diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index b80d877..18cd55c 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/Area.ts","../src/AreaAllocator.ts","../src/AtlasResource.ts","../src/GuilloteneAllocator.ts","../src/TextureSlab.ts","../src/TextureAllocator.ts","../src/AtlasAllocator.ts","../src/CanvasTextureAllocator.ts","../src/RenderTextureAllocator.ts","../src/index.ts"],"names":[],"mappings":";IAAA;;;;OAIG;IACH,MAAM,MAAM,eAAe;QACvB,UAAU,IAAI;QACd,QAAQ,IAAI;KACf;IAED;;;;OAIG;IACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;IAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,MAAM,OAAO,IAAI;QAEb,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;QAKrF,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;QAK7C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;QAK9C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe;QAKvD,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;QAS7D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;KAQjE;;;IC1GD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;IAE3C;;;OAGG;IACH,MAAM,WAAW,aAAa,CAAC,CAAC;QAE5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAExB,QAAQ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AAS,CAAC,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,GAAG,aAAa;KAIrF;;;ICxCD,qBAAuB;IACvB,8BAAgC;IAChC,+BAAiC;IACjC,8BAAgC;IAChC,uCAAyC;IACzC,oCAAsC;IACtC,uCAAyC;IACzC,iCAAmC;IACnC,4BAA8B"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/Area.ts","../src/AreaAllocator.ts","../src/AtlasResource.ts","../src/GuilloteneAllocator.ts","../src/TextureSlab.ts","../src/TextureAllocator.ts","../src/AtlasAllocator.ts","../src/CanvasTextureAllocator.ts","../src/RenderTextureAllocator.ts","../src/index.ts"],"names":[],"mappings":";IAAA;;;;OAIG;IACH,MAAM,MAAM,eAAe;QACvB,UAAU,IAAI;QACd,QAAQ,IAAI;KACf;IAED;;;;OAIG;IACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;IAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,MAAM,OAAO,IAAI;QAEb,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;QAKrF,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;QAK7C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;QAK9C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe;QAKvD,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;QAS7D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;KAQjE;;;IC1GD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;IAE3C;;;OAGG;IACH,MAAM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M,OAAO,sBAAuB,SAAQ,gBAAgB,CAAC,aAAa,CAAC;QAEvE;;WAEG;QACH,SAAS,CAAC,UAAU,IAAI,WAAW;QAYnC;;;;;WAKG;QACH,SAAS,CAAC,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,GAAG,aAAa;KAIrF;;;ICxCD,qBAAuB;IACvB,8BAAgC;IAChC,+BAAiC;IACjC,8BAAgC;IAChC,uCAAyC;IACzC,oCAAsC;IACtC,uCAAyC;IACzC,iCAAmC;IACnC,4BAA8B"} \ No newline at end of file diff --git a/dist/pixi-texture-allocator.cjs b/dist/pixi-texture-allocator.cjs index a981229..a5e4b9b 100644 --- a/dist/pixi-texture-allocator.cjs +++ b/dist/pixi-texture-allocator.cjs @@ -130,9 +130,6 @@ var AtlasResource = class extends import_core.Resource { * @param item - The item to upload. */ uploadItem(renderer, target, format, type, item) { - if (item.updateId === item.dirtyId) { - return; - } const gl = renderer.gl; const isWebGL2 = gl instanceof WebGL2RenderingContext; const frame = item.frame; diff --git a/dist/pixi-texture-allocator.cjs.map b/dist/pixi-texture-allocator.cjs.map index 12c81c9..86090ff 100644 --- a/dist/pixi-texture-allocator.cjs.map +++ b/dist/pixi-texture-allocator.cjs.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/index.ts", "../src/Area.ts", "../src/AtlasResource.ts", "../src/AtlasAllocator.ts", "../src/GuilloteneAllocator.ts", "../src/TextureAllocator.ts", "../src/CanvasTextureAllocator.ts", "../src/RenderTextureAllocator.ts"], - "sourcesContent": ["export * from './Area';\nexport * from './AreaAllocator';\nexport * from './AtlasAllocator';\nexport * from './AtlasResource';\nexport * from './CanvasTextureAllocator';\nexport * from './GuilloteneAllocator';\nexport * from './RenderTextureAllocator';\nexport * from './TextureAllocator';\nexport * from './TextureSlab';", "/**\n * The orientation of an area indicates the axis along which it is split. This is a 1-bit field.\n *\n * @public\n */\nexport enum AreaOrientation {\n HORIZONTAL = 0,\n VERTICAL = 1\n};\n\n/**\n * Alias for the 31-bit field texture-area type.\n *\n * @public\n */\nexport type AreaField = number;\n\n/**\n * An area represents an oriented rectangular region. It is implemented as a 31-bit field. The open/close edges are\n * specified along its parent's orientation axis, i.e. if the parent is horizontal, the left and right edges are defined,\n * else if the parent is vertical, the top and bottom edges are defined. Similarly, the open/close edges of its\n * children will be along its own orientation axis.\n *\n * The orientation axes flip-flop along the hierarchy, i.e. an area's parent's orientation is always opposite to\n * the area's own orientation. This is because if the orientation were to be same, the area's children could be\n * \"pulled up\" to the parent making itself redundant.\n *\n * All four edges of an area can be retrieved from it and its parent.\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
FieldBitsDescription
OPEN_OFFSET0-14\n * The offset along the parent's axis at which the area begins. If orientation is horizontal,\n * this is the left edge. If orientation is vertical, this is the top edge.\n *
CLOSE_OFFSET15-29\n * The offset along the parent's axis at which the area ends. If orientation is horizontal,\n * this is the right edge. If orientation is vertical, this is the bottom edge.\n *
ORIENTATION30\n * The orientation of the area, which indicates the axis along it is split. The open and close\n * offsets of its children are along this axis. See {@link AreaOrientation}.\n *
\n *\n * @public\n */\nexport class Area\n{\n static makeArea(openOffset: number, closeOffset: number, orientation: number): number\n {\n return openOffset | (closeOffset << 15) | (orientation << 30);\n }\n\n static getOpenOffset(area: AreaField): number\n {\n return area & ((1 << 15) - 1);\n }\n\n static getCloseOffset(area: AreaField): number\n {\n return (area >> 15) & ((1 << 15) - 1);\n }\n\n static getOrientation(area: AreaField): AreaOrientation\n {\n return (area >> 30) & 1;\n }\n\n static setOpenOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n offset,\n Area.getCloseOffset(area),\n Area.getOrientation(area)\n );\n }\n\n static setCloseOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n Area.getOpenOffset(offset),\n offset,\n Area.getOrientation(area)\n );\n }\n}", "import { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, GLTexture, Resource, Renderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Texture } from '@pixi/core';\n\n/**\n * Types of image sources supported by {@link AtlasResource}.\n *\n * @public\n */\nexport type AtlasResourceSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData | ArrayBufferView;\n\n/**\n * An item that is uploaded to the atlas texture.\n *\n * @public\n */\nexport type AtlasResourceItem =\n{\n /**\n * The location of the atlas item in the base-texture's space.\n */\n frame: Rectangle;\n\n /**\n * The source of the texture data.\n */\n source: AtlasResourceSource;\n\n /**\n * This flags when the resource is to be re-uploaded.\n */\n dirtyId: number;\n\n /**\n * This flags when the resource is uploaded and update-to-date with the dirty ID.\n */\n updateId: number;\n\n /**\n * The texture holding this item.\n */\n texture: Texture;\n};\n\n/**\n * An {@code AtlasResource} is used by {@link AtlasAllocator} to manage texture sources\n *\n * @public\n */\nexport class AtlasResource extends Resource\n{\n /**\n * The list of managed resources in the atlas.\n */\n public managedItems: AtlasResourceItem[];\n\n /**\n * Creates an atlas resource.\n *\n * @param width\n * @param height\n */\n constructor(width: number, height: number)\n {\n super(width, height);\n\n this.managedItems = [];\n }\n\n /**\n * Uploads the atlas.\n *\n * @param renderer\n * @param baseTexture\n * @param glTexture\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl: WebGLRenderingContext = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK)\n\n // Allocate the texture on the GPU\n if (glTexture.width !== width ||\n glTexture.height !== height)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n baseTexture.format,\n width,\n height,\n 0,\n baseTexture.format,\n baseTexture.type,\n undefined\n );\n }\n\n const items = this.managedItems;\n\n // Upload all atlas items.\n for (let i = 0, j = items.length; i < j; i++)\n {\n this.uploadItem(\n renderer,\n baseTexture.target,\n baseTexture.format,\n baseTexture.type,\n items[i]\n );\n }\n\n return true;\n }\n\n /**\n * Uploads the atlas item to the GPU.\n *\n * @param renderer - The renderer holding the WebGL context.\n * @param target - The binding point of the base-texture.\n * @param format - The format of the base-texture.\n * @param type - The type of the base-texture data.\n * @param item - The item to upload.\n */\n protected uploadItem(\n renderer: Renderer,\n target: number,\n format: number,\n type: number,\n item: AtlasResourceItem\n ): void\n {\n if (item.updateId === item.dirtyId)\n {\n return;\n }\n\n const gl: WebGLRenderingContext = renderer.gl;\n const isWebGL2 = (gl instanceof WebGL2RenderingContext);\n const frame = item.frame;\n let source = item.source;\n\n // if WebGL1, convert whatever we have into a typed array\n if (!isWebGL2) {\n if (source instanceof ImageData) {\n source = source.data; // pass the typed array directly\n\n } else if (source instanceof HTMLCanvasElement) {\n const ctx = source.getContext('2d');\n const [w, h] = [source.width, source.height];\n source = ctx.getImageData(0, 0, w, h).data;\n\n } else if (source instanceof HTMLImageElement) {\n const [w, h] = [source.naturalWidth, source.naturalHeight];\n const canvas = document.createElement('canvas');\n canvas.width = w;\n canvas.height = h;\n\n const ctx = canvas.getContext('2d');\n ctx.drawImage(source, 0, 0);\n source = ctx.getImageData(0, 0, w, h).data;\n }\n }\n\n gl.texSubImage2D(\n target,\n 0,\n frame.x,\n frame.y,\n frame.width,\n frame.height,\n format,\n type,\n source as any,\n );\n\n item.updateId = item.dirtyId;\n }\n}", "import { AtlasResource } from './AtlasResource';\nimport { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\nimport type { AtlasResourceSource } from './AtlasResource';\n\n/**\n * This texture allocator auto-manages the base-texture with an {@link AtlasResource}. You can also\n * pass a texture source to `allocate`, mimicing {@link Texture.from} functionality.\n *\n * @public\n */\nexport class AtlasAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by an {@link AtlasResource}.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(new AtlasResource(this.slabWidth, this.slabHeight),\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Allocates a texture backed by the given atlas source, with the given padding.\n *\n * @override\n * @param width\n * @param height\n * @param padding\n * @param source\n */\n allocate(width: number, height: number, padding?: number, source?: AtlasResourceSource): Texture;\n\n /**\n * Allocates a texture backed by the given source, with default padding.\n *\n * @param width\n * @param height\n * @param source\n */\n allocate(width: number, height: number, source?: AtlasResourceSource): Texture;\n\n allocate(width: number, height: number, paddingOrSource?: number | AtlasResourceSource, source?: AtlasResourceSource): Texture\n {\n let padding: number;\n\n if (typeof paddingOrSource === 'number')\n {\n padding = paddingOrSource;\n }\n else\n {\n padding = this.calculatePadding(width, height);\n source = paddingOrSource;\n }\n\n const texture = super.allocate(width, height, padding);\n\n if (source)\n {\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = {\n frame: texture.frame,\n source,\n // dirtyId !== updateId only if image loaded\n dirtyId: source instanceof HTMLImageElement && !source.complete ? -1 : 0,\n updateId: -1,\n texture,\n };\n\n atlas.managedItems.push(item);\n\n if (source instanceof HTMLImageElement && !source.complete) {\n source.addEventListener('load', () => {\n if (texture.baseTexture.valid && !texture.baseTexture.destroyed && atlas.managedItems.indexOf(item) >= 0) {\n item.dirtyId++;\n texture.baseTexture.update();\n }\n });\n }\n\n texture.baseTexture.update();\n }\n\n return texture;\n }\n\n free(texture: Texture): void\n {\n super.free(texture);\n\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = atlas.managedItems.find(item => item.texture === texture);\n\n if (item)\n {\n atlas.managedItems.splice(atlas.managedItems.indexOf(item), 1);\n }\n }\n}", "import { Rectangle } from '@pixi/math';\nimport { Area, AreaOrientation } from './Area';\n\nimport type { AreaAllocator } from './AreaAllocator';\nimport type { AreaField } from './Area';\n\n/**\n * An allocator node is represented as a tuple. The zeroth element is the parent of the node. The first element\n * always exists and is the texture area it wholly represents. The second element is whether the rectangle\n * is allocated or free. The last element is optional and is the list\n * of its children.\n *\n * @public\n * @ignore\n */\nexport type AreaNode = [AreaNode, AreaField, boolean] | [AreaNode, AreaField, AreaNode[]];\n\n/**\n * Pointer to guillotene node.\n *\n * @public\n * @ignore\n */\nexport type AreaPtr = { __mem_area: AreaNode };\n\n/**\n * @public\n * @ignore\n */\nexport enum SPLIT_ORIENTATION {\n HOR = 0,\n VERT = 1,\n NONE = 2\n}\n\nconst tempRect = new Rectangle();\n\n/** @public */\nexport class GuilloteneAllocator implements AreaAllocator\n{\n protected _root: AreaNode;\n\n private _width: number;\n private _height: number;\n\n constructor(width: number, height: number)\n {\n this._width = width;\n this._height = height;\n\n // NOTE: getFrame assumes root node is always horizontal!\n this._root = [\n null,\n Area.makeArea(0, this._height, AreaOrientation.HORIZONTAL),\n false\n ];\n }\n\n /**\n * Allocates an area of the given `width` and `height`.\n *\n * @param width - The width required for the allocated area.\n * @param height - The height required for the allocated area.\n * @param rect - An optional `Rectangle` instance to put the resulting area frame into.\n * @return The rectangle frame of the area allocated.\n */\n allocate(width: number, height: number, rect?: Rectangle): Rectangle & AreaPtr\n {\n const area = this.findArea(width, height);\n\n if (!area)\n {\n return null;\n }\n\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n this.getFrame(area, rect);\n\n const hole = new Rectangle(rect.x, rect.y, width, height);\n const node = this.split(area, rect, hole);\n\n rect.copyFrom(hole);\n (rect as any).__mem_area = node;\n\n return rect as (Rectangle & AreaPtr);\n }\n\n /**\n * Frees the area represented by the given area pointer. The original rectangle returned by\n * {@link GuilloteneAllocator#allocate} included this pointer (the `__mem_area` property).\n *\n * @param areaPtr\n */\n free(areaPtr: AreaPtr): void\n {\n const area = areaPtr.__mem_area;\n\n area[2] = false;\n this.merge(area);\n }\n\n get width(): number\n {\n return this._width;\n }\n\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Returns the [area]{@link Area} data for the node.\n *\n * @param node\n * @returns The area data for the node.\n */\n protected getAreaField(node: AreaNode): AreaField\n {\n return node[1];\n }\n\n /**\n * Returns the rectangle covered by the area node.\n *\n * @param node - The node whose covered rectangular area is needed.\n * @param rect - An optional `Rectangle` instance to put the data in.\n * @return The rectangle covered by `node`.\n */\n protected getFrame(node: AreaNode, rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n const nodeArea = this.getAreaField(node);\n const nodeParent = this.getParent(node);\n const nodeOrientation = Area.getOrientation(nodeArea);\n const nodeOpen = Area.getOpenOffset(nodeArea);\n const nodeClose = Area.getCloseOffset(nodeArea);\n const parentOpen = nodeParent ? Area.getOpenOffset(nodeParent[1]) : 0;\n const parentClose = nodeParent ? Area.getCloseOffset(nodeParent[1]) : this._width;// (because root node is horizontal)\n\n if (nodeOrientation) // VERTICAL\n {\n rect.x = nodeOpen;\n rect.y = parentOpen;\n rect.width = nodeClose - rect.x;\n rect.height = parentClose - parentOpen;\n }\n else // HORIZONTAL\n {\n rect.x = parentOpen;\n rect.y = nodeOpen;\n rect.width = parentClose - rect.x;\n rect.height = nodeClose - rect.y;\n }\n\n return rect;\n }\n\n /**\n * Returns the parent of the area node.\n *\n * @param node\n * @return The parent of `node`\n */\n protected getParent(node: AreaNode): AreaNode\n {\n return node[0];\n }\n\n /**\n * Returns whether the given node has any children.\n *\n * @param node\n * @return Whether the given node has any children.\n */\n protected hasChildren(node: AreaNode): boolean\n {\n return (Array.isArray(node[2]) && (node[2].length !== 0));\n }\n\n /**\n * Returns the children of the passed node, if any.\n *\n * @param node\n */\n protected getChildren(node: AreaNode): AreaNode[]\n {\n if (!Array.isArray(node[2])) {\n throw new Error(\"Children don't exist\")\n }\n\n return node[2];\n }\n\n protected addChild(parent: AreaNode, ...nodes: AreaNode[]): void\n {\n parent[2] = Array.isArray(parent[2]) ? parent[2] : []\n parent[2].push(...nodes)\n }\n\n /**\n * Finds an area node with minimum width `aw` and minimum height `ah`.\n *\n * @param aw\n * @param ah\n */\n protected findArea(aw: number, ah: number): AreaNode\n {\n return this.findAreaRecursive(this._root, aw, ah);\n }\n\n /**\n * The recursive implementation for {@link AreaAllocator#findArea}.\n *\n * @param rootArea\n * @param aw\n * @param ah\n */\n protected findAreaRecursive(rootArea: AreaNode, aw: number, ah: number): AreaNode\n {\n const frame = this.getFrame(rootArea, tempRect);\n\n if (frame.width < aw || frame.height < ah)\n {\n return null;\n }\n\n if (!this.hasChildren(rootArea))\n {\n const dx = frame.width - aw;\n const dy = frame.height - ah;\n\n if (dx < 0 || dy < 0 || rootArea[2])\n {\n return null;\n }\n\n return rootArea;\n }\n\n const children = this.getChildren(rootArea);\n\n let bestCandidate = null;\n let bestCandidateScore = Infinity;\n\n for (let i = 0, j = children.length; i < j; i++)\n {\n const candidate = this.findAreaRecursive(children[i], aw, ah);\n\n if (!candidate)\n {\n continue;\n }\n\n const candidateFrame = this.getFrame(candidate, tempRect);\n\n const dx = candidateFrame.width - aw;\n const dy = candidateFrame.height - ah;\n\n if (dx < 0 || dy < 0)\n {\n continue;\n }\n if (!dx && !dy)\n {\n // Perfect fit!\n return candidate;\n }\n\n const score = Math.min(dx, dy);\n\n if (bestCandidateScore > score)\n {\n bestCandidate = candidate;\n bestCandidateScore = score;\n }\n }\n\n return bestCandidate;\n }\n\n /**\n * Returns the orientation of the primary split of host.\n */\n protected splitOrientation(host: Rectangle, hole: Rectangle): SPLIT_ORIENTATION\n {\n if (hole.width === host.width && hole.height === host.height) {\n return SPLIT_ORIENTATION.NONE;\n }\n if (hole.width === host.width) {\n return SPLIT_ORIENTATION.VERT;\n }\n if (hole.height === host.height) {\n return SPLIT_ORIENTATION.HOR;\n }\n\n // ____________________\n // | | |\n // | | |\n // | hole | |\n // | | |\n // |________| Primary |\n // | | |\n // | | |\n // | Sec. | |\n // |________|_________|\n const horAreaDiff = Math.abs(\n // (Primary) Right\n (host.width - hole.width) * host.height -\n // (Secondary) Bottom\n hole.width * (host.height - hole.height)\n )\n\n // ____________________\n // | | |\n // | | |\n // | hole | Sec. |\n // | | |\n // |________|_________|\n // | |\n // | Primary |\n // |__________________|\n const verAreaDiff = Math.abs(\n // (Primary) Bottom\n host.width * (host.height - hole.height) -\n (host.width - hole.width) * hole.height\n )\n\n if (horAreaDiff > verAreaDiff)\n {\n return SPLIT_ORIENTATION.HOR\n }\n else\n {\n return SPLIT_ORIENTATION.VERT\n }\n }\n\n protected split(\n area: AreaNode,\n areaFrame: Rectangle,\n holeFrame: Rectangle,\n orientation: SPLIT_ORIENTATION = this.getParent(area) ? this.splitOrientation(areaFrame, holeFrame) : SPLIT_ORIENTATION.HOR\n ): AreaNode\n {\n if (area[2] === true)\n {\n throw new Error('Cannot deallocate')\n }\n if (orientation === SPLIT_ORIENTATION.NONE)\n {\n area[2] = true;\n return area;\n }\n\n return this[orientation === SPLIT_ORIENTATION.HOR\n ? 'splitPrimaryHorizontal'\n : 'splitPrimaryVertical'](area, areaFrame, holeFrame);\n }\n\n private splitPrimaryHorizontal(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area))\n {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const firstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n []\n ];\n const secondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.HORIZONTAL) {\n this.addChild(area, firstChild, secondChild)\n } else {\n const i = this.getChildren(parent).indexOf(area);\n\n firstChild[0] = parent;\n secondChild[0] = parent;\n\n this.getChildren(parent).splice(i, 1, firstChild, secondChild);\n }\n\n if (holeFrame.height !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n this.addChild(firstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (firstChild as AreaNode)[2] = true;\n }\n\n return firstChild;\n }\n\n private splitPrimaryVertical(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area)) {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const primaryFirstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n []\n ];\n const primarySecondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.VERTICAL)\n {\n this.addChild(area, primaryFirstChild, primarySecondChild);\n }\n else\n {\n const i = this.getChildren(parent).indexOf(area);\n primaryFirstChild[0] = parent;\n primarySecondChild[0] = parent;\n this.getChildren(parent).splice(i, 1, primaryFirstChild, primarySecondChild);\n }\n\n if (holeFrame.width !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n this.addChild(primaryFirstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (primaryFirstChild as AreaNode)[2] = true;\n }\n\n return primaryFirstChild;\n }\n\n protected merge(\n area: AreaNode\n ) {\n if (this.hasChildren(area))\n {\n throw new Error(\"Cannot merge a non-leaf node\");\n }\n\n const parent = this.getParent(area);\n\n if (!parent)\n {\n return;\n }\n\n const siblings = this.getChildren(parent);\n const i = siblings.indexOf(area);\n\n const leftSibling = siblings[i - 1];\n const rightSibling = siblings[i + 1];\n\n if (rightSibling && rightSibling[2] === false)\n {\n // Merge rightSibling into area\n area[1] = Area.setCloseOffset(area[1], Area.getCloseOffset(rightSibling[1]));\n siblings.splice(i + 1, 1);\n }\n if (leftSibling && leftSibling[2] === false)\n {\n // Merge leftSibling into area\n area[1] = Area.setOpenOffset(area[1], Area.getOpenOffset(leftSibling[1]));\n siblings.splice(i - 1, 1);\n }\n\n if (siblings.length === 1) {\n parent[2] = false;\n this.merge(parent);\n }\n }\n\n private printState(area: AreaNode): void\n {\n if (!this.hasChildren(area)) {\n console.log({ ...this.getFrame(area) }, area[2])\n } else {\n this.getChildren(area).forEach(n => this.printState(n))\n }\n }\n}", "import { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { Rectangle } from '@pixi/math';\n\nimport type { TextureSlab } from './TextureSlab';\n\nconst tempRect = new Rectangle();\n\n/**\n * The texture allocator dynamically manages space on base-texture slabs. It can be used to generate\n * atlases on demand, which improve batching efficiency.\n *\n * @public\n */\nexport class TextureAllocator\n{\n /**\n * The width of texture slabs.\n */\n public readonly slabWidth: number;\n\n /**\n * The height of texture slabs.\n */\n public readonly slabHeight: number;\n\n /**\n * The list of base-textures that are used to allocate texture space.\n */\n protected textureSlabs: TextureSlab[];\n\n /**\n * @param slabWidth - The width of base-texture slabs. This should be at most 2048.\n * @param slabHeight - The height of base-texture slabs. This should be at most 2048.\n */\n constructor(slabWidth = 2048, slabHeight = 2048)\n {\n this.slabWidth = slabWidth;\n this.slabHeight = slabHeight;\n\n this.textureSlabs = [];\n }\n\n get maxWidth() {\n return this.slabWidth - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n get maxHeight() {\n return this.slabHeight - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n /**\n * Allocates a texture from this allocator.\n *\n * If its existing slab pool has enough space, the texture is issued from one. Otherwise,\n * a new slab is created and the texture is issued from it. However, if the requested\n * dimensions are larger than slabs themselves, then `null` is always returned.\n *\n * To upload a texture source, you will have to create an atlas-managing {@link Resource}\n * yourself on the base-texture. The {@link AtlasAllocator} does this for you, while the\n * {@link CanvasTextureAllocator} can be used to draw on a canvas-based atlas.\n *\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - The padding requested around the texture, to prevent bleeding.\n * @return The allocated texture, if successful; otherwise, `null`.\n */\n allocate(width: number, height: number, padding = this.calculatePadding(width, height)): T\n {\n // Cannot allocate a texture larger than a texture-slab.\n if (width + 2 * padding > this.slabWidth ||\n height + 2 * padding > this.slabHeight)\n {\n return null;\n }\n\n const slabs = this.textureSlabs;\n\n // Loop through the slabs and find one with enough space, if any.\n for (let i = 0, j = slabs.length; i < j; i++)\n {\n const slab = slabs[i];\n const texture = this.issueTexture(slab, width, height, padding);\n\n if (texture)\n {\n return texture;\n }\n }\n\n // Issue a new slab.\n const slab = this.createSlab();\n\n // Append this slab to the head of the list.\n this.textureSlabs.unshift(slab);\n\n // Issue the texture from this blank slab.\n return this.issueTexture(slab, width, height, padding);\n }\n\n /**\n * Frees the texture and reclaims its space. It is assumed you will not use it again, and have\n * destroyed any resource uploading its data.\n *\n * @param texture\n * @throws When the texture was not located in this allocator.\n */\n free(texture: T): void\n {\n const baseTexture = (texture as Texture).baseTexture;\n const slab = this.textureSlabs.find(sl => sl.slab === baseTexture);\n\n if (!slab)\n {\n throw new Error(\"The texture cannot be freed because \" +\n \"its base-texture is not pooled by this allocator. \" +\n \"This is either a bug in TextureAllocator or you tried to free a \" +\n \"texture that was never allocated by one.\");\n }\n\n const textureEntry = slab.managedTextures.find(entry => entry.texture === texture);\n\n if (!textureEntry)\n {\n throw new Error(\"The texture cannot be freed because it was not found \" +\n \"in the managed list of issued textures on its slab. This may be because you \" +\n \"duplicated this texture or a bug in TextureAllocator\");\n }\n\n slab.managedArea.free(textureEntry.area);\n slab.managedTextures.splice(slab.managedTextures.indexOf(textureEntry), 1);\n }\n\n protected calculatePadding(width: number, height: number): number\n {\n const dimen = Math.max(width, height);\n\n if (dimen < 64)\n {\n return 2;\n }\n else if (dimen < 128)\n {\n return 4;\n }\n else if (dimen < 1024)\n {\n return 8;\n }\n else\n {\n return 16;\n }\n }\n\n /**\n * Creates a texture slab. The slab's base-texture is not backed by any resource. You\n * will have to manage that yourself. See {@link AtlasAllocator} or {@link CanvasTextureAllocator}\n * for better resource semantics.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(null,\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Creates a texture on the given base-texture at {@code frame}.\n *\n * @param baseTexture - The base texture that will hold the texture's space.\n * @param frame - The frame in which the texture will be stored.\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): T\n {\n // Override this method to return correct texture type T.\n return new Texture(baseTexture, frame) as T;\n }\n\n /**\n * Issues a texture from the given texture slab, if possible.\n *\n * @param slab - The texture slab to allocate frame.\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - Padding required around the texture.\n * @return The issued texture, if successful; otherwise, `null`.\n */\n protected issueTexture(slab: TextureSlab, width: number, height: number, padding = 0): T\n {\n const area = slab.managedArea.allocate(width + 2 * padding, height + 2 * padding);\n\n if (!area)\n {\n return null;\n }\n\n tempRect.copyFrom(area);\n tempRect.pad(-padding);\n\n const baseTexture = slab.slab;\n const issuedTexture = this.createTexture(baseTexture, tempRect.clone());\n\n slab.managedTextures.push({\n area,\n texture: issuedTexture,\n });\n\n return issuedTexture;\n }\n}", "import { BaseTexture } from '@pixi/core';\n\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues texture backed by a canvas. You can draw on to that canvas to soruce\n * each texture.\n *\n * @public\n */\nexport class CanvasTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a canvas.\n */\n protected createSlab(): TextureSlab\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = this.slabWidth;\n canvas.height = this.slabHeight;\n\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(canvas, {\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n}", "import { BaseRenderTexture, RenderTexture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\n\nimport type { BaseTexture } from '@pixi/core';\nimport type { Rectangle } from '@pixi/math';\nimport type { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues render-textures, and is otherwise just like {@link TextureAllocator}.\n *\n * @public\n */\nexport class RenderTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a base render-texture.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseRenderTexture({\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n\n /**\n * Creates a render-texture from the given base render-texture.\n *\n * @param baseTexture\n * @param frame\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): RenderTexture\n {\n return new RenderTexture(baseTexture as BaseRenderTexture, frame);\n }\n}"], - "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAK,kBA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,EACJ;AACJ;;;AG7GA,IAAAC,eAA4B;AAYrB,IAAM,yBAAN,cAAqC,iBAC5C;AAAA;AAAA;AAAA;AAAA,EAIc,aACV;AACI,UAAM,SAAS,SAAS,cAAc,QAAQ;AAE9C,WAAO,QAAQ,KAAK;AACpB,WAAO,SAAS,KAAK;AAErB,WAAO;AAAA,MACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,MACpE,iBAAiB,CAAC;AAAA,MAClB,MAAM,IAAI,yBAAY,QAAQ;AAAA,QAC1B,OAAO,KAAK;AAAA,QACZ,QAAQ,KAAK;AAAA,MACjB,CAAC;AAAA,IACL;AAAA,EACJ;AACJ;;;ACjCA,IAAAC,eAAiD;AAa1C,IAAM,yBAAN,cAAqC,iBAC5C;AAAA;AAAA;AAAA;AAAA,EAIc,aACV;AACI,WAAO;AAAA,MACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,MACpE,iBAAiB,CAAC;AAAA,MAClB,MAAM,IAAI,+BAAkB;AAAA,QACxB,OAAO,KAAK;AAAA,QACZ,QAAQ,KAAK;AAAA,MACjB,CAAC;AAAA,IACL;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQU,cAAc,aAA0B,OAClD;AACI,WAAO,IAAI,2BAAc,aAAkC,KAAK;AAAA,EACpE;AACJ;", + "sourcesContent": ["export * from './Area';\nexport * from './AreaAllocator';\nexport * from './AtlasAllocator';\nexport * from './AtlasResource';\nexport * from './CanvasTextureAllocator';\nexport * from './GuilloteneAllocator';\nexport * from './RenderTextureAllocator';\nexport * from './TextureAllocator';\nexport * from './TextureSlab';", "/**\n * The orientation of an area indicates the axis along which it is split. This is a 1-bit field.\n *\n * @public\n */\nexport enum AreaOrientation {\n HORIZONTAL = 0,\n VERTICAL = 1\n};\n\n/**\n * Alias for the 31-bit field texture-area type.\n *\n * @public\n */\nexport type AreaField = number;\n\n/**\n * An area represents an oriented rectangular region. It is implemented as a 31-bit field. The open/close edges are\n * specified along its parent's orientation axis, i.e. if the parent is horizontal, the left and right edges are defined,\n * else if the parent is vertical, the top and bottom edges are defined. Similarly, the open/close edges of its\n * children will be along its own orientation axis.\n *\n * The orientation axes flip-flop along the hierarchy, i.e. an area's parent's orientation is always opposite to\n * the area's own orientation. This is because if the orientation were to be same, the area's children could be\n * \"pulled up\" to the parent making itself redundant.\n *\n * All four edges of an area can be retrieved from it and its parent.\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
FieldBitsDescription
OPEN_OFFSET0-14\n * The offset along the parent's axis at which the area begins. If orientation is horizontal,\n * this is the left edge. If orientation is vertical, this is the top edge.\n *
CLOSE_OFFSET15-29\n * The offset along the parent's axis at which the area ends. If orientation is horizontal,\n * this is the right edge. If orientation is vertical, this is the bottom edge.\n *
ORIENTATION30\n * The orientation of the area, which indicates the axis along it is split. The open and close\n * offsets of its children are along this axis. See {@link AreaOrientation}.\n *
\n *\n * @public\n */\nexport class Area\n{\n static makeArea(openOffset: number, closeOffset: number, orientation: number): number\n {\n return openOffset | (closeOffset << 15) | (orientation << 30);\n }\n\n static getOpenOffset(area: AreaField): number\n {\n return area & ((1 << 15) - 1);\n }\n\n static getCloseOffset(area: AreaField): number\n {\n return (area >> 15) & ((1 << 15) - 1);\n }\n\n static getOrientation(area: AreaField): AreaOrientation\n {\n return (area >> 30) & 1;\n }\n\n static setOpenOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n offset,\n Area.getCloseOffset(area),\n Area.getOrientation(area)\n );\n }\n\n static setCloseOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n Area.getOpenOffset(offset),\n offset,\n Area.getOrientation(area)\n );\n }\n}", "import { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, GLTexture, Resource, Renderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Texture } from '@pixi/core';\n\n/**\n * Types of image sources supported by {@link AtlasResource}.\n *\n * @public\n */\nexport type AtlasResourceSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData | ArrayBufferView;\n\n/**\n * An item that is uploaded to the atlas texture.\n *\n * @public\n */\nexport type AtlasResourceItem =\n{\n /**\n * The location of the atlas item in the base-texture's space.\n */\n frame: Rectangle;\n\n /**\n * The source of the texture data.\n */\n source: AtlasResourceSource;\n\n /**\n * This flags when the resource is to be re-uploaded.\n */\n dirtyId: number;\n\n /**\n * This flags when the resource is uploaded and update-to-date with the dirty ID.\n */\n updateId: number;\n\n /**\n * The texture holding this item.\n */\n texture: Texture;\n};\n\n/**\n * An {@code AtlasResource} is used by {@link AtlasAllocator} to manage texture sources\n *\n * @public\n */\nexport class AtlasResource extends Resource\n{\n /**\n * The list of managed resources in the atlas.\n */\n public managedItems: AtlasResourceItem[];\n\n /**\n * Creates an atlas resource.\n *\n * @param width\n * @param height\n */\n constructor(width: number, height: number)\n {\n super(width, height);\n\n this.managedItems = [];\n }\n\n /**\n * Uploads the atlas.\n *\n * @param renderer\n * @param baseTexture\n * @param glTexture\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl: WebGLRenderingContext = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK)\n\n // Allocate the texture on the GPU\n if (glTexture.width !== width ||\n glTexture.height !== height)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n baseTexture.format,\n width,\n height,\n 0,\n baseTexture.format,\n baseTexture.type,\n undefined\n );\n }\n\n const items = this.managedItems;\n\n // Upload all atlas items.\n for (let i = 0, j = items.length; i < j; i++)\n {\n this.uploadItem(\n renderer,\n baseTexture.target,\n baseTexture.format,\n baseTexture.type,\n items[i]\n );\n }\n\n return true;\n }\n\n /**\n * Uploads the atlas item to the GPU.\n *\n * @param renderer - The renderer holding the WebGL context.\n * @param target - The binding point of the base-texture.\n * @param format - The format of the base-texture.\n * @param type - The type of the base-texture data.\n * @param item - The item to upload.\n */\n protected uploadItem(\n renderer: Renderer,\n target: number,\n format: number,\n type: number,\n item: AtlasResourceItem\n ): void\n {\n // see https://github.com/rapideditor/pixi-texture-allocator/issues/2\n // if (item.updateId === item.dirtyId)\n // {\n // return;\n // }\n\n const gl: WebGLRenderingContext = renderer.gl;\n const isWebGL2 = (gl instanceof WebGL2RenderingContext);\n const frame = item.frame;\n let source = item.source;\n\n // if WebGL1, convert whatever we have into a typed array\n if (!isWebGL2) {\n if (source instanceof ImageData) {\n source = source.data; // pass the typed array directly\n\n } else if (source instanceof HTMLCanvasElement) {\n const ctx = source.getContext('2d');\n const [w, h] = [source.width, source.height];\n source = ctx.getImageData(0, 0, w, h).data;\n\n } else if (source instanceof HTMLImageElement) {\n const [w, h] = [source.naturalWidth, source.naturalHeight];\n const canvas = document.createElement('canvas');\n canvas.width = w;\n canvas.height = h;\n\n const ctx = canvas.getContext('2d');\n ctx.drawImage(source, 0, 0);\n source = ctx.getImageData(0, 0, w, h).data;\n }\n }\n\n gl.texSubImage2D(\n target,\n 0,\n frame.x,\n frame.y,\n frame.width,\n frame.height,\n format,\n type,\n source as any,\n );\n\n item.updateId = item.dirtyId;\n }\n}", "import { AtlasResource } from './AtlasResource';\nimport { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\nimport type { AtlasResourceSource } from './AtlasResource';\n\n/**\n * This texture allocator auto-manages the base-texture with an {@link AtlasResource}. You can also\n * pass a texture source to `allocate`, mimicing {@link Texture.from} functionality.\n *\n * @public\n */\nexport class AtlasAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by an {@link AtlasResource}.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(new AtlasResource(this.slabWidth, this.slabHeight),\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Allocates a texture backed by the given atlas source, with the given padding.\n *\n * @override\n * @param width\n * @param height\n * @param padding\n * @param source\n */\n allocate(width: number, height: number, padding?: number, source?: AtlasResourceSource): Texture;\n\n /**\n * Allocates a texture backed by the given source, with default padding.\n *\n * @param width\n * @param height\n * @param source\n */\n allocate(width: number, height: number, source?: AtlasResourceSource): Texture;\n\n allocate(width: number, height: number, paddingOrSource?: number | AtlasResourceSource, source?: AtlasResourceSource): Texture\n {\n let padding: number;\n\n if (typeof paddingOrSource === 'number')\n {\n padding = paddingOrSource;\n }\n else\n {\n padding = this.calculatePadding(width, height);\n source = paddingOrSource;\n }\n\n const texture = super.allocate(width, height, padding);\n\n if (source)\n {\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = {\n frame: texture.frame,\n source,\n // dirtyId !== updateId only if image loaded\n dirtyId: source instanceof HTMLImageElement && !source.complete ? -1 : 0,\n updateId: -1,\n texture,\n };\n\n atlas.managedItems.push(item);\n\n if (source instanceof HTMLImageElement && !source.complete) {\n source.addEventListener('load', () => {\n if (texture.baseTexture.valid && !texture.baseTexture.destroyed && atlas.managedItems.indexOf(item) >= 0) {\n item.dirtyId++;\n texture.baseTexture.update();\n }\n });\n }\n\n texture.baseTexture.update();\n }\n\n return texture;\n }\n\n free(texture: Texture): void\n {\n super.free(texture);\n\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = atlas.managedItems.find(item => item.texture === texture);\n\n if (item)\n {\n atlas.managedItems.splice(atlas.managedItems.indexOf(item), 1);\n }\n }\n}", "import { Rectangle } from '@pixi/math';\nimport { Area, AreaOrientation } from './Area';\n\nimport type { AreaAllocator } from './AreaAllocator';\nimport type { AreaField } from './Area';\n\n/**\n * An allocator node is represented as a tuple. The zeroth element is the parent of the node. The first element\n * always exists and is the texture area it wholly represents. The second element is whether the rectangle\n * is allocated or free. The last element is optional and is the list\n * of its children.\n *\n * @public\n * @ignore\n */\nexport type AreaNode = [AreaNode, AreaField, boolean] | [AreaNode, AreaField, AreaNode[]];\n\n/**\n * Pointer to guillotene node.\n *\n * @public\n * @ignore\n */\nexport type AreaPtr = { __mem_area: AreaNode };\n\n/**\n * @public\n * @ignore\n */\nexport enum SPLIT_ORIENTATION {\n HOR = 0,\n VERT = 1,\n NONE = 2\n}\n\nconst tempRect = new Rectangle();\n\n/** @public */\nexport class GuilloteneAllocator implements AreaAllocator\n{\n protected _root: AreaNode;\n\n private _width: number;\n private _height: number;\n\n constructor(width: number, height: number)\n {\n this._width = width;\n this._height = height;\n\n // NOTE: getFrame assumes root node is always horizontal!\n this._root = [\n null,\n Area.makeArea(0, this._height, AreaOrientation.HORIZONTAL),\n false\n ];\n }\n\n /**\n * Allocates an area of the given `width` and `height`.\n *\n * @param width - The width required for the allocated area.\n * @param height - The height required for the allocated area.\n * @param rect - An optional `Rectangle` instance to put the resulting area frame into.\n * @return The rectangle frame of the area allocated.\n */\n allocate(width: number, height: number, rect?: Rectangle): Rectangle & AreaPtr\n {\n const area = this.findArea(width, height);\n\n if (!area)\n {\n return null;\n }\n\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n this.getFrame(area, rect);\n\n const hole = new Rectangle(rect.x, rect.y, width, height);\n const node = this.split(area, rect, hole);\n\n rect.copyFrom(hole);\n (rect as any).__mem_area = node;\n\n return rect as (Rectangle & AreaPtr);\n }\n\n /**\n * Frees the area represented by the given area pointer. The original rectangle returned by\n * {@link GuilloteneAllocator#allocate} included this pointer (the `__mem_area` property).\n *\n * @param areaPtr\n */\n free(areaPtr: AreaPtr): void\n {\n const area = areaPtr.__mem_area;\n\n area[2] = false;\n this.merge(area);\n }\n\n get width(): number\n {\n return this._width;\n }\n\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Returns the [area]{@link Area} data for the node.\n *\n * @param node\n * @returns The area data for the node.\n */\n protected getAreaField(node: AreaNode): AreaField\n {\n return node[1];\n }\n\n /**\n * Returns the rectangle covered by the area node.\n *\n * @param node - The node whose covered rectangular area is needed.\n * @param rect - An optional `Rectangle` instance to put the data in.\n * @return The rectangle covered by `node`.\n */\n protected getFrame(node: AreaNode, rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n const nodeArea = this.getAreaField(node);\n const nodeParent = this.getParent(node);\n const nodeOrientation = Area.getOrientation(nodeArea);\n const nodeOpen = Area.getOpenOffset(nodeArea);\n const nodeClose = Area.getCloseOffset(nodeArea);\n const parentOpen = nodeParent ? Area.getOpenOffset(nodeParent[1]) : 0;\n const parentClose = nodeParent ? Area.getCloseOffset(nodeParent[1]) : this._width;// (because root node is horizontal)\n\n if (nodeOrientation) // VERTICAL\n {\n rect.x = nodeOpen;\n rect.y = parentOpen;\n rect.width = nodeClose - rect.x;\n rect.height = parentClose - parentOpen;\n }\n else // HORIZONTAL\n {\n rect.x = parentOpen;\n rect.y = nodeOpen;\n rect.width = parentClose - rect.x;\n rect.height = nodeClose - rect.y;\n }\n\n return rect;\n }\n\n /**\n * Returns the parent of the area node.\n *\n * @param node\n * @return The parent of `node`\n */\n protected getParent(node: AreaNode): AreaNode\n {\n return node[0];\n }\n\n /**\n * Returns whether the given node has any children.\n *\n * @param node\n * @return Whether the given node has any children.\n */\n protected hasChildren(node: AreaNode): boolean\n {\n return (Array.isArray(node[2]) && (node[2].length !== 0));\n }\n\n /**\n * Returns the children of the passed node, if any.\n *\n * @param node\n */\n protected getChildren(node: AreaNode): AreaNode[]\n {\n if (!Array.isArray(node[2])) {\n throw new Error(\"Children don't exist\")\n }\n\n return node[2];\n }\n\n protected addChild(parent: AreaNode, ...nodes: AreaNode[]): void\n {\n parent[2] = Array.isArray(parent[2]) ? parent[2] : []\n parent[2].push(...nodes)\n }\n\n /**\n * Finds an area node with minimum width `aw` and minimum height `ah`.\n *\n * @param aw\n * @param ah\n */\n protected findArea(aw: number, ah: number): AreaNode\n {\n return this.findAreaRecursive(this._root, aw, ah);\n }\n\n /**\n * The recursive implementation for {@link AreaAllocator#findArea}.\n *\n * @param rootArea\n * @param aw\n * @param ah\n */\n protected findAreaRecursive(rootArea: AreaNode, aw: number, ah: number): AreaNode\n {\n const frame = this.getFrame(rootArea, tempRect);\n\n if (frame.width < aw || frame.height < ah)\n {\n return null;\n }\n\n if (!this.hasChildren(rootArea))\n {\n const dx = frame.width - aw;\n const dy = frame.height - ah;\n\n if (dx < 0 || dy < 0 || rootArea[2])\n {\n return null;\n }\n\n return rootArea;\n }\n\n const children = this.getChildren(rootArea);\n\n let bestCandidate = null;\n let bestCandidateScore = Infinity;\n\n for (let i = 0, j = children.length; i < j; i++)\n {\n const candidate = this.findAreaRecursive(children[i], aw, ah);\n\n if (!candidate)\n {\n continue;\n }\n\n const candidateFrame = this.getFrame(candidate, tempRect);\n\n const dx = candidateFrame.width - aw;\n const dy = candidateFrame.height - ah;\n\n if (dx < 0 || dy < 0)\n {\n continue;\n }\n if (!dx && !dy)\n {\n // Perfect fit!\n return candidate;\n }\n\n const score = Math.min(dx, dy);\n\n if (bestCandidateScore > score)\n {\n bestCandidate = candidate;\n bestCandidateScore = score;\n }\n }\n\n return bestCandidate;\n }\n\n /**\n * Returns the orientation of the primary split of host.\n */\n protected splitOrientation(host: Rectangle, hole: Rectangle): SPLIT_ORIENTATION\n {\n if (hole.width === host.width && hole.height === host.height) {\n return SPLIT_ORIENTATION.NONE;\n }\n if (hole.width === host.width) {\n return SPLIT_ORIENTATION.VERT;\n }\n if (hole.height === host.height) {\n return SPLIT_ORIENTATION.HOR;\n }\n\n // ____________________\n // | | |\n // | | |\n // | hole | |\n // | | |\n // |________| Primary |\n // | | |\n // | | |\n // | Sec. | |\n // |________|_________|\n const horAreaDiff = Math.abs(\n // (Primary) Right\n (host.width - hole.width) * host.height -\n // (Secondary) Bottom\n hole.width * (host.height - hole.height)\n )\n\n // ____________________\n // | | |\n // | | |\n // | hole | Sec. |\n // | | |\n // |________|_________|\n // | |\n // | Primary |\n // |__________________|\n const verAreaDiff = Math.abs(\n // (Primary) Bottom\n host.width * (host.height - hole.height) -\n (host.width - hole.width) * hole.height\n )\n\n if (horAreaDiff > verAreaDiff)\n {\n return SPLIT_ORIENTATION.HOR\n }\n else\n {\n return SPLIT_ORIENTATION.VERT\n }\n }\n\n protected split(\n area: AreaNode,\n areaFrame: Rectangle,\n holeFrame: Rectangle,\n orientation: SPLIT_ORIENTATION = this.getParent(area) ? this.splitOrientation(areaFrame, holeFrame) : SPLIT_ORIENTATION.HOR\n ): AreaNode\n {\n if (area[2] === true)\n {\n throw new Error('Cannot deallocate')\n }\n if (orientation === SPLIT_ORIENTATION.NONE)\n {\n area[2] = true;\n return area;\n }\n\n return this[orientation === SPLIT_ORIENTATION.HOR\n ? 'splitPrimaryHorizontal'\n : 'splitPrimaryVertical'](area, areaFrame, holeFrame);\n }\n\n private splitPrimaryHorizontal(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area))\n {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const firstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n []\n ];\n const secondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.HORIZONTAL) {\n this.addChild(area, firstChild, secondChild)\n } else {\n const i = this.getChildren(parent).indexOf(area);\n\n firstChild[0] = parent;\n secondChild[0] = parent;\n\n this.getChildren(parent).splice(i, 1, firstChild, secondChild);\n }\n\n if (holeFrame.height !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n this.addChild(firstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (firstChild as AreaNode)[2] = true;\n }\n\n return firstChild;\n }\n\n private splitPrimaryVertical(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area)) {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const primaryFirstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n []\n ];\n const primarySecondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.VERTICAL)\n {\n this.addChild(area, primaryFirstChild, primarySecondChild);\n }\n else\n {\n const i = this.getChildren(parent).indexOf(area);\n primaryFirstChild[0] = parent;\n primarySecondChild[0] = parent;\n this.getChildren(parent).splice(i, 1, primaryFirstChild, primarySecondChild);\n }\n\n if (holeFrame.width !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n this.addChild(primaryFirstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (primaryFirstChild as AreaNode)[2] = true;\n }\n\n return primaryFirstChild;\n }\n\n protected merge(\n area: AreaNode\n ) {\n if (this.hasChildren(area))\n {\n throw new Error(\"Cannot merge a non-leaf node\");\n }\n\n const parent = this.getParent(area);\n\n if (!parent)\n {\n return;\n }\n\n const siblings = this.getChildren(parent);\n const i = siblings.indexOf(area);\n\n const leftSibling = siblings[i - 1];\n const rightSibling = siblings[i + 1];\n\n if (rightSibling && rightSibling[2] === false)\n {\n // Merge rightSibling into area\n area[1] = Area.setCloseOffset(area[1], Area.getCloseOffset(rightSibling[1]));\n siblings.splice(i + 1, 1);\n }\n if (leftSibling && leftSibling[2] === false)\n {\n // Merge leftSibling into area\n area[1] = Area.setOpenOffset(area[1], Area.getOpenOffset(leftSibling[1]));\n siblings.splice(i - 1, 1);\n }\n\n if (siblings.length === 1) {\n parent[2] = false;\n this.merge(parent);\n }\n }\n\n private printState(area: AreaNode): void\n {\n if (!this.hasChildren(area)) {\n console.log({ ...this.getFrame(area) }, area[2])\n } else {\n this.getChildren(area).forEach(n => this.printState(n))\n }\n }\n}", "import { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { Rectangle } from '@pixi/math';\n\nimport type { TextureSlab } from './TextureSlab';\n\nconst tempRect = new Rectangle();\n\n/**\n * The texture allocator dynamically manages space on base-texture slabs. It can be used to generate\n * atlases on demand, which improve batching efficiency.\n *\n * @public\n */\nexport class TextureAllocator\n{\n /**\n * The width of texture slabs.\n */\n public readonly slabWidth: number;\n\n /**\n * The height of texture slabs.\n */\n public readonly slabHeight: number;\n\n /**\n * The list of base-textures that are used to allocate texture space.\n */\n protected textureSlabs: TextureSlab[];\n\n /**\n * @param slabWidth - The width of base-texture slabs. This should be at most 2048.\n * @param slabHeight - The height of base-texture slabs. This should be at most 2048.\n */\n constructor(slabWidth = 2048, slabHeight = 2048)\n {\n this.slabWidth = slabWidth;\n this.slabHeight = slabHeight;\n\n this.textureSlabs = [];\n }\n\n get maxWidth() {\n return this.slabWidth - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n get maxHeight() {\n return this.slabHeight - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n /**\n * Allocates a texture from this allocator.\n *\n * If its existing slab pool has enough space, the texture is issued from one. Otherwise,\n * a new slab is created and the texture is issued from it. However, if the requested\n * dimensions are larger than slabs themselves, then `null` is always returned.\n *\n * To upload a texture source, you will have to create an atlas-managing {@link Resource}\n * yourself on the base-texture. The {@link AtlasAllocator} does this for you, while the\n * {@link CanvasTextureAllocator} can be used to draw on a canvas-based atlas.\n *\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - The padding requested around the texture, to prevent bleeding.\n * @return The allocated texture, if successful; otherwise, `null`.\n */\n allocate(width: number, height: number, padding = this.calculatePadding(width, height)): T\n {\n // Cannot allocate a texture larger than a texture-slab.\n if (width + 2 * padding > this.slabWidth ||\n height + 2 * padding > this.slabHeight)\n {\n return null;\n }\n\n const slabs = this.textureSlabs;\n\n // Loop through the slabs and find one with enough space, if any.\n for (let i = 0, j = slabs.length; i < j; i++)\n {\n const slab = slabs[i];\n const texture = this.issueTexture(slab, width, height, padding);\n\n if (texture)\n {\n return texture;\n }\n }\n\n // Issue a new slab.\n const slab = this.createSlab();\n\n // Append this slab to the head of the list.\n this.textureSlabs.unshift(slab);\n\n // Issue the texture from this blank slab.\n return this.issueTexture(slab, width, height, padding);\n }\n\n /**\n * Frees the texture and reclaims its space. It is assumed you will not use it again, and have\n * destroyed any resource uploading its data.\n *\n * @param texture\n * @throws When the texture was not located in this allocator.\n */\n free(texture: T): void\n {\n const baseTexture = (texture as Texture).baseTexture;\n const slab = this.textureSlabs.find(sl => sl.slab === baseTexture);\n\n if (!slab)\n {\n throw new Error(\"The texture cannot be freed because \" +\n \"its base-texture is not pooled by this allocator. \" +\n \"This is either a bug in TextureAllocator or you tried to free a \" +\n \"texture that was never allocated by one.\");\n }\n\n const textureEntry = slab.managedTextures.find(entry => entry.texture === texture);\n\n if (!textureEntry)\n {\n throw new Error(\"The texture cannot be freed because it was not found \" +\n \"in the managed list of issued textures on its slab. This may be because you \" +\n \"duplicated this texture or a bug in TextureAllocator\");\n }\n\n slab.managedArea.free(textureEntry.area);\n slab.managedTextures.splice(slab.managedTextures.indexOf(textureEntry), 1);\n }\n\n protected calculatePadding(width: number, height: number): number\n {\n const dimen = Math.max(width, height);\n\n if (dimen < 64)\n {\n return 2;\n }\n else if (dimen < 128)\n {\n return 4;\n }\n else if (dimen < 1024)\n {\n return 8;\n }\n else\n {\n return 16;\n }\n }\n\n /**\n * Creates a texture slab. The slab's base-texture is not backed by any resource. You\n * will have to manage that yourself. See {@link AtlasAllocator} or {@link CanvasTextureAllocator}\n * for better resource semantics.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(null,\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Creates a texture on the given base-texture at {@code frame}.\n *\n * @param baseTexture - The base texture that will hold the texture's space.\n * @param frame - The frame in which the texture will be stored.\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): T\n {\n // Override this method to return correct texture type T.\n return new Texture(baseTexture, frame) as T;\n }\n\n /**\n * Issues a texture from the given texture slab, if possible.\n *\n * @param slab - The texture slab to allocate frame.\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - Padding required around the texture.\n * @return The issued texture, if successful; otherwise, `null`.\n */\n protected issueTexture(slab: TextureSlab, width: number, height: number, padding = 0): T\n {\n const area = slab.managedArea.allocate(width + 2 * padding, height + 2 * padding);\n\n if (!area)\n {\n return null;\n }\n\n tempRect.copyFrom(area);\n tempRect.pad(-padding);\n\n const baseTexture = slab.slab;\n const issuedTexture = this.createTexture(baseTexture, tempRect.clone());\n\n slab.managedTextures.push({\n area,\n texture: issuedTexture,\n });\n\n return issuedTexture;\n }\n}", "import { BaseTexture } from '@pixi/core';\n\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues texture backed by a canvas. You can draw on to that canvas to soruce\n * each texture.\n *\n * @public\n */\nexport class CanvasTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a canvas.\n */\n protected createSlab(): TextureSlab\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = this.slabWidth;\n canvas.height = this.slabHeight;\n\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(canvas, {\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n}", "import { BaseRenderTexture, RenderTexture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\n\nimport type { BaseTexture } from '@pixi/core';\nimport type { Rectangle } from '@pixi/math';\nimport type { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues render-textures, and is otherwise just like {@link TextureAllocator}.\n *\n * @public\n */\nexport class RenderTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a base render-texture.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseRenderTexture({\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n\n /**\n * Creates a render-texture from the given base render-texture.\n *\n * @param baseTexture\n * @param frame\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): RenderTexture\n {\n return new RenderTexture(baseTexture as BaseRenderTexture, frame);\n }\n}"], + "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAK,kBAAL,kBAAKA,qBAAL;AACH,EAAAA,kCAAA,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AAAA,EAIc,aACV;AACI,UAAM,SAAS,SAAS,cAAc,QAAQ;AAE9C,WAAO,QAAQ,KAAK;AACpB,WAAO,SAAS,KAAK;AAErB,WAAO;AAAA,MACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,MACpE,iBAAiB,CAAC;AAAA,MAClB,MAAM,IAAI,yBAAY,QAAQ;AAAA,QAC1B,OAAO,KAAK;AAAA,QACZ,QAAQ,KAAK;AAAA,MACjB,CAAC;AAAA,IACL;AAAA,EACJ;AACJ;;;ACjCA,IAAAC,eAAiD;AAa1C,IAAM,yBAAN,cAAqC,iBAC5C;AAAA;AAAA;AAAA;AAAA,EAIc,aACV;AACI,WAAO;AAAA,MACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,MACpE,iBAAiB,CAAC;AAAA,MAClB,MAAM,IAAI,+BAAkB;AAAA,QACxB,OAAO,KAAK;AAAA,QACZ,QAAQ,KAAK;AAAA,MACjB,CAAC;AAAA,IACL;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQU,cAAc,aAA0B,OAClD;AACI,WAAO,IAAI,2BAAc,aAAkC,KAAK;AAAA,EACpE;AACJ;", "names": ["AreaOrientation", "import_core", "SPLIT_ORIENTATION", "import_core", "import_math", "tempRect", "slab", "item", "import_core", "import_core"] } diff --git a/dist/pixi-texture-allocator.iife.js b/dist/pixi-texture-allocator.iife.js index 404cc0d..e4b919e 100644 --- a/dist/pixi-texture-allocator.iife.js +++ b/dist/pixi-texture-allocator.iife.js @@ -11189,9 +11189,6 @@ ${this.fragmentSrc}`; * @param item - The item to upload. */ uploadItem(renderer, target, format2, type, item) { - if (item.updateId === item.dirtyId) { - return; - } const gl = renderer.gl; const isWebGL2 = gl instanceof WebGL2RenderingContext; const frame = item.frame; diff --git a/dist/pixi-texture-allocator.iife.js.map b/dist/pixi-texture-allocator.iife.js.map index a23e30a..2a57c62 100644 --- a/dist/pixi-texture-allocator.iife.js.map +++ b/dist/pixi-texture-allocator.iife.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../node_modules/eventemitter3/index.js", "../node_modules/earcut/src/earcut.js", "../node_modules/punycode/punycode.js", "../node_modules/url/util.js", "../node_modules/querystring/decode.js", "../node_modules/querystring/encode.js", "../node_modules/querystring/index.js", "../node_modules/url/url.js", "../src/index.ts", "../src/Area.ts", "../node_modules/@pixi/constants/src/index.ts", "../node_modules/@pixi/settings/src/adapter.ts", "../node_modules/@pixi/settings/src/settings.ts", "../node_modules/ismobilejs/src/isMobile.ts", "../node_modules/@pixi/settings/src/utils/isMobile.ts", "../node_modules/@pixi/utils/src/settings.ts", "../node_modules/@pixi/utils/lib/index.mjs", "../node_modules/@pixi/utils/src/url.ts", "../node_modules/@pixi/utils/src/logging/deprecation.ts", "../node_modules/@pixi/utils/src/browser/isWebGLSupported.ts", "../node_modules/colord/index.mjs", "../node_modules/colord/plugins/names.mjs", "../node_modules/@pixi/color/src/Color.ts", "../node_modules/@pixi/utils/src/color/premultiply.ts", "../node_modules/@pixi/utils/src/data/getBufferType.ts", "../node_modules/@pixi/utils/src/data/pow2.ts", "../node_modules/@pixi/utils/src/data/removeItems.ts", "../node_modules/@pixi/utils/src/data/uid.ts", "../node_modules/@pixi/utils/src/media/BoundingBox.ts", "../node_modules/@pixi/utils/src/media/caches.ts", "../node_modules/@pixi/utils/src/network/determineCrossOrigin.ts", "../node_modules/@pixi/utils/src/network/getResolutionOfUrl.ts", "../node_modules/@pixi/extensions/src/index.ts", "../node_modules/@pixi/core/src/geometry/ViewableBuffer.ts", "../node_modules/@pixi/core/src/shader/utils/checkMaxIfStatementsInShader.ts", "../node_modules/@pixi/core/src/state/State.ts", "../node_modules/@pixi/core/src/textures/resources/autoDetectResource.ts", "../node_modules/@pixi/runner/src/Runner.ts", "../node_modules/@pixi/core/src/textures/resources/Resource.ts", "../node_modules/@pixi/core/src/textures/resources/BufferResource.ts", "../node_modules/@pixi/core/src/textures/BaseTexture.ts", "../node_modules/@pixi/core/src/batch/BatchDrawCall.ts", "../node_modules/@pixi/core/src/geometry/Buffer.ts", "../node_modules/@pixi/core/src/geometry/Attribute.ts", "../node_modules/@pixi/core/src/geometry/utils/interleaveTypedArrays.ts", "../node_modules/@pixi/core/src/geometry/Geometry.ts", "../node_modules/@pixi/core/src/batch/BatchGeometry.ts", "../node_modules/@pixi/math/src/const.ts", "../node_modules/@pixi/math/src/Point.ts", "../node_modules/@pixi/math/src/shapes/Rectangle.ts", "../node_modules/@pixi/math/src/Matrix.ts", "../node_modules/@pixi/math/src/groupD8.ts", "../node_modules/@pixi/math/src/ObservablePoint.ts", "../node_modules/@pixi/math/src/Transform.ts", "../node_modules/@pixi/core/lib/shader/defaultProgram.mjs", "../node_modules/@pixi/core/lib/shader/defaultProgram2.mjs", "../node_modules/@pixi/core/src/shader/utils/compileShader.ts", "../node_modules/@pixi/core/src/shader/utils/defaultValue.ts", "../node_modules/@pixi/core/src/shader/utils/uniformParsers.ts", "../node_modules/@pixi/core/src/shader/utils/generateUniformsSync.ts", "../node_modules/@pixi/core/src/shader/utils/getTestContext.ts", "../node_modules/@pixi/core/src/shader/utils/getMaxFragmentPrecision.ts", "../node_modules/@pixi/core/src/shader/utils/logProgramError.ts", "../node_modules/@pixi/core/src/shader/utils/mapSize.ts", "../node_modules/@pixi/core/src/shader/utils/mapType.ts", "../node_modules/@pixi/core/src/shader/utils/setPrecision.ts", "../node_modules/@pixi/core/src/shader/utils/unsafeEvalSupported.ts", "../node_modules/@pixi/core/src/shader/Program.ts", "../node_modules/@pixi/core/src/shader/UniformGroup.ts", "../node_modules/@pixi/core/src/shader/Shader.ts", "../node_modules/@pixi/core/src/batch/BatchShaderGenerator.ts", "../node_modules/@pixi/core/src/batch/BatchTextureArray.ts", "../node_modules/@pixi/core/src/batch/canUploadSameBuffer.ts", "../node_modules/@pixi/core/src/batch/maxRecommendedTextures.ts", "../node_modules/@pixi/core/src/batch/ObjectRenderer.ts", "../node_modules/@pixi/core/lib/batch/texture.mjs", "../node_modules/@pixi/core/lib/batch/texture2.mjs", "../node_modules/@pixi/core/src/batch/BatchRenderer.ts", "../node_modules/@pixi/core/lib/filters/defaultFilter.mjs", "../node_modules/@pixi/core/lib/filters/defaultFilter2.mjs", "../node_modules/@pixi/core/src/filters/Filter.ts", "../node_modules/@pixi/core/src/background/BackgroundSystem.ts", "../node_modules/@pixi/core/src/batch/BatchSystem.ts", "../node_modules/@pixi/core/src/context/ContextSystem.ts", "../node_modules/@pixi/core/src/textures/resources/DepthResource.ts", "../node_modules/@pixi/core/src/framebuffer/Framebuffer.ts", "../node_modules/@pixi/core/src/renderTexture/BaseRenderTexture.ts", "../node_modules/@pixi/core/src/textures/resources/BaseImageResource.ts", "../node_modules/@pixi/core/src/textures/resources/ImageResource.ts", "../node_modules/@pixi/core/src/textures/TextureUvs.ts", "../node_modules/@pixi/core/src/textures/Texture.ts", "../node_modules/@pixi/core/src/renderTexture/RenderTexture.ts", "../node_modules/@pixi/core/src/renderTexture/RenderTexturePool.ts", "../node_modules/@pixi/core/src/utils/Quad.ts", "../node_modules/@pixi/core/src/utils/QuadUv.ts", "../node_modules/@pixi/core/src/filters/FilterState.ts", "../node_modules/@pixi/core/src/filters/FilterSystem.ts", "../node_modules/@pixi/core/src/framebuffer/GLFramebuffer.ts", "../node_modules/@pixi/core/src/framebuffer/FramebufferSystem.ts", "../node_modules/@pixi/core/src/geometry/GeometrySystem.ts", "../node_modules/@pixi/core/src/textures/TextureMatrix.ts", "../node_modules/@pixi/core/lib/filters/spriteMask/spriteMaskFilter2.mjs", "../node_modules/@pixi/core/lib/filters/spriteMask/spriteMaskFilter3.mjs", "../node_modules/@pixi/core/src/filters/spriteMask/SpriteMaskFilter.ts", "../node_modules/@pixi/core/src/mask/MaskData.ts", "../node_modules/@pixi/core/src/mask/MaskSystem.ts", "../node_modules/@pixi/core/src/mask/AbstractMaskSystem.ts", "../node_modules/@pixi/core/src/mask/ScissorSystem.ts", "../node_modules/@pixi/core/src/mask/StencilSystem.ts", "../node_modules/@pixi/core/src/plugin/PluginSystem.ts", "../node_modules/@pixi/core/src/projection/ProjectionSystem.ts", "../node_modules/@pixi/core/src/renderTexture/GenerateTextureSystem.ts", "../node_modules/@pixi/core/src/renderTexture/RenderTextureSystem.ts", "../node_modules/@pixi/core/src/shader/GLProgram.ts", "../node_modules/@pixi/core/src/shader/utils/getAttributeData.ts", "../node_modules/@pixi/core/src/shader/utils/getUniformData.ts", "../node_modules/@pixi/core/src/shader/utils/generateProgram.ts", "../node_modules/@pixi/core/src/shader/utils/generateUniformBufferSync.ts", "../node_modules/@pixi/core/src/shader/ShaderSystem.ts", "../node_modules/@pixi/core/src/startup/StartupSystem.ts", "../node_modules/@pixi/core/src/state/utils/mapWebGLBlendModesToPixi.ts", "../node_modules/@pixi/core/src/state/StateSystem.ts", "../node_modules/@pixi/core/src/system/SystemManager.ts", "../node_modules/@pixi/core/src/textures/TextureGCSystem.ts", "../node_modules/@pixi/core/src/textures/GLTexture.ts", "../node_modules/@pixi/core/src/textures/utils/mapTypeAndFormatToInternalFormat.ts", "../node_modules/@pixi/core/src/textures/TextureSystem.ts", "../node_modules/@pixi/core/src/transformFeedback/TransformFeedbackSystem.ts", "../node_modules/@pixi/core/src/view/ViewSystem.ts", "../node_modules/@pixi/core/src/settings.ts", "../node_modules/@pixi/ticker/src/const.ts", "../node_modules/@pixi/ticker/src/TickerListener.ts", "../node_modules/@pixi/ticker/src/Ticker.ts", "../node_modules/@pixi/ticker/src/settings.ts", "../node_modules/@pixi/ticker/src/TickerPlugin.ts", "../node_modules/@pixi/core/src/autoDetectRenderer.ts", "../node_modules/@pixi/core/src/framebuffer/MultisampleSystem.ts", "../node_modules/@pixi/core/src/geometry/GLBuffer.ts", "../node_modules/@pixi/core/src/geometry/BufferSystem.ts", "../node_modules/@pixi/core/src/render/ObjectRendererSystem.ts", "../node_modules/@pixi/core/src/Renderer.ts", "../node_modules/@pixi/core/src/textures/resources/AbstractMultiResource.ts", "../node_modules/@pixi/core/src/textures/resources/ArrayResource.ts", "../node_modules/@pixi/core/src/textures/resources/CanvasResource.ts", "../node_modules/@pixi/core/src/textures/resources/CubeResource.ts", "../node_modules/@pixi/core/src/textures/resources/ImageBitmapResource.ts", "../node_modules/@pixi/core/src/textures/resources/SVGResource.ts", "../node_modules/@pixi/core/src/textures/resources/VideoResource.ts", "../node_modules/@pixi/core/src/textures/resources/index.ts", "../src/AtlasResource.ts", "../src/GuilloteneAllocator.ts", "../src/TextureAllocator.ts", "../src/AtlasAllocator.ts", "../src/CanvasTextureAllocator.ts", "../src/RenderTextureAllocator.ts"], - "sourcesContent": ["'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 * @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 {*} 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 * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @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 * @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 * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\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 * @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 {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\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 {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\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 {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @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 clearEvent(this, 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 clearEvent(this, 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 clearEvent(this, 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 * @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]) clearEvent(this, evt);\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// 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", "'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 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\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 | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\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(filterPoints(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 ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangle(ax, ay, bx, by, cx, cy, 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 var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, 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.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && 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.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && 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.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && 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 | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\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 filterPoints(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, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\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 outerNode = eliminateHole(queue[i], outerNode);\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 var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\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 m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\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;\n\n do {\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 (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\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 === 0) 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 = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\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 || (p.x === leftmost.x && p.y < leftmost.y)) 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) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\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) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\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 var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 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 = 0;\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", "/*! https://mths.be/punycode v1.3.2 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 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 \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 * http://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 state to ,\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.3.2',\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 \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) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // 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 { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\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", "// 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 (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\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 Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(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", "'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\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 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", "export * from './Area';\nexport * from './AreaAllocator';\nexport * from './AtlasAllocator';\nexport * from './AtlasResource';\nexport * from './CanvasTextureAllocator';\nexport * from './GuilloteneAllocator';\nexport * from './RenderTextureAllocator';\nexport * from './TextureAllocator';\nexport * from './TextureSlab';", "/**\n * The orientation of an area indicates the axis along which it is split. This is a 1-bit field.\n *\n * @public\n */\nexport enum AreaOrientation {\n HORIZONTAL = 0,\n VERTICAL = 1\n};\n\n/**\n * Alias for the 31-bit field texture-area type.\n *\n * @public\n */\nexport type AreaField = number;\n\n/**\n * An area represents an oriented rectangular region. It is implemented as a 31-bit field. The open/close edges are\n * specified along its parent's orientation axis, i.e. if the parent is horizontal, the left and right edges are defined,\n * else if the parent is vertical, the top and bottom edges are defined. Similarly, the open/close edges of its\n * children will be along its own orientation axis.\n *\n * The orientation axes flip-flop along the hierarchy, i.e. an area's parent's orientation is always opposite to\n * the area's own orientation. This is because if the orientation were to be same, the area's children could be\n * \"pulled up\" to the parent making itself redundant.\n *\n * All four edges of an area can be retrieved from it and its parent.\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
FieldBitsDescription
OPEN_OFFSET0-14\n * The offset along the parent's axis at which the area begins. If orientation is horizontal,\n * this is the left edge. If orientation is vertical, this is the top edge.\n *
CLOSE_OFFSET15-29\n * The offset along the parent's axis at which the area ends. If orientation is horizontal,\n * this is the right edge. If orientation is vertical, this is the bottom edge.\n *
ORIENTATION30\n * The orientation of the area, which indicates the axis along it is split. The open and close\n * offsets of its children are along this axis. See {@link AreaOrientation}.\n *
\n *\n * @public\n */\nexport class Area\n{\n static makeArea(openOffset: number, closeOffset: number, orientation: number): number\n {\n return openOffset | (closeOffset << 15) | (orientation << 30);\n }\n\n static getOpenOffset(area: AreaField): number\n {\n return area & ((1 << 15) - 1);\n }\n\n static getCloseOffset(area: AreaField): number\n {\n return (area >> 15) & ((1 << 15) - 1);\n }\n\n static getOrientation(area: AreaField): AreaOrientation\n {\n return (area >> 30) & 1;\n }\n\n static setOpenOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n offset,\n Area.getCloseOffset(area),\n Area.getOrientation(area)\n );\n }\n\n static setCloseOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n Area.getOpenOffset(offset),\n offset,\n Area.getOrientation(area)\n );\n }\n}", "/**\n * Different types of environments for WebGL.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum ENV\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @default 0\n */\n WEBGL_LEGACY,\n /**\n * Version 1 of WebGL\n * @default 1\n */\n WEBGL,\n /**\n * Version 2 of WebGL\n * @default 2\n */\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum RENDERER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Unknown render type.\n * @default 0\n */\n UNKNOWN,\n /**\n * WebGL render type.\n * @default 1\n */\n WEBGL,\n /**\n * Canvas render type.\n * @default 2\n */\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum BUFFER_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Indicates the buffers currently enabled for color writing.\n * @default 0x00004000\n */\n COLOR = 0x00004000,\n /**\n * Indicates the depth buffer.\n * @default 0x00000100\n */\n DEPTH = 0x00000100,\n /**\n * Indicates the stencil buffer.\n * @default 0x00000400\n */\n STENCIL = 0x00000400\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 * @memberof PIXI\n * @enum {number}\n */\nexport enum BLEND_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * @default 0\n */\n NORMAL = 0,\n /**\n * @default 1\n */\n ADD = 1,\n /**\n * The pixels of the top layer are multiplied with the corresponding pixel of the bottom layer.\n * A darker picture is the result.\n * @default 2\n */\n MULTIPLY = 2,\n /**\n * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply)\n * @default 3\n */\n SCREEN = 3,\n /**\n * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter.\n *\n * Canvas Renderer only.\n * @default 4\n */\n OVERLAY = 4,\n /**\n * Retains the darkest pixels of both layers.\n *\n * Canvas Renderer only.\n * @default 5\n */\n DARKEN = 5,\n /**\n * Retains the lightest pixels of both layers.\n *\n * Canvas Renderer only.\n * @default 6\n */\n LIGHTEN = 6,\n /**\n * Divides the bottom layer by the inverted top layer.\n *\n * Canvas Renderer only.\n * @default 7\n */\n COLOR_DODGE = 7,\n /**\n * Divides the inverted bottom layer by the top layer, and then inverts the result.\n *\n * Canvas Renderer only.\n * @default 8\n */\n COLOR_BURN = 8,\n /**\n * A combination of multiply and screen like overlay, but with top and bottom layer swapped.\n *\n * Canvas Renderer only.\n * @default 9\n */\n HARD_LIGHT = 9,\n /**\n * A softer version of hard-light. Pure black or white does not result in pure black or white.\n *\n * Canvas Renderer only.\n * @default 10\n */\n SOFT_LIGHT = 10,\n /**\n * Subtracts the bottom layer from the top layer or the other way round to always get a positive value.\n *\n * Canvas Renderer only.\n * @default 11\n */\n DIFFERENCE = 11,\n /**\n * Like difference, but with lower contrast.\n *\n * Canvas Renderer only.\n * @default 12\n */\n EXCLUSION = 12,\n /**\n * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.\n *\n * Canvas Renderer only.\n * @default 13\n */\n HUE = 13,\n /**\n * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.\n *\n * Canvas Renderer only.\n * @default 14\n */\n SATURATION = 14,\n /**\n * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.\n *\n * Canvas Renderer only.\n * @default 15\n */\n COLOR = 15,\n /**\n * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.\n *\n * Canvas Renderer only.\n * @default 16\n */\n LUMINOSITY = 16,\n /**\n * @default 17\n */\n NORMAL_NPM = 17,\n /**\n * @default 18\n */\n ADD_NPM = 18,\n /**\n * @default 19\n */\n SCREEN_NPM = 19,\n /**\n * @default 20\n */\n NONE = 20,\n\n /**\n * Draws new shapes on top of the existing canvas content.\n * @default 0\n */\n SRC_OVER = 0,\n /**\n * The new shape is drawn only where both the new shape and the destination canvas overlap.\n * Everything else is made transparent.\n * @default 21\n */\n SRC_IN = 21,\n /**\n * The new shape is drawn where it doesn't overlap the existing canvas content.\n * @default 22\n */\n SRC_OUT = 22,\n /**\n * The new shape is only drawn where it overlaps the existing canvas content.\n * @default 23\n */\n SRC_ATOP = 23,\n /**\n * New shapes are drawn behind the existing canvas content.\n * @default 24\n */\n DST_OVER = 24,\n /**\n * The existing canvas content is kept where both the new shape and existing canvas content overlap.\n * Everything else is made transparent.\n * @default 25\n */\n DST_IN = 25,\n /**\n * The existing content is kept where it doesn't overlap the new shape.\n * @default 26\n */\n DST_OUT = 26,\n /**\n * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content.\n * @default 27\n */\n DST_ATOP = 27,\n /**\n * @default 26\n */\n ERASE = 26,\n /**\n * @default 28\n */\n SUBTRACT = 28,\n /**\n * Shapes are made transparent where both overlap and drawn normal everywhere else.\n * @default 29\n */\n XOR = 29,\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 * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum DRAW_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * To draw a series of points.\n * @default 0\n */\n POINTS,\n /**\n * To draw a series of unconnected line segments (individual lines).\n * @default 1\n */\n LINES,\n /**\n * To draw a series of connected line segments. It also joins the first and last vertices to form a loop.\n * @default 2\n */\n LINE_LOOP,\n /**\n * To draw a series of connected line segments.\n * @default 3\n */\n LINE_STRIP,\n /**\n * To draw a series of separate triangles.\n * @default 4\n */\n TRIANGLES,\n /**\n * To draw a series of connected triangles in strip fashion.\n * @default 5\n */\n TRIANGLE_STRIP,\n /**\n * To draw a series of connected triangles sharing the first vertex in a fan-like fashion.\n * @default 6\n */\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n */\nexport enum FORMATS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * @default 6408\n */\n RGBA = 6408,\n /**\n * @default 6407\n */\n RGB = 6407,\n /**\n * @default 33319\n */\n RG = 33319,\n /**\n * @default 6403\n */\n RED = 6403,\n /**\n * @default 36249\n */\n RGBA_INTEGER = 36249,\n /**\n * @default 36248\n */\n RGB_INTEGER = 36248,\n /**\n * @default 33320\n */\n RG_INTEGER = 33320,\n /**\n * @default 36244\n */\n RED_INTEGER = 36244,\n /**\n * @default 6406\n */\n ALPHA = 6406,\n /**\n * @default 6409\n */\n LUMINANCE = 6409,\n /**\n * @default 6410\n */\n LUMINANCE_ALPHA = 6410,\n /**\n * @default 6402\n */\n DEPTH_COMPONENT = 6402,\n /**\n * @default 34041\n */\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum TARGETS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * A two-dimensional texture\n * @default 3553\n */\n TEXTURE_2D = 3553,\n /**\n * A cube-mapped texture. When using a WebGL 2 context, the following values are available additionally:\n * - gl.TEXTURE_3D: A three-dimensional texture.\n * - gl.TEXTURE_2D_ARRAY: A two-dimensional array texture.\n * @default 34067\n */\n TEXTURE_CUBE_MAP = 34067,\n /**\n * A two-dimensional array texture.\n * @default 35866\n */\n TEXTURE_2D_ARRAY = 35866,\n /**\n * Positive X face for a cube-mapped texture.\n * @default 34069\n */\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n /**\n * Negative X face for a cube-mapped texture.\n * @default 34070\n */\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n /**\n * Positive Y face for a cube-mapped texture.\n * @default 34071\n */\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n /**\n * Negative Y face for a cube-mapped texture.\n * @default 34072\n */\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n /**\n * Positive Z face for a cube-mapped texture.\n * @default 34073\n */\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n /**\n * Negative Z face for a cube-mapped texture.\n * @default 34074\n */\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * 8 bits per channel for gl.RGBA\n * @default 5121\n */\n UNSIGNED_BYTE = 5121,\n /**\n * @default 5123\n */\n UNSIGNED_SHORT = 5123,\n /**\n * 5 red bits, 6 green bits, 5 blue bits.\n * @default 33635\n */\n UNSIGNED_SHORT_5_6_5 = 33635,\n /**\n * 4 red bits, 4 green bits, 4 blue bits, 4 alpha bits.\n * @default 32819\n */\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n /**\n * 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit.\n * @default 32820\n */\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n /**\n * @default 5125\n */\n UNSIGNED_INT = 5125,\n /**\n * @default 35899\n */\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n /**\n * @default 33640\n */\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n /**\n * @default 34042\n */\n UNSIGNED_INT_24_8 = 34042,\n /**\n * @default 35902\n */\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n /**\n * @default 5120\n */\n BYTE = 5120,\n /**\n * @default 5122\n */\n SHORT = 5122,\n /**\n * @default 5124\n */\n INT = 5124,\n /**\n * @default 5126\n */\n FLOAT = 5126,\n /**\n * @default 36269\n */\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n /**\n * @default 36193\n */\n HALF_FLOAT = 36193,\n}\n\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum SAMPLER_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * @default 0\n */\n FLOAT = 0,\n /**\n * @default 1\n */\n INT = 1,\n /**\n * @default 2\n */\n UINT = 2,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.BaseTexture.defaultOptions.scaleMode} 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 * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum SCALE_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Pixelating scaling\n * @default 0\n */\n NEAREST,\n /**\n * Smooth scaling\n * @default 1\n */\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The 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 * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum WRAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * The textures uvs are clamped\n * @default 33071\n */\n CLAMP = 33071,\n /**\n * The texture uvs tile and repeat\n * @default 10497\n */\n REPEAT = 10497,\n /**\n * The texture uvs tile and repeat with mirroring\n * @default 33648\n */\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.BaseTexture.defaultOptions.mipmap} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Since WebGL 1 don't support mipmap for non-power-of-two textures,\n * `ON` option will work like `POW2` for WebGL 1.\n *\n * This property only affects WebGL.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum MIPMAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * No mipmaps.\n * @default 0\n */\n OFF,\n /**\n * Generate mipmaps if texture dimensions are powers of 2.\n * @default 1\n */\n POW2,\n /**\n * Always generate mipmaps.\n * @default 2\n */\n ON,\n /**\n * Use mipmaps, but do not auto-generate them.\n * this is used with a resource that supports buffering each level-of-detail.\n * @default 3\n */\n ON_MANUAL,\n}\n\n/**\n * How to treat textures with premultiplied alpha\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum ALPHA_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Alias for NO_PREMULTIPLIED_ALPHA.\n * @type {number}\n * @default 0\n */\n NPM = 0,\n /**\n * Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @type {number}\n * @default 1\n */\n UNPACK = 1,\n /**\n * Alias for PREMULTIPLIED_ALPHA.\n * @type {number}\n * @default 2\n */\n PMA = 2,\n /**\n * Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @type {number}\n * @default 0\n */\n NO_PREMULTIPLIED_ALPHA = 0,\n /**\n * Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @type {number}\n * @default 1\n */\n PREMULTIPLY_ON_UPLOAD = 1,\n /**\n * Source is already premultiplied. Example: spine atlases with `_pma` suffix.\n * @type {number}\n * @default 2\n */\n PREMULTIPLIED_ALPHA = 2,\n}\n\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link PIXI.CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum CLEAR_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Alias for BLEND, same as `false` in earlier versions\n * @default 0\n */\n NO = 0,\n /**\n * Alias for CLEAR, same as `true` in earlier versions\n * @default 1\n */\n YES = 1,\n /**\n * Alias for BLIT\n * @default 2\n */\n AUTO = 2,\n /**\n * Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @default 0\n */\n BLEND = 0,\n /**\n * Always clear the filter texture.\n * @default 1\n */\n CLEAR = 1,\n /**\n * Clear only if {@link PIXI.FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @default 2\n */\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.TextureGCSystem.defaultMode} 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 * @enum {number}\n * @static\n * @memberof PIXI\n */\nexport enum GC_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Garbage collection will happen periodically automatically\n * @default 0\n */\n AUTO,\n /**\n * Garbage collection will need to be called manually\n * @default 1\n */\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n * @memberof PIXI\n * @static\n * @enum {string}\n */\nexport enum PRECISION\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * lowp is at least an 9 bit value.\n * For floating point values they can range from: -2 to +2,\n * for integer values they are similar to Uint8Array or Int8Array\n * @default lowp\n */\n LOW = 'lowp',\n /**\n * mediump is at least a 16 bit value.\n * For floating point values they can range from: -2^14 to +2^14,\n * for integer values they are similar to Uint16Array or Int16Array\n * @default mediump\n */\n MEDIUM = 'mediump',\n /**\n * highp is at least a 32 bit value.\n * For floating point values they can range from: -2^62 to +2^62,\n * for integer values they are similar to Uint32Array or Int32Array\n * @default highp\n */\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum MASK_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Mask is ignored\n * @default 0\n */\n NONE = 0,\n /**\n * Scissor mask, rectangle on screen, cheap\n * @default 1\n */\n SCISSOR = 1,\n /**\n * Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @default 2\n */\n STENCIL = 2,\n /**\n * Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n * @default 3\n */\n SPRITE = 3,\n /**\n * Color mask (RGBA)\n * @default 4\n */\n COLOR = 4,\n}\n\n/**\n * Bitwise OR of masks that indicate the color channels that are rendered to.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum COLOR_MASK_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Red channel.\n * @default 0x1\n */\n RED = 0x1,\n /**\n * Green channel\n * @default 0x2\n */\n GREEN = 0x2,\n /**\n * Blue channel.\n * @default 0x4\n */\n BLUE = 0x4,\n /**\n * Alpha channel.\n * @default 0x\n */\n ALPHA = 0x8\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n * @see PIXI.Framebuffer#multisample\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum MSAA_QUALITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * No multisampling for this renderTexture\n * @default 0\n */\n NONE = 0,\n /**\n * Try 2 samples\n * @default 2\n */\n LOW = 2,\n /**\n * Try 4 samples\n * @default 4\n */\n MEDIUM = 4,\n /**\n * Try 8 samples\n * @default 8\n */\n HIGH = 8\n}\n\n/**\n * Constants for various buffer types in Pixi\n * @see PIXI.BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum BUFFER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * buffer type for using as an index buffer\n * @default 34963\n */\n ELEMENT_ARRAY_BUFFER = 34963,\n /**\n * buffer type for using attribute data\n * @default 34962\n */\n ARRAY_BUFFER = 34962,\n /**\n * the buffer type is for uniform buffer objects\n * @default 35345\n */\n UNIFORM_BUFFER = 35345,\n}\n", "import type { ICanvas } from './ICanvas';\nimport type { ICanvasRenderingContext2D } from './ICanvasRenderingContext2D';\n\n/**\n * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase.\n * Implementations of this interface can be used to make sure Pixi will work in any environment,\n * such as browser, Web Workers, and Node.js.\n * @memberof PIXI\n */\nexport interface IAdapter\n{\n /** Returns a canvas object that can be used to create a webgl context. */\n createCanvas: (width?: number, height?: number) => ICanvas;\n /** Returns a 2D rendering context. */\n getCanvasRenderingContext2D: () => { prototype: ICanvasRenderingContext2D; };\n /** Returns a WebGL rendering context. */\n getWebGLRenderingContext: () => typeof WebGLRenderingContext;\n /** Returns a partial implementation of the browsers window.navigator */\n getNavigator: () => { userAgent: string };\n /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */\n getBaseUrl: () => string;\n getFontFaceSet: () => FontFaceSet | null;\n fetch: (url: RequestInfo, options?: RequestInit) => Promise;\n parseXML: (xml: string) => Document;\n}\n\nexport const BrowserAdapter = {\n /**\n * Creates a canvas element of the given size.\n * This canvas is created using the browser's native canvas element.\n * @param width - width of the canvas\n * @param height - height of the canvas\n */\n createCanvas: (width: number, height: number): HTMLCanvasElement =>\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n },\n getCanvasRenderingContext2D: () => CanvasRenderingContext2D,\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => (document.baseURI ?? window.location.href),\n getFontFaceSet: () => document.fonts,\n fetch: (url: RequestInfo, options?: RequestInit) => fetch(url, options),\n parseXML: (xml: string) =>\n {\n const parser = new DOMParser();\n\n return parser.parseFromString(xml, 'text/xml');\n },\n} as IAdapter;\n", "import { BrowserAdapter } from './adapter';\n\nimport type { IAdapter } from './adapter';\n\ninterface ISettings\n{\n ADAPTER: IAdapter;\n RESOLUTION: number;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * import { settings, ENV } from 'pixi.js';\n *\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Used for older v1 WebGL devices for backwards compatibility\n * settings.PREFER_ENV = ENV.WEBGL_LEGACY;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings & Partial = {\n /**\n * This adapter is used to call methods that are platform dependent.\n * For example `document.createElement` only runs on the web but fails in node environments.\n * This allows us to support more platforms by abstracting away specific implementations per platform.\n *\n * By default the adapter is set to work in the browser. However you can create your own\n * by implementing the `IAdapter` interface. See `IAdapter` for more information.\n * @name ADAPTER\n * @memberof PIXI.settings\n * @type {PIXI.IAdapter}\n * @default PIXI.BrowserAdapter\n */\n ADAPTER: BrowserAdapter,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * @static\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n", "const appleIphone = /iPhone/i;\nconst appleIpod = /iPod/i;\nconst appleTablet = /iPad/i;\nconst appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nconst androidPhone = /\\bAndroid(?:.+)Mobile\\b/i; // Match 'Android' AND 'Mobile'\nconst androidTablet = /Android/i;\nconst amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i; // Match 'Silk' AND 'Mobile'\nconst amazonTablet = /Silk/i;\nconst windowsPhone = /Windows Phone/i;\nconst windowsTablet = /\\bWindows(?:.+)ARM\\b/i; // Match 'Windows' AND 'ARM'\nconst otherBlackBerry = /BlackBerry/i;\nconst otherBlackBerry10 = /BB10/i;\nconst otherOpera = /Opera Mini/i;\nconst otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nconst otherFirefox = /Mobile(?:.+)Firefox\\b/i; // Match 'Mobile' AND 'Firefox'\n\nexport type UserAgent = string;\nexport type Navigator = {\n userAgent: string;\n platform: string;\n maxTouchPoints?: number;\n};\n\nconst isAppleTabletOnIos13 = (navigator?: Navigator): boolean => {\n return (\n typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined'\n );\n};\n\nfunction createMatch(userAgent: UserAgent): (regex: RegExp) => boolean {\n return (regex: RegExp): boolean => regex.test(userAgent);\n}\n\nexport type isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport type IsMobileParameter = UserAgent | Navigator;\n\nexport default function isMobile(param?: IsMobileParameter): isMobileResult {\n let nav: Navigator = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0,\n };\n\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0,\n };\n } else if (typeof param === 'string') {\n nav.userAgent = param;\n } else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0,\n };\n }\n\n let userAgent = nav.userAgent;\n\n // Facebook mobile app's integrated browser adds a bunch of strings that\n // match everything. Strip it out if it exists.\n let tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n // Twitter mobile app's integrated browser on iPad adds a \"Twitter for\n // iPhone\" string. Same probably happens on other tablet platforms.\n // This will confuse detection so strip it out if it exists.\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n const match = createMatch(userAgent);\n\n const result: isMobileResult = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet:\n !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device:\n (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet),\n },\n android: {\n phone:\n (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet:\n !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device:\n (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i),\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet),\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device:\n match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome),\n },\n any: false,\n phone: false,\n tablet: false,\n };\n\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n // excludes 'other' devices and ipods, targeting touchscreen phones\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n\n return result;\n}\n", "import isMobileJs from 'ismobilejs';\n\n// ismobilejs have different import behavior for CJS and ESM, so here is the hack\ntype isMobileJsType = typeof isMobileJs & { default?: typeof isMobileJs };\nconst isMobileCall = (isMobileJs as isMobileJsType).default ?? isMobileJs;\n\nexport type isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport const isMobile: isMobileResult = isMobileCall(globalThis.navigator);\n", "import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nexport { settings };\n", "import './settings.mjs';\nexport { isMobile } from '@pixi/settings';\nexport { default as EventEmitter } from 'eventemitter3';\nexport { default as earcut } from 'earcut';\nexport { url } from './url.mjs';\nexport { path } from './path.mjs';\nexport { sayHello, skipHello } from './browser/hello.mjs';\nexport { isWebGLSupported } from './browser/isWebGLSupported.mjs';\nexport { hex2rgb, hex2string, rgb2hex, string2hex } from './color/hex.mjs';\nexport { correctBlendMode, premultiplyBlendMode, premultiplyRgba, premultiplyTint, premultiplyTintToRgba } from './color/premultiply.mjs';\nexport { DATA_URI } from './const.mjs';\nexport { createIndicesForQuads } from './data/createIndicesForQuads.mjs';\nexport { getBufferType } from './data/getBufferType.mjs';\nexport { interleaveTypedArrays } from './data/interleaveTypedArrays.mjs';\nexport { isPow2, log2, nextPow2 } from './data/pow2.mjs';\nexport { removeItems } from './data/removeItems.mjs';\nexport { sign } from './data/sign.mjs';\nexport { uid } from './data/uid.mjs';\nexport { deprecation } from './logging/deprecation.mjs';\nexport { BoundingBox } from './media/BoundingBox.mjs';\nexport { BaseTextureCache, ProgramCache, TextureCache, clearTextureCache, destroyTextureCache } from './media/caches.mjs';\nexport { CanvasRenderTarget } from './media/CanvasRenderTarget.mjs';\nexport { getCanvasBoundingBox } from './media/getCanvasBoundingBox.mjs';\nexport { trimCanvas } from './media/trimCanvas.mjs';\nexport { decomposeDataUri } from './network/decomposeDataUri.mjs';\nexport { determineCrossOrigin } from './network/determineCrossOrigin.mjs';\nexport { getResolutionOfUrl } from './network/getResolutionOfUrl.mjs';\nimport './types/index.mjs';\n//# sourceMappingURL=index.mjs.map\n", "/*\n * This file contains redeclared types for Node `url` and `querystring` modules. These modules\n * don't provide their own typings but instead are a part of the full Node typings. The purpose of\n * this file is to redeclare the required types to avoid having the whole Node types as a\n * dependency.\n */\n\nimport { format as _format, parse as _parse, resolve as _resolve } from 'url';\n\ninterface ParsedUrlQuery\n{\n [key: string]: string | string[];\n}\n\ninterface ParsedUrlQueryInput\n{\n [key: string]: unknown;\n}\n\ninterface UrlObjectCommon\n{\n auth?: string;\n hash?: string;\n host?: string;\n hostname?: string;\n href?: string;\n path?: string;\n pathname?: string;\n protocol?: string;\n search?: string;\n slashes?: boolean;\n}\n\n// Input to `url.format`\ninterface UrlObject extends UrlObjectCommon\n{\n port?: string | number;\n query?: string | null | ParsedUrlQueryInput;\n}\n\n// Output of `url.parse`\ninterface Url extends UrlObjectCommon\n{\n port?: string;\n query?: string | null | ParsedUrlQuery;\n}\n\ninterface UrlWithParsedQuery extends Url\n{\n query: ParsedUrlQuery;\n}\n\ninterface UrlWithStringQuery extends Url\n{\n query: string | null;\n}\n\ninterface URLFormatOptions\n{\n auth?: boolean;\n fragment?: boolean;\n search?: boolean;\n unicode?: boolean;\n}\n\ntype ParseFunction = {\n (urlStr: string): UrlWithStringQuery;\n (urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;\n (urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;\n (urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;\n};\n\ntype FormatFunction = {\n (URL: URL, options?: URLFormatOptions): string;\n (urlObject: UrlObject | string): string;\n};\n\ntype ResolveFunction = {\n (from: string, to: string): string;\n};\n\nexport const url = {\n parse: _parse as ParseFunction,\n format: _format as FormatFunction,\n resolve: _resolve as ResolveFunction,\n};\n", "import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\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('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n", "import { settings } from '../settings';\n\nlet supported: boolean | undefined;\n\n/**\n * Helper for checking for WebGL support.\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @returns {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!settings.ADAPTER.getWebGLRenderingContext())\n {\n return false;\n }\n\n const canvas = settings.ADAPTER.createCanvas();\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext | null;\n\n const success = !!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 return supported;\n}\n", "var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return\"string\"==typeof r?r.length>0:\"number\"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?\"0\"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,p=/^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s+([+-]?\\d*\\.?\\d+)%\\s+([+-]?\\d*\\.?\\d+)%\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,v=/^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,m=/^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},\"hex\"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},\"rgb\"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u=\"deg\"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},\"hsl\"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},\"rgb\"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},\"hsl\"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},\"hsv\"]]},N=function(r,t){for(var n=0;n=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):\"\",\"#\"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?\"rgba(\"+t+\", \"+n+\", \"+e+\", \"+u+\")\":\"rgb(\"+t+\", \"+n+\", \"+e+\")\";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?\"hsla(\"+t+\", \"+n+\"%, \"+e+\"%, \"+u+\")\":\"hsl(\"+t+\", \"+n+\"%, \"+e+\"%)\";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return\"number\"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return\"number\"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};export{j as Colord,w as colord,k as extend,I as getFormat,E as random};\n", "export default function(e,f){var a={white:\"#ffffff\",bisque:\"#ffe4c4\",blue:\"#0000ff\",cadetblue:\"#5f9ea0\",chartreuse:\"#7fff00\",chocolate:\"#d2691e\",coral:\"#ff7f50\",antiquewhite:\"#faebd7\",aqua:\"#00ffff\",azure:\"#f0ffff\",whitesmoke:\"#f5f5f5\",papayawhip:\"#ffefd5\",plum:\"#dda0dd\",blanchedalmond:\"#ffebcd\",black:\"#000000\",gold:\"#ffd700\",goldenrod:\"#daa520\",gainsboro:\"#dcdcdc\",cornsilk:\"#fff8dc\",cornflowerblue:\"#6495ed\",burlywood:\"#deb887\",aquamarine:\"#7fffd4\",beige:\"#f5f5dc\",crimson:\"#dc143c\",cyan:\"#00ffff\",darkblue:\"#00008b\",darkcyan:\"#008b8b\",darkgoldenrod:\"#b8860b\",darkkhaki:\"#bdb76b\",darkgray:\"#a9a9a9\",darkgreen:\"#006400\",darkgrey:\"#a9a9a9\",peachpuff:\"#ffdab9\",darkmagenta:\"#8b008b\",darkred:\"#8b0000\",darkorchid:\"#9932cc\",darkorange:\"#ff8c00\",darkslateblue:\"#483d8b\",gray:\"#808080\",darkslategray:\"#2f4f4f\",darkslategrey:\"#2f4f4f\",deeppink:\"#ff1493\",deepskyblue:\"#00bfff\",wheat:\"#f5deb3\",firebrick:\"#b22222\",floralwhite:\"#fffaf0\",ghostwhite:\"#f8f8ff\",darkviolet:\"#9400d3\",magenta:\"#ff00ff\",green:\"#008000\",dodgerblue:\"#1e90ff\",grey:\"#808080\",honeydew:\"#f0fff0\",hotpink:\"#ff69b4\",blueviolet:\"#8a2be2\",forestgreen:\"#228b22\",lawngreen:\"#7cfc00\",indianred:\"#cd5c5c\",indigo:\"#4b0082\",fuchsia:\"#ff00ff\",brown:\"#a52a2a\",maroon:\"#800000\",mediumblue:\"#0000cd\",lightcoral:\"#f08080\",darkturquoise:\"#00ced1\",lightcyan:\"#e0ffff\",ivory:\"#fffff0\",lightyellow:\"#ffffe0\",lightsalmon:\"#ffa07a\",lightseagreen:\"#20b2aa\",linen:\"#faf0e6\",mediumaquamarine:\"#66cdaa\",lemonchiffon:\"#fffacd\",lime:\"#00ff00\",khaki:\"#f0e68c\",mediumseagreen:\"#3cb371\",limegreen:\"#32cd32\",mediumspringgreen:\"#00fa9a\",lightskyblue:\"#87cefa\",lightblue:\"#add8e6\",midnightblue:\"#191970\",lightpink:\"#ffb6c1\",mistyrose:\"#ffe4e1\",moccasin:\"#ffe4b5\",mintcream:\"#f5fffa\",lightslategray:\"#778899\",lightslategrey:\"#778899\",navajowhite:\"#ffdead\",navy:\"#000080\",mediumvioletred:\"#c71585\",powderblue:\"#b0e0e6\",palegoldenrod:\"#eee8aa\",oldlace:\"#fdf5e6\",paleturquoise:\"#afeeee\",mediumturquoise:\"#48d1cc\",mediumorchid:\"#ba55d3\",rebeccapurple:\"#663399\",lightsteelblue:\"#b0c4de\",mediumslateblue:\"#7b68ee\",thistle:\"#d8bfd8\",tan:\"#d2b48c\",orchid:\"#da70d6\",mediumpurple:\"#9370db\",purple:\"#800080\",pink:\"#ffc0cb\",skyblue:\"#87ceeb\",springgreen:\"#00ff7f\",palegreen:\"#98fb98\",red:\"#ff0000\",yellow:\"#ffff00\",slateblue:\"#6a5acd\",lavenderblush:\"#fff0f5\",peru:\"#cd853f\",palevioletred:\"#db7093\",violet:\"#ee82ee\",teal:\"#008080\",slategray:\"#708090\",slategrey:\"#708090\",aliceblue:\"#f0f8ff\",darkseagreen:\"#8fbc8f\",darkolivegreen:\"#556b2f\",greenyellow:\"#adff2f\",seagreen:\"#2e8b57\",seashell:\"#fff5ee\",tomato:\"#ff6347\",silver:\"#c0c0c0\",sienna:\"#a0522d\",lavender:\"#e6e6fa\",lightgreen:\"#90ee90\",orange:\"#ffa500\",orangered:\"#ff4500\",steelblue:\"#4682b4\",royalblue:\"#4169e1\",turquoise:\"#40e0d0\",yellowgreen:\"#9acd32\",salmon:\"#fa8072\",saddlebrown:\"#8b4513\",sandybrown:\"#f4a460\",rosybrown:\"#bc8f8f\",darksalmon:\"#e9967a\",lightgoldenrodyellow:\"#fafad2\",snow:\"#fffafa\",lightgrey:\"#d3d3d3\",lightgray:\"#d3d3d3\",dimgray:\"#696969\",dimgrey:\"#696969\",olivedrab:\"#6b8e23\",olive:\"#808000\"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return\"transparent\";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b=\"black\";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u | null;\n\n /** Normalized rgba component, floats from 0-1 */\n private _components: Float32Array;\n\n /** Cache color as number */\n private _int: number;\n\n /**\n * @param {PIXI.ColorSource} value - Optional value to use, if not provided, white is used.\n */\n constructor(value: ColorSource = 0xffffff)\n {\n this._value = null;\n this._components = new Float32Array(4);\n this._components.fill(1);\n this._int = 0xffffff;\n this.value = value;\n }\n\n /** Get red component (0 - 1) */\n get red(): number\n {\n return this._components[0];\n }\n\n /** Get green component (0 - 1) */\n get green(): number\n {\n return this._components[1];\n }\n\n /** Get blue component (0 - 1) */\n get blue(): number\n {\n return this._components[2];\n }\n\n /** Get alpha component (0 - 1) */\n get alpha(): number\n {\n return this._components[3];\n }\n\n /**\n * Set the value, suitable for chaining\n * @param value\n * @see PIXI.Color.value\n */\n setValue(value: ColorSource): this\n {\n this.value = value;\n\n return this;\n }\n\n /**\n * The current color source.\n *\n * When setting:\n * - Setting to an instance of `Color` will copy its color source and components.\n * - Otherwise, `Color` will try to normalize the color source and set the components.\n * If the color source is invalid, an `Error` will be thrown and the `Color` will left unchanged.\n *\n * Note: The `null` in the setter's parameter type is added to match the TypeScript rule: return type of getter\n * must be assignable to its setter's parameter type. Setting `value` to `null` will throw an `Error`.\n *\n * When getting:\n * - A return value of `null` means the previous value was overridden (e.g., {@link PIXI.Color.multiply multiply},\n * {@link PIXI.Color.premultiply premultiply} or {@link PIXI.Color.round round}).\n * - Otherwise, the color source used when setting is returned.\n * @type {PIXI.ColorSource}\n */\n set value(value: ColorSource | null)\n {\n // Support copying from other Color objects\n if (value instanceof Color)\n {\n this._value = this.cloneSource(value._value);\n this._int = value._int;\n this._components.set(value._components);\n }\n else if (value === null)\n {\n throw new Error('Cannot set PIXI.Color#value to null');\n }\n else if (this._value === null || !this.isSourceEqual(this._value, value))\n {\n this.normalize(value);\n this._value = this.cloneSource(value);\n }\n }\n get value(): Exclude | null\n {\n return this._value;\n }\n\n /**\n * Copy a color source internally.\n * @param value - Color source\n */\n private cloneSource(value: Exclude | null): Exclude | null\n {\n if (typeof value === 'string' || typeof value === 'number' || value instanceof Number || value === null)\n {\n return value;\n }\n else if (Array.isArray(value) || ArrayBuffer.isView(value))\n {\n return value.slice(0);\n }\n else if (typeof value === 'object' && value !== null)\n {\n return { ...value };\n }\n\n return value;\n }\n\n /**\n * Equality check for color sources.\n * @param value1 - First color source\n * @param value2 - Second color source\n * @returns `true` if the color sources are equal, `false` otherwise.\n */\n private isSourceEqual(value1: Exclude, value2: Exclude): boolean\n {\n const type1 = typeof value1;\n const type2 = typeof value2;\n\n // Mismatched types\n if (type1 !== type2)\n {\n return false;\n }\n // Handle numbers/strings and things that extend Number\n // important to do the instanceof Number first, as this is \"object\" type\n else if (type1 === 'number' || type1 === 'string' || value1 instanceof Number)\n {\n return value1 === value2;\n }\n // Handle Arrays and TypedArrays\n else if ((Array.isArray(value1) && Array.isArray(value2))\n || (ArrayBuffer.isView(value1) && ArrayBuffer.isView(value2)))\n {\n if (value1.length !== value2.length)\n {\n return false;\n }\n\n return value1.every((v, i) => v === value2[i]);\n }\n // Handle Objects\n else if (value1 !== null && value2 !== null)\n {\n const keys1 = Object.keys(value1) as (keyof typeof value1)[];\n const keys2 = Object.keys(value2) as (keyof typeof value2)[];\n\n if (keys1.length !== keys2.length)\n {\n return false;\n }\n\n return keys1.every((key) => value1[key] === value2[key]);\n }\n\n return value1 === value2;\n }\n\n /**\n * Convert to a RGBA color object.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toRgb(); // returns { r: 1, g: 1, b: 1, a: 1 }\n */\n toRgba(): RgbaColor\n {\n const [r, g, b, a] = this._components;\n\n return { r, g, b, a };\n }\n\n /**\n * Convert to a RGB color object.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toRgb(); // returns { r: 1, g: 1, b: 1 }\n */\n toRgb(): RgbColor\n {\n const [r, g, b] = this._components;\n\n return { r, g, b };\n }\n\n /** Convert to a CSS-style rgba string: `rgba(255,255,255,1.0)`. */\n toRgbaString(): string\n {\n const [r, g, b] = this.toUint8RgbArray();\n\n return `rgba(${r},${g},${b},${this.alpha})`;\n }\n\n /**\n * Convert to an [R, G, B] array of clamped uint8 values (0 to 255).\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toUint8RgbArray(); // returns [255, 255, 255]\n * @param {number[]|Uint8Array|Uint8ClampedArray} [out] - Output array\n */\n toUint8RgbArray(): number[];\n toUint8RgbArray(out: T): T;\n toUint8RgbArray(out?: T): T\n {\n const [r, g, b] = this._components;\n\n out = out ?? [] as number[] as T;\n\n out[0] = Math.round(r * 255);\n out[1] = Math.round(g * 255);\n out[2] = Math.round(b * 255);\n\n return out;\n }\n\n /**\n * Convert to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toRgbArray(); // returns [1, 1, 1]\n * @param {number[]|Float32Array} [out] - Output array\n */\n toRgbArray(): number[];\n toRgbArray(out: T): T;\n toRgbArray(out?: T): T\n {\n out = out ?? [] as number[] as T;\n const [r, g, b] = this._components;\n\n out[0] = r;\n out[1] = g;\n out[2] = b;\n\n return out;\n }\n\n /**\n * Convert to a hexadecimal number.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toNumber(); // returns 16777215\n */\n toNumber(): number\n {\n return this._int;\n }\n\n /**\n * Convert to a hexadecimal number in little endian format (e.g., BBGGRR).\n * @example\n * import { Color } from 'pixi.js';\n * new Color(0xffcc99).toLittleEndianNumber(); // returns 0x99ccff\n * @returns {number} - The color as a number in little endian format.\n */\n toLittleEndianNumber(): number\n {\n const value = this._int;\n\n return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /**\n * Multiply with another color. This action is destructive, and will\n * override the previous `value` property to be `null`.\n * @param {PIXI.ColorSource} value - The color to multiply by.\n */\n multiply(value: ColorSource): this\n {\n const [r, g, b, a] = Color.temp.setValue(value)._components;\n\n this._components[0] *= r;\n this._components[1] *= g;\n this._components[2] *= b;\n this._components[3] *= a;\n\n this.refreshInt();\n this._value = null;\n\n return this;\n }\n\n /**\n * Converts color to a premultiplied alpha format. This action is destructive, and will\n * override the previous `value` property to be `null`.\n * @param alpha - The alpha to multiply by.\n * @param {boolean} [applyToRGB=true] - Whether to premultiply RGB channels.\n * @returns {PIXI.Color} - Itself.\n */\n premultiply(alpha: number, applyToRGB = true): this\n {\n if (applyToRGB)\n {\n this._components[0] *= alpha;\n this._components[1] *= alpha;\n this._components[2] *= alpha;\n }\n this._components[3] = alpha;\n\n this.refreshInt();\n this._value = null;\n\n return this;\n }\n\n /**\n * Premultiplies alpha with current color.\n * @param {number} alpha - The alpha to multiply by.\n * @param {boolean} [applyToRGB=true] - Whether to premultiply RGB channels.\n * @returns {number} tint multiplied by alpha\n */\n toPremultiplied(alpha: number, applyToRGB = true): number\n {\n if (alpha === 1.0)\n {\n return (0xFF << 24) + this._int;\n }\n if (alpha === 0.0)\n {\n return applyToRGB ? 0 : this._int;\n }\n let r = ((this._int >> 16) & 0xFF);\n let g = ((this._int >> 8) & 0xFF);\n let b = (this._int & 0xFF);\n\n if (applyToRGB)\n {\n r = ((r * alpha) + 0.5) | 0;\n g = ((g * alpha) + 0.5) | 0;\n b = ((b * alpha) + 0.5) | 0;\n }\n\n return (alpha * 255 << 24) + (r << 16) + (g << 8) + b;\n }\n\n /**\n * Convert to a hexidecimal string.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toHex(); // returns \"#ffffff\"\n */\n toHex(): string\n {\n const hexString = this._int.toString(16);\n\n return `#${'000000'.substring(0, 6 - hexString.length) + hexString}`;\n }\n\n /**\n * Convert to a hexidecimal string with alpha.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toHexa(); // returns \"#ffffffff\"\n */\n toHexa(): string\n {\n const alphaValue = Math.round(this._components[3] * 255);\n const alphaString = alphaValue.toString(16);\n\n return this.toHex() + '00'.substring(0, 2 - alphaString.length) + alphaString;\n }\n\n /**\n * Set alpha, suitable for chaining.\n * @param alpha\n */\n setAlpha(alpha: number): this\n {\n this._components[3] = this._clamp(alpha);\n\n return this;\n }\n\n /**\n * Rounds the specified color according to the step. This action is destructive, and will\n * override the previous `value` property to be `null`. The alpha component is not rounded.\n * @param steps - Number of steps which will be used as a cap when rounding colors\n */\n round(steps: number): this\n {\n const [r, g, b] = this._components;\n\n this._components[0] = Math.round(r * steps) / steps;\n this._components[1] = Math.round(g * steps) / steps;\n this._components[2] = Math.round(b * steps) / steps;\n this.refreshInt();\n this._value = null;\n\n return this;\n }\n\n /**\n * Convert to an [R, G, B, A] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toArray(); // returns [1, 1, 1, 1]\n * @param {number[]|Float32Array} [out] - Output array\n */\n toArray(): number[];\n toArray(out: T): T;\n toArray(out?: T): T\n {\n out = out ?? [] as number[] as T;\n const [r, g, b, a] = this._components;\n\n out[0] = r;\n out[1] = g;\n out[2] = b;\n out[3] = a;\n\n return out;\n }\n\n /**\n * Normalize the input value into rgba\n * @param value - Input value\n */\n private normalize(value: Exclude): void\n {\n let r: number | undefined;\n let g: number | undefined;\n let b: number | undefined;\n let a: number | undefined;\n\n // Number is a primative so typeof works fine, but in the case\n // that someone creates a class that extends Number, we also\n // need to check for instanceof Number\n if ((typeof value === 'number' || value instanceof Number) && value >= 0 && value <= 0xffffff)\n {\n const int = value as number; // cast required because instanceof Number is ambiguous for TS\n\n r = ((int >> 16) & 0xFF) / 255;\n g = ((int >> 8) & 0xFF) / 255;\n b = (int & 0xFF) / 255;\n a = 1.0;\n }\n else if ((Array.isArray(value) || value instanceof Float32Array)\n // Can be rgb or rgba\n && value.length >= 3 && value.length <= 4)\n {\n // make sure all values are 0 - 1\n value = this._clamp(value);\n [r, g, b, a = 1.0] = value;\n }\n else if ((value instanceof Uint8Array || value instanceof Uint8ClampedArray)\n // Can be rgb or rgba\n && value.length >= 3 && value.length <= 4)\n {\n // make sure all values are 0 - 255\n value = this._clamp(value, 0, 255);\n [r, g, b, a = 255] = value;\n r /= 255;\n g /= 255;\n b /= 255;\n a /= 255;\n }\n else if (typeof value === 'string' || typeof value === 'object')\n {\n if (typeof value === 'string')\n {\n const match = Color.HEX_PATTERN.exec(value);\n\n if (match)\n {\n // Normalize hex string, remove 0x or # prefix\n value = `#${match[2]}`;\n }\n }\n\n const color = colord(value as AnyColor);\n\n if (color.isValid())\n {\n ({ r, g, b, a } = color.rgba);\n r /= 255;\n g /= 255;\n b /= 255;\n }\n }\n\n // Cache normalized values for rgba and hex integer\n if (r !== undefined)\n {\n this._components[0] = r as number;\n this._components[1] = g as number;\n this._components[2] = b as number;\n this._components[3] = a as number;\n this.refreshInt();\n }\n else\n {\n throw new Error(`Unable to convert color ${value}`);\n }\n }\n\n /** Refresh the internal color rgb number */\n private refreshInt(): void\n {\n // Clamp values to 0 - 1\n this._clamp(this._components);\n\n const [r, g, b] = this._components;\n\n this._int = (((r * 255) << 16) + ((g * 255) << 8) + (b * 255 | 0));\n }\n\n /**\n * Clamps values to a range. Will override original values\n * @param value - Value(s) to clamp\n * @param min - Minimum value\n * @param max - Maximum value\n */\n private _clamp(value: T, min = 0, max = 1): T\n {\n if (typeof value === 'number')\n {\n return Math.min(Math.max(value, min), max) as T;\n }\n\n value.forEach((v, i) =>\n {\n value[i] = Math.min(Math.max(v, min), max);\n });\n\n return value;\n }\n}\n", "import { Color } from '@pixi/color';\nimport { BLEND_MODES } from '@pixi/constants';\nimport { deprecation } from '../logging/deprecation';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @returns {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\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: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\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: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @deprecated since 7.2.0\n * @see PIXI.Color.premultiply\n * @param {Float32Array|number[]} rgb -\n * @param {number} alpha -\n * @param {Float32Array} [out] -\n * @param {boolean} [premultiply=true] -\n */\nexport function premultiplyRgba(\n rgb: Float32Array | number[],\n alpha: number,\n out?: Float32Array,\n premultiply = true\n): Float32Array\n{\n // #if _DEBUG\n deprecation('7.2.0', `utils.premultiplyRgba has moved to Color.premultiply`);\n // #endif\n\n return Color.shared\n .setValue(rgb)\n .premultiply(alpha, premultiply)\n .toArray(out ?? new Float32Array(4));\n}\n\n/**\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @deprecated since 7.2.0\n * @see PIXI.Color.toPremultiplied\n * @param {number} tint -\n * @param {number} alpha -\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n // #if _DEBUG\n deprecation('7.2.0', `utils.premultiplyTint has moved to Color.toPremultiplied`);\n // #endif\n\n return Color.shared\n .setValue(tint)\n .toPremultiplied(alpha);\n}\n\n/**\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @deprecated since 7.2.0\n * @see PIXI.Color.premultiply\n * @param {number} tint -\n * @param {number} alpha -\n * @param {Float32Array} [out] -\n * @param {boolean} [premultiply=true] -\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out?: Float32Array, premultiply = true): Float32Array\n{\n // #if _DEBUG\n deprecation('7.2.0', `utils.premultiplyTintToRgba has moved to Color.premultiply`);\n // #endif\n\n return Color.shared\n .setValue(tint)\n .premultiply(alpha, premultiply)\n .toArray(out ?? new Float32Array(4));\n}\n", "import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(\n array: ITypedArray\n): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n", "// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n", "/**\n * Remove items from a javascript array without generating garbage\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n", "let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n * @memberof PIXI.utils\n * @function uid\n * @returns {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n", "/**\n * A rectangular bounding box describing the boundary of an area.\n * @memberof PIXI.utils\n * @since 7.1.0\n */\nexport class BoundingBox\n{\n /** The left coordinate value of the bounding box. */\n left: number;\n /** The top coordinate value of the bounding box. */\n top: number;\n /** The right coordinate value of the bounding box. */\n right: number;\n /** The bottom coordinate value of the bounding box. */\n bottom: number;\n\n /**\n * @param left - The left coordinate value of the bounding box.\n * @param top - The top coordinate value of the bounding box.\n * @param right - The right coordinate value of the bounding box.\n * @param bottom - The bottom coordinate value of the bounding box.\n */\n constructor(left: number, top: number, right: number, bottom: number)\n {\n this.left = left;\n this.top = top;\n this.right = right;\n this.bottom = bottom;\n }\n\n /** The width of the bounding box. */\n get width(): number { return this.right - this.left; }\n /** The height of the bounding box. */\n get height(): number { return this.bottom - this.top; }\n\n /** Determines whether the BoundingBox is empty. */\n isEmpty(): boolean\n {\n return this.left === this.right || this.top === this.bottom;\n }\n\n /**\n * An empty BoundingBox.\n * @type {PIXI.utils.BoundingBox}\n */\n public static readonly EMPTY = new BoundingBox(0, 0, 0, 0);\n}\n", "import type { BaseTexture, Program, Texture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Record}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Record}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Record}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\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 * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\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", "import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement | undefined;\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 * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @returns {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = globalThis.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.startsWith('data:'))\n {\n return '';\n }\n\n // default is window.location\n loc = loc || globalThis.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 const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n", "import { settings } from '../settings';\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 * @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 * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue = 1): number\n{\n const resolution = settings.RETINA_PREFIX?.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue;\n}\n", "/**\n * Collection of valid extension types.\n * @memberof PIXI\n * @property {string} Application - Application plugins\n * @property {string} RendererPlugin - Plugins for Renderer\n * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer\n * @property {string} Loader - Plugins to use with Loader\n * @property {string} LoadParser - Parsers for Assets loader.\n * @property {string} ResolveParser - Parsers for Assets resolvers.\n * @property {string} CacheParser - Parsers for Assets cache.\n */\nenum ExtensionType\n// eslint-disable-next-line @typescript-eslint/indent\n{\n Renderer = 'renderer',\n Application = 'application',\n RendererSystem = 'renderer-webgl-system',\n RendererPlugin = 'renderer-webgl-plugin',\n CanvasRendererSystem = 'renderer-canvas-system',\n CanvasRendererPlugin = 'renderer-canvas-plugin',\n Asset = 'asset',\n LoadParser = 'load-parser',\n ResolveParser = 'resolve-parser',\n CacheParser = 'cache-parser',\n DetectionParser = 'detection-parser',\n}\n\ninterface ExtensionMetadataDetails\n{\n type: ExtensionType | ExtensionType[];\n name?: string;\n priority?: number;\n}\n\ntype ExtensionMetadata = ExtensionType | ExtensionMetadataDetails;\n\n/**\n * Format when registering an extension. Generally, the extension\n * should have these values as `extension` static property,\n * but you can override name or type by providing an object.\n * @memberof PIXI\n */\ninterface ExtensionFormatLoose\n{\n /** The extension type, can be multiple types */\n type: ExtensionType | ExtensionType[];\n /** Optional. Some plugins provide an API name/property, such as Renderer plugins */\n name?: string;\n /** Optional, used for sorting the plugins in a particular order */\n priority?: number;\n /** Reference to the plugin object/class */\n ref: any;\n}\n\n/**\n * Strict extension format that is used internally for registrations.\n * @memberof PIXI\n */\ninterface ExtensionFormat extends ExtensionFormatLoose\n{\n /** The extension type, always expressed as multiple, even if a single */\n type: ExtensionType[];\n}\n\ntype ExtensionHandler = (extension: ExtensionFormat) => void;\n\n/**\n * Convert input into extension format data.\n * @ignore\n */\nconst normalizeExtension = (ext: ExtensionFormatLoose | any): ExtensionFormat =>\n{\n // Class/Object submission, use extension object\n if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension))\n {\n // #if _DEBUG\n if (!ext.extension)\n {\n throw new Error('Extension class must have an extension object');\n }\n // #endif\n const metadata: ExtensionMetadataDetails = (typeof ext.extension !== 'object')\n ? { type: ext.extension }\n : ext.extension;\n\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === 'object')\n {\n ext = { ...ext };\n }\n else\n {\n throw new Error('Invalid extension type');\n }\n\n if (typeof ext.type === 'string')\n {\n ext.type = [ext.type];\n }\n\n return ext;\n};\n\n/**\n * Get the priority for an extension.\n * @ignore\n * @param ext - Any extension\n * @param defaultPriority - Fallback priority if none is defined.\n * @returns The priority for the extension.\n */\nconst normalizePriority = (ext: ExtensionFormatLoose | any, defaultPriority: number): number =>\n normalizeExtension(ext).priority ?? defaultPriority;\n\n/**\n * Global registration of all PixiJS extensions. One-stop-shop for extensibility.\n * @memberof PIXI\n * @namespace extensions\n */\nconst extensions = {\n\n /** @ignore */\n _addHandlers: {} as Record,\n\n /** @ignore */\n _removeHandlers: {} as Record,\n\n /** @ignore */\n _queue: {} as Record,\n\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {PIXI.extensions} For chaining.\n */\n remove(...extensions: Array)\n {\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n\n return this;\n },\n\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {PIXI.extensions} For chaining.\n */\n add(...extensions: Array)\n {\n // Handle any extensions either passed as class w/ data or as data\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) =>\n {\n const handlers = this._addHandlers;\n const queue = this._queue;\n\n if (!handlers[type])\n {\n queue[type] = queue[type] || [];\n queue[type].push(ext);\n }\n else\n {\n handlers[type](ext);\n }\n });\n });\n\n return this;\n },\n\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}.\n * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}.\n * @returns {PIXI.extensions} For chaining.\n */\n handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler)\n {\n const addHandlers = this._addHandlers;\n const removeHandlers = this._removeHandlers;\n\n // #if _DEBUG\n if (addHandlers[type] || removeHandlers[type])\n {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n // #endif\n\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n\n // Process the queue\n const queue = this._queue;\n\n // Process any plugins that have been registered before the handler\n if (queue[type])\n {\n queue[type].forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n\n return this;\n },\n\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByMap(type: ExtensionType, map: Record)\n {\n return this.handle(type,\n (extension) =>\n {\n map[extension.name] = extension.ref;\n },\n (extension) =>\n {\n delete map[extension.name];\n }\n );\n },\n\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @param defaultPriority - The default priority to use if none is specified.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByList(type: ExtensionType, list: any[], defaultPriority = -1)\n {\n return this.handle(\n type,\n (extension) =>\n {\n if (list.includes(extension.ref))\n {\n return;\n }\n\n list.push(extension.ref);\n list.sort((a, b) => normalizePriority(b, defaultPriority) - normalizePriority(a, defaultPriority));\n },\n (extension) =>\n {\n const index = list.indexOf(extension.ref);\n\n if (index !== -1)\n {\n list.splice(index, 1);\n }\n }\n );\n },\n};\n\nexport {\n extensions,\n ExtensionType,\n};\nexport type {\n ExtensionFormat,\n ExtensionFormatLoose,\n ExtensionHandler,\n ExtensionMetadata,\n};\n", "import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n\n /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */\n public rawBinaryData: ArrayBuffer;\n\n /** View on the raw binary data as a `Uint32Array`. */\n public uint32View: Uint32Array;\n\n /** View on the raw binary data as a `Float32Array`. */\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array)\n {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\n\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /** View on the raw binary data as a `Int8Array`. */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /** View on the raw binary data as a `Int16Array`. */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /** View on the raw binary data as a `Uint16Array`. */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /** View on the raw binary data as a `Int32Array`. */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /** Destroys all buffer references. Do not use after calling this. */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n", "import type { IRenderingContext } from '../../IRenderer';\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\nfunction generateIfTestSrc(maxIfs: number): string\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\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\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 return maxIfs;\n}\n", "import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:State `\n + `blendMode=${this.blendMode} `\n + `clockwiseFrontFace=${this.clockwiseFrontFace} `\n + `culling=${this.culling} `\n + `depthMask=${this.depthMask} `\n + `polygonOffset=${this.polygonOffset}`\n + `]`;\n }\n // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n", "import type { ISize } from '@pixi/math';\nimport type { ICubeResourceOptions } from './CubeResource';\nimport type { IImageResourceOptions } from './ImageResource';\nimport type { Resource } from './Resource';\nimport type { ISVGResourceOptions } from './SVGResource';\nimport type { IVideoResourceOptions } from './VideoResource';\n\n/*\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/*\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n| ICubeResourceOptions\n| IImageResourceOptions\n| ISVGResourceOptions\n| IVideoResourceOptions\n| IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n * @memberof PIXI\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // Upload with GL\n * return true;\n * }\n * // Used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz' || source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array> = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @returns {PIXI.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n", "/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n * Like a signal:\n *\n * ```js\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded'),\n * };\n *\n * const listener = {\n * loaded: function() {\n * // Do something when loaded\n * }\n * };\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items:\n *\n * ```js\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update'),\n * };\n *\n * const gameObject = {\n * update: function(time) {\n * // Update my gamey state\n * },\n * };\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * E.g. A listener passed to this Runner will require a 'complete' function.\n *\n * ```js\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.includes(item);\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n", "import { Runner } from '@pixi/runner';\n\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n * @memberof PIXI\n */\nexport abstract class Resource\n{\n /** The url of the resource */\n public src: string;\n\n /**\n * If resource has been destroyed.\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @returns Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n * @param _renderer - yeah, renderer!\n * @param _baseTexture - the texture\n * @param _glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type.\n * @param {*} _source - The source object\n * @param {string} _extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { Resource } from './Resource';\n\nimport type { ISize } from '@pixi/math';\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Buffer resource with data of typed array.\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */\n data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;\n\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if \\\n */\n static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n", "import { ALPHA_MODES, FORMATS, MIPMAP_MODES, SCALE_MODES, TARGETS, TYPES, WRAP_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { BufferResource } from './resources/BufferResource';\nimport { Resource } from './resources/Resource';\n\nimport type { MSAA_QUALITY } from '@pixi/constants';\nimport type { ICanvas } from '@pixi/settings';\nimport type { GLTexture } from './GLTexture';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement | HTMLVideoElement | ImageBitmap | ICanvas;\n\nexport interface IBaseTextureOptions\n{\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n * @member {number}\n * @default 0\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n touched: number;\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 * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\n /**\n * Default options used when creating BaseTexture objects.\n * @static\n * @memberof PIXI.BaseTexture\n * @type {PIXI.IBaseTextureOptions}\n */\n public static defaultOptions: IBaseTextureOptions = {\n /**\n * If mipmapping is enabled for texture.\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n mipmap: MIPMAP_MODES.POW2,\n /** Anisotropic filtering level of texture */\n anisotropicLevel: 0,\n /**\n * Default scale mode, linear, nearest.\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n scaleMode: SCALE_MODES.LINEAR,\n /**\n * Wrap mode for textures.\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n wrapMode: WRAP_MODES.CLAMP,\n /**\n * Pre multiply the image alpha\n * @type {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n alphaMode: ALPHA_MODES.UNPACK,\n /**\n * GL texture target\n * @type {PIXI.TARGETS}\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n target: TARGETS.TEXTURE_2D,\n /**\n * GL format type\n * @type {PIXI.FORMATS}\n * @default PIXI.FORMATS.RGBA\n */\n format: FORMATS.RGBA,\n /**\n * GL data type\n * @type {PIXI.TYPES}\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n type: TYPES.UNSIGNED_BYTE,\n };\n\n /**\n * @param {PIXI.Resource|HTMLImageElement|HTMLVideoElement|ImageBitmap|ICanvas|string} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param options - Collection of options, default options inherited from {@link PIXI.BaseTexture.defaultOptions}.\n * @param {PIXI.MIPMAP_MODES} [options.mipmap] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format] - GL format type\n * @param {PIXI.TYPES} [options.type] - GL data type\n * @param {PIXI.TARGETS} [options.target] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = Object.assign({}, BaseTexture.defaultOptions, options);\n\n const {\n alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions\n } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n this.resolution = resolution || settings.RESOLUTION;\n this.width = Math.round((width || 0) * this.resolution) / this.resolution;\n this.height = Math.round((height || 0) * this.resolution) / this.resolution;\n this._mipmap = mipmap;\n this.anisotropicLevel = anisotropicLevel;\n this._wrapMode = wrapMode;\n this._scaleMode = scaleMode;\n this.format = format;\n this.type = type;\n this.target = target;\n this.alphaMode = alphaMode;\n\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n this._glTextures = {};\n this.dirtyId = 0;\n this.dirtyStyleId = 0;\n this.cacheId = null;\n this.valid = width > 0 && height > 0;\n this.textureCacheIds = [];\n this.destroyed = false;\n this.resource = null;\n\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\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 * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\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 * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n * @readonly\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n * @readonly\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n * @default PIXI.MIPMAP_MODES.POW2\n */\n get mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * The scale mode to apply when scaling this texture\n * @default PIXI.SCALE_MODES.LINEAR\n */\n get scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @default PIXI.WRAP_MODES.CLAMP\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * Changes style options of BaseTexture\n * @param scaleMode - Pixi scalemode\n * @param mipmap - enable mipmaps\n * @returns - this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n * @param desiredWidth - Desired visual width\n * @param desiredHeight - Desired visual height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n * @param realWidth - Full rendered width\n * @param realHeight - Full rendered height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n * @param resolution - res\n * @returns - this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n * @param resource - that is managing this BaseTexture\n * @returns - this\n */\n setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\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 * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this;\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 * @static\n * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas|string|string[]} source - The\n * source to create base texture from.\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource | string | string[],\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = options?.pixiIdPrefix || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * Default properties are different from the constructor's defaults.\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, { type }, options));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\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: BaseTexture, id: string): void\n {\n if (id)\n {\n if (!baseTexture.textureCacheIds.includes(id))\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n // only throw a warning if there is a different base texture mapped to this id.\n if (BaseTextureCache[id] && BaseTextureCache[id] !== baseTexture)\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null\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?.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 /** Global number of the texture batch, used by multi-texture renderers. */\n static _globalBatch = 0;\n}\n", "import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n", "import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\n\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer.\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation.\n * @memberof PIXI\n */\nexport interface IArrayBuffer extends ArrayBuffer // eslint-disable-line @typescript-eslint/no-empty-interface\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field.\n * - @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n * @memberof PIXI\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n * @type {PIXI.IArrayBuffer}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n * @private\n * @type {Object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\n /**\n * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @returns - A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n", "import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n public divisor: number;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n * @param [divisor=1] - Divisor to use when doing instanced rendering\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean, divisor = 1)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n this.divisor = divisor;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n", "import { getBufferType } from '@pixi/utils';\n\nimport type { Dict } from '@pixi/utils';\nimport type { ITypedArray } from '../Buffer';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n", "import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport { getBufferType } from '@pixi/utils';\nimport { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\n\nimport type { TYPES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { IArrayBuffer } from './Buffer';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n * @example\n * import { Geometry } from 'pixi.js';\n *\n * const geometry = new Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0, 0, 1, 0, 1, 1, 0, 1], 2);\n * geometry.addIndex([0, 1, 2, 1, 3, 2]);\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @returns - Returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer | Float32Array | Uint32Array | Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @returns - Returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (!this.buffers.includes(buffer))\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n * @returns - Returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\n\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n * @param geometries - array of geometries to merge\n * @returns - Shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n", "import { TYPES } from '@pixi/constants';\nimport { Buffer } from '../geometry/Buffer';\nimport { Geometry } from '../geometry/Geometry';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n", "/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum SHAPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * @property {number} RECT Rectangle\n * @default 0\n */\n POLY = 0,\n /**\n * @property {number} POLY Polygon\n * @default 1\n */\n RECT = 1,\n /**\n * @property {number} CIRC Circle\n * @default 2\n */\n CIRC = 2,\n /**\n * @property {number} ELIP Ellipse\n * @default 3\n */\n ELIP = 3,\n /**\n * @property {number} RREC Rounded Rectangle\n * @default 4\n */\n RREC = 4,\n}\n", "import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n * @class\n * @memberof PIXI\n * @implements {IPoint}\n */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\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 this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\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 * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n", "import { SHAPES } from '../const';\nimport { Point } from '../Point';\n\nimport type { Matrix } from '../Matrix';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\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 * @memberof PIXI\n */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x: string | number = 0, y: string | number = 0, width: string | number = 0, height: string | number = 0)\n {\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle: Rectangle): 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 * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\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 * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other: Rectangle, transform?: Matrix): boolean\n {\n if (!transform)\n {\n const x0 = this.x < other.x ? other.x : this.x;\n const x1 = this.right > other.right ? other.right : this.right;\n\n if (x1 <= x0)\n {\n return false;\n }\n\n const y0 = this.y < other.y ? other.y : this.y;\n const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;\n\n return y1 > y0;\n }\n\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n\n if (x1 <= x0 || y1 <= y0)\n {\n return false;\n }\n\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n\n if (rt.x <= lt.x || lb.y <= lt.y)\n {\n return false;\n }\n\n const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));\n\n if (s === 0)\n {\n return false;\n }\n\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0\n || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1\n || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0\n || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1)\n {\n return false;\n }\n\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = (nx * x0) + (ny * y0);\n const n10 = (nx * x1) + (ny * y0);\n const n01 = (nx * x0) + (ny * y1);\n const n11 = (nx * x1) + (ny * y1);\n\n if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)\n || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y))\n {\n return false;\n }\n\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = (mx * x0) + (my * y0);\n const m10 = (mx * x1) + (my * y0);\n const m01 = (mx * x0) + (my * y1);\n const m11 = (mx * x1) + (my * y1);\n\n if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)\n || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle: Rectangle): this\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 return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\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 return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle: Rectangle): this\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 return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n", "import { PI_2 } from './const';\nimport { Point } from './Point';\n\nimport type { IPointData } from './IPointData';\nimport type { Transform } from './Transform';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @memberof PIXI\n */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array | null = null;\n\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\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\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 * @param array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\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 * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\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 * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\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 * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\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 * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\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 * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\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 * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\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 * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\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 * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\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 * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\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 * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\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 * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform: Transform): 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 const pivot = transform.pivot;\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 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 + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert(): this\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 Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity(): this\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 * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\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 * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): 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 matrix to be the same as the ones in given matrix\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @returns {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n // #endif\n\n /**\n * A default (identity) matrix\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n", "// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\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];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n * @type {number[][]}\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n * @type {PIXI.Matrix[]}\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\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 /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && 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 rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**\n * This is the small part of gameofbombs.com portal system. It works.\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @readonly\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @readonly\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @readonly\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @readonly\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @readonly\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @readonly\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @readonly\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @readonly\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n * @readonly\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n * @readonly\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n * @readonly\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n * @readonly\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @returns {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\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 * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n", "import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n * @memberof PIXI\n */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\n /**\n * Creates a new `ObservablePoint`\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param 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: (this: T) => any, scope: T, 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 overridden otherwise they will default\n * to the clone object's values.\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @returns a copy of this observable point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\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 * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x): this\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 return this;\n }\n\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n", "import { Matrix } from './Matrix';\nimport { ObservablePoint } from './ObservablePoint';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n * @memberof PIXI\n */\nexport class Transform\n{\n /**\n * A default (identity) transform.\n * @static\n * @type {PIXI.Transform}\n */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */\n protected _currentLocalID: number;\n\n constructor()\n {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\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 // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Transform `\n + `position=(${this.position.x}, ${this.position.y}) `\n + `rotation=${this.rotation} `\n + `scale=(${this.scale.x}, ${this.scale.y}) `\n + `skew=(${this.skew.x}, ${this.skew.y}) `\n + `]`;\n }\n // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\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 local and the world transformation matrices.\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\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 * @param matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n", "var defaultFragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\\n}\";\n\nexport { defaultFragment as default };\n//# sourceMappingURL=defaultProgram.mjs.map\n", "var defaultVertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void){\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n}\\n\";\n\nexport { defaultVertex as default };\n//# sourceMappingURL=defaultProgram2.mjs.map\n", "/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @returns {WebGLShader} the shader\n */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n", "function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\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 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\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 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(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 return null;\n}\n", "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any, uniform: any): boolean =>\n // eslint-disable-next-line max-len,no-eq-null,eqeqeq\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined),\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\n var ${name}_matrix = uv.${name}.toArray(true);\n\n data[offset] = ${name}_matrix[0];\n data[offset+1] = ${name}_matrix[1];\n data[offset+2] = ${name}_matrix[2];\n \n data[offset + 4] = ${name}_matrix[3];\n data[offset + 5] = ${name}_matrix[4];\n data[offset + 6] = ${name}_matrix[5];\n \n data[offset + 8] = ${name}_matrix[6];\n data[offset + 9] = ${name}_matrix[7];\n data[offset + 10] = ${name}_matrix[8];\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `\n },\n // upload a pixi color as vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.red !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n cv[3] = v.alpha;\n gl.uniform4f(ud[\"${name}\"].location, v.red, v.green, v.blue, v.alpha)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n data[offset+3] = v.alpha;\n `\n },\n // upload a pixi color as a vec3 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec3' && data.size === 1 && !data.isArray && uniform.red !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n \n gl.uniform3f(ud[\"${name}\"].location, v.red, v.green, v.blue)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n `\n },\n\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n", "import { uniformParsers } from './uniformParsers';\n\nimport type { Dict } from '@pixi/utils';\nimport type { UniformGroup } from '../UniformGroup';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n\n vec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n\n int: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n ivec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n ivec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n ivec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n uint: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }`,\n uvec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n uvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n uvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n\n bool: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n bvec2: `\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n bvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n bvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n samplerCube: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n sampler2DArray: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n", "import { ENV } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || context?.isContextLost())\n {\n const canvas = settings.ADAPTER.createCanvas();\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = (canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext));\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n", "import { PRECISION } from '@pixi/constants';\nimport { getTestContext } from './getTestContext';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n", "/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n\n/**\n *\n * logs out any program errors\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n", "import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\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 uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 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\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {string} type\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n", "import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\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 UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\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 INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n", "import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n * @returns {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n", "// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n", "import { PRECISION } from '@pixi/constants';\nimport { isMobile, ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { getMaxFragmentPrecision, setPrecision } from './utils';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\nexport interface IProgramExtraData\n{\n transformFeedbackVaryings?: {\n names: string[],\n bufferMode: 'separate' | 'interleaved'\n }\n}\n\n/**\n * Helper class to create a shader program.\n * @memberof PIXI\n */\nexport class Program\n{\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n public static defaultVertexPrecision: PRECISION = PRECISION.HIGH;\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixijs/issues/3742\n * @static\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n public static defaultFragmentPrecision: PRECISION = isMobile.apple.device\n ? PRECISION.HIGH\n : PRECISION.MEDIUM;\n\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\n extra: IProgramExtraData = {};\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @param extra - Extra data for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader', extra: IProgramExtraData = {})\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n this.extra = extra;\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(\n this.vertexSrc,\n Program.defaultVertexPrecision,\n PRECISION.HIGH\n );\n this.fragmentSrc = setPrecision(\n this.fragmentSrc,\n Program.defaultFragmentPrecision,\n getMaxFragmentPrecision()\n );\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n * @readonly\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n", "import { BUFFER_TYPE } from '@pixi/constants';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```glsl\n * // UBO in shader:\n * uniform myCoolData { // Declaring a UBO...\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace;\n * };\n * ```\n *\n * ```js\n * // A new Uniform Buffer Object...\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // Build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // Name matches the UBO name in the shader. Will be processed accordingly.\n * })\n *\n * ```\n * @memberof PIXI\n */\nexport class UniformGroup>\n{\n /**\n * Uniform values\n * @member {object}\n */\n public readonly uniforms: LAYOUT;\n\n /**\n * Its a group and not a single uniforms.\n * @default true\n */\n public readonly group: boolean;\n\n /**\n * unique id\n * @protected\n */\n public id: number;\n syncUniforms: Dict;\n\n /**\n * Dirty version\n * @protected\n */\n dirtyId: number;\n\n /** Flag for if uniforms wont be changed after creation. */\n static: boolean;\n\n /** Flags whether this group is treated like a uniform buffer object. */\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer.\n * @param isStatic - Uniforms wont be changed after creation.\n * @param isUbo - If true, will treat this uniform group as a uniform buffer object.\n */\n constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n this.dirtyId = 0;\n this.id = UID++;\n this.static = !!isStatic;\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else\n {\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n }\n\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\n\n /**\n * A short hand function for creating a static UBO UniformGroup.\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n", "import { Runner } from '@pixi/runner';\nimport { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\n\n/**\n * A helper class for shaders.\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\n disposeRunner: Runner;\n\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n this.disposeRunner = new Runner('disposeShader');\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n\n this.disposeRunner.emit(this);\n this.disposeRunner.destroy();\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n", "import { Matrix } from '@pixi/math';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { UniformGroup } from '../shader/UniformGroup';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (!fragTemplate.includes('%count%'))\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (!fragTemplate.includes('%forloop%'))\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\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(vTextureId < ${i}.5)`;\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}\n", "import type { BaseTexture } from '../textures/BaseTexture';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n", "import { isMobile } from '@pixi/settings';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n * @private\n * @returns {boolean} `true` if the same buffer may be uploaded more than once.\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n", "import { isMobile, settings } from '@pixi/settings';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n * @private\n * @param {number} max\n * @returns {number} The maximum recommended texture units to use.\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n const navigator = settings.ADAPTER.getNavigator();\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n", "import type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Stub method that should be used to empty the current batch by rendering objects now. */\n flush(): void\n {\n // flush!\n }\n\n /** Generic destruction method that frees all resources. This should be called by subclasses. */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /** Stops the renderer. It should free up any state and become dormant. */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n * @param {PIXI.DisplayObject} _object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n", "var defaultFragment = \"varying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying float vTextureId;\\nuniform sampler2D uSamplers[%count%];\\n\\nvoid main(void){\\n vec4 color;\\n %forloop%\\n gl_FragColor = color * vColor;\\n}\\n\";\n\nexport { defaultFragment as default };\n//# sourceMappingURL=texture.mjs.map\n", "var defaultVertex = \"precision highp float;\\nattribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\nattribute float aTextureId;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 translationMatrix;\\nuniform vec4 tint;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying float vTextureId;\\n\\nvoid main(void){\\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vTextureId = aTextureId;\\n vColor = aColor * tint;\\n}\\n\";\n\nexport { defaultVertex as default };\n//# sourceMappingURL=texture2.mjs.map\n", "import { Color } from '@pixi/color';\nimport { ENV } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { settings } from '@pixi/settings';\nimport { deprecation, log2, nextPow2, premultiplyBlendMode } from '@pixi/utils';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\nimport { State } from '../state/State';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { BatchDrawCall } from './BatchDrawCall';\nimport { BatchGeometry } from './BatchGeometry';\nimport { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { canUploadSameBuffer } from './canUploadSameBuffer';\nimport { maxRecommendedTextures } from './maxRecommendedTextures';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport defaultFragment from './texture.frag';\nimport defaultVertex from './texture.vert';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { Texture } from '../textures/Texture';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n * @memberof PIXI\n */\nexport interface IBatchableElement\n{\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n * @memberof PIXI\n */\nexport class BatchRenderer extends ObjectRenderer\n{\n /**\n * The maximum textures that this device supports.\n * @static\n * @default 32\n */\n public static get defaultMaxTextures(): number\n {\n this._defaultMaxTextures = this._defaultMaxTextures ?? maxRecommendedTextures(32);\n\n return this._defaultMaxTextures;\n }\n public static set defaultMaxTextures(value: number)\n {\n this._defaultMaxTextures = value;\n }\n\n /** @ignore */\n private static _defaultMaxTextures: number;\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n */\n public static defaultBatchSize = 4096;\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n */\n public static get canUploadSameBuffer(): boolean\n {\n this._canUploadSameBuffer = this._canUploadSameBuffer ?? canUploadSameBuffer();\n\n return this._canUploadSameBuffer;\n }\n public static set canUploadSameBuffer(value: boolean)\n {\n this._canUploadSameBuffer = value;\n }\n\n /** @ignore */\n private static _canUploadSameBuffer: boolean;\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n name: 'batch',\n type: ExtensionType.RendererPlugin,\n };\n\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n * @default PIXI.BatchRenderer.defaultBatchSize * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n * @see PIXI.BatchRenderer#contextChange\n * @readonly\n */\n public maxTextures: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n * @default 6\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `BatchRenderer.canUploadSameBuffer` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.BatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n * @member {Uint16Array[]}\n * @see PIXI.BatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n * @member {PIXI.Geometry[]}\n * @see PIXI.BatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.setShaderGenerator();\n this.geometryClass = BatchGeometry;\n this.vertexSize = 6;\n this.state = State.for2d();\n this.size = BatchRenderer.defaultBatchSize * 4;\n this._vertexCount = 0;\n this._indexCount = 0;\n this._bufferedElements = [];\n this._bufferedTextures = [];\n this._bufferSize = 0;\n this._shader = null;\n this._packedGeometries = [];\n this._packedGeometryPoolSize = 2;\n this._flushId = 0;\n this._aBuffers = {} as any;\n this._iBuffers = {} as any;\n\n this.maxTextures = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * @see PIXI.BatchRenderer#maxTextures\n * @deprecated since 7.1.0\n * @readonly\n */\n get MAX_TEXTURES(): number\n {\n // #if _DEBUG\n deprecation('7.1.0', 'BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures');\n // #endif\n\n return this.maxTextures;\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n\n /**\n * Set the shader generator.\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchRenderer.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchRenderer.defaultFragmentTemplate] - Fragment shader template\n */\n public setShaderGenerator({\n vertex = BatchRenderer.defaultVertexSrc,\n fragment = BatchRenderer.defaultFragmentTemplate\n }: { vertex?: string, fragment?: string } = {}): void\n {\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.maxTextures` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.maxTextures = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.maxTextures = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n BatchRenderer.defaultMaxTextures);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.maxTextures = checkMaxIfStatementsInShader(\n this.maxTextures, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.maxTextures);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = BatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.maxTextures) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.maxTextures; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n maxTextures,\n } = this;\n const textureArrays = BatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, maxTextures);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= maxTextures)\n {\n batch.boundArray(texArray, boundTextures, TICK, maxTextures);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, maxTextures);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n * @param texArray\n * @param start\n * @param finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = BatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n * @param texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!BatchRenderer.canUploadSameBuffer)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = BatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.maxTextures);\n\n this.renderer.shader.bind(this._shader);\n\n if (BatchRenderer.canUploadSameBuffer)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `BatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n * @param size - minimum capacity required\n * @returns - buffer than can hold atleast `size` floats\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n * @param size - minimum required capacity\n * @returns - buffer that can fit `size` indices.\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = Color.shared\n .setValue(element._tintRGB)\n .toPremultiplied(alpha, element._texture.baseTexture.alphaMode > 0);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n\n// Install BatchRenderer as default\nextensions.add(BatchRenderer);\n", "var defaultFragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n}\\n\";\n\nexport { defaultFragment as default };\n//# sourceMappingURL=defaultFilter.mjs.map\n", "var defaultVertex = \"attribute vec2 aVertexPosition;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform vec4 inputSize;\\nuniform vec4 outputFrame;\\n\\nvec4 filterVertexPosition( void )\\n{\\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\\n\\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\\n}\\n\\nvec2 filterTextureCoord( void )\\n{\\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\\n}\\n\\nvoid main(void)\\n{\\n gl_Position = filterVertexPosition();\\n vTextureCoord = filterTextureCoord();\\n}\\n\";\n\nexport { defaultVertex as default };\n//# sourceMappingURL=defaultFilter2.mjs.map\n", "import { MSAA_QUALITY } from '@pixi/constants';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { State } from '../state/State';\nimport defaultFragment from './defaultFilter.frag';\nimport defaultVertex from './defaultFilter.vert';\n\nimport type { BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterState } from './FilterState';\nimport type { FilterSystem } from './FilterSystem';\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link https://pixijs.io/examples/#/filters-basic/blur.js Example} of the\n * {@link PIXI.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```js\n * import { Container, Filter } from 'pixi.js';\n * const filter = new Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixijs/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```js\n * import { Filter } from 'pixi.js';\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```glsl\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```glsl\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n *\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```glsl\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw));\n * ```\n *\n * Or:\n *\n * ```glsl\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw));\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixijs/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n * @memberof PIXI\n */\nexport class Filter extends Shader\n{\n /**\n * Default filter resolution for any filter.\n * @static\n */\n public static defaultResolution = 1;\n\n /**\n * Default filter samples for any filter.\n * @static\n * @type {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public static defaultMultisample = MSAA_QUALITY.NONE;\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 public padding: number;\n\n /** The samples override of the filter instance. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\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 * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n this.padding = 0;\n this.resolution = Filter.defaultResolution;\n this.multisample = Filter.defaultMultisample;\n this.enabled = true;\n this.autoFit = true;\n this.state = new State();\n }\n\n /**\n * Applies the filter\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - 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: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // Do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // Or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\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 get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n", "import { Color } from '@pixi/color';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ColorSource } from '@pixi/color';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Options for the background system.\n * @memberof PIXI\n * @deprecated since 7.2.3\n * @see PIXI.BackgroundSystemOptions\n */\nexport type BackgroundSytemOptions = BackgroundSystemOptions;\n\n/**\n * Options for the background system.\n * @memberof PIXI\n */\nexport interface BackgroundSystemOptions\n{\n /**\n * The background color used to clear the canvas. See {@link PIXI.ColorSource} for accepted color values.\n * @memberof PIXI.IRendererOptions\n */\n backgroundColor: ColorSource;\n /**\n * Alias for {@link PIXI.IRendererOptions.backgroundColor}\n * @memberof PIXI.IRendererOptions\n */\n background?: ColorSource;\n /**\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @memberof PIXI.IRendererOptions\n */\n backgroundAlpha: number;\n /**\n * Whether to clear the canvas before new render passes.\n * @memberof PIXI.IRendererOptions\n */\n clearBeforeRender: boolean;\n}\n\n/**\n * The background system manages the background color and alpha of the main view.\n * @memberof PIXI\n */\nexport class BackgroundSystem implements ISystem\n{\n static defaultOptions: BackgroundSystemOptions = {\n /**\n * {@link PIXI.IRendererOptions.backgroundAlpha}\n * @default 1\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n backgroundAlpha: 1,\n /**\n * {@link PIXI.IRendererOptions.backgroundColor}\n * @default 0x000000\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n backgroundColor: 0x0,\n /**\n * {@link PIXI.IRendererOptions.clearBeforeRender}\n * @default true\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n clearBeforeRender: true,\n };\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: 'background',\n };\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 * @member {boolean}\n * @default\n */\n public clearBeforeRender: boolean;\n\n /** Reference to the internal color */\n private _backgroundColor: Color;\n\n constructor()\n {\n this.clearBeforeRender = true;\n this._backgroundColor = new Color(0x0);\n this.alpha = 1;\n }\n\n /**\n * initiates the background system\n * @param {PIXI.IRendererOptions} options - the options for the background colors\n */\n init(options: BackgroundSystemOptions): void\n {\n this.clearBeforeRender = options.clearBeforeRender;\n const { backgroundColor, background, backgroundAlpha } = options;\n const color = background ?? backgroundColor;\n\n if (color !== undefined)\n {\n this.color = color;\n }\n\n this.alpha = backgroundAlpha;\n }\n\n /**\n * The background color to fill if not transparent.\n * @member {PIXI.ColorSource}\n */\n get color(): ColorSource\n {\n return this._backgroundColor.value;\n }\n\n set color(value: ColorSource)\n {\n this._backgroundColor.setValue(value);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n */\n get alpha(): number\n {\n return this._backgroundColor.alpha;\n }\n\n set alpha(value: number)\n {\n this._backgroundColor.setAlpha(value);\n }\n\n /** The background color object. */\n get backgroundColor(): Color\n {\n return this._backgroundColor;\n }\n\n destroy(): void\n {\n // ka boom!\n }\n}\n\nextensions.add(BackgroundSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'batch',\n };\n\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\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 flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /** Reset the system to an empty renderer */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(BatchSystem);\n", "import { ENV } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { settings } from '@pixi/settings';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { ICanvas } from '@pixi/settings';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\n/**\n * Options for the context system.\n * @memberof PIXI\n */\nexport interface ContextSystemOptions\n{\n /**\n * **Deprecated since 7.0.0, use `premultipliedAlpha` and `backgroundAlpha` instead.**\n *\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`.\n *\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @deprecated since 7.0.0\n * @memberof PIXI.IRendererOptions\n */\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * **WebGL Only.** User-provided WebGL rendering context object.\n * @memberof PIXI.IRendererOptions\n */\n context: IRenderingContext | null;\n /**\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @memberof PIXI.IRendererOptions\n */\n antialias: boolean;\n /**\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @memberof PIXI.IRendererOptions\n */\n powerPreference: WebGLPowerPreference;\n /**\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @memberof PIXI.IRendererOptions\n */\n premultipliedAlpha: boolean;\n /**\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @memberof PIXI.IRendererOptions\n */\n preserveDrawingBuffer: boolean;\n}\n\nexport interface ISupportDict\n{\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /** @ignore */\n static defaultOptions: ContextSystemOptions = {\n /**\n * {@link PIXI.IRendererOptions.context}\n * @default null\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n context: null,\n /**\n * {@link PIXI.IRendererOptions.antialias}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n antialias: false,\n /**\n * {@link PIXI.IRendererOptions.premultipliedAlpha}\n * @default true\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n premultipliedAlpha: true,\n /**\n * {@link PIXI.IRendererOptions.preserveDrawingBuffer}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n preserveDrawingBuffer: false,\n /**\n * {@link PIXI.IRendererOptions.powerPreference}\n * @default default\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n powerPreference: 'default',\n };\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'context',\n };\n\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n preserveDrawingBuffer: boolean;\n powerPreference: WebGLPowerPreference;\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @member {boolean}\n * @deprecated since 7.0.0\n */\n useContextAlpha: boolean | 'notMultiplied';\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n }\n\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n }\n\n init(options: ContextSystemOptions): void\n {\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.initFromContext(options.context);\n }\n else\n {\n const alpha = this.renderer.background.alpha < 1;\n const premultipliedAlpha = options.premultipliedAlpha;\n\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n this.useContextAlpha = options.useContextAlpha;\n this.powerPreference = options.powerPreference;\n\n this.initFromOptions({\n alpha,\n premultipliedAlpha,\n antialias: options.antialias,\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: options.powerPreference,\n });\n }\n }\n\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n\n const view = this.renderer.view;\n\n if (view.addEventListener !== undefined)\n {\n view.addEventListener('webglcontextlost', this.handleContextLost, false);\n view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n }\n\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: ICanvas, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options) || 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\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n loseContext: gl.getExtension('WEBGL_lose_context'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), // eslint-disable-line camelcase\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n // Prevent default to be able to restore the context\n event.preventDefault();\n\n // Restore the context after this event has exited\n setTimeout(() =>\n {\n if (this.gl.isContextLost() && this.extensions.loseContext)\n {\n this.extensions.loseContext.restoreContext();\n }\n }, 0);\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n if (view.removeEventListener !== undefined)\n {\n view.removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n }\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.objectRenderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (attributes && !attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n\nextensions.add(ContextSystem);\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n", "import { FORMATS, MIPMAP_MODES, MSAA_QUALITY, SCALE_MODES, TYPES } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n /** Width of framebuffer in pixels. */\n public width: number;\n\n /** Height of framebuffer in pixels. */\n public height: number;\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias: true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n * @example\n * import { MSAA_QUALITY } from 'pixi.js';\n *\n * renderTexture.framebuffer.multisample = MSAA_QUALITY.HIGH;\n * // ...\n * renderer.render(myContainer, { renderTexture });\n * renderer.framebuffer.blit(); // Copies data from MSAA framebuffer to texture\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param width - Width of the frame buffer\n * @param height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n this.width = Math.round(width || 100);\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array.\n * @param index - Index of the array to add the texture to\n * @param texture - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer.\n * @param texture - Texture to add.\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable depth on the frame buffer. */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable stencil on the frame buffer. */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n * @param width - Width of the frame buffer to resize to\n * @param height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys and removes the depth texture added to this framebuffer. */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n", "import { Color } from '@pixi/color';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { BaseTexture } from '../textures/BaseTexture';\n\nimport type { ColorSource } from '@pixi/color';\nimport type { MaskData } from '../mask/MaskData';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\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 * @example\n * import { autoDetectRenderer, BaseRenderTexture, RenderTexture, Sprite } from 'pixi.js';\n *\n * const renderer = autoDetectRenderer();\n * const baseRenderTexture = new BaseRenderTexture({ width: 800, height: 600 });\n * const renderTexture = new RenderTexture(baseRenderTexture);\n * const sprite = Sprite.from('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 * // The Sprite in this case will be rendered using its local transform.\n * // To render this sprite at 0,0 you can clear the transform\n * sprite.setTransform();\n *\n * const baseRenderTexture = new BaseRenderTexture({ width: 100, height: 100 });\n * const renderTexture = new RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, { renderTexture }); // Renders to center of RenderTexture\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public _clear: Color;\n public framebuffer: Framebuffer;\n\n /** The data structure for the stencil masks. */\n maskStack: Array;\n\n /** The data structure for the filters. */\n filterStack: Array;\n\n /**\n * @param options\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.BaseTexture.defaultOptions.scaleMode] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n constructor(options: IBaseTextureOptions = {})\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample ??= MSAA_QUALITY.NONE;\n\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this._clear = new Color([0, 0, 0, 0]);\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n this.maskStack = [];\n this.filterStack = [{}];\n }\n\n /** Color when clearning the texture. */\n set clearColor(value: ColorSource)\n {\n this._clear.setValue(value);\n }\n get clearColor(): ColorSource\n {\n return this._clear.value;\n }\n\n /**\n * Color object when clearning the texture.\n * @readonly\n * @since 7.2.0\n */\n get clear(): Color\n {\n return this._clear;\n }\n\n /**\n * Resizes the BaseRenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\n\n /**\n * Frees the texture and framebuffer 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 * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /** Destroys this texture. */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { Resource } from './Resource';\n\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n * @member {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void\n {\n if (crossorigin === undefined && !url.startsWith('data:'))\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} [source] - (optional)\n * @returns - true is success\n */\n override upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n if (typeof HTMLImageElement !== 'undefined' && source instanceof HTMLImageElement)\n {\n if (!source.complete || source.naturalWidth === 0)\n {\n return false;\n }\n }\n else if (typeof HTMLVideoElement !== 'undefined' && source instanceof HTMLVideoElement)\n {\n if (source.readyState <= 1 && source.buffered.length === 0)\n {\n return false;\n }\n }\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n override update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link PIXI.BaseImageResource} */\n override dispose(): void\n {\n this.source = null;\n }\n}\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process automatically when constructed. */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean | string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@link HTMLImageElement}.\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement | string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (typeof source === 'string')\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixijs/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\n this.preserveBitmap = false;\n this.createBitmap = (options.createBitmap ?? settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n this.bitmap = null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n * @returns - Cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !globalThis.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = globalThis.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n override upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n override dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if current environment support HTMLImageElement, and source is string or HTMLImageElement\n */\n static override test(source: unknown): source is string | HTMLImageElement\n {\n return typeof HTMLImageElement !== 'undefined' && (typeof source === 'string' || source instanceof HTMLImageElement);\n }\n}\n", "import { groupD8 } from '@pixi/math';\n\nimport type { ISize, Rectangle } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n /** X-component of top-left corner `(x0,y0)`. */\n public x0: number;\n\n /** Y-component of top-left corner `(x0,y0)`. */\n public y0: number;\n\n /** X-component of top-right corner `(x1,y1)`. */\n public x1: number;\n\n /** Y-component of top-right corner `(x1,y1)`. */\n public y1: number;\n\n /** X-component of bottom-right corner `(x2,y2)`. */\n public x2: number;\n\n /** Y-component of bottom-right corner `(x2,y2)`. */\n public y2: number;\n\n /** X-component of bottom-left corner `(x3,y3)`. */\n public x3: number;\n\n /** Y-component of bottom-right corner `(x3,y3)`. */\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n this.x1 = 1;\n this.y1 = 0;\n this.x2 = 1;\n this.y2 = 1;\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n * @protected\n * @param frame - The frame of the texture\n * @param baseFrame - The base frame of the texture\n * @param rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\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.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:TextureUvs `\n + `x0=${this.x0} y0=${this.y0} `\n + `x1=${this.x1} y1=${this.y1} x2=${this.x2} `\n + `y2=${this.y2} x3=${this.x3} y3=${this.y3}`\n + `]`;\n }\n // #endif\n}\n", "import { Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { EventEmitter, getResolutionOfUrl, TextureCache, uid } from '@pixi/utils';\nimport { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport { TextureUvs } from './TextureUvs';\n\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { CanvasResource } from './resources/CanvasResource';\nimport type { Resource } from './resources/Resource';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string | BaseTexture | ImageSource;\n\n/**\n * Stores the width of the non-scalable borders, for example when used with {@link PIXI.NineSlicePlane} texture.\n * @memberof PIXI\n * @since 7.2.0\n */\nexport interface ITextureBorders\n{\n /** left border in pixels */\n left: number;\n /** top border in pixels */\n top: number;\n /** right border in pixels */\n right: number;\n /** bottom border in pixels */\n bottom: number;\n}\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * Used to remove listeners from WHITE and EMPTY Textures\n * @ignore\n */\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, 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 * import { Sprite, Texture } from 'pixi.js';\n *\n * const texture = Texture.from('assets/image.png');\n * const sprite1 = new Sprite(texture);\n * const sprite2 = new Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\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 *\n * ```js\n * import { Sprite, Texture } from 'pixi.js';\n *\n * const texture = Texture.from('assets/image.svg');\n * const sprite1 = new Sprite(texture);\n * // sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n *\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing.\n * See issue [#3085]{@link https://github.com/pixijs/pixijs/issues/3085}.\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nexport class Texture extends EventEmitter\n{\n /** The base texture that this texture uses. */\n public baseTexture: BaseTexture;\n\n /** This is the area of original texture, before it was put in atlas. */\n public orig: Rectangle;\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 public trim: Rectangle;\n\n /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */\n public valid: boolean;\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n * @example\n * texture.on('update', () => {});\n */\n public noFrame: boolean;\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 * @default {0,0}\n */\n public defaultAnchor: Point;\n\n /**\n * Default width of the non-scalable border that is used if 9-slice plane is created with this texture.\n * @since 7.2.0\n * @see PIXI.NineSlicePlane\n */\n public defaultBorders?: ITextureBorders;\n\n /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n * @protected\n */\n _updateID: number;\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 _frame: Rectangle;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV.\n * @protected\n */\n _uvs: TextureUvs;\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 textureCacheIds: Array;\n\n /**\n * @param baseTexture - The base texture source to create the texture from\n * @param frame - The rectangle frame of the texture to show\n * @param orig - The area of original texture\n * @param trim - Trimmed rectangle of original texture\n * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param anchor - Default anchor point used for sprite placement / rotation\n * @param borders - Default borders used for 9-slice scaling. See {@link PIXI.NineSlicePlane}\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData, borders?: ITextureBorders)\n {\n super();\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 this.baseTexture = baseTexture;\n this._frame = frame;\n this.trim = trim;\n this.valid = false;\n this._uvs = DEFAULT_UVS;\n this.uvMatrix = null;\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === 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 this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n this.defaultBorders = borders;\n\n this._updateID = 0;\n\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n * @protected\n * @param baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n * @param [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\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 (resource?.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, 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 * @returns - The new texture\n */\n clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim?.clone(),\n this.rotate,\n this.defaultAnchor,\n this.defaultBorders\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_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 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 * @param {string|PIXI.BaseTexture|HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} source -\n * Source or array of sources to create texture from\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource | TextureSource[],\n options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = options?.pixiIdPrefix || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = options?.pixiIdPrefix || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param url - The remote URL or array of URLs to load.\n * @param options - Optional options to include\n * @returns - A Promise that resolves to a Texture.\n */\n static fromURL(\n url: string | string[], options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas|string} source - The input source.\n * @param imageUrl - File name of texture, for cache and resolving resolution.\n * @param name - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @param options\n * @returns - Output texture\n */\n static fromLoader(source: ImageSource | string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: BaseTexture.defaultOptions.scaleMode,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\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 'fromLoader' function\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 // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n * @param texture - The Texture to add to the cache.\n * @param id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (!texture.textureCacheIds.includes(id))\n {\n texture.textureCacheIds.push(id);\n }\n\n // only throw a warning if there is a different texture mapped to this id.\n if (TextureCache[id] && TextureCache[id] !== texture)\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n * @param texture - id of a Texture to be removed, or a Texture instance itself\n * @returns - The Texture that was removed\n */\n static removeFromCache(texture: string | Texture): Texture | null\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?.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 * Returns resolution of baseTexture\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\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 get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\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.valid;\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 get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /** The width of the Texture in pixels. */\n get width(): number\n {\n return this.orig.width;\n }\n\n /** The height of the Texture in pixels. */\n get height(): number\n {\n return this.orig.height;\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n private static _EMPTY: Texture;\n private static _WHITE: Texture;\n\n /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */\n public static get EMPTY(): Texture\n {\n if (!Texture._EMPTY)\n {\n Texture._EMPTY = new Texture(new BaseTexture());\n removeAllHandlers(Texture._EMPTY);\n removeAllHandlers(Texture._EMPTY.baseTexture);\n }\n\n return Texture._EMPTY;\n }\n\n /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */\n public static get WHITE(): Texture\n {\n if (!Texture._WHITE)\n {\n const canvas = settings.ADAPTER.createCanvas(16, 16);\n const context = canvas.getContext('2d');\n\n canvas.width = 16;\n canvas.height = 16;\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n Texture._WHITE = new Texture(BaseTexture.from(canvas));\n removeAllHandlers(Texture._WHITE);\n removeAllHandlers(Texture._WHITE.baseTexture);\n }\n\n return Texture._WHITE;\n }\n}\n\n", "import { Texture } from '../textures/Texture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\n\nimport type { MSAA_QUALITY } from '@pixi/constants';\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\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 * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n * @example\n * import { autoDetectRenderer, RenderTexture, Sprite } from 'pixi.js';\n *\n * const renderer = autoDetectRenderer();\n * const renderTexture = RenderTexture.create({ width: 800, height: 600 });\n * const sprite = Sprite.from('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 * // Note that you should not create a new renderer, but reuse the same one as the rest of the application.\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 * sprite.setTransform();\n *\n * const renderTexture = new RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, { renderTexture }); // Renders to center of RenderTexture\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n * @readonly\n */\n public filterFrame: Rectangle | null;\n\n /**\n * The key for pooled texture of FilterSystem.\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string | number | null;\n\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\n\n /**\n * Resizes the RenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\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 (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n * @param resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * A short hand way of creating a render texture.\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.BaseTexture.defaultOptions.scaleMode] - See {@link PIXI.SCALE_MODES}\n * for possible values\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @returns The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture\n {\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n", "import { MSAA_QUALITY } from '@pixi/constants';\nimport { nextPow2 } from '@pixi/utils';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { RenderTexture } from './RenderTexture';\n\nimport type { ISize } from '@pixi/math';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string | number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil((minWidth * resolution) - 1e-6);\n minHeight = Math.ceil((minHeight * resolution) - 1e-6);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[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\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n * @param size - Initial size of screen.\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[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 this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n * @readonly\n */\n static SCREEN_KEY = -1;\n}\n", "import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n", "import { Buffer } from '../geometry/Buffer';\nimport { Geometry } from '../geometry/Geometry';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n * @memberof PIXI\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n\n /** An array of vertices. */\n vertices: Float32Array;\n\n /** The Uvs of the quad. */\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n * @param targetTextureFrame - The first rectangle\n * @param destinationFrame - The second rectangle\n * @returns - Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\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 this.invalidate();\n\n return this;\n }\n\n /**\n * Legacy upload method, just marks buffers dirty.\n * @returns - Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n", "import { MSAA_QUALITY } from '@pixi/constants';\nimport { Rectangle } from '@pixi/math';\n\nimport type { Matrix } from '@pixi/math';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\n\n/**\n * System plugin to the renderer to manage filter states.\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n", "import { CLEAR_MODES, DRAW_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix, Point, Rectangle } from '@pixi/math';\nimport { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { FilterState } from './FilterState';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { ISystem } from '../system/ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n * @memberof PIXI\n */\nexport class FilterSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'filter',\n };\n\n /**\n * List of filters for the FilterSystem\n * @member {object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n * @property {PIXI.Rectangle} outputFrame -\n * @property {Float32Array} inputSize -\n * @property {Float32Array} inputPixel -\n * @property {Float32Array} inputClamp -\n * @property {number} resolution -\n * @property {Float32Array} filterArea -\n * @property {Float32Array} filterClamp -\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n\n init(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n if (autoFit)\n {\n state.sourceFrame.fit(sourceFrameProjected);\n\n if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0)\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n }\n else if (!state.sourceFrame.intersects(sourceFrameProjected))\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n }\n\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture?.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\n\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n }\n\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link PIXI.Filter#apply}.\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(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\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns - The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0)\n {\n return;\n }\n\n if (transform)\n {\n const { a, b, c, d } = transform;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4))\n {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n\nextensions.add(FilterSystem);\n", "import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context.\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n /** The WebGL framebuffer. */\n public framebuffer: WebGLFramebuffer;\n\n /** Stencil+depth , usually costs 32bits per pixel. */\n public stencil: WebGLRenderbuffer;\n\n /** Detected AA samples number. */\n public multisample: MSAA_QUALITY;\n\n /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */\n public msaaBuffer: WebGLRenderbuffer;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n */\n public blitFramebuffer: Framebuffer;\n\n /** Latest known version of framebuffer. */\n dirtyId: number;\n\n /** Latest known version of framebuffer format. */\n dirtyFormat: number;\n\n /** Latest known version of framebuffer size. */\n dirtySize: number;\n\n /** Store the current mipmap of the textures the framebuffer will write too. */\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n this.framebuffer = framebuffer;\n this.stencil = null;\n this.dirtyId = -1;\n this.dirtyFormat = -1;\n this.dirtySize = -1;\n this.multisample = MSAA_QUALITY.NONE;\n this.msaaBuffer = null;\n this.blitFramebuffer = null;\n this.mipLevel = 0;\n }\n}\n", "import { BUFFER_BITS, ENV, MSAA_QUALITY } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'framebuffer',\n };\n\n /** A list of managed framebuffers. */\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /** Framebuffer value that shows that we don't know what is bound. */\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedFramebuffers = [];\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer.\n * @param framebuffer\n * @param frame - frame, default is framebuffer size\n * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n * @param x - X position of viewport\n * @param y - Y position of viewport\n * @param width - Width of viewport\n * @param height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n * @param r - Red value from 0 to 1\n * @param g - Green value from 0 to 1\n * @param b - Blue value from 0 to 1\n * @param a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n * @protected\n * @param framebuffer\n * @returns - created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n * @param framebuffer\n * @protected\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n parentTexture._glTextures[this.CONTEXT_UID].internalFormat, framebuffer.width, framebuffer.height);\n }\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n * @param framebuffer\n * @param mipLevel\n * @protected\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n }\n else if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n parentTexture._glTextures[this.CONTEXT_UID].internalFormat, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else\n {\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled.\n * @param framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n * @param samples - number of samples\n * @returns - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n * @param framebuffer - by default it blits \"into itself\", from renderBuffer to texture.\n * @param sourcePixels - source rectangle in pixels\n * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(\n sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom,\n destPixels.left, destPixels.top, destPixels.right, destPixels.bottom,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, framebuffer.glFramebuffers[this.CONTEXT_UID].framebuffer);\n }\n\n /**\n * Disposes framebuffer.\n * @param framebuffer - framebuffer that has to be disposed of\n * @param contextLost - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n this.disposeFramebuffer(fbo.blitFramebuffer, contextLost);\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them.\n * @param [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(FramebufferSystem);\n", "import { BUFFER_TYPE, ENV } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { settings } from '@pixi/settings';\n\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Dict } from '@pixi/utils';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { Program } from '../shader/Program';\nimport type { Shader } from '../shader/Shader';\nimport type { ISystem } from '../system/ISystem';\nimport type { Geometry } from './Geometry';\nimport type { GLBuffer } from './GLBuffer';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'geometry',\n };\n\n /**\n * `true` if we has `*_vertex_array_object` extension.\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\n }\n\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n // @TODO: We don't know if VAO is supported.\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n gl.bindVertexArray(null);\n bufferSystem.unbind(BUFFER_TYPE.ARRAY_BUFFER);\n\n return vao;\n }\n\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, attribute.divisor);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draws the currently bound geometry.\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(GeometrySystem);\n", "import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` 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 * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @readonly\n */\n public mapCoord: Matrix;\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 * @default 0\n */\n public clampOffset: number;\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 * @default 0.5\n */\n public clampMargin: number;\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n */\n readonly uClampFrame: Float32Array;\n\n /** Normalized clamp offset. Calculated based on clampOffset. */\n readonly uClampOffset: Float32Array;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _textureID: number;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _updateID: number;\n _texture: Texture;\n\n /**\n * If texture size is the same as baseTexture.\n * @default false\n * @readonly\n */\n isSimple: boolean;\n\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n\n this.clampOffset = 0;\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n this.isSimple = false;\n }\n\n /** Texture property. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\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 [forceUpdate=false] - if true, matrices will be updated any case\n * @returns - Whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._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 this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n", "var fragment = \"varying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform sampler2D mask;\\nuniform float alpha;\\nuniform float npmAlpha;\\nuniform vec4 maskClamp;\\n\\nvoid main(void)\\n{\\n float clip = step(3.5,\\n step(maskClamp.x, vMaskCoord.x) +\\n step(maskClamp.y, vMaskCoord.y) +\\n step(vMaskCoord.x, maskClamp.z) +\\n step(vMaskCoord.y, maskClamp.w));\\n\\n vec4 original = texture2D(uSampler, vTextureCoord);\\n vec4 masky = texture2D(mask, vMaskCoord);\\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\\n\\n original *= (alphaMul * masky.r * alpha * clip);\\n\\n gl_FragColor = original;\\n}\\n\";\n\nexport { fragment as default };\n//# sourceMappingURL=spriteMaskFilter2.mjs.map\n", "var vertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 otherMatrix;\\n\\nvarying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\\n}\\n\";\n\nexport { vertex as default };\n//# sourceMappingURL=spriteMaskFilter3.mjs.map\n", "import { Matrix } from '@pixi/math';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\nimport { Filter } from '../Filter';\nimport fragment from './spriteMaskFilter.frag';\nimport vertex from './spriteMaskFilter.vert';\n\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport type { Point } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Texture } from '../../textures/Texture';\nimport type { FilterSystem } from '../FilterSystem';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\n\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\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.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n", "import { MASK_TYPES } from '@pixi/constants';\nimport { Filter } from '../filters/Filter';\n\nimport type { COLOR_MASK_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport type { Matrix, Rectangle } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { ISpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link PIXI.MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.Filter.defaultMultisample\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /** Color mask. */\n public colorMask: COLOR_MASK_BITS;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @private\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n * @private\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * pre-computed color mask\n * @private\n */\n _colorMask: number;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = Filter.defaultMultisample;\n this.enabled = true;\n this.colorMask = 0xf;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._colorMask = 0xf;\n this._target = null;\n }\n\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /**\n * Copies counters from maskData above, called from pushMask().\n * @param maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n", "import { MASK_TYPES } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MaskData } from './MaskData';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { IMaskTarget } from './MaskData';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n * @memberof PIXI\n */\nexport class MaskSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'mask',\n };\n\n /**\n * Flag to enable scissor masking.\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf;\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.pushColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.popColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject.\n * @param maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (!maskObject)\n {\n maskData.type = MASK_TYPES.COLOR;\n }\n else if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * @param maskData - Sprite to be used as the mask.\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param maskData - Sprite to be used as the mask.\n */\n popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n /**\n * Pushes the color mask.\n * @param maskData - The mask data\n */\n pushColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n /**\n * Pops the color mask.\n * @param maskData - The mask data\n */\n popColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = this.maskStack.length > 0\n ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(MaskSystem);\n", "import type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\n\nconst tempMatrix = new Matrix();\nconst rectPool: Rectangle[] = [];\n\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n * @memberof PIXI\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'scissor',\n };\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n const rect = maskObject.getBounds(true, rectPool.pop() ?? new Rectangle());\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n }\n\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData - mask data\n * @returns whether Whether the object can be scissor mask\n */\n public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\n\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n * @param maskData - The mask data.\n */\n pop(maskData?: MaskData): void\n {\n const { gl } = this.renderer;\n\n if (maskData)\n {\n rectPool.push(maskData._scissorRectLocal);\n }\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n\nextensions.add(ScissorSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { settings } from '@pixi/settings';\nimport { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'stencil',\n };\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n const colorMask = maskData._colorMask;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 1) !== 0,\n (colorMask & 2) !== 0,\n (colorMask & 4) !== 0,\n (colorMask & 8) !== 0\n );\n }\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n const maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n const colorMask = maskData ? maskData._colorMask : 0xf;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 0x1) !== 0,\n (colorMask & 0x2) !== 0,\n (colorMask & 0x4) !== 0,\n (colorMask & 0x8) !== 0\n );\n }\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n}\n\nextensions.add(StencilSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { deprecation } from '@pixi/utils';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\nexport interface IRendererPlugins extends GlobalMixins.IRendererPlugins\n{\n [key: string]: any;\n}\n\n/**\n * Manages the functionality that allows users to extend pixi functionality via additional plugins.\n * @memberof PIXI\n */\nexport class PluginSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: '_plugin',\n };\n\n /** @ignore */\n public rendererPlugins: IRendererPlugins;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n public readonly plugins: IRendererPlugins;\n private renderer: IRenderer;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n\n // #if _DEBUG\n Object.defineProperties(this.plugins, {\n extract: {\n enumerable: false,\n get()\n {\n deprecation('7.0.0', 'renderer.plugins.extract has moved to renderer.extract');\n\n return (renderer as any).extract;\n },\n },\n prepare: {\n enumerable: false,\n get()\n {\n deprecation('7.0.0', 'renderer.plugins.prepare has moved to renderer.prepare');\n\n return (renderer as any).prepare;\n },\n },\n interaction: {\n enumerable: false,\n get()\n {\n deprecation('7.0.0', 'renderer.plugins.interaction has been deprecated, use renderer.events');\n\n return (renderer as any).events;\n },\n },\n });\n // #endif\n }\n\n /**\n * Initialize the plugins.\n * @protected\n */\n init(): void\n {\n const staticMap = this.rendererPlugins;\n\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this.renderer);\n }\n }\n\n destroy(): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n }\n}\n\nextensions.add(PluginSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix } from '@pixi/math';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n * @memberof PIXI\n */\nexport class ProjectionSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'projection',\n };\n\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link PIXI.RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture.\n * It is expected\n * that you dirty the current bindings when calling this manually.\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n * @param _destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n * @param _matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(ProjectionSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix, Transform } from '@pixi/math';\nimport { RenderTexture } from './RenderTexture';\n\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Rectangle } from '@pixi/math';\nimport type { IRenderableContainer, IRenderableObject, IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\nconst tempTransform = new Transform();\n\n// TODO could this just be part of extract?\nexport interface IGenerateTextureOptions\n{\n /** The scale mode of the texture. Optional, defaults to `PIXI.BaseTexture.defaultOptions.scaleMode`. */\n scaleMode?: SCALE_MODES;\n /** The resolution / device pixel ratio of the texture being generated. Optional defaults to Renderer resolution. */\n resolution?: number;\n /**\n * The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n */\n region?: Rectangle;\n /** The number of samples of the frame buffer. */\n multisample?: MSAA_QUALITY;\n}\n\n/**\n * System that manages the generation of textures from the renderer.\n * @memberof PIXI\n */\nexport class GenerateTextureSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: 'textureGenerator',\n };\n\n renderer: IRenderer;\n\n private readonly _tempMatrix: Matrix;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n\n this._tempMatrix = new Matrix();\n }\n\n /**\n * A 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 * @param displayObject - The displayObject the object will be generated from.\n * @param {IGenerateTextureOptions} options - Generate texture options.\n * @returns a shiny new texture of the display object passed in\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture\n {\n const { region: manualRegion, ...textureOptions } = options || {};\n\n const region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n this._tempMatrix.tx = -region.x;\n this._tempMatrix.ty = -region.y;\n\n const transform = displayObject.transform;\n\n displayObject.transform = tempTransform;\n\n this.renderer.render(displayObject, {\n renderTexture,\n transform: this._tempMatrix,\n skipUpdateTransform: !!displayObject.parent,\n blit: true,\n });\n\n displayObject.transform = transform;\n\n return renderTexture;\n }\n\n destroy(): void\n {\n // ka boom!\n }\n}\n\nextensions.add(GenerateTextureSystem);\n", "import { Color } from '@pixi/color';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { Rectangle } from '@pixi/math';\n\nimport type { ColorSource } from '@pixi/color';\nimport type { BUFFER_BITS } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { ISize } from '@pixi/math';\nimport type { MaskData } from '../mask/MaskData';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { RenderTexture } from './RenderTexture';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n * @memberof PIXI\n */\nexport class RenderTextureSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'renderTexture',\n };\n\n /* eslint-enable max-len */\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /** Does the renderer have alpha and are its color channels stored premultipled by the alpha channel? */\n private _rendererPremultipliedAlpha: boolean;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n\n protected contextChange(): void\n {\n const attributes = this.renderer?.gl.getContextAttributes();\n\n this._rendererPremultipliedAlpha = !!(attributes && attributes.alpha && attributes.premultipliedAlpha);\n }\n\n /**\n * Bind the current render texture.\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer._view.screen.width;\n tempRect.height = renderer._view.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour.\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(clearColor?: ColorSource, mask?: BUFFER_BITS): void\n {\n const fallbackColor = this.current\n ? this.current.baseTexture.clear\n : this.renderer.background.backgroundColor;\n const color = Color.shared.setValue(clearColor ? clearColor : fallbackColor);\n\n if ((this.current && this.current.baseTexture.alphaMode > 0)\n || (!this.current && this._rendererPremultipliedAlpha))\n {\n color.premultiply(color.alpha);\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer._view.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n\n this.renderer.framebuffer.clear(color.red, color.green, color.blue, color.alpha, mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(RenderTextureSystem);\n", "import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n * @memberof PIXI\n */\nexport class GLProgram\n{\n /** The shader program. */\n public program: WebGLProgram;\n\n /**\n * Holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands.\n */\n public uniformData: Dict;\n\n /**\n * UniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n */\n public uniformGroups: Dict;\n\n /** A hash that stores where UBOs are bound to on the program. */\n public uniformBufferBindings: Dict;\n\n /** A hash for lazily-generated uniform uploading functions. */\n public uniformSync: Dict;\n\n /**\n * A place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n\n /** Destroys this program. */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n", "import { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\nimport type { IAttributeData } from '../Program';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.startsWith('gl_'))\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n", "import { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\n\nimport type { IUniformData } from '../Program';\n\n/**\n * returns the uniform data from the program\n * @private\n * @param program - the webgl program\n * @param gl - the WebGL context\n * @returns {object} the uniform data for this program\n */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n", "import { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\n\nimport type { IRenderingContext } from '../../IRenderer';\nimport type { IGLUniformData } from '../GLProgram';\nimport type { Program } from '../Program';\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n const transformFeedbackVaryings = program.extra?.transformFeedbackVaryings;\n\n if (transformFeedbackVaryings)\n {\n if (typeof gl.transformFeedbackVaryings !== 'function')\n {\n // #if _DEBUG\n console.warn(`TransformFeedback is not supported but TransformFeedbackVaryings are given.`);\n // #endif\n }\n else\n {\n gl.transformFeedbackVaryings(\n webGLProgram,\n transformFeedbackVaryings.names,\n transformFeedbackVaryings.bufferMode === 'separate'\n ? gl.SEPARATE_ATTRIBS\n : gl.INTERLEAVED_ATTRIBS\n );\n }\n }\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc))\n {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n", "import { mapSize } from '../utils';\nimport { uniformParsers } from './uniformParsers';\n\nimport type { Dict } from '@pixi/utils';\nimport type { Buffer } from '../../geometry/Buffer';\nimport type { Renderer } from '../../Renderer';\nimport type { IUniformData } from '../Program';\nimport type { UniformGroup } from '../UniformGroup';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\n float: `\n data[offset] = v;\n `,\n vec2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n `,\n vec3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n `,\n vec4: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n `,\n mat2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n `,\n mat3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n `,\n mat4: `\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n `\n};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement\n{\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\n\n/**\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n * @ignore\n * @param uniformData\n */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n `];\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${remainder};\n }\n\n `);\n }\n else\n {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\nimport { generateProgram } from './utils/generateProgram';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Dict } from '@pixi/utils';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { GLProgram } from './GLProgram';\nimport type { Program } from './Program';\nimport type { Shader } from './Shader';\nimport type { UniformGroup } from './UniformGroup';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'shader',\n };\n\n /**\n * The current WebGL rendering context.\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n private systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.disposeRunner.add(this);\n\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param glProgram\n * @param syncData\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Syncs uniform buffers\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\n\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n * @returns The glProgram for the currently bound Shader for this context\n */\n getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n * @param shader - The shader that the glProgram will be based on.\n * @returns A shiny new glProgram!\n */\n generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Disposes shader.\n * If disposing one equals with current shader, set current as null.\n * @param shader - Shader object\n */\n disposeShader(shader: Shader): void\n {\n if (this.shader === shader)\n {\n this.shader = null;\n }\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n\nextensions.add(ShaderSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Options for the startup system.\n * @memberof PIXI\n */\nexport interface StartupSystemOptions\n{\n /**\n * Whether to log the version and type information of renderer to console.\n * @memberof PIXI.IRendererOptions\n */\n hello: boolean;\n}\n\n/**\n * A simple system responsible for initiating the renderer.\n * @memberof PIXI\n */\nexport class StartupSystem implements ISystem\n{\n /** @ignore */\n static defaultOptions: StartupSystemOptions = {\n /**\n * {@link PIXI.IRendererOptions.hello}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n hello: false,\n };\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: 'startup',\n };\n\n readonly renderer: IRenderer;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * It all starts here! This initiates every system, passing in the options for any system by name.\n * @param options - the config for the renderer and all its systems\n */\n run(options: StartupSystemOptions): void\n {\n const { renderer } = this;\n\n renderer.runners.init.emit(renderer.options);\n\n if (options.hello)\n {\n // eslint-disable-next-line no-console\n console.log(`PixiJS ${'$_VERSION'} - ${renderer.rendererLogId} - https://pixijs.com`);\n }\n\n renderer.resize(renderer.screen.width, renderer.screen.height);\n }\n\n destroy(): void\n {\n // ka pow!\n }\n}\n\nextensions.add(StartupSystem);\n", "import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @returns {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\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.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\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 array[BLEND_MODES.NONE] = [0, 0];\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.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n", "import { BLEND_MODES } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { State } from './State';\nimport { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'state',\n };\n\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {Function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {Function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n\nextensions.add(StateSystem);\n", "import { Runner } from '@pixi/runner';\nimport { EventEmitter } from '@pixi/utils';\n\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem, ISystemConstructor } from './ISystem';\n\ninterface ISystemConfig\n{\n runners: string[],\n systems: Record>\n priority: string[];\n}\n\n/**\n * The SystemManager is a class that provides functions for managing a set of systems\n * This is a base class, that is generic (no render code or knowledge at all)\n * @memberof PIXI\n */\nexport class SystemManager extends EventEmitter\n{\n /** a collection of runners defined by the user */\n readonly runners: {[key: string]: Runner} = {};\n\n private _systemsHash: Record = {};\n\n /**\n * Set up a system with a collection of SystemClasses and runners.\n * Systems are attached dynamically to this class when added.\n * @param config - the config for the system manager\n */\n setup(config: ISystemConfig): void\n {\n this.addRunners(...config.runners);\n\n // Remove keys that aren't available\n const priority = (config.priority ?? []).filter((key) => config.systems[key]);\n\n // Order the systems by priority\n const orderByPriority = [\n ...priority,\n ...Object.keys(config.systems)\n .filter((key) => !priority.includes(key))\n ];\n\n for (const i of orderByPriority)\n {\n this.addSystem(config.systems[i], i);\n }\n }\n\n /**\n * Create a bunch of runners based of a collection of ids\n * @param runnerIds - the runner ids to add\n */\n addRunners(...runnerIds: string[]): void\n {\n runnerIds.forEach((runnerId) =>\n {\n this.runners[runnerId] = new Runner(runnerId);\n });\n }\n\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this as any as R);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n this._systemsHash[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * A function that will run a runner and call the runners function but pass in different options\n * to each system based on there name.\n *\n * E.g. If you have two systems added called `systemA` and `systemB` you could call do the following:\n *\n * ```js\n * system.emitWithCustomOptions(init, {\n * systemA: {...optionsForA},\n * systemB: {...optionsForB},\n * });\n * ```\n *\n * `init` would be called on system A passing `optionsForA` and on system B passing `optionsForB`.\n * @param runner - the runner to target\n * @param options - key value options for each system\n */\n emitWithCustomOptions(runner: Runner, options: Record): void\n {\n const systemHashKeys = Object.keys(this._systemsHash);\n\n runner.items.forEach((system) =>\n {\n // I know this does not need to be a performant function so it.. isn't!\n // its only used for init and destroy.. we can refactor if required..\n const systemName = systemHashKeys.find((systemId) => this._systemsHash[systemId] === system);\n\n system[runner.name](options[systemName]);\n });\n }\n\n /** destroy the all runners and systems. Its apps job to */\n destroy(): void\n {\n Object.values(this.runners).forEach((runner) =>\n {\n runner.destroy();\n });\n\n this._systemsHash = {};\n }\n\n // TODO implement!\n // removeSystem(ClassRef: ISystemConstructor, name: string): void\n // {\n\n // }\n}\n", "import { GC_MODES } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { ISystem } from '../system/ISystem';\nimport type { Texture } from './Texture';\n\nexport interface IUnloadableTexture\n{\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @memberof PIXI\n */\nexport class TextureGCSystem implements ISystem\n{\n /**\n * Default garbage collection mode.\n * @static\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n * @see PIXI.TextureGCSystem#mode\n */\n public static defaultMode = GC_MODES.AUTO;\n\n /**\n * Default maximum idle frames before a texture is destroyed by garbage collection.\n * @static\n * @default 3600\n * @see PIXI.TextureGCSystem#maxIdle\n */\n public static defaultMaxIdle = 60 * 60;\n\n /**\n * Default frames between two garbage collections.\n * @static\n * @default 600\n * @see PIXI.TextureGCSystem#checkCountMax\n */\n public static defaultCheckCountMax = 60 * 10;\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'textureGC',\n };\n\n /**\n * Frame count since started.\n * @readonly\n */\n public count: number;\n\n /**\n * Frame count since last garbage collection.\n * @readonly\n */\n public checkCount: number;\n\n /**\n * Maximum idle frames before a texture is destroyed by garbage collection.\n * @see PIXI.TextureGCSystem.defaultMaxIdle\n */\n public maxIdle: number;\n\n /**\n * Frames between two garbage collections.\n * @see PIXI.TextureGCSystem.defaultCheckCountMax\n */\n public checkCountMax: number;\n\n /**\n * Current garbage collection mode.\n * @see PIXI.TextureGCSystem.defaultMode\n */\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = TextureGCSystem.defaultMaxIdle;\n this.checkCountMax = TextureGCSystem.defaultCheckCountMax;\n this.mode = TextureGCSystem.defaultMode;\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 protected postrender(): void\n {\n if (!this.renderer.objectRenderer.renderingToScreen)\n {\n return;\n }\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(): void\n {\n const tm = this.renderer.texture;\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 as any).framebuffer && 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 * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(TextureGCSystem);\n", "import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context.\n * @memberof PIXI\n */\nexport class GLTexture\n{\n /** The WebGL texture. */\n public texture: WebGLTexture;\n\n /** Width of texture that was used in texImage2D. */\n public width: number;\n\n /** Height of texture that was used in texImage2D. */\n public height: number;\n\n /** Whether mip levels has to be generated. */\n public mipmap: boolean;\n\n /** WrapMode copied from baseTexture. */\n public wrapMode: number;\n\n /** Type copied from baseTexture. */\n public type: number;\n\n /** Type copied from baseTexture. */\n public internalFormat: number;\n\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n /** Texture contents dirty flag. */\n dirtyId: number;\n\n /** Texture style dirty flag. */\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.dirtyId = -1;\n this.dirtyStyleId = -1;\n this.mipmap = false;\n this.wrapMode = 33071;\n this.type = TYPES.UNSIGNED_BYTE;\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n", "import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @returns Lookup table.\n */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n{ [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n", "import { MIPMAP_MODES, SAMPLER_TYPES, SCALE_MODES, TYPES, WRAP_MODES } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { removeItems } from '@pixi/utils';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { Texture } from './Texture';\n\n/**\n * System plugin to the renderer to manage textures.\n * @memberof PIXI\n */\nexport class TextureSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'texture',\n };\n\n /**\n * Bound textures.\n * @readonly\n */\n public boundTextures: BaseTexture[];\n\n /**\n * List of managed textures.\n * @readonly\n */\n public managedTextures: Array;\n\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n\n /**\n * BaseTexture value that shows that we don't know what is bound.\n * @readonly\n */\n protected unknownTexture: BaseTexture;\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @private\n */\n protected _unknownBoundTextures: boolean;\n\n /**\n * Current location.\n * @readonly\n */\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this system works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n this.boundTextures = [];\n this.currentLocation = -1;\n this.managedTextures = [];\n\n this._unknownBoundTextures = false;\n this.unknownTexture = new BaseTexture();\n\n this.hasIntegerTextures = false;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n * @param texture - Texture to bind\n * @param [location=0] - Location to bind at\n */\n bind(texture: Texture | BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture?.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n else if (glTexture.dirtyStyleId !== texture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture.\n * @param texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\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 multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n * @param maxTextures - number of locations to check\n */\n ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n * @private\n * @param texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else\n {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource?.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n * @private\n * @param texture - the texture to destroy\n * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_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\n /**\n * Update texture style such as mipmap flag\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource?.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n * @private\n * @param texture - Texture to update\n * @param glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(TextureSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { ISystem } from '../system/ISystem';\nimport type { TransformFeedback } from './TransformFeedback';\n\n/**\n * TransformFeedbackSystem provides TransformFeedback of WebGL2\n * https://developer.mozilla.org/en-US/docs/Web/API/WebGLTransformFeedback\n *\n * For example, you can use TransformFeedbackSystem to implement GPU Particle or\n * general purpose computing on GPU (aka GPGPU).\n *\n * It also manages a lifetime of GLTransformFeedback object\n * @memberof PIXI\n */\nexport class TransformFeedbackSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'transformFeedback',\n };\n\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * Bind TransformFeedback and buffers\n * @param transformFeedback - TransformFeedback to bind\n */\n bind(transformFeedback: TransformFeedback)\n {\n const { gl, CONTEXT_UID } = this;\n\n const glTransformFeedback = transformFeedback._glTransformFeedbacks[CONTEXT_UID]\n || this.createGLTransformFeedback(transformFeedback);\n\n gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, glTransformFeedback);\n }\n\n /** Unbind TransformFeedback */\n unbind()\n {\n const { gl } = this;\n\n gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);\n }\n\n /**\n * Begin TransformFeedback\n * @param drawMode - DrawMode for TransformFeedback\n * @param shader - A Shader used by TransformFeedback. Current bound shader will be used if not provided.\n */\n beginTransformFeedback(drawMode: DRAW_MODES, shader?: Shader)\n {\n const { gl, renderer } = this;\n\n if (shader)\n {\n renderer.shader.bind(shader);\n }\n\n gl.beginTransformFeedback(drawMode);\n }\n\n /** End TransformFeedback */\n endTransformFeedback()\n {\n const { gl } = this;\n\n gl.endTransformFeedback();\n }\n\n /**\n * Create TransformFeedback and bind buffers\n * @param tf - TransformFeedback\n * @returns WebGLTransformFeedback\n */\n protected createGLTransformFeedback(tf: TransformFeedback)\n {\n const { gl, renderer, CONTEXT_UID } = this;\n\n const glTransformFeedback = gl.createTransformFeedback();\n\n tf._glTransformFeedbacks[CONTEXT_UID] = glTransformFeedback;\n gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, glTransformFeedback);\n for (let i = 0; i < tf.buffers.length; i++)\n {\n const buffer = tf.buffers[i];\n\n if (!buffer) continue;\n\n renderer.buffer.update(buffer);\n buffer._glBuffers[CONTEXT_UID].refCount++;\n\n gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, i, buffer._glBuffers[CONTEXT_UID].buffer || null);\n }\n gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);\n\n tf.disposeRunner.add(this);\n\n return glTransformFeedback;\n }\n\n /**\n * Disposes TransfromFeedback\n * @param {PIXI.TransformFeedback} tf - TransformFeedback\n * @param {boolean} [contextLost=false] - If context was lost, we suppress delete TransformFeedback\n */\n disposeTransformFeedback(tf: TransformFeedback, contextLost?: boolean): void\n {\n const glTF = tf._glTransformFeedbacks[this.CONTEXT_UID];\n const gl = this.gl;\n\n tf.disposeRunner.remove(this);\n\n const bufferSystem = this.renderer.buffer;\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < tf.buffers.length; i++)\n {\n const buffer = tf.buffers[i];\n\n if (!buffer) continue;\n\n const buf = buffer._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffer, contextLost);\n }\n }\n }\n }\n\n if (!glTF)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteTransformFeedback(glTF);\n }\n\n delete tf._glTransformFeedbacks[this.CONTEXT_UID];\n }\n\n destroy(): void\n {\n // @TODO: Destroy managed TransformFeedbacks\n this.renderer = null;\n }\n}\n\nextensions.add(TransformFeedbackSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { ICanvas } from '@pixi/settings';\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Options for the view system.\n * @memberof PIXI\n */\nexport interface ViewSystemOptions\n{\n /**\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @memberof PIXI.IRendererOptions\n */\n view?: ICanvas;\n /**\n * The width of the renderer's view.\n * @memberof PIXI.IRendererOptions\n */\n width?: number;\n /**\n * The height of the renderer's view.\n * @memberof PIXI.IRendererOptions\n */\n height?: number;\n /**\n * The resolution / device pixel ratio of the renderer.\n * @memberof PIXI.IRendererOptions\n */\n resolution?: number;\n /**\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @memberof PIXI.IRendererOptions\n */\n autoDensity?: boolean;\n}\n\n/**\n * The view system manages the main canvas that is attached to the DOM.\n * This main role is to deal with how the holding the view reference and dealing with how it is resized.\n * @memberof PIXI\n */\nexport class ViewSystem implements ISystem\n{\n /** @ignore */\n static defaultOptions = {\n /**\n * {@link PIXI.IRendererOptions.width}\n * @default 800\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n width: 800,\n /**\n * {@link PIXI.IRendererOptions.height}\n * @default 600\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n height: 600,\n /**\n * {@link PIXI.IRendererOptions.resolution}\n * @type {number}\n * @default PIXI.settings.RESOLUTION\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n resolution: settings.RESOLUTION,\n /**\n * {@link PIXI.IRendererOptions.autoDensity}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n autoDensity: false,\n };\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: '_view',\n };\n\n private renderer: IRenderer;\n\n /**\n * The resolution / device pixel ratio of the renderer.\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n public screen: Rectangle;\n\n /**\n * The canvas element that everything is drawn to.\n * @member {PIXI.ICanvas}\n */\n public element: ICanvas;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n * @member {boolean}\n */\n public autoDensity: boolean;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * initiates the view system\n * @param {PIXI.ViewOptions} options - the options for the view\n */\n init(options: ViewSystemOptions): void\n {\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n this.element = options.view || settings.ADAPTER.createCanvas() as ICanvas;\n\n this.resolution = options.resolution || settings.RESOLUTION;\n\n this.autoDensity = !!options.autoDensity;\n }\n\n /**\n * Resizes the screen and canvas to the specified dimensions.\n * @param desiredScreenWidth - The new width of the screen.\n * @param desiredScreenHeight - The new height of the screen.\n */\n resizeView(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.element.width = Math.round(desiredScreenWidth * this.resolution);\n this.element.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.element.width / this.resolution;\n const screenHeight = this.element.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.element.style.width = `${screenWidth}px`;\n this.element.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.renderer.emit('resize', screenWidth, screenHeight);\n this.renderer.runners.resize.emit(this.screen.width, this.screen.height);\n }\n\n /**\n * Destroys this System and optionally removes the canvas from the dom.\n * @param {boolean} [removeView=false] - Whether to remove the canvas from the DOM.\n */\n destroy(removeView: boolean): void\n {\n // ka boom!\n if (removeView)\n {\n this.element.parentNode?.removeChild(this.element);\n }\n\n this.renderer = null;\n this.element = null;\n this.screen = null;\n }\n}\n\nextensions.add(ViewSystem);\n", "import { ENV } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { deprecation } from '@pixi/utils';\nimport { BatchRenderer } from './batch/BatchRenderer';\nimport { Filter } from './filters/Filter';\nimport { Program } from './shader/Program';\nimport { BackgroundSystem, ContextSystem, StartupSystem, TextureGCSystem, ViewSystem } from './systems';\nimport { BaseTexture } from './textures/BaseTexture';\n\nimport type { GC_MODES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, SCALE_MODES, WRAP_MODES } from '@pixi/constants';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Assets Loader}.\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\n/**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {PIXI.IRendererOptions}\n */\nsettings.RENDER_OPTIONS = {\n ...ContextSystem.defaultOptions,\n ...BackgroundSystem.defaultOptions,\n ...ViewSystem.defaultOptions,\n ...StartupSystem.defaultOptions,\n};\n\nObject.defineProperties(settings, {\n /**\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @deprecated since 7.1.0\n * @see PIXI.BaseTexture.defaultOptions.wrapMode\n */\n WRAP_MODE: {\n get()\n {\n return BaseTexture.defaultOptions.wrapMode;\n },\n set(value: WRAP_MODES)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode');\n // #endif\n BaseTexture.defaultOptions.wrapMode = value;\n },\n },\n\n /**\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @deprecated since 7.1.0\n * @see PIXI.BaseTexture.defaultOptions.scaleMode\n */\n SCALE_MODE: {\n get()\n {\n return BaseTexture.defaultOptions.scaleMode;\n },\n set(value: SCALE_MODES)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode');\n // #endif\n BaseTexture.defaultOptions.scaleMode = value;\n },\n },\n\n /**\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @deprecated since 7.1.0\n * @see PIXI.BaseTexture.defaultOptions.mipmap\n */\n MIPMAP_TEXTURES:\n {\n get()\n {\n return BaseTexture.defaultOptions.mipmap;\n },\n set(value: MIPMAP_MODES)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap');\n // #endif\n BaseTexture.defaultOptions.mipmap = value;\n },\n // MIPMAP_MODES.POW2,\n },\n\n /**\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @deprecated since 7.1.0\n * @see PIXI.BaseTexture.defaultOptions.anisotropicLevel\n */\n ANISOTROPIC_LEVEL:\n {\n get()\n {\n return BaseTexture.defaultOptions.anisotropicLevel;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation(\n '7.1.0', 'settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel');\n // #endif\n BaseTexture.defaultOptions.anisotropicLevel = value;\n },\n\n },\n /**\n * Default filter resolution.\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @deprecated since 7.1.0\n * @type {number}\n * @see PIXI.Filter.defaultResolution\n */\n FILTER_RESOLUTION: {\n get()\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution');\n // #endif\n\n return Filter.defaultResolution;\n },\n set(value)\n {\n Filter.defaultResolution = value;\n },\n },\n\n /**\n * Default filter samples.\n * @static\n * @name FILTER_MULTISAMPLE\n * @memberof PIXI.settings\n * @deprecated since 7.1.0\n * @type {PIXI.MSAA_QUALITY}\n * @see PIXI.Filter.defaultMultisample\n */\n FILTER_MULTISAMPLE: {\n get()\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample');\n // #endif\n\n return Filter.defaultMultisample;\n },\n set(value: MSAA_QUALITY)\n {\n Filter.defaultMultisample = value;\n },\n },\n\n /**\n * The maximum textures that this device supports.\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @deprecated since 7.1.0\n * @see PIXI.BatchRenderer.defaultMaxTextures\n * @type {number}\n */\n SPRITE_MAX_TEXTURES: {\n get()\n {\n return BatchRenderer.defaultMaxTextures;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures');\n // #endif\n BatchRenderer.defaultMaxTextures = value;\n },\n },\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @see PIXI.BatchRenderer.defaultBatchSize\n * @deprecated since 7.1.0\n * @type {number}\n */\n SPRITE_BATCH_SIZE: {\n get()\n {\n return BatchRenderer.defaultBatchSize;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize');\n // #endif\n BatchRenderer.defaultBatchSize = value;\n },\n },\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @see PIXI.BatchRenderer.canUploadSameBuffer\n * @deprecated since 7.1.0\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: {\n get()\n {\n return BatchRenderer.canUploadSameBuffer;\n },\n set(value: boolean)\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.1.0', 'settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer');\n // #endif\n BatchRenderer.canUploadSameBuffer = value;\n },\n },\n\n /**\n * Default Garbage Collection mode.\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @deprecated since 7.1.0\n * @see PIXI.TextureGCSystem.defaultMode\n */\n GC_MODE: {\n get()\n {\n return TextureGCSystem.defaultMode;\n },\n set(value: GC_MODES)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode');\n // #endif\n TextureGCSystem.defaultMode = value;\n },\n },\n\n /**\n * Default Garbage Collection max idle.\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @deprecated since 7.1.0\n * @see PIXI.TextureGCSystem.defaultMaxIdle\n */\n GC_MAX_IDLE: {\n get()\n {\n return TextureGCSystem.defaultMaxIdle;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle');\n // #endif\n TextureGCSystem.defaultMaxIdle = value;\n },\n },\n\n /**\n * Default Garbage Collection maximum check count.\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @deprecated since 7.1.0\n * @see PIXI.TextureGCSystem.defaultCheckCountMax\n */\n GC_MAX_CHECK_COUNT: {\n get()\n {\n return TextureGCSystem.defaultCheckCountMax;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax');\n // #endif\n TextureGCSystem.defaultCheckCountMax = value;\n },\n },\n\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @deprecated since 7.1.0\n * @see PIXI.Program.defaultVertexPrecision\n */\n PRECISION_VERTEX: {\n get()\n {\n return Program.defaultVertexPrecision;\n },\n set(value: PRECISION)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision');\n // #endif\n Program.defaultVertexPrecision = value;\n },\n },\n\n /**\n * Default specify float precision in fragment shader.\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @deprecated since 7.1.0\n * @see PIXI.Program.defaultFragmentPrecision\n */\n PRECISION_FRAGMENT: {\n get()\n {\n return Program.defaultFragmentPrecision;\n },\n set(value: PRECISION)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision');\n // #endif\n Program.defaultFragmentPrecision = value;\n },\n },\n});\n", "/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum UPDATE_PRIORITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Highest priority used for interaction events in {@link PIXI.EventSystem}\n * @default 50\n */\n INTERACTION = 50,\n /**\n * High priority updating, used by {@link PIXI.AnimatedSprite}\n * @default 25\n */\n HIGH = 25,\n /**\n * Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @default 0\n */\n NORMAL = 0,\n /**\n * Low priority used for {@link PIXI.Application} rendering.\n * @default -25\n */\n LOW = -25,\n /**\n * Lowest priority used for {@link PIXI.BasePrepare} utility.\n * @default -50\n */\n UTILITY = -50,\n}\n", "import type { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @returns Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).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 * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\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 * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\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 { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n /**\n * Target frames per millisecond.\n * @static\n */\n public static targetFPMS = 0.06;\n\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n public autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.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 * @default 16.66\n */\n public elapsedMS: number;\n /**\n * The last time {@link PIXI.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 public lastTime = -1;\n /**\n * Factor of current {@link PIXI.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 public speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n private _lastFrame = -1;\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 * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / Ticker.targetFPMS;\n this.elapsedMS = 1 / Ticker.targetFPMS;\n\n this._tick = (time: number): void =>\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 * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\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 * @private\n */\n private _startIfPossible(): void\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 * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\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 * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\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 * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\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 * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn: TickerCallback, context?: T): this\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 * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy(): void\n {\n if (!this._protected)\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 /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.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 * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\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 elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * Ticker.targetFPMS;\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.deltaMS = 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#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS(): number\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#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `Ticker.targetFPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / Ticker.targetFPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, Ticker.targetFPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * import { Ticker } from 'pixi.js';\n *\n * const ticker = 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 *\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 *\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * import { autoDetectRenderer, Container } from 'pixi.js';\n *\n * // You may use the shared ticker to render...\n * const renderer = autoDetectRenderer();\n * const stage = new Container();\n * document.body.appendChild(renderer.view);\n * ticker.add((time) => renderer.render(stage));\n *\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * const animate = (time) => {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * };\n * animate(performance.now());\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.BasePrepare} for core timing\n * functionality that shouldn't usually need to be paused, unlike the `shared`\n * ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n", "import { settings } from '@pixi/settings';\nimport { deprecation } from '@pixi/utils';\nimport { Ticker } from './Ticker';\n\nObject.defineProperties(settings, {\n /**\n * Target frames per millisecond.\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @deprecated since 7.1.0\n * @see PIXI.Ticker.targetFPMS\n */\n TARGET_FPMS: {\n get()\n {\n return Ticker.targetFPMS;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS');\n // #endif\n\n Ticker.targetFPMS = value;\n },\n },\n});\n\nexport { settings };\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\n\nexport interface TickerPluginOptions\n{\n /**\n * Automatically starts the rendering after the construction.\n * **Note**: 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 * @memberof PIXI.IApplicationOptions\n * @default true\n */\n autoStart?: boolean;\n /**\n * Set`true` to use `Ticker.shared`, `false` to create new ticker.\n * If set to `false`, you cannot register a handler to occur before anything that runs on the shared ticker.\n * The system ticker will always run before both the shared ticker and the app ticker.\n * @memberof PIXI.IApplicationOptions\n * @default false\n */\n sharedTicker?: boolean;\n}\n\n/**\n * Middleware for for Application Ticker.\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\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()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n\nextensions.add(TickerPlugin);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ICanvas } from '@pixi/settings';\nimport type { IRenderer, IRendererOptions } from './IRenderer';\n\n/**\n * Renderer options supplied to `autoDetectRenderer`.\n * @memberof PIXI\n */\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n /**\n * Force CanvasRenderer even if WebGL is supported. Only available with **pixi.js-legacy**.\n * @default false\n */\n forceCanvas?: boolean;\n}\n\nexport interface IRendererConstructor\n{\n test(options?: Partial): boolean;\n new (options?: Partial): IRenderer;\n}\n\n/**\n * Collection of installed Renderers.\n * @ignore\n */\nconst renderers: IRendererConstructor[] = [];\n\nextensions.handleByList(ExtensionType.Renderer, renderers);\n\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 * @memberof PIXI\n * @function autoDetectRenderer\n * @param options - Options to use.\n */\nexport function autoDetectRenderer(options?: Partial): IRenderer\n{\n for (const RendererType of renderers)\n {\n if (RendererType.test(options))\n {\n return new RendererType(options) as IRenderer;\n }\n }\n\n throw new Error('Unable to auto-detect a suitable renderer.');\n}\n", "import { MSAA_QUALITY } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * System that manages the multisample property on the WebGL renderer\n * @memberof PIXI\n */\nexport class MultisampleSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: '_multisample',\n };\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n\n private renderer: Renderer;\n\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n let samples;\n\n if (this.renderer.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n destroy(): void\n {\n // ka boom!\n }\n}\n\nextensions.add(MultisampleSystem);\n", "export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { GLBuffer } from './GLBuffer';\n\nimport type { BUFFER_TYPE } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { Buffer } from './Buffer';\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n * @class\n * @memberof PIXI\n */\nexport class BufferSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'buffer',\n };\n\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\n\n unbind(type: BUFFER_TYPE): void\n {\n const { gl } = this;\n\n gl.bindBuffer(type, null);\n }\n\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n\nextensions.add(BufferSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Matrix } from '@pixi/math';\nimport type { IRenderableObject, IRendererRenderOptions } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * system that provides a render function that focussing on rendering Pixi Scene Graph objects\n * to either the main view or to a renderTexture. Used for Canvas `WebGL` contexts\n * @memberof PIXI\n */\nexport class ObjectRendererSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'objectRenderer',\n };\n\n renderer: Renderer;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n renderingToScreen: boolean;\n\n /**\n * the last object rendered by the renderer. Useful for other plugins like interaction managers\n * @readonly\n */\n lastObjectRendered: IRenderableObject;\n\n // renderers scene graph!\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param options - the options to be passed to the renderer\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void\n {\n const renderer = this.renderer;\n\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n renderer.runners.prerender.emit();\n renderer.emit('prerender');\n\n // apply a transform at a GPU level\n renderer.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (renderer.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this.lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n renderer.renderTexture.bind(renderTexture);\n renderer.batch.currentRenderer.start();\n\n if (clear ?? renderer.background.clearBeforeRender)\n {\n renderer.renderTexture.clear();\n }\n\n displayObject.render(renderer);\n\n // apply transform..\n renderer.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n if (options.blit)\n {\n renderer.framebuffer.blit();\n }\n\n renderTexture.baseTexture.update();\n }\n\n renderer.runners.postrender.emit();\n\n // reset transform after render\n renderer.projection.transform = null;\n\n renderer.emit('postrender');\n }\n\n destroy(): void\n {\n // ka pow!\n this.renderer = null;\n this.lastObjectRendered = null;\n }\n}\n\nextensions.add(ObjectRendererSystem);\n", "import { RENDERER_TYPE } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { deprecation, isWebGLSupported } from '@pixi/utils';\nimport { UniformGroup } from './shader/UniformGroup';\nimport { SystemManager } from './system/SystemManager';\n\nimport type { ColorSource } from '@pixi/color';\nimport type { MSAA_QUALITY } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Rectangle } from '@pixi/math';\nimport type { ICanvas } from '@pixi/settings';\nimport type { BackgroundSystem } from './background/BackgroundSystem';\nimport type { BatchSystem } from './batch/BatchSystem';\nimport type { ContextSystem } from './context/ContextSystem';\nimport type { FilterSystem } from './filters/FilterSystem';\nimport type { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport type { MultisampleSystem } from './framebuffer/MultisampleSystem';\nimport type { BufferSystem } from './geometry/BufferSystem';\nimport type { GeometrySystem } from './geometry/GeometrySystem';\nimport type { IRenderableObject, IRenderer, IRendererOptions, IRendererRenderOptions, IRenderingContext } from './IRenderer';\nimport type { MaskSystem } from './mask/MaskSystem';\nimport type { ScissorSystem } from './mask/ScissorSystem';\nimport type { StencilSystem } from './mask/StencilSystem';\nimport type { IRendererPlugins, PluginSystem } from './plugin/PluginSystem';\nimport type { ProjectionSystem } from './projection/ProjectionSystem';\nimport type { ObjectRendererSystem } from './render/ObjectRendererSystem';\nimport type { GenerateTextureSystem, IGenerateTextureOptions } from './renderTexture/GenerateTextureSystem';\nimport type { RenderTexture } from './renderTexture/RenderTexture';\nimport type { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport type { ShaderSystem } from './shader/ShaderSystem';\nimport type { StartupSystem } from './startup/StartupSystem';\nimport type { StateSystem } from './state/StateSystem';\nimport type { TextureGCSystem } from './textures/TextureGCSystem';\nimport type { TextureSystem } from './textures/TextureSystem';\nimport type { TransformFeedbackSystem } from './transformFeedback/TransformFeedbackSystem';\nimport type { ViewSystem } from './view/ViewSystem';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Renderer extends GlobalMixins.Renderer {}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatches, 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 * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n *\n * | Generic Systems | Systems that manage functionality that all renderer types share |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.ViewSystem} | This manages the main view of the renderer usually a Canvas |\n * | {@link PIXI.PluginSystem} | This manages plugins for the renderer |\n * | {@link PIXI.BackgroundSystem} | This manages the main views background color and alpha |\n * | {@link PIXI.StartupSystem} | Boots up a renderer and initiatives all the systems |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n *\n * | WebGL Core Systems | Provide an optimised, easy to use API to work with WebGL |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n * | {@link PIXI.MultisampleSystem} | This manages the multisample const on the WEbGL Renderer |\n *\n * | PixiJS High-Level Systems | Set of specific systems designed to work with PixiJS objects |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.GenerateTextureSystem} | This adds the ability to generate textures from any PIXI.DisplayObject |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link PIXI.MaskSystem} |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link PIXI.MaskSystem} |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.Prepare} | This manages uploading assets to the GPU. |\n * | {@link PIXI.Extract} | This extracts image data from display objects. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n * @memberof PIXI\n */\nexport class Renderer extends SystemManager implements IRenderer\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.Renderer,\n priority: 1,\n };\n\n /**\n * The type of the renderer. will be PIXI.RENDERER_TYPE.CANVAS\n * @member {number}\n * @see PIXI.RENDERER_TYPE\n */\n public readonly type = RENDERER_TYPE.WEBGL;\n\n /**\n * Options passed to the constructor.\n * @type {PIXI.IRendererOptions}\n */\n public readonly options: IRendererOptions;\n\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /**\n * Global uniforms\n * Add any uniforms you want shared across your shaders.\n * the must be added before the scene is rendered for the first time\n * as we dynamically buildcode to handle all global var per shader\n *\n */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public readonly mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public readonly context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public readonly state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public readonly shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public readonly texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public readonly buffer: BufferSystem;\n\n /**\n * TransformFeedback system instance\n * @readonly\n */\n public transformFeedback: TransformFeedbackSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public readonly geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public readonly framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public readonly scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public readonly stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public readonly projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public readonly textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public readonly filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public readonly renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public readonly batch: BatchSystem;\n\n /**\n * plugin system instance\n * @readonly\n */\n public readonly _plugin: PluginSystem;\n\n /**\n * _multisample system instance\n * @readonly\n */\n public readonly _multisample: MultisampleSystem;\n\n /**\n * textureGenerator system instance\n * @readonly\n */\n public readonly textureGenerator: GenerateTextureSystem;\n\n /**\n * background system instance\n * @readonly\n */\n public readonly background: BackgroundSystem;\n\n /**\n * _view system instance\n * @readonly\n */\n public readonly _view: ViewSystem;\n\n /**\n * _render system instance\n * @readonly\n */\n public readonly objectRenderer: ObjectRendererSystem;\n\n /**\n * startup system instance\n * @readonly\n */\n public readonly startup: StartupSystem;\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @param options\n * @private\n */\n static test(options?: Partial): boolean\n {\n if (options?.forceCanvas)\n {\n return false;\n }\n\n return isWebGLSupported();\n }\n\n /**\n * @param {PIXI.IRendererOptions} [options] - See {@link PIXI.settings.RENDER_OPTIONS} for defaults.\n */\n constructor(options?: Partial)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n const systemConfig = {\n runners: [\n 'init',\n 'destroy',\n 'contextChange',\n 'resolutionChange',\n 'reset',\n 'update',\n 'postrender',\n 'prerender',\n 'resize'\n ],\n systems: Renderer.__systems,\n priority: [\n '_view',\n 'textureGenerator',\n 'background',\n '_plugin',\n 'startup',\n // low level WebGL systems\n 'context',\n 'state',\n 'texture',\n 'buffer',\n 'geometry',\n 'framebuffer',\n 'transformFeedback',\n // high level pixi specific rendering\n 'mask',\n 'scissor',\n 'stencil',\n 'projection',\n 'textureGC',\n 'filter',\n 'renderTexture',\n 'batch',\n 'objectRenderer',\n '_multisample'\n ],\n };\n\n this.setup(systemConfig);\n\n if ('useContextAlpha' in options)\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead');\n // #endif\n options.premultipliedAlpha = options.useContextAlpha && options.useContextAlpha !== 'notMultiplied';\n options.backgroundAlpha = options.useContextAlpha === false ? 1 : options.backgroundAlpha;\n }\n\n this._plugin.rendererPlugins = Renderer.__plugins;\n this.options = options as IRendererOptions;\n this.startup.run(this.options);\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param {object} [options] - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void\n {\n this.objectRenderer.render(displayObject, options);\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this._view.resizeView(desiredScreenWidth, desiredScreenHeight);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n * @returns Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixijs/issues/2233\n */\n destroy(removeView = false): void\n {\n this.runners.destroy.items.reverse();\n\n this.emitWithCustomOptions(this.runners.destroy, {\n _view: removeView,\n });\n\n super.destroy();\n }\n\n /** Collection of plugins */\n get plugins(): IRendererPlugins\n {\n return this._plugin.plugins;\n }\n\n /** The number of msaa samples of the canvas. */\n get multisample(): MSAA_QUALITY\n {\n return this._multisample.multisample;\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this._view.element.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @default 600\n */\n get height(): number\n {\n return this._view.element.height;\n }\n\n /** The resolution / device pixel ratio of the renderer. */\n get resolution(): number\n {\n return this._view.resolution;\n }\n set resolution(value: number)\n {\n this._view.resolution = value;\n this.runners.resolutionChange.emit(value);\n }\n\n /** Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. */\n get autoDensity(): boolean\n {\n return this._view.autoDensity;\n }\n\n /** The canvas element that everything is drawn to.*/\n get view(): ICanvas\n {\n return this._view.element;\n }\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n get screen(): Rectangle\n {\n return this._view.screen;\n }\n\n /** the last object rendered by the renderer. Useful for other plugins like interaction managers */\n get lastObjectRendered(): IRenderableObject\n {\n return this.objectRenderer.lastObjectRendered;\n }\n\n /** Flag if we are rendering to the screen vs renderTexture */\n get renderingToScreen(): boolean\n {\n return this.objectRenderer.renderingToScreen;\n }\n\n /** When logging Pixi to the console, this is the name we will show */\n get rendererLogId(): string\n {\n return `WebGL ${this.context.webGLVersion}`;\n }\n\n /**\n * This sets weather the screen is totally cleared between each frame withthe background color and alpha\n * @deprecated since 7.0.0\n */\n get clearBeforeRender(): boolean\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead.');\n // #endif\n\n return this.background.clearBeforeRender;\n }\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @deprecated since 7.0.0\n * @member {boolean}\n */\n get useContextAlpha(): boolean | 'notMultiplied'\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead.');\n // #endif\n\n return this.context.useContextAlpha;\n }\n\n /**\n * readonly drawing buffer preservation\n * we can only know this if Pixi created the context\n * @deprecated since 7.0.0\n */\n get preserveDrawingBuffer(): boolean\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context');\n // #endif\n\n return this.context.preserveDrawingBuffer;\n }\n\n /**\n * The background color to fill if not transparent\n * @member {number}\n * @deprecated since 7.0.0\n */\n get backgroundColor(): ColorSource\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.backgroundColor has been deprecated, use renderer.background.color instead.');\n // #endif\n\n return this.background.color;\n }\n\n set backgroundColor(value: ColorSource)\n {\n // #if _DEBUG\n deprecation('7.0.0', 'renderer.backgroundColor has been deprecated, use renderer.background.color instead.');\n // #endif\n\n this.background.color = value;\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n * @deprecated since 7.0.0\n */\n get backgroundAlpha(): number\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.');\n // #endif\n\n return this.background.alpha;\n }\n\n /**\n * @deprecated since 7.0.0\n */\n set backgroundAlpha(value: number)\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.');\n // #endif\n\n this.background.alpha = value;\n }\n\n /**\n * @deprecated since 7.0.0\n */\n get powerPreference(): WebGLPowerPreference\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.powerPreference has been deprecated, we can only know this if pixi creates the context');\n // #endif\n\n return this.context.powerPreference;\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 * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.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 * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @returns A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture\n {\n return this.textureGenerator.generateTexture(displayObject, options);\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 * @private\n */\n static readonly __plugins: IRendererPlugins = {};\n\n /**\n * The collection of installed systems.\n * @private\n */\n static readonly __systems: Record = {};\n}\n\n// Handle registration of extensions\nextensions.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins);\nextensions.handleByMap(ExtensionType.RendererSystem, Renderer.__systems);\nextensions.add(Renderer);\n", "import { BaseTexture } from '../BaseTexture';\nimport { autoDetectResource } from './autoDetectResource';\nimport { Resource } from './Resource';\n\nimport type { ISize } from '@pixi/math';\nimport type { IAutoDetectOptions } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n * @memberof PIXI\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\n\n /**\n * Used from ArrayResource and CubeResource constructors.\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n * @param resource\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture.\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture.\n * @param baseTexture\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @returns - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n", "import { TARGETS } from '@pixi/constants';\nimport { AbstractMultiResource } from './AbstractMultiResource';\n\nimport type { ISize } from '@pixi/math';\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\nimport type { BaseImageResource } from './BaseImageResource';\n\n/**\n * A resource that contains a number of sources.\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(source: number | Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n", "import { BaseImageResource } from './BaseImageResource';\n\nimport type { ICanvas } from '@pixi/settings';\n\n/**\n * Resource type for HTMLCanvasElement and OffscreenCanvas.\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ICanvas)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement\n {\n const { OffscreenCanvas } = globalThis;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n", "import { TARGETS } from '@pixi/constants';\nimport { AbstractMultiResource } from './AbstractMultiResource';\n\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\nimport type { Resource } from './Resource';\n\n/**\n * Constructor options for CubeResource.\n * @memberof PIXI\n */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n * @protected\n */\n linkBaseTexture: boolean;\n\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n * @param renderer\n * @param _baseTexture\n * @param glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ICanvas } from '@pixi/settings';\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageBitmapResourceOptions\n{\n /** Start loading process automatically when constructed. */\n autoLoad?: boolean;\n\n /** Load image using cross origin. */\n crossOrigin?: boolean;\n\n /** Alpha mode used when creating the ImageBitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for ImageBitmap.\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /** URL of the image source. */\n url: string | null;\n\n /**\n * Load image using cross origin.\n * @default false\n */\n crossOrigin: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES | null;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /**\n * @param source - ImageBitmap or URL to use\n * @param options\n * @param {boolean} [options.autoLoad=true] - Start loading process automatically when constructed.\n * @param {boolean} [options.crossOrigin=true] - Load image using cross origin.\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=null] - Alpha mode used when creating the ImageBitmap.\n */\n constructor(source: ImageBitmap | string, options?: IImageBitmapResourceOptions)\n {\n options = options || {};\n\n let baseSource;\n let url;\n\n if (typeof source === 'string')\n {\n baseSource = ImageBitmapResource.EMPTY;\n url = source;\n }\n else\n {\n baseSource = source;\n url = null;\n }\n // Using super() in if() can cause transpilation problems in some cases, so take it out of if().\n // See https://github.com/pixijs/pixijs/pull/9093 for details.\n super(baseSource);\n this.url = url;\n\n this.crossOrigin = options.crossOrigin ?? true;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise(async (resolve, reject) =>\n {\n if (this.url === null)\n {\n resolve(this);\n\n return;\n }\n\n try\n {\n const response = await settings.ADAPTER.fetch(this.url, {\n mode: this.crossOrigin ? 'cors' : 'no-cors'\n });\n\n if (this.destroyed) return;\n\n const imageBlob = await response.blob();\n\n if (this.destroyed) return;\n\n const imageBitmap = await createImageBitmap(imageBlob, {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n });\n\n if (this.destroyed) return;\n\n this.source = imageBitmap;\n this.update();\n\n resolve(this);\n }\n catch (e)\n {\n if (this.destroyed) return;\n\n reject(e);\n this.onError.emit(e);\n }\n });\n\n return this._load;\n }\n\n /**\n * Upload the image bitmap resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n override upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (!(this.source instanceof ImageBitmap))\n {\n this.load();\n\n return false;\n }\n\n if (typeof this.alphaMode === 'number')\n {\n baseTexture.alphaMode = this.alphaMode;\n }\n\n return super.upload(renderer, baseTexture, glTexture);\n }\n\n /** Destroys this resource. */\n override dispose(): void\n {\n if (this.source instanceof ImageBitmap)\n {\n this.source.close();\n }\n\n super.dispose();\n\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if current environment support ImageBitmap, and source is string or ImageBitmap\n */\n static override test(source: unknown): source is string | ImageBitmap\n {\n return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined'\n && (typeof source === 'string' || source instanceof ImageBitmap);\n }\n\n /**\n * Cached empty placeholder canvas.\n * @see EMPTY\n */\n private static _EMPTY: ICanvas;\n\n /**\n * ImageBitmap cannot be created synchronously, so a empty placeholder canvas is needed when loading from URLs.\n * Only for internal usage.\n * @returns The cached placeholder canvas.\n */\n private static get EMPTY(): ICanvas\n {\n ImageBitmapResource._EMPTY = ImageBitmapResource._EMPTY ?? settings.ADAPTER.createCanvas(0, 0);\n\n return ImageBitmapResource._EMPTY;\n }\n}\n", "import { settings } from '@pixi/settings';\nimport { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ISize } from '@pixi/math';\nimport type { ICanvas } from '@pixi/settings';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean | string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean | string;\n\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(settings.ADAPTER.createCanvas());\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.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 // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as ICanvas;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using a regular expression.\n * @param svgString - a serialized svg element\n * @returns - image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\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 /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} - If the source is a SVG source or data file\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && source.startsWith('data:image/svg+xml'))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n }\n\n /**\n * Regular expression for SVG XML document.\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n", "import { Ticker } from '@pixi/ticker';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean | string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@link HTMLVideoElement}.\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use Ticker.shared to auto update the base texture.\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\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 * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: this | PromiseLike) => void;\n\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n constructor(\n source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions\n )\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixijs/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n * @param _deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n * @param event\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n * @returns - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (!source.paused && !source.ended && this._isSourceReady());\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n * @returns - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState > 2;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.includes(extension);\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n", "import { ArrayResource } from './ArrayResource';\nimport { INSTALLED } from './autoDetectResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\n\nexport * from './BaseImageResource';\nexport * from './Resource';\n\nINSTALLED.push(\n ImageBitmapResource,\n ImageResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './autoDetectResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageBitmapResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, GLTexture, Resource, Renderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Texture } from '@pixi/core';\n\n/**\n * Types of image sources supported by {@link AtlasResource}.\n *\n * @public\n */\nexport type AtlasResourceSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData | ArrayBufferView;\n\n/**\n * An item that is uploaded to the atlas texture.\n *\n * @public\n */\nexport type AtlasResourceItem =\n{\n /**\n * The location of the atlas item in the base-texture's space.\n */\n frame: Rectangle;\n\n /**\n * The source of the texture data.\n */\n source: AtlasResourceSource;\n\n /**\n * This flags when the resource is to be re-uploaded.\n */\n dirtyId: number;\n\n /**\n * This flags when the resource is uploaded and update-to-date with the dirty ID.\n */\n updateId: number;\n\n /**\n * The texture holding this item.\n */\n texture: Texture;\n};\n\n/**\n * An {@code AtlasResource} is used by {@link AtlasAllocator} to manage texture sources\n *\n * @public\n */\nexport class AtlasResource extends Resource\n{\n /**\n * The list of managed resources in the atlas.\n */\n public managedItems: AtlasResourceItem[];\n\n /**\n * Creates an atlas resource.\n *\n * @param width\n * @param height\n */\n constructor(width: number, height: number)\n {\n super(width, height);\n\n this.managedItems = [];\n }\n\n /**\n * Uploads the atlas.\n *\n * @param renderer\n * @param baseTexture\n * @param glTexture\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl: WebGLRenderingContext = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK)\n\n // Allocate the texture on the GPU\n if (glTexture.width !== width ||\n glTexture.height !== height)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n baseTexture.format,\n width,\n height,\n 0,\n baseTexture.format,\n baseTexture.type,\n undefined\n );\n }\n\n const items = this.managedItems;\n\n // Upload all atlas items.\n for (let i = 0, j = items.length; i < j; i++)\n {\n this.uploadItem(\n renderer,\n baseTexture.target,\n baseTexture.format,\n baseTexture.type,\n items[i]\n );\n }\n\n return true;\n }\n\n /**\n * Uploads the atlas item to the GPU.\n *\n * @param renderer - The renderer holding the WebGL context.\n * @param target - The binding point of the base-texture.\n * @param format - The format of the base-texture.\n * @param type - The type of the base-texture data.\n * @param item - The item to upload.\n */\n protected uploadItem(\n renderer: Renderer,\n target: number,\n format: number,\n type: number,\n item: AtlasResourceItem\n ): void\n {\n if (item.updateId === item.dirtyId)\n {\n return;\n }\n\n const gl: WebGLRenderingContext = renderer.gl;\n const isWebGL2 = (gl instanceof WebGL2RenderingContext);\n const frame = item.frame;\n let source = item.source;\n\n // if WebGL1, convert whatever we have into a typed array\n if (!isWebGL2) {\n if (source instanceof ImageData) {\n source = source.data; // pass the typed array directly\n\n } else if (source instanceof HTMLCanvasElement) {\n const ctx = source.getContext('2d');\n const [w, h] = [source.width, source.height];\n source = ctx.getImageData(0, 0, w, h).data;\n\n } else if (source instanceof HTMLImageElement) {\n const [w, h] = [source.naturalWidth, source.naturalHeight];\n const canvas = document.createElement('canvas');\n canvas.width = w;\n canvas.height = h;\n\n const ctx = canvas.getContext('2d');\n ctx.drawImage(source, 0, 0);\n source = ctx.getImageData(0, 0, w, h).data;\n }\n }\n\n gl.texSubImage2D(\n target,\n 0,\n frame.x,\n frame.y,\n frame.width,\n frame.height,\n format,\n type,\n source as any,\n );\n\n item.updateId = item.dirtyId;\n }\n}", "import { Rectangle } from '@pixi/math';\nimport { Area, AreaOrientation } from './Area';\n\nimport type { AreaAllocator } from './AreaAllocator';\nimport type { AreaField } from './Area';\n\n/**\n * An allocator node is represented as a tuple. The zeroth element is the parent of the node. The first element\n * always exists and is the texture area it wholly represents. The second element is whether the rectangle\n * is allocated or free. The last element is optional and is the list\n * of its children.\n *\n * @public\n * @ignore\n */\nexport type AreaNode = [AreaNode, AreaField, boolean] | [AreaNode, AreaField, AreaNode[]];\n\n/**\n * Pointer to guillotene node.\n *\n * @public\n * @ignore\n */\nexport type AreaPtr = { __mem_area: AreaNode };\n\n/**\n * @public\n * @ignore\n */\nexport enum SPLIT_ORIENTATION {\n HOR = 0,\n VERT = 1,\n NONE = 2\n}\n\nconst tempRect = new Rectangle();\n\n/** @public */\nexport class GuilloteneAllocator implements AreaAllocator\n{\n protected _root: AreaNode;\n\n private _width: number;\n private _height: number;\n\n constructor(width: number, height: number)\n {\n this._width = width;\n this._height = height;\n\n // NOTE: getFrame assumes root node is always horizontal!\n this._root = [\n null,\n Area.makeArea(0, this._height, AreaOrientation.HORIZONTAL),\n false\n ];\n }\n\n /**\n * Allocates an area of the given `width` and `height`.\n *\n * @param width - The width required for the allocated area.\n * @param height - The height required for the allocated area.\n * @param rect - An optional `Rectangle` instance to put the resulting area frame into.\n * @return The rectangle frame of the area allocated.\n */\n allocate(width: number, height: number, rect?: Rectangle): Rectangle & AreaPtr\n {\n const area = this.findArea(width, height);\n\n if (!area)\n {\n return null;\n }\n\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n this.getFrame(area, rect);\n\n const hole = new Rectangle(rect.x, rect.y, width, height);\n const node = this.split(area, rect, hole);\n\n rect.copyFrom(hole);\n (rect as any).__mem_area = node;\n\n return rect as (Rectangle & AreaPtr);\n }\n\n /**\n * Frees the area represented by the given area pointer. The original rectangle returned by\n * {@link GuilloteneAllocator#allocate} included this pointer (the `__mem_area` property).\n *\n * @param areaPtr\n */\n free(areaPtr: AreaPtr): void\n {\n const area = areaPtr.__mem_area;\n\n area[2] = false;\n this.merge(area);\n }\n\n get width(): number\n {\n return this._width;\n }\n\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Returns the [area]{@link Area} data for the node.\n *\n * @param node\n * @returns The area data for the node.\n */\n protected getAreaField(node: AreaNode): AreaField\n {\n return node[1];\n }\n\n /**\n * Returns the rectangle covered by the area node.\n *\n * @param node - The node whose covered rectangular area is needed.\n * @param rect - An optional `Rectangle` instance to put the data in.\n * @return The rectangle covered by `node`.\n */\n protected getFrame(node: AreaNode, rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n const nodeArea = this.getAreaField(node);\n const nodeParent = this.getParent(node);\n const nodeOrientation = Area.getOrientation(nodeArea);\n const nodeOpen = Area.getOpenOffset(nodeArea);\n const nodeClose = Area.getCloseOffset(nodeArea);\n const parentOpen = nodeParent ? Area.getOpenOffset(nodeParent[1]) : 0;\n const parentClose = nodeParent ? Area.getCloseOffset(nodeParent[1]) : this._width;// (because root node is horizontal)\n\n if (nodeOrientation) // VERTICAL\n {\n rect.x = nodeOpen;\n rect.y = parentOpen;\n rect.width = nodeClose - rect.x;\n rect.height = parentClose - parentOpen;\n }\n else // HORIZONTAL\n {\n rect.x = parentOpen;\n rect.y = nodeOpen;\n rect.width = parentClose - rect.x;\n rect.height = nodeClose - rect.y;\n }\n\n return rect;\n }\n\n /**\n * Returns the parent of the area node.\n *\n * @param node\n * @return The parent of `node`\n */\n protected getParent(node: AreaNode): AreaNode\n {\n return node[0];\n }\n\n /**\n * Returns whether the given node has any children.\n *\n * @param node\n * @return Whether the given node has any children.\n */\n protected hasChildren(node: AreaNode): boolean\n {\n return (Array.isArray(node[2]) && (node[2].length !== 0));\n }\n\n /**\n * Returns the children of the passed node, if any.\n *\n * @param node\n */\n protected getChildren(node: AreaNode): AreaNode[]\n {\n if (!Array.isArray(node[2])) {\n throw new Error(\"Children don't exist\")\n }\n\n return node[2];\n }\n\n protected addChild(parent: AreaNode, ...nodes: AreaNode[]): void\n {\n parent[2] = Array.isArray(parent[2]) ? parent[2] : []\n parent[2].push(...nodes)\n }\n\n /**\n * Finds an area node with minimum width `aw` and minimum height `ah`.\n *\n * @param aw\n * @param ah\n */\n protected findArea(aw: number, ah: number): AreaNode\n {\n return this.findAreaRecursive(this._root, aw, ah);\n }\n\n /**\n * The recursive implementation for {@link AreaAllocator#findArea}.\n *\n * @param rootArea\n * @param aw\n * @param ah\n */\n protected findAreaRecursive(rootArea: AreaNode, aw: number, ah: number): AreaNode\n {\n const frame = this.getFrame(rootArea, tempRect);\n\n if (frame.width < aw || frame.height < ah)\n {\n return null;\n }\n\n if (!this.hasChildren(rootArea))\n {\n const dx = frame.width - aw;\n const dy = frame.height - ah;\n\n if (dx < 0 || dy < 0 || rootArea[2])\n {\n return null;\n }\n\n return rootArea;\n }\n\n const children = this.getChildren(rootArea);\n\n let bestCandidate = null;\n let bestCandidateScore = Infinity;\n\n for (let i = 0, j = children.length; i < j; i++)\n {\n const candidate = this.findAreaRecursive(children[i], aw, ah);\n\n if (!candidate)\n {\n continue;\n }\n\n const candidateFrame = this.getFrame(candidate, tempRect);\n\n const dx = candidateFrame.width - aw;\n const dy = candidateFrame.height - ah;\n\n if (dx < 0 || dy < 0)\n {\n continue;\n }\n if (!dx && !dy)\n {\n // Perfect fit!\n return candidate;\n }\n\n const score = Math.min(dx, dy);\n\n if (bestCandidateScore > score)\n {\n bestCandidate = candidate;\n bestCandidateScore = score;\n }\n }\n\n return bestCandidate;\n }\n\n /**\n * Returns the orientation of the primary split of host.\n */\n protected splitOrientation(host: Rectangle, hole: Rectangle): SPLIT_ORIENTATION\n {\n if (hole.width === host.width && hole.height === host.height) {\n return SPLIT_ORIENTATION.NONE;\n }\n if (hole.width === host.width) {\n return SPLIT_ORIENTATION.VERT;\n }\n if (hole.height === host.height) {\n return SPLIT_ORIENTATION.HOR;\n }\n\n // ____________________\n // | | |\n // | | |\n // | hole | |\n // | | |\n // |________| Primary |\n // | | |\n // | | |\n // | Sec. | |\n // |________|_________|\n const horAreaDiff = Math.abs(\n // (Primary) Right\n (host.width - hole.width) * host.height -\n // (Secondary) Bottom\n hole.width * (host.height - hole.height)\n )\n\n // ____________________\n // | | |\n // | | |\n // | hole | Sec. |\n // | | |\n // |________|_________|\n // | |\n // | Primary |\n // |__________________|\n const verAreaDiff = Math.abs(\n // (Primary) Bottom\n host.width * (host.height - hole.height) -\n (host.width - hole.width) * hole.height\n )\n\n if (horAreaDiff > verAreaDiff)\n {\n return SPLIT_ORIENTATION.HOR\n }\n else\n {\n return SPLIT_ORIENTATION.VERT\n }\n }\n\n protected split(\n area: AreaNode,\n areaFrame: Rectangle,\n holeFrame: Rectangle,\n orientation: SPLIT_ORIENTATION = this.getParent(area) ? this.splitOrientation(areaFrame, holeFrame) : SPLIT_ORIENTATION.HOR\n ): AreaNode\n {\n if (area[2] === true)\n {\n throw new Error('Cannot deallocate')\n }\n if (orientation === SPLIT_ORIENTATION.NONE)\n {\n area[2] = true;\n return area;\n }\n\n return this[orientation === SPLIT_ORIENTATION.HOR\n ? 'splitPrimaryHorizontal'\n : 'splitPrimaryVertical'](area, areaFrame, holeFrame);\n }\n\n private splitPrimaryHorizontal(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area))\n {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const firstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n []\n ];\n const secondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.HORIZONTAL) {\n this.addChild(area, firstChild, secondChild)\n } else {\n const i = this.getChildren(parent).indexOf(area);\n\n firstChild[0] = parent;\n secondChild[0] = parent;\n\n this.getChildren(parent).splice(i, 1, firstChild, secondChild);\n }\n\n if (holeFrame.height !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n this.addChild(firstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (firstChild as AreaNode)[2] = true;\n }\n\n return firstChild;\n }\n\n private splitPrimaryVertical(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area)) {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const primaryFirstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n []\n ];\n const primarySecondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.VERTICAL)\n {\n this.addChild(area, primaryFirstChild, primarySecondChild);\n }\n else\n {\n const i = this.getChildren(parent).indexOf(area);\n primaryFirstChild[0] = parent;\n primarySecondChild[0] = parent;\n this.getChildren(parent).splice(i, 1, primaryFirstChild, primarySecondChild);\n }\n\n if (holeFrame.width !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n this.addChild(primaryFirstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (primaryFirstChild as AreaNode)[2] = true;\n }\n\n return primaryFirstChild;\n }\n\n protected merge(\n area: AreaNode\n ) {\n if (this.hasChildren(area))\n {\n throw new Error(\"Cannot merge a non-leaf node\");\n }\n\n const parent = this.getParent(area);\n\n if (!parent)\n {\n return;\n }\n\n const siblings = this.getChildren(parent);\n const i = siblings.indexOf(area);\n\n const leftSibling = siblings[i - 1];\n const rightSibling = siblings[i + 1];\n\n if (rightSibling && rightSibling[2] === false)\n {\n // Merge rightSibling into area\n area[1] = Area.setCloseOffset(area[1], Area.getCloseOffset(rightSibling[1]));\n siblings.splice(i + 1, 1);\n }\n if (leftSibling && leftSibling[2] === false)\n {\n // Merge leftSibling into area\n area[1] = Area.setOpenOffset(area[1], Area.getOpenOffset(leftSibling[1]));\n siblings.splice(i - 1, 1);\n }\n\n if (siblings.length === 1) {\n parent[2] = false;\n this.merge(parent);\n }\n }\n\n private printState(area: AreaNode): void\n {\n if (!this.hasChildren(area)) {\n console.log({ ...this.getFrame(area) }, area[2])\n } else {\n this.getChildren(area).forEach(n => this.printState(n))\n }\n }\n}", "import { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { Rectangle } from '@pixi/math';\n\nimport type { TextureSlab } from './TextureSlab';\n\nconst tempRect = new Rectangle();\n\n/**\n * The texture allocator dynamically manages space on base-texture slabs. It can be used to generate\n * atlases on demand, which improve batching efficiency.\n *\n * @public\n */\nexport class TextureAllocator\n{\n /**\n * The width of texture slabs.\n */\n public readonly slabWidth: number;\n\n /**\n * The height of texture slabs.\n */\n public readonly slabHeight: number;\n\n /**\n * The list of base-textures that are used to allocate texture space.\n */\n protected textureSlabs: TextureSlab[];\n\n /**\n * @param slabWidth - The width of base-texture slabs. This should be at most 2048.\n * @param slabHeight - The height of base-texture slabs. This should be at most 2048.\n */\n constructor(slabWidth = 2048, slabHeight = 2048)\n {\n this.slabWidth = slabWidth;\n this.slabHeight = slabHeight;\n\n this.textureSlabs = [];\n }\n\n get maxWidth() {\n return this.slabWidth - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n get maxHeight() {\n return this.slabHeight - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n /**\n * Allocates a texture from this allocator.\n *\n * If its existing slab pool has enough space, the texture is issued from one. Otherwise,\n * a new slab is created and the texture is issued from it. However, if the requested\n * dimensions are larger than slabs themselves, then `null` is always returned.\n *\n * To upload a texture source, you will have to create an atlas-managing {@link Resource}\n * yourself on the base-texture. The {@link AtlasAllocator} does this for you, while the\n * {@link CanvasTextureAllocator} can be used to draw on a canvas-based atlas.\n *\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - The padding requested around the texture, to prevent bleeding.\n * @return The allocated texture, if successful; otherwise, `null`.\n */\n allocate(width: number, height: number, padding = this.calculatePadding(width, height)): T\n {\n // Cannot allocate a texture larger than a texture-slab.\n if (width + 2 * padding > this.slabWidth ||\n height + 2 * padding > this.slabHeight)\n {\n return null;\n }\n\n const slabs = this.textureSlabs;\n\n // Loop through the slabs and find one with enough space, if any.\n for (let i = 0, j = slabs.length; i < j; i++)\n {\n const slab = slabs[i];\n const texture = this.issueTexture(slab, width, height, padding);\n\n if (texture)\n {\n return texture;\n }\n }\n\n // Issue a new slab.\n const slab = this.createSlab();\n\n // Append this slab to the head of the list.\n this.textureSlabs.unshift(slab);\n\n // Issue the texture from this blank slab.\n return this.issueTexture(slab, width, height, padding);\n }\n\n /**\n * Frees the texture and reclaims its space. It is assumed you will not use it again, and have\n * destroyed any resource uploading its data.\n *\n * @param texture\n * @throws When the texture was not located in this allocator.\n */\n free(texture: T): void\n {\n const baseTexture = (texture as Texture).baseTexture;\n const slab = this.textureSlabs.find(sl => sl.slab === baseTexture);\n\n if (!slab)\n {\n throw new Error(\"The texture cannot be freed because \" +\n \"its base-texture is not pooled by this allocator. \" +\n \"This is either a bug in TextureAllocator or you tried to free a \" +\n \"texture that was never allocated by one.\");\n }\n\n const textureEntry = slab.managedTextures.find(entry => entry.texture === texture);\n\n if (!textureEntry)\n {\n throw new Error(\"The texture cannot be freed because it was not found \" +\n \"in the managed list of issued textures on its slab. This may be because you \" +\n \"duplicated this texture or a bug in TextureAllocator\");\n }\n\n slab.managedArea.free(textureEntry.area);\n slab.managedTextures.splice(slab.managedTextures.indexOf(textureEntry), 1);\n }\n\n protected calculatePadding(width: number, height: number): number\n {\n const dimen = Math.max(width, height);\n\n if (dimen < 64)\n {\n return 2;\n }\n else if (dimen < 128)\n {\n return 4;\n }\n else if (dimen < 1024)\n {\n return 8;\n }\n else\n {\n return 16;\n }\n }\n\n /**\n * Creates a texture slab. The slab's base-texture is not backed by any resource. You\n * will have to manage that yourself. See {@link AtlasAllocator} or {@link CanvasTextureAllocator}\n * for better resource semantics.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(null,\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Creates a texture on the given base-texture at {@code frame}.\n *\n * @param baseTexture - The base texture that will hold the texture's space.\n * @param frame - The frame in which the texture will be stored.\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): T\n {\n // Override this method to return correct texture type T.\n return new Texture(baseTexture, frame) as T;\n }\n\n /**\n * Issues a texture from the given texture slab, if possible.\n *\n * @param slab - The texture slab to allocate frame.\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - Padding required around the texture.\n * @return The issued texture, if successful; otherwise, `null`.\n */\n protected issueTexture(slab: TextureSlab, width: number, height: number, padding = 0): T\n {\n const area = slab.managedArea.allocate(width + 2 * padding, height + 2 * padding);\n\n if (!area)\n {\n return null;\n }\n\n tempRect.copyFrom(area);\n tempRect.pad(-padding);\n\n const baseTexture = slab.slab;\n const issuedTexture = this.createTexture(baseTexture, tempRect.clone());\n\n slab.managedTextures.push({\n area,\n texture: issuedTexture,\n });\n\n return issuedTexture;\n }\n}", "import { AtlasResource } from './AtlasResource';\nimport { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\nimport type { AtlasResourceSource } from './AtlasResource';\n\n/**\n * This texture allocator auto-manages the base-texture with an {@link AtlasResource}. You can also\n * pass a texture source to `allocate`, mimicing {@link Texture.from} functionality.\n *\n * @public\n */\nexport class AtlasAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by an {@link AtlasResource}.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(new AtlasResource(this.slabWidth, this.slabHeight),\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Allocates a texture backed by the given atlas source, with the given padding.\n *\n * @override\n * @param width\n * @param height\n * @param padding\n * @param source\n */\n allocate(width: number, height: number, padding?: number, source?: AtlasResourceSource): Texture;\n\n /**\n * Allocates a texture backed by the given source, with default padding.\n *\n * @param width\n * @param height\n * @param source\n */\n allocate(width: number, height: number, source?: AtlasResourceSource): Texture;\n\n allocate(width: number, height: number, paddingOrSource?: number | AtlasResourceSource, source?: AtlasResourceSource): Texture\n {\n let padding: number;\n\n if (typeof paddingOrSource === 'number')\n {\n padding = paddingOrSource;\n }\n else\n {\n padding = this.calculatePadding(width, height);\n source = paddingOrSource;\n }\n\n const texture = super.allocate(width, height, padding);\n\n if (source)\n {\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = {\n frame: texture.frame,\n source,\n // dirtyId !== updateId only if image loaded\n dirtyId: source instanceof HTMLImageElement && !source.complete ? -1 : 0,\n updateId: -1,\n texture,\n };\n\n atlas.managedItems.push(item);\n\n if (source instanceof HTMLImageElement && !source.complete) {\n source.addEventListener('load', () => {\n if (texture.baseTexture.valid && !texture.baseTexture.destroyed && atlas.managedItems.indexOf(item) >= 0) {\n item.dirtyId++;\n texture.baseTexture.update();\n }\n });\n }\n\n texture.baseTexture.update();\n }\n\n return texture;\n }\n\n free(texture: Texture): void\n {\n super.free(texture);\n\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = atlas.managedItems.find(item => item.texture === texture);\n\n if (item)\n {\n atlas.managedItems.splice(atlas.managedItems.indexOf(item), 1);\n }\n }\n}", "import { BaseTexture } from '@pixi/core';\n\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues texture backed by a canvas. You can draw on to that canvas to soruce\n * each texture.\n *\n * @public\n */\nexport class CanvasTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a canvas.\n */\n protected createSlab(): TextureSlab\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = this.slabWidth;\n canvas.height = this.slabHeight;\n\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(canvas, {\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n}", "import { BaseRenderTexture, RenderTexture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\n\nimport type { BaseTexture } from '@pixi/core';\nimport type { Rectangle } from '@pixi/math';\nimport type { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues render-textures, and is otherwise just like {@link TextureAllocator}.\n *\n * @public\n */\nexport class RenderTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a base render-texture.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseRenderTexture({\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n\n /**\n * Creates a render-texture from the given base render-texture.\n *\n * @param baseTexture\n * @param frame\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): RenderTexture\n {\n return new RenderTexture(baseTexture as BaseRenderTexture, frame);\n }\n}"], - "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,UAAI,MAAM,OAAO,UAAU;AAA3B,UACI,SAAS;AASb,eAAS,SAAS;AAAA,MAAC;AASnB,UAAI,OAAO,QAAQ;AACjB,eAAO,YAAY,uBAAO,OAAO,IAAI;AAMrC,YAAI,CAAC,IAAI,OAAO,EAAE;AAAW,mBAAS;AAAA,MACxC;AAWA,eAAS,GAAG,IAAIA,UAAS,MAAM;AAC7B,aAAK,KAAK;AACV,aAAK,UAAUA;AACf,aAAK,OAAO,QAAQ;AAAA,MACtB;AAaA,eAAS,YAAY,SAAS,OAAO,IAAIA,UAAS,MAAM;AACtD,YAAI,OAAO,OAAO,YAAY;AAC5B,gBAAM,IAAI,UAAU,iCAAiC;AAAA,QACvD;AAEA,YAAI,WAAW,IAAI,GAAG,IAAIA,YAAW,SAAS,IAAI,GAC9C,MAAM,SAAS,SAAS,QAAQ;AAEpC,YAAI,CAAC,QAAQ,QAAQ,GAAG;AAAG,kBAAQ,QAAQ,GAAG,IAAI,UAAU,QAAQ;AAAA,iBAC3D,CAAC,QAAQ,QAAQ,GAAG,EAAE;AAAI,kBAAQ,QAAQ,GAAG,EAAE,KAAK,QAAQ;AAAA;AAChE,kBAAQ,QAAQ,GAAG,IAAI,CAAC,QAAQ,QAAQ,GAAG,GAAG,QAAQ;AAE3D,eAAO;AAAA,MACT;AASA,eAAS,WAAW,SAAS,KAAK;AAChC,YAAI,EAAE,QAAQ,iBAAiB;AAAG,kBAAQ,UAAU,IAAI,OAAO;AAAA;AAC1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AO,QAAQ,KAAK;AACpB,aAAO,SAAS,KAAK;AAErB,aAAO;AAAA,QACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,QACpE,iBAAiB,CAAC;AAAA,QAClB,MAAM,IAAI,YAAY,QAAQ;AAAA,UAC1B,OAAO,KAAK;AAAA,UACZ,QAAQ,KAAK;AAAA,QACjB,CAAC;AAAA,MACL;AAAA,IACJ;AAAA,EACJ;;;ACpBO,MAAM,yBAAN,cAAqC,iBAC5C;AAAA;AAAA;AAAA;AAAA,IAIc,aACV;AACI,aAAO;AAAA,QACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,QACpE,iBAAiB,CAAC;AAAA,QAClB,MAAM,IAAI,kBAAkB;AAAA,UACxB,OAAO,KAAK;AAAA,UACZ,QAAQ,KAAK;AAAA,QACjB,CAAC;AAAA,MACL;AAAA,IACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQU,cAAc,aAA0B,OAClD;AACI,aAAO,IAAI,cAAc,aAAkC,KAAK;AAAA,IACpE;AAAA,EACJ;", + "sourcesContent": ["'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 * @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 {*} 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 * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @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 * @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 * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\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 * @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 {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\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 {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\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 {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @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 clearEvent(this, 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 clearEvent(this, 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 clearEvent(this, 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 * @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]) clearEvent(this, evt);\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// 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", "'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 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\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 | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\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(filterPoints(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 ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangle(ax, ay, bx, by, cx, cy, 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 var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, 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.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && 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.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && 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.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && 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 | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\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 filterPoints(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, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\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 outerNode = eliminateHole(queue[i], outerNode);\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 var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\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 m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\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;\n\n do {\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 (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\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 === 0) 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 = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\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 || (p.x === leftmost.x && p.y < leftmost.y)) 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) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\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) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\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 var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 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 = 0;\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", "/*! https://mths.be/punycode v1.3.2 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 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 \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 * http://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 state to ,\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.3.2',\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 \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) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // 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 { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\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", "// 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 (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\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 Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(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", "'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\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 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", "export * from './Area';\nexport * from './AreaAllocator';\nexport * from './AtlasAllocator';\nexport * from './AtlasResource';\nexport * from './CanvasTextureAllocator';\nexport * from './GuilloteneAllocator';\nexport * from './RenderTextureAllocator';\nexport * from './TextureAllocator';\nexport * from './TextureSlab';", "/**\n * The orientation of an area indicates the axis along which it is split. This is a 1-bit field.\n *\n * @public\n */\nexport enum AreaOrientation {\n HORIZONTAL = 0,\n VERTICAL = 1\n};\n\n/**\n * Alias for the 31-bit field texture-area type.\n *\n * @public\n */\nexport type AreaField = number;\n\n/**\n * An area represents an oriented rectangular region. It is implemented as a 31-bit field. The open/close edges are\n * specified along its parent's orientation axis, i.e. if the parent is horizontal, the left and right edges are defined,\n * else if the parent is vertical, the top and bottom edges are defined. Similarly, the open/close edges of its\n * children will be along its own orientation axis.\n *\n * The orientation axes flip-flop along the hierarchy, i.e. an area's parent's orientation is always opposite to\n * the area's own orientation. This is because if the orientation were to be same, the area's children could be\n * \"pulled up\" to the parent making itself redundant.\n *\n * All four edges of an area can be retrieved from it and its parent.\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
FieldBitsDescription
OPEN_OFFSET0-14\n * The offset along the parent's axis at which the area begins. If orientation is horizontal,\n * this is the left edge. If orientation is vertical, this is the top edge.\n *
CLOSE_OFFSET15-29\n * The offset along the parent's axis at which the area ends. If orientation is horizontal,\n * this is the right edge. If orientation is vertical, this is the bottom edge.\n *
ORIENTATION30\n * The orientation of the area, which indicates the axis along it is split. The open and close\n * offsets of its children are along this axis. See {@link AreaOrientation}.\n *
\n *\n * @public\n */\nexport class Area\n{\n static makeArea(openOffset: number, closeOffset: number, orientation: number): number\n {\n return openOffset | (closeOffset << 15) | (orientation << 30);\n }\n\n static getOpenOffset(area: AreaField): number\n {\n return area & ((1 << 15) - 1);\n }\n\n static getCloseOffset(area: AreaField): number\n {\n return (area >> 15) & ((1 << 15) - 1);\n }\n\n static getOrientation(area: AreaField): AreaOrientation\n {\n return (area >> 30) & 1;\n }\n\n static setOpenOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n offset,\n Area.getCloseOffset(area),\n Area.getOrientation(area)\n );\n }\n\n static setCloseOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n Area.getOpenOffset(offset),\n offset,\n Area.getOrientation(area)\n );\n }\n}", "/**\n * Different types of environments for WebGL.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum ENV\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @default 0\n */\n WEBGL_LEGACY,\n /**\n * Version 1 of WebGL\n * @default 1\n */\n WEBGL,\n /**\n * Version 2 of WebGL\n * @default 2\n */\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum RENDERER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Unknown render type.\n * @default 0\n */\n UNKNOWN,\n /**\n * WebGL render type.\n * @default 1\n */\n WEBGL,\n /**\n * Canvas render type.\n * @default 2\n */\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum BUFFER_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Indicates the buffers currently enabled for color writing.\n * @default 0x00004000\n */\n COLOR = 0x00004000,\n /**\n * Indicates the depth buffer.\n * @default 0x00000100\n */\n DEPTH = 0x00000100,\n /**\n * Indicates the stencil buffer.\n * @default 0x00000400\n */\n STENCIL = 0x00000400\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 * @memberof PIXI\n * @enum {number}\n */\nexport enum BLEND_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * @default 0\n */\n NORMAL = 0,\n /**\n * @default 1\n */\n ADD = 1,\n /**\n * The pixels of the top layer are multiplied with the corresponding pixel of the bottom layer.\n * A darker picture is the result.\n * @default 2\n */\n MULTIPLY = 2,\n /**\n * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply)\n * @default 3\n */\n SCREEN = 3,\n /**\n * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter.\n *\n * Canvas Renderer only.\n * @default 4\n */\n OVERLAY = 4,\n /**\n * Retains the darkest pixels of both layers.\n *\n * Canvas Renderer only.\n * @default 5\n */\n DARKEN = 5,\n /**\n * Retains the lightest pixels of both layers.\n *\n * Canvas Renderer only.\n * @default 6\n */\n LIGHTEN = 6,\n /**\n * Divides the bottom layer by the inverted top layer.\n *\n * Canvas Renderer only.\n * @default 7\n */\n COLOR_DODGE = 7,\n /**\n * Divides the inverted bottom layer by the top layer, and then inverts the result.\n *\n * Canvas Renderer only.\n * @default 8\n */\n COLOR_BURN = 8,\n /**\n * A combination of multiply and screen like overlay, but with top and bottom layer swapped.\n *\n * Canvas Renderer only.\n * @default 9\n */\n HARD_LIGHT = 9,\n /**\n * A softer version of hard-light. Pure black or white does not result in pure black or white.\n *\n * Canvas Renderer only.\n * @default 10\n */\n SOFT_LIGHT = 10,\n /**\n * Subtracts the bottom layer from the top layer or the other way round to always get a positive value.\n *\n * Canvas Renderer only.\n * @default 11\n */\n DIFFERENCE = 11,\n /**\n * Like difference, but with lower contrast.\n *\n * Canvas Renderer only.\n * @default 12\n */\n EXCLUSION = 12,\n /**\n * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.\n *\n * Canvas Renderer only.\n * @default 13\n */\n HUE = 13,\n /**\n * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.\n *\n * Canvas Renderer only.\n * @default 14\n */\n SATURATION = 14,\n /**\n * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.\n *\n * Canvas Renderer only.\n * @default 15\n */\n COLOR = 15,\n /**\n * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.\n *\n * Canvas Renderer only.\n * @default 16\n */\n LUMINOSITY = 16,\n /**\n * @default 17\n */\n NORMAL_NPM = 17,\n /**\n * @default 18\n */\n ADD_NPM = 18,\n /**\n * @default 19\n */\n SCREEN_NPM = 19,\n /**\n * @default 20\n */\n NONE = 20,\n\n /**\n * Draws new shapes on top of the existing canvas content.\n * @default 0\n */\n SRC_OVER = 0,\n /**\n * The new shape is drawn only where both the new shape and the destination canvas overlap.\n * Everything else is made transparent.\n * @default 21\n */\n SRC_IN = 21,\n /**\n * The new shape is drawn where it doesn't overlap the existing canvas content.\n * @default 22\n */\n SRC_OUT = 22,\n /**\n * The new shape is only drawn where it overlaps the existing canvas content.\n * @default 23\n */\n SRC_ATOP = 23,\n /**\n * New shapes are drawn behind the existing canvas content.\n * @default 24\n */\n DST_OVER = 24,\n /**\n * The existing canvas content is kept where both the new shape and existing canvas content overlap.\n * Everything else is made transparent.\n * @default 25\n */\n DST_IN = 25,\n /**\n * The existing content is kept where it doesn't overlap the new shape.\n * @default 26\n */\n DST_OUT = 26,\n /**\n * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content.\n * @default 27\n */\n DST_ATOP = 27,\n /**\n * @default 26\n */\n ERASE = 26,\n /**\n * @default 28\n */\n SUBTRACT = 28,\n /**\n * Shapes are made transparent where both overlap and drawn normal everywhere else.\n * @default 29\n */\n XOR = 29,\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 * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum DRAW_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * To draw a series of points.\n * @default 0\n */\n POINTS,\n /**\n * To draw a series of unconnected line segments (individual lines).\n * @default 1\n */\n LINES,\n /**\n * To draw a series of connected line segments. It also joins the first and last vertices to form a loop.\n * @default 2\n */\n LINE_LOOP,\n /**\n * To draw a series of connected line segments.\n * @default 3\n */\n LINE_STRIP,\n /**\n * To draw a series of separate triangles.\n * @default 4\n */\n TRIANGLES,\n /**\n * To draw a series of connected triangles in strip fashion.\n * @default 5\n */\n TRIANGLE_STRIP,\n /**\n * To draw a series of connected triangles sharing the first vertex in a fan-like fashion.\n * @default 6\n */\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n */\nexport enum FORMATS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * @default 6408\n */\n RGBA = 6408,\n /**\n * @default 6407\n */\n RGB = 6407,\n /**\n * @default 33319\n */\n RG = 33319,\n /**\n * @default 6403\n */\n RED = 6403,\n /**\n * @default 36249\n */\n RGBA_INTEGER = 36249,\n /**\n * @default 36248\n */\n RGB_INTEGER = 36248,\n /**\n * @default 33320\n */\n RG_INTEGER = 33320,\n /**\n * @default 36244\n */\n RED_INTEGER = 36244,\n /**\n * @default 6406\n */\n ALPHA = 6406,\n /**\n * @default 6409\n */\n LUMINANCE = 6409,\n /**\n * @default 6410\n */\n LUMINANCE_ALPHA = 6410,\n /**\n * @default 6402\n */\n DEPTH_COMPONENT = 6402,\n /**\n * @default 34041\n */\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum TARGETS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * A two-dimensional texture\n * @default 3553\n */\n TEXTURE_2D = 3553,\n /**\n * A cube-mapped texture. When using a WebGL 2 context, the following values are available additionally:\n * - gl.TEXTURE_3D: A three-dimensional texture.\n * - gl.TEXTURE_2D_ARRAY: A two-dimensional array texture.\n * @default 34067\n */\n TEXTURE_CUBE_MAP = 34067,\n /**\n * A two-dimensional array texture.\n * @default 35866\n */\n TEXTURE_2D_ARRAY = 35866,\n /**\n * Positive X face for a cube-mapped texture.\n * @default 34069\n */\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n /**\n * Negative X face for a cube-mapped texture.\n * @default 34070\n */\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n /**\n * Positive Y face for a cube-mapped texture.\n * @default 34071\n */\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n /**\n * Negative Y face for a cube-mapped texture.\n * @default 34072\n */\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n /**\n * Positive Z face for a cube-mapped texture.\n * @default 34073\n */\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n /**\n * Negative Z face for a cube-mapped texture.\n * @default 34074\n */\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * 8 bits per channel for gl.RGBA\n * @default 5121\n */\n UNSIGNED_BYTE = 5121,\n /**\n * @default 5123\n */\n UNSIGNED_SHORT = 5123,\n /**\n * 5 red bits, 6 green bits, 5 blue bits.\n * @default 33635\n */\n UNSIGNED_SHORT_5_6_5 = 33635,\n /**\n * 4 red bits, 4 green bits, 4 blue bits, 4 alpha bits.\n * @default 32819\n */\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n /**\n * 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit.\n * @default 32820\n */\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n /**\n * @default 5125\n */\n UNSIGNED_INT = 5125,\n /**\n * @default 35899\n */\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n /**\n * @default 33640\n */\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n /**\n * @default 34042\n */\n UNSIGNED_INT_24_8 = 34042,\n /**\n * @default 35902\n */\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n /**\n * @default 5120\n */\n BYTE = 5120,\n /**\n * @default 5122\n */\n SHORT = 5122,\n /**\n * @default 5124\n */\n INT = 5124,\n /**\n * @default 5126\n */\n FLOAT = 5126,\n /**\n * @default 36269\n */\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n /**\n * @default 36193\n */\n HALF_FLOAT = 36193,\n}\n\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum SAMPLER_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * @default 0\n */\n FLOAT = 0,\n /**\n * @default 1\n */\n INT = 1,\n /**\n * @default 2\n */\n UINT = 2,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.BaseTexture.defaultOptions.scaleMode} 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 * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum SCALE_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Pixelating scaling\n * @default 0\n */\n NEAREST,\n /**\n * Smooth scaling\n * @default 1\n */\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The 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 * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum WRAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * The textures uvs are clamped\n * @default 33071\n */\n CLAMP = 33071,\n /**\n * The texture uvs tile and repeat\n * @default 10497\n */\n REPEAT = 10497,\n /**\n * The texture uvs tile and repeat with mirroring\n * @default 33648\n */\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.BaseTexture.defaultOptions.mipmap} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Since WebGL 1 don't support mipmap for non-power-of-two textures,\n * `ON` option will work like `POW2` for WebGL 1.\n *\n * This property only affects WebGL.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum MIPMAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * No mipmaps.\n * @default 0\n */\n OFF,\n /**\n * Generate mipmaps if texture dimensions are powers of 2.\n * @default 1\n */\n POW2,\n /**\n * Always generate mipmaps.\n * @default 2\n */\n ON,\n /**\n * Use mipmaps, but do not auto-generate them.\n * this is used with a resource that supports buffering each level-of-detail.\n * @default 3\n */\n ON_MANUAL,\n}\n\n/**\n * How to treat textures with premultiplied alpha\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum ALPHA_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Alias for NO_PREMULTIPLIED_ALPHA.\n * @type {number}\n * @default 0\n */\n NPM = 0,\n /**\n * Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @type {number}\n * @default 1\n */\n UNPACK = 1,\n /**\n * Alias for PREMULTIPLIED_ALPHA.\n * @type {number}\n * @default 2\n */\n PMA = 2,\n /**\n * Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @type {number}\n * @default 0\n */\n NO_PREMULTIPLIED_ALPHA = 0,\n /**\n * Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @type {number}\n * @default 1\n */\n PREMULTIPLY_ON_UPLOAD = 1,\n /**\n * Source is already premultiplied. Example: spine atlases with `_pma` suffix.\n * @type {number}\n * @default 2\n */\n PREMULTIPLIED_ALPHA = 2,\n}\n\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link PIXI.CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum CLEAR_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Alias for BLEND, same as `false` in earlier versions\n * @default 0\n */\n NO = 0,\n /**\n * Alias for CLEAR, same as `true` in earlier versions\n * @default 1\n */\n YES = 1,\n /**\n * Alias for BLIT\n * @default 2\n */\n AUTO = 2,\n /**\n * Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @default 0\n */\n BLEND = 0,\n /**\n * Always clear the filter texture.\n * @default 1\n */\n CLEAR = 1,\n /**\n * Clear only if {@link PIXI.FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @default 2\n */\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.TextureGCSystem.defaultMode} 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 * @enum {number}\n * @static\n * @memberof PIXI\n */\nexport enum GC_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Garbage collection will happen periodically automatically\n * @default 0\n */\n AUTO,\n /**\n * Garbage collection will need to be called manually\n * @default 1\n */\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n * @memberof PIXI\n * @static\n * @enum {string}\n */\nexport enum PRECISION\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * lowp is at least an 9 bit value.\n * For floating point values they can range from: -2 to +2,\n * for integer values they are similar to Uint8Array or Int8Array\n * @default lowp\n */\n LOW = 'lowp',\n /**\n * mediump is at least a 16 bit value.\n * For floating point values they can range from: -2^14 to +2^14,\n * for integer values they are similar to Uint16Array or Int16Array\n * @default mediump\n */\n MEDIUM = 'mediump',\n /**\n * highp is at least a 32 bit value.\n * For floating point values they can range from: -2^62 to +2^62,\n * for integer values they are similar to Uint32Array or Int32Array\n * @default highp\n */\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum MASK_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Mask is ignored\n * @default 0\n */\n NONE = 0,\n /**\n * Scissor mask, rectangle on screen, cheap\n * @default 1\n */\n SCISSOR = 1,\n /**\n * Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @default 2\n */\n STENCIL = 2,\n /**\n * Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n * @default 3\n */\n SPRITE = 3,\n /**\n * Color mask (RGBA)\n * @default 4\n */\n COLOR = 4,\n}\n\n/**\n * Bitwise OR of masks that indicate the color channels that are rendered to.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum COLOR_MASK_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Red channel.\n * @default 0x1\n */\n RED = 0x1,\n /**\n * Green channel\n * @default 0x2\n */\n GREEN = 0x2,\n /**\n * Blue channel.\n * @default 0x4\n */\n BLUE = 0x4,\n /**\n * Alpha channel.\n * @default 0x\n */\n ALPHA = 0x8\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n * @see PIXI.Framebuffer#multisample\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum MSAA_QUALITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * No multisampling for this renderTexture\n * @default 0\n */\n NONE = 0,\n /**\n * Try 2 samples\n * @default 2\n */\n LOW = 2,\n /**\n * Try 4 samples\n * @default 4\n */\n MEDIUM = 4,\n /**\n * Try 8 samples\n * @default 8\n */\n HIGH = 8\n}\n\n/**\n * Constants for various buffer types in Pixi\n * @see PIXI.BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n */\nexport enum BUFFER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * buffer type for using as an index buffer\n * @default 34963\n */\n ELEMENT_ARRAY_BUFFER = 34963,\n /**\n * buffer type for using attribute data\n * @default 34962\n */\n ARRAY_BUFFER = 34962,\n /**\n * the buffer type is for uniform buffer objects\n * @default 35345\n */\n UNIFORM_BUFFER = 35345,\n}\n", "import type { ICanvas } from './ICanvas';\nimport type { ICanvasRenderingContext2D } from './ICanvasRenderingContext2D';\n\n/**\n * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase.\n * Implementations of this interface can be used to make sure Pixi will work in any environment,\n * such as browser, Web Workers, and Node.js.\n * @memberof PIXI\n */\nexport interface IAdapter\n{\n /** Returns a canvas object that can be used to create a webgl context. */\n createCanvas: (width?: number, height?: number) => ICanvas;\n /** Returns a 2D rendering context. */\n getCanvasRenderingContext2D: () => { prototype: ICanvasRenderingContext2D; };\n /** Returns a WebGL rendering context. */\n getWebGLRenderingContext: () => typeof WebGLRenderingContext;\n /** Returns a partial implementation of the browsers window.navigator */\n getNavigator: () => { userAgent: string };\n /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */\n getBaseUrl: () => string;\n getFontFaceSet: () => FontFaceSet | null;\n fetch: (url: RequestInfo, options?: RequestInit) => Promise;\n parseXML: (xml: string) => Document;\n}\n\nexport const BrowserAdapter = {\n /**\n * Creates a canvas element of the given size.\n * This canvas is created using the browser's native canvas element.\n * @param width - width of the canvas\n * @param height - height of the canvas\n */\n createCanvas: (width: number, height: number): HTMLCanvasElement =>\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n },\n getCanvasRenderingContext2D: () => CanvasRenderingContext2D,\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => (document.baseURI ?? window.location.href),\n getFontFaceSet: () => document.fonts,\n fetch: (url: RequestInfo, options?: RequestInit) => fetch(url, options),\n parseXML: (xml: string) =>\n {\n const parser = new DOMParser();\n\n return parser.parseFromString(xml, 'text/xml');\n },\n} as IAdapter;\n", "import { BrowserAdapter } from './adapter';\n\nimport type { IAdapter } from './adapter';\n\ninterface ISettings\n{\n ADAPTER: IAdapter;\n RESOLUTION: number;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * import { settings, ENV } from 'pixi.js';\n *\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Used for older v1 WebGL devices for backwards compatibility\n * settings.PREFER_ENV = ENV.WEBGL_LEGACY;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings & Partial = {\n /**\n * This adapter is used to call methods that are platform dependent.\n * For example `document.createElement` only runs on the web but fails in node environments.\n * This allows us to support more platforms by abstracting away specific implementations per platform.\n *\n * By default the adapter is set to work in the browser. However you can create your own\n * by implementing the `IAdapter` interface. See `IAdapter` for more information.\n * @name ADAPTER\n * @memberof PIXI.settings\n * @type {PIXI.IAdapter}\n * @default PIXI.BrowserAdapter\n */\n ADAPTER: BrowserAdapter,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * @static\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n", "const appleIphone = /iPhone/i;\nconst appleIpod = /iPod/i;\nconst appleTablet = /iPad/i;\nconst appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nconst androidPhone = /\\bAndroid(?:.+)Mobile\\b/i; // Match 'Android' AND 'Mobile'\nconst androidTablet = /Android/i;\nconst amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i; // Match 'Silk' AND 'Mobile'\nconst amazonTablet = /Silk/i;\nconst windowsPhone = /Windows Phone/i;\nconst windowsTablet = /\\bWindows(?:.+)ARM\\b/i; // Match 'Windows' AND 'ARM'\nconst otherBlackBerry = /BlackBerry/i;\nconst otherBlackBerry10 = /BB10/i;\nconst otherOpera = /Opera Mini/i;\nconst otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nconst otherFirefox = /Mobile(?:.+)Firefox\\b/i; // Match 'Mobile' AND 'Firefox'\n\nexport type UserAgent = string;\nexport type Navigator = {\n userAgent: string;\n platform: string;\n maxTouchPoints?: number;\n};\n\nconst isAppleTabletOnIos13 = (navigator?: Navigator): boolean => {\n return (\n typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined'\n );\n};\n\nfunction createMatch(userAgent: UserAgent): (regex: RegExp) => boolean {\n return (regex: RegExp): boolean => regex.test(userAgent);\n}\n\nexport type isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport type IsMobileParameter = UserAgent | Navigator;\n\nexport default function isMobile(param?: IsMobileParameter): isMobileResult {\n let nav: Navigator = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0,\n };\n\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0,\n };\n } else if (typeof param === 'string') {\n nav.userAgent = param;\n } else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0,\n };\n }\n\n let userAgent = nav.userAgent;\n\n // Facebook mobile app's integrated browser adds a bunch of strings that\n // match everything. Strip it out if it exists.\n let tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n // Twitter mobile app's integrated browser on iPad adds a \"Twitter for\n // iPhone\" string. Same probably happens on other tablet platforms.\n // This will confuse detection so strip it out if it exists.\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n const match = createMatch(userAgent);\n\n const result: isMobileResult = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet:\n !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device:\n (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet),\n },\n android: {\n phone:\n (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet:\n !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device:\n (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i),\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet),\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device:\n match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome),\n },\n any: false,\n phone: false,\n tablet: false,\n };\n\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n // excludes 'other' devices and ipods, targeting touchscreen phones\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n\n return result;\n}\n", "import isMobileJs from 'ismobilejs';\n\n// ismobilejs have different import behavior for CJS and ESM, so here is the hack\ntype isMobileJsType = typeof isMobileJs & { default?: typeof isMobileJs };\nconst isMobileCall = (isMobileJs as isMobileJsType).default ?? isMobileJs;\n\nexport type isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport const isMobile: isMobileResult = isMobileCall(globalThis.navigator);\n", "import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nexport { settings };\n", "import './settings.mjs';\nexport { isMobile } from '@pixi/settings';\nexport { default as EventEmitter } from 'eventemitter3';\nexport { default as earcut } from 'earcut';\nexport { url } from './url.mjs';\nexport { path } from './path.mjs';\nexport { sayHello, skipHello } from './browser/hello.mjs';\nexport { isWebGLSupported } from './browser/isWebGLSupported.mjs';\nexport { hex2rgb, hex2string, rgb2hex, string2hex } from './color/hex.mjs';\nexport { correctBlendMode, premultiplyBlendMode, premultiplyRgba, premultiplyTint, premultiplyTintToRgba } from './color/premultiply.mjs';\nexport { DATA_URI } from './const.mjs';\nexport { createIndicesForQuads } from './data/createIndicesForQuads.mjs';\nexport { getBufferType } from './data/getBufferType.mjs';\nexport { interleaveTypedArrays } from './data/interleaveTypedArrays.mjs';\nexport { isPow2, log2, nextPow2 } from './data/pow2.mjs';\nexport { removeItems } from './data/removeItems.mjs';\nexport { sign } from './data/sign.mjs';\nexport { uid } from './data/uid.mjs';\nexport { deprecation } from './logging/deprecation.mjs';\nexport { BoundingBox } from './media/BoundingBox.mjs';\nexport { BaseTextureCache, ProgramCache, TextureCache, clearTextureCache, destroyTextureCache } from './media/caches.mjs';\nexport { CanvasRenderTarget } from './media/CanvasRenderTarget.mjs';\nexport { getCanvasBoundingBox } from './media/getCanvasBoundingBox.mjs';\nexport { trimCanvas } from './media/trimCanvas.mjs';\nexport { decomposeDataUri } from './network/decomposeDataUri.mjs';\nexport { determineCrossOrigin } from './network/determineCrossOrigin.mjs';\nexport { getResolutionOfUrl } from './network/getResolutionOfUrl.mjs';\nimport './types/index.mjs';\n//# sourceMappingURL=index.mjs.map\n", "/*\n * This file contains redeclared types for Node `url` and `querystring` modules. These modules\n * don't provide their own typings but instead are a part of the full Node typings. The purpose of\n * this file is to redeclare the required types to avoid having the whole Node types as a\n * dependency.\n */\n\nimport { format as _format, parse as _parse, resolve as _resolve } from 'url';\n\ninterface ParsedUrlQuery\n{\n [key: string]: string | string[];\n}\n\ninterface ParsedUrlQueryInput\n{\n [key: string]: unknown;\n}\n\ninterface UrlObjectCommon\n{\n auth?: string;\n hash?: string;\n host?: string;\n hostname?: string;\n href?: string;\n path?: string;\n pathname?: string;\n protocol?: string;\n search?: string;\n slashes?: boolean;\n}\n\n// Input to `url.format`\ninterface UrlObject extends UrlObjectCommon\n{\n port?: string | number;\n query?: string | null | ParsedUrlQueryInput;\n}\n\n// Output of `url.parse`\ninterface Url extends UrlObjectCommon\n{\n port?: string;\n query?: string | null | ParsedUrlQuery;\n}\n\ninterface UrlWithParsedQuery extends Url\n{\n query: ParsedUrlQuery;\n}\n\ninterface UrlWithStringQuery extends Url\n{\n query: string | null;\n}\n\ninterface URLFormatOptions\n{\n auth?: boolean;\n fragment?: boolean;\n search?: boolean;\n unicode?: boolean;\n}\n\ntype ParseFunction = {\n (urlStr: string): UrlWithStringQuery;\n (urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;\n (urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;\n (urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;\n};\n\ntype FormatFunction = {\n (URL: URL, options?: URLFormatOptions): string;\n (urlObject: UrlObject | string): string;\n};\n\ntype ResolveFunction = {\n (from: string, to: string): string;\n};\n\nexport const url = {\n parse: _parse as ParseFunction,\n format: _format as FormatFunction,\n resolve: _resolve as ResolveFunction,\n};\n", "import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\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('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n", "import { settings } from '../settings';\n\nlet supported: boolean | undefined;\n\n/**\n * Helper for checking for WebGL support.\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @returns {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!settings.ADAPTER.getWebGLRenderingContext())\n {\n return false;\n }\n\n const canvas = settings.ADAPTER.createCanvas();\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext | null;\n\n const success = !!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 return supported;\n}\n", "var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return\"string\"==typeof r?r.length>0:\"number\"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?\"0\"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,p=/^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s+([+-]?\\d*\\.?\\d+)%\\s+([+-]?\\d*\\.?\\d+)%\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,v=/^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,m=/^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},\"hex\"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},\"rgb\"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u=\"deg\"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},\"hsl\"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},\"rgb\"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},\"hsl\"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},\"hsv\"]]},N=function(r,t){for(var n=0;n=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):\"\",\"#\"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?\"rgba(\"+t+\", \"+n+\", \"+e+\", \"+u+\")\":\"rgb(\"+t+\", \"+n+\", \"+e+\")\";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?\"hsla(\"+t+\", \"+n+\"%, \"+e+\"%, \"+u+\")\":\"hsl(\"+t+\", \"+n+\"%, \"+e+\"%)\";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return\"number\"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return\"number\"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};export{j as Colord,w as colord,k as extend,I as getFormat,E as random};\n", "export default function(e,f){var a={white:\"#ffffff\",bisque:\"#ffe4c4\",blue:\"#0000ff\",cadetblue:\"#5f9ea0\",chartreuse:\"#7fff00\",chocolate:\"#d2691e\",coral:\"#ff7f50\",antiquewhite:\"#faebd7\",aqua:\"#00ffff\",azure:\"#f0ffff\",whitesmoke:\"#f5f5f5\",papayawhip:\"#ffefd5\",plum:\"#dda0dd\",blanchedalmond:\"#ffebcd\",black:\"#000000\",gold:\"#ffd700\",goldenrod:\"#daa520\",gainsboro:\"#dcdcdc\",cornsilk:\"#fff8dc\",cornflowerblue:\"#6495ed\",burlywood:\"#deb887\",aquamarine:\"#7fffd4\",beige:\"#f5f5dc\",crimson:\"#dc143c\",cyan:\"#00ffff\",darkblue:\"#00008b\",darkcyan:\"#008b8b\",darkgoldenrod:\"#b8860b\",darkkhaki:\"#bdb76b\",darkgray:\"#a9a9a9\",darkgreen:\"#006400\",darkgrey:\"#a9a9a9\",peachpuff:\"#ffdab9\",darkmagenta:\"#8b008b\",darkred:\"#8b0000\",darkorchid:\"#9932cc\",darkorange:\"#ff8c00\",darkslateblue:\"#483d8b\",gray:\"#808080\",darkslategray:\"#2f4f4f\",darkslategrey:\"#2f4f4f\",deeppink:\"#ff1493\",deepskyblue:\"#00bfff\",wheat:\"#f5deb3\",firebrick:\"#b22222\",floralwhite:\"#fffaf0\",ghostwhite:\"#f8f8ff\",darkviolet:\"#9400d3\",magenta:\"#ff00ff\",green:\"#008000\",dodgerblue:\"#1e90ff\",grey:\"#808080\",honeydew:\"#f0fff0\",hotpink:\"#ff69b4\",blueviolet:\"#8a2be2\",forestgreen:\"#228b22\",lawngreen:\"#7cfc00\",indianred:\"#cd5c5c\",indigo:\"#4b0082\",fuchsia:\"#ff00ff\",brown:\"#a52a2a\",maroon:\"#800000\",mediumblue:\"#0000cd\",lightcoral:\"#f08080\",darkturquoise:\"#00ced1\",lightcyan:\"#e0ffff\",ivory:\"#fffff0\",lightyellow:\"#ffffe0\",lightsalmon:\"#ffa07a\",lightseagreen:\"#20b2aa\",linen:\"#faf0e6\",mediumaquamarine:\"#66cdaa\",lemonchiffon:\"#fffacd\",lime:\"#00ff00\",khaki:\"#f0e68c\",mediumseagreen:\"#3cb371\",limegreen:\"#32cd32\",mediumspringgreen:\"#00fa9a\",lightskyblue:\"#87cefa\",lightblue:\"#add8e6\",midnightblue:\"#191970\",lightpink:\"#ffb6c1\",mistyrose:\"#ffe4e1\",moccasin:\"#ffe4b5\",mintcream:\"#f5fffa\",lightslategray:\"#778899\",lightslategrey:\"#778899\",navajowhite:\"#ffdead\",navy:\"#000080\",mediumvioletred:\"#c71585\",powderblue:\"#b0e0e6\",palegoldenrod:\"#eee8aa\",oldlace:\"#fdf5e6\",paleturquoise:\"#afeeee\",mediumturquoise:\"#48d1cc\",mediumorchid:\"#ba55d3\",rebeccapurple:\"#663399\",lightsteelblue:\"#b0c4de\",mediumslateblue:\"#7b68ee\",thistle:\"#d8bfd8\",tan:\"#d2b48c\",orchid:\"#da70d6\",mediumpurple:\"#9370db\",purple:\"#800080\",pink:\"#ffc0cb\",skyblue:\"#87ceeb\",springgreen:\"#00ff7f\",palegreen:\"#98fb98\",red:\"#ff0000\",yellow:\"#ffff00\",slateblue:\"#6a5acd\",lavenderblush:\"#fff0f5\",peru:\"#cd853f\",palevioletred:\"#db7093\",violet:\"#ee82ee\",teal:\"#008080\",slategray:\"#708090\",slategrey:\"#708090\",aliceblue:\"#f0f8ff\",darkseagreen:\"#8fbc8f\",darkolivegreen:\"#556b2f\",greenyellow:\"#adff2f\",seagreen:\"#2e8b57\",seashell:\"#fff5ee\",tomato:\"#ff6347\",silver:\"#c0c0c0\",sienna:\"#a0522d\",lavender:\"#e6e6fa\",lightgreen:\"#90ee90\",orange:\"#ffa500\",orangered:\"#ff4500\",steelblue:\"#4682b4\",royalblue:\"#4169e1\",turquoise:\"#40e0d0\",yellowgreen:\"#9acd32\",salmon:\"#fa8072\",saddlebrown:\"#8b4513\",sandybrown:\"#f4a460\",rosybrown:\"#bc8f8f\",darksalmon:\"#e9967a\",lightgoldenrodyellow:\"#fafad2\",snow:\"#fffafa\",lightgrey:\"#d3d3d3\",lightgray:\"#d3d3d3\",dimgray:\"#696969\",dimgrey:\"#696969\",olivedrab:\"#6b8e23\",olive:\"#808000\"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return\"transparent\";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b=\"black\";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u | null;\n\n /** Normalized rgba component, floats from 0-1 */\n private _components: Float32Array;\n\n /** Cache color as number */\n private _int: number;\n\n /**\n * @param {PIXI.ColorSource} value - Optional value to use, if not provided, white is used.\n */\n constructor(value: ColorSource = 0xffffff)\n {\n this._value = null;\n this._components = new Float32Array(4);\n this._components.fill(1);\n this._int = 0xffffff;\n this.value = value;\n }\n\n /** Get red component (0 - 1) */\n get red(): number\n {\n return this._components[0];\n }\n\n /** Get green component (0 - 1) */\n get green(): number\n {\n return this._components[1];\n }\n\n /** Get blue component (0 - 1) */\n get blue(): number\n {\n return this._components[2];\n }\n\n /** Get alpha component (0 - 1) */\n get alpha(): number\n {\n return this._components[3];\n }\n\n /**\n * Set the value, suitable for chaining\n * @param value\n * @see PIXI.Color.value\n */\n setValue(value: ColorSource): this\n {\n this.value = value;\n\n return this;\n }\n\n /**\n * The current color source.\n *\n * When setting:\n * - Setting to an instance of `Color` will copy its color source and components.\n * - Otherwise, `Color` will try to normalize the color source and set the components.\n * If the color source is invalid, an `Error` will be thrown and the `Color` will left unchanged.\n *\n * Note: The `null` in the setter's parameter type is added to match the TypeScript rule: return type of getter\n * must be assignable to its setter's parameter type. Setting `value` to `null` will throw an `Error`.\n *\n * When getting:\n * - A return value of `null` means the previous value was overridden (e.g., {@link PIXI.Color.multiply multiply},\n * {@link PIXI.Color.premultiply premultiply} or {@link PIXI.Color.round round}).\n * - Otherwise, the color source used when setting is returned.\n * @type {PIXI.ColorSource}\n */\n set value(value: ColorSource | null)\n {\n // Support copying from other Color objects\n if (value instanceof Color)\n {\n this._value = this.cloneSource(value._value);\n this._int = value._int;\n this._components.set(value._components);\n }\n else if (value === null)\n {\n throw new Error('Cannot set PIXI.Color#value to null');\n }\n else if (this._value === null || !this.isSourceEqual(this._value, value))\n {\n this.normalize(value);\n this._value = this.cloneSource(value);\n }\n }\n get value(): Exclude | null\n {\n return this._value;\n }\n\n /**\n * Copy a color source internally.\n * @param value - Color source\n */\n private cloneSource(value: Exclude | null): Exclude | null\n {\n if (typeof value === 'string' || typeof value === 'number' || value instanceof Number || value === null)\n {\n return value;\n }\n else if (Array.isArray(value) || ArrayBuffer.isView(value))\n {\n return value.slice(0);\n }\n else if (typeof value === 'object' && value !== null)\n {\n return { ...value };\n }\n\n return value;\n }\n\n /**\n * Equality check for color sources.\n * @param value1 - First color source\n * @param value2 - Second color source\n * @returns `true` if the color sources are equal, `false` otherwise.\n */\n private isSourceEqual(value1: Exclude, value2: Exclude): boolean\n {\n const type1 = typeof value1;\n const type2 = typeof value2;\n\n // Mismatched types\n if (type1 !== type2)\n {\n return false;\n }\n // Handle numbers/strings and things that extend Number\n // important to do the instanceof Number first, as this is \"object\" type\n else if (type1 === 'number' || type1 === 'string' || value1 instanceof Number)\n {\n return value1 === value2;\n }\n // Handle Arrays and TypedArrays\n else if ((Array.isArray(value1) && Array.isArray(value2))\n || (ArrayBuffer.isView(value1) && ArrayBuffer.isView(value2)))\n {\n if (value1.length !== value2.length)\n {\n return false;\n }\n\n return value1.every((v, i) => v === value2[i]);\n }\n // Handle Objects\n else if (value1 !== null && value2 !== null)\n {\n const keys1 = Object.keys(value1) as (keyof typeof value1)[];\n const keys2 = Object.keys(value2) as (keyof typeof value2)[];\n\n if (keys1.length !== keys2.length)\n {\n return false;\n }\n\n return keys1.every((key) => value1[key] === value2[key]);\n }\n\n return value1 === value2;\n }\n\n /**\n * Convert to a RGBA color object.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toRgb(); // returns { r: 1, g: 1, b: 1, a: 1 }\n */\n toRgba(): RgbaColor\n {\n const [r, g, b, a] = this._components;\n\n return { r, g, b, a };\n }\n\n /**\n * Convert to a RGB color object.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toRgb(); // returns { r: 1, g: 1, b: 1 }\n */\n toRgb(): RgbColor\n {\n const [r, g, b] = this._components;\n\n return { r, g, b };\n }\n\n /** Convert to a CSS-style rgba string: `rgba(255,255,255,1.0)`. */\n toRgbaString(): string\n {\n const [r, g, b] = this.toUint8RgbArray();\n\n return `rgba(${r},${g},${b},${this.alpha})`;\n }\n\n /**\n * Convert to an [R, G, B] array of clamped uint8 values (0 to 255).\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toUint8RgbArray(); // returns [255, 255, 255]\n * @param {number[]|Uint8Array|Uint8ClampedArray} [out] - Output array\n */\n toUint8RgbArray(): number[];\n toUint8RgbArray(out: T): T;\n toUint8RgbArray(out?: T): T\n {\n const [r, g, b] = this._components;\n\n out = out ?? [] as number[] as T;\n\n out[0] = Math.round(r * 255);\n out[1] = Math.round(g * 255);\n out[2] = Math.round(b * 255);\n\n return out;\n }\n\n /**\n * Convert to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toRgbArray(); // returns [1, 1, 1]\n * @param {number[]|Float32Array} [out] - Output array\n */\n toRgbArray(): number[];\n toRgbArray(out: T): T;\n toRgbArray(out?: T): T\n {\n out = out ?? [] as number[] as T;\n const [r, g, b] = this._components;\n\n out[0] = r;\n out[1] = g;\n out[2] = b;\n\n return out;\n }\n\n /**\n * Convert to a hexadecimal number.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toNumber(); // returns 16777215\n */\n toNumber(): number\n {\n return this._int;\n }\n\n /**\n * Convert to a hexadecimal number in little endian format (e.g., BBGGRR).\n * @example\n * import { Color } from 'pixi.js';\n * new Color(0xffcc99).toLittleEndianNumber(); // returns 0x99ccff\n * @returns {number} - The color as a number in little endian format.\n */\n toLittleEndianNumber(): number\n {\n const value = this._int;\n\n return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /**\n * Multiply with another color. This action is destructive, and will\n * override the previous `value` property to be `null`.\n * @param {PIXI.ColorSource} value - The color to multiply by.\n */\n multiply(value: ColorSource): this\n {\n const [r, g, b, a] = Color.temp.setValue(value)._components;\n\n this._components[0] *= r;\n this._components[1] *= g;\n this._components[2] *= b;\n this._components[3] *= a;\n\n this.refreshInt();\n this._value = null;\n\n return this;\n }\n\n /**\n * Converts color to a premultiplied alpha format. This action is destructive, and will\n * override the previous `value` property to be `null`.\n * @param alpha - The alpha to multiply by.\n * @param {boolean} [applyToRGB=true] - Whether to premultiply RGB channels.\n * @returns {PIXI.Color} - Itself.\n */\n premultiply(alpha: number, applyToRGB = true): this\n {\n if (applyToRGB)\n {\n this._components[0] *= alpha;\n this._components[1] *= alpha;\n this._components[2] *= alpha;\n }\n this._components[3] = alpha;\n\n this.refreshInt();\n this._value = null;\n\n return this;\n }\n\n /**\n * Premultiplies alpha with current color.\n * @param {number} alpha - The alpha to multiply by.\n * @param {boolean} [applyToRGB=true] - Whether to premultiply RGB channels.\n * @returns {number} tint multiplied by alpha\n */\n toPremultiplied(alpha: number, applyToRGB = true): number\n {\n if (alpha === 1.0)\n {\n return (0xFF << 24) + this._int;\n }\n if (alpha === 0.0)\n {\n return applyToRGB ? 0 : this._int;\n }\n let r = ((this._int >> 16) & 0xFF);\n let g = ((this._int >> 8) & 0xFF);\n let b = (this._int & 0xFF);\n\n if (applyToRGB)\n {\n r = ((r * alpha) + 0.5) | 0;\n g = ((g * alpha) + 0.5) | 0;\n b = ((b * alpha) + 0.5) | 0;\n }\n\n return (alpha * 255 << 24) + (r << 16) + (g << 8) + b;\n }\n\n /**\n * Convert to a hexidecimal string.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toHex(); // returns \"#ffffff\"\n */\n toHex(): string\n {\n const hexString = this._int.toString(16);\n\n return `#${'000000'.substring(0, 6 - hexString.length) + hexString}`;\n }\n\n /**\n * Convert to a hexidecimal string with alpha.\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toHexa(); // returns \"#ffffffff\"\n */\n toHexa(): string\n {\n const alphaValue = Math.round(this._components[3] * 255);\n const alphaString = alphaValue.toString(16);\n\n return this.toHex() + '00'.substring(0, 2 - alphaString.length) + alphaString;\n }\n\n /**\n * Set alpha, suitable for chaining.\n * @param alpha\n */\n setAlpha(alpha: number): this\n {\n this._components[3] = this._clamp(alpha);\n\n return this;\n }\n\n /**\n * Rounds the specified color according to the step. This action is destructive, and will\n * override the previous `value` property to be `null`. The alpha component is not rounded.\n * @param steps - Number of steps which will be used as a cap when rounding colors\n */\n round(steps: number): this\n {\n const [r, g, b] = this._components;\n\n this._components[0] = Math.round(r * steps) / steps;\n this._components[1] = Math.round(g * steps) / steps;\n this._components[2] = Math.round(b * steps) / steps;\n this.refreshInt();\n this._value = null;\n\n return this;\n }\n\n /**\n * Convert to an [R, G, B, A] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * import { Color } from 'pixi.js';\n * new Color('white').toArray(); // returns [1, 1, 1, 1]\n * @param {number[]|Float32Array} [out] - Output array\n */\n toArray(): number[];\n toArray(out: T): T;\n toArray(out?: T): T\n {\n out = out ?? [] as number[] as T;\n const [r, g, b, a] = this._components;\n\n out[0] = r;\n out[1] = g;\n out[2] = b;\n out[3] = a;\n\n return out;\n }\n\n /**\n * Normalize the input value into rgba\n * @param value - Input value\n */\n private normalize(value: Exclude): void\n {\n let r: number | undefined;\n let g: number | undefined;\n let b: number | undefined;\n let a: number | undefined;\n\n // Number is a primative so typeof works fine, but in the case\n // that someone creates a class that extends Number, we also\n // need to check for instanceof Number\n if ((typeof value === 'number' || value instanceof Number) && value >= 0 && value <= 0xffffff)\n {\n const int = value as number; // cast required because instanceof Number is ambiguous for TS\n\n r = ((int >> 16) & 0xFF) / 255;\n g = ((int >> 8) & 0xFF) / 255;\n b = (int & 0xFF) / 255;\n a = 1.0;\n }\n else if ((Array.isArray(value) || value instanceof Float32Array)\n // Can be rgb or rgba\n && value.length >= 3 && value.length <= 4)\n {\n // make sure all values are 0 - 1\n value = this._clamp(value);\n [r, g, b, a = 1.0] = value;\n }\n else if ((value instanceof Uint8Array || value instanceof Uint8ClampedArray)\n // Can be rgb or rgba\n && value.length >= 3 && value.length <= 4)\n {\n // make sure all values are 0 - 255\n value = this._clamp(value, 0, 255);\n [r, g, b, a = 255] = value;\n r /= 255;\n g /= 255;\n b /= 255;\n a /= 255;\n }\n else if (typeof value === 'string' || typeof value === 'object')\n {\n if (typeof value === 'string')\n {\n const match = Color.HEX_PATTERN.exec(value);\n\n if (match)\n {\n // Normalize hex string, remove 0x or # prefix\n value = `#${match[2]}`;\n }\n }\n\n const color = colord(value as AnyColor);\n\n if (color.isValid())\n {\n ({ r, g, b, a } = color.rgba);\n r /= 255;\n g /= 255;\n b /= 255;\n }\n }\n\n // Cache normalized values for rgba and hex integer\n if (r !== undefined)\n {\n this._components[0] = r as number;\n this._components[1] = g as number;\n this._components[2] = b as number;\n this._components[3] = a as number;\n this.refreshInt();\n }\n else\n {\n throw new Error(`Unable to convert color ${value}`);\n }\n }\n\n /** Refresh the internal color rgb number */\n private refreshInt(): void\n {\n // Clamp values to 0 - 1\n this._clamp(this._components);\n\n const [r, g, b] = this._components;\n\n this._int = (((r * 255) << 16) + ((g * 255) << 8) + (b * 255 | 0));\n }\n\n /**\n * Clamps values to a range. Will override original values\n * @param value - Value(s) to clamp\n * @param min - Minimum value\n * @param max - Maximum value\n */\n private _clamp(value: T, min = 0, max = 1): T\n {\n if (typeof value === 'number')\n {\n return Math.min(Math.max(value, min), max) as T;\n }\n\n value.forEach((v, i) =>\n {\n value[i] = Math.min(Math.max(v, min), max);\n });\n\n return value;\n }\n}\n", "import { Color } from '@pixi/color';\nimport { BLEND_MODES } from '@pixi/constants';\nimport { deprecation } from '../logging/deprecation';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @returns {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\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: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\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: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @deprecated since 7.2.0\n * @see PIXI.Color.premultiply\n * @param {Float32Array|number[]} rgb -\n * @param {number} alpha -\n * @param {Float32Array} [out] -\n * @param {boolean} [premultiply=true] -\n */\nexport function premultiplyRgba(\n rgb: Float32Array | number[],\n alpha: number,\n out?: Float32Array,\n premultiply = true\n): Float32Array\n{\n // #if _DEBUG\n deprecation('7.2.0', `utils.premultiplyRgba has moved to Color.premultiply`);\n // #endif\n\n return Color.shared\n .setValue(rgb)\n .premultiply(alpha, premultiply)\n .toArray(out ?? new Float32Array(4));\n}\n\n/**\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @deprecated since 7.2.0\n * @see PIXI.Color.toPremultiplied\n * @param {number} tint -\n * @param {number} alpha -\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n // #if _DEBUG\n deprecation('7.2.0', `utils.premultiplyTint has moved to Color.toPremultiplied`);\n // #endif\n\n return Color.shared\n .setValue(tint)\n .toPremultiplied(alpha);\n}\n\n/**\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @deprecated since 7.2.0\n * @see PIXI.Color.premultiply\n * @param {number} tint -\n * @param {number} alpha -\n * @param {Float32Array} [out] -\n * @param {boolean} [premultiply=true] -\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out?: Float32Array, premultiply = true): Float32Array\n{\n // #if _DEBUG\n deprecation('7.2.0', `utils.premultiplyTintToRgba has moved to Color.premultiply`);\n // #endif\n\n return Color.shared\n .setValue(tint)\n .premultiply(alpha, premultiply)\n .toArray(out ?? new Float32Array(4));\n}\n", "import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(\n array: ITypedArray\n): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n", "// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n", "/**\n * Remove items from a javascript array without generating garbage\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n", "let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n * @memberof PIXI.utils\n * @function uid\n * @returns {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n", "/**\n * A rectangular bounding box describing the boundary of an area.\n * @memberof PIXI.utils\n * @since 7.1.0\n */\nexport class BoundingBox\n{\n /** The left coordinate value of the bounding box. */\n left: number;\n /** The top coordinate value of the bounding box. */\n top: number;\n /** The right coordinate value of the bounding box. */\n right: number;\n /** The bottom coordinate value of the bounding box. */\n bottom: number;\n\n /**\n * @param left - The left coordinate value of the bounding box.\n * @param top - The top coordinate value of the bounding box.\n * @param right - The right coordinate value of the bounding box.\n * @param bottom - The bottom coordinate value of the bounding box.\n */\n constructor(left: number, top: number, right: number, bottom: number)\n {\n this.left = left;\n this.top = top;\n this.right = right;\n this.bottom = bottom;\n }\n\n /** The width of the bounding box. */\n get width(): number { return this.right - this.left; }\n /** The height of the bounding box. */\n get height(): number { return this.bottom - this.top; }\n\n /** Determines whether the BoundingBox is empty. */\n isEmpty(): boolean\n {\n return this.left === this.right || this.top === this.bottom;\n }\n\n /**\n * An empty BoundingBox.\n * @type {PIXI.utils.BoundingBox}\n */\n public static readonly EMPTY = new BoundingBox(0, 0, 0, 0);\n}\n", "import type { BaseTexture, Program, Texture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Record}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Record}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Record}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\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 * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\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", "import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement | undefined;\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 * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @returns {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = globalThis.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.startsWith('data:'))\n {\n return '';\n }\n\n // default is window.location\n loc = loc || globalThis.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 const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n", "import { settings } from '../settings';\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 * @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 * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue = 1): number\n{\n const resolution = settings.RETINA_PREFIX?.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue;\n}\n", "/**\n * Collection of valid extension types.\n * @memberof PIXI\n * @property {string} Application - Application plugins\n * @property {string} RendererPlugin - Plugins for Renderer\n * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer\n * @property {string} Loader - Plugins to use with Loader\n * @property {string} LoadParser - Parsers for Assets loader.\n * @property {string} ResolveParser - Parsers for Assets resolvers.\n * @property {string} CacheParser - Parsers for Assets cache.\n */\nenum ExtensionType\n// eslint-disable-next-line @typescript-eslint/indent\n{\n Renderer = 'renderer',\n Application = 'application',\n RendererSystem = 'renderer-webgl-system',\n RendererPlugin = 'renderer-webgl-plugin',\n CanvasRendererSystem = 'renderer-canvas-system',\n CanvasRendererPlugin = 'renderer-canvas-plugin',\n Asset = 'asset',\n LoadParser = 'load-parser',\n ResolveParser = 'resolve-parser',\n CacheParser = 'cache-parser',\n DetectionParser = 'detection-parser',\n}\n\ninterface ExtensionMetadataDetails\n{\n type: ExtensionType | ExtensionType[];\n name?: string;\n priority?: number;\n}\n\ntype ExtensionMetadata = ExtensionType | ExtensionMetadataDetails;\n\n/**\n * Format when registering an extension. Generally, the extension\n * should have these values as `extension` static property,\n * but you can override name or type by providing an object.\n * @memberof PIXI\n */\ninterface ExtensionFormatLoose\n{\n /** The extension type, can be multiple types */\n type: ExtensionType | ExtensionType[];\n /** Optional. Some plugins provide an API name/property, such as Renderer plugins */\n name?: string;\n /** Optional, used for sorting the plugins in a particular order */\n priority?: number;\n /** Reference to the plugin object/class */\n ref: any;\n}\n\n/**\n * Strict extension format that is used internally for registrations.\n * @memberof PIXI\n */\ninterface ExtensionFormat extends ExtensionFormatLoose\n{\n /** The extension type, always expressed as multiple, even if a single */\n type: ExtensionType[];\n}\n\ntype ExtensionHandler = (extension: ExtensionFormat) => void;\n\n/**\n * Convert input into extension format data.\n * @ignore\n */\nconst normalizeExtension = (ext: ExtensionFormatLoose | any): ExtensionFormat =>\n{\n // Class/Object submission, use extension object\n if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension))\n {\n // #if _DEBUG\n if (!ext.extension)\n {\n throw new Error('Extension class must have an extension object');\n }\n // #endif\n const metadata: ExtensionMetadataDetails = (typeof ext.extension !== 'object')\n ? { type: ext.extension }\n : ext.extension;\n\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === 'object')\n {\n ext = { ...ext };\n }\n else\n {\n throw new Error('Invalid extension type');\n }\n\n if (typeof ext.type === 'string')\n {\n ext.type = [ext.type];\n }\n\n return ext;\n};\n\n/**\n * Get the priority for an extension.\n * @ignore\n * @param ext - Any extension\n * @param defaultPriority - Fallback priority if none is defined.\n * @returns The priority for the extension.\n */\nconst normalizePriority = (ext: ExtensionFormatLoose | any, defaultPriority: number): number =>\n normalizeExtension(ext).priority ?? defaultPriority;\n\n/**\n * Global registration of all PixiJS extensions. One-stop-shop for extensibility.\n * @memberof PIXI\n * @namespace extensions\n */\nconst extensions = {\n\n /** @ignore */\n _addHandlers: {} as Record,\n\n /** @ignore */\n _removeHandlers: {} as Record,\n\n /** @ignore */\n _queue: {} as Record,\n\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {PIXI.extensions} For chaining.\n */\n remove(...extensions: Array)\n {\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n\n return this;\n },\n\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {PIXI.extensions} For chaining.\n */\n add(...extensions: Array)\n {\n // Handle any extensions either passed as class w/ data or as data\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) =>\n {\n const handlers = this._addHandlers;\n const queue = this._queue;\n\n if (!handlers[type])\n {\n queue[type] = queue[type] || [];\n queue[type].push(ext);\n }\n else\n {\n handlers[type](ext);\n }\n });\n });\n\n return this;\n },\n\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}.\n * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}.\n * @returns {PIXI.extensions} For chaining.\n */\n handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler)\n {\n const addHandlers = this._addHandlers;\n const removeHandlers = this._removeHandlers;\n\n // #if _DEBUG\n if (addHandlers[type] || removeHandlers[type])\n {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n // #endif\n\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n\n // Process the queue\n const queue = this._queue;\n\n // Process any plugins that have been registered before the handler\n if (queue[type])\n {\n queue[type].forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n\n return this;\n },\n\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByMap(type: ExtensionType, map: Record)\n {\n return this.handle(type,\n (extension) =>\n {\n map[extension.name] = extension.ref;\n },\n (extension) =>\n {\n delete map[extension.name];\n }\n );\n },\n\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @param defaultPriority - The default priority to use if none is specified.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByList(type: ExtensionType, list: any[], defaultPriority = -1)\n {\n return this.handle(\n type,\n (extension) =>\n {\n if (list.includes(extension.ref))\n {\n return;\n }\n\n list.push(extension.ref);\n list.sort((a, b) => normalizePriority(b, defaultPriority) - normalizePriority(a, defaultPriority));\n },\n (extension) =>\n {\n const index = list.indexOf(extension.ref);\n\n if (index !== -1)\n {\n list.splice(index, 1);\n }\n }\n );\n },\n};\n\nexport {\n extensions,\n ExtensionType,\n};\nexport type {\n ExtensionFormat,\n ExtensionFormatLoose,\n ExtensionHandler,\n ExtensionMetadata,\n};\n", "import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n\n /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */\n public rawBinaryData: ArrayBuffer;\n\n /** View on the raw binary data as a `Uint32Array`. */\n public uint32View: Uint32Array;\n\n /** View on the raw binary data as a `Float32Array`. */\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array)\n {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\n\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /** View on the raw binary data as a `Int8Array`. */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /** View on the raw binary data as a `Int16Array`. */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /** View on the raw binary data as a `Uint16Array`. */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /** View on the raw binary data as a `Int32Array`. */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /** Destroys all buffer references. Do not use after calling this. */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n", "import type { IRenderingContext } from '../../IRenderer';\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\nfunction generateIfTestSrc(maxIfs: number): string\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\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\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 return maxIfs;\n}\n", "import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:State `\n + `blendMode=${this.blendMode} `\n + `clockwiseFrontFace=${this.clockwiseFrontFace} `\n + `culling=${this.culling} `\n + `depthMask=${this.depthMask} `\n + `polygonOffset=${this.polygonOffset}`\n + `]`;\n }\n // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n", "import type { ISize } from '@pixi/math';\nimport type { ICubeResourceOptions } from './CubeResource';\nimport type { IImageResourceOptions } from './ImageResource';\nimport type { Resource } from './Resource';\nimport type { ISVGResourceOptions } from './SVGResource';\nimport type { IVideoResourceOptions } from './VideoResource';\n\n/*\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/*\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n| ICubeResourceOptions\n| IImageResourceOptions\n| ISVGResourceOptions\n| IVideoResourceOptions\n| IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n * @memberof PIXI\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // Upload with GL\n * return true;\n * }\n * // Used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz' || source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array> = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @returns {PIXI.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n", "/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n * Like a signal:\n *\n * ```js\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded'),\n * };\n *\n * const listener = {\n * loaded: function() {\n * // Do something when loaded\n * }\n * };\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items:\n *\n * ```js\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update'),\n * };\n *\n * const gameObject = {\n * update: function(time) {\n * // Update my gamey state\n * },\n * };\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * E.g. A listener passed to this Runner will require a 'complete' function.\n *\n * ```js\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.includes(item);\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n", "import { Runner } from '@pixi/runner';\n\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n * @memberof PIXI\n */\nexport abstract class Resource\n{\n /** The url of the resource */\n public src: string;\n\n /**\n * If resource has been destroyed.\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @returns Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n * @param _renderer - yeah, renderer!\n * @param _baseTexture - the texture\n * @param _glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type.\n * @param {*} _source - The source object\n * @param {string} _extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { Resource } from './Resource';\n\nimport type { ISize } from '@pixi/math';\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Buffer resource with data of typed array.\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */\n data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;\n\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if \\\n */\n static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n", "import { ALPHA_MODES, FORMATS, MIPMAP_MODES, SCALE_MODES, TARGETS, TYPES, WRAP_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { BufferResource } from './resources/BufferResource';\nimport { Resource } from './resources/Resource';\n\nimport type { MSAA_QUALITY } from '@pixi/constants';\nimport type { ICanvas } from '@pixi/settings';\nimport type { GLTexture } from './GLTexture';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement | HTMLVideoElement | ImageBitmap | ICanvas;\n\nexport interface IBaseTextureOptions\n{\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n * @member {number}\n * @default 0\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n touched: number;\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 * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\n /**\n * Default options used when creating BaseTexture objects.\n * @static\n * @memberof PIXI.BaseTexture\n * @type {PIXI.IBaseTextureOptions}\n */\n public static defaultOptions: IBaseTextureOptions = {\n /**\n * If mipmapping is enabled for texture.\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n mipmap: MIPMAP_MODES.POW2,\n /** Anisotropic filtering level of texture */\n anisotropicLevel: 0,\n /**\n * Default scale mode, linear, nearest.\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n scaleMode: SCALE_MODES.LINEAR,\n /**\n * Wrap mode for textures.\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n wrapMode: WRAP_MODES.CLAMP,\n /**\n * Pre multiply the image alpha\n * @type {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n alphaMode: ALPHA_MODES.UNPACK,\n /**\n * GL texture target\n * @type {PIXI.TARGETS}\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n target: TARGETS.TEXTURE_2D,\n /**\n * GL format type\n * @type {PIXI.FORMATS}\n * @default PIXI.FORMATS.RGBA\n */\n format: FORMATS.RGBA,\n /**\n * GL data type\n * @type {PIXI.TYPES}\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n type: TYPES.UNSIGNED_BYTE,\n };\n\n /**\n * @param {PIXI.Resource|HTMLImageElement|HTMLVideoElement|ImageBitmap|ICanvas|string} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param options - Collection of options, default options inherited from {@link PIXI.BaseTexture.defaultOptions}.\n * @param {PIXI.MIPMAP_MODES} [options.mipmap] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format] - GL format type\n * @param {PIXI.TYPES} [options.type] - GL data type\n * @param {PIXI.TARGETS} [options.target] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = Object.assign({}, BaseTexture.defaultOptions, options);\n\n const {\n alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions\n } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n this.resolution = resolution || settings.RESOLUTION;\n this.width = Math.round((width || 0) * this.resolution) / this.resolution;\n this.height = Math.round((height || 0) * this.resolution) / this.resolution;\n this._mipmap = mipmap;\n this.anisotropicLevel = anisotropicLevel;\n this._wrapMode = wrapMode;\n this._scaleMode = scaleMode;\n this.format = format;\n this.type = type;\n this.target = target;\n this.alphaMode = alphaMode;\n\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n this._glTextures = {};\n this.dirtyId = 0;\n this.dirtyStyleId = 0;\n this.cacheId = null;\n this.valid = width > 0 && height > 0;\n this.textureCacheIds = [];\n this.destroyed = false;\n this.resource = null;\n\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\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 * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\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 * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n * @readonly\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n * @readonly\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n * @default PIXI.MIPMAP_MODES.POW2\n */\n get mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * The scale mode to apply when scaling this texture\n * @default PIXI.SCALE_MODES.LINEAR\n */\n get scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @default PIXI.WRAP_MODES.CLAMP\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * Changes style options of BaseTexture\n * @param scaleMode - Pixi scalemode\n * @param mipmap - enable mipmaps\n * @returns - this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n * @param desiredWidth - Desired visual width\n * @param desiredHeight - Desired visual height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n * @param realWidth - Full rendered width\n * @param realHeight - Full rendered height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n * @param resolution - res\n * @returns - this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n * @param resource - that is managing this BaseTexture\n * @returns - this\n */\n setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\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 * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this;\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 * @static\n * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas|string|string[]} source - The\n * source to create base texture from.\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource | string | string[],\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = options?.pixiIdPrefix || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * Default properties are different from the constructor's defaults.\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, { type }, options));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\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: BaseTexture, id: string): void\n {\n if (id)\n {\n if (!baseTexture.textureCacheIds.includes(id))\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n // only throw a warning if there is a different base texture mapped to this id.\n if (BaseTextureCache[id] && BaseTextureCache[id] !== baseTexture)\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null\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?.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 /** Global number of the texture batch, used by multi-texture renderers. */\n static _globalBatch = 0;\n}\n", "import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n", "import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\n\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer.\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation.\n * @memberof PIXI\n */\nexport interface IArrayBuffer extends ArrayBuffer // eslint-disable-line @typescript-eslint/no-empty-interface\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field.\n * - @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n * @memberof PIXI\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n * @type {PIXI.IArrayBuffer}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n * @private\n * @type {Object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\n /**\n * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @returns - A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n", "import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n public divisor: number;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n * @param [divisor=1] - Divisor to use when doing instanced rendering\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean, divisor = 1)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n this.divisor = divisor;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n", "import { getBufferType } from '@pixi/utils';\n\nimport type { Dict } from '@pixi/utils';\nimport type { ITypedArray } from '../Buffer';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n", "import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport { getBufferType } from '@pixi/utils';\nimport { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\n\nimport type { TYPES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { IArrayBuffer } from './Buffer';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n * @example\n * import { Geometry } from 'pixi.js';\n *\n * const geometry = new Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0, 0, 1, 0, 1, 1, 0, 1], 2);\n * geometry.addIndex([0, 1, 2, 1, 3, 2]);\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @returns - Returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer | Float32Array | Uint32Array | Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @returns - Returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (!this.buffers.includes(buffer))\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n * @returns - Returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\n\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n * @param geometries - array of geometries to merge\n * @returns - Shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n", "import { TYPES } from '@pixi/constants';\nimport { Buffer } from '../geometry/Buffer';\nimport { Geometry } from '../geometry/Geometry';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n", "/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum SHAPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * @property {number} RECT Rectangle\n * @default 0\n */\n POLY = 0,\n /**\n * @property {number} POLY Polygon\n * @default 1\n */\n RECT = 1,\n /**\n * @property {number} CIRC Circle\n * @default 2\n */\n CIRC = 2,\n /**\n * @property {number} ELIP Ellipse\n * @default 3\n */\n ELIP = 3,\n /**\n * @property {number} RREC Rounded Rectangle\n * @default 4\n */\n RREC = 4,\n}\n", "import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n * @class\n * @memberof PIXI\n * @implements {IPoint}\n */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\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 this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\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 * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n", "import { SHAPES } from '../const';\nimport { Point } from '../Point';\n\nimport type { Matrix } from '../Matrix';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\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 * @memberof PIXI\n */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x: string | number = 0, y: string | number = 0, width: string | number = 0, height: string | number = 0)\n {\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle: Rectangle): 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 * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\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 * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other: Rectangle, transform?: Matrix): boolean\n {\n if (!transform)\n {\n const x0 = this.x < other.x ? other.x : this.x;\n const x1 = this.right > other.right ? other.right : this.right;\n\n if (x1 <= x0)\n {\n return false;\n }\n\n const y0 = this.y < other.y ? other.y : this.y;\n const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;\n\n return y1 > y0;\n }\n\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n\n if (x1 <= x0 || y1 <= y0)\n {\n return false;\n }\n\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n\n if (rt.x <= lt.x || lb.y <= lt.y)\n {\n return false;\n }\n\n const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));\n\n if (s === 0)\n {\n return false;\n }\n\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0\n || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1\n || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0\n || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1)\n {\n return false;\n }\n\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = (nx * x0) + (ny * y0);\n const n10 = (nx * x1) + (ny * y0);\n const n01 = (nx * x0) + (ny * y1);\n const n11 = (nx * x1) + (ny * y1);\n\n if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)\n || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y))\n {\n return false;\n }\n\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = (mx * x0) + (my * y0);\n const m10 = (mx * x1) + (my * y0);\n const m01 = (mx * x0) + (my * y1);\n const m11 = (mx * x1) + (my * y1);\n\n if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)\n || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle: Rectangle): this\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 return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\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 return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle: Rectangle): this\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 return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n", "import { PI_2 } from './const';\nimport { Point } from './Point';\n\nimport type { IPointData } from './IPointData';\nimport type { Transform } from './Transform';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @memberof PIXI\n */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array | null = null;\n\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\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\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 * @param array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\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 * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\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 * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\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 * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\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 * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\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 * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\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 * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\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 * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\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 * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\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 * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\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 * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\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 * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform: Transform): 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 const pivot = transform.pivot;\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 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 + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert(): this\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 Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity(): this\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 * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\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 * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): 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 matrix to be the same as the ones in given matrix\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @returns {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n // #endif\n\n /**\n * A default (identity) matrix\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n", "// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\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];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n * @type {number[][]}\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n * @type {PIXI.Matrix[]}\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\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 /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && 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 rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**\n * This is the small part of gameofbombs.com portal system. It works.\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @readonly\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @readonly\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @readonly\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @readonly\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @readonly\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @readonly\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @readonly\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @readonly\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n * @readonly\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n * @readonly\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n * @readonly\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n * @readonly\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @returns {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\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 * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n", "import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n * @memberof PIXI\n */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\n /**\n * Creates a new `ObservablePoint`\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param 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: (this: T) => any, scope: T, 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 overridden otherwise they will default\n * to the clone object's values.\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @returns a copy of this observable point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\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 * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x): this\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 return this;\n }\n\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n", "import { Matrix } from './Matrix';\nimport { ObservablePoint } from './ObservablePoint';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n * @memberof PIXI\n */\nexport class Transform\n{\n /**\n * A default (identity) transform.\n * @static\n * @type {PIXI.Transform}\n */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */\n protected _currentLocalID: number;\n\n constructor()\n {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\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 // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Transform `\n + `position=(${this.position.x}, ${this.position.y}) `\n + `rotation=${this.rotation} `\n + `scale=(${this.scale.x}, ${this.scale.y}) `\n + `skew=(${this.skew.x}, ${this.skew.y}) `\n + `]`;\n }\n // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\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 local and the world transformation matrices.\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\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 * @param matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n", "var defaultFragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\\n}\";\n\nexport { defaultFragment as default };\n//# sourceMappingURL=defaultProgram.mjs.map\n", "var defaultVertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void){\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n}\\n\";\n\nexport { defaultVertex as default };\n//# sourceMappingURL=defaultProgram2.mjs.map\n", "/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @returns {WebGLShader} the shader\n */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n", "function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\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 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\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 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(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 return null;\n}\n", "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any, uniform: any): boolean =>\n // eslint-disable-next-line max-len,no-eq-null,eqeqeq\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined),\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\n var ${name}_matrix = uv.${name}.toArray(true);\n\n data[offset] = ${name}_matrix[0];\n data[offset+1] = ${name}_matrix[1];\n data[offset+2] = ${name}_matrix[2];\n \n data[offset + 4] = ${name}_matrix[3];\n data[offset + 5] = ${name}_matrix[4];\n data[offset + 6] = ${name}_matrix[5];\n \n data[offset + 8] = ${name}_matrix[6];\n data[offset + 9] = ${name}_matrix[7];\n data[offset + 10] = ${name}_matrix[8];\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `\n },\n // upload a pixi color as vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.red !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n cv[3] = v.alpha;\n gl.uniform4f(ud[\"${name}\"].location, v.red, v.green, v.blue, v.alpha)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n data[offset+3] = v.alpha;\n `\n },\n // upload a pixi color as a vec3 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec3' && data.size === 1 && !data.isArray && uniform.red !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n \n gl.uniform3f(ud[\"${name}\"].location, v.red, v.green, v.blue)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n `\n },\n\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n", "import { uniformParsers } from './uniformParsers';\n\nimport type { Dict } from '@pixi/utils';\nimport type { UniformGroup } from '../UniformGroup';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n\n vec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n\n int: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n ivec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n ivec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n ivec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n uint: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }`,\n uvec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n uvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n uvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n\n bool: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n bvec2: `\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n bvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n bvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n samplerCube: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n sampler2DArray: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n", "import { ENV } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || context?.isContextLost())\n {\n const canvas = settings.ADAPTER.createCanvas();\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = (canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext));\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n", "import { PRECISION } from '@pixi/constants';\nimport { getTestContext } from './getTestContext';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n", "/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n\n/**\n *\n * logs out any program errors\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n", "import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\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 uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 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\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {string} type\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n", "import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\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 UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\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 INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n", "import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n * @returns {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n", "// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n", "import { PRECISION } from '@pixi/constants';\nimport { isMobile, ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { getMaxFragmentPrecision, setPrecision } from './utils';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\nexport interface IProgramExtraData\n{\n transformFeedbackVaryings?: {\n names: string[],\n bufferMode: 'separate' | 'interleaved'\n }\n}\n\n/**\n * Helper class to create a shader program.\n * @memberof PIXI\n */\nexport class Program\n{\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n public static defaultVertexPrecision: PRECISION = PRECISION.HIGH;\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixijs/issues/3742\n * @static\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n public static defaultFragmentPrecision: PRECISION = isMobile.apple.device\n ? PRECISION.HIGH\n : PRECISION.MEDIUM;\n\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\n extra: IProgramExtraData = {};\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @param extra - Extra data for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader', extra: IProgramExtraData = {})\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n this.extra = extra;\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(\n this.vertexSrc,\n Program.defaultVertexPrecision,\n PRECISION.HIGH\n );\n this.fragmentSrc = setPrecision(\n this.fragmentSrc,\n Program.defaultFragmentPrecision,\n getMaxFragmentPrecision()\n );\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n * @readonly\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n", "import { BUFFER_TYPE } from '@pixi/constants';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```glsl\n * // UBO in shader:\n * uniform myCoolData { // Declaring a UBO...\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace;\n * };\n * ```\n *\n * ```js\n * // A new Uniform Buffer Object...\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // Build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // Name matches the UBO name in the shader. Will be processed accordingly.\n * })\n *\n * ```\n * @memberof PIXI\n */\nexport class UniformGroup>\n{\n /**\n * Uniform values\n * @member {object}\n */\n public readonly uniforms: LAYOUT;\n\n /**\n * Its a group and not a single uniforms.\n * @default true\n */\n public readonly group: boolean;\n\n /**\n * unique id\n * @protected\n */\n public id: number;\n syncUniforms: Dict;\n\n /**\n * Dirty version\n * @protected\n */\n dirtyId: number;\n\n /** Flag for if uniforms wont be changed after creation. */\n static: boolean;\n\n /** Flags whether this group is treated like a uniform buffer object. */\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer.\n * @param isStatic - Uniforms wont be changed after creation.\n * @param isUbo - If true, will treat this uniform group as a uniform buffer object.\n */\n constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n this.dirtyId = 0;\n this.id = UID++;\n this.static = !!isStatic;\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else\n {\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n }\n\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\n\n /**\n * A short hand function for creating a static UBO UniformGroup.\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n", "import { Runner } from '@pixi/runner';\nimport { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\n\n/**\n * A helper class for shaders.\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\n disposeRunner: Runner;\n\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n this.disposeRunner = new Runner('disposeShader');\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n\n this.disposeRunner.emit(this);\n this.disposeRunner.destroy();\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n", "import { Matrix } from '@pixi/math';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { UniformGroup } from '../shader/UniformGroup';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (!fragTemplate.includes('%count%'))\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (!fragTemplate.includes('%forloop%'))\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\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(vTextureId < ${i}.5)`;\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}\n", "import type { BaseTexture } from '../textures/BaseTexture';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n", "import { isMobile } from '@pixi/settings';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n * @private\n * @returns {boolean} `true` if the same buffer may be uploaded more than once.\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n", "import { isMobile, settings } from '@pixi/settings';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n * @private\n * @param {number} max\n * @returns {number} The maximum recommended texture units to use.\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n const navigator = settings.ADAPTER.getNavigator();\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n", "import type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Stub method that should be used to empty the current batch by rendering objects now. */\n flush(): void\n {\n // flush!\n }\n\n /** Generic destruction method that frees all resources. This should be called by subclasses. */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /** Stops the renderer. It should free up any state and become dormant. */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n * @param {PIXI.DisplayObject} _object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n", "var defaultFragment = \"varying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying float vTextureId;\\nuniform sampler2D uSamplers[%count%];\\n\\nvoid main(void){\\n vec4 color;\\n %forloop%\\n gl_FragColor = color * vColor;\\n}\\n\";\n\nexport { defaultFragment as default };\n//# sourceMappingURL=texture.mjs.map\n", "var defaultVertex = \"precision highp float;\\nattribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\nattribute float aTextureId;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 translationMatrix;\\nuniform vec4 tint;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying float vTextureId;\\n\\nvoid main(void){\\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vTextureId = aTextureId;\\n vColor = aColor * tint;\\n}\\n\";\n\nexport { defaultVertex as default };\n//# sourceMappingURL=texture2.mjs.map\n", "import { Color } from '@pixi/color';\nimport { ENV } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { settings } from '@pixi/settings';\nimport { deprecation, log2, nextPow2, premultiplyBlendMode } from '@pixi/utils';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\nimport { State } from '../state/State';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { BatchDrawCall } from './BatchDrawCall';\nimport { BatchGeometry } from './BatchGeometry';\nimport { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { canUploadSameBuffer } from './canUploadSameBuffer';\nimport { maxRecommendedTextures } from './maxRecommendedTextures';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport defaultFragment from './texture.frag';\nimport defaultVertex from './texture.vert';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { Texture } from '../textures/Texture';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n * @memberof PIXI\n */\nexport interface IBatchableElement\n{\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n * @memberof PIXI\n */\nexport class BatchRenderer extends ObjectRenderer\n{\n /**\n * The maximum textures that this device supports.\n * @static\n * @default 32\n */\n public static get defaultMaxTextures(): number\n {\n this._defaultMaxTextures = this._defaultMaxTextures ?? maxRecommendedTextures(32);\n\n return this._defaultMaxTextures;\n }\n public static set defaultMaxTextures(value: number)\n {\n this._defaultMaxTextures = value;\n }\n\n /** @ignore */\n private static _defaultMaxTextures: number;\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n */\n public static defaultBatchSize = 4096;\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n */\n public static get canUploadSameBuffer(): boolean\n {\n this._canUploadSameBuffer = this._canUploadSameBuffer ?? canUploadSameBuffer();\n\n return this._canUploadSameBuffer;\n }\n public static set canUploadSameBuffer(value: boolean)\n {\n this._canUploadSameBuffer = value;\n }\n\n /** @ignore */\n private static _canUploadSameBuffer: boolean;\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n name: 'batch',\n type: ExtensionType.RendererPlugin,\n };\n\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n * @default PIXI.BatchRenderer.defaultBatchSize * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n * @see PIXI.BatchRenderer#contextChange\n * @readonly\n */\n public maxTextures: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n * @default 6\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `BatchRenderer.canUploadSameBuffer` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.BatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n * @member {Uint16Array[]}\n * @see PIXI.BatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n * @member {PIXI.Geometry[]}\n * @see PIXI.BatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.setShaderGenerator();\n this.geometryClass = BatchGeometry;\n this.vertexSize = 6;\n this.state = State.for2d();\n this.size = BatchRenderer.defaultBatchSize * 4;\n this._vertexCount = 0;\n this._indexCount = 0;\n this._bufferedElements = [];\n this._bufferedTextures = [];\n this._bufferSize = 0;\n this._shader = null;\n this._packedGeometries = [];\n this._packedGeometryPoolSize = 2;\n this._flushId = 0;\n this._aBuffers = {} as any;\n this._iBuffers = {} as any;\n\n this.maxTextures = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * @see PIXI.BatchRenderer#maxTextures\n * @deprecated since 7.1.0\n * @readonly\n */\n get MAX_TEXTURES(): number\n {\n // #if _DEBUG\n deprecation('7.1.0', 'BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures');\n // #endif\n\n return this.maxTextures;\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n\n /**\n * Set the shader generator.\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchRenderer.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchRenderer.defaultFragmentTemplate] - Fragment shader template\n */\n public setShaderGenerator({\n vertex = BatchRenderer.defaultVertexSrc,\n fragment = BatchRenderer.defaultFragmentTemplate\n }: { vertex?: string, fragment?: string } = {}): void\n {\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.maxTextures` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.maxTextures = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.maxTextures = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n BatchRenderer.defaultMaxTextures);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.maxTextures = checkMaxIfStatementsInShader(\n this.maxTextures, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.maxTextures);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = BatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.maxTextures) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.maxTextures; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n maxTextures,\n } = this;\n const textureArrays = BatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, maxTextures);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= maxTextures)\n {\n batch.boundArray(texArray, boundTextures, TICK, maxTextures);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, maxTextures);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n * @param texArray\n * @param start\n * @param finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = BatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n * @param texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!BatchRenderer.canUploadSameBuffer)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = BatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.maxTextures);\n\n this.renderer.shader.bind(this._shader);\n\n if (BatchRenderer.canUploadSameBuffer)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `BatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n * @param size - minimum capacity required\n * @returns - buffer than can hold atleast `size` floats\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n * @param size - minimum required capacity\n * @returns - buffer that can fit `size` indices.\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = Color.shared\n .setValue(element._tintRGB)\n .toPremultiplied(alpha, element._texture.baseTexture.alphaMode > 0);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n\n// Install BatchRenderer as default\nextensions.add(BatchRenderer);\n", "var defaultFragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n}\\n\";\n\nexport { defaultFragment as default };\n//# sourceMappingURL=defaultFilter.mjs.map\n", "var defaultVertex = \"attribute vec2 aVertexPosition;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform vec4 inputSize;\\nuniform vec4 outputFrame;\\n\\nvec4 filterVertexPosition( void )\\n{\\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\\n\\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\\n}\\n\\nvec2 filterTextureCoord( void )\\n{\\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\\n}\\n\\nvoid main(void)\\n{\\n gl_Position = filterVertexPosition();\\n vTextureCoord = filterTextureCoord();\\n}\\n\";\n\nexport { defaultVertex as default };\n//# sourceMappingURL=defaultFilter2.mjs.map\n", "import { MSAA_QUALITY } from '@pixi/constants';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { State } from '../state/State';\nimport defaultFragment from './defaultFilter.frag';\nimport defaultVertex from './defaultFilter.vert';\n\nimport type { BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterState } from './FilterState';\nimport type { FilterSystem } from './FilterSystem';\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link https://pixijs.io/examples/#/filters-basic/blur.js Example} of the\n * {@link PIXI.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```js\n * import { Container, Filter } from 'pixi.js';\n * const filter = new Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixijs/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```js\n * import { Filter } from 'pixi.js';\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```glsl\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```glsl\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n *\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```glsl\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw));\n * ```\n *\n * Or:\n *\n * ```glsl\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw));\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixijs/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n * @memberof PIXI\n */\nexport class Filter extends Shader\n{\n /**\n * Default filter resolution for any filter.\n * @static\n */\n public static defaultResolution = 1;\n\n /**\n * Default filter samples for any filter.\n * @static\n * @type {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public static defaultMultisample = MSAA_QUALITY.NONE;\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 public padding: number;\n\n /** The samples override of the filter instance. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\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 * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n this.padding = 0;\n this.resolution = Filter.defaultResolution;\n this.multisample = Filter.defaultMultisample;\n this.enabled = true;\n this.autoFit = true;\n this.state = new State();\n }\n\n /**\n * Applies the filter\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - 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: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // Do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // Or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\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 get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n", "import { Color } from '@pixi/color';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ColorSource } from '@pixi/color';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Options for the background system.\n * @memberof PIXI\n * @deprecated since 7.2.3\n * @see PIXI.BackgroundSystemOptions\n */\nexport type BackgroundSytemOptions = BackgroundSystemOptions;\n\n/**\n * Options for the background system.\n * @memberof PIXI\n */\nexport interface BackgroundSystemOptions\n{\n /**\n * The background color used to clear the canvas. See {@link PIXI.ColorSource} for accepted color values.\n * @memberof PIXI.IRendererOptions\n */\n backgroundColor: ColorSource;\n /**\n * Alias for {@link PIXI.IRendererOptions.backgroundColor}\n * @memberof PIXI.IRendererOptions\n */\n background?: ColorSource;\n /**\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @memberof PIXI.IRendererOptions\n */\n backgroundAlpha: number;\n /**\n * Whether to clear the canvas before new render passes.\n * @memberof PIXI.IRendererOptions\n */\n clearBeforeRender: boolean;\n}\n\n/**\n * The background system manages the background color and alpha of the main view.\n * @memberof PIXI\n */\nexport class BackgroundSystem implements ISystem\n{\n static defaultOptions: BackgroundSystemOptions = {\n /**\n * {@link PIXI.IRendererOptions.backgroundAlpha}\n * @default 1\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n backgroundAlpha: 1,\n /**\n * {@link PIXI.IRendererOptions.backgroundColor}\n * @default 0x000000\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n backgroundColor: 0x0,\n /**\n * {@link PIXI.IRendererOptions.clearBeforeRender}\n * @default true\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n clearBeforeRender: true,\n };\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: 'background',\n };\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 * @member {boolean}\n * @default\n */\n public clearBeforeRender: boolean;\n\n /** Reference to the internal color */\n private _backgroundColor: Color;\n\n constructor()\n {\n this.clearBeforeRender = true;\n this._backgroundColor = new Color(0x0);\n this.alpha = 1;\n }\n\n /**\n * initiates the background system\n * @param {PIXI.IRendererOptions} options - the options for the background colors\n */\n init(options: BackgroundSystemOptions): void\n {\n this.clearBeforeRender = options.clearBeforeRender;\n const { backgroundColor, background, backgroundAlpha } = options;\n const color = background ?? backgroundColor;\n\n if (color !== undefined)\n {\n this.color = color;\n }\n\n this.alpha = backgroundAlpha;\n }\n\n /**\n * The background color to fill if not transparent.\n * @member {PIXI.ColorSource}\n */\n get color(): ColorSource\n {\n return this._backgroundColor.value;\n }\n\n set color(value: ColorSource)\n {\n this._backgroundColor.setValue(value);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n */\n get alpha(): number\n {\n return this._backgroundColor.alpha;\n }\n\n set alpha(value: number)\n {\n this._backgroundColor.setAlpha(value);\n }\n\n /** The background color object. */\n get backgroundColor(): Color\n {\n return this._backgroundColor;\n }\n\n destroy(): void\n {\n // ka boom!\n }\n}\n\nextensions.add(BackgroundSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'batch',\n };\n\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\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 flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /** Reset the system to an empty renderer */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(BatchSystem);\n", "import { ENV } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { settings } from '@pixi/settings';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { ICanvas } from '@pixi/settings';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\n/**\n * Options for the context system.\n * @memberof PIXI\n */\nexport interface ContextSystemOptions\n{\n /**\n * **Deprecated since 7.0.0, use `premultipliedAlpha` and `backgroundAlpha` instead.**\n *\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`.\n *\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @deprecated since 7.0.0\n * @memberof PIXI.IRendererOptions\n */\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * **WebGL Only.** User-provided WebGL rendering context object.\n * @memberof PIXI.IRendererOptions\n */\n context: IRenderingContext | null;\n /**\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @memberof PIXI.IRendererOptions\n */\n antialias: boolean;\n /**\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @memberof PIXI.IRendererOptions\n */\n powerPreference: WebGLPowerPreference;\n /**\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @memberof PIXI.IRendererOptions\n */\n premultipliedAlpha: boolean;\n /**\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @memberof PIXI.IRendererOptions\n */\n preserveDrawingBuffer: boolean;\n}\n\nexport interface ISupportDict\n{\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /** @ignore */\n static defaultOptions: ContextSystemOptions = {\n /**\n * {@link PIXI.IRendererOptions.context}\n * @default null\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n context: null,\n /**\n * {@link PIXI.IRendererOptions.antialias}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n antialias: false,\n /**\n * {@link PIXI.IRendererOptions.premultipliedAlpha}\n * @default true\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n premultipliedAlpha: true,\n /**\n * {@link PIXI.IRendererOptions.preserveDrawingBuffer}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n preserveDrawingBuffer: false,\n /**\n * {@link PIXI.IRendererOptions.powerPreference}\n * @default default\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n powerPreference: 'default',\n };\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'context',\n };\n\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n preserveDrawingBuffer: boolean;\n powerPreference: WebGLPowerPreference;\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @member {boolean}\n * @deprecated since 7.0.0\n */\n useContextAlpha: boolean | 'notMultiplied';\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n }\n\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n }\n\n init(options: ContextSystemOptions): void\n {\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.initFromContext(options.context);\n }\n else\n {\n const alpha = this.renderer.background.alpha < 1;\n const premultipliedAlpha = options.premultipliedAlpha;\n\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n this.useContextAlpha = options.useContextAlpha;\n this.powerPreference = options.powerPreference;\n\n this.initFromOptions({\n alpha,\n premultipliedAlpha,\n antialias: options.antialias,\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: options.powerPreference,\n });\n }\n }\n\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n\n const view = this.renderer.view;\n\n if (view.addEventListener !== undefined)\n {\n view.addEventListener('webglcontextlost', this.handleContextLost, false);\n view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n }\n\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: ICanvas, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options) || 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\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n loseContext: gl.getExtension('WEBGL_lose_context'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), // eslint-disable-line camelcase\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n // Prevent default to be able to restore the context\n event.preventDefault();\n\n // Restore the context after this event has exited\n setTimeout(() =>\n {\n if (this.gl.isContextLost() && this.extensions.loseContext)\n {\n this.extensions.loseContext.restoreContext();\n }\n }, 0);\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n if (view.removeEventListener !== undefined)\n {\n view.removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n }\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.objectRenderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (attributes && !attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n\nextensions.add(ContextSystem);\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n", "import { FORMATS, MIPMAP_MODES, MSAA_QUALITY, SCALE_MODES, TYPES } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n /** Width of framebuffer in pixels. */\n public width: number;\n\n /** Height of framebuffer in pixels. */\n public height: number;\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias: true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n * @example\n * import { MSAA_QUALITY } from 'pixi.js';\n *\n * renderTexture.framebuffer.multisample = MSAA_QUALITY.HIGH;\n * // ...\n * renderer.render(myContainer, { renderTexture });\n * renderer.framebuffer.blit(); // Copies data from MSAA framebuffer to texture\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param width - Width of the frame buffer\n * @param height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n this.width = Math.round(width || 100);\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array.\n * @param index - Index of the array to add the texture to\n * @param texture - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer.\n * @param texture - Texture to add.\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable depth on the frame buffer. */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable stencil on the frame buffer. */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n * @param width - Width of the frame buffer to resize to\n * @param height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys and removes the depth texture added to this framebuffer. */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n", "import { Color } from '@pixi/color';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { BaseTexture } from '../textures/BaseTexture';\n\nimport type { ColorSource } from '@pixi/color';\nimport type { MaskData } from '../mask/MaskData';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\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 * @example\n * import { autoDetectRenderer, BaseRenderTexture, RenderTexture, Sprite } from 'pixi.js';\n *\n * const renderer = autoDetectRenderer();\n * const baseRenderTexture = new BaseRenderTexture({ width: 800, height: 600 });\n * const renderTexture = new RenderTexture(baseRenderTexture);\n * const sprite = Sprite.from('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 * // The Sprite in this case will be rendered using its local transform.\n * // To render this sprite at 0,0 you can clear the transform\n * sprite.setTransform();\n *\n * const baseRenderTexture = new BaseRenderTexture({ width: 100, height: 100 });\n * const renderTexture = new RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, { renderTexture }); // Renders to center of RenderTexture\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public _clear: Color;\n public framebuffer: Framebuffer;\n\n /** The data structure for the stencil masks. */\n maskStack: Array;\n\n /** The data structure for the filters. */\n filterStack: Array;\n\n /**\n * @param options\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.BaseTexture.defaultOptions.scaleMode] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n constructor(options: IBaseTextureOptions = {})\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample ??= MSAA_QUALITY.NONE;\n\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this._clear = new Color([0, 0, 0, 0]);\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n this.maskStack = [];\n this.filterStack = [{}];\n }\n\n /** Color when clearning the texture. */\n set clearColor(value: ColorSource)\n {\n this._clear.setValue(value);\n }\n get clearColor(): ColorSource\n {\n return this._clear.value;\n }\n\n /**\n * Color object when clearning the texture.\n * @readonly\n * @since 7.2.0\n */\n get clear(): Color\n {\n return this._clear;\n }\n\n /**\n * Resizes the BaseRenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\n\n /**\n * Frees the texture and framebuffer 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 * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /** Destroys this texture. */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { Resource } from './Resource';\n\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n * @member {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void\n {\n if (crossorigin === undefined && !url.startsWith('data:'))\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} [source] - (optional)\n * @returns - true is success\n */\n override upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n if (typeof HTMLImageElement !== 'undefined' && source instanceof HTMLImageElement)\n {\n if (!source.complete || source.naturalWidth === 0)\n {\n return false;\n }\n }\n else if (typeof HTMLVideoElement !== 'undefined' && source instanceof HTMLVideoElement)\n {\n if (source.readyState <= 1 && source.buffered.length === 0)\n {\n return false;\n }\n }\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n override update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link PIXI.BaseImageResource} */\n override dispose(): void\n {\n this.source = null;\n }\n}\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process automatically when constructed. */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean | string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@link HTMLImageElement}.\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement | string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (typeof source === 'string')\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixijs/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\n this.preserveBitmap = false;\n this.createBitmap = (options.createBitmap ?? settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n this.bitmap = null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n * @returns - Cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !globalThis.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = globalThis.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n override upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n override dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if current environment support HTMLImageElement, and source is string or HTMLImageElement\n */\n static override test(source: unknown): source is string | HTMLImageElement\n {\n return typeof HTMLImageElement !== 'undefined' && (typeof source === 'string' || source instanceof HTMLImageElement);\n }\n}\n", "import { groupD8 } from '@pixi/math';\n\nimport type { ISize, Rectangle } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n /** X-component of top-left corner `(x0,y0)`. */\n public x0: number;\n\n /** Y-component of top-left corner `(x0,y0)`. */\n public y0: number;\n\n /** X-component of top-right corner `(x1,y1)`. */\n public x1: number;\n\n /** Y-component of top-right corner `(x1,y1)`. */\n public y1: number;\n\n /** X-component of bottom-right corner `(x2,y2)`. */\n public x2: number;\n\n /** Y-component of bottom-right corner `(x2,y2)`. */\n public y2: number;\n\n /** X-component of bottom-left corner `(x3,y3)`. */\n public x3: number;\n\n /** Y-component of bottom-right corner `(x3,y3)`. */\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n this.x1 = 1;\n this.y1 = 0;\n this.x2 = 1;\n this.y2 = 1;\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n * @protected\n * @param frame - The frame of the texture\n * @param baseFrame - The base frame of the texture\n * @param rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\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.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:TextureUvs `\n + `x0=${this.x0} y0=${this.y0} `\n + `x1=${this.x1} y1=${this.y1} x2=${this.x2} `\n + `y2=${this.y2} x3=${this.x3} y3=${this.y3}`\n + `]`;\n }\n // #endif\n}\n", "import { Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { EventEmitter, getResolutionOfUrl, TextureCache, uid } from '@pixi/utils';\nimport { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport { TextureUvs } from './TextureUvs';\n\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { CanvasResource } from './resources/CanvasResource';\nimport type { Resource } from './resources/Resource';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string | BaseTexture | ImageSource;\n\n/**\n * Stores the width of the non-scalable borders, for example when used with {@link PIXI.NineSlicePlane} texture.\n * @memberof PIXI\n * @since 7.2.0\n */\nexport interface ITextureBorders\n{\n /** left border in pixels */\n left: number;\n /** top border in pixels */\n top: number;\n /** right border in pixels */\n right: number;\n /** bottom border in pixels */\n bottom: number;\n}\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * Used to remove listeners from WHITE and EMPTY Textures\n * @ignore\n */\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, 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 * import { Sprite, Texture } from 'pixi.js';\n *\n * const texture = Texture.from('assets/image.png');\n * const sprite1 = new Sprite(texture);\n * const sprite2 = new Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\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 *\n * ```js\n * import { Sprite, Texture } from 'pixi.js';\n *\n * const texture = Texture.from('assets/image.svg');\n * const sprite1 = new Sprite(texture);\n * // sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n *\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing.\n * See issue [#3085]{@link https://github.com/pixijs/pixijs/issues/3085}.\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nexport class Texture extends EventEmitter\n{\n /** The base texture that this texture uses. */\n public baseTexture: BaseTexture;\n\n /** This is the area of original texture, before it was put in atlas. */\n public orig: Rectangle;\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 public trim: Rectangle;\n\n /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */\n public valid: boolean;\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n * @example\n * texture.on('update', () => {});\n */\n public noFrame: boolean;\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 * @default {0,0}\n */\n public defaultAnchor: Point;\n\n /**\n * Default width of the non-scalable border that is used if 9-slice plane is created with this texture.\n * @since 7.2.0\n * @see PIXI.NineSlicePlane\n */\n public defaultBorders?: ITextureBorders;\n\n /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n * @protected\n */\n _updateID: number;\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 _frame: Rectangle;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV.\n * @protected\n */\n _uvs: TextureUvs;\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 textureCacheIds: Array;\n\n /**\n * @param baseTexture - The base texture source to create the texture from\n * @param frame - The rectangle frame of the texture to show\n * @param orig - The area of original texture\n * @param trim - Trimmed rectangle of original texture\n * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param anchor - Default anchor point used for sprite placement / rotation\n * @param borders - Default borders used for 9-slice scaling. See {@link PIXI.NineSlicePlane}\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData, borders?: ITextureBorders)\n {\n super();\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 this.baseTexture = baseTexture;\n this._frame = frame;\n this.trim = trim;\n this.valid = false;\n this._uvs = DEFAULT_UVS;\n this.uvMatrix = null;\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === 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 this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n this.defaultBorders = borders;\n\n this._updateID = 0;\n\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n * @protected\n * @param baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n * @param [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\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 (resource?.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, 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 * @returns - The new texture\n */\n clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim?.clone(),\n this.rotate,\n this.defaultAnchor,\n this.defaultBorders\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_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 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 * @param {string|PIXI.BaseTexture|HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} source -\n * Source or array of sources to create texture from\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource | TextureSource[],\n options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = options?.pixiIdPrefix || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = options?.pixiIdPrefix || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param url - The remote URL or array of URLs to load.\n * @param options - Optional options to include\n * @returns - A Promise that resolves to a Texture.\n */\n static fromURL(\n url: string | string[], options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas|string} source - The input source.\n * @param imageUrl - File name of texture, for cache and resolving resolution.\n * @param name - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @param options\n * @returns - Output texture\n */\n static fromLoader(source: ImageSource | string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: BaseTexture.defaultOptions.scaleMode,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\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 'fromLoader' function\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 // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n * @param texture - The Texture to add to the cache.\n * @param id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (!texture.textureCacheIds.includes(id))\n {\n texture.textureCacheIds.push(id);\n }\n\n // only throw a warning if there is a different texture mapped to this id.\n if (TextureCache[id] && TextureCache[id] !== texture)\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n * @param texture - id of a Texture to be removed, or a Texture instance itself\n * @returns - The Texture that was removed\n */\n static removeFromCache(texture: string | Texture): Texture | null\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?.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 * Returns resolution of baseTexture\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\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 get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\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.valid;\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 get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /** The width of the Texture in pixels. */\n get width(): number\n {\n return this.orig.width;\n }\n\n /** The height of the Texture in pixels. */\n get height(): number\n {\n return this.orig.height;\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n private static _EMPTY: Texture;\n private static _WHITE: Texture;\n\n /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */\n public static get EMPTY(): Texture\n {\n if (!Texture._EMPTY)\n {\n Texture._EMPTY = new Texture(new BaseTexture());\n removeAllHandlers(Texture._EMPTY);\n removeAllHandlers(Texture._EMPTY.baseTexture);\n }\n\n return Texture._EMPTY;\n }\n\n /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */\n public static get WHITE(): Texture\n {\n if (!Texture._WHITE)\n {\n const canvas = settings.ADAPTER.createCanvas(16, 16);\n const context = canvas.getContext('2d');\n\n canvas.width = 16;\n canvas.height = 16;\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n Texture._WHITE = new Texture(BaseTexture.from(canvas));\n removeAllHandlers(Texture._WHITE);\n removeAllHandlers(Texture._WHITE.baseTexture);\n }\n\n return Texture._WHITE;\n }\n}\n\n", "import { Texture } from '../textures/Texture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\n\nimport type { MSAA_QUALITY } from '@pixi/constants';\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\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 * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n * @example\n * import { autoDetectRenderer, RenderTexture, Sprite } from 'pixi.js';\n *\n * const renderer = autoDetectRenderer();\n * const renderTexture = RenderTexture.create({ width: 800, height: 600 });\n * const sprite = Sprite.from('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 * // Note that you should not create a new renderer, but reuse the same one as the rest of the application.\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 * sprite.setTransform();\n *\n * const renderTexture = new RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, { renderTexture }); // Renders to center of RenderTexture\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n * @readonly\n */\n public filterFrame: Rectangle | null;\n\n /**\n * The key for pooled texture of FilterSystem.\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string | number | null;\n\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\n\n /**\n * Resizes the RenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\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 (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n * @param resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * A short hand way of creating a render texture.\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.BaseTexture.defaultOptions.scaleMode] - See {@link PIXI.SCALE_MODES}\n * for possible values\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @returns The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture\n {\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n", "import { MSAA_QUALITY } from '@pixi/constants';\nimport { nextPow2 } from '@pixi/utils';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { RenderTexture } from './RenderTexture';\n\nimport type { ISize } from '@pixi/math';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string | number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil((minWidth * resolution) - 1e-6);\n minHeight = Math.ceil((minHeight * resolution) - 1e-6);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[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\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n * @param size - Initial size of screen.\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[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 this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n * @readonly\n */\n static SCREEN_KEY = -1;\n}\n", "import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n", "import { Buffer } from '../geometry/Buffer';\nimport { Geometry } from '../geometry/Geometry';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n * @memberof PIXI\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n\n /** An array of vertices. */\n vertices: Float32Array;\n\n /** The Uvs of the quad. */\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n * @param targetTextureFrame - The first rectangle\n * @param destinationFrame - The second rectangle\n * @returns - Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\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 this.invalidate();\n\n return this;\n }\n\n /**\n * Legacy upload method, just marks buffers dirty.\n * @returns - Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n", "import { MSAA_QUALITY } from '@pixi/constants';\nimport { Rectangle } from '@pixi/math';\n\nimport type { Matrix } from '@pixi/math';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\n\n/**\n * System plugin to the renderer to manage filter states.\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n", "import { CLEAR_MODES, DRAW_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix, Point, Rectangle } from '@pixi/math';\nimport { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { FilterState } from './FilterState';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { ISystem } from '../system/ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n * @memberof PIXI\n */\nexport class FilterSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'filter',\n };\n\n /**\n * List of filters for the FilterSystem\n * @member {object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n * @property {PIXI.Rectangle} outputFrame -\n * @property {Float32Array} inputSize -\n * @property {Float32Array} inputPixel -\n * @property {Float32Array} inputClamp -\n * @property {number} resolution -\n * @property {Float32Array} filterArea -\n * @property {Float32Array} filterClamp -\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n\n init(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n if (autoFit)\n {\n state.sourceFrame.fit(sourceFrameProjected);\n\n if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0)\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n }\n else if (!state.sourceFrame.intersects(sourceFrameProjected))\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n }\n\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture?.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\n\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n }\n\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link PIXI.Filter#apply}.\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(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\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns - The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0)\n {\n return;\n }\n\n if (transform)\n {\n const { a, b, c, d } = transform;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4))\n {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n\nextensions.add(FilterSystem);\n", "import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context.\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n /** The WebGL framebuffer. */\n public framebuffer: WebGLFramebuffer;\n\n /** Stencil+depth , usually costs 32bits per pixel. */\n public stencil: WebGLRenderbuffer;\n\n /** Detected AA samples number. */\n public multisample: MSAA_QUALITY;\n\n /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */\n public msaaBuffer: WebGLRenderbuffer;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n */\n public blitFramebuffer: Framebuffer;\n\n /** Latest known version of framebuffer. */\n dirtyId: number;\n\n /** Latest known version of framebuffer format. */\n dirtyFormat: number;\n\n /** Latest known version of framebuffer size. */\n dirtySize: number;\n\n /** Store the current mipmap of the textures the framebuffer will write too. */\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n this.framebuffer = framebuffer;\n this.stencil = null;\n this.dirtyId = -1;\n this.dirtyFormat = -1;\n this.dirtySize = -1;\n this.multisample = MSAA_QUALITY.NONE;\n this.msaaBuffer = null;\n this.blitFramebuffer = null;\n this.mipLevel = 0;\n }\n}\n", "import { BUFFER_BITS, ENV, MSAA_QUALITY } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'framebuffer',\n };\n\n /** A list of managed framebuffers. */\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /** Framebuffer value that shows that we don't know what is bound. */\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedFramebuffers = [];\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer.\n * @param framebuffer\n * @param frame - frame, default is framebuffer size\n * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n * @param x - X position of viewport\n * @param y - Y position of viewport\n * @param width - Width of viewport\n * @param height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n * @param r - Red value from 0 to 1\n * @param g - Green value from 0 to 1\n * @param b - Blue value from 0 to 1\n * @param a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n * @protected\n * @param framebuffer\n * @returns - created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n * @param framebuffer\n * @protected\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n parentTexture._glTextures[this.CONTEXT_UID].internalFormat, framebuffer.width, framebuffer.height);\n }\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n * @param framebuffer\n * @param mipLevel\n * @protected\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n }\n else if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n parentTexture._glTextures[this.CONTEXT_UID].internalFormat, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else\n {\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled.\n * @param framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n * @param samples - number of samples\n * @returns - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n * @param framebuffer - by default it blits \"into itself\", from renderBuffer to texture.\n * @param sourcePixels - source rectangle in pixels\n * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(\n sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom,\n destPixels.left, destPixels.top, destPixels.right, destPixels.bottom,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, framebuffer.glFramebuffers[this.CONTEXT_UID].framebuffer);\n }\n\n /**\n * Disposes framebuffer.\n * @param framebuffer - framebuffer that has to be disposed of\n * @param contextLost - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n this.disposeFramebuffer(fbo.blitFramebuffer, contextLost);\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them.\n * @param [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(FramebufferSystem);\n", "import { BUFFER_TYPE, ENV } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { settings } from '@pixi/settings';\n\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Dict } from '@pixi/utils';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { Program } from '../shader/Program';\nimport type { Shader } from '../shader/Shader';\nimport type { ISystem } from '../system/ISystem';\nimport type { Geometry } from './Geometry';\nimport type { GLBuffer } from './GLBuffer';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'geometry',\n };\n\n /**\n * `true` if we has `*_vertex_array_object` extension.\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\n }\n\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n // @TODO: We don't know if VAO is supported.\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n gl.bindVertexArray(null);\n bufferSystem.unbind(BUFFER_TYPE.ARRAY_BUFFER);\n\n return vao;\n }\n\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, attribute.divisor);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draws the currently bound geometry.\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(GeometrySystem);\n", "import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` 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 * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @readonly\n */\n public mapCoord: Matrix;\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 * @default 0\n */\n public clampOffset: number;\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 * @default 0.5\n */\n public clampMargin: number;\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n */\n readonly uClampFrame: Float32Array;\n\n /** Normalized clamp offset. Calculated based on clampOffset. */\n readonly uClampOffset: Float32Array;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _textureID: number;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _updateID: number;\n _texture: Texture;\n\n /**\n * If texture size is the same as baseTexture.\n * @default false\n * @readonly\n */\n isSimple: boolean;\n\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n\n this.clampOffset = 0;\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n this.isSimple = false;\n }\n\n /** Texture property. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\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 [forceUpdate=false] - if true, matrices will be updated any case\n * @returns - Whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._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 this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n", "var fragment = \"varying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform sampler2D mask;\\nuniform float alpha;\\nuniform float npmAlpha;\\nuniform vec4 maskClamp;\\n\\nvoid main(void)\\n{\\n float clip = step(3.5,\\n step(maskClamp.x, vMaskCoord.x) +\\n step(maskClamp.y, vMaskCoord.y) +\\n step(vMaskCoord.x, maskClamp.z) +\\n step(vMaskCoord.y, maskClamp.w));\\n\\n vec4 original = texture2D(uSampler, vTextureCoord);\\n vec4 masky = texture2D(mask, vMaskCoord);\\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\\n\\n original *= (alphaMul * masky.r * alpha * clip);\\n\\n gl_FragColor = original;\\n}\\n\";\n\nexport { fragment as default };\n//# sourceMappingURL=spriteMaskFilter2.mjs.map\n", "var vertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 otherMatrix;\\n\\nvarying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\\n}\\n\";\n\nexport { vertex as default };\n//# sourceMappingURL=spriteMaskFilter3.mjs.map\n", "import { Matrix } from '@pixi/math';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\nimport { Filter } from '../Filter';\nimport fragment from './spriteMaskFilter.frag';\nimport vertex from './spriteMaskFilter.vert';\n\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport type { Point } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Texture } from '../../textures/Texture';\nimport type { FilterSystem } from '../FilterSystem';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\n\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\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.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n", "import { MASK_TYPES } from '@pixi/constants';\nimport { Filter } from '../filters/Filter';\n\nimport type { COLOR_MASK_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport type { Matrix, Rectangle } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { ISpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link PIXI.MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.Filter.defaultMultisample\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /** Color mask. */\n public colorMask: COLOR_MASK_BITS;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @private\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n * @private\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * pre-computed color mask\n * @private\n */\n _colorMask: number;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = Filter.defaultMultisample;\n this.enabled = true;\n this.colorMask = 0xf;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._colorMask = 0xf;\n this._target = null;\n }\n\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /**\n * Copies counters from maskData above, called from pushMask().\n * @param maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n", "import { MASK_TYPES } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MaskData } from './MaskData';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { IMaskTarget } from './MaskData';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n * @memberof PIXI\n */\nexport class MaskSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'mask',\n };\n\n /**\n * Flag to enable scissor masking.\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf;\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.pushColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.popColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject.\n * @param maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (!maskObject)\n {\n maskData.type = MASK_TYPES.COLOR;\n }\n else if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * @param maskData - Sprite to be used as the mask.\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param maskData - Sprite to be used as the mask.\n */\n popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n /**\n * Pushes the color mask.\n * @param maskData - The mask data\n */\n pushColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n /**\n * Pops the color mask.\n * @param maskData - The mask data\n */\n popColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = this.maskStack.length > 0\n ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(MaskSystem);\n", "import type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\n\nconst tempMatrix = new Matrix();\nconst rectPool: Rectangle[] = [];\n\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n * @memberof PIXI\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'scissor',\n };\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n const rect = maskObject.getBounds(true, rectPool.pop() ?? new Rectangle());\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n }\n\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData - mask data\n * @returns whether Whether the object can be scissor mask\n */\n public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\n\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n * @param maskData - The mask data.\n */\n pop(maskData?: MaskData): void\n {\n const { gl } = this.renderer;\n\n if (maskData)\n {\n rectPool.push(maskData._scissorRectLocal);\n }\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n\nextensions.add(ScissorSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { settings } from '@pixi/settings';\nimport { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'stencil',\n };\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n const colorMask = maskData._colorMask;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 1) !== 0,\n (colorMask & 2) !== 0,\n (colorMask & 4) !== 0,\n (colorMask & 8) !== 0\n );\n }\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n const maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n const colorMask = maskData ? maskData._colorMask : 0xf;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 0x1) !== 0,\n (colorMask & 0x2) !== 0,\n (colorMask & 0x4) !== 0,\n (colorMask & 0x8) !== 0\n );\n }\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n}\n\nextensions.add(StencilSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { deprecation } from '@pixi/utils';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\nexport interface IRendererPlugins extends GlobalMixins.IRendererPlugins\n{\n [key: string]: any;\n}\n\n/**\n * Manages the functionality that allows users to extend pixi functionality via additional plugins.\n * @memberof PIXI\n */\nexport class PluginSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: '_plugin',\n };\n\n /** @ignore */\n public rendererPlugins: IRendererPlugins;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n public readonly plugins: IRendererPlugins;\n private renderer: IRenderer;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n\n // #if _DEBUG\n Object.defineProperties(this.plugins, {\n extract: {\n enumerable: false,\n get()\n {\n deprecation('7.0.0', 'renderer.plugins.extract has moved to renderer.extract');\n\n return (renderer as any).extract;\n },\n },\n prepare: {\n enumerable: false,\n get()\n {\n deprecation('7.0.0', 'renderer.plugins.prepare has moved to renderer.prepare');\n\n return (renderer as any).prepare;\n },\n },\n interaction: {\n enumerable: false,\n get()\n {\n deprecation('7.0.0', 'renderer.plugins.interaction has been deprecated, use renderer.events');\n\n return (renderer as any).events;\n },\n },\n });\n // #endif\n }\n\n /**\n * Initialize the plugins.\n * @protected\n */\n init(): void\n {\n const staticMap = this.rendererPlugins;\n\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this.renderer);\n }\n }\n\n destroy(): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n }\n}\n\nextensions.add(PluginSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix } from '@pixi/math';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n * @memberof PIXI\n */\nexport class ProjectionSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'projection',\n };\n\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link PIXI.RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture.\n * It is expected\n * that you dirty the current bindings when calling this manually.\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n * @param _destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n * @param _matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(ProjectionSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix, Transform } from '@pixi/math';\nimport { RenderTexture } from './RenderTexture';\n\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Rectangle } from '@pixi/math';\nimport type { IRenderableContainer, IRenderableObject, IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\nconst tempTransform = new Transform();\n\n// TODO could this just be part of extract?\nexport interface IGenerateTextureOptions\n{\n /** The scale mode of the texture. Optional, defaults to `PIXI.BaseTexture.defaultOptions.scaleMode`. */\n scaleMode?: SCALE_MODES;\n /** The resolution / device pixel ratio of the texture being generated. Optional defaults to Renderer resolution. */\n resolution?: number;\n /**\n * The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n */\n region?: Rectangle;\n /** The number of samples of the frame buffer. */\n multisample?: MSAA_QUALITY;\n}\n\n/**\n * System that manages the generation of textures from the renderer.\n * @memberof PIXI\n */\nexport class GenerateTextureSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: 'textureGenerator',\n };\n\n renderer: IRenderer;\n\n private readonly _tempMatrix: Matrix;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n\n this._tempMatrix = new Matrix();\n }\n\n /**\n * A 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 * @param displayObject - The displayObject the object will be generated from.\n * @param {IGenerateTextureOptions} options - Generate texture options.\n * @returns a shiny new texture of the display object passed in\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture\n {\n const { region: manualRegion, ...textureOptions } = options || {};\n\n const region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n this._tempMatrix.tx = -region.x;\n this._tempMatrix.ty = -region.y;\n\n const transform = displayObject.transform;\n\n displayObject.transform = tempTransform;\n\n this.renderer.render(displayObject, {\n renderTexture,\n transform: this._tempMatrix,\n skipUpdateTransform: !!displayObject.parent,\n blit: true,\n });\n\n displayObject.transform = transform;\n\n return renderTexture;\n }\n\n destroy(): void\n {\n // ka boom!\n }\n}\n\nextensions.add(GenerateTextureSystem);\n", "import { Color } from '@pixi/color';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { Rectangle } from '@pixi/math';\n\nimport type { ColorSource } from '@pixi/color';\nimport type { BUFFER_BITS } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { ISize } from '@pixi/math';\nimport type { MaskData } from '../mask/MaskData';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { RenderTexture } from './RenderTexture';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n * @memberof PIXI\n */\nexport class RenderTextureSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'renderTexture',\n };\n\n /* eslint-enable max-len */\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /** Does the renderer have alpha and are its color channels stored premultipled by the alpha channel? */\n private _rendererPremultipliedAlpha: boolean;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n\n protected contextChange(): void\n {\n const attributes = this.renderer?.gl.getContextAttributes();\n\n this._rendererPremultipliedAlpha = !!(attributes && attributes.alpha && attributes.premultipliedAlpha);\n }\n\n /**\n * Bind the current render texture.\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer._view.screen.width;\n tempRect.height = renderer._view.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour.\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(clearColor?: ColorSource, mask?: BUFFER_BITS): void\n {\n const fallbackColor = this.current\n ? this.current.baseTexture.clear\n : this.renderer.background.backgroundColor;\n const color = Color.shared.setValue(clearColor ? clearColor : fallbackColor);\n\n if ((this.current && this.current.baseTexture.alphaMode > 0)\n || (!this.current && this._rendererPremultipliedAlpha))\n {\n color.premultiply(color.alpha);\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer._view.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n\n this.renderer.framebuffer.clear(color.red, color.green, color.blue, color.alpha, mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(RenderTextureSystem);\n", "import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n * @memberof PIXI\n */\nexport class GLProgram\n{\n /** The shader program. */\n public program: WebGLProgram;\n\n /**\n * Holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands.\n */\n public uniformData: Dict;\n\n /**\n * UniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n */\n public uniformGroups: Dict;\n\n /** A hash that stores where UBOs are bound to on the program. */\n public uniformBufferBindings: Dict;\n\n /** A hash for lazily-generated uniform uploading functions. */\n public uniformSync: Dict;\n\n /**\n * A place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n\n /** Destroys this program. */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n", "import { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\nimport type { IAttributeData } from '../Program';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.startsWith('gl_'))\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n", "import { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\n\nimport type { IUniformData } from '../Program';\n\n/**\n * returns the uniform data from the program\n * @private\n * @param program - the webgl program\n * @param gl - the WebGL context\n * @returns {object} the uniform data for this program\n */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n", "import { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\n\nimport type { IRenderingContext } from '../../IRenderer';\nimport type { IGLUniformData } from '../GLProgram';\nimport type { Program } from '../Program';\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n const transformFeedbackVaryings = program.extra?.transformFeedbackVaryings;\n\n if (transformFeedbackVaryings)\n {\n if (typeof gl.transformFeedbackVaryings !== 'function')\n {\n // #if _DEBUG\n console.warn(`TransformFeedback is not supported but TransformFeedbackVaryings are given.`);\n // #endif\n }\n else\n {\n gl.transformFeedbackVaryings(\n webGLProgram,\n transformFeedbackVaryings.names,\n transformFeedbackVaryings.bufferMode === 'separate'\n ? gl.SEPARATE_ATTRIBS\n : gl.INTERLEAVED_ATTRIBS\n );\n }\n }\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc))\n {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n", "import { mapSize } from '../utils';\nimport { uniformParsers } from './uniformParsers';\n\nimport type { Dict } from '@pixi/utils';\nimport type { Buffer } from '../../geometry/Buffer';\nimport type { Renderer } from '../../Renderer';\nimport type { IUniformData } from '../Program';\nimport type { UniformGroup } from '../UniformGroup';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\n float: `\n data[offset] = v;\n `,\n vec2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n `,\n vec3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n `,\n vec4: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n `,\n mat2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n `,\n mat3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n `,\n mat4: `\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n `\n};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement\n{\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\n\n/**\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n * @ignore\n * @param uniformData\n */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n `];\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${remainder};\n }\n\n `);\n }\n else\n {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\nimport { generateProgram } from './utils/generateProgram';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Dict } from '@pixi/utils';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { GLProgram } from './GLProgram';\nimport type { Program } from './Program';\nimport type { Shader } from './Shader';\nimport type { UniformGroup } from './UniformGroup';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'shader',\n };\n\n /**\n * The current WebGL rendering context.\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n private systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.disposeRunner.add(this);\n\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param glProgram\n * @param syncData\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Syncs uniform buffers\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\n\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n * @returns The glProgram for the currently bound Shader for this context\n */\n getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n * @param shader - The shader that the glProgram will be based on.\n * @returns A shiny new glProgram!\n */\n generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Disposes shader.\n * If disposing one equals with current shader, set current as null.\n * @param shader - Shader object\n */\n disposeShader(shader: Shader): void\n {\n if (this.shader === shader)\n {\n this.shader = null;\n }\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n\nextensions.add(ShaderSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Options for the startup system.\n * @memberof PIXI\n */\nexport interface StartupSystemOptions\n{\n /**\n * Whether to log the version and type information of renderer to console.\n * @memberof PIXI.IRendererOptions\n */\n hello: boolean;\n}\n\n/**\n * A simple system responsible for initiating the renderer.\n * @memberof PIXI\n */\nexport class StartupSystem implements ISystem\n{\n /** @ignore */\n static defaultOptions: StartupSystemOptions = {\n /**\n * {@link PIXI.IRendererOptions.hello}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n hello: false,\n };\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: 'startup',\n };\n\n readonly renderer: IRenderer;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * It all starts here! This initiates every system, passing in the options for any system by name.\n * @param options - the config for the renderer and all its systems\n */\n run(options: StartupSystemOptions): void\n {\n const { renderer } = this;\n\n renderer.runners.init.emit(renderer.options);\n\n if (options.hello)\n {\n // eslint-disable-next-line no-console\n console.log(`PixiJS ${'$_VERSION'} - ${renderer.rendererLogId} - https://pixijs.com`);\n }\n\n renderer.resize(renderer.screen.width, renderer.screen.height);\n }\n\n destroy(): void\n {\n // ka pow!\n }\n}\n\nextensions.add(StartupSystem);\n", "import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @returns {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\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.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\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 array[BLEND_MODES.NONE] = [0, 0];\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.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n", "import { BLEND_MODES } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { State } from './State';\nimport { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'state',\n };\n\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {Function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {Function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n\nextensions.add(StateSystem);\n", "import { Runner } from '@pixi/runner';\nimport { EventEmitter } from '@pixi/utils';\n\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem, ISystemConstructor } from './ISystem';\n\ninterface ISystemConfig\n{\n runners: string[],\n systems: Record>\n priority: string[];\n}\n\n/**\n * The SystemManager is a class that provides functions for managing a set of systems\n * This is a base class, that is generic (no render code or knowledge at all)\n * @memberof PIXI\n */\nexport class SystemManager extends EventEmitter\n{\n /** a collection of runners defined by the user */\n readonly runners: {[key: string]: Runner} = {};\n\n private _systemsHash: Record = {};\n\n /**\n * Set up a system with a collection of SystemClasses and runners.\n * Systems are attached dynamically to this class when added.\n * @param config - the config for the system manager\n */\n setup(config: ISystemConfig): void\n {\n this.addRunners(...config.runners);\n\n // Remove keys that aren't available\n const priority = (config.priority ?? []).filter((key) => config.systems[key]);\n\n // Order the systems by priority\n const orderByPriority = [\n ...priority,\n ...Object.keys(config.systems)\n .filter((key) => !priority.includes(key))\n ];\n\n for (const i of orderByPriority)\n {\n this.addSystem(config.systems[i], i);\n }\n }\n\n /**\n * Create a bunch of runners based of a collection of ids\n * @param runnerIds - the runner ids to add\n */\n addRunners(...runnerIds: string[]): void\n {\n runnerIds.forEach((runnerId) =>\n {\n this.runners[runnerId] = new Runner(runnerId);\n });\n }\n\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this as any as R);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n this._systemsHash[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * A function that will run a runner and call the runners function but pass in different options\n * to each system based on there name.\n *\n * E.g. If you have two systems added called `systemA` and `systemB` you could call do the following:\n *\n * ```js\n * system.emitWithCustomOptions(init, {\n * systemA: {...optionsForA},\n * systemB: {...optionsForB},\n * });\n * ```\n *\n * `init` would be called on system A passing `optionsForA` and on system B passing `optionsForB`.\n * @param runner - the runner to target\n * @param options - key value options for each system\n */\n emitWithCustomOptions(runner: Runner, options: Record): void\n {\n const systemHashKeys = Object.keys(this._systemsHash);\n\n runner.items.forEach((system) =>\n {\n // I know this does not need to be a performant function so it.. isn't!\n // its only used for init and destroy.. we can refactor if required..\n const systemName = systemHashKeys.find((systemId) => this._systemsHash[systemId] === system);\n\n system[runner.name](options[systemName]);\n });\n }\n\n /** destroy the all runners and systems. Its apps job to */\n destroy(): void\n {\n Object.values(this.runners).forEach((runner) =>\n {\n runner.destroy();\n });\n\n this._systemsHash = {};\n }\n\n // TODO implement!\n // removeSystem(ClassRef: ISystemConstructor, name: string): void\n // {\n\n // }\n}\n", "import { GC_MODES } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { ISystem } from '../system/ISystem';\nimport type { Texture } from './Texture';\n\nexport interface IUnloadableTexture\n{\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @memberof PIXI\n */\nexport class TextureGCSystem implements ISystem\n{\n /**\n * Default garbage collection mode.\n * @static\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n * @see PIXI.TextureGCSystem#mode\n */\n public static defaultMode = GC_MODES.AUTO;\n\n /**\n * Default maximum idle frames before a texture is destroyed by garbage collection.\n * @static\n * @default 3600\n * @see PIXI.TextureGCSystem#maxIdle\n */\n public static defaultMaxIdle = 60 * 60;\n\n /**\n * Default frames between two garbage collections.\n * @static\n * @default 600\n * @see PIXI.TextureGCSystem#checkCountMax\n */\n public static defaultCheckCountMax = 60 * 10;\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'textureGC',\n };\n\n /**\n * Frame count since started.\n * @readonly\n */\n public count: number;\n\n /**\n * Frame count since last garbage collection.\n * @readonly\n */\n public checkCount: number;\n\n /**\n * Maximum idle frames before a texture is destroyed by garbage collection.\n * @see PIXI.TextureGCSystem.defaultMaxIdle\n */\n public maxIdle: number;\n\n /**\n * Frames between two garbage collections.\n * @see PIXI.TextureGCSystem.defaultCheckCountMax\n */\n public checkCountMax: number;\n\n /**\n * Current garbage collection mode.\n * @see PIXI.TextureGCSystem.defaultMode\n */\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = TextureGCSystem.defaultMaxIdle;\n this.checkCountMax = TextureGCSystem.defaultCheckCountMax;\n this.mode = TextureGCSystem.defaultMode;\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 protected postrender(): void\n {\n if (!this.renderer.objectRenderer.renderingToScreen)\n {\n return;\n }\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(): void\n {\n const tm = this.renderer.texture;\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 as any).framebuffer && 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 * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(TextureGCSystem);\n", "import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context.\n * @memberof PIXI\n */\nexport class GLTexture\n{\n /** The WebGL texture. */\n public texture: WebGLTexture;\n\n /** Width of texture that was used in texImage2D. */\n public width: number;\n\n /** Height of texture that was used in texImage2D. */\n public height: number;\n\n /** Whether mip levels has to be generated. */\n public mipmap: boolean;\n\n /** WrapMode copied from baseTexture. */\n public wrapMode: number;\n\n /** Type copied from baseTexture. */\n public type: number;\n\n /** Type copied from baseTexture. */\n public internalFormat: number;\n\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n /** Texture contents dirty flag. */\n dirtyId: number;\n\n /** Texture style dirty flag. */\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.dirtyId = -1;\n this.dirtyStyleId = -1;\n this.mipmap = false;\n this.wrapMode = 33071;\n this.type = TYPES.UNSIGNED_BYTE;\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n", "import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @returns Lookup table.\n */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n{ [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n", "import { MIPMAP_MODES, SAMPLER_TYPES, SCALE_MODES, TYPES, WRAP_MODES } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { removeItems } from '@pixi/utils';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { Texture } from './Texture';\n\n/**\n * System plugin to the renderer to manage textures.\n * @memberof PIXI\n */\nexport class TextureSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'texture',\n };\n\n /**\n * Bound textures.\n * @readonly\n */\n public boundTextures: BaseTexture[];\n\n /**\n * List of managed textures.\n * @readonly\n */\n public managedTextures: Array;\n\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n\n /**\n * BaseTexture value that shows that we don't know what is bound.\n * @readonly\n */\n protected unknownTexture: BaseTexture;\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @private\n */\n protected _unknownBoundTextures: boolean;\n\n /**\n * Current location.\n * @readonly\n */\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this system works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n this.boundTextures = [];\n this.currentLocation = -1;\n this.managedTextures = [];\n\n this._unknownBoundTextures = false;\n this.unknownTexture = new BaseTexture();\n\n this.hasIntegerTextures = false;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n * @param texture - Texture to bind\n * @param [location=0] - Location to bind at\n */\n bind(texture: Texture | BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture?.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n else if (glTexture.dirtyStyleId !== texture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture.\n * @param texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\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 multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n * @param maxTextures - number of locations to check\n */\n ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n * @private\n * @param texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else\n {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource?.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n * @private\n * @param texture - the texture to destroy\n * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_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\n /**\n * Update texture style such as mipmap flag\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource?.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n * @private\n * @param texture - Texture to update\n * @param glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n\nextensions.add(TextureSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { ISystem } from '../system/ISystem';\nimport type { TransformFeedback } from './TransformFeedback';\n\n/**\n * TransformFeedbackSystem provides TransformFeedback of WebGL2\n * https://developer.mozilla.org/en-US/docs/Web/API/WebGLTransformFeedback\n *\n * For example, you can use TransformFeedbackSystem to implement GPU Particle or\n * general purpose computing on GPU (aka GPGPU).\n *\n * It also manages a lifetime of GLTransformFeedback object\n * @memberof PIXI\n */\nexport class TransformFeedbackSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'transformFeedback',\n };\n\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * Bind TransformFeedback and buffers\n * @param transformFeedback - TransformFeedback to bind\n */\n bind(transformFeedback: TransformFeedback)\n {\n const { gl, CONTEXT_UID } = this;\n\n const glTransformFeedback = transformFeedback._glTransformFeedbacks[CONTEXT_UID]\n || this.createGLTransformFeedback(transformFeedback);\n\n gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, glTransformFeedback);\n }\n\n /** Unbind TransformFeedback */\n unbind()\n {\n const { gl } = this;\n\n gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);\n }\n\n /**\n * Begin TransformFeedback\n * @param drawMode - DrawMode for TransformFeedback\n * @param shader - A Shader used by TransformFeedback. Current bound shader will be used if not provided.\n */\n beginTransformFeedback(drawMode: DRAW_MODES, shader?: Shader)\n {\n const { gl, renderer } = this;\n\n if (shader)\n {\n renderer.shader.bind(shader);\n }\n\n gl.beginTransformFeedback(drawMode);\n }\n\n /** End TransformFeedback */\n endTransformFeedback()\n {\n const { gl } = this;\n\n gl.endTransformFeedback();\n }\n\n /**\n * Create TransformFeedback and bind buffers\n * @param tf - TransformFeedback\n * @returns WebGLTransformFeedback\n */\n protected createGLTransformFeedback(tf: TransformFeedback)\n {\n const { gl, renderer, CONTEXT_UID } = this;\n\n const glTransformFeedback = gl.createTransformFeedback();\n\n tf._glTransformFeedbacks[CONTEXT_UID] = glTransformFeedback;\n gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, glTransformFeedback);\n for (let i = 0; i < tf.buffers.length; i++)\n {\n const buffer = tf.buffers[i];\n\n if (!buffer) continue;\n\n renderer.buffer.update(buffer);\n buffer._glBuffers[CONTEXT_UID].refCount++;\n\n gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, i, buffer._glBuffers[CONTEXT_UID].buffer || null);\n }\n gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);\n\n tf.disposeRunner.add(this);\n\n return glTransformFeedback;\n }\n\n /**\n * Disposes TransfromFeedback\n * @param {PIXI.TransformFeedback} tf - TransformFeedback\n * @param {boolean} [contextLost=false] - If context was lost, we suppress delete TransformFeedback\n */\n disposeTransformFeedback(tf: TransformFeedback, contextLost?: boolean): void\n {\n const glTF = tf._glTransformFeedbacks[this.CONTEXT_UID];\n const gl = this.gl;\n\n tf.disposeRunner.remove(this);\n\n const bufferSystem = this.renderer.buffer;\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < tf.buffers.length; i++)\n {\n const buffer = tf.buffers[i];\n\n if (!buffer) continue;\n\n const buf = buffer._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffer, contextLost);\n }\n }\n }\n }\n\n if (!glTF)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteTransformFeedback(glTF);\n }\n\n delete tf._glTransformFeedbacks[this.CONTEXT_UID];\n }\n\n destroy(): void\n {\n // @TODO: Destroy managed TransformFeedbacks\n this.renderer = null;\n }\n}\n\nextensions.add(TransformFeedbackSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { ICanvas } from '@pixi/settings';\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Options for the view system.\n * @memberof PIXI\n */\nexport interface ViewSystemOptions\n{\n /**\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @memberof PIXI.IRendererOptions\n */\n view?: ICanvas;\n /**\n * The width of the renderer's view.\n * @memberof PIXI.IRendererOptions\n */\n width?: number;\n /**\n * The height of the renderer's view.\n * @memberof PIXI.IRendererOptions\n */\n height?: number;\n /**\n * The resolution / device pixel ratio of the renderer.\n * @memberof PIXI.IRendererOptions\n */\n resolution?: number;\n /**\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @memberof PIXI.IRendererOptions\n */\n autoDensity?: boolean;\n}\n\n/**\n * The view system manages the main canvas that is attached to the DOM.\n * This main role is to deal with how the holding the view reference and dealing with how it is resized.\n * @memberof PIXI\n */\nexport class ViewSystem implements ISystem\n{\n /** @ignore */\n static defaultOptions = {\n /**\n * {@link PIXI.IRendererOptions.width}\n * @default 800\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n width: 800,\n /**\n * {@link PIXI.IRendererOptions.height}\n * @default 600\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n height: 600,\n /**\n * {@link PIXI.IRendererOptions.resolution}\n * @type {number}\n * @default PIXI.settings.RESOLUTION\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n resolution: settings.RESOLUTION,\n /**\n * {@link PIXI.IRendererOptions.autoDensity}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n autoDensity: false,\n };\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: '_view',\n };\n\n private renderer: IRenderer;\n\n /**\n * The resolution / device pixel ratio of the renderer.\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n public screen: Rectangle;\n\n /**\n * The canvas element that everything is drawn to.\n * @member {PIXI.ICanvas}\n */\n public element: ICanvas;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n * @member {boolean}\n */\n public autoDensity: boolean;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * initiates the view system\n * @param {PIXI.ViewOptions} options - the options for the view\n */\n init(options: ViewSystemOptions): void\n {\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n this.element = options.view || settings.ADAPTER.createCanvas() as ICanvas;\n\n this.resolution = options.resolution || settings.RESOLUTION;\n\n this.autoDensity = !!options.autoDensity;\n }\n\n /**\n * Resizes the screen and canvas to the specified dimensions.\n * @param desiredScreenWidth - The new width of the screen.\n * @param desiredScreenHeight - The new height of the screen.\n */\n resizeView(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.element.width = Math.round(desiredScreenWidth * this.resolution);\n this.element.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.element.width / this.resolution;\n const screenHeight = this.element.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.element.style.width = `${screenWidth}px`;\n this.element.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.renderer.emit('resize', screenWidth, screenHeight);\n this.renderer.runners.resize.emit(this.screen.width, this.screen.height);\n }\n\n /**\n * Destroys this System and optionally removes the canvas from the dom.\n * @param {boolean} [removeView=false] - Whether to remove the canvas from the DOM.\n */\n destroy(removeView: boolean): void\n {\n // ka boom!\n if (removeView)\n {\n this.element.parentNode?.removeChild(this.element);\n }\n\n this.renderer = null;\n this.element = null;\n this.screen = null;\n }\n}\n\nextensions.add(ViewSystem);\n", "import { ENV } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { deprecation } from '@pixi/utils';\nimport { BatchRenderer } from './batch/BatchRenderer';\nimport { Filter } from './filters/Filter';\nimport { Program } from './shader/Program';\nimport { BackgroundSystem, ContextSystem, StartupSystem, TextureGCSystem, ViewSystem } from './systems';\nimport { BaseTexture } from './textures/BaseTexture';\n\nimport type { GC_MODES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, SCALE_MODES, WRAP_MODES } from '@pixi/constants';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Assets Loader}.\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\n/**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {PIXI.IRendererOptions}\n */\nsettings.RENDER_OPTIONS = {\n ...ContextSystem.defaultOptions,\n ...BackgroundSystem.defaultOptions,\n ...ViewSystem.defaultOptions,\n ...StartupSystem.defaultOptions,\n};\n\nObject.defineProperties(settings, {\n /**\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @deprecated since 7.1.0\n * @see PIXI.BaseTexture.defaultOptions.wrapMode\n */\n WRAP_MODE: {\n get()\n {\n return BaseTexture.defaultOptions.wrapMode;\n },\n set(value: WRAP_MODES)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode');\n // #endif\n BaseTexture.defaultOptions.wrapMode = value;\n },\n },\n\n /**\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @deprecated since 7.1.0\n * @see PIXI.BaseTexture.defaultOptions.scaleMode\n */\n SCALE_MODE: {\n get()\n {\n return BaseTexture.defaultOptions.scaleMode;\n },\n set(value: SCALE_MODES)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode');\n // #endif\n BaseTexture.defaultOptions.scaleMode = value;\n },\n },\n\n /**\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @deprecated since 7.1.0\n * @see PIXI.BaseTexture.defaultOptions.mipmap\n */\n MIPMAP_TEXTURES:\n {\n get()\n {\n return BaseTexture.defaultOptions.mipmap;\n },\n set(value: MIPMAP_MODES)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap');\n // #endif\n BaseTexture.defaultOptions.mipmap = value;\n },\n // MIPMAP_MODES.POW2,\n },\n\n /**\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @deprecated since 7.1.0\n * @see PIXI.BaseTexture.defaultOptions.anisotropicLevel\n */\n ANISOTROPIC_LEVEL:\n {\n get()\n {\n return BaseTexture.defaultOptions.anisotropicLevel;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation(\n '7.1.0', 'settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel');\n // #endif\n BaseTexture.defaultOptions.anisotropicLevel = value;\n },\n\n },\n /**\n * Default filter resolution.\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @deprecated since 7.1.0\n * @type {number}\n * @see PIXI.Filter.defaultResolution\n */\n FILTER_RESOLUTION: {\n get()\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution');\n // #endif\n\n return Filter.defaultResolution;\n },\n set(value)\n {\n Filter.defaultResolution = value;\n },\n },\n\n /**\n * Default filter samples.\n * @static\n * @name FILTER_MULTISAMPLE\n * @memberof PIXI.settings\n * @deprecated since 7.1.0\n * @type {PIXI.MSAA_QUALITY}\n * @see PIXI.Filter.defaultMultisample\n */\n FILTER_MULTISAMPLE: {\n get()\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample');\n // #endif\n\n return Filter.defaultMultisample;\n },\n set(value: MSAA_QUALITY)\n {\n Filter.defaultMultisample = value;\n },\n },\n\n /**\n * The maximum textures that this device supports.\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @deprecated since 7.1.0\n * @see PIXI.BatchRenderer.defaultMaxTextures\n * @type {number}\n */\n SPRITE_MAX_TEXTURES: {\n get()\n {\n return BatchRenderer.defaultMaxTextures;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures');\n // #endif\n BatchRenderer.defaultMaxTextures = value;\n },\n },\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @see PIXI.BatchRenderer.defaultBatchSize\n * @deprecated since 7.1.0\n * @type {number}\n */\n SPRITE_BATCH_SIZE: {\n get()\n {\n return BatchRenderer.defaultBatchSize;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize');\n // #endif\n BatchRenderer.defaultBatchSize = value;\n },\n },\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @see PIXI.BatchRenderer.canUploadSameBuffer\n * @deprecated since 7.1.0\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: {\n get()\n {\n return BatchRenderer.canUploadSameBuffer;\n },\n set(value: boolean)\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.1.0', 'settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer');\n // #endif\n BatchRenderer.canUploadSameBuffer = value;\n },\n },\n\n /**\n * Default Garbage Collection mode.\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @deprecated since 7.1.0\n * @see PIXI.TextureGCSystem.defaultMode\n */\n GC_MODE: {\n get()\n {\n return TextureGCSystem.defaultMode;\n },\n set(value: GC_MODES)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode');\n // #endif\n TextureGCSystem.defaultMode = value;\n },\n },\n\n /**\n * Default Garbage Collection max idle.\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @deprecated since 7.1.0\n * @see PIXI.TextureGCSystem.defaultMaxIdle\n */\n GC_MAX_IDLE: {\n get()\n {\n return TextureGCSystem.defaultMaxIdle;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle');\n // #endif\n TextureGCSystem.defaultMaxIdle = value;\n },\n },\n\n /**\n * Default Garbage Collection maximum check count.\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @deprecated since 7.1.0\n * @see PIXI.TextureGCSystem.defaultCheckCountMax\n */\n GC_MAX_CHECK_COUNT: {\n get()\n {\n return TextureGCSystem.defaultCheckCountMax;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax');\n // #endif\n TextureGCSystem.defaultCheckCountMax = value;\n },\n },\n\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @deprecated since 7.1.0\n * @see PIXI.Program.defaultVertexPrecision\n */\n PRECISION_VERTEX: {\n get()\n {\n return Program.defaultVertexPrecision;\n },\n set(value: PRECISION)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision');\n // #endif\n Program.defaultVertexPrecision = value;\n },\n },\n\n /**\n * Default specify float precision in fragment shader.\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @deprecated since 7.1.0\n * @see PIXI.Program.defaultFragmentPrecision\n */\n PRECISION_FRAGMENT: {\n get()\n {\n return Program.defaultFragmentPrecision;\n },\n set(value: PRECISION)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision');\n // #endif\n Program.defaultFragmentPrecision = value;\n },\n },\n});\n", "/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n * @static\n * @memberof PIXI\n * @enum {number}\n */\nexport enum UPDATE_PRIORITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /**\n * Highest priority used for interaction events in {@link PIXI.EventSystem}\n * @default 50\n */\n INTERACTION = 50,\n /**\n * High priority updating, used by {@link PIXI.AnimatedSprite}\n * @default 25\n */\n HIGH = 25,\n /**\n * Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @default 0\n */\n NORMAL = 0,\n /**\n * Low priority used for {@link PIXI.Application} rendering.\n * @default -25\n */\n LOW = -25,\n /**\n * Lowest priority used for {@link PIXI.BasePrepare} utility.\n * @default -50\n */\n UTILITY = -50,\n}\n", "import type { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @returns Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).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 * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\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 * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\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 { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n /**\n * Target frames per millisecond.\n * @static\n */\n public static targetFPMS = 0.06;\n\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n public autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.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 * @default 16.66\n */\n public elapsedMS: number;\n /**\n * The last time {@link PIXI.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 public lastTime = -1;\n /**\n * Factor of current {@link PIXI.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 public speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n private _lastFrame = -1;\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 * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / Ticker.targetFPMS;\n this.elapsedMS = 1 / Ticker.targetFPMS;\n\n this._tick = (time: number): void =>\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 * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\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 * @private\n */\n private _startIfPossible(): void\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 * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\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 * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\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 * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\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 * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn: TickerCallback, context?: T): this\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 * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy(): void\n {\n if (!this._protected)\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 /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.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 * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\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 elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * Ticker.targetFPMS;\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.deltaMS = 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#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS(): number\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#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `Ticker.targetFPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / Ticker.targetFPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, Ticker.targetFPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * import { Ticker } from 'pixi.js';\n *\n * const ticker = 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 *\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 *\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * import { autoDetectRenderer, Container } from 'pixi.js';\n *\n * // You may use the shared ticker to render...\n * const renderer = autoDetectRenderer();\n * const stage = new Container();\n * document.body.appendChild(renderer.view);\n * ticker.add((time) => renderer.render(stage));\n *\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * const animate = (time) => {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * };\n * animate(performance.now());\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.BasePrepare} for core timing\n * functionality that shouldn't usually need to be paused, unlike the `shared`\n * ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n", "import { settings } from '@pixi/settings';\nimport { deprecation } from '@pixi/utils';\nimport { Ticker } from './Ticker';\n\nObject.defineProperties(settings, {\n /**\n * Target frames per millisecond.\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @deprecated since 7.1.0\n * @see PIXI.Ticker.targetFPMS\n */\n TARGET_FPMS: {\n get()\n {\n return Ticker.targetFPMS;\n },\n set(value: number)\n {\n // #if _DEBUG\n deprecation('7.1.0', 'settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS');\n // #endif\n\n Ticker.targetFPMS = value;\n },\n },\n});\n\nexport { settings };\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\n\nexport interface TickerPluginOptions\n{\n /**\n * Automatically starts the rendering after the construction.\n * **Note**: 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 * @memberof PIXI.IApplicationOptions\n * @default true\n */\n autoStart?: boolean;\n /**\n * Set`true` to use `Ticker.shared`, `false` to create new ticker.\n * If set to `false`, you cannot register a handler to occur before anything that runs on the shared ticker.\n * The system ticker will always run before both the shared ticker and the app ticker.\n * @memberof PIXI.IApplicationOptions\n * @default false\n */\n sharedTicker?: boolean;\n}\n\n/**\n * Middleware for for Application Ticker.\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\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()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n\nextensions.add(TickerPlugin);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ICanvas } from '@pixi/settings';\nimport type { IRenderer, IRendererOptions } from './IRenderer';\n\n/**\n * Renderer options supplied to `autoDetectRenderer`.\n * @memberof PIXI\n */\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n /**\n * Force CanvasRenderer even if WebGL is supported. Only available with **pixi.js-legacy**.\n * @default false\n */\n forceCanvas?: boolean;\n}\n\nexport interface IRendererConstructor\n{\n test(options?: Partial): boolean;\n new (options?: Partial): IRenderer;\n}\n\n/**\n * Collection of installed Renderers.\n * @ignore\n */\nconst renderers: IRendererConstructor[] = [];\n\nextensions.handleByList(ExtensionType.Renderer, renderers);\n\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 * @memberof PIXI\n * @function autoDetectRenderer\n * @param options - Options to use.\n */\nexport function autoDetectRenderer(options?: Partial): IRenderer\n{\n for (const RendererType of renderers)\n {\n if (RendererType.test(options))\n {\n return new RendererType(options) as IRenderer;\n }\n }\n\n throw new Error('Unable to auto-detect a suitable renderer.');\n}\n", "import { MSAA_QUALITY } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * System that manages the multisample property on the WebGL renderer\n * @memberof PIXI\n */\nexport class MultisampleSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: '_multisample',\n };\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n\n private renderer: Renderer;\n\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n let samples;\n\n if (this.renderer.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n destroy(): void\n {\n // ka boom!\n }\n}\n\nextensions.add(MultisampleSystem);\n", "export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n", "import { extensions, ExtensionType } from '@pixi/extensions';\nimport { GLBuffer } from './GLBuffer';\n\nimport type { BUFFER_TYPE } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\nimport type { Buffer } from './Buffer';\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n * @class\n * @memberof PIXI\n */\nexport class BufferSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'buffer',\n };\n\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\n\n unbind(type: BUFFER_TYPE): void\n {\n const { gl } = this;\n\n gl.bindBuffer(type, null);\n }\n\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n\nextensions.add(BufferSystem);\n", "import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Matrix } from '@pixi/math';\nimport type { IRenderableObject, IRendererRenderOptions } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * system that provides a render function that focussing on rendering Pixi Scene Graph objects\n * to either the main view or to a renderTexture. Used for Canvas `WebGL` contexts\n * @memberof PIXI\n */\nexport class ObjectRendererSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: 'objectRenderer',\n };\n\n renderer: Renderer;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n renderingToScreen: boolean;\n\n /**\n * the last object rendered by the renderer. Useful for other plugins like interaction managers\n * @readonly\n */\n lastObjectRendered: IRenderableObject;\n\n // renderers scene graph!\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param options - the options to be passed to the renderer\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void\n {\n const renderer = this.renderer;\n\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n renderer.runners.prerender.emit();\n renderer.emit('prerender');\n\n // apply a transform at a GPU level\n renderer.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (renderer.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this.lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n renderer.renderTexture.bind(renderTexture);\n renderer.batch.currentRenderer.start();\n\n if (clear ?? renderer.background.clearBeforeRender)\n {\n renderer.renderTexture.clear();\n }\n\n displayObject.render(renderer);\n\n // apply transform..\n renderer.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n if (options.blit)\n {\n renderer.framebuffer.blit();\n }\n\n renderTexture.baseTexture.update();\n }\n\n renderer.runners.postrender.emit();\n\n // reset transform after render\n renderer.projection.transform = null;\n\n renderer.emit('postrender');\n }\n\n destroy(): void\n {\n // ka pow!\n this.renderer = null;\n this.lastObjectRendered = null;\n }\n}\n\nextensions.add(ObjectRendererSystem);\n", "import { RENDERER_TYPE } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\nimport { Matrix } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { deprecation, isWebGLSupported } from '@pixi/utils';\nimport { UniformGroup } from './shader/UniformGroup';\nimport { SystemManager } from './system/SystemManager';\n\nimport type { ColorSource } from '@pixi/color';\nimport type { MSAA_QUALITY } from '@pixi/constants';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { Rectangle } from '@pixi/math';\nimport type { ICanvas } from '@pixi/settings';\nimport type { BackgroundSystem } from './background/BackgroundSystem';\nimport type { BatchSystem } from './batch/BatchSystem';\nimport type { ContextSystem } from './context/ContextSystem';\nimport type { FilterSystem } from './filters/FilterSystem';\nimport type { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport type { MultisampleSystem } from './framebuffer/MultisampleSystem';\nimport type { BufferSystem } from './geometry/BufferSystem';\nimport type { GeometrySystem } from './geometry/GeometrySystem';\nimport type { IRenderableObject, IRenderer, IRendererOptions, IRendererRenderOptions, IRenderingContext } from './IRenderer';\nimport type { MaskSystem } from './mask/MaskSystem';\nimport type { ScissorSystem } from './mask/ScissorSystem';\nimport type { StencilSystem } from './mask/StencilSystem';\nimport type { IRendererPlugins, PluginSystem } from './plugin/PluginSystem';\nimport type { ProjectionSystem } from './projection/ProjectionSystem';\nimport type { ObjectRendererSystem } from './render/ObjectRendererSystem';\nimport type { GenerateTextureSystem, IGenerateTextureOptions } from './renderTexture/GenerateTextureSystem';\nimport type { RenderTexture } from './renderTexture/RenderTexture';\nimport type { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport type { ShaderSystem } from './shader/ShaderSystem';\nimport type { StartupSystem } from './startup/StartupSystem';\nimport type { StateSystem } from './state/StateSystem';\nimport type { TextureGCSystem } from './textures/TextureGCSystem';\nimport type { TextureSystem } from './textures/TextureSystem';\nimport type { TransformFeedbackSystem } from './transformFeedback/TransformFeedbackSystem';\nimport type { ViewSystem } from './view/ViewSystem';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Renderer extends GlobalMixins.Renderer {}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatches, 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 * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n *\n * | Generic Systems | Systems that manage functionality that all renderer types share |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.ViewSystem} | This manages the main view of the renderer usually a Canvas |\n * | {@link PIXI.PluginSystem} | This manages plugins for the renderer |\n * | {@link PIXI.BackgroundSystem} | This manages the main views background color and alpha |\n * | {@link PIXI.StartupSystem} | Boots up a renderer and initiatives all the systems |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n *\n * | WebGL Core Systems | Provide an optimised, easy to use API to work with WebGL |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n * | {@link PIXI.MultisampleSystem} | This manages the multisample const on the WEbGL Renderer |\n *\n * | PixiJS High-Level Systems | Set of specific systems designed to work with PixiJS objects |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.GenerateTextureSystem} | This adds the ability to generate textures from any PIXI.DisplayObject |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link PIXI.MaskSystem} |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link PIXI.MaskSystem} |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.Prepare} | This manages uploading assets to the GPU. |\n * | {@link PIXI.Extract} | This extracts image data from display objects. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n * @memberof PIXI\n */\nexport class Renderer extends SystemManager implements IRenderer\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.Renderer,\n priority: 1,\n };\n\n /**\n * The type of the renderer. will be PIXI.RENDERER_TYPE.CANVAS\n * @member {number}\n * @see PIXI.RENDERER_TYPE\n */\n public readonly type = RENDERER_TYPE.WEBGL;\n\n /**\n * Options passed to the constructor.\n * @type {PIXI.IRendererOptions}\n */\n public readonly options: IRendererOptions;\n\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /**\n * Global uniforms\n * Add any uniforms you want shared across your shaders.\n * the must be added before the scene is rendered for the first time\n * as we dynamically buildcode to handle all global var per shader\n *\n */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public readonly mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public readonly context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public readonly state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public readonly shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public readonly texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public readonly buffer: BufferSystem;\n\n /**\n * TransformFeedback system instance\n * @readonly\n */\n public transformFeedback: TransformFeedbackSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public readonly geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public readonly framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public readonly scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public readonly stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public readonly projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public readonly textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public readonly filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public readonly renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public readonly batch: BatchSystem;\n\n /**\n * plugin system instance\n * @readonly\n */\n public readonly _plugin: PluginSystem;\n\n /**\n * _multisample system instance\n * @readonly\n */\n public readonly _multisample: MultisampleSystem;\n\n /**\n * textureGenerator system instance\n * @readonly\n */\n public readonly textureGenerator: GenerateTextureSystem;\n\n /**\n * background system instance\n * @readonly\n */\n public readonly background: BackgroundSystem;\n\n /**\n * _view system instance\n * @readonly\n */\n public readonly _view: ViewSystem;\n\n /**\n * _render system instance\n * @readonly\n */\n public readonly objectRenderer: ObjectRendererSystem;\n\n /**\n * startup system instance\n * @readonly\n */\n public readonly startup: StartupSystem;\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @param options\n * @private\n */\n static test(options?: Partial): boolean\n {\n if (options?.forceCanvas)\n {\n return false;\n }\n\n return isWebGLSupported();\n }\n\n /**\n * @param {PIXI.IRendererOptions} [options] - See {@link PIXI.settings.RENDER_OPTIONS} for defaults.\n */\n constructor(options?: Partial)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n const systemConfig = {\n runners: [\n 'init',\n 'destroy',\n 'contextChange',\n 'resolutionChange',\n 'reset',\n 'update',\n 'postrender',\n 'prerender',\n 'resize'\n ],\n systems: Renderer.__systems,\n priority: [\n '_view',\n 'textureGenerator',\n 'background',\n '_plugin',\n 'startup',\n // low level WebGL systems\n 'context',\n 'state',\n 'texture',\n 'buffer',\n 'geometry',\n 'framebuffer',\n 'transformFeedback',\n // high level pixi specific rendering\n 'mask',\n 'scissor',\n 'stencil',\n 'projection',\n 'textureGC',\n 'filter',\n 'renderTexture',\n 'batch',\n 'objectRenderer',\n '_multisample'\n ],\n };\n\n this.setup(systemConfig);\n\n if ('useContextAlpha' in options)\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead');\n // #endif\n options.premultipliedAlpha = options.useContextAlpha && options.useContextAlpha !== 'notMultiplied';\n options.backgroundAlpha = options.useContextAlpha === false ? 1 : options.backgroundAlpha;\n }\n\n this._plugin.rendererPlugins = Renderer.__plugins;\n this.options = options as IRendererOptions;\n this.startup.run(this.options);\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param {object} [options] - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void\n {\n this.objectRenderer.render(displayObject, options);\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this._view.resizeView(desiredScreenWidth, desiredScreenHeight);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n * @returns Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixijs/issues/2233\n */\n destroy(removeView = false): void\n {\n this.runners.destroy.items.reverse();\n\n this.emitWithCustomOptions(this.runners.destroy, {\n _view: removeView,\n });\n\n super.destroy();\n }\n\n /** Collection of plugins */\n get plugins(): IRendererPlugins\n {\n return this._plugin.plugins;\n }\n\n /** The number of msaa samples of the canvas. */\n get multisample(): MSAA_QUALITY\n {\n return this._multisample.multisample;\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this._view.element.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @default 600\n */\n get height(): number\n {\n return this._view.element.height;\n }\n\n /** The resolution / device pixel ratio of the renderer. */\n get resolution(): number\n {\n return this._view.resolution;\n }\n set resolution(value: number)\n {\n this._view.resolution = value;\n this.runners.resolutionChange.emit(value);\n }\n\n /** Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. */\n get autoDensity(): boolean\n {\n return this._view.autoDensity;\n }\n\n /** The canvas element that everything is drawn to.*/\n get view(): ICanvas\n {\n return this._view.element;\n }\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n get screen(): Rectangle\n {\n return this._view.screen;\n }\n\n /** the last object rendered by the renderer. Useful for other plugins like interaction managers */\n get lastObjectRendered(): IRenderableObject\n {\n return this.objectRenderer.lastObjectRendered;\n }\n\n /** Flag if we are rendering to the screen vs renderTexture */\n get renderingToScreen(): boolean\n {\n return this.objectRenderer.renderingToScreen;\n }\n\n /** When logging Pixi to the console, this is the name we will show */\n get rendererLogId(): string\n {\n return `WebGL ${this.context.webGLVersion}`;\n }\n\n /**\n * This sets weather the screen is totally cleared between each frame withthe background color and alpha\n * @deprecated since 7.0.0\n */\n get clearBeforeRender(): boolean\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead.');\n // #endif\n\n return this.background.clearBeforeRender;\n }\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @deprecated since 7.0.0\n * @member {boolean}\n */\n get useContextAlpha(): boolean | 'notMultiplied'\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead.');\n // #endif\n\n return this.context.useContextAlpha;\n }\n\n /**\n * readonly drawing buffer preservation\n * we can only know this if Pixi created the context\n * @deprecated since 7.0.0\n */\n get preserveDrawingBuffer(): boolean\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context');\n // #endif\n\n return this.context.preserveDrawingBuffer;\n }\n\n /**\n * The background color to fill if not transparent\n * @member {number}\n * @deprecated since 7.0.0\n */\n get backgroundColor(): ColorSource\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.backgroundColor has been deprecated, use renderer.background.color instead.');\n // #endif\n\n return this.background.color;\n }\n\n set backgroundColor(value: ColorSource)\n {\n // #if _DEBUG\n deprecation('7.0.0', 'renderer.backgroundColor has been deprecated, use renderer.background.color instead.');\n // #endif\n\n this.background.color = value;\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n * @deprecated since 7.0.0\n */\n get backgroundAlpha(): number\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.');\n // #endif\n\n return this.background.alpha;\n }\n\n /**\n * @deprecated since 7.0.0\n */\n set backgroundAlpha(value: number)\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.');\n // #endif\n\n this.background.alpha = value;\n }\n\n /**\n * @deprecated since 7.0.0\n */\n get powerPreference(): WebGLPowerPreference\n {\n // #if _DEBUG\n // eslint-disable-next-line max-len\n deprecation('7.0.0', 'renderer.powerPreference has been deprecated, we can only know this if pixi creates the context');\n // #endif\n\n return this.context.powerPreference;\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 * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.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 * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @returns A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture\n {\n return this.textureGenerator.generateTexture(displayObject, options);\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 * @private\n */\n static readonly __plugins: IRendererPlugins = {};\n\n /**\n * The collection of installed systems.\n * @private\n */\n static readonly __systems: Record = {};\n}\n\n// Handle registration of extensions\nextensions.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins);\nextensions.handleByMap(ExtensionType.RendererSystem, Renderer.__systems);\nextensions.add(Renderer);\n", "import { BaseTexture } from '../BaseTexture';\nimport { autoDetectResource } from './autoDetectResource';\nimport { Resource } from './Resource';\n\nimport type { ISize } from '@pixi/math';\nimport type { IAutoDetectOptions } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n * @memberof PIXI\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\n\n /**\n * Used from ArrayResource and CubeResource constructors.\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n * @param resource\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture.\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture.\n * @param baseTexture\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @returns - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n", "import { TARGETS } from '@pixi/constants';\nimport { AbstractMultiResource } from './AbstractMultiResource';\n\nimport type { ISize } from '@pixi/math';\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\nimport type { BaseImageResource } from './BaseImageResource';\n\n/**\n * A resource that contains a number of sources.\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(source: number | Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n", "import { BaseImageResource } from './BaseImageResource';\n\nimport type { ICanvas } from '@pixi/settings';\n\n/**\n * Resource type for HTMLCanvasElement and OffscreenCanvas.\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ICanvas)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement\n {\n const { OffscreenCanvas } = globalThis;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n", "import { TARGETS } from '@pixi/constants';\nimport { AbstractMultiResource } from './AbstractMultiResource';\n\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\nimport type { Resource } from './Resource';\n\n/**\n * Constructor options for CubeResource.\n * @memberof PIXI\n */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n * @protected\n */\n linkBaseTexture: boolean;\n\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n * @param renderer\n * @param _baseTexture\n * @param glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ICanvas } from '@pixi/settings';\nimport type { Renderer } from '../../Renderer';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageBitmapResourceOptions\n{\n /** Start loading process automatically when constructed. */\n autoLoad?: boolean;\n\n /** Load image using cross origin. */\n crossOrigin?: boolean;\n\n /** Alpha mode used when creating the ImageBitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for ImageBitmap.\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /** URL of the image source. */\n url: string | null;\n\n /**\n * Load image using cross origin.\n * @default false\n */\n crossOrigin: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES | null;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /**\n * @param source - ImageBitmap or URL to use\n * @param options\n * @param {boolean} [options.autoLoad=true] - Start loading process automatically when constructed.\n * @param {boolean} [options.crossOrigin=true] - Load image using cross origin.\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=null] - Alpha mode used when creating the ImageBitmap.\n */\n constructor(source: ImageBitmap | string, options?: IImageBitmapResourceOptions)\n {\n options = options || {};\n\n let baseSource;\n let url;\n\n if (typeof source === 'string')\n {\n baseSource = ImageBitmapResource.EMPTY;\n url = source;\n }\n else\n {\n baseSource = source;\n url = null;\n }\n // Using super() in if() can cause transpilation problems in some cases, so take it out of if().\n // See https://github.com/pixijs/pixijs/pull/9093 for details.\n super(baseSource);\n this.url = url;\n\n this.crossOrigin = options.crossOrigin ?? true;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise(async (resolve, reject) =>\n {\n if (this.url === null)\n {\n resolve(this);\n\n return;\n }\n\n try\n {\n const response = await settings.ADAPTER.fetch(this.url, {\n mode: this.crossOrigin ? 'cors' : 'no-cors'\n });\n\n if (this.destroyed) return;\n\n const imageBlob = await response.blob();\n\n if (this.destroyed) return;\n\n const imageBitmap = await createImageBitmap(imageBlob, {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n });\n\n if (this.destroyed) return;\n\n this.source = imageBitmap;\n this.update();\n\n resolve(this);\n }\n catch (e)\n {\n if (this.destroyed) return;\n\n reject(e);\n this.onError.emit(e);\n }\n });\n\n return this._load;\n }\n\n /**\n * Upload the image bitmap resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n override upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (!(this.source instanceof ImageBitmap))\n {\n this.load();\n\n return false;\n }\n\n if (typeof this.alphaMode === 'number')\n {\n baseTexture.alphaMode = this.alphaMode;\n }\n\n return super.upload(renderer, baseTexture, glTexture);\n }\n\n /** Destroys this resource. */\n override dispose(): void\n {\n if (this.source instanceof ImageBitmap)\n {\n this.source.close();\n }\n\n super.dispose();\n\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if current environment support ImageBitmap, and source is string or ImageBitmap\n */\n static override test(source: unknown): source is string | ImageBitmap\n {\n return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined'\n && (typeof source === 'string' || source instanceof ImageBitmap);\n }\n\n /**\n * Cached empty placeholder canvas.\n * @see EMPTY\n */\n private static _EMPTY: ICanvas;\n\n /**\n * ImageBitmap cannot be created synchronously, so a empty placeholder canvas is needed when loading from URLs.\n * Only for internal usage.\n * @returns The cached placeholder canvas.\n */\n private static get EMPTY(): ICanvas\n {\n ImageBitmapResource._EMPTY = ImageBitmapResource._EMPTY ?? settings.ADAPTER.createCanvas(0, 0);\n\n return ImageBitmapResource._EMPTY;\n }\n}\n", "import { settings } from '@pixi/settings';\nimport { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ISize } from '@pixi/math';\nimport type { ICanvas } from '@pixi/settings';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean | string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean | string;\n\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(settings.ADAPTER.createCanvas());\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.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 // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as ICanvas;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using a regular expression.\n * @param svgString - a serialized svg element\n * @returns - image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\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 /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} - If the source is a SVG source or data file\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && source.startsWith('data:image/svg+xml'))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n }\n\n /**\n * Regular expression for SVG XML document.\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n", "import { Ticker } from '@pixi/ticker';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean | string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@link HTMLVideoElement}.\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use Ticker.shared to auto update the base texture.\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\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 * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: this | PromiseLike) => void;\n\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n constructor(\n source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions\n )\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixijs/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n * @param _deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n * @param event\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n * @returns - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (!source.paused && !source.ended && this._isSourceReady());\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n * @returns - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState > 2;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.includes(extension);\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n", "import { ArrayResource } from './ArrayResource';\nimport { INSTALLED } from './autoDetectResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\n\nexport * from './BaseImageResource';\nexport * from './Resource';\n\nINSTALLED.push(\n ImageBitmapResource,\n ImageResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './autoDetectResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageBitmapResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\n", "import { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, GLTexture, Resource, Renderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Texture } from '@pixi/core';\n\n/**\n * Types of image sources supported by {@link AtlasResource}.\n *\n * @public\n */\nexport type AtlasResourceSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData | ArrayBufferView;\n\n/**\n * An item that is uploaded to the atlas texture.\n *\n * @public\n */\nexport type AtlasResourceItem =\n{\n /**\n * The location of the atlas item in the base-texture's space.\n */\n frame: Rectangle;\n\n /**\n * The source of the texture data.\n */\n source: AtlasResourceSource;\n\n /**\n * This flags when the resource is to be re-uploaded.\n */\n dirtyId: number;\n\n /**\n * This flags when the resource is uploaded and update-to-date with the dirty ID.\n */\n updateId: number;\n\n /**\n * The texture holding this item.\n */\n texture: Texture;\n};\n\n/**\n * An {@code AtlasResource} is used by {@link AtlasAllocator} to manage texture sources\n *\n * @public\n */\nexport class AtlasResource extends Resource\n{\n /**\n * The list of managed resources in the atlas.\n */\n public managedItems: AtlasResourceItem[];\n\n /**\n * Creates an atlas resource.\n *\n * @param width\n * @param height\n */\n constructor(width: number, height: number)\n {\n super(width, height);\n\n this.managedItems = [];\n }\n\n /**\n * Uploads the atlas.\n *\n * @param renderer\n * @param baseTexture\n * @param glTexture\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl: WebGLRenderingContext = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK)\n\n // Allocate the texture on the GPU\n if (glTexture.width !== width ||\n glTexture.height !== height)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n baseTexture.format,\n width,\n height,\n 0,\n baseTexture.format,\n baseTexture.type,\n undefined\n );\n }\n\n const items = this.managedItems;\n\n // Upload all atlas items.\n for (let i = 0, j = items.length; i < j; i++)\n {\n this.uploadItem(\n renderer,\n baseTexture.target,\n baseTexture.format,\n baseTexture.type,\n items[i]\n );\n }\n\n return true;\n }\n\n /**\n * Uploads the atlas item to the GPU.\n *\n * @param renderer - The renderer holding the WebGL context.\n * @param target - The binding point of the base-texture.\n * @param format - The format of the base-texture.\n * @param type - The type of the base-texture data.\n * @param item - The item to upload.\n */\n protected uploadItem(\n renderer: Renderer,\n target: number,\n format: number,\n type: number,\n item: AtlasResourceItem\n ): void\n {\n // see https://github.com/rapideditor/pixi-texture-allocator/issues/2\n // if (item.updateId === item.dirtyId)\n // {\n // return;\n // }\n\n const gl: WebGLRenderingContext = renderer.gl;\n const isWebGL2 = (gl instanceof WebGL2RenderingContext);\n const frame = item.frame;\n let source = item.source;\n\n // if WebGL1, convert whatever we have into a typed array\n if (!isWebGL2) {\n if (source instanceof ImageData) {\n source = source.data; // pass the typed array directly\n\n } else if (source instanceof HTMLCanvasElement) {\n const ctx = source.getContext('2d');\n const [w, h] = [source.width, source.height];\n source = ctx.getImageData(0, 0, w, h).data;\n\n } else if (source instanceof HTMLImageElement) {\n const [w, h] = [source.naturalWidth, source.naturalHeight];\n const canvas = document.createElement('canvas');\n canvas.width = w;\n canvas.height = h;\n\n const ctx = canvas.getContext('2d');\n ctx.drawImage(source, 0, 0);\n source = ctx.getImageData(0, 0, w, h).data;\n }\n }\n\n gl.texSubImage2D(\n target,\n 0,\n frame.x,\n frame.y,\n frame.width,\n frame.height,\n format,\n type,\n source as any,\n );\n\n item.updateId = item.dirtyId;\n }\n}", "import { Rectangle } from '@pixi/math';\nimport { Area, AreaOrientation } from './Area';\n\nimport type { AreaAllocator } from './AreaAllocator';\nimport type { AreaField } from './Area';\n\n/**\n * An allocator node is represented as a tuple. The zeroth element is the parent of the node. The first element\n * always exists and is the texture area it wholly represents. The second element is whether the rectangle\n * is allocated or free. The last element is optional and is the list\n * of its children.\n *\n * @public\n * @ignore\n */\nexport type AreaNode = [AreaNode, AreaField, boolean] | [AreaNode, AreaField, AreaNode[]];\n\n/**\n * Pointer to guillotene node.\n *\n * @public\n * @ignore\n */\nexport type AreaPtr = { __mem_area: AreaNode };\n\n/**\n * @public\n * @ignore\n */\nexport enum SPLIT_ORIENTATION {\n HOR = 0,\n VERT = 1,\n NONE = 2\n}\n\nconst tempRect = new Rectangle();\n\n/** @public */\nexport class GuilloteneAllocator implements AreaAllocator\n{\n protected _root: AreaNode;\n\n private _width: number;\n private _height: number;\n\n constructor(width: number, height: number)\n {\n this._width = width;\n this._height = height;\n\n // NOTE: getFrame assumes root node is always horizontal!\n this._root = [\n null,\n Area.makeArea(0, this._height, AreaOrientation.HORIZONTAL),\n false\n ];\n }\n\n /**\n * Allocates an area of the given `width` and `height`.\n *\n * @param width - The width required for the allocated area.\n * @param height - The height required for the allocated area.\n * @param rect - An optional `Rectangle` instance to put the resulting area frame into.\n * @return The rectangle frame of the area allocated.\n */\n allocate(width: number, height: number, rect?: Rectangle): Rectangle & AreaPtr\n {\n const area = this.findArea(width, height);\n\n if (!area)\n {\n return null;\n }\n\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n this.getFrame(area, rect);\n\n const hole = new Rectangle(rect.x, rect.y, width, height);\n const node = this.split(area, rect, hole);\n\n rect.copyFrom(hole);\n (rect as any).__mem_area = node;\n\n return rect as (Rectangle & AreaPtr);\n }\n\n /**\n * Frees the area represented by the given area pointer. The original rectangle returned by\n * {@link GuilloteneAllocator#allocate} included this pointer (the `__mem_area` property).\n *\n * @param areaPtr\n */\n free(areaPtr: AreaPtr): void\n {\n const area = areaPtr.__mem_area;\n\n area[2] = false;\n this.merge(area);\n }\n\n get width(): number\n {\n return this._width;\n }\n\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Returns the [area]{@link Area} data for the node.\n *\n * @param node\n * @returns The area data for the node.\n */\n protected getAreaField(node: AreaNode): AreaField\n {\n return node[1];\n }\n\n /**\n * Returns the rectangle covered by the area node.\n *\n * @param node - The node whose covered rectangular area is needed.\n * @param rect - An optional `Rectangle` instance to put the data in.\n * @return The rectangle covered by `node`.\n */\n protected getFrame(node: AreaNode, rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n const nodeArea = this.getAreaField(node);\n const nodeParent = this.getParent(node);\n const nodeOrientation = Area.getOrientation(nodeArea);\n const nodeOpen = Area.getOpenOffset(nodeArea);\n const nodeClose = Area.getCloseOffset(nodeArea);\n const parentOpen = nodeParent ? Area.getOpenOffset(nodeParent[1]) : 0;\n const parentClose = nodeParent ? Area.getCloseOffset(nodeParent[1]) : this._width;// (because root node is horizontal)\n\n if (nodeOrientation) // VERTICAL\n {\n rect.x = nodeOpen;\n rect.y = parentOpen;\n rect.width = nodeClose - rect.x;\n rect.height = parentClose - parentOpen;\n }\n else // HORIZONTAL\n {\n rect.x = parentOpen;\n rect.y = nodeOpen;\n rect.width = parentClose - rect.x;\n rect.height = nodeClose - rect.y;\n }\n\n return rect;\n }\n\n /**\n * Returns the parent of the area node.\n *\n * @param node\n * @return The parent of `node`\n */\n protected getParent(node: AreaNode): AreaNode\n {\n return node[0];\n }\n\n /**\n * Returns whether the given node has any children.\n *\n * @param node\n * @return Whether the given node has any children.\n */\n protected hasChildren(node: AreaNode): boolean\n {\n return (Array.isArray(node[2]) && (node[2].length !== 0));\n }\n\n /**\n * Returns the children of the passed node, if any.\n *\n * @param node\n */\n protected getChildren(node: AreaNode): AreaNode[]\n {\n if (!Array.isArray(node[2])) {\n throw new Error(\"Children don't exist\")\n }\n\n return node[2];\n }\n\n protected addChild(parent: AreaNode, ...nodes: AreaNode[]): void\n {\n parent[2] = Array.isArray(parent[2]) ? parent[2] : []\n parent[2].push(...nodes)\n }\n\n /**\n * Finds an area node with minimum width `aw` and minimum height `ah`.\n *\n * @param aw\n * @param ah\n */\n protected findArea(aw: number, ah: number): AreaNode\n {\n return this.findAreaRecursive(this._root, aw, ah);\n }\n\n /**\n * The recursive implementation for {@link AreaAllocator#findArea}.\n *\n * @param rootArea\n * @param aw\n * @param ah\n */\n protected findAreaRecursive(rootArea: AreaNode, aw: number, ah: number): AreaNode\n {\n const frame = this.getFrame(rootArea, tempRect);\n\n if (frame.width < aw || frame.height < ah)\n {\n return null;\n }\n\n if (!this.hasChildren(rootArea))\n {\n const dx = frame.width - aw;\n const dy = frame.height - ah;\n\n if (dx < 0 || dy < 0 || rootArea[2])\n {\n return null;\n }\n\n return rootArea;\n }\n\n const children = this.getChildren(rootArea);\n\n let bestCandidate = null;\n let bestCandidateScore = Infinity;\n\n for (let i = 0, j = children.length; i < j; i++)\n {\n const candidate = this.findAreaRecursive(children[i], aw, ah);\n\n if (!candidate)\n {\n continue;\n }\n\n const candidateFrame = this.getFrame(candidate, tempRect);\n\n const dx = candidateFrame.width - aw;\n const dy = candidateFrame.height - ah;\n\n if (dx < 0 || dy < 0)\n {\n continue;\n }\n if (!dx && !dy)\n {\n // Perfect fit!\n return candidate;\n }\n\n const score = Math.min(dx, dy);\n\n if (bestCandidateScore > score)\n {\n bestCandidate = candidate;\n bestCandidateScore = score;\n }\n }\n\n return bestCandidate;\n }\n\n /**\n * Returns the orientation of the primary split of host.\n */\n protected splitOrientation(host: Rectangle, hole: Rectangle): SPLIT_ORIENTATION\n {\n if (hole.width === host.width && hole.height === host.height) {\n return SPLIT_ORIENTATION.NONE;\n }\n if (hole.width === host.width) {\n return SPLIT_ORIENTATION.VERT;\n }\n if (hole.height === host.height) {\n return SPLIT_ORIENTATION.HOR;\n }\n\n // ____________________\n // | | |\n // | | |\n // | hole | |\n // | | |\n // |________| Primary |\n // | | |\n // | | |\n // | Sec. | |\n // |________|_________|\n const horAreaDiff = Math.abs(\n // (Primary) Right\n (host.width - hole.width) * host.height -\n // (Secondary) Bottom\n hole.width * (host.height - hole.height)\n )\n\n // ____________________\n // | | |\n // | | |\n // | hole | Sec. |\n // | | |\n // |________|_________|\n // | |\n // | Primary |\n // |__________________|\n const verAreaDiff = Math.abs(\n // (Primary) Bottom\n host.width * (host.height - hole.height) -\n (host.width - hole.width) * hole.height\n )\n\n if (horAreaDiff > verAreaDiff)\n {\n return SPLIT_ORIENTATION.HOR\n }\n else\n {\n return SPLIT_ORIENTATION.VERT\n }\n }\n\n protected split(\n area: AreaNode,\n areaFrame: Rectangle,\n holeFrame: Rectangle,\n orientation: SPLIT_ORIENTATION = this.getParent(area) ? this.splitOrientation(areaFrame, holeFrame) : SPLIT_ORIENTATION.HOR\n ): AreaNode\n {\n if (area[2] === true)\n {\n throw new Error('Cannot deallocate')\n }\n if (orientation === SPLIT_ORIENTATION.NONE)\n {\n area[2] = true;\n return area;\n }\n\n return this[orientation === SPLIT_ORIENTATION.HOR\n ? 'splitPrimaryHorizontal'\n : 'splitPrimaryVertical'](area, areaFrame, holeFrame);\n }\n\n private splitPrimaryHorizontal(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area))\n {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const firstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n []\n ];\n const secondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.HORIZONTAL) {\n this.addChild(area, firstChild, secondChild)\n } else {\n const i = this.getChildren(parent).indexOf(area);\n\n firstChild[0] = parent;\n secondChild[0] = parent;\n\n this.getChildren(parent).splice(i, 1, firstChild, secondChild);\n }\n\n if (holeFrame.height !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n this.addChild(firstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (firstChild as AreaNode)[2] = true;\n }\n\n return firstChild;\n }\n\n private splitPrimaryVertical(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area)) {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const primaryFirstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n []\n ];\n const primarySecondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.VERTICAL)\n {\n this.addChild(area, primaryFirstChild, primarySecondChild);\n }\n else\n {\n const i = this.getChildren(parent).indexOf(area);\n primaryFirstChild[0] = parent;\n primarySecondChild[0] = parent;\n this.getChildren(parent).splice(i, 1, primaryFirstChild, primarySecondChild);\n }\n\n if (holeFrame.width !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n this.addChild(primaryFirstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (primaryFirstChild as AreaNode)[2] = true;\n }\n\n return primaryFirstChild;\n }\n\n protected merge(\n area: AreaNode\n ) {\n if (this.hasChildren(area))\n {\n throw new Error(\"Cannot merge a non-leaf node\");\n }\n\n const parent = this.getParent(area);\n\n if (!parent)\n {\n return;\n }\n\n const siblings = this.getChildren(parent);\n const i = siblings.indexOf(area);\n\n const leftSibling = siblings[i - 1];\n const rightSibling = siblings[i + 1];\n\n if (rightSibling && rightSibling[2] === false)\n {\n // Merge rightSibling into area\n area[1] = Area.setCloseOffset(area[1], Area.getCloseOffset(rightSibling[1]));\n siblings.splice(i + 1, 1);\n }\n if (leftSibling && leftSibling[2] === false)\n {\n // Merge leftSibling into area\n area[1] = Area.setOpenOffset(area[1], Area.getOpenOffset(leftSibling[1]));\n siblings.splice(i - 1, 1);\n }\n\n if (siblings.length === 1) {\n parent[2] = false;\n this.merge(parent);\n }\n }\n\n private printState(area: AreaNode): void\n {\n if (!this.hasChildren(area)) {\n console.log({ ...this.getFrame(area) }, area[2])\n } else {\n this.getChildren(area).forEach(n => this.printState(n))\n }\n }\n}", "import { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { Rectangle } from '@pixi/math';\n\nimport type { TextureSlab } from './TextureSlab';\n\nconst tempRect = new Rectangle();\n\n/**\n * The texture allocator dynamically manages space on base-texture slabs. It can be used to generate\n * atlases on demand, which improve batching efficiency.\n *\n * @public\n */\nexport class TextureAllocator\n{\n /**\n * The width of texture slabs.\n */\n public readonly slabWidth: number;\n\n /**\n * The height of texture slabs.\n */\n public readonly slabHeight: number;\n\n /**\n * The list of base-textures that are used to allocate texture space.\n */\n protected textureSlabs: TextureSlab[];\n\n /**\n * @param slabWidth - The width of base-texture slabs. This should be at most 2048.\n * @param slabHeight - The height of base-texture slabs. This should be at most 2048.\n */\n constructor(slabWidth = 2048, slabHeight = 2048)\n {\n this.slabWidth = slabWidth;\n this.slabHeight = slabHeight;\n\n this.textureSlabs = [];\n }\n\n get maxWidth() {\n return this.slabWidth - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n get maxHeight() {\n return this.slabHeight - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n /**\n * Allocates a texture from this allocator.\n *\n * If its existing slab pool has enough space, the texture is issued from one. Otherwise,\n * a new slab is created and the texture is issued from it. However, if the requested\n * dimensions are larger than slabs themselves, then `null` is always returned.\n *\n * To upload a texture source, you will have to create an atlas-managing {@link Resource}\n * yourself on the base-texture. The {@link AtlasAllocator} does this for you, while the\n * {@link CanvasTextureAllocator} can be used to draw on a canvas-based atlas.\n *\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - The padding requested around the texture, to prevent bleeding.\n * @return The allocated texture, if successful; otherwise, `null`.\n */\n allocate(width: number, height: number, padding = this.calculatePadding(width, height)): T\n {\n // Cannot allocate a texture larger than a texture-slab.\n if (width + 2 * padding > this.slabWidth ||\n height + 2 * padding > this.slabHeight)\n {\n return null;\n }\n\n const slabs = this.textureSlabs;\n\n // Loop through the slabs and find one with enough space, if any.\n for (let i = 0, j = slabs.length; i < j; i++)\n {\n const slab = slabs[i];\n const texture = this.issueTexture(slab, width, height, padding);\n\n if (texture)\n {\n return texture;\n }\n }\n\n // Issue a new slab.\n const slab = this.createSlab();\n\n // Append this slab to the head of the list.\n this.textureSlabs.unshift(slab);\n\n // Issue the texture from this blank slab.\n return this.issueTexture(slab, width, height, padding);\n }\n\n /**\n * Frees the texture and reclaims its space. It is assumed you will not use it again, and have\n * destroyed any resource uploading its data.\n *\n * @param texture\n * @throws When the texture was not located in this allocator.\n */\n free(texture: T): void\n {\n const baseTexture = (texture as Texture).baseTexture;\n const slab = this.textureSlabs.find(sl => sl.slab === baseTexture);\n\n if (!slab)\n {\n throw new Error(\"The texture cannot be freed because \" +\n \"its base-texture is not pooled by this allocator. \" +\n \"This is either a bug in TextureAllocator or you tried to free a \" +\n \"texture that was never allocated by one.\");\n }\n\n const textureEntry = slab.managedTextures.find(entry => entry.texture === texture);\n\n if (!textureEntry)\n {\n throw new Error(\"The texture cannot be freed because it was not found \" +\n \"in the managed list of issued textures on its slab. This may be because you \" +\n \"duplicated this texture or a bug in TextureAllocator\");\n }\n\n slab.managedArea.free(textureEntry.area);\n slab.managedTextures.splice(slab.managedTextures.indexOf(textureEntry), 1);\n }\n\n protected calculatePadding(width: number, height: number): number\n {\n const dimen = Math.max(width, height);\n\n if (dimen < 64)\n {\n return 2;\n }\n else if (dimen < 128)\n {\n return 4;\n }\n else if (dimen < 1024)\n {\n return 8;\n }\n else\n {\n return 16;\n }\n }\n\n /**\n * Creates a texture slab. The slab's base-texture is not backed by any resource. You\n * will have to manage that yourself. See {@link AtlasAllocator} or {@link CanvasTextureAllocator}\n * for better resource semantics.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(null,\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Creates a texture on the given base-texture at {@code frame}.\n *\n * @param baseTexture - The base texture that will hold the texture's space.\n * @param frame - The frame in which the texture will be stored.\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): T\n {\n // Override this method to return correct texture type T.\n return new Texture(baseTexture, frame) as T;\n }\n\n /**\n * Issues a texture from the given texture slab, if possible.\n *\n * @param slab - The texture slab to allocate frame.\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - Padding required around the texture.\n * @return The issued texture, if successful; otherwise, `null`.\n */\n protected issueTexture(slab: TextureSlab, width: number, height: number, padding = 0): T\n {\n const area = slab.managedArea.allocate(width + 2 * padding, height + 2 * padding);\n\n if (!area)\n {\n return null;\n }\n\n tempRect.copyFrom(area);\n tempRect.pad(-padding);\n\n const baseTexture = slab.slab;\n const issuedTexture = this.createTexture(baseTexture, tempRect.clone());\n\n slab.managedTextures.push({\n area,\n texture: issuedTexture,\n });\n\n return issuedTexture;\n }\n}", "import { AtlasResource } from './AtlasResource';\nimport { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\nimport type { AtlasResourceSource } from './AtlasResource';\n\n/**\n * This texture allocator auto-manages the base-texture with an {@link AtlasResource}. You can also\n * pass a texture source to `allocate`, mimicing {@link Texture.from} functionality.\n *\n * @public\n */\nexport class AtlasAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by an {@link AtlasResource}.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(new AtlasResource(this.slabWidth, this.slabHeight),\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Allocates a texture backed by the given atlas source, with the given padding.\n *\n * @override\n * @param width\n * @param height\n * @param padding\n * @param source\n */\n allocate(width: number, height: number, padding?: number, source?: AtlasResourceSource): Texture;\n\n /**\n * Allocates a texture backed by the given source, with default padding.\n *\n * @param width\n * @param height\n * @param source\n */\n allocate(width: number, height: number, source?: AtlasResourceSource): Texture;\n\n allocate(width: number, height: number, paddingOrSource?: number | AtlasResourceSource, source?: AtlasResourceSource): Texture\n {\n let padding: number;\n\n if (typeof paddingOrSource === 'number')\n {\n padding = paddingOrSource;\n }\n else\n {\n padding = this.calculatePadding(width, height);\n source = paddingOrSource;\n }\n\n const texture = super.allocate(width, height, padding);\n\n if (source)\n {\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = {\n frame: texture.frame,\n source,\n // dirtyId !== updateId only if image loaded\n dirtyId: source instanceof HTMLImageElement && !source.complete ? -1 : 0,\n updateId: -1,\n texture,\n };\n\n atlas.managedItems.push(item);\n\n if (source instanceof HTMLImageElement && !source.complete) {\n source.addEventListener('load', () => {\n if (texture.baseTexture.valid && !texture.baseTexture.destroyed && atlas.managedItems.indexOf(item) >= 0) {\n item.dirtyId++;\n texture.baseTexture.update();\n }\n });\n }\n\n texture.baseTexture.update();\n }\n\n return texture;\n }\n\n free(texture: Texture): void\n {\n super.free(texture);\n\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = atlas.managedItems.find(item => item.texture === texture);\n\n if (item)\n {\n atlas.managedItems.splice(atlas.managedItems.indexOf(item), 1);\n }\n }\n}", "import { BaseTexture } from '@pixi/core';\n\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues texture backed by a canvas. You can draw on to that canvas to soruce\n * each texture.\n *\n * @public\n */\nexport class CanvasTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a canvas.\n */\n protected createSlab(): TextureSlab\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = this.slabWidth;\n canvas.height = this.slabHeight;\n\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(canvas, {\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n}", "import { BaseRenderTexture, RenderTexture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\n\nimport type { BaseTexture } from '@pixi/core';\nimport type { Rectangle } from '@pixi/math';\nimport type { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues render-textures, and is otherwise just like {@link TextureAllocator}.\n *\n * @public\n */\nexport class RenderTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a base render-texture.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseRenderTexture({\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n\n /**\n * Creates a render-texture from the given base render-texture.\n *\n * @param baseTexture\n * @param frame\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): RenderTexture\n {\n return new RenderTexture(baseTexture as BaseRenderTexture, frame);\n }\n}"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,UAAI,MAAM,OAAO,UAAU;AAA3B,UACI,SAAS;AASb,eAAS,SAAS;AAAA,MAAC;AASnB,UAAI,OAAO,QAAQ;AACjB,eAAO,YAAY,uBAAO,OAAO,IAAI;AAMrC,YAAI,CAAC,IAAI,OAAO,EAAE;AAAW,mBAAS;AAAA,MACxC;AAWA,eAAS,GAAG,IAAIA,UAAS,MAAM;AAC7B,aAAK,KAAK;AACV,aAAK,UAAUA;AACf,aAAK,OAAO,QAAQ;AAAA,MACtB;AAaA,eAAS,YAAY,SAAS,OAAO,IAAIA,UAAS,MAAM;AACtD,YAAI,OAAO,OAAO,YAAY;AAC5B,gBAAM,IAAI,UAAU,iCAAiC;AAAA,QACvD;AAEA,YAAI,WAAW,IAAI,GAAG,IAAIA,YAAW,SAAS,IAAI,GAC9C,MAAM,SAAS,SAAS,QAAQ;AAEpC,YAAI,CAAC,QAAQ,QAAQ,G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AAClC,YAAM,OAAO,MAAM,aAAa,KAAK,CAAAI,UAAQA,MAAK,YAAY,OAAO;AAErE,UAAI,MACJ;AACI,cAAM,aAAa,OAAO,MAAM,aAAa,QAAQ,IAAI,GAAG,CAAC;AAAA,MACjE;AAAA,IACJ;AAAA,EACJ;;;ACjGO,MAAM,yBAAN,cAAqC,iBAC5C;AAAA;AAAA;AAAA;AAAA,IAIc,aACV;AACI,YAAM,SAAS,SAAS,cAAc,QAAQ;AAE9C,aAAO,QAAQ,KAAK;AACpB,aAAO,SAAS,KAAK;AAErB,aAAO;AAAA,QACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,QACpE,iBAAiB,CAAC;AAAA,QAClB,MAAM,IAAI,YAAY,QAAQ;AAAA,UAC1B,OAAO,KAAK;AAAA,UACZ,QAAQ,KAAK;AAAA,QACjB,CAAC;AAAA,MACL;AAAA,IACJ;AAAA,EACJ;;;ACpBO,MAAM,yBAAN,cAAqC,iBAC5C;AAAA;AAAA;AAAA;AAAA,IAIc,aACV;AACI,aAAO;AAAA,QACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,QACpE,iBAAiB,CAAC;AAAA,QAClB,MAAM,IAAI,kBAAkB;AAAA,UACxB,OAAO,KAAK;AAAA,UACZ,QAAQ,KAAK;AAAA,QACjB,CAAC;AAAA,MACL;AAAA,IACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQU,cAAc,aAA0B,OAClD;AACI,aAAO,IAAI,cAAc,aAAkC,KAAK;AAAA,IACpE;AAAA,EACJ;", "names": ["context", "i", "l", "j", "x", "y", "i", "p", "a", "b", "c", "n", "m", "e", "r", "sign", "a2", "b2", "j", "d", "map", "k", "i", "n", "j", "w", "t", "m", "i", "x", "k", "v", "v", "k", "url", "u", "i", "l", "j", "k", "p", "h", "s", "v", "AreaOrientation", "url", "navigator", "isMobile", "_parse", "_format", "_resolve", "e", "r", "t", "n", "e", "u", "a", "o", "i", "s", "h", "r", "t", "n", "e", "u", "i", "a", "e", "f", "a", "r", "d", "l", "i", "n", "o", "t", "b", "c", "g", "u", "v", "i", "r", "g", "b", "a", "i", "v", "r", "i", "url", "_url", "url", "defaultValue", "map", "a", "b", "i", "i", "i", "format", "i", "Buffer", "interleaveTypedArrays", "i", "j", "UID", "map", "Buffer", "i", "interleaveTypedArrays", "j", "Buffer", "x", "y", "p", "x", "y", "s", "a", "b", "c", "d", "x", "y", "n", "i", "j", "k", "x", "y", "p", "i", "i", "j", "n", "i", "e", "UID", "isMobile", "UID", "Buffer", "i", "fragTemplate", "i", "i", "isMobile", "navigator", "isMobile", "defaultFragment", "defaultVertex", "defaultVertex", "defaultFragment", "vertex", "fragment", "i", "j", "defaultFragment", "defaultVertex", "defaultVertex", "defaultFragment", "i", "j", "i", "url", "resolve", "createImageBitmap", "r", "url", "resolve", "i", "x", "y", "context", "i", "j", "Buffer", "x", "y", "tempPoints", "i", "t", "a", "b", "c", "d", "i", "x", "y", "v", "r", "g", "b", "a", "w", "h", "byteSizeMap", "context", "a", "b", "c", "d", "e", "i", "j", "i", "x", "y", "d", "tempMatrix", "a", "b", "c", "d", "y", "o", "sign", "x", "y", "i", "i", "a", "b", "i", "i", "a", "b", "j", "UID", "i", "BLEND", "OFFSET", "CULLING", "DEPTH_TEST", "WINDING", "DEPTH_MASK", "i", "i", "i", "j", "i", "i", "context", "context", "i", "i", "i", "i", "url", "resolve", "e", "resolve", "i", "resolve", "i", "j", "format", "w", "h", "SPLIT_ORIENTATION", "tempRect", "i", "j", "n", "tempRect", "i", "j", "slab", "item"] } diff --git a/dist/pixi-texture-allocator.mjs b/dist/pixi-texture-allocator.mjs index 6cf1c8f..8316c3b 100644 --- a/dist/pixi-texture-allocator.mjs +++ b/dist/pixi-texture-allocator.mjs @@ -96,9 +96,6 @@ var AtlasResource = class extends Resource { * @param item - The item to upload. */ uploadItem(renderer, target, format, type, item) { - if (item.updateId === item.dirtyId) { - return; - } const gl = renderer.gl; const isWebGL2 = gl instanceof WebGL2RenderingContext; const frame = item.frame; diff --git a/dist/pixi-texture-allocator.mjs.map b/dist/pixi-texture-allocator.mjs.map index 5d38fc8..34107bd 100644 --- a/dist/pixi-texture-allocator.mjs.map +++ b/dist/pixi-texture-allocator.mjs.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/Area.ts", "../src/AtlasResource.ts", "../src/AtlasAllocator.ts", "../src/GuilloteneAllocator.ts", "../src/TextureAllocator.ts", "../src/CanvasTextureAllocator.ts", "../src/RenderTextureAllocator.ts"], - "sourcesContent": ["/**\n * The orientation of an area indicates the axis along which it is split. This is a 1-bit field.\n *\n * @public\n */\nexport enum AreaOrientation {\n HORIZONTAL = 0,\n VERTICAL = 1\n};\n\n/**\n * Alias for the 31-bit field texture-area type.\n *\n * @public\n */\nexport type AreaField = number;\n\n/**\n * An area represents an oriented rectangular region. It is implemented as a 31-bit field. The open/close edges are\n * specified along its parent's orientation axis, i.e. if the parent is horizontal, the left and right edges are defined,\n * else if the parent is vertical, the top and bottom edges are defined. Similarly, the open/close edges of its\n * children will be along its own orientation axis.\n *\n * The orientation axes flip-flop along the hierarchy, i.e. an area's parent's orientation is always opposite to\n * the area's own orientation. This is because if the orientation were to be same, the area's children could be\n * \"pulled up\" to the parent making itself redundant.\n *\n * All four edges of an area can be retrieved from it and its parent.\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
FieldBitsDescription
OPEN_OFFSET0-14\n * The offset along the parent's axis at which the area begins. If orientation is horizontal,\n * this is the left edge. If orientation is vertical, this is the top edge.\n *
CLOSE_OFFSET15-29\n * The offset along the parent's axis at which the area ends. If orientation is horizontal,\n * this is the right edge. If orientation is vertical, this is the bottom edge.\n *
ORIENTATION30\n * The orientation of the area, which indicates the axis along it is split. The open and close\n * offsets of its children are along this axis. See {@link AreaOrientation}.\n *
\n *\n * @public\n */\nexport class Area\n{\n static makeArea(openOffset: number, closeOffset: number, orientation: number): number\n {\n return openOffset | (closeOffset << 15) | (orientation << 30);\n }\n\n static getOpenOffset(area: AreaField): number\n {\n return area & ((1 << 15) - 1);\n }\n\n static getCloseOffset(area: AreaField): number\n {\n return (area >> 15) & ((1 << 15) - 1);\n }\n\n static getOrientation(area: AreaField): AreaOrientation\n {\n return (area >> 30) & 1;\n }\n\n static setOpenOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n offset,\n Area.getCloseOffset(area),\n Area.getOrientation(area)\n );\n }\n\n static setCloseOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n Area.getOpenOffset(offset),\n offset,\n Area.getOrientation(area)\n );\n }\n}", "import { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, GLTexture, Resource, Renderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Texture } from '@pixi/core';\n\n/**\n * Types of image sources supported by {@link AtlasResource}.\n *\n * @public\n */\nexport type AtlasResourceSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData | ArrayBufferView;\n\n/**\n * An item that is uploaded to the atlas texture.\n *\n * @public\n */\nexport type AtlasResourceItem =\n{\n /**\n * The location of the atlas item in the base-texture's space.\n */\n frame: Rectangle;\n\n /**\n * The source of the texture data.\n */\n source: AtlasResourceSource;\n\n /**\n * This flags when the resource is to be re-uploaded.\n */\n dirtyId: number;\n\n /**\n * This flags when the resource is uploaded and update-to-date with the dirty ID.\n */\n updateId: number;\n\n /**\n * The texture holding this item.\n */\n texture: Texture;\n};\n\n/**\n * An {@code AtlasResource} is used by {@link AtlasAllocator} to manage texture sources\n *\n * @public\n */\nexport class AtlasResource extends Resource\n{\n /**\n * The list of managed resources in the atlas.\n */\n public managedItems: AtlasResourceItem[];\n\n /**\n * Creates an atlas resource.\n *\n * @param width\n * @param height\n */\n constructor(width: number, height: number)\n {\n super(width, height);\n\n this.managedItems = [];\n }\n\n /**\n * Uploads the atlas.\n *\n * @param renderer\n * @param baseTexture\n * @param glTexture\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl: WebGLRenderingContext = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK)\n\n // Allocate the texture on the GPU\n if (glTexture.width !== width ||\n glTexture.height !== height)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n baseTexture.format,\n width,\n height,\n 0,\n baseTexture.format,\n baseTexture.type,\n undefined\n );\n }\n\n const items = this.managedItems;\n\n // Upload all atlas items.\n for (let i = 0, j = items.length; i < j; i++)\n {\n this.uploadItem(\n renderer,\n baseTexture.target,\n baseTexture.format,\n baseTexture.type,\n items[i]\n );\n }\n\n return true;\n }\n\n /**\n * Uploads the atlas item to the GPU.\n *\n * @param renderer - The renderer holding the WebGL context.\n * @param target - The binding point of the base-texture.\n * @param format - The format of the base-texture.\n * @param type - The type of the base-texture data.\n * @param item - The item to upload.\n */\n protected uploadItem(\n renderer: Renderer,\n target: number,\n format: number,\n type: number,\n item: AtlasResourceItem\n ): void\n {\n if (item.updateId === item.dirtyId)\n {\n return;\n }\n\n const gl: WebGLRenderingContext = renderer.gl;\n const isWebGL2 = (gl instanceof WebGL2RenderingContext);\n const frame = item.frame;\n let source = item.source;\n\n // if WebGL1, convert whatever we have into a typed array\n if (!isWebGL2) {\n if (source instanceof ImageData) {\n source = source.data; // pass the typed array directly\n\n } else if (source instanceof HTMLCanvasElement) {\n const ctx = source.getContext('2d');\n const [w, h] = [source.width, source.height];\n source = ctx.getImageData(0, 0, w, h).data;\n\n } else if (source instanceof HTMLImageElement) {\n const [w, h] = [source.naturalWidth, source.naturalHeight];\n const canvas = document.createElement('canvas');\n canvas.width = w;\n canvas.height = h;\n\n const ctx = canvas.getContext('2d');\n ctx.drawImage(source, 0, 0);\n source = ctx.getImageData(0, 0, w, h).data;\n }\n }\n\n gl.texSubImage2D(\n target,\n 0,\n frame.x,\n frame.y,\n frame.width,\n frame.height,\n format,\n type,\n source as any,\n );\n\n item.updateId = item.dirtyId;\n }\n}", "import { AtlasResource } from './AtlasResource';\nimport { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\nimport type { AtlasResourceSource } from './AtlasResource';\n\n/**\n * This texture allocator auto-manages the base-texture with an {@link AtlasResource}. You can also\n * pass a texture source to `allocate`, mimicing {@link Texture.from} functionality.\n *\n * @public\n */\nexport class AtlasAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by an {@link AtlasResource}.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(new AtlasResource(this.slabWidth, this.slabHeight),\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Allocates a texture backed by the given atlas source, with the given padding.\n *\n * @override\n * @param width\n * @param height\n * @param padding\n * @param source\n */\n allocate(width: number, height: number, padding?: number, source?: AtlasResourceSource): Texture;\n\n /**\n * Allocates a texture backed by the given source, with default padding.\n *\n * @param width\n * @param height\n * @param source\n */\n allocate(width: number, height: number, source?: AtlasResourceSource): Texture;\n\n allocate(width: number, height: number, paddingOrSource?: number | AtlasResourceSource, source?: AtlasResourceSource): Texture\n {\n let padding: number;\n\n if (typeof paddingOrSource === 'number')\n {\n padding = paddingOrSource;\n }\n else\n {\n padding = this.calculatePadding(width, height);\n source = paddingOrSource;\n }\n\n const texture = super.allocate(width, height, padding);\n\n if (source)\n {\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = {\n frame: texture.frame,\n source,\n // dirtyId !== updateId only if image loaded\n dirtyId: source instanceof HTMLImageElement && !source.complete ? -1 : 0,\n updateId: -1,\n texture,\n };\n\n atlas.managedItems.push(item);\n\n if (source instanceof HTMLImageElement && !source.complete) {\n source.addEventListener('load', () => {\n if (texture.baseTexture.valid && !texture.baseTexture.destroyed && atlas.managedItems.indexOf(item) >= 0) {\n item.dirtyId++;\n texture.baseTexture.update();\n }\n });\n }\n\n texture.baseTexture.update();\n }\n\n return texture;\n }\n\n free(texture: Texture): void\n {\n super.free(texture);\n\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = atlas.managedItems.find(item => item.texture === texture);\n\n if (item)\n {\n atlas.managedItems.splice(atlas.managedItems.indexOf(item), 1);\n }\n }\n}", "import { Rectangle } from '@pixi/math';\nimport { Area, AreaOrientation } from './Area';\n\nimport type { AreaAllocator } from './AreaAllocator';\nimport type { AreaField } from './Area';\n\n/**\n * An allocator node is represented as a tuple. The zeroth element is the parent of the node. The first element\n * always exists and is the texture area it wholly represents. The second element is whether the rectangle\n * is allocated or free. The last element is optional and is the list\n * of its children.\n *\n * @public\n * @ignore\n */\nexport type AreaNode = [AreaNode, AreaField, boolean] | [AreaNode, AreaField, AreaNode[]];\n\n/**\n * Pointer to guillotene node.\n *\n * @public\n * @ignore\n */\nexport type AreaPtr = { __mem_area: AreaNode };\n\n/**\n * @public\n * @ignore\n */\nexport enum SPLIT_ORIENTATION {\n HOR = 0,\n VERT = 1,\n NONE = 2\n}\n\nconst tempRect = new Rectangle();\n\n/** @public */\nexport class GuilloteneAllocator implements AreaAllocator\n{\n protected _root: AreaNode;\n\n private _width: number;\n private _height: number;\n\n constructor(width: number, height: number)\n {\n this._width = width;\n this._height = height;\n\n // NOTE: getFrame assumes root node is always horizontal!\n this._root = [\n null,\n Area.makeArea(0, this._height, AreaOrientation.HORIZONTAL),\n false\n ];\n }\n\n /**\n * Allocates an area of the given `width` and `height`.\n *\n * @param width - The width required for the allocated area.\n * @param height - The height required for the allocated area.\n * @param rect - An optional `Rectangle` instance to put the resulting area frame into.\n * @return The rectangle frame of the area allocated.\n */\n allocate(width: number, height: number, rect?: Rectangle): Rectangle & AreaPtr\n {\n const area = this.findArea(width, height);\n\n if (!area)\n {\n return null;\n }\n\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n this.getFrame(area, rect);\n\n const hole = new Rectangle(rect.x, rect.y, width, height);\n const node = this.split(area, rect, hole);\n\n rect.copyFrom(hole);\n (rect as any).__mem_area = node;\n\n return rect as (Rectangle & AreaPtr);\n }\n\n /**\n * Frees the area represented by the given area pointer. The original rectangle returned by\n * {@link GuilloteneAllocator#allocate} included this pointer (the `__mem_area` property).\n *\n * @param areaPtr\n */\n free(areaPtr: AreaPtr): void\n {\n const area = areaPtr.__mem_area;\n\n area[2] = false;\n this.merge(area);\n }\n\n get width(): number\n {\n return this._width;\n }\n\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Returns the [area]{@link Area} data for the node.\n *\n * @param node\n * @returns The area data for the node.\n */\n protected getAreaField(node: AreaNode): AreaField\n {\n return node[1];\n }\n\n /**\n * Returns the rectangle covered by the area node.\n *\n * @param node - The node whose covered rectangular area is needed.\n * @param rect - An optional `Rectangle` instance to put the data in.\n * @return The rectangle covered by `node`.\n */\n protected getFrame(node: AreaNode, rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n const nodeArea = this.getAreaField(node);\n const nodeParent = this.getParent(node);\n const nodeOrientation = Area.getOrientation(nodeArea);\n const nodeOpen = Area.getOpenOffset(nodeArea);\n const nodeClose = Area.getCloseOffset(nodeArea);\n const parentOpen = nodeParent ? Area.getOpenOffset(nodeParent[1]) : 0;\n const parentClose = nodeParent ? Area.getCloseOffset(nodeParent[1]) : this._width;// (because root node is horizontal)\n\n if (nodeOrientation) // VERTICAL\n {\n rect.x = nodeOpen;\n rect.y = parentOpen;\n rect.width = nodeClose - rect.x;\n rect.height = parentClose - parentOpen;\n }\n else // HORIZONTAL\n {\n rect.x = parentOpen;\n rect.y = nodeOpen;\n rect.width = parentClose - rect.x;\n rect.height = nodeClose - rect.y;\n }\n\n return rect;\n }\n\n /**\n * Returns the parent of the area node.\n *\n * @param node\n * @return The parent of `node`\n */\n protected getParent(node: AreaNode): AreaNode\n {\n return node[0];\n }\n\n /**\n * Returns whether the given node has any children.\n *\n * @param node\n * @return Whether the given node has any children.\n */\n protected hasChildren(node: AreaNode): boolean\n {\n return (Array.isArray(node[2]) && (node[2].length !== 0));\n }\n\n /**\n * Returns the children of the passed node, if any.\n *\n * @param node\n */\n protected getChildren(node: AreaNode): AreaNode[]\n {\n if (!Array.isArray(node[2])) {\n throw new Error(\"Children don't exist\")\n }\n\n return node[2];\n }\n\n protected addChild(parent: AreaNode, ...nodes: AreaNode[]): void\n {\n parent[2] = Array.isArray(parent[2]) ? parent[2] : []\n parent[2].push(...nodes)\n }\n\n /**\n * Finds an area node with minimum width `aw` and minimum height `ah`.\n *\n * @param aw\n * @param ah\n */\n protected findArea(aw: number, ah: number): AreaNode\n {\n return this.findAreaRecursive(this._root, aw, ah);\n }\n\n /**\n * The recursive implementation for {@link AreaAllocator#findArea}.\n *\n * @param rootArea\n * @param aw\n * @param ah\n */\n protected findAreaRecursive(rootArea: AreaNode, aw: number, ah: number): AreaNode\n {\n const frame = this.getFrame(rootArea, tempRect);\n\n if (frame.width < aw || frame.height < ah)\n {\n return null;\n }\n\n if (!this.hasChildren(rootArea))\n {\n const dx = frame.width - aw;\n const dy = frame.height - ah;\n\n if (dx < 0 || dy < 0 || rootArea[2])\n {\n return null;\n }\n\n return rootArea;\n }\n\n const children = this.getChildren(rootArea);\n\n let bestCandidate = null;\n let bestCandidateScore = Infinity;\n\n for (let i = 0, j = children.length; i < j; i++)\n {\n const candidate = this.findAreaRecursive(children[i], aw, ah);\n\n if (!candidate)\n {\n continue;\n }\n\n const candidateFrame = this.getFrame(candidate, tempRect);\n\n const dx = candidateFrame.width - aw;\n const dy = candidateFrame.height - ah;\n\n if (dx < 0 || dy < 0)\n {\n continue;\n }\n if (!dx && !dy)\n {\n // Perfect fit!\n return candidate;\n }\n\n const score = Math.min(dx, dy);\n\n if (bestCandidateScore > score)\n {\n bestCandidate = candidate;\n bestCandidateScore = score;\n }\n }\n\n return bestCandidate;\n }\n\n /**\n * Returns the orientation of the primary split of host.\n */\n protected splitOrientation(host: Rectangle, hole: Rectangle): SPLIT_ORIENTATION\n {\n if (hole.width === host.width && hole.height === host.height) {\n return SPLIT_ORIENTATION.NONE;\n }\n if (hole.width === host.width) {\n return SPLIT_ORIENTATION.VERT;\n }\n if (hole.height === host.height) {\n return SPLIT_ORIENTATION.HOR;\n }\n\n // ____________________\n // | | |\n // | | |\n // | hole | |\n // | | |\n // |________| Primary |\n // | | |\n // | | |\n // | Sec. | |\n // |________|_________|\n const horAreaDiff = Math.abs(\n // (Primary) Right\n (host.width - hole.width) * host.height -\n // (Secondary) Bottom\n hole.width * (host.height - hole.height)\n )\n\n // ____________________\n // | | |\n // | | |\n // | hole | Sec. |\n // | | |\n // |________|_________|\n // | |\n // | Primary |\n // |__________________|\n const verAreaDiff = Math.abs(\n // (Primary) Bottom\n host.width * (host.height - hole.height) -\n (host.width - hole.width) * hole.height\n )\n\n if (horAreaDiff > verAreaDiff)\n {\n return SPLIT_ORIENTATION.HOR\n }\n else\n {\n return SPLIT_ORIENTATION.VERT\n }\n }\n\n protected split(\n area: AreaNode,\n areaFrame: Rectangle,\n holeFrame: Rectangle,\n orientation: SPLIT_ORIENTATION = this.getParent(area) ? this.splitOrientation(areaFrame, holeFrame) : SPLIT_ORIENTATION.HOR\n ): AreaNode\n {\n if (area[2] === true)\n {\n throw new Error('Cannot deallocate')\n }\n if (orientation === SPLIT_ORIENTATION.NONE)\n {\n area[2] = true;\n return area;\n }\n\n return this[orientation === SPLIT_ORIENTATION.HOR\n ? 'splitPrimaryHorizontal'\n : 'splitPrimaryVertical'](area, areaFrame, holeFrame);\n }\n\n private splitPrimaryHorizontal(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area))\n {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const firstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n []\n ];\n const secondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.HORIZONTAL) {\n this.addChild(area, firstChild, secondChild)\n } else {\n const i = this.getChildren(parent).indexOf(area);\n\n firstChild[0] = parent;\n secondChild[0] = parent;\n\n this.getChildren(parent).splice(i, 1, firstChild, secondChild);\n }\n\n if (holeFrame.height !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n this.addChild(firstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (firstChild as AreaNode)[2] = true;\n }\n\n return firstChild;\n }\n\n private splitPrimaryVertical(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area)) {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const primaryFirstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n []\n ];\n const primarySecondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.VERTICAL)\n {\n this.addChild(area, primaryFirstChild, primarySecondChild);\n }\n else\n {\n const i = this.getChildren(parent).indexOf(area);\n primaryFirstChild[0] = parent;\n primarySecondChild[0] = parent;\n this.getChildren(parent).splice(i, 1, primaryFirstChild, primarySecondChild);\n }\n\n if (holeFrame.width !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n this.addChild(primaryFirstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (primaryFirstChild as AreaNode)[2] = true;\n }\n\n return primaryFirstChild;\n }\n\n protected merge(\n area: AreaNode\n ) {\n if (this.hasChildren(area))\n {\n throw new Error(\"Cannot merge a non-leaf node\");\n }\n\n const parent = this.getParent(area);\n\n if (!parent)\n {\n return;\n }\n\n const siblings = this.getChildren(parent);\n const i = siblings.indexOf(area);\n\n const leftSibling = siblings[i - 1];\n const rightSibling = siblings[i + 1];\n\n if (rightSibling && rightSibling[2] === false)\n {\n // Merge rightSibling into area\n area[1] = Area.setCloseOffset(area[1], Area.getCloseOffset(rightSibling[1]));\n siblings.splice(i + 1, 1);\n }\n if (leftSibling && leftSibling[2] === false)\n {\n // Merge leftSibling into area\n area[1] = Area.setOpenOffset(area[1], Area.getOpenOffset(leftSibling[1]));\n siblings.splice(i - 1, 1);\n }\n\n if (siblings.length === 1) {\n parent[2] = false;\n this.merge(parent);\n }\n }\n\n private printState(area: AreaNode): void\n {\n if (!this.hasChildren(area)) {\n console.log({ ...this.getFrame(area) }, area[2])\n } else {\n this.getChildren(area).forEach(n => this.printState(n))\n }\n }\n}", "import { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { Rectangle } from '@pixi/math';\n\nimport type { TextureSlab } from './TextureSlab';\n\nconst tempRect = new Rectangle();\n\n/**\n * The texture allocator dynamically manages space on base-texture slabs. It can be used to generate\n * atlases on demand, which improve batching efficiency.\n *\n * @public\n */\nexport class TextureAllocator\n{\n /**\n * The width of texture slabs.\n */\n public readonly slabWidth: number;\n\n /**\n * The height of texture slabs.\n */\n public readonly slabHeight: number;\n\n /**\n * The list of base-textures that are used to allocate texture space.\n */\n protected textureSlabs: TextureSlab[];\n\n /**\n * @param slabWidth - The width of base-texture slabs. This should be at most 2048.\n * @param slabHeight - The height of base-texture slabs. This should be at most 2048.\n */\n constructor(slabWidth = 2048, slabHeight = 2048)\n {\n this.slabWidth = slabWidth;\n this.slabHeight = slabHeight;\n\n this.textureSlabs = [];\n }\n\n get maxWidth() {\n return this.slabWidth - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n get maxHeight() {\n return this.slabHeight - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n /**\n * Allocates a texture from this allocator.\n *\n * If its existing slab pool has enough space, the texture is issued from one. Otherwise,\n * a new slab is created and the texture is issued from it. However, if the requested\n * dimensions are larger than slabs themselves, then `null` is always returned.\n *\n * To upload a texture source, you will have to create an atlas-managing {@link Resource}\n * yourself on the base-texture. The {@link AtlasAllocator} does this for you, while the\n * {@link CanvasTextureAllocator} can be used to draw on a canvas-based atlas.\n *\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - The padding requested around the texture, to prevent bleeding.\n * @return The allocated texture, if successful; otherwise, `null`.\n */\n allocate(width: number, height: number, padding = this.calculatePadding(width, height)): T\n {\n // Cannot allocate a texture larger than a texture-slab.\n if (width + 2 * padding > this.slabWidth ||\n height + 2 * padding > this.slabHeight)\n {\n return null;\n }\n\n const slabs = this.textureSlabs;\n\n // Loop through the slabs and find one with enough space, if any.\n for (let i = 0, j = slabs.length; i < j; i++)\n {\n const slab = slabs[i];\n const texture = this.issueTexture(slab, width, height, padding);\n\n if (texture)\n {\n return texture;\n }\n }\n\n // Issue a new slab.\n const slab = this.createSlab();\n\n // Append this slab to the head of the list.\n this.textureSlabs.unshift(slab);\n\n // Issue the texture from this blank slab.\n return this.issueTexture(slab, width, height, padding);\n }\n\n /**\n * Frees the texture and reclaims its space. It is assumed you will not use it again, and have\n * destroyed any resource uploading its data.\n *\n * @param texture\n * @throws When the texture was not located in this allocator.\n */\n free(texture: T): void\n {\n const baseTexture = (texture as Texture).baseTexture;\n const slab = this.textureSlabs.find(sl => sl.slab === baseTexture);\n\n if (!slab)\n {\n throw new Error(\"The texture cannot be freed because \" +\n \"its base-texture is not pooled by this allocator. \" +\n \"This is either a bug in TextureAllocator or you tried to free a \" +\n \"texture that was never allocated by one.\");\n }\n\n const textureEntry = slab.managedTextures.find(entry => entry.texture === texture);\n\n if (!textureEntry)\n {\n throw new Error(\"The texture cannot be freed because it was not found \" +\n \"in the managed list of issued textures on its slab. This may be because you \" +\n \"duplicated this texture or a bug in TextureAllocator\");\n }\n\n slab.managedArea.free(textureEntry.area);\n slab.managedTextures.splice(slab.managedTextures.indexOf(textureEntry), 1);\n }\n\n protected calculatePadding(width: number, height: number): number\n {\n const dimen = Math.max(width, height);\n\n if (dimen < 64)\n {\n return 2;\n }\n else if (dimen < 128)\n {\n return 4;\n }\n else if (dimen < 1024)\n {\n return 8;\n }\n else\n {\n return 16;\n }\n }\n\n /**\n * Creates a texture slab. The slab's base-texture is not backed by any resource. You\n * will have to manage that yourself. See {@link AtlasAllocator} or {@link CanvasTextureAllocator}\n * for better resource semantics.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(null,\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Creates a texture on the given base-texture at {@code frame}.\n *\n * @param baseTexture - The base texture that will hold the texture's space.\n * @param frame - The frame in which the texture will be stored.\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): T\n {\n // Override this method to return correct texture type T.\n return new Texture(baseTexture, frame) as T;\n }\n\n /**\n * Issues a texture from the given texture slab, if possible.\n *\n * @param slab - The texture slab to allocate frame.\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - Padding required around the texture.\n * @return The issued texture, if successful; otherwise, `null`.\n */\n protected issueTexture(slab: TextureSlab, width: number, height: number, padding = 0): T\n {\n const area = slab.managedArea.allocate(width + 2 * padding, height + 2 * padding);\n\n if (!area)\n {\n return null;\n }\n\n tempRect.copyFrom(area);\n tempRect.pad(-padding);\n\n const baseTexture = slab.slab;\n const issuedTexture = this.createTexture(baseTexture, tempRect.clone());\n\n slab.managedTextures.push({\n area,\n texture: issuedTexture,\n });\n\n return issuedTexture;\n }\n}", "import { BaseTexture } from '@pixi/core';\n\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues texture backed by a canvas. You can draw on to that canvas to soruce\n * each texture.\n *\n * @public\n */\nexport class CanvasTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a canvas.\n */\n protected createSlab(): TextureSlab\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = this.slabWidth;\n canvas.height = this.slabHeight;\n\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(canvas, {\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n}", "import { BaseRenderTexture, RenderTexture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\n\nimport type { BaseTexture } from '@pixi/core';\nimport type { Rectangle } from '@pixi/math';\nimport type { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues render-textures, and is otherwise just like {@link TextureAllocator}.\n *\n * @public\n */\nexport class RenderTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a base render-texture.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseRenderTexture({\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n\n /**\n * Creates a render-texture from the given base render-texture.\n *\n * @param baseTexture\n * @param frame\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): RenderTexture\n {\n return new RenderTexture(baseTexture as BaseRenderTexture, frame);\n }\n}"], - "mappings": ";AAKO,IAAK,kBAAL,kBAAKA,qBAAL;AACH,EAAAA,kCAAA,gBAAa,KAAb;AACA,EAAAA,kCAAA,cAAW,KAAX;AAFQ,SAAAA;AAAA,GAAA;AA8DL,IAAM,OAAN,MACP;AAAA,EACI,OAAO,SAAS,YAAoB,aAAqB,aACzD;AACI,WAAO,aAAc,eAAe,KAAO,eAAe;AAAA,EAC9D;AAAA,EAEA,OAAO,cAAc,MACrB;AACI,WAAO,QAAS,KAAK,MAAM;AAAA,EAC/B;AAAA,EAEA,OAAO,eAAe,MACtB;AACI,WAAQ,QAAQ,MAAQ,KAAK,MAAM;AAAA,EACvC;AAAA,EAEA,OAAO,eAAe,MACtB;AACI,WAAQ,QAAQ,KAAM;AAAA,EAC1B;AAAA,EAEA,OAAO,cAAc,MAAiB,QACtC;AACI,WAAO,KAAK;AAAA,MACR;AAAA,MACA,KAAK,eAAe,IAAI;AAAA,MACxB,KAAK,eAAe,IAAI;AAAA,IAC5B;AAAA,EACJ;AAAA,EAEA,OAAO,eAAe,MAAiB,QACvC;AACI,WAAO,KAAK;AAAA,MACR,KAAK,cAAc,MAAM;AAAA,MACzB;AAAA,MACA,KAAK,eAAe,IAAI;AAAA,IAC5B;AAAA,EACJ;AACJ;;;AC1GA,SAAS,mBAAmB;AAC5B,SAAiC,gBAA0B;AAkDpD,IAAM,gBAAN,cAA4B,SACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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cAAc,aAAkC,KAAK;AAAA,EACpE;AACJ;", + "sourcesContent": ["/**\n * The orientation of an area indicates the axis along which it is split. This is a 1-bit field.\n *\n * @public\n */\nexport enum AreaOrientation {\n HORIZONTAL = 0,\n VERTICAL = 1\n};\n\n/**\n * Alias for the 31-bit field texture-area type.\n *\n * @public\n */\nexport type AreaField = number;\n\n/**\n * An area represents an oriented rectangular region. It is implemented as a 31-bit field. The open/close edges are\n * specified along its parent's orientation axis, i.e. if the parent is horizontal, the left and right edges are defined,\n * else if the parent is vertical, the top and bottom edges are defined. Similarly, the open/close edges of its\n * children will be along its own orientation axis.\n *\n * The orientation axes flip-flop along the hierarchy, i.e. an area's parent's orientation is always opposite to\n * the area's own orientation. This is because if the orientation were to be same, the area's children could be\n * \"pulled up\" to the parent making itself redundant.\n *\n * All four edges of an area can be retrieved from it and its parent.\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
FieldBitsDescription
OPEN_OFFSET0-14\n * The offset along the parent's axis at which the area begins. If orientation is horizontal,\n * this is the left edge. If orientation is vertical, this is the top edge.\n *
CLOSE_OFFSET15-29\n * The offset along the parent's axis at which the area ends. If orientation is horizontal,\n * this is the right edge. If orientation is vertical, this is the bottom edge.\n *
ORIENTATION30\n * The orientation of the area, which indicates the axis along it is split. The open and close\n * offsets of its children are along this axis. See {@link AreaOrientation}.\n *
\n *\n * @public\n */\nexport class Area\n{\n static makeArea(openOffset: number, closeOffset: number, orientation: number): number\n {\n return openOffset | (closeOffset << 15) | (orientation << 30);\n }\n\n static getOpenOffset(area: AreaField): number\n {\n return area & ((1 << 15) - 1);\n }\n\n static getCloseOffset(area: AreaField): number\n {\n return (area >> 15) & ((1 << 15) - 1);\n }\n\n static getOrientation(area: AreaField): AreaOrientation\n {\n return (area >> 30) & 1;\n }\n\n static setOpenOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n offset,\n Area.getCloseOffset(area),\n Area.getOrientation(area)\n );\n }\n\n static setCloseOffset(area: AreaField, offset: number): number\n {\n return Area.makeArea(\n Area.getOpenOffset(offset),\n offset,\n Area.getOrientation(area)\n );\n }\n}", "import { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, GLTexture, Resource, Renderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Texture } from '@pixi/core';\n\n/**\n * Types of image sources supported by {@link AtlasResource}.\n *\n * @public\n */\nexport type AtlasResourceSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData | ArrayBufferView;\n\n/**\n * An item that is uploaded to the atlas texture.\n *\n * @public\n */\nexport type AtlasResourceItem =\n{\n /**\n * The location of the atlas item in the base-texture's space.\n */\n frame: Rectangle;\n\n /**\n * The source of the texture data.\n */\n source: AtlasResourceSource;\n\n /**\n * This flags when the resource is to be re-uploaded.\n */\n dirtyId: number;\n\n /**\n * This flags when the resource is uploaded and update-to-date with the dirty ID.\n */\n updateId: number;\n\n /**\n * The texture holding this item.\n */\n texture: Texture;\n};\n\n/**\n * An {@code AtlasResource} is used by {@link AtlasAllocator} to manage texture sources\n *\n * @public\n */\nexport class AtlasResource extends Resource\n{\n /**\n * The list of managed resources in the atlas.\n */\n public managedItems: AtlasResourceItem[];\n\n /**\n * Creates an atlas resource.\n *\n * @param width\n * @param height\n */\n constructor(width: number, height: number)\n {\n super(width, height);\n\n this.managedItems = [];\n }\n\n /**\n * Uploads the atlas.\n *\n * @param renderer\n * @param baseTexture\n * @param glTexture\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl: WebGLRenderingContext = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK)\n\n // Allocate the texture on the GPU\n if (glTexture.width !== width ||\n glTexture.height !== height)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n baseTexture.format,\n width,\n height,\n 0,\n baseTexture.format,\n baseTexture.type,\n undefined\n );\n }\n\n const items = this.managedItems;\n\n // Upload all atlas items.\n for (let i = 0, j = items.length; i < j; i++)\n {\n this.uploadItem(\n renderer,\n baseTexture.target,\n baseTexture.format,\n baseTexture.type,\n items[i]\n );\n }\n\n return true;\n }\n\n /**\n * Uploads the atlas item to the GPU.\n *\n * @param renderer - The renderer holding the WebGL context.\n * @param target - The binding point of the base-texture.\n * @param format - The format of the base-texture.\n * @param type - The type of the base-texture data.\n * @param item - The item to upload.\n */\n protected uploadItem(\n renderer: Renderer,\n target: number,\n format: number,\n type: number,\n item: AtlasResourceItem\n ): void\n {\n // see https://github.com/rapideditor/pixi-texture-allocator/issues/2\n // if (item.updateId === item.dirtyId)\n // {\n // return;\n // }\n\n const gl: WebGLRenderingContext = renderer.gl;\n const isWebGL2 = (gl instanceof WebGL2RenderingContext);\n const frame = item.frame;\n let source = item.source;\n\n // if WebGL1, convert whatever we have into a typed array\n if (!isWebGL2) {\n if (source instanceof ImageData) {\n source = source.data; // pass the typed array directly\n\n } else if (source instanceof HTMLCanvasElement) {\n const ctx = source.getContext('2d');\n const [w, h] = [source.width, source.height];\n source = ctx.getImageData(0, 0, w, h).data;\n\n } else if (source instanceof HTMLImageElement) {\n const [w, h] = [source.naturalWidth, source.naturalHeight];\n const canvas = document.createElement('canvas');\n canvas.width = w;\n canvas.height = h;\n\n const ctx = canvas.getContext('2d');\n ctx.drawImage(source, 0, 0);\n source = ctx.getImageData(0, 0, w, h).data;\n }\n }\n\n gl.texSubImage2D(\n target,\n 0,\n frame.x,\n frame.y,\n frame.width,\n frame.height,\n format,\n type,\n source as any,\n );\n\n item.updateId = item.dirtyId;\n }\n}", "import { AtlasResource } from './AtlasResource';\nimport { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\nimport type { AtlasResourceSource } from './AtlasResource';\n\n/**\n * This texture allocator auto-manages the base-texture with an {@link AtlasResource}. You can also\n * pass a texture source to `allocate`, mimicing {@link Texture.from} functionality.\n *\n * @public\n */\nexport class AtlasAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by an {@link AtlasResource}.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(new AtlasResource(this.slabWidth, this.slabHeight),\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Allocates a texture backed by the given atlas source, with the given padding.\n *\n * @override\n * @param width\n * @param height\n * @param padding\n * @param source\n */\n allocate(width: number, height: number, padding?: number, source?: AtlasResourceSource): Texture;\n\n /**\n * Allocates a texture backed by the given source, with default padding.\n *\n * @param width\n * @param height\n * @param source\n */\n allocate(width: number, height: number, source?: AtlasResourceSource): Texture;\n\n allocate(width: number, height: number, paddingOrSource?: number | AtlasResourceSource, source?: AtlasResourceSource): Texture\n {\n let padding: number;\n\n if (typeof paddingOrSource === 'number')\n {\n padding = paddingOrSource;\n }\n else\n {\n padding = this.calculatePadding(width, height);\n source = paddingOrSource;\n }\n\n const texture = super.allocate(width, height, padding);\n\n if (source)\n {\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = {\n frame: texture.frame,\n source,\n // dirtyId !== updateId only if image loaded\n dirtyId: source instanceof HTMLImageElement && !source.complete ? -1 : 0,\n updateId: -1,\n texture,\n };\n\n atlas.managedItems.push(item);\n\n if (source instanceof HTMLImageElement && !source.complete) {\n source.addEventListener('load', () => {\n if (texture.baseTexture.valid && !texture.baseTexture.destroyed && atlas.managedItems.indexOf(item) >= 0) {\n item.dirtyId++;\n texture.baseTexture.update();\n }\n });\n }\n\n texture.baseTexture.update();\n }\n\n return texture;\n }\n\n free(texture: Texture): void\n {\n super.free(texture);\n\n const atlas = texture.baseTexture.resource as AtlasResource;\n const item = atlas.managedItems.find(item => item.texture === texture);\n\n if (item)\n {\n atlas.managedItems.splice(atlas.managedItems.indexOf(item), 1);\n }\n }\n}", "import { Rectangle } from '@pixi/math';\nimport { Area, AreaOrientation } from './Area';\n\nimport type { AreaAllocator } from './AreaAllocator';\nimport type { AreaField } from './Area';\n\n/**\n * An allocator node is represented as a tuple. The zeroth element is the parent of the node. The first element\n * always exists and is the texture area it wholly represents. The second element is whether the rectangle\n * is allocated or free. The last element is optional and is the list\n * of its children.\n *\n * @public\n * @ignore\n */\nexport type AreaNode = [AreaNode, AreaField, boolean] | [AreaNode, AreaField, AreaNode[]];\n\n/**\n * Pointer to guillotene node.\n *\n * @public\n * @ignore\n */\nexport type AreaPtr = { __mem_area: AreaNode };\n\n/**\n * @public\n * @ignore\n */\nexport enum SPLIT_ORIENTATION {\n HOR = 0,\n VERT = 1,\n NONE = 2\n}\n\nconst tempRect = new Rectangle();\n\n/** @public */\nexport class GuilloteneAllocator implements AreaAllocator\n{\n protected _root: AreaNode;\n\n private _width: number;\n private _height: number;\n\n constructor(width: number, height: number)\n {\n this._width = width;\n this._height = height;\n\n // NOTE: getFrame assumes root node is always horizontal!\n this._root = [\n null,\n Area.makeArea(0, this._height, AreaOrientation.HORIZONTAL),\n false\n ];\n }\n\n /**\n * Allocates an area of the given `width` and `height`.\n *\n * @param width - The width required for the allocated area.\n * @param height - The height required for the allocated area.\n * @param rect - An optional `Rectangle` instance to put the resulting area frame into.\n * @return The rectangle frame of the area allocated.\n */\n allocate(width: number, height: number, rect?: Rectangle): Rectangle & AreaPtr\n {\n const area = this.findArea(width, height);\n\n if (!area)\n {\n return null;\n }\n\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n this.getFrame(area, rect);\n\n const hole = new Rectangle(rect.x, rect.y, width, height);\n const node = this.split(area, rect, hole);\n\n rect.copyFrom(hole);\n (rect as any).__mem_area = node;\n\n return rect as (Rectangle & AreaPtr);\n }\n\n /**\n * Frees the area represented by the given area pointer. The original rectangle returned by\n * {@link GuilloteneAllocator#allocate} included this pointer (the `__mem_area` property).\n *\n * @param areaPtr\n */\n free(areaPtr: AreaPtr): void\n {\n const area = areaPtr.__mem_area;\n\n area[2] = false;\n this.merge(area);\n }\n\n get width(): number\n {\n return this._width;\n }\n\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Returns the [area]{@link Area} data for the node.\n *\n * @param node\n * @returns The area data for the node.\n */\n protected getAreaField(node: AreaNode): AreaField\n {\n return node[1];\n }\n\n /**\n * Returns the rectangle covered by the area node.\n *\n * @param node - The node whose covered rectangular area is needed.\n * @param rect - An optional `Rectangle` instance to put the data in.\n * @return The rectangle covered by `node`.\n */\n protected getFrame(node: AreaNode, rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n rect = new Rectangle();\n }\n\n const nodeArea = this.getAreaField(node);\n const nodeParent = this.getParent(node);\n const nodeOrientation = Area.getOrientation(nodeArea);\n const nodeOpen = Area.getOpenOffset(nodeArea);\n const nodeClose = Area.getCloseOffset(nodeArea);\n const parentOpen = nodeParent ? Area.getOpenOffset(nodeParent[1]) : 0;\n const parentClose = nodeParent ? Area.getCloseOffset(nodeParent[1]) : this._width;// (because root node is horizontal)\n\n if (nodeOrientation) // VERTICAL\n {\n rect.x = nodeOpen;\n rect.y = parentOpen;\n rect.width = nodeClose - rect.x;\n rect.height = parentClose - parentOpen;\n }\n else // HORIZONTAL\n {\n rect.x = parentOpen;\n rect.y = nodeOpen;\n rect.width = parentClose - rect.x;\n rect.height = nodeClose - rect.y;\n }\n\n return rect;\n }\n\n /**\n * Returns the parent of the area node.\n *\n * @param node\n * @return The parent of `node`\n */\n protected getParent(node: AreaNode): AreaNode\n {\n return node[0];\n }\n\n /**\n * Returns whether the given node has any children.\n *\n * @param node\n * @return Whether the given node has any children.\n */\n protected hasChildren(node: AreaNode): boolean\n {\n return (Array.isArray(node[2]) && (node[2].length !== 0));\n }\n\n /**\n * Returns the children of the passed node, if any.\n *\n * @param node\n */\n protected getChildren(node: AreaNode): AreaNode[]\n {\n if (!Array.isArray(node[2])) {\n throw new Error(\"Children don't exist\")\n }\n\n return node[2];\n }\n\n protected addChild(parent: AreaNode, ...nodes: AreaNode[]): void\n {\n parent[2] = Array.isArray(parent[2]) ? parent[2] : []\n parent[2].push(...nodes)\n }\n\n /**\n * Finds an area node with minimum width `aw` and minimum height `ah`.\n *\n * @param aw\n * @param ah\n */\n protected findArea(aw: number, ah: number): AreaNode\n {\n return this.findAreaRecursive(this._root, aw, ah);\n }\n\n /**\n * The recursive implementation for {@link AreaAllocator#findArea}.\n *\n * @param rootArea\n * @param aw\n * @param ah\n */\n protected findAreaRecursive(rootArea: AreaNode, aw: number, ah: number): AreaNode\n {\n const frame = this.getFrame(rootArea, tempRect);\n\n if (frame.width < aw || frame.height < ah)\n {\n return null;\n }\n\n if (!this.hasChildren(rootArea))\n {\n const dx = frame.width - aw;\n const dy = frame.height - ah;\n\n if (dx < 0 || dy < 0 || rootArea[2])\n {\n return null;\n }\n\n return rootArea;\n }\n\n const children = this.getChildren(rootArea);\n\n let bestCandidate = null;\n let bestCandidateScore = Infinity;\n\n for (let i = 0, j = children.length; i < j; i++)\n {\n const candidate = this.findAreaRecursive(children[i], aw, ah);\n\n if (!candidate)\n {\n continue;\n }\n\n const candidateFrame = this.getFrame(candidate, tempRect);\n\n const dx = candidateFrame.width - aw;\n const dy = candidateFrame.height - ah;\n\n if (dx < 0 || dy < 0)\n {\n continue;\n }\n if (!dx && !dy)\n {\n // Perfect fit!\n return candidate;\n }\n\n const score = Math.min(dx, dy);\n\n if (bestCandidateScore > score)\n {\n bestCandidate = candidate;\n bestCandidateScore = score;\n }\n }\n\n return bestCandidate;\n }\n\n /**\n * Returns the orientation of the primary split of host.\n */\n protected splitOrientation(host: Rectangle, hole: Rectangle): SPLIT_ORIENTATION\n {\n if (hole.width === host.width && hole.height === host.height) {\n return SPLIT_ORIENTATION.NONE;\n }\n if (hole.width === host.width) {\n return SPLIT_ORIENTATION.VERT;\n }\n if (hole.height === host.height) {\n return SPLIT_ORIENTATION.HOR;\n }\n\n // ____________________\n // | | |\n // | | |\n // | hole | |\n // | | |\n // |________| Primary |\n // | | |\n // | | |\n // | Sec. | |\n // |________|_________|\n const horAreaDiff = Math.abs(\n // (Primary) Right\n (host.width - hole.width) * host.height -\n // (Secondary) Bottom\n hole.width * (host.height - hole.height)\n )\n\n // ____________________\n // | | |\n // | | |\n // | hole | Sec. |\n // | | |\n // |________|_________|\n // | |\n // | Primary |\n // |__________________|\n const verAreaDiff = Math.abs(\n // (Primary) Bottom\n host.width * (host.height - hole.height) -\n (host.width - hole.width) * hole.height\n )\n\n if (horAreaDiff > verAreaDiff)\n {\n return SPLIT_ORIENTATION.HOR\n }\n else\n {\n return SPLIT_ORIENTATION.VERT\n }\n }\n\n protected split(\n area: AreaNode,\n areaFrame: Rectangle,\n holeFrame: Rectangle,\n orientation: SPLIT_ORIENTATION = this.getParent(area) ? this.splitOrientation(areaFrame, holeFrame) : SPLIT_ORIENTATION.HOR\n ): AreaNode\n {\n if (area[2] === true)\n {\n throw new Error('Cannot deallocate')\n }\n if (orientation === SPLIT_ORIENTATION.NONE)\n {\n area[2] = true;\n return area;\n }\n\n return this[orientation === SPLIT_ORIENTATION.HOR\n ? 'splitPrimaryHorizontal'\n : 'splitPrimaryVertical'](area, areaFrame, holeFrame);\n }\n\n private splitPrimaryHorizontal(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area))\n {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const firstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n []\n ];\n const secondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.HORIZONTAL) {\n this.addChild(area, firstChild, secondChild)\n } else {\n const i = this.getChildren(parent).indexOf(area);\n\n firstChild[0] = parent;\n secondChild[0] = parent;\n\n this.getChildren(parent).splice(i, 1, firstChild, secondChild);\n }\n\n if (holeFrame.height !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n firstChild,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n this.addChild(firstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (firstChild as AreaNode)[2] = true;\n }\n\n return firstChild;\n }\n\n private splitPrimaryVertical(area: AreaNode, areaFrame: Rectangle, holeFrame: Rectangle): AreaNode\n {\n const field = this.getAreaField(area);\n const axis = Area.getOrientation(field);\n const parent = this.getParent(area);\n\n if (this.hasChildren(area)) {\n throw new Error(\"Can't split non-leaf node\")\n }\n\n const primaryFirstChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.top,\n areaFrame.y + holeFrame.height,\n AreaOrientation.HORIZONTAL\n ),\n []\n ];\n const primarySecondChild: AreaNode = [\n area,\n Area.makeArea(\n areaFrame.y + holeFrame.height,\n areaFrame.bottom,\n AreaOrientation.HORIZONTAL\n ),\n false\n ];\n\n if (axis === AreaOrientation.VERTICAL)\n {\n this.addChild(area, primaryFirstChild, primarySecondChild);\n }\n else\n {\n const i = this.getChildren(parent).indexOf(area);\n primaryFirstChild[0] = parent;\n primarySecondChild[0] = parent;\n this.getChildren(parent).splice(i, 1, primaryFirstChild, primarySecondChild);\n }\n\n if (holeFrame.width !== areaFrame.height)\n {\n const secondaryFirstChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.left,\n areaFrame.x + holeFrame.width,\n AreaOrientation.VERTICAL\n ),\n true\n ];\n const secondarySecondChild: AreaNode = [\n primaryFirstChild,\n Area.makeArea(\n areaFrame.x + holeFrame.width,\n areaFrame.right,\n AreaOrientation.VERTICAL\n ),\n false\n ];\n\n this.addChild(primaryFirstChild, secondaryFirstChild, secondarySecondChild);\n\n return secondaryFirstChild;\n }\n else\n {\n (primaryFirstChild as AreaNode)[2] = true;\n }\n\n return primaryFirstChild;\n }\n\n protected merge(\n area: AreaNode\n ) {\n if (this.hasChildren(area))\n {\n throw new Error(\"Cannot merge a non-leaf node\");\n }\n\n const parent = this.getParent(area);\n\n if (!parent)\n {\n return;\n }\n\n const siblings = this.getChildren(parent);\n const i = siblings.indexOf(area);\n\n const leftSibling = siblings[i - 1];\n const rightSibling = siblings[i + 1];\n\n if (rightSibling && rightSibling[2] === false)\n {\n // Merge rightSibling into area\n area[1] = Area.setCloseOffset(area[1], Area.getCloseOffset(rightSibling[1]));\n siblings.splice(i + 1, 1);\n }\n if (leftSibling && leftSibling[2] === false)\n {\n // Merge leftSibling into area\n area[1] = Area.setOpenOffset(area[1], Area.getOpenOffset(leftSibling[1]));\n siblings.splice(i - 1, 1);\n }\n\n if (siblings.length === 1) {\n parent[2] = false;\n this.merge(parent);\n }\n }\n\n private printState(area: AreaNode): void\n {\n if (!this.hasChildren(area)) {\n console.log({ ...this.getFrame(area) }, area[2])\n } else {\n this.getChildren(area).forEach(n => this.printState(n))\n }\n }\n}", "import { BaseTexture, Texture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { Rectangle } from '@pixi/math';\n\nimport type { TextureSlab } from './TextureSlab';\n\nconst tempRect = new Rectangle();\n\n/**\n * The texture allocator dynamically manages space on base-texture slabs. It can be used to generate\n * atlases on demand, which improve batching efficiency.\n *\n * @public\n */\nexport class TextureAllocator\n{\n /**\n * The width of texture slabs.\n */\n public readonly slabWidth: number;\n\n /**\n * The height of texture slabs.\n */\n public readonly slabHeight: number;\n\n /**\n * The list of base-textures that are used to allocate texture space.\n */\n protected textureSlabs: TextureSlab[];\n\n /**\n * @param slabWidth - The width of base-texture slabs. This should be at most 2048.\n * @param slabHeight - The height of base-texture slabs. This should be at most 2048.\n */\n constructor(slabWidth = 2048, slabHeight = 2048)\n {\n this.slabWidth = slabWidth;\n this.slabHeight = slabHeight;\n\n this.textureSlabs = [];\n }\n\n get maxWidth() {\n return this.slabWidth - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n get maxHeight() {\n return this.slabHeight - (2 * this.calculatePadding(this.slabWidth, this.slabHeight));\n }\n\n /**\n * Allocates a texture from this allocator.\n *\n * If its existing slab pool has enough space, the texture is issued from one. Otherwise,\n * a new slab is created and the texture is issued from it. However, if the requested\n * dimensions are larger than slabs themselves, then `null` is always returned.\n *\n * To upload a texture source, you will have to create an atlas-managing {@link Resource}\n * yourself on the base-texture. The {@link AtlasAllocator} does this for you, while the\n * {@link CanvasTextureAllocator} can be used to draw on a canvas-based atlas.\n *\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - The padding requested around the texture, to prevent bleeding.\n * @return The allocated texture, if successful; otherwise, `null`.\n */\n allocate(width: number, height: number, padding = this.calculatePadding(width, height)): T\n {\n // Cannot allocate a texture larger than a texture-slab.\n if (width + 2 * padding > this.slabWidth ||\n height + 2 * padding > this.slabHeight)\n {\n return null;\n }\n\n const slabs = this.textureSlabs;\n\n // Loop through the slabs and find one with enough space, if any.\n for (let i = 0, j = slabs.length; i < j; i++)\n {\n const slab = slabs[i];\n const texture = this.issueTexture(slab, width, height, padding);\n\n if (texture)\n {\n return texture;\n }\n }\n\n // Issue a new slab.\n const slab = this.createSlab();\n\n // Append this slab to the head of the list.\n this.textureSlabs.unshift(slab);\n\n // Issue the texture from this blank slab.\n return this.issueTexture(slab, width, height, padding);\n }\n\n /**\n * Frees the texture and reclaims its space. It is assumed you will not use it again, and have\n * destroyed any resource uploading its data.\n *\n * @param texture\n * @throws When the texture was not located in this allocator.\n */\n free(texture: T): void\n {\n const baseTexture = (texture as Texture).baseTexture;\n const slab = this.textureSlabs.find(sl => sl.slab === baseTexture);\n\n if (!slab)\n {\n throw new Error(\"The texture cannot be freed because \" +\n \"its base-texture is not pooled by this allocator. \" +\n \"This is either a bug in TextureAllocator or you tried to free a \" +\n \"texture that was never allocated by one.\");\n }\n\n const textureEntry = slab.managedTextures.find(entry => entry.texture === texture);\n\n if (!textureEntry)\n {\n throw new Error(\"The texture cannot be freed because it was not found \" +\n \"in the managed list of issued textures on its slab. This may be because you \" +\n \"duplicated this texture or a bug in TextureAllocator\");\n }\n\n slab.managedArea.free(textureEntry.area);\n slab.managedTextures.splice(slab.managedTextures.indexOf(textureEntry), 1);\n }\n\n protected calculatePadding(width: number, height: number): number\n {\n const dimen = Math.max(width, height);\n\n if (dimen < 64)\n {\n return 2;\n }\n else if (dimen < 128)\n {\n return 4;\n }\n else if (dimen < 1024)\n {\n return 8;\n }\n else\n {\n return 16;\n }\n }\n\n /**\n * Creates a texture slab. The slab's base-texture is not backed by any resource. You\n * will have to manage that yourself. See {@link AtlasAllocator} or {@link CanvasTextureAllocator}\n * for better resource semantics.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(null,\n {\n width: this.slabWidth,\n height: this.slabHeight,\n }),\n };\n }\n\n /**\n * Creates a texture on the given base-texture at {@code frame}.\n *\n * @param baseTexture - The base texture that will hold the texture's space.\n * @param frame - The frame in which the texture will be stored.\n */\n protected createTexture(baseTexture: BaseTexture, frame: Rectangle): T\n {\n // Override this method to return correct texture type T.\n return new Texture(baseTexture, frame) as T;\n }\n\n /**\n * Issues a texture from the given texture slab, if possible.\n *\n * @param slab - The texture slab to allocate frame.\n * @param width - The width of the requested texture.\n * @param height - The height of the requested texture.\n * @param padding - Padding required around the texture.\n * @return The issued texture, if successful; otherwise, `null`.\n */\n protected issueTexture(slab: TextureSlab, width: number, height: number, padding = 0): T\n {\n const area = slab.managedArea.allocate(width + 2 * padding, height + 2 * padding);\n\n if (!area)\n {\n return null;\n }\n\n tempRect.copyFrom(area);\n tempRect.pad(-padding);\n\n const baseTexture = slab.slab;\n const issuedTexture = this.createTexture(baseTexture, tempRect.clone());\n\n slab.managedTextures.push({\n area,\n texture: issuedTexture,\n });\n\n return issuedTexture;\n }\n}", "import { BaseTexture } from '@pixi/core';\n\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\nimport { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues texture backed by a canvas. You can draw on to that canvas to soruce\n * each texture.\n *\n * @public\n */\nexport class CanvasTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a canvas.\n */\n protected createSlab(): TextureSlab\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = this.slabWidth;\n canvas.height = this.slabHeight;\n\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseTexture(canvas, {\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n}", "import { BaseRenderTexture, RenderTexture } from '@pixi/core';\nimport { GuilloteneAllocator } from './GuilloteneAllocator';\nimport { TextureAllocator } from './TextureAllocator';\n\nimport type { BaseTexture } from '@pixi/core';\nimport type { Rectangle } from '@pixi/math';\nimport type { TextureSlab } from './TextureSlab';\n\n/**\n * This allocator issues render-textures, and is otherwise just like {@link TextureAllocator}.\n *\n * @public\n */\nexport class RenderTextureAllocator extends TextureAllocator\n{\n /**\n * Creates a texture slab backed by a base render-texture.\n */\n protected createSlab(): TextureSlab\n {\n return {\n managedArea: new GuilloteneAllocator(this.slabWidth, this.slabHeight),\n managedTextures: [],\n slab: new BaseRenderTexture({\n width: this.slabWidth,\n height: this.slabHeight\n })\n };\n }\n\n /**\n * Creates a render-texture from the given base render-texture.\n *\n * @param baseTexture\n * @param frame\n */\n protected createTexture(baseTex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AI,MACJ;AACI,YAAM,aAAa,OAAO,MAAM,aAAa,QAAQ,IAAI,GAAG,CAAC;AAAA,IACjE;AAAA,EACJ;AACJ;;;AG7GA,SAAS,eAAAC,oBAAmB;AAYrB,IAAM,yBAAN,cAAqC,iBAC5C;AAAA;AAAA;AAAA;AAAA,EAIc,aACV;AACI,UAAM,SAAS,SAAS,cAAc,QAAQ;AAE9C,WAAO,QAAQ,KAAK;AACpB,WAAO,SAAS,KAAK;AAErB,WAAO;AAAA,MACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,MACpE,iBAAiB,CAAC;AAAA,MAClB,MAAM,IAAIC,aAAY,QAAQ;AAAA,QAC1B,OAAO,KAAK;AAAA,QACZ,QAAQ,KAAK;AAAA,MACjB,CAAC;AAAA,IACL;AAAA,EACJ;AACJ;;;ACjCA,SAAS,mBAAmB,qBAAqB;AAa1C,IAAM,yBAAN,cAAqC,iBAC5C;AAAA;AAAA;AAAA;AAAA,EAIc,aACV;AACI,WAAO;AAAA,MACH,aAAa,IAAI,oBAAoB,KAAK,WAAW,KAAK,UAAU;AAAA,MACpE,iBAAiB,CAAC;AAAA,MAClB,MAAM,IAAI,kBAAkB;AAAA,QACxB,OAAO,KAAK;AAAA,QACZ,QAAQ,KAAK;AAAA,MACjB,CAAC;AAAA,IACL;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQU,cAAc,aAA0B,OAClD;AACI,WAAO,IAAI,cAAc,aAAkC,KAAK;AAAA,EACpE;AACJ;", "names": ["AreaOrientation", "BaseTexture", "SPLIT_ORIENTATION", "BaseTexture", "Rectangle", "tempRect", "slab", "BaseTexture", "BaseTexture", "item", "BaseTexture", "BaseTexture"] } diff --git a/package-lock.json b/package-lock.json index 025dbfd..f52fe15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rapideditor/pixi-texture-allocator", - "version": "7.2.4", + "version": "7.2.5-pre.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@rapideditor/pixi-texture-allocator", - "version": "7.2.4", + "version": "7.2.5-pre.0", "license": "MIT", "dependencies": { "@pixi/constants": "7.2.4", diff --git a/package.json b/package.json index 4785378..309b5d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rapideditor/pixi-texture-allocator", - "version": "7.2.4", + "version": "7.2.5-pre.0", "author": "Ben Clark