swf2es 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunks/c9dbb43b77c0df16.js","sources":["webpack://swf2es/../native/dist/render/lines.js","webpack://swf2es/../native/dist/render/tessellator.js","webpack://swf2es/../render/dist/commands.js","webpack://swf2es/../render/dist/filter-shaders.js","webpack://swf2es/../render/dist/filters.js","webpack://swf2es/../render/dist/registry.js","webpack://swf2es/../render/dist/geometry.js","webpack://swf2es/../render/dist/keeps.js","webpack://swf2es/../render/dist/measure.js","webpack://swf2es/../render/dist/plan.js","webpack://swf2es/../render/dist/rows.js","webpack://swf2es/../render/dist/scene.js","webpack://swf2es/../render/dist/textures.js","webpack://swf2es/../context3d/dist/device/programs.js","webpack://swf2es/../context3d/dist/device/state.js","webpack://swf2es/../render/dist/webgl/programs.js","webpack://swf2es/../render/dist/webgl/atlas.js","webpack://swf2es/../render/dist/kernel-shaders.js","webpack://swf2es/../render/dist/webgl/pool.js","webpack://swf2es/../render/dist/webgl/targets.js","webpack://swf2es/../render/dist/webgl/composite.js","webpack://swf2es/../render/dist/webgl/draws.js","webpack://swf2es/../render/dist/filter-plan.js","webpack://swf2es/../render/dist/webgl/filters.js","webpack://swf2es/../render/dist/webgl/gpu-textures.js","webpack://swf2es/../render/dist/shelves.js","webpack://swf2es/../render/dist/webgl/holds.js","webpack://swf2es/../render/dist/webgl/kernels.js","webpack://swf2es/../render/dist/webgl/stage.js","webpack://swf2es/../render/dist/webgl/backend.js","webpack://swf2es/../player/dist/display/stretch.js","webpack://swf2es/../player/dist/text/saffron.js","webpack://swf2es/../player/dist/scene/advanced.js","webpack://swf2es/../player/dist/scene/pixel-bender-glsl.js","webpack://swf2es/../player/dist/scene/filters.js","webpack://swf2es/../player/dist/scene/shapes.js","webpack://swf2es/../player/dist/scene/fills.js","webpack://swf2es/../player/dist/scene/paints.js","webpack://swf2es/../player/dist/scene/filter-layers.js","webpack://swf2es/../player/dist/scene/strokes.js","webpack://swf2es/../player/dist/scene/lines.js","webpack://swf2es/../player/dist/scene/text.js","webpack://swf2es/../player/dist/scene/text-items.js","webpack://swf2es/../player/dist/scene/masks.js","webpack://swf2es/../player/dist/scene/parts.js","webpack://swf2es/../player/dist/scene/planes.js","webpack://swf2es/../player/dist/scene/context-menu.js","webpack://swf2es/../player/dist/scene/stale-shapes.js","webpack://swf2es/../player/dist/scene/view.js","webpack://swf2es/../player/dist/scene/hidden.js","webpack://swf2es/../player/dist/display/plane.js","webpack://swf2es/../player/dist/scene/pointer.js","webpack://swf2es/../player/dist/input/canvas.js"],"sourcesContent":["import { renderInstance, renderModule } from \"./module.js\";\n/**\n * A shape layer's lines built in one call by the render module's\n * strokes.zig, its outlines filled by the module's libtess2, or its bands\n * where libtess2 fails: the caller writes the layer into input() as\n * strokes.zig reads it (the player's scene/strokes.ts) and calls build()\n * with its length. Its instance is its own, apart from any Tessellator's,\n * and held to the same limits as a Tessellator's (TessellatorOptions),\n * which pass them on: where a fill would have run out of memory, so do the\n * lines, and none are drawn.\n */\nexport class LineBuilder {\n instance = null;\n view = new Float64Array(0);\n layout = new Uint32Array(0);\n /** libtess2 trapped the last instance: the next fills its outlines by the bands alone. */\n trapped = false;\n lastUnwound = false;\n limit;\n keep;\n bands;\n constructor(options = {}) {\n this.limit = options.memoryLimit ?? 128 << 20;\n this.keep = options.retainMemory ?? 8 << 20;\n this.bands = options.bands ?? false;\n renderModule();\n }\n /** Whether the last build() unwound, which the next, in a new instance by the bands, may not. */\n get unwound() {\n return this.lastUnwound;\n }\n /** Current retained Wasm capacity. */\n get capacity() {\n return this.instance?.memory.buffer.byteLength ?? 0;\n }\n /** A view of at least `n` f64s of input, valid until build(); null where no instance could be made. */\n input(n) {\n if (!this.instance) {\n try {\n this.instance = renderInstance(() => {\n throw new Error(\"line tessellation allocation failed\");\n });\n }\n catch {\n return null;\n }\n this.instance.setLimit(this.limit);\n this.instance.bandsOnly(Number(this.bands || this.trapped));\n }\n const x = this.instance;\n if (n > this.view.length || this.view.buffer !== x.memory.buffer) {\n const size = Math.max(n, this.view.length * 2, 1024);\n const at = x.lineInput(size);\n if (!at) {\n this.dispose();\n return null;\n }\n this.view = new Float64Array(x.memory.buffer, at, size);\n }\n return this.view;\n }\n /**\n * The layer in the input's first `length` f64s, copied out in one\n * block: null for none, undefined where the module refused it (a\n * position not a number) or failed. Where libtess2 trapped, the next\n * instance fills the layer's outlines by the bands alone, for the\n * caller's next input() and build().\n */\n build(length) {\n this.lastUnwound = false;\n const x = this.instance;\n if (!x) {\n return undefined;\n }\n try {\n const status = x.lineBuild(length);\n // Built without unwinding: libtess2 again for the next.\n if (this.trapped) {\n this.trapped = false;\n x.bandsOnly(Number(this.bands));\n }\n if (status !== 0) {\n return undefined;\n }\n const [at, vertices, count] = this.header(x);\n if (count === 0) {\n return null;\n }\n const copy = x.memory.buffer.slice(at, at + (vertices * 3 + count) * 4);\n return {\n positions: new Float32Array(copy, 0, vertices * 2),\n colors: new Uint32Array(copy, vertices * 8, vertices),\n indices: new Uint32Array(copy, vertices * 12, count),\n };\n }\n catch {\n // libtess2 unwound through the failure import: never resume that instance.\n this.dispose();\n this.trapped = true;\n this.lastUnwound = true;\n return undefined;\n }\n finally {\n if (this.capacity > this.keep) {\n this.dispose();\n }\n }\n }\n /** strokes.zig's layout, read again where memory grew. */\n header(x) {\n if (this.layout.buffer !== x.memory.buffer) {\n this.layout = new Uint32Array(x.memory.buffer, x.lineHeader(), 3);\n }\n return this.layout;\n }\n /** The instance let go, its memory with it; the next input() makes another. */\n dispose() {\n this.instance = null;\n this.view = new Float64Array(0);\n this.layout = new Uint32Array(0);\n }\n}\n//# sourceMappingURL=lines.js.map","import { LineBuilder } from \"./lines.js\";\nimport { renderInstance, renderModule } from \"./module.js\";\n/**\n * The commands of a contour layer() takes, each followed by its\n * coordinates: MOVE x y and LINE x y; CURVE cx cy x y, a quadratic from\n * the pen; CUBIC c1x c1y c2x c2y x y. The pen starts each contour at 0, 0.\n * Curves are flattened to within 0.02 of the curve, in at most 256 chords;\n * repeated points are dropped, and contours of fewer than three points left out.\n */\nexport const PATH_MOVE = 1;\nexport const PATH_LINE = 2;\nexport const PATH_CURVE = 3;\nexport const PATH_CUBIC = 4;\n/** What root.zig takes of one fill; it rejects more too. */\nconst MOST_CONTOURS = 100000;\nconst MOST_POINTS = 1000000;\n/** A rule root.zig rejects, for a fill whose arrays already show it would reject them. */\nconst REJECTED = 2;\n/** The Int32s of root.zig's Layer, and of each fill's Range after it. */\nconst LAYER = 5;\nconst RANGE = 5;\n/**\n * Synchronous double-precision tessellator. It compiles the render module\n * as it is made, and throws where the host refuses it. A fill it refuses\n * (not finite, malformed, too large, or out of memory) is null.\n */\nexport class Tessellator {\n instance = null;\n limit;\n keep;\n bands;\n lines;\n constructor(options = {}) {\n this.limit = options.memoryLimit ?? 128 << 20;\n this.keep = options.retainMemory ?? 8 << 20;\n this.bands = options.bands ?? false;\n if (!Number.isInteger(this.limit) ||\n this.limit < 0 ||\n this.limit > 128 << 20 ||\n !Number.isInteger(this.keep) ||\n this.keep < 0 ||\n this.keep > 128 << 20) {\n throw new RangeError(\"invalid tessellator memory limit\");\n }\n renderModule();\n this.lines = new LineBuilder({\n memoryLimit: this.limit,\n retainMemory: this.keep,\n bands: this.bands,\n });\n this.tessellate = Object.assign(this.fill, { layer: this.layer, lines: this.lines });\n }\n /**\n * Current retained Wasm capacity, the line builder's included. Arena reset\n * alone does not shrink this memory.\n */\n get capacity() {\n return (this.instance?.memory.buffer.byteLength ?? 0) + this.lines.capacity;\n }\n dispose() {\n this.instance = null;\n this.lines.dispose();\n }\n /** The instance, made on first use, its arena reset; filling by the bands alone where `bands`. */\n arena(bands) {\n this.instance ??= renderInstance(() => {\n throw new Error(\"tessellation allocation failed\");\n });\n const x = this.instance;\n x.reset();\n x.setLimit(this.limit);\n x.bandsOnly(Number(bands));\n return x;\n }\n /** A call that threw: a trapped instance is never used again. */\n failed() {\n // In particular, longjmp unwinds through a throwing import: never resume that C instance. The\n // line builder's instance is its own.\n this.instance = null;\n }\n /** An instance grown past what is kept, let go. */\n trim() {\n if ((this.instance?.memory.buffer.byteLength ?? 0) > this.keep) {\n this.instance = null;\n }\n }\n /** One fill. The module checks the coordinates; only the arrays' lengths are looked at here. */\n fill = (contours, nonZero) => this.fillBy(contours, nonZero, this.bands);\n /** One fill, by the bands alone where `bands`; again so in a new instance where libtess2 trapped. */\n fillBy(contours, nonZero, bands) {\n if (contours.length > MOST_CONTOURS) {\n return null;\n }\n let count = 0;\n for (const points of contours) {\n if (points.length % 2 !== 0) {\n return null;\n }\n count += points.length / 2;\n }\n if (count > MOST_POINTS) {\n return null;\n }\n if (count === 0) {\n return { vertices: new Float64Array(), indices: new Uint16Array() };\n }\n try {\n const x = this.arena(bands);\n // One allocation: coordinates, then contours' ends.\n const coordAt = x.alloc(count * 16 + contours.length * 4);\n if (!coordAt) {\n throw new Error(\"tessellation input allocation failed\");\n }\n const endsAt = coordAt + count * 16;\n const coords = new Float64Array(x.memory.buffer, coordAt, count * 2);\n const ends = new Uint32Array(x.memory.buffer, endsAt, contours.length);\n let at = 0;\n for (let i = 0; i < contours.length; i++) {\n coords.set(contours[i], at);\n at += contours[i].length;\n ends[i] = at / 2;\n }\n if (x.run(coordAt, count, endsAt, contours.length, Number(nonZero)) !== 0) {\n return null;\n }\n // Growth can detach the input views. Cached geometry owns fresh copies of the final views.\n const vertices = new Float64Array(x.memory.buffer, x.vertices(), x.vertexCount() * 2).slice();\n const source = new Uint32Array(x.memory.buffer, x.indices(), x.triangleCount() * 3);\n const indices = vertices.length / 2 <= 0x10000 ? new Uint16Array(source) : source.slice();\n return { vertices, indices };\n }\n catch {\n this.failed();\n return bands ? null : this.fillBy(contours, nonZero, true);\n }\n finally {\n this.trim();\n }\n }\n /** Each fill flattened and tessellated, as `fill` would make its polygons, in one call and one copy out. */\n layer = (fills, nonZero) => this.layerBy(fills, nonZero, this.bands);\n /** The layer, by the bands alone where `bands`; again so in a new instance where libtess2 trapped. */\n layerBy(fills, nonZero, bands) {\n let length = 0;\n let contours = 0;\n const rules = new Uint8Array(fills.length);\n for (let i = 0; i < fills.length; i++) {\n const fill = fills[i];\n if (fill.length > MOST_CONTOURS) {\n rules[i] = REJECTED;\n continue;\n }\n for (let j = 0; j < fill.length; j++) {\n length += fill[j].length;\n }\n rules[i] = Number(nonZero[i]);\n contours += fill.length;\n }\n let ranges;\n let vertices;\n let indices;\n try {\n // One allocation: commands, contours' ends, each fill's last contour, then rules.\n const x = this.arena(bands);\n const commandAt = x.alloc(length * 8 + contours * 4 + fills.length * 5);\n if (!commandAt) {\n throw new Error(\"tessellation input allocation failed\");\n }\n const endsAt = commandAt + length * 8;\n const fillsAt = endsAt + contours * 4;\n const rulesAt = fillsAt + fills.length * 4;\n const commands = new Float64Array(x.memory.buffer, commandAt, length);\n const ends = new Uint32Array(x.memory.buffer, endsAt, contours);\n const lasts = new Uint32Array(x.memory.buffer, fillsAt, fills.length);\n new Uint8Array(x.memory.buffer, rulesAt, fills.length).set(rules);\n let at = 0;\n let contour = 0;\n for (let i = 0; i < fills.length; i++) {\n if (rules[i] !== REJECTED) {\n const fill = fills[i];\n for (let j = 0; j < fill.length; j++) {\n commands.set(fill[j], at);\n at += fill[j].length;\n ends[contour++] = at;\n }\n }\n lasts[i] = contour;\n }\n const head = x.layer(commandAt, length, endsAt, contours, fillsAt, rulesAt, fills.length);\n if (head === 0) {\n // The layer's own output did not fit: a call a fill.\n return fills.length === 1\n ? [null]\n : fills.map((fill, i) => this.alone(fill, nonZero[i], bands));\n }\n // The one copy out, its ranges read before a retry resets the arena.\n const buffer = x.memory.buffer;\n ranges = new Int32Array(buffer, head, LAYER + fills.length * RANGE).slice();\n vertices = new Float64Array(buffer, ranges[0], ranges[2] * 2).slice();\n indices =\n ranges[4] === 2\n ? new Uint16Array(buffer, ranges[1], ranges[3]).slice()\n : new Uint32Array(buffer, ranges[1], ranges[3]).slice();\n }\n catch {\n this.failed();\n if (bands) {\n return null;\n }\n // libtess2 trapped: each fill in a fresh instance, and one that traps alone again by the\n // bands, which never trap.\n return fills.length === 1\n ? this.layerBy(fills, nonZero, true)\n : fills.map((fill, i) => this.alone(fill, nonZero[i], false));\n }\n finally {\n this.trim();\n }\n const out = new Array(fills.length);\n for (let i = 0; i < fills.length; i++) {\n const range = LAYER + i * RANGE;\n const status = ranges[range];\n if (status === 0) {\n const vertexStart = ranges[range + 1];\n const indexStart = ranges[range + 3];\n out[i] = {\n vertices: vertices.subarray(vertexStart * 2, (vertexStart + ranges[range + 2]) * 2),\n indices: indices.subarray(indexStart, indexStart + ranges[range + 4]),\n indexOffset: vertexStart,\n };\n }\n else {\n // Running out may be the layer's memory, where the fill alone fits.\n out[i] = status === -1 && fills.length > 1 ? this.alone(fills[i], nonZero[i], bands) : null;\n }\n }\n return out;\n }\n /** One fill's commands as a layer of its own, in a fresh arena. */\n alone(contours, nonZero, bands) {\n const geometry = this.layerBy([contours], [nonZero], bands)?.[0] ?? null;\n return geometry && { vertices: geometry.vertices, indices: geometry.indices };\n }\n /**\n * Use as RenderView's fillTessellator. A fill alone takes its contours\n * flattened already; a layer takes them as path commands; and a layer's\n * lines take the layer as the player packs it (`lines`).\n */\n tessellate;\n}\n//# sourceMappingURL=tessellator.js.map","/** Clear the target to a colour: params red, green, blue, alpha. */\nexport const CLEAR = 1;\n/** Draw the scene list's entries from `a`, `b` of them, under blend mode `c`. */\nexport const RUN = 2;\n/**\n * A mask: entries from `a`, `b` of them, drawn into the stencil, where what\n * follows is drawn; and taken out again, the same entries, once it is.\n */\nexport const STENCIL_PUSH = 3;\nexport const STENCIL_POP = 4;\n/**\n * A layer begun, drawn into a target of its own over the rectangle of the\n * target whose x, y, width and height are params from `a`, `b` 1 where\n * filters will read it past that rectangle, which is then clear too; and\n * composited onto the one below in blend mode `a`, coloured by row `b`\n * (or -1), its output kept as kept output `c` (Keeps), or not (-1).\n */\nexport const LAYER_PUSH = 5;\nexport const LAYER_POP = 6;\n/** The filters of chain `a` of the frame's filter list run over the layer drawn into, in turn. */\nexport const FILTER = 7;\n/**\n * A kept output (Keeps) composited again onto the target drawn into, in\n * blend mode `b`, coloured by row `c` (or -1): its rectangle's x, y, width\n * and height, then its id, are params from `a`.\n */\nexport const COMPOSITE = 8;\n/**\n * A filtered layer drawn ahead of the stage (plan), its draws, masks and\n * held layers' composites the operations between: begun over the\n * rectangle of params from `a`, its output held as held output `b`, at\n * level `c`, one past the deepest held layer in it; ended with chain `a`\n * of the frame's filters run over it, held output `b`. Held layers come\n * before the stage's CLEAR, a level's after those it holds, and the\n * backend draws a level's side by side, their passes too.\n */\nexport const HOLD_PUSH = 9;\nexport const HOLD_POP = 10;\n/** Held output `a` composited onto the target drawn into, in blend mode `b`, coloured by row `c` (or -1). */\nexport const HELD = 11;\n/**\n * What a frame asks of the backend, in order: each operation an opcode and\n * three integers, with the floats some take apart.\n */\nexport class Commands {\n ops = new Int32Array(256);\n params = new Float32Array(64);\n length = 0;\n paramLength = 0;\n /**\n * Whether a layer is composited onto the target itself in erase or alpha,\n * which leaves it less than opaque where it covers, as adl clears the\n * stage, for the blends after it to read.\n */\n clearsTarget = false;\n /**\n * Whether the stage stays opaque throughout: cleared to an opaque colour,\n * and nothing composited onto it that leaves less, erase, alpha or a\n * blend shader. GL's blending computes more of Flash's blends over it.\n */\n opaqueStage = false;\n reset() {\n this.length = 0;\n this.paramLength = 0;\n this.clearsTarget = false;\n this.opaqueStage = false;\n }\n push(op, a = 0, b = 0, c = 0) {\n if ((this.length + 1) * 4 > this.ops.length) {\n const grown = new Int32Array(this.ops.length * 2);\n grown.set(this.ops);\n this.ops = grown;\n }\n const at = this.length++ * 4;\n this.ops[at] = op;\n this.ops[at + 1] = a;\n this.ops[at + 2] = b;\n this.ops[at + 3] = c;\n }\n /** Floats for the operation pushed next, where it reads them from. */\n param(...values) {\n const at = this.paramLength;\n if (at + values.length > this.params.length) {\n const grown = new Float32Array(Math.max(this.params.length * 2, at + values.length));\n grown.set(this.params);\n this.params = grown;\n }\n this.params.set(values, at);\n this.paramLength += values.length;\n return at;\n }\n}\n//# sourceMappingURL=commands.js.map","// The fragment shaders of Flash's filters, as adl draws them (docs/architecture/compositing.md,\n// \"Filters\"), which the renderer's passes (webgl/filters.ts) run, so that their\n// exactness rules live in one place. GLSL ES 3 bodies, with no version or precision\n// line; each reads vTextureCoord, its input's texture coordinate, and writes finalColor.\n/** Truncated to 8 bits, as adl's each pass is: a hair over, so that an exact value stays. */\nexport const TRUNCATE = \"floor(c * 255.0 + 0.001) / 255.0\";\n/**\n * One run of the box one way: `uWidth` texels wide, its end texels weighted\n * by their part; `uDirection` a texel's step in the input's pixels, which\n * uInputSize gives the coordinates in.\n */\nexport const BOX = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\n// As the vertex shader has it, which is highp: a program's uniforms agree.\nuniform highp vec4 uInputSize;\nuniform vec2 uDirection;\nuniform float uWidth;\nvoid main(void) {\n float half_ = uWidth * 0.5;\n int reach = int(ceil(half_));\n vec4 sum = vec4(0.0);\n // As far as 255 pixels at 4 texels a pixel, each way.\n for (int i = 0; i <= 2040; i++) {\n if (i > 2 * reach) { break; }\n float f = float(i - reach);\n float weight = max(0.0, min(f + 0.5, half_) - max(f - 0.5, -half_));\n sum += texture(uTexture, vTextureCoord + uDirection * uInputSize.zw * f) * weight;\n }\n vec4 c = sum / uWidth;\n finalColor = ${TRUNCATE};\n}`;\n// The mean of the uFactor.x by uFactor.y texels of the input that a texel of the output covers,\n// the output that many times narrower and lower (blurShrink). Two texels each way a read: a linear read midway between texel centres is their mean, so a\n// block takes a quarter of the reads. An odd factor's last column or row is read alone, weighted\n// by the texels each read stands for. A pool texture has no levels but its base.\nexport const SHRINK = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform highp vec4 uInputPixel;\nuniform vec2 uFactor;\nvoid main(void) {\n vec4 sum = vec4(0.0);\n vec2 centre = (uFactor - 1.0) * 0.5;\n for (int j = 0; j < 16; j += 2) {\n float y = float(j);\n if (y >= uFactor.y) { break; }\n float ny = min(2.0, uFactor.y - y);\n for (int i = 0; i < 16; i += 2) {\n float x = float(i);\n if (x >= uFactor.x) { break; }\n float nx = min(2.0, uFactor.x - x);\n vec2 at = vec2(x, y) + (vec2(nx, ny) - 1.0) * 0.5 - centre;\n sum += texture(uTexture, vTextureCoord + at * uInputPixel.zw) * (nx * ny);\n }\n }\n finalColor = sum / (uFactor.x * uFactor.y);\n}`;\n/** A blur's runs, done coarser (blurred), drawn back between their texels over the input's frame. */\nexport const READ_BACK = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uBlurred;\nuniform vec2 uBlurredScale;\nvoid main(void) {\n finalColor = texture(uBlurred, vTextureCoord * uBlurredScale);\n}`;\n/**\n * A glow or a shadow: the input's blurred alpha (uBlurred), from `uOffset`\n * texels back for a shadow, times strength and alpha, in its colour; behind\n * the object, or inside it for an inner one; the object kept, or not.\n */\nexport const GLOW = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform sampler2D uBlurred;\nuniform highp vec4 uInputSize;\nuniform vec3 uColor;\nuniform float uAlpha;\nuniform float uStrength;\nuniform vec2 uOffset;\nuniform vec2 uBlurredScale;\nuniform float uInner;\nuniform float uKnockout;\nuniform float uHide;\nvoid main(void) {\n vec4 src = texture(uTexture, vTextureCoord);\n float a = texture(uBlurred, (vTextureCoord - uOffset * uInputSize.zw) * uBlurredScale).a;\n vec4 c;\n if (uInner > 0.5) {\n float g = clamp((1.0 - a) * uStrength, 0.0, 1.0) * uAlpha * src.a;\n vec4 glow = vec4(uColor * g, g);\n c = uKnockout > 0.5 ? glow : glow + src * (1.0 - g);\n } else {\n float g = clamp(a * uStrength, 0.0, 1.0) * uAlpha;\n vec4 glow = vec4(uColor * g, g);\n c = uKnockout > 0.5 ? glow * (1.0 - src.a) : uHide > 0.5 ? glow : src + glow * (1.0 - src.a);\n }\n finalColor = ${TRUNCATE};\n}`;\n/**\n * A bevel: the input's blurred alpha (uBlurred) from uOffset texels on and\n * back; their difference times strength, clamped, times the colour's alpha,\n * the highlight where on is more and the shadow where it is less. Inner\n * (uType 0) atop the object, outer (1) behind it, full (2) over it;\n * knocked out, alone, masked to where the object is (inner) or is not\n * (outer).\n */\nexport const BEVEL = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform sampler2D uBlurred;\nuniform highp vec4 uInputSize;\nuniform vec3 uHighlight;\nuniform vec3 uShadow;\nuniform float uHighlightAlpha;\nuniform float uShadowAlpha;\nuniform float uStrength;\nuniform vec2 uOffset;\nuniform float uType;\nuniform float uKnockout;\nvoid main(void) {\n // Keep source samples sharp; the bevel reads alpha at a stage pixel's centre.\n vec2 at = (floor(vTextureCoord * uInputSize.xy) + 0.5) * uInputSize.zw;\n vec4 src = texture(uTexture, vTextureCoord);\n vec2 step_ = uOffset * uInputSize.zw;\n // In 255ths, each read truncated, as adl's are.\n float on = floor(texture(uBlurred, at + step_).a * 255.0 + 0.001);\n float back = floor(texture(uBlurred, at - step_).a * 255.0 + 0.001);\n float d = on - back;\n bool lit = d > 0.0;\n float strong = min(255.0, floor(abs(d) * uStrength + 0.001));\n float la = floor(strong * (lit ? uHighlightAlpha : uShadowAlpha) + 0.5) / 255.0;\n float m = uType < 0.5 ? src.a : (uType < 1.5 && uKnockout > 0.5 ? 1.0 - src.a : 1.0);\n vec4 layer = vec4((lit ? uHighlight : uShadow) * la, la) * m;\n vec4 c;\n if (uKnockout > 0.5) {\n c = layer;\n } else if (uType > 0.5 && uType < 1.5) {\n c = src + layer * (1.0 - src.a);\n } else {\n c = layer + src * (1.0 - (uType < 0.5 ? la : layer.a));\n }\n finalColor = ${TRUNCATE};\n}`;\n/**\n * How a bevel or a gradient filter places its layer (premultiplied) on the\n * object's pixel, as bitmap/filters' placer does: masked to where the\n * object is (uType 0, inner) or, knocked out, is not (1, outer); inner\n * atop it, outer behind it, full (2) over it, knocked out alone.\n */\nexport const PLACE = `vec4 place(vec4 src, vec4 layer) {\n float m = uType < 0.5 ? src.a : (uType < 1.5 && uKnockout > 0.5 ? 1.0 - src.a : 1.0);\n vec4 masked = layer * m;\n if (uKnockout > 0.5) {\n return masked;\n }\n if (uType > 0.5 && uType < 1.5) {\n return src + masked * (1.0 - src.a);\n }\n return masked + src * (1.0 - (uType < 0.5 ? layer.a : masked.a));\n}`;\n/**\n * A gradient glow: the input's blurred alpha (uBlurred) from uOffset back,\n * as a shadow reads it, times strength, picking a texel of the gradient\n * (uGradient, 256 wide); a gradient bevel (uBevel 1): the difference of\n * that alpha on and back, the middle of the gradient where they agree.\n * Each pixel is evaluated once, at its centre, in 255ths truncated.\n */\nexport const GRADIENT = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform sampler2D uBlurred;\nuniform sampler2D uGradient;\nuniform highp vec4 uInputSize;\nuniform float uStrength;\nuniform vec2 uOffset;\nuniform float uType;\nuniform float uKnockout;\nuniform float uBevel;\nuniform vec4 uRegion;\n${PLACE}\nfloat alphaAt(vec2 at) {\n return floor(texture(uBlurred, at).a * 255.0 + 0.001);\n}\nvoid main(void) {\n vec2 p = floor(vTextureCoord * uInputSize.xy) + 0.5;\n // Past the filter's rect it draws nothing, though its gradient may have colour at 0.\n if (any(lessThan(p, uRegion.xy)) || any(greaterThanEqual(p, uRegion.zw))) {\n finalColor = vec4(0.0);\n return;\n }\n vec2 at = p * uInputSize.zw;\n vec4 src = texture(uTexture, at);\n vec2 step_ = uOffset * uInputSize.zw;\n float index;\n if (uBevel > 0.5) {\n float d = clamp(floor((alphaAt(at + step_) - alphaAt(at - step_)) * uStrength), -255.0, 255.0);\n index = floor((d + 256.0) / 2.0);\n } else {\n index = min(255.0, floor(alphaAt(at - step_) * uStrength + 0.001));\n }\n vec4 layer = texture(uGradient, vec2((index + 0.5) / 256.0, 0.5));\n vec4 c = place(src, layer);\n finalColor = ${TRUNCATE};\n}`;\n/**\n * A displacement map, in the input's pixels from its frame's corner: each\n * pixel of the object's (uBox) where the map lies (uMapAt, uMapSize) takes\n * the input at itself moved by the map's channel (uComponents picks one\n * for x, one for y) less 128, times scale, in 256ths toward 0, between\n * pixels with weights in 256ths; past the object's pixels as uMode says:\n * 0 wrap, 1 clamp, 2 its own place, 3 uColor, which also fills uGrow pixels\n * round the object, as adl's drawing of it does. Each pixel once, at its\n * centre.\n */\nexport const DISPLACE = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform sampler2D uMap;\nuniform highp vec4 uInputSize;\nuniform vec4 uBox;\nuniform vec4 uMapAt;\nuniform vec4 uComponentX;\nuniform vec4 uComponentY;\nuniform vec2 uScale;\nuniform float uMode;\nuniform vec4 uColor;\nuniform vec2 uGrow;\nvec4 read(vec2 at, vec2 own) {\n vec2 size = uBox.zw - uBox.xy;\n vec2 i = at - uBox.xy;\n if (any(lessThan(i, vec2(0.0))) || any(greaterThanEqual(i, size))) {\n if (uMode < 0.5) {\n i = mod(i, size);\n } else if (uMode < 2.5) {\n i = clamp(i, vec2(0.0), size - 1.0);\n } else {\n return uColor;\n }\n }\n return texture(uTexture, (uBox.xy + i + 0.5) * uInputSize.zw);\n}\nvoid main(void) {\n vec2 p = floor(vTextureCoord * uInputSize.xy);\n vec4 own = texture(uTexture, (p + 0.5) * uInputSize.zw);\n vec2 m = p - uMapAt.xy;\n if (any(lessThan(p, uBox.xy)) || any(greaterThanEqual(p, uBox.zw))) {\n bool near = all(greaterThanEqual(p, uBox.xy - uGrow)) && all(lessThan(p, uBox.zw + uGrow));\n finalColor = uMode > 2.5 && near ? uColor : vec4(0.0);\n return;\n }\n if (any(lessThan(m, vec2(0.0))) || any(greaterThanEqual(m, uMapAt.zw))) {\n finalColor = own;\n return;\n }\n vec4 map = texture(uMap, (m + 0.5) / uMapAt.zw);\n vec4 straight = map.a > 0.0 ? vec4(map.rgb / map.a, map.a) : vec4(0.0);\n vec2 c = floor(vec2(dot(straight, uComponentX), dot(straight, uComponentY)) * 255.0 + 0.5);\n // None picked: no move.\n c = vec2(uComponentX == vec4(0.0) ? 128.0 : c.x, uComponentY == vec4(0.0) ? 128.0 : c.y);\n // Toward 0, without trunc, which GLSL ES 1 has not.\n vec2 moved = (c - 128.0) * uScale;\n vec2 q = p * 256.0 + sign(moved) * floor(abs(moved));\n vec2 whole = floor(q / 256.0);\n vec2 f = q - whole * 256.0;\n if (uMode > 1.5 && uMode < 2.5) {\n vec2 i = whole - uBox.xy;\n vec2 size = uBox.zw - uBox.xy;\n whole = vec2(i.x < 0.0 || i.x >= size.x ? p.x : whole.x, i.y < 0.0 || i.y >= size.y ? p.y : whole.y);\n }\n float w00 = floor((256.0 - f.x) * (256.0 - f.y) / 256.0);\n float w10 = floor(f.x * (256.0 - f.y) / 256.0);\n float w01 = floor((256.0 - f.x) * f.y / 256.0);\n float w11 = floor(f.x * f.y / 256.0);\n vec4 v = read(whole, p) * w00 + read(whole + vec2(1.0, 0.0), p) * w10 +\n read(whole + vec2(0.0, 1.0), p) * w01 + read(whole + vec2(1.0, 1.0), p) * w11;\n vec4 c8 = floor(v * 255.0 / 256.0 + 0.001) / 255.0;\n finalColor = c8;\n}`;\n/** A colour matrix of a pixel's straight colour, its offsets in 255ths, transparent pixels too. */\nexport const MATRIX = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform mat4 uMatrix;\nuniform vec4 uOffset;\nvoid main(void) {\n vec4 src = texture(uTexture, vTextureCoord);\n vec4 straight = src.a > 0.0 ? vec4(src.rgb / src.a, src.a) : vec4(0.0);\n vec4 s = clamp(uMatrix * straight + uOffset, 0.0, 1.0);\n vec4 c = vec4(s.rgb * s.a, s.a);\n finalColor = ${TRUNCATE};\n}`;\n/**\n * A convolution, in 255ths: the taps' straight colour over uBox, the\n * object's pixels as adl filters them, in the input's pixels from its\n * frame's corner; past it the nearest edge's or uEdge; summed, divided,\n * biased, clamped and premultiplied as bitmap/filters' convolve does, the\n * fixed-point way too (uReciprocal not 0) where every tap lies in the box.\n */\nexport const CONVOLUTION = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform highp vec4 uInputSize;\nuniform vec4 uMatrix[57];\nuniform vec2 uSize;\nuniform vec4 uBox;\nuniform vec4 uEdge;\nuniform float uDivisor;\nuniform float uReciprocal;\nuniform float uBias;\nuniform float uClamp;\nuniform float uPreserve;\nvec4 straight(vec2 p) {\n if (any(lessThan(p, uBox.xy)) || any(greaterThanEqual(p, uBox.zw))) {\n if (uClamp < 0.5) { return uEdge; }\n p = clamp(p, floor(uBox.xy) + 0.5, floor(uBox.zw) - 0.5);\n }\n vec4 c = texture(uTexture, p * uInputSize.zw);\n return c.a > 0.0 ? floor(vec4(c.rgb / c.a, c.a) * 255.0 + 0.5) : vec4(0.0);\n}\nvoid main(void) {\n // The pixel's centre, which all its texels read alike, as adl's one pixel.\n vec2 p = floor(vTextureCoord * uInputSize.xy) + 0.5;\n vec2 reach = floor(uSize * 0.5);\n if (any(lessThan(p, uBox.xy - reach)) || any(greaterThanEqual(p, uBox.zw + reach))) {\n finalColor = vec4(0.0);\n return;\n }\n bool fixed_ = uReciprocal != 0.0 && all(greaterThanEqual(p - 1.0, uBox.xy)) &&\n all(lessThan(p + 1.0, uBox.zw));\n int cols = int(uSize.x);\n int count = cols * int(uSize.y);\n vec4 sum = vec4(0.0);\n // One loop, its index alone indexing the weights, as GLSL ES 1 allows.\n for (int k = 0; k < 225; k++) {\n if (k >= count) { break; }\n float w = dot(uMatrix[k / 4], vec4(equal(vec4(float(k - k / 4 * 4)), vec4(0.0, 1.0, 2.0, 3.0))));\n if (w != 0.0) {\n int j = k / cols;\n vec2 at = vec2(float(k - j * cols), float(j)) - reach;\n sum += straight(fixed_ && k == 8 ? p : p + at) * w;\n }\n }\n sum = fixed_ ? floor(sum * uReciprocal) : sum / uDivisor;\n vec4 v = floor(clamp(sum + uBias, 0.0, 255.0) + 0.0001);\n float a = uPreserve > 0.5 ? straight(p).a : v.a;\n vec3 c = fixed_ ? floor(v.rgb * a / 255.0) : floor((v.rgb * a + 127.0) / 255.0);\n finalColor = vec4(c, a) / 255.0;\n}`;\n//# sourceMappingURL=filter-shaders.js.map","// Flash's filters as passes a layer takes before it is composited: what\n// each kind reads, as the floats a frame's filter list holds for it, and\n// the rules its passes keep to match adl (docs/architecture/compositing.md,\n// \"Filters\"), which the backend's runner (webgl/filters.ts) follows.\n// Offsets and insets are in the target's units, its pixels over the\n// resolution, as the shaders read their input's size in.\n/** A blur: blurX, blurY, quality, units (the target's units a stage pixel). */\nexport const BLUR = 1;\n/**\n * A glow or a drop shadow: blurX, blurY, quality, units; its colour's red,\n * green and blue from 0 to 1, alpha, strength; the offset x and y it is\n * cast by; inner, knockout and hide object, 1 or 0.\n */\nexport const GLOW = 2;\n/**\n * A bevel: blurX, blurY, quality, units; the highlight's red, green and\n * blue, the shadow's, the highlight's alpha, the shadow's, strength; the\n * offset x and y; its type (0 inner, 1 outer, 2 full), knockout.\n */\nexport const BEVEL = 3;\n/**\n * A gradient glow or bevel, its texture the gradient's 256 colours: blurX,\n * blurY, quality, units, strength; the offset x and y; type, knockout,\n * bevel (1, else a glow); how far in the object's pixels start; how far\n * its rect grows past them in stage pixels, left, top, right and bottom.\n */\nexport const GRADIENT = 4;\n/** A colour matrix: its 4 by 4 part by columns, then its offsets over 255. */\nexport const COLOR_MATRIX = 5;\n/**\n * A convolution: its columns and rows; the edge colour's red, green, blue\n * and alpha in 255ths; divisor, the fixed-point reciprocal over 65536 (0\n * for none), bias, clamp, preserve alpha; how far in the object's pixels\n * start; then the matrix by rows.\n */\nexport const CONVOLUTION = 6;\n/**\n * A displacement map, its texture the map's pixels: the channel that\n * moves x, picked by four weights for red, green, blue and alpha, and the\n * one that moves y; scale x and y; its mode (0 wrap, 1 clamp, 2 ignore, 3\n * colour), the colour's red, green, blue and alpha, premultiplied, and how\n * far round the object it fills, x and y; how far in the object's pixels\n * start; the map's point, and its width and height.\n */\nexport const DISPLACEMENT = 7;\n/**\n * A ShaderFilter, its kernel's GLSL the filter's kernel (kernel-shaders.ts):\n * units; how far in from its input's corner the filter's input starts, and\n * how far the first filter's, the object's bitmap, is from that, both in\n * units; its extensions left, top, right and bottom in stage pixels; how\n * many images it samples, then each one's texture number, the texture of\n * the frame's it reads (-1 for the layer) and whether its texels are\n * floats; how many floats its parameters take, then them. Its parameters'\n * ints are the filter's ints (Filters.ints).\n */\nexport const SHADER = 8;\n/**\n * A blend shader, alone in a chain a layer's KERNEL mode names, which no\n * filter pass runs: its values as SHADER's, its images' textures -1 for\n * what is below and -2 for the layer, but its first, 1 where it blends\n * the layer's whole rectangle rather than where the layer covers anything.\n */\nexport const BLEND = 9;\n/**\n * A shader fill, alone in a chain a SHADED draw names (scene.ts), which no\n * filter pass runs: its values as SHADER's, every image a texture.\n */\nexport const FILL_SHADER = 10;\n/**\n * A frame's filters in chains, one a filtered layer: each filter its kind,\n * its values and the texture it reads (-1 for none), written in order and\n * closed into a chain the layer's end names.\n */\nexport class Filters {\n kind = new Uint8Array(64);\n texture = new Int32Array(64);\n /** A ShaderFilter's kernel, its GLSL, by the filter; null for the others. */\n kernels = [];\n /** Where each filter's values start in `values`, and where the next one's do. */\n start = new Int32Array(65);\n values = new Float32Array(1024);\n /** Each filter's ints, which floats would round: from `intStart` on, as values are. */\n intStart = new Int32Array(65);\n ints = new Int32Array(256);\n count = 0;\n /** Where each chain's filters start, and where the next one's do: the first's, 0. */\n chains = new Int32Array(17);\n chainCount = 0;\n /** Moves on at each reset: a chain number is good while it is the same. */\n generation = 0;\n reset() {\n this.count = 0;\n this.chainCount = 0;\n this.kernels.length = 0;\n this.generation++;\n }\n /** A filter of `kind` added to the chain open: its values, the texture it reads, its kernel and its ints. */\n add(kind, values, texture = -1, kernel = null, ints = NO_INTS) {\n const at = this.count++;\n if (this.count >= this.kind.length) {\n this.kind = grow(this.kind);\n this.texture = grow(this.texture);\n this.start = grow(this.start);\n this.intStart = grow(this.intStart);\n }\n const intFrom = at > 0 ? this.intStart[at] : 0;\n if (intFrom + ints.length > this.ints.length) {\n const grown = new Int32Array(Math.max(this.ints.length * 2, intFrom + ints.length));\n grown.set(this.ints);\n this.ints = grown;\n }\n this.intStart[at] = intFrom;\n this.ints.set(ints, intFrom);\n this.intStart[at + 1] = intFrom + ints.length;\n const from = at > 0 ? this.start[at] : 0;\n if (from + values.length > this.values.length) {\n const grown = new Float32Array(Math.max(this.values.length * 2, from + values.length));\n grown.set(this.values);\n this.values = grown;\n }\n this.kind[at] = kind;\n this.texture[at] = texture;\n this.kernels[at] = kernel;\n this.start[at] = from;\n this.values.set(values, from);\n this.start[at + 1] = from + values.length;\n }\n /** The filters added since the last chain closed, as a chain: its number. */\n close() {\n const chain = this.chainCount++;\n if (this.chainCount >= this.chains.length) {\n this.chains = grow(this.chains);\n }\n this.chains[chain + 1] = this.count;\n return chain;\n }\n}\nconst NO_INTS = new Int32Array(0);\nfunction grow(array) {\n const grown = new array.constructor(array.length * 2);\n grown.set(array);\n return grown;\n}\n/**\n * The fewest texels a shrunk run spans, for each time a glow's strength\n * multiplies its alpha. Under it the bound below fails: an edge's ramp a\n * few coarse texels long bends sharply where a box ends, and drawn back\n * linearly between them a glow 8 wide at strength 2.37 shrunk three times\n * was off by 10 levels; a glow's strength multiplies that too.\n */\nconst SHRUNK_TEXELS = 8;\n/** The most, in 255ths of alpha times strength, that drawing a shrunk blur back may be off by. */\nconst SHRUNK_ERROR = 2;\n/**\n * The strongest glow or shadow a shrunk blur serves. Each run truncates to\n * a 255th, and drawn back between coarser texels a level's step moves by up\n * to a texel: off by a level the strength multiplies, however wide the blur.\n */\nconst SHRUNK_STRENGTH = 3;\n/**\n * How many times coarser than its input a blur's runs one way may go: none\n * at a texel a stage pixel or under, nor where it does not blur that way;\n * otherwise whole times, to a texel a stage pixel at most, the run still\n * SHRUNK_TEXELS wide for each time strength multiplies it. A run reads a\n * texel for each of its width, so at three texels a stage pixel a glow 68\n * wide read 204 for each texel of an area nine times the stage's; shrunk\n * three times each way, it reads 68 for each of the stage's. Drawn back\n * between the coarser texels, what it blurred is off where it bends: at the\n * ends of a single box's ramp by a quarter of a coarse texel's rise, and\n * where two boxes or more bend smoothly by a sixth of the coarse texel\n * squared over the box's width squared; times the strength a glow multiplies\n * its alpha by, that stays within SHRUNK_ERROR. Each way is its own: a\n * streak 68 wide and 5 high goes coarser across alone.\n */\nexport function blurShrink(blur, quality, strength, texels) {\n if (!(blur > 1 && quality > 0) || strength > SHRUNK_STRENGTH) {\n return 1;\n }\n const box = blur * texels;\n const amplified = 255 * Math.max(1, strength);\n const error = quality === 1\n ? (4 * SHRUNK_ERROR * box) / amplified\n : box * Math.sqrt((6 * SHRUNK_ERROR) / amplified);\n const most = Math.min(16, Math.floor(texels + 1e-6), Math.floor(box / (SHRUNK_TEXELS * Math.max(1, strength))));\n return Math.max(1, Math.min(most, Math.floor(error)));\n}\n//# sourceMappingURL=filters.js.map","/**\n * Ids for what a frame may name, handed out and taken back: a reused id is\n * a new generation, which an old handle does not name; what goes unused\n * for its idle frames is removed; the backend takes what was removed since\n * it last looked. Geometries, textures and kept outputs are each one.\n */\nexport class Registry {\n generations = [];\n usedAt = [];\n idleFrames = [];\n held = [];\n free = [];\n /** Removed since the backend last took them. */\n removed = [];\n frame = 0;\n /** A new id, removed once unused for `idle` frames. */\n hold(idle) {\n const id = this.free.pop() ?? this.held.length;\n this.held[id] = true;\n this.generations[id] = (this.generations[id] ?? 0) + 1;\n this.usedAt[id] = this.frame;\n this.idleFrames[id] = idle;\n return { id, generation: this.generations[id] };\n }\n /** Whether `handle` still names what it was given for. */\n alive(handle) {\n return this.held[handle.id] === true && this.generations[handle.id] === handle.generation;\n }\n /** Whether `id` names anything now. */\n holds(id) {\n return this.held[id] === true;\n }\n /** How many ids there have been, the free ones among them. */\n get size() {\n return this.held.length;\n }\n /** How many ids name something now. */\n get count() {\n return this.held.length - this.free.length;\n }\n /** `id` let go of after `idle` unused frames, where that is fewer than it was given. */\n idleWithin(id, idle) {\n if (this.held[id] && idle < this.idleFrames[id]) {\n this.idleFrames[id] = idle;\n }\n }\n /**\n * `id` let go of after `idle` unused frames, more or fewer than before:\n * Infinity keeps it till it is removed, as a texture that alone holds what\n * was drawn into it is kept.\n */\n idleFor(id, idle) {\n if (this.held[id]) {\n this.idleFrames[id] = idle;\n }\n }\n /** `id` used this frame. */\n use(id) {\n this.usedAt[id] = this.frame;\n }\n remove(id) {\n if (this.held[id]) {\n this.held[id] = false;\n this.removed.push(id);\n this.free.push(id);\n this.dropped(id);\n }\n }\n /** What `id` held, let go of as it is removed. */\n dropped(_id) { }\n /** Everything let go of, as a lost context took it: the owners add it again. */\n lost() {\n for (let id = 0; id < this.held.length; id++) {\n this.remove(id);\n }\n }\n /** A frame ends: what went unused too long is let go of. */\n endFrame() {\n for (let id = 0; id < this.held.length; id++) {\n if (this.held[id] && this.frame - this.usedAt[id] > this.idleFrames[id]) {\n this.remove(id);\n }\n }\n this.frame++;\n }\n}\n//# sourceMappingURL=registry.js.map","import { Registry } from \"./registry.js\";\n/**\n * How many frames a geometry may go undrawn before it is let go of: a\n * pool's object or a loop's rarer frame comes back within a few seconds.\n */\nexport const IDLE_FRAMES = 300;\n/** Floats a vertex of advanced text's glyph quads (GeometryData.glyphs). */\nexport const GLYPH_FLOATS = 18;\n/**\n * Every geometry a scene list may name, by id. What goes undrawn for\n * IDLE_FRAMES is let go of; its owner finds it gone by its handle and adds\n * it again. The backend takes what was added and removed since it last\n * looked (taken), and keeps its own copies.\n */\nexport class Geometries extends Registry {\n /** Changes only when a handle can have become stale, including expiry and context loss. */\n removalVersion = 0;\n data = [];\n /** Each geometry's box: its positions' least x and y, then their greatest. */\n boxes = new Float32Array(1024);\n /** Added since the backend last took them. */\n added = [];\n /** Changed in place since the backend last took them (update). */\n updated = [];\n add(data) {\n const handle = this.hold(IDLE_FRAMES);\n const id = handle.id;\n this.data[id] = data;\n this.added.push(id);\n this.measure(id);\n return handle;\n }\n /**\n * Geometry `id`'s arrays changed in place, their lengths as they were: its\n * box measured again, and its vertices copied again where they lie.\n */\n update(id) {\n if (this.data[id]) {\n this.measure(id);\n this.updated.push(id);\n }\n }\n measure(id) {\n const data = this.data[id];\n if (id * 4 >= this.boxes.length) {\n const grown = new Float32Array(Math.max(this.boxes.length * 2, id * 4 + 4));\n grown.set(this.boxes);\n this.boxes = grown;\n }\n const p = data.positions;\n let x0 = Number.POSITIVE_INFINITY;\n let y0 = Number.POSITIVE_INFINITY;\n let x1 = Number.NEGATIVE_INFINITY;\n let y1 = Number.NEGATIVE_INFINITY;\n for (let i = 0; i < p.length; i += 2) {\n x0 = Math.min(x0, p[i]);\n y0 = Math.min(y0, p[i + 1]);\n x1 = Math.max(x1, p[i]);\n y1 = Math.max(y1, p[i + 1]);\n }\n const box = this.boxes;\n box[id * 4] = x0;\n box[id * 4 + 1] = y0;\n box[id * 4 + 2] = x1;\n box[id * 4 + 3] = y1;\n }\n /**\n * The boxes of every geometry, four floats from `id * 4`: least x and y,\n * greatest x and y; a geometry of no vertices has its least past its\n * greatest.\n */\n get box() {\n return this.boxes;\n }\n get(id) {\n return this.data[id] ?? null;\n }\n /** The ids of every geometry held, in order. */\n live() {\n const ids = [];\n for (let id = 0; id < this.data.length; id++) {\n if (this.data[id]) {\n ids.push(id);\n }\n }\n return ids;\n }\n dropped(id) {\n this.removalVersion++;\n this.data[id] = null;\n }\n}\n//# sourceMappingURL=geometry.js.map","import { Registry } from \"./registry.js\";\n/** Frames a kept output may go undrawn before it is let go of, unless its owner says otherwise. */\nexport const KEEP_IDLE_FRAMES = 60;\n/**\n * The layers kept from one frame to the next, as Flash keeps a filtered\n * object's bitmap while nothing in it changed: an owner adds one, names it\n * on the layer whose output it keeps, and composites it again while it\n * stands (SceneList.keptLayer). The backend holds their targets, and lets\n * go of those removed; what goes undrawn for KEEP_IDLE_FRAMES is removed.\n */\nexport class Keeps extends Registry {\n /** A kept output's id, let go of once undrawn for `idle` frames. */\n add(idle = KEEP_IDLE_FRAMES) {\n return this.hold(idle);\n }\n}\n//# sourceMappingURL=keeps.js.map","import { ROW_FLOATS } from \"./rows.js\";\nimport { ALPHA_MASK, DRAW, KEPT, LAYER_BEGIN, LAYER_END, MASK_BEGIN, MASK_POP, MASK_USE, NO_WHOLE, WHOLE_ALIASED, } from \"./scene.js\";\n/** A hair, which keeps a padded edge on the pixel it lies on at any resolution. */\nconst TEXEL_SNAP = 1e-6;\n// Scratch stacks, four numbers an open area: least x and y, greatest x and y, in target pixels.\nconst areas = [];\nconst clips = [];\nconst open = [];\n// Each open layer's cut, four numbers as an area's: an alpha mask's rectangle in it (ALPHA_MASK).\nconst cuts = [];\n/**\n * Each layer's rectangle of the target (SceneList.layerRect), from what is\n * drawn in it: its draws' geometries placed by their rows, a mask's own\n * draws apart, what a mask clips cut to that mask's draws as it pops, and\n * the rectangles of the layers in it; out to whole pixels and a pixel more\n * each way, cut to the target. An alpha mask's layer is no part of the\n * unfiltered layer it ends, which it cuts to its own rectangle instead, as\n * nothing of that layer shows past it. What is drawn is what is measured,\n * so a layer covers its draws however they came to be where they are. A\n * filtered layer is measured as PixiJS's filter system measures it, which\n * the filters' exactness rules were found with: cut to the target, out to\n * whole pixels, then padded, not cut again; where nothing is drawn in it,\n * it draws nothing.\n */\nexport function measureLayers(scene, rows, geometries, target) {\n if (scene.layerCount === 0) {\n return;\n }\n areas.length = 0;\n clips.length = 0;\n open.length = 0;\n cuts.length = 0;\n pushEmpty(areas);\n const k = target.scale;\n const box = geometries.box;\n const m = rows.data;\n for (let i = 0; i < scene.length; i++) {\n switch (scene.kind[i]) {\n case DRAW:\n placeDraw(scene, i, box, m, k, areas);\n break;\n case MASK_BEGIN:\n // The mask's own draws, measured apart.\n pushEmpty(areas);\n break;\n case LAYER_BEGIN:\n open.push(scene.geometry[i]);\n pushEmpty(areas);\n cuts.push(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);\n break;\n case MASK_USE:\n // The mask's draws clip what follows, measured apart till it pops.\n moveTop(areas, clips);\n pushEmpty(areas);\n break;\n case MASK_POP: {\n const n = areas.length;\n const c = clips.length;\n const left = Math.max(areas[n - 4], clips[c - 4]);\n const top = Math.max(areas[n - 3], clips[c - 3]);\n const right = Math.min(areas[n - 2], clips[c - 2]);\n const bottom = Math.min(areas[n - 1], clips[c - 1]);\n areas.length = n - 4;\n clips.length = c - 4;\n if (right > left && bottom > top) {\n unionTop(left, top, right, bottom);\n }\n break;\n }\n case LAYER_END: {\n const n = areas.length;\n const layer = open.pop();\n const pad = scene.pads[layer];\n const c = cuts.length - 4;\n if (pad < 0) {\n const left = Math.max(0, Math.floor(areas[n - 4]) - 1, cuts[c]);\n const top = Math.max(0, Math.floor(areas[n - 3]) - 1, cuts[c + 1]);\n const right = Math.min(target.width, Math.ceil(areas[n - 2]) + 1, cuts[c + 2]);\n const bottom = Math.min(target.height, Math.ceil(areas[n - 1]) + 1, cuts[c + 3]);\n areas.length = n - 4;\n cuts.length = c;\n if (scene.geometry[i] === ALPHA_MASK) {\n // Not taken into the layer it ends, which it cuts to its rectangle: to nothing, where it\n // has none.\n if (right > left && bottom > top) {\n scene.layerRect(layer, left, top, right - left, bottom - top);\n }\n const p = c - 4;\n if (p >= 0) {\n cuts[p] = Math.max(cuts[p], left);\n cuts[p + 1] = Math.max(cuts[p + 1], top);\n cuts[p + 2] = Math.min(cuts[p + 2], right);\n cuts[p + 3] = Math.min(cuts[p + 3], bottom);\n }\n break;\n }\n if (right > left && bottom > top) {\n scene.layerRect(layer, left, top, right - left, bottom - top);\n unionTop(left, top, right, bottom);\n }\n break;\n }\n // The view puts no alpha mask straight in a filtered layer, which would run its filters on\n // what the mask left (cuts).\n cuts.length = c;\n const kept = scene.areas;\n for (let k = 0; k < 4; k++) {\n kept[layer * 4 + k] = areas[n - 4 + k];\n }\n filteredRect(scene.areas, layer * 4, pad, target, scene.layers, layer * 4, scene.wholes[layer], scene.objects);\n areas.length = n - 4;\n const r = scene.layers;\n const at = layer * 4;\n if (r[at + 2] > 0) {\n unionTop(r[at], r[at + 1], r[at] + r[at + 2], r[at + 1] + r[at + 3]);\n }\n break;\n }\n case KEPT: {\n // A kept output covers its rectangle, which its owner placed.\n const r = scene.layers;\n const at = scene.geometry[i] * 4;\n if (r[at + 2] > 0 && r[at + 3] > 0) {\n unionTop(r[at], r[at + 1], r[at] + r[at + 2], r[at + 1] + r[at + 3]);\n }\n break;\n }\n }\n }\n}\n/**\n * The rectangle a filtered layer padded by `pad` units covers, from its\n * area (least x and y, greatest x and y in target pixels, from `area[at]`)\n * as PixiJS's filter system has it (FilterSystem's _calculateFilterArea): in\n * units, the area cut to the target, out to whole pixels at the\n * resolution, or to whole stage pixels as `whole` says (SceneList.wholes),\n * padded; nothing where it has no size then; its edges snapped to the\n * pixels they lie on. Into `out` from `to`: x, y, width, height, of no\n * size for nothing. A whole layer's object, uncut, goes into `objects` at\n * `to` too (SceneList.objects).\n */\nexport function filteredRect(area, at, pad, target, out, to, whole = NO_WHOLE, objects = null) {\n const res = target.resolution;\n let x0 = area[at] / res;\n let y0 = area[at + 1] / res;\n let x1 = area[at + 2] / res;\n let y1 = area[at + 3] / res;\n out[to] = 0;\n out[to + 1] = 0;\n out[to + 2] = 0;\n out[to + 3] = 0;\n if (!(x1 > x0 && y1 > y0)) {\n return;\n }\n if (whole !== NO_WHOLE) {\n // Flash's bitmap of the object, of whole stage pixels, whatever the stage's scale; cut to the\n // target only after.\n const k = target.scale;\n const object = wholeBitmap(area[at] / k, area[at + 1] / k, area[at + 2] / k, area[at + 3] / k, whole);\n const ox0 = object[0] * k;\n const oy0 = object[1] * k;\n const ox1 = object[2] * k;\n const oy1 = object[3] * k;\n if (objects) {\n objects[to] = ox0;\n objects[to + 1] = oy0;\n objects[to + 2] = ox1 - ox0;\n objects[to + 3] = oy1 - oy0;\n }\n x0 = Math.max(ox0, 0) / res - pad;\n y0 = Math.max(oy0, 0) / res - pad;\n x1 = Math.min(ox1, target.width) / res + pad;\n y1 = Math.min(oy1, target.height) / res + pad;\n }\n else {\n // Each edge moved in alone, as Bounds.fitBounds does: an area off the target turns inside out,\n // and its padding may yet give it a size.\n x0 = Math.floor(Math.max(x0, 0) * res) / res - pad;\n y0 = Math.floor(Math.max(y0, 0) * res) / res - pad;\n x1 = Math.ceil(Math.min(x1, target.width / res) * res) / res + pad;\n y1 = Math.ceil(Math.min(y1, target.height / res) * res) / res + pad;\n }\n if (!(x1 - x0 > 0 && y1 - y0 > 0)) {\n return;\n }\n const left = Math.floor(x0 * res + TEXEL_SNAP);\n const top = Math.floor(y0 * res + TEXEL_SNAP);\n out[to] = left;\n out[to + 1] = top;\n out[to + 2] = Math.ceil(x1 * res - TEXEL_SNAP) - left;\n out[to + 3] = Math.ceil(y1 * res - TEXEL_SNAP) - top;\n}\n/** What wholeBitmap gives, read before it is asked again. */\nconst bitmap = [0, 0, 0, 0];\n/**\n * Flash's bitmap of an object of bounds x0, y0 to x1, y1 in stage pixels:\n * the bounds out to twips, then antialiased (WHOLE_SMOOTH) the pixels its\n * edges touch and one more right and down where an edge lies on one,\n * aliased (WHOLE_ALIASED) those whose centres it covers.\n */\nexport function wholeBitmap(x0, y0, x1, y1, whole) {\n x0 = Math.floor(x0 * 20 + TEXEL_SNAP) / 20;\n y0 = Math.floor(y0 * 20 + TEXEL_SNAP) / 20;\n x1 = Math.ceil(x1 * 20 - TEXEL_SNAP) / 20;\n y1 = Math.ceil(y1 * 20 - TEXEL_SNAP) / 20;\n if (whole === WHOLE_ALIASED) {\n bitmap[0] = Math.ceil(x0 - 0.5);\n bitmap[1] = Math.ceil(y0 - 0.5);\n bitmap[2] = Math.ceil(x1 - 0.5);\n bitmap[3] = Math.ceil(y1 - 0.5);\n }\n else {\n bitmap[0] = Math.floor(x0);\n bitmap[1] = Math.floor(y0);\n bitmap[2] = Math.floor(x1) + 1;\n bitmap[3] = Math.floor(y1) + 1;\n }\n return bitmap;\n}\n/**\n * The area of the target the draws from entry `from` on cover, at `scale`\n * target pixels a stage pixel, masks' own draws apart and nothing cut by\n * the masks: into `out`, its least x and y, then its greatest, in target\n * pixels; nothing drawn leaves the least past the greatest.\n */\nexport function drawnArea(scene, rows, geometries, from, scale, out) {\n out.length = 0;\n pushEmpty(out);\n let defining = 0;\n for (let i = from; i < scene.length; i++) {\n switch (scene.kind[i]) {\n case DRAW:\n if (defining === 0) {\n placeDraw(scene, i, geometries.box, rows.data, scale, out);\n }\n break;\n case MASK_BEGIN:\n defining++;\n break;\n case MASK_USE:\n defining--;\n break;\n }\n }\n}\n/** Entry `i`'s geometry box placed by its row at `k` target pixels a stage pixel, taken into the area atop `stack`. */\nfunction placeDraw(scene, i, box, m, k, stack) {\n const g = scene.geometry[i] * 4;\n const x0 = box[g];\n const y0 = box[g + 1];\n const x1 = box[g + 2];\n const y1 = box[g + 3];\n if (!(x1 >= x0 && y1 >= y0)) {\n return;\n }\n const r = scene.row[i] * ROW_FLOATS;\n const a = m[r] * k;\n const b = m[r + 1] * k;\n const c = m[r + 2] * k;\n const d = m[r + 3] * k;\n const tx = m[r + 4] * k;\n const ty = m[r + 5] * k;\n // The box's corners placed: each of the least and greatest a coordinate takes, by sign.\n const n = stack.length;\n stack[n - 4] = Math.min(stack[n - 4], tx + Math.min(a * x0, a * x1) + Math.min(c * y0, c * y1));\n stack[n - 3] = Math.min(stack[n - 3], ty + Math.min(b * x0, b * x1) + Math.min(d * y0, d * y1));\n stack[n - 2] = Math.max(stack[n - 2], tx + Math.max(a * x0, a * x1) + Math.max(c * y0, c * y1));\n stack[n - 1] = Math.max(stack[n - 1], ty + Math.max(b * x0, b * x1) + Math.max(d * y0, d * y1));\n}\nfunction pushEmpty(stack) {\n stack.push(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);\n}\n/** The top area of `from` moved onto `to`. */\nfunction moveTop(from, to) {\n const n = from.length;\n to.push(from[n - 4], from[n - 3], from[n - 2], from[n - 1]);\n from.length = n - 4;\n}\n/** The open area on top grown to take in the rectangle. */\nfunction unionTop(left, top, right, bottom) {\n const n = areas.length;\n areas[n - 4] = Math.min(areas[n - 4], left);\n areas[n - 3] = Math.min(areas[n - 3], top);\n areas[n - 2] = Math.max(areas[n - 2], right);\n areas[n - 1] = Math.max(areas[n - 1], bottom);\n}\n//# sourceMappingURL=measure.js.map","import { CLEAR, COMPOSITE, FILTER, HELD, HOLD_POP, HOLD_PUSH, LAYER_POP, LAYER_PUSH, RUN, STENCIL_POP, STENCIL_PUSH, } from \"./commands.js\";\nimport { ALPHA, DRAW, ERASE, KEPT, KERNEL, LAYER_BEGIN, LAYER_END, MASK_BEGIN, MASK_POP, MASK_USE, NO_WHOLE, } from \"./scene.js\";\n/**\n * Plan a frame: clear to `background` (0xAARRGGBB, straight), then a run\n * for each stretch of the list under one blend mode, each mask pushed into\n * the stencil and popped out, and each layer pushed and composited, where\n * their markers say; a layer of no size is left out, all in it. A filtered\n * layer of draws, masks and held layers alone, not kept, is held (findHolds):\n * drawn before the stage, with every other such of its level, after those\n * it holds (HOLD_PUSH), and composited where it stands (HELD). Pure: the\n * same list plans the same commands.\n */\nexport function plan(scene, background, out) {\n out.reset();\n open.length = 0;\n if (heldAt.length < scene.length) {\n heldAt = new Int32Array(Math.max(scene.length, heldAt.length * 2));\n }\n heldAt.fill(-1, 0, scene.length);\n findHolds(scene);\n // Numbered a level after another, in their order within each (a counting sort by level).\n levelStart.length = mostLevel + 2;\n levelStart.fill(0);\n for (let h = 0; h < heldBegin.length; h++) {\n levelStart[heldLevel[h] + 1]++;\n }\n for (let level = 1; level < levelStart.length; level++) {\n levelStart[level] += levelStart[level - 1];\n }\n heldOrder.length = heldBegin.length;\n for (let h = 0; h < heldBegin.length; h++) {\n heldOrder[levelStart[heldLevel[h]]++] = h;\n }\n for (let n = 0; n < heldOrder.length; n++) {\n heldAt[heldBegin[heldOrder[n]]] = n;\n }\n for (let n = 0; n < heldOrder.length; n++) {\n const h = heldOrder[n];\n const i = heldBegin[h];\n const end = heldEnd[h];\n out.push(HOLD_PUSH, layerParams(out, scene, scene.geometry[i]), n, heldLevel[h]);\n emit(scene, i + 1, end, out, false);\n out.push(HOLD_POP, scene.texture[end], n);\n }\n const alpha = (background >>> 24) / 255;\n out.push(CLEAR, out.param((((background >> 16) & 0xff) / 255) * alpha, (((background >> 8) & 0xff) / 255) * alpha, ((background & 0xff) / 255) * alpha, alpha));\n out.opaqueStage = alpha === 1;\n emit(scene, 0, scene.length, out, true);\n}\n/**\n * The commands for the list's entries from `from` to before `to`: a run for\n * each stretch under one blend mode, outside a mask's own draws, which its\n * markers name for the stencil; masks, layers and kept outputs where their\n * markers are; a held layer's composite where it begins (heldAt). Of the\n * `stage`, not a held layer's content, which clears its own page alone.\n */\nfunction emit(scene, from, to, out, stage) {\n let first = -1;\n let masking = false;\n const close = (end) => {\n if (first >= 0 && end > first) {\n out.push(RUN, first, end - first, scene.blend[first]);\n }\n first = -1;\n };\n for (let i = from; i < to; i++) {\n switch (scene.kind[i]) {\n case DRAW:\n if (!masking && first >= 0 && scene.blend[i] !== scene.blend[first]) {\n close(i);\n }\n if (!masking && first < 0) {\n first = i;\n }\n break;\n case MASK_BEGIN:\n close(i);\n masking = true;\n break;\n case MASK_USE:\n masking = false;\n out.push(STENCIL_PUSH, scene.geometry[i], scene.row[i]);\n break;\n case MASK_POP:\n close(i);\n out.push(STENCIL_POP, scene.geometry[i], scene.row[i]);\n break;\n case LAYER_BEGIN: {\n close(i);\n if (heldAt[i] >= 0) {\n const end = layerEnd(scene, i);\n out.push(HELD, heldAt[i], scene.geometry[end], scene.row[end]);\n if (stage) {\n noteClearing(out, scene.geometry[end]);\n }\n i = end;\n break;\n }\n const r = scene.layers;\n const at = scene.geometry[i] * 4;\n if (r[at + 2] <= 0 || r[at + 3] <= 0) {\n // Nothing of it shows: all in it left out, up to its end.\n i = layerEnd(scene, i);\n break;\n }\n open.push(scene.geometry[i]);\n out.push(LAYER_PUSH, layerParams(out, scene, scene.geometry[i]), scene.pads[scene.geometry[i]] >= 0 ? 1 : 0);\n break;\n }\n case LAYER_END:\n close(i);\n if (scene.texture[i] >= 0) {\n out.push(FILTER, scene.texture[i]);\n }\n out.push(LAYER_POP, scene.geometry[i], scene.row[i], scene.keeps[open.pop()]);\n noteClearing(out, scene.geometry[i]);\n break;\n case KEPT: {\n close(i);\n const r = scene.layers;\n const at = scene.geometry[i] * 4;\n if (r[at + 2] > 0 && r[at + 3] > 0) {\n out.push(COMPOSITE, out.param(r[at], r[at + 1], r[at + 2], r[at + 3], scene.texture[i]), scene.blend[i], scene.row[i]);\n noteClearing(out, scene.blend[i]);\n }\n break;\n }\n }\n }\n close(to);\n}\n/** Each entry's held layer, by number, where a layer it begins is held; else -1. */\nlet heldAt = new Int32Array(256);\n/** The held layers found (findHolds): where each begins and ends, and its level; the deepest level. */\nconst heldBegin = [];\nconst heldEnd = [];\nconst heldLevel = [];\n/** Where each level's held layers start in their numbering, and the held layers in it. */\nconst levelStart = [];\nconst heldOrder = [];\nlet mostLevel = 0;\n/** The layers open as findHolds walks: where each begins, the level its held layers reach, whether it may be held. */\nconst openBegin = [];\nconst openLevel = [];\nconst openHoldable = [];\n/**\n * The layers held: filtered, not kept for the frames after, of some size,\n * and of draws, masks and held layers alone, with no other layer or kept\n * output in them, whose content no other target takes part in. Each has a\n * level, one past the deepest of those in it, and leaves 0, so that a held\n * layer's are drawn before it. A layer of no size is left out, all in it.\n */\nfunction findHolds(scene) {\n heldBegin.length = 0;\n heldEnd.length = 0;\n heldLevel.length = 0;\n openBegin.length = 0;\n openLevel.length = 0;\n openHoldable.length = 0;\n mostLevel = 0;\n for (let i = 0; i < scene.length; i++) {\n switch (scene.kind[i]) {\n case LAYER_BEGIN: {\n const layer = scene.geometry[i];\n if (scene.layers[layer * 4 + 2] <= 0 || scene.layers[layer * 4 + 3] <= 0) {\n i = layerEnd(scene, i);\n break;\n }\n openBegin.push(i);\n openLevel.push(0);\n openHoldable.push(scene.pads[layer] >= 0 && scene.keeps[layer] < 0);\n break;\n }\n case KEPT:\n if (openHoldable.length > 0) {\n openHoldable[openHoldable.length - 1] = false;\n }\n break;\n case LAYER_END: {\n const begin = openBegin.pop();\n const level = openLevel.pop();\n const held = openHoldable.pop() && scene.texture[i] >= 0;\n if (held) {\n heldBegin.push(begin);\n heldEnd.push(i);\n heldLevel.push(level);\n mostLevel = Math.max(mostLevel, level);\n }\n const top = openBegin.length - 1;\n if (top >= 0) {\n if (held) {\n openLevel[top] = Math.max(openLevel[top], level + 1);\n }\n else {\n openHoldable[top] = false;\n }\n }\n break;\n }\n }\n }\n}\n/**\n * Layer `layer`'s params: its rectangle, then where its object lies in it\n * and its size (SceneList.objects), or a width of -1 for none, as a whole\n * layer's ShaderFilters read it.\n */\nfunction layerParams(out, scene, layer) {\n const r = scene.layers;\n const o = scene.objects;\n const at = layer * 4;\n return scene.wholes[layer] === NO_WHOLE\n ? out.param(r[at], r[at + 1], r[at + 2], r[at + 3], 0, 0, -1, -1)\n : out.param(r[at], r[at + 1], r[at + 2], r[at + 3], o[at] - r[at], o[at + 1] - r[at + 1], o[at + 2], o[at + 3]);\n}\n/** The layers pushed and not yet popped, by number, innermost last. */\nconst open = [];\n/**\n * A layer composited in `mode` noted where it clears the target itself\n * (Commands.clearsTarget), or may leave it less than opaque (opaqueStage).\n */\nfunction noteClearing(out, mode) {\n if (open.length === 0 && (mode === ERASE || mode === ALPHA)) {\n out.clearsTarget = true;\n }\n if (open.length === 0 && (mode === ERASE || mode === ALPHA || mode >= KERNEL)) {\n out.opaqueStage = false;\n }\n}\n/** The LAYER_END that closes the layer begun at entry `begin`. */\nfunction layerEnd(scene, begin) {\n let depth = 0;\n for (let i = begin; i < scene.length; i++) {\n switch (scene.kind[i]) {\n case LAYER_BEGIN:\n depth++;\n break;\n case LAYER_END:\n if (--depth === 0) {\n return i;\n }\n break;\n }\n }\n return scene.length;\n}\n//# sourceMappingURL=plan.js.map","/**\n * Floats a row: an object's transform on the stage and its colour\n * transform, four texels of a float texture. The linear part; the\n * translation; the multipliers; the offsets, over 255.\n */\nexport const ROW_FLOATS = 16;\n/** Rows a line of the rows' texture. */\nexport const ROWS_A_LINE = 256;\n/** The rows of a frame's draws, written in order and uploaded together. */\nexport class Rows {\n data = new Float32Array(ROWS_A_LINE * ROW_FLOATS);\n count = 0;\n /** Written from the first row again, as a frame starts. */\n reset() {\n this.count = 0;\n }\n /**\n * A row for the transform at `places[at]`, a b c d tx ty: numbers a\n * caller keeps in a typed array, so that none are boxed passing them.\n */\n addPlaced(places, at, ct) {\n return this.add(places[at], places[at + 1], places[at + 2], places[at + 3], places[at + 4], places[at + 5], ct);\n }\n /** A row for the translation of the transform at `places[at]` alone. */\n addTranslated(places, at, ct) {\n return this.add(1, 0, 0, 1, places[at + 4], places[at + 5], ct);\n }\n /**\n * A row for the transform `m` and, unless null, the colour transform's\n * multipliers and offsets `ct`: its index.\n */\n add(a, b, c, d, tx, ty, ct) {\n const row = this.count++;\n if (this.count * ROW_FLOATS > this.data.length) {\n const grown = new Float32Array(this.data.length * 2);\n grown.set(this.data);\n this.data = grown;\n }\n const out = this.data;\n const at = row * ROW_FLOATS;\n out[at] = a;\n out[at + 1] = b;\n out[at + 2] = c;\n out[at + 3] = d;\n out[at + 4] = tx;\n out[at + 5] = ty;\n out[at + 6] = 0;\n out[at + 7] = 0;\n out[at + 8] = ct ? ct.rMul : 1;\n out[at + 9] = ct ? ct.gMul : 1;\n out[at + 10] = ct ? ct.bMul : 1;\n out[at + 11] = ct ? ct.aMul : 1;\n out[at + 12] = ct ? ct.rAdd / 255 : 0;\n out[at + 13] = ct ? ct.gAdd / 255 : 0;\n out[at + 14] = ct ? ct.bAdd / 255 : 0;\n out[at + 15] = ct ? ct.aAdd / 255 : 0;\n return row;\n }\n}\n//# sourceMappingURL=rows.js.map","/**\n * Blend modes as a scene list names them, in Flash's order: the separable\n * ones blend straight colours, the rest have formulas of their own.\n */\nexport const NORMAL = 0;\nexport const LAYER = 1;\nexport const MULTIPLY = 2;\nexport const SCREEN = 3;\nexport const LIGHTEN = 4;\nexport const DARKEN = 5;\nexport const DIFFERENCE = 6;\nexport const ADD = 7;\nexport const SUBTRACT = 8;\nexport const INVERT = 9;\nexport const ALPHA = 10;\nexport const ERASE = 11;\nexport const OVERLAY = 12;\nexport const HARDLIGHT = 13;\n/**\n * A Pixel Bender blend shader's, from KERNEL on: KERNEL + k blends by the\n * kernel of chain k of the frame's filters (filters.ts, BLEND). A layer\n * alone takes it, never a draw or a kept layer, whose modes are bytes.\n */\nexport const KERNEL = 14;\n/**\n * Not Flash's: an alpha mask's layer composited onto the unfiltered layer\n * that ends after it, the layer of what it masks, keeping only what the\n * mask covers, scaled by the mask's alpha. measureLayers cuts that layer to\n * the mask's rectangle, past which nothing of it shows. A LAYER_END alone\n * takes it; negative, as no blend mode's number is.\n */\nexport const ALPHA_MASK = -2;\n/** Flash's blend mode names, by their number here. */\nexport const BLEND_NAMES = [\n \"normal\",\n \"layer\",\n \"multiply\",\n \"screen\",\n \"lighten\",\n \"darken\",\n \"difference\",\n \"add\",\n \"subtract\",\n \"invert\",\n \"alpha\",\n \"erase\",\n \"overlay\",\n \"hardlight\",\n];\n/**\n * What an entry is: a draw, or a mask's marker. A mask's own draws lie\n * between its MASK_BEGIN and its MASK_USE, which names them (its geometry\n * the first, its row how many) for the planner to push them into the\n * stencil; what it masks follows, up to the MASK_POP that names them again\n * to take them out.\n */\nexport const DRAW = 0;\nexport const MASK_BEGIN = 1;\nexport const MASK_USE = 2;\nexport const MASK_POP = 3;\n/**\n * A layer: what lies between LAYER_BEGIN and LAYER_END is drawn into a\n * target of its own over a rectangle of the target, then composited onto\n * what is below in the END's blend mode (its geometry), its colour\n * transform the END's row, or none (-1), after the END's chain of filters\n * (its texture, or none, -1) runs over it. The BEGIN's geometry is the\n * layer's number, whose rectangle measureLayers finds.\n */\nexport const LAYER_BEGIN = 4;\nexport const LAYER_END = 5;\n/**\n * A layer kept from a frame before (Keeps) composited again, over the\n * rectangle of its layer number (its geometry), in its blend mode, its\n * colour transform its row; its texture the kept one's id.\n */\nexport const KEPT = 6;\n/** How an entry samples its texture: smoothed, and clamped, repeated or mirrored past its edges. */\nexport const SMOOTH = 1;\nexport const CLAMP = 0;\nexport const REPEAT = 2;\nexport const MIRROR = 4;\n/**\n * Drawn as drawTriangles' textured triangles are: its texels each\n * vertex's u and v from 0 to 1, interpolated in perspective by the depth\n * (t) it carries (GeometryData.depths), and the texture read as Flash\n * reads it, once a pixel of Flash's (webgl/programs.ts, meshFragment).\n */\nexport const MESH = 8;\n/**\n * A 3D object's quad: drawn by the mesh program, its texture the kept\n * output (Keeps) its bitmap was drawn into (WebGLBackend.drawPlane), its\n * texels in that bitmap's texels, read smoothed at the centre of each pixel\n * of Flash's, as Flash reads it.\n */\nexport const PLANE = 16;\n/**\n * Its vertices placed on quarters of a pixel of Flash's, ties to even, as\n * Flash places a glyph's outline (the `legacy-static-text` case, drawn in\n * adl): a pixel of the screen, a BitmapData's in a draw, a texel of a 3D\n * object's bitmap.\n */\nexport const SNAP = 32;\n/**\n * A shader fill's part: its texels the kernel's coordinates, carried as a\n * mesh's are with a depth of 1, and its texture the chain of the frame's\n * filters that holds the kernel (filters.ts, FILL_SHADER); drawn by a\n * program of the kernel's, once a pixel of Flash's, at its centre, as adl\n * draws one.\n */\nexport const SHADED = 64;\n/**\n * Which pixels a filtered layer's object covers (SceneList.wholes): those\n * of the target its drawing touches; or whole units, as Flash's bitmap of\n * an object is, antialiased those its edges touch and one more right and\n * down where an edge lies on one, aliased those whose centres it covers.\n */\nexport const NO_WHOLE = 0;\nexport const WHOLE_SMOOTH = 1;\nexport const WHOLE_ALIASED = 2;\n/**\n * A frame's drawing in order: each entry a geometry drawn under a row with\n * a blend mode, and the texture it samples (-1 for none) and how. Boundaries\n * (filters, masks, blend layers) come with the features that need them.\n */\nexport class SceneList {\n geometry = new Int32Array(1024);\n row = new Int32Array(1024);\n blend = new Uint8Array(1024);\n texture = new Int32Array(1024);\n sampler = new Uint8Array(1024);\n kind = new Uint8Array(1024);\n length = 0;\n /** Each layer's rectangle of the target, in its pixels from the top left: x, y, width, height. */\n layers = new Int32Array(64);\n /**\n * Each layer's padding, as its filters reach past what is drawn: in the\n * target's units (its pixels over the resolution), or -1 for an\n * unfiltered layer, which covers what is drawn alone.\n */\n pads = new Int32Array(16);\n /**\n * Whether each filtered layer covers whole units of the target, as Flash\n * places the bitmap a ShaderFilter's kernel runs over, its coordinates\n * from its corner: NO_WHOLE, WHOLE_SMOOTH or WHOLE_ALIASED.\n */\n wholes = new Uint8Array(16);\n /**\n * Each whole layer's object, Flash's bitmap of it, uncut by the target:\n * x, y, width and height in target pixels, as measureLayers finds it.\n */\n objects = new Float64Array(64);\n /** Each layer's kept output, which its output becomes (Keeps), or -1. */\n keeps = new Int32Array(16);\n /** The layer each layer is in, or -1. */\n parents = new Int32Array(16);\n /** The layers begun and not yet ended, innermost last. */\n open = [];\n /**\n * Each filtered layer's area as measured, before it was rounded and\n * padded: least x and y, greatest x and y, in target pixels.\n */\n areas = new Float64Array(64);\n layerCount = 0;\n reset() {\n this.length = 0;\n this.layerCount = 0;\n this.open.length = 0;\n }\n draw(geometry, row, blend, texture = -1, sampler = 0) {\n this.push(DRAW, geometry, row, blend, texture, sampler);\n }\n /**\n * A layer begun, padded for its filters (or -1), over whole units as\n * `whole` says (wholes), its rectangle none till measured (layerRect):\n * its number.\n */\n layerBegin(padding = -1, keep = -1, whole = NO_WHOLE) {\n const layer = this.newLayer(padding, keep);\n this.wholes[layer] = whole;\n this.push(LAYER_BEGIN, layer, 0, 0, -1, 0);\n this.open.push(layer);\n return layer;\n }\n /**\n * Kept output `keep` composited again over the rectangle x y width height\n * of the target, in blend mode `mode`, coloured by `row`.\n */\n keptLayer(keep, mode, row, x, y, width, height) {\n const layer = this.newLayer(-1, keep);\n this.layerRect(layer, x, y, width, height);\n this.push(KEPT, layer, row, mode, keep, 0);\n }\n newLayer(padding, keep) {\n const layer = this.layerCount++;\n if (layer >= this.pads.length) {\n this.layers = grow(this.layers);\n this.pads = grow(this.pads);\n this.wholes = grow(this.wholes);\n const objects = new Float64Array(this.objects.length * 2);\n objects.set(this.objects);\n this.objects = objects;\n this.keeps = grow(this.keeps);\n this.parents = grow(this.parents);\n const areas = new Float64Array(this.areas.length * 2);\n areas.set(this.areas);\n this.areas = areas;\n }\n this.pads[layer] = padding;\n this.wholes[layer] = NO_WHOLE;\n this.keeps[layer] = keep;\n this.parents[layer] = this.open.at(-1) ?? -1;\n this.layerRect(layer, 0, 0, 0, 0);\n return layer;\n }\n /** Filtered layer `layer` padded by `padding` after all, as its filters were fitted once it was drawn. */\n padLayer(layer, padding) {\n this.pads[layer] = padding;\n }\n /** The layer begun last ended: filtered by `chain` (or -1), composited in `mode`, coloured by `row`. */\n layerEnd(mode, row, chain = -1) {\n this.open.pop();\n this.push(LAYER_END, mode, row, 0, chain, 0);\n }\n /**\n * Layer `layer` covers the rectangle x y width height of the target, in\n * its pixels from the top left; one of no size shows nothing.\n */\n layerRect(layer, x, y, width, height) {\n const r = this.layers;\n r[layer * 4] = x;\n r[layer * 4 + 1] = y;\n r[layer * 4 + 2] = width;\n r[layer * 4 + 3] = height;\n }\n /**\n * A mask's marker, with two numbers in its geometry and row: MASK_USE\n * and MASK_POP name the mask's draws, from the first, so many of them.\n */\n marker(kind, a = 0, b = 0) {\n this.push(kind, a, b, 0, -1, 0);\n }\n push(kind, geometry, row, blend, texture, sampler) {\n if (this.length === this.geometry.length) {\n this.geometry = grow(this.geometry);\n this.row = grow(this.row);\n this.blend = grow(this.blend);\n this.texture = grow(this.texture);\n this.sampler = grow(this.sampler);\n this.kind = grow(this.kind);\n }\n const at = this.length++;\n this.kind[at] = kind;\n this.geometry[at] = geometry;\n this.row[at] = row;\n this.blend[at] = blend;\n this.texture[at] = texture;\n this.sampler[at] = sampler;\n }\n}\nfunction grow(array) {\n const grown = new array.constructor(array.length * 2);\n grown.set(array);\n return grown;\n}\n//# sourceMappingURL=scene.js.map","import { IDLE_FRAMES } from \"./geometry.js\";\nimport { Registry } from \"./registry.js\";\n/**\n * How many frames a texture keeps the bytes it was last set from without\n * being set again, and spare bytes wait for another texture: a texture set\n * every frame, as a BitmapData drawn into every frame is, is converted into\n * the same bytes each time; one that stops changing lets them go a couple\n * of seconds later.\n */\nexport const KEEP_FRAMES = 60;\n/** The spare bytes kept at most, the least lately spared let go of first. */\nconst SPARE_BYTES = 32 << 20;\n/**\n * Every texture a scene list may name, by id. An owner adds a texture's\n * pixels, and sets them again as they change; the backend uploads what is\n * pending in its next render and lets the pixels go, keeping no hold on\n * them. What goes undrawn for its idle frames, IDLE_FRAMES unless it was\n * given fewer, is let go of, as geometries are.\n *\n * The bytes an owner fills to add or set a texture come from `bytes`, and\n * stay this registry's: filled, they are passed to add or set at once and\n * left be after, as they are lent again, to the same texture to be set again\n * or, once it let them go, to another. A texture set again keeps the bytes it\n * was last set from for KEEP_FRAMES; then, or once uploaded for one only\n * added, or when it is removed, idle or with a lost context, they are spare\n * for as long, for the next texture of their length.\n */\nexport class Textures extends Registry {\n data = [];\n /** The bytes each texture was last added or set from, where `bytes` lent them, and the frame. */\n kept = [];\n setAt = [];\n /** Whether each texture was set again since it was added, which keeps its bytes for a while. */\n changing = [];\n /** Bytes no texture keeps, by length, the least lately spared first. */\n spare = new Map();\n spareBytes = 0;\n lent = new WeakSet();\n /** Added or set again since the backend last took them. */\n pending = [];\n /**\n * `length` bytes to fill and add or set a texture from: those texture `id`\n * keeps where they are as long, else spare ones, else new.\n */\n bytes(length, id = -1) {\n const own = id >= 0 && this.holds(id) ? this.kept[id] : null;\n if (own?.length === length) {\n return own;\n }\n const spare = this.spare.get(length)?.pop();\n if (spare) {\n this.spareBytes -= length;\n return spare.bytes;\n }\n const bytes = new Uint8Array(length);\n this.lent.add(bytes);\n return bytes;\n }\n /** A texture of `pixels`, let go of once undrawn for `idle` frames. */\n add(width, height, pixels, idle = IDLE_FRAMES) {\n const handle = this.hold(idle);\n this.data[handle.id] = { width, height, pixels };\n this.keep(handle.id, pixels);\n this.changing[handle.id] = false;\n this.pending.push(handle.id);\n return handle;\n }\n /**\n * `id`'s pixels changed, its size with them perhaps; with `idle`, it is\n * let go of after as many undrawn frames where that is fewer.\n */\n set(id, width, height, pixels, idle) {\n const data = this.data[id];\n if (data) {\n data.width = width;\n data.height = height;\n data.pixels = pixels;\n this.keep(id, pixels);\n this.changing[id] = true;\n this.pending.push(id);\n if (idle !== undefined) {\n this.idleWithin(id, idle);\n }\n }\n }\n get(id) {\n return this.data[id] ?? null;\n }\n /** The bytes held on the CPU: those textures keep, and spare ones. */\n get heldBytes() {\n let held = this.spareBytes;\n for (const bytes of this.kept) {\n held += bytes?.length ?? 0;\n }\n return held;\n }\n /** A frame ends: what went unused too long is let go of, and bytes kept no longer needed spared. */\n endFrame() {\n super.endFrame();\n for (let id = 0; id < this.kept.length; id++) {\n const bytes = this.kept[id];\n const done = !this.changing[id] || this.frame - this.setAt[id] > KEEP_FRAMES;\n // Never while they wait to be uploaded, as they may where the backend drew no frame.\n if (bytes && done && this.data[id]?.pixels !== bytes) {\n this.kept[id] = null;\n this.spareOf(bytes);\n }\n }\n for (const [length, list] of this.spare) {\n while (list.length && this.frame - list[0].at > KEEP_FRAMES) {\n list.shift();\n this.spareBytes -= length;\n }\n }\n }\n dropped(id) {\n this.data[id] = null;\n const bytes = this.kept[id];\n this.kept[id] = null;\n if (bytes) {\n this.spareOf(bytes);\n }\n }\n /** `pixels` kept for `id` where `bytes` lent them; those it kept before spared. */\n keep(id, pixels) {\n const before = this.kept[id];\n const own = pixels instanceof Uint8Array && this.lent.has(pixels) ? pixels : null;\n if (before && before !== own) {\n this.spareOf(before);\n }\n this.kept[id] = own;\n this.setAt[id] = this.frame;\n }\n spareOf(bytes) {\n if (bytes.length > SPARE_BYTES) {\n return;\n }\n let list = this.spare.get(bytes.length);\n if (!list) {\n list = [];\n this.spare.set(bytes.length, list);\n }\n list.push({ bytes, at: this.frame });\n this.spareBytes += bytes.length;\n // Past the cap, the least lately spared go, whatever their length.\n while (this.spareBytes > SPARE_BYTES) {\n let oldest = -1;\n let oldestAt = Number.POSITIVE_INFINITY;\n for (const [length, entries] of this.spare) {\n if (entries.length && entries[0].at < oldestAt) {\n oldestAt = entries[0].at;\n oldest = length;\n }\n }\n this.spare.get(oldest)?.shift();\n this.spareBytes -= oldest;\n }\n }\n}\n//# sourceMappingURL=textures.js.map","/** Why a program could not be made: no objects to make it of, a stage that did not compile, or no link. */\nexport class ShaderError extends Error {\n stage;\n log;\n constructor(stage, log) {\n super(log);\n this.stage = stage;\n this.log = log;\n this.name = \"ShaderError\";\n }\n}\n/**\n * A program linked from GLSL `vertex` and `fragment`, its shaders detached\n * and deleted once linked, and nothing left behind if it fails: a\n * ShaderError says where.\n */\nexport function linkProgram(gl, vertex, fragment) {\n const v = gl.createShader(gl.VERTEX_SHADER);\n const f = gl.createShader(gl.FRAGMENT_SHADER);\n const p = gl.createProgram();\n let linked = false;\n let attached = false;\n try {\n if (!v || !f || !p) {\n throw new ShaderError(\"allocate\", \"cannot allocate shader\");\n }\n gl.shaderSource(v, vertex);\n gl.shaderSource(f, fragment);\n gl.compileShader(v);\n gl.compileShader(f);\n if (!gl.getShaderParameter(v, gl.COMPILE_STATUS) ||\n !gl.getShaderParameter(f, gl.COMPILE_STATUS)) {\n throw new ShaderError(\"compile\", `${gl.getShaderInfoLog(v)} ${gl.getShaderInfoLog(f)}`);\n }\n gl.attachShader(p, v);\n gl.attachShader(p, f);\n attached = true;\n gl.linkProgram(p);\n if (!gl.getProgramParameter(p, gl.LINK_STATUS)) {\n throw new ShaderError(\"link\", `${gl.getProgramInfoLog(p)}`);\n }\n linked = true;\n return p;\n }\n finally {\n if (attached && p && v) {\n gl.detachShader(p, v);\n }\n if (attached && p && f) {\n gl.detachShader(p, f);\n }\n gl.deleteShader(v);\n gl.deleteShader(f);\n if (!linked) {\n gl.deleteProgram(p);\n }\n }\n}\n//# sourceMappingURL=programs.js.map","/**\n * The GL state of a context as its one owner last set it, so that nothing\n * is set twice: the program, vertex array, framebuffer, viewport, blending,\n * scissor, colour mask and the textures on each unit. What sets state\n * behind it (another library, a lost context) calls forget, and everything\n * is set again on its next use.\n */\nexport class GlState {\n gl;\n program;\n vertexArray;\n framebuffer;\n view = [Number.NaN, Number.NaN, Number.NaN, Number.NaN];\n /** Blending: on or off, then the four factors and the equation, -1 as unknown. */\n blending;\n blend = [-1, -1, -1, -1, -1];\n scissoring;\n box = [Number.NaN, Number.NaN, Number.NaN, Number.NaN];\n mask = -1;\n /** The stencil test: off (undefined unknown), or its function, reference and pass operation. */\n stencilling;\n stencilState = [-1, -1, -1];\n unit = -1;\n textures = [];\n samplers = [];\n constructor(gl) {\n this.gl = gl;\n }\n /** Everything unknown: set again as next asked for. */\n forget() {\n this.program = undefined;\n this.vertexArray = undefined;\n this.framebuffer = undefined;\n this.view.fill(Number.NaN);\n this.blending = undefined;\n this.blend.fill(-1);\n this.scissoring = undefined;\n this.box.fill(Number.NaN);\n this.mask = -1;\n this.stencilling = undefined;\n this.stencilState.fill(-1);\n this.unit = -1;\n this.textures.length = 0;\n this.samplers.length = 0;\n }\n useProgram(program) {\n if (program !== this.program) {\n this.program = program;\n this.gl.useProgram(program);\n }\n }\n bindVertexArray(vertexArray) {\n if (vertexArray !== this.vertexArray) {\n this.vertexArray = vertexArray;\n this.gl.bindVertexArray(vertexArray);\n }\n }\n bindFramebuffer(framebuffer) {\n if (framebuffer !== this.framebuffer) {\n this.framebuffer = framebuffer;\n this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, framebuffer);\n }\n }\n viewport(x, y, width, height) {\n const v = this.view;\n if (v[0] !== x || v[1] !== y || v[2] !== width || v[3] !== height) {\n v[0] = x;\n v[1] = y;\n v[2] = width;\n v[3] = height;\n this.gl.viewport(x, y, width, height);\n }\n }\n /** Blending by the factors and equation given, or off with `src` null. */\n setBlend(src, dst = 0, srcAlpha = src ?? 0, dstAlpha = dst, equation = 0) {\n const gl = this.gl;\n const on = src !== null;\n if (on !== this.blending) {\n this.blending = on;\n if (on) {\n gl.enable(gl.BLEND);\n }\n else {\n gl.disable(gl.BLEND);\n }\n }\n if (!on) {\n return;\n }\n const b = this.blend;\n if (b[0] !== src || b[1] !== dst || b[2] !== srcAlpha || b[3] !== dstAlpha) {\n b[0] = src;\n b[1] = dst;\n b[2] = srcAlpha;\n b[3] = dstAlpha;\n gl.blendFuncSeparate(src, dst, srcAlpha, dstAlpha);\n }\n const eq = equation || gl.FUNC_ADD;\n if (b[4] !== eq) {\n b[4] = eq;\n gl.blendEquation(eq);\n }\n }\n /** Scissoring to the box given, or off with none. */\n scissor(box) {\n const gl = this.gl;\n const on = box !== null;\n if (on !== this.scissoring) {\n this.scissoring = on;\n if (on) {\n gl.enable(gl.SCISSOR_TEST);\n }\n else {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n const b = this.box;\n if (box && (b[0] !== box[0] || b[1] !== box[1] || b[2] !== box[2] || b[3] !== box[3])) {\n b[0] = box[0];\n b[1] = box[1];\n b[2] = box[2];\n b[3] = box[3];\n gl.scissor(box[0], box[1], box[2], box[3]);\n }\n }\n /**\n * The stencil test: passing where `func` holds of the stencil and `ref`,\n * then `pass` done to it (KEEP, INCR, DECR...); off with `func` null.\n */\n stencil(func, ref = 0, pass = 0) {\n const gl = this.gl;\n const on = func !== null;\n if (on !== this.stencilling) {\n this.stencilling = on;\n if (on) {\n gl.enable(gl.STENCIL_TEST);\n }\n else {\n gl.disable(gl.STENCIL_TEST);\n }\n }\n if (!on) {\n return;\n }\n const s = this.stencilState;\n if (s[0] !== func || s[1] !== ref) {\n s[0] = func;\n s[1] = ref;\n gl.stencilFunc(func, ref, 0xff);\n }\n const op = pass || gl.KEEP;\n if (s[2] !== op) {\n s[2] = op;\n gl.stencilOp(gl.KEEP, gl.KEEP, op);\n }\n }\n /** Which of red, green, blue and alpha are written, as bits 1, 2, 4 and 8. */\n colorMask(bits) {\n if (bits !== this.mask) {\n this.mask = bits;\n this.gl.colorMask((bits & 1) !== 0, (bits & 2) !== 0, (bits & 4) !== 0, (bits & 8) !== 0);\n }\n }\n /** `texture` bound to texture unit `unit` as a 2D texture. */\n bindTexture(unit, texture) {\n if (this.textures[unit] === texture) {\n return;\n }\n this.textures[unit] = texture;\n this.activeTexture(unit);\n this.gl.bindTexture(this.gl.TEXTURE_2D, texture);\n }\n /** `sampler` bound to texture unit `unit`, or none for the texture's own parameters. */\n bindSampler(unit, sampler) {\n if (this.samplers[unit] !== sampler) {\n this.samplers[unit] = sampler;\n this.gl.bindSampler(unit, sampler);\n }\n }\n /** Make `unit` the active one, for an upload to the texture bound there. */\n activeTexture(unit) {\n if (unit !== this.unit) {\n this.unit = unit;\n this.gl.activeTexture(this.gl.TEXTURE0 + unit);\n }\n }\n /** A texture deleted: no unit is thought to hold it any more. */\n dropTexture(texture) {\n for (let i = 0; i < this.textures.length; i++) {\n if (this.textures[i] === texture) {\n this.textures[i] = undefined;\n }\n }\n }\n}\n//# sourceMappingURL=state.js.map","import { ROWS_A_LINE } from \"../rows.js\";\nimport { ADD, ALPHA, DARKEN, DIFFERENCE, ERASE, HARDLIGHT, INVERT, LAYER, LIGHTEN, MULTIPLY, NORMAL, OVERLAY, SCREEN, SUBTRACT, } from \"../scene.js\";\n/** Texels a row (ROW_FLOATS over four). */\nexport const ROW_TEXELS = 4;\n/**\n * The vertex atlas' attributes, where both the fill and the mesh programs\n * read them: a mesh's depth is the four bytes of its colour, as a float.\n */\nexport const POSITION_AT = 0;\nexport const TEXEL_AT = 1;\nexport const COLOR_AT = 2;\nexport const DEPTH_AT = 3;\n/** Advanced text's glyph quads' attributes past their position (GeometryData.glyphs), in theirs. */\nexport const ORIGIN_AT = 4;\nexport const GLYPH_AT = 5;\nexport const RUN_AT = 6;\nexport const TINT_AT = 7;\n/** The most cutoff table entries a text's draw takes, as the player's text/saffron.ts builds them. */\nexport const TABLE_ENTRIES = 48;\n/** Segments a row of the outlines' texture, as the player's text/saffron.ts stores them. */\nexport const OUTLINE_ROW = 1024;\n/**\n * The most draws a multi-draw of the fill program makes, their rows in its\n * integer texture, a line of it. A power of two: the vertex shader splits a\n * draw's place in the table into column and line with a mask and a shift.\n */\nexport const RUN_MOST = 256;\n/** Textures the fill program samples in one draw call, each on a unit of its own. */\nexport const FILL_TEXTURES = 8;\n/**\n * A fill draw's row and how it is drawn, in one int: the row in the bits\n * below FILL_SLOT, then which of the fill program's textures it samples, one\n * past its index or 0 for none, then SNAP_BIT where it snaps (SNAP). Rows\n * are fewer: ROWS_A_LINE to a line of a texture of at most 16384 lines.\n */\nexport const FILL_SLOT = 24;\nexport const SNAP_BIT = 1 << 28;\n/** The texture unit a mesh's texture is bound to, and textures are uploaded on; the rows are on 0. */\nexport const TEXTURE_UNIT = 1;\n/** The units a composite reads its layer and what is below from. */\nexport const LAYER_UNIT = 2;\nexport const BACK_UNIT = 3;\n/** The unit advanced text's outlines are on (uploadOutlines); the filters take 4 to 6. */\nexport const OUTLINE_UNIT = 7;\n/** The first of the units the fill program's textures are bound to (FILL_TEXTURES). */\nexport const FILL_UNIT = 8;\n/** The multi-draw row table's unit, past the fill textures. */\nexport const RUN_UNIT = FILL_UNIT + FILL_TEXTURES;\n/**\n * Places a vertex by its row's transform, on a quarter of a pixel of\n * Flash's (uUnit of them a stage pixel, from the stage's origin) where it\n * snaps (SNAP), then on the target by uView (scale and offset into clip\n * space), and passes on its straight colour, the row's colour transform\n * and the texture it samples. uRow names the draw's row (FILL_SLOT); with\n * `multi` (WEBGL_multi_draw), uRunTable names each draw's of a multi-draw by\n * gl_DrawID, which is 0 in a draw of its own.\n */\nexport const fillVertex = (multi) => `#version 300 es\n${multi ? \"#extension GL_ANGLE_multi_draw : require\" : \"\"}\nprecision highp float;\nlayout(location = ${POSITION_AT}) in vec2 aPosition;\nlayout(location = ${TEXEL_AT}) in vec2 aTexel;\nlayout(location = ${COLOR_AT}) in vec4 aColor;\nuniform highp sampler2D uRows;\n${multi ? \"uniform highp isampler2D uRunTable;\\nuniform int uRunBase;\" : \"uniform int uRow;\"}\nuniform vec4 uView;\nuniform float uUnit;\nout vec4 vColor;\nout vec2 vTexel;\nflat out vec4 vMul;\nflat out vec4 vAdd;\nflat out int vSlot;\n\nvoid main(void) {\n int draw = ${multi ? `texelFetch(uRunTable, ivec2((uRunBase + gl_DrawID) & ${RUN_MOST - 1}, (uRunBase + gl_DrawID) >> ${Math.log2(RUN_MOST)}), 0).r` : \"uRow\"};\n int row = draw & ${(1 << FILL_SLOT) - 1};\n vSlot = (draw >> ${FILL_SLOT}) & 15;\n ivec2 at = ivec2((row & ${ROWS_A_LINE - 1}) * ${ROW_TEXELS}, row >> ${Math.log2(ROWS_A_LINE)});\n vec4 m = texelFetch(uRows, at, 0);\n vec4 t = texelFetch(uRows, at + ivec2(1, 0), 0);\n vMul = texelFetch(uRows, at + ivec2(2, 0), 0);\n vAdd = texelFetch(uRows, at + ivec2(3, 0), 0);\n vec2 p = vec2(m.x * aPosition.x + m.z * aPosition.y + t.x, m.y * aPosition.x + m.w * aPosition.y + t.y);\n if ((draw & ${SNAP_BIT}) != 0) {\n p = roundEven(p * uUnit * 4.0) / (uUnit * 4.0);\n }\n\n gl_Position = vec4(p * uView.xy + uView.zw, 0.0, 1.0);\n vColor = aColor;\n vTexel = aTexel;\n}\n`;\n/**\n * Texel `at` of the texture vSlot names, as only a constant may index the\n * samplers. At level 0: the textures have no mipmaps and sample alike up\n * close and far off, and so no derivatives are taken in the switch.\n */\n// Each case sets the texel and breaks rather than returning from inside the\n// switch: Direct3D's compiler, which ANGLE hands it to on Windows, cannot\n// tell every path sets the result of such a function and warns (X4000).\nconst slotTexel = Array.from({ length: FILL_TEXTURES }, (_, k) => ` case ${k + 1}:\n t = textureLod(uTextures[${k}], at / vec2(textureSize(uTextures[${k}], 0)), 0.0);\n break;`).join(\"\\n\");\n/**\n * Flash's colour transform on the straight colour, clamped, then\n * premultiplied for blending: the vertex' colour, or with a texture the\n * texel's (premultiplied in the texture) times it, as the colour batcher\n * did, a clear texel staying clear.\n */\nexport const fillFragment = `#version 300 es\nprecision highp float;\nin vec4 vColor;\nin vec2 vTexel;\nflat in vec4 vMul;\nflat in vec4 vAdd;\nflat in int vSlot;\nuniform sampler2D uTextures[${FILL_TEXTURES}];\nout vec4 finalColor;\n\nvec4 texel(vec2 at) {\n vec4 t = vec4(0.0);\n switch (vSlot) {\n${slotTexel}\n }\n\n return t;\n}\n\nvoid main(void) {\n vec4 straight = vColor;\n if (vSlot != 0) {\n vec4 t = texel(vTexel);\n if (t.a == 0.0) {\n finalColor = vec4(0.0);\n return;\n }\n\n straight = vec4(t.rgb / t.a * vColor.rgb, t.a * vColor.a);\n }\n\n vec4 c = clamp(straight * vMul + vAdd, 0.0, 1.0);\n finalColor = vec4(c.rgb * c.a, c.a);\n}\n`;\n/**\n * drawTriangles' textured triangles (MESH), placed as fills are, their u\n * and v carried times their depth t, and t, which the GPU interpolates\n * straight across the screen for each pixel to divide.\n */\nexport const meshVertex = `#version 300 es\nprecision highp float;\nlayout(location = ${POSITION_AT}) in vec2 aPosition;\nlayout(location = ${TEXEL_AT}) in vec2 aTexel;\nlayout(location = ${DEPTH_AT}) in float aDepth;\nuniform highp sampler2D uRows;\nuniform int uRow;\nuniform vec4 uView;\nout vec3 vUVT;\nflat out vec4 vMul;\nflat out vec4 vAdd;\n\nvoid main(void) {\n ivec2 at = ivec2((uRow & ${ROWS_A_LINE - 1}) * ${ROW_TEXELS}, uRow >> ${Math.log2(ROWS_A_LINE)});\n vec4 m = texelFetch(uRows, at, 0);\n vec4 t = texelFetch(uRows, at + ivec2(1, 0), 0);\n vMul = texelFetch(uRows, at + ivec2(2, 0), 0);\n vAdd = texelFetch(uRows, at + ivec2(3, 0), 0);\n vec2 p = vec2(m.x * aPosition.x + m.z * aPosition.y + t.x, m.y * aPosition.x + m.w * aPosition.y + t.y);\n gl_Position = vec4(p * uView.xy + uView.zw, 0.0, 1.0);\n vUVT = vec3(aTexel * aDepth, aDepth);\n}\n`;\n/**\n * drawTriangles' bitmap as adl samples it: u and v from 0 to 1 onto the first\n * texel's centre to the last's, wrapped into that or clamped to it, read\n * once a pixel of Flash's, at its top left corner; not smoothed, the nearer\n * texel, the lower of two as near; smoothed, the four around, weighed.\n * uFrag takes a fragment to the target's pixels from the stage's origin,\n * down (x + uFrag.x, uFrag.y + uFrag.z * y), and is a pixel of Flash's\n * that many of them (w). uMode: whether it repeats, whether it is smoothed,\n * and whether it is a 3D object's quad (PLANE), which reads its bitmap\n * otherwise. The colour transform then as on a fill.\n */\nexport const meshFragment = `#version 300 es\nprecision highp float;\nin vec3 vUVT;\nflat in vec4 vMul;\nflat in vec4 vAdd;\nuniform sampler2D uTexture;\nuniform vec4 uFrag;\nuniform ivec3 uMode;\nout vec4 finalColor;\n\nvec4 texel(ivec2 at) {\n return texelFetch(uTexture, at, 0);\n}\n\nvoid main(void) {\n float pixel = uFrag.w;\n vec2 f = vec2(gl_FragCoord.x + uFrag.x, uFrag.y + uFrag.z * gl_FragCoord.y);\n vec2 size = vec2(textureSize(uTexture, 0));\n if (uMode.z != 0) {\n // A 3D object's quad (PLANE): its bitmap read smoothed at the pixel's centre, in its texels.\n vec2 centre = (floor(f / pixel) + 0.5) * pixel;\n vec3 at = vUVT + dFdx(vUVT) * (centre.x - f.x) + dFdy(vUVT) * ((centre.y - f.y) * uFrag.z);\n vec4 shown = texture(uTexture, (at.z != 0.0 ? at.xy / at.z : vec2(0.0)) / size);\n if (shown.a == 0.0) {\n finalColor = vec4(0.0);\n return;\n }\n\n vec4 s = clamp(vec4(shown.rgb / shown.a, shown.a) * vMul + vAdd, 0.0, 1.0);\n finalColor = vec4(s.rgb * s.a, s.a);\n return;\n }\n\n vec2 corner = floor(f / pixel) * pixel;\n vec3 uvt = vUVT + dFdx(vUVT) * (corner.x - f.x) + dFdy(vUVT) * ((corner.y - f.y) * uFrag.z);\n vec2 uv = uvt.z != 0.0 ? uvt.xy / uvt.z : vec2(0.0);\n // As adl draws one, a bitmap a texel high shows its first texel throughout.\n if (size.y == 1.0) {\n uv = vec2(0.0);\n }\n\n // A hair nearer 0, as adl's come out, stepped across the triangle in fixed point: 1 wraps to\n // the last texel, not the first, and a corner halfway between texels takes the one nearer 0.\n uv -= sign(uv) / 16384.0;\n uv = uMode.x != 0 ? fract(uv) : clamp(uv, 0.0, 1.0);\n vec2 p = uv * (size - 1.0);\n vec4 color;\n if (uMode.y != 0) {\n vec2 below = floor(p);\n vec2 w = p - below;\n ivec2 a = ivec2(below);\n ivec2 b = min(a + 1, ivec2(size) - 1);\n color = mix(\n mix(texel(a), texel(ivec2(b.x, a.y)), w.x),\n mix(texel(ivec2(a.x, b.y)), texel(b), w.x),\n w.y\n );\n } else {\n color = texel(ivec2(floor(p + 0.5)));\n }\n\n if (color.a == 0.0) {\n finalColor = vec4(0.0);\n return;\n }\n\n vec4 c = clamp(vec4(color.rgb / color.a, color.a) * vMul + vAdd, 0.0, 1.0);\n finalColor = vec4(c.rgb * c.a, c.a);\n}\n`;\n/**\n * Advanced text's glyph quads (player's text/saffron.ts), placed by the\n * row's transform: the text's\n * pixels to Flash's, uUnit of them a stage pixel, on their grid from the\n * stage's origin, a BitmapData's in a draw. A glyph's pen stands where its\n * text's origin, at a whole pixel, puts it, snapped as its grid fits it\n * (uMode: gridFitType 0 none, 1 pixel, 2 subpixel, thickness, sharpness),\n * and its quad reaches out past its outline by the furthest cutoff. Its\n * colour is drawn under the row's colour transform, light or dark as adl\n * chooses its table. aOrigin: the pen, and its light and dark tables, each\n * its first entry plus 64 times its entries; aGlyph: a corner of its\n * outline's bounds and the way out from it; aRun: its segments, first and\n * count, the pixels of a unit of its outline, and its size.\n */\nexport const glyphsVertex = `#version 300 es\nprecision highp float;\nlayout(location = ${POSITION_AT}) in vec2 aPosition;\nlayout(location = ${ORIGIN_AT}) in vec4 aOrigin;\nlayout(location = ${GLYPH_AT}) in vec4 aGlyph;\nlayout(location = ${RUN_AT}) in vec4 aRun;\nlayout(location = ${TINT_AT}) in vec4 aColor;\nuniform highp sampler2D uRows;\nuniform int uRow;\nuniform vec4 uView;\nuniform float uUnit;\nuniform vec4 uMode;\nuniform vec4 uTable[${TABLE_ENTRIES}];\nout vec2 vPixel;\nflat out vec2 vPen;\nflat out vec4 vToGlyph;\nflat out vec4 vToPixel;\nflat out vec4 vCut;\nflat out vec4 vShown;\n\n// The cutoffs at ppem by the table of entries start to start + count, as text/csm.ts' cutoffs.\nvec2 cutoffs(int start, int count, float ppem) {\n vec4 first = uTable[start];\n vec4 last = uTable[start + count - 1];\n vec2 c = first.yz;\n if (ppem >= last.x) {\n c = last.yz;\n } else if (ppem > first.x) {\n for (int i = 1; i < ${TABLE_ENTRIES}; i++) {\n if (i >= count) {\n break;\n }\n\n vec4 b = uTable[start + i];\n if (ppem <= b.x) {\n vec4 a = uTable[start + i - 1];\n c = mix(a.yz, b.yz, (ppem - a.x) / (b.x - a.x));\n break;\n }\n }\n }\n\n float unit = 0.0001 * ppem;\n float t = clamp(uMode.y, -200.0, 200.0);\n float s = clamp(uMode.z, -400.0, 400.0);\n c -= unit * vec2(t + s * 0.5, t - s * 0.5);\n if (c.x < c.y) {\n c = vec2((c.x + c.y) * 0.5);\n }\n\n return c;\n}\n\nvoid main(void) {\n ivec2 at = ivec2((uRow & ${ROWS_A_LINE - 1}) * ${ROW_TEXELS}, uRow >> ${Math.log2(ROWS_A_LINE)});\n vec4 m = texelFetch(uRows, at, 0);\n vec4 t = texelFetch(uRows, at + ivec2(1, 0), 0);\n vec4 mul = texelFetch(uRows, at + ivec2(2, 0), 0);\n vec4 add = texelFetch(uRows, at + ivec2(3, 0), 0);\n // The text's pixels to Flash's.\n mat2 linear = mat2(m.xy, m.zw) * uUnit;\n vec2 origin = t.xy * uUnit;\n vec2 pen = linear * aOrigin.xy + roundEven(origin);\n float across = max(abs(linear[0][1]), abs(linear[1][0]));\n if (across > max(abs(linear[0][0]), abs(linear[1][1])) / 65536.0) {\n // Turned or skewed: no grid.\n } else if (uMode.x == 1.0) {\n pen = vec2(roundEven(pen.x * 8.0) / 8.0 + 0.5, roundEven(pen.y));\n } else if (uMode.x == 2.0) {\n pen = vec2(roundEven(pen.x * 4.0) / 4.0 + 0.5, roundEven(pen.y));\n } else {\n pen = roundEven(pen * 4.0) / 4.0 + vec2(0.5, 0.0);\n }\n\n float ppem = aRun.w * sqrt(abs(determinant(linear)));\n // The colour as drawn, straight: light or dark by it, as adl chooses.\n vec4 shown = clamp(aColor * mul + add, 0.0, 1.0);\n bool light = dot(floor(shown.rgb * 255.0 + 0.5), vec3(30.0, 59.0, 11.0)) > 20000.0;\n int table = int(light ? aOrigin.z : aOrigin.w);\n vec2 cut = cutoffs(table & 63, table >> 6, ppem);\n mat2 toPixel = linear * aRun.z;\n float margin = max(abs(cut.x), abs(cut.y)) + 1.0;\n float det = determinant(toPixel);\n mat2 inverse = det != 0.0\n ? mat2(toPixel[1][1], -toPixel[0][1], -toPixel[1][0], toPixel[0][0]) / det\n : mat2(0.0);\n // Out in the glyph's space, so that the margin stays outside under reflections and turns: each\n // row of the inverse gives the glyph's units a pixel across that edge takes.\n vec2 reach = vec2(length(vec2(inverse[0][0], inverse[1][0])),\n length(vec2(inverse[0][1], inverse[1][1]))) * margin;\n vec2 p = pen + toPixel * (aGlyph.xy + aGlyph.zw * reach);\n vPixel = p;\n vPen = pen;\n vToGlyph = vec4(inverse[0], inverse[1]);\n vToPixel = vec4(toPixel[0], toPixel[1]);\n vCut = vec4(cut, aRun.xy);\n vShown = shown;\n gl_Position = vec4((p / uUnit) * uView.xy + uView.zw, 0.0, 1.0);\n}\n`;\n/**\n * Each pixel of Flash's a glyph's quad covers, by its signed distance to\n * the glyph's outline (the segments of its run in uSegments, the nearest\n * and, by parity, whether it is inside), between the cutoffs, as Saffron\n * covers it. Nothing outside: in a mask, which\n * writes the stencil wherever it draws, a glyph is its shape.\n */\nexport const glyphsFragment = `#version 300 es\nprecision highp float;\nprecision highp int;\nin vec2 vPixel;\nflat in vec2 vPen;\nflat in vec4 vToGlyph;\nflat in vec4 vToPixel;\nflat in vec4 vCut;\nflat in vec4 vShown;\nout vec4 finalColor;\nuniform highp sampler2D uSegments;\n\nvoid main(void) {\n vec2 centre = floor(vPixel) + 0.5;\n mat2 toGlyph = mat2(vToGlyph.xy, vToGlyph.zw);\n mat2 toPixel = mat2(vToPixel.xy, vToPixel.zw);\n vec2 g = toGlyph * (centre - vPen);\n int start = int(vCut.z);\n int count = int(vCut.w);\n float nearest = 3.4e38;\n vec2 along = vec2(1.0, 0.0);\n bool inside = false;\n for (int i = 0; i < count; i++) {\n int k = start + i;\n vec4 s = texelFetch(uSegments, ivec2(k & ${OUTLINE_ROW - 1}, k >> ${Math.log2(OUTLINE_ROW)}), 0);\n vec2 a = s.xy;\n vec2 e = s.zw - a;\n vec2 w = g - a;\n float t = clamp(dot(w, e) / max(dot(e, e), 1e-20), 0.0, 1.0);\n vec2 off = w - e * t;\n float d = dot(off, off);\n if (d < nearest) {\n nearest = d;\n along = e;\n }\n\n if ((a.y > g.y) != (s.w > g.y) && a.x + (g.y - a.y) * e.x / e.y > g.x) {\n inside = !inside;\n }\n }\n\n // In Flash's pixels, across the nearest edge as the transform stretches it.\n float stretch = length(toPixel * along);\n float d = stretch > 0.0\n ? sqrt(nearest) * abs(determinant(toPixel)) * length(along) / stretch\n : 0.0;\n d = inside ? d : -d;\n float coverage = vCut.x > vCut.y\n ? clamp((d - vCut.y) / (vCut.x - vCut.y), 0.0, 1.0)\n : step(vCut.x, d);\n if (coverage <= 0.0) {\n discard;\n }\n\n finalColor = vec4(vShown.rgb * vShown.a, vShown.a) * coverage;\n}\n`;\n/**\n * Two triangles over a layer's rectangle of the target, uRect its corners\n * in clip space: a rasteriser then steps over those pixels alone, as a\n * software one does not for a triangle over the whole target cut by the\n * scissor.\n */\nexport const compositeVertex = `#version 300 es\nuniform vec4 uRect;\nvoid main(void) {\n int k = gl_VertexID;\n vec2 p = vec2(k == 1 || k == 2 || k == 4 ? 1.0 : 0.0, k == 2 || k == 4 || k == 5 ? 1.0 : 0.0);\n gl_Position = vec4(mix(uRect.xy, uRect.zw, p), 0.0, 1.0);\n}\n`;\n/**\n * A composited layer's pixel, `front`, coloured by its row's colour\n * transform where it has one (`row` not -1).\n */\nconst layerColor = (row) => ` if (${row} >= 0 && front.a > 0.0) {\n ivec2 row = ivec2((${row} & ${ROWS_A_LINE - 1}) * ${ROW_TEXELS}, ${row} >> ${Math.log2(ROWS_A_LINE)});\n vec4 mul = texelFetch(uRows, row + ivec2(2, 0), 0);\n vec4 add = texelFetch(uRows, row + ivec2(3, 0), 0);\n vec4 c = clamp(vec4(front.rgb / front.a, front.a) * mul + add, 0.0, 1.0);\n front = vec4(c.rgb * c.a, c.a);\n }\n`;\n/** A composited layer's pixel, `front`, coloured by its row's colour transform where it has one (uRow not -1). */\nexport const LAYER_COLOR = layerColor(\"uRow\");\n/**\n * `front`, premultiplied, blended in mode uMode onto what is below it\n * (uBack, a copy of it, whose texel at the fragment is uBackOffset short of\n * it) into finalColor: normal, layer, add and screen as `front` alone, GL's\n * blending computing them; the separable modes blend straight colours and\n * composite source over, the others have formulas of their own.\n */\nconst BLEND_FRONT = ` if (uMode == ${NORMAL} || uMode == ${LAYER} || uMode == ${SCREEN} || uMode == ${ADD}) {\n finalColor = front;\n return;\n }\n\n vec4 back = texelFetch(uBack, ivec2(gl_FragCoord.xy) - uBackOffset, 0);\n vec3 cb = straight(back);\n vec3 cf = straight(front);\n vec3 b;\n switch (uMode) {\n case ${MULTIPLY}: b = cb * cf; break;\n case ${LIGHTEN}: b = max(cb, cf); break;\n case ${DARKEN}: b = min(cb, cf); break;\n case ${DIFFERENCE}: b = abs(cb - cf); break;\n case ${OVERLAY}: b = hardlight(cf, cb); break;\n case ${HARDLIGHT}: b = hardlight(cb, cf); break;\n case ${SUBTRACT}:\n finalColor = vec4(max(back.rgb - front.rgb, 0.0), front.a + back.a * (1.0 - front.a));\n return;\n case ${INVERT}:\n finalColor = vec4((back.a - back.rgb) * front.a + back.rgb * (1.0 - front.a), back.a);\n return;\n case ${ALPHA}:\n finalColor = front.a > 0.0 ? back * front.a : back;\n return;\n case ${ERASE}:\n finalColor = back * (1.0 - front.a);\n return;\n default:\n finalColor = front + back * (1.0 - front.a);\n return;\n }\n\n vec3 co = front.rgb * (1.0 - back.a) + back.rgb * (1.0 - front.a) + front.a * back.a * b;\n finalColor = vec4(co, front.a + back.a * (1.0 - front.a));\n`;\n/** BLEND_FRONT's helpers. */\nconst BLEND_HELPERS = `vec3 straight(vec4 c) { return c.a > 0.0 ? c.rgb / c.a : vec3(0.0); }\nvec3 hardlight(vec3 cb, vec3 cf) {\n vec3 multiply = 2.0 * cb * cf;\n vec3 screen = 1.0 - 2.0 * (1.0 - cb) * (1.0 - cf);\n return mix(multiply, screen, step(0.5, cf));\n}\n`;\n/**\n * A layer composited onto what is below over its rectangle, pixel for\n * pixel: its rows run down, as the filters read them, and the target's up\n * where it is the canvas (uFlip), from uOffset in its framebuffer. Coloured\n * by its row's colour transform where it has one (uRow not -1), on its\n * straight colour where it covers anything; then blended by its mode\n * (BLEND_FRONT).\n */\nexport const compositeFragment = `#version 300 es\nprecision highp float;\nuniform sampler2D uLayer;\nuniform sampler2D uBack;\nuniform highp sampler2D uRows;\nuniform int uRow;\nuniform int uMode;\nuniform ivec2 uOffset;\nuniform bool uFlip;\nuniform ivec2 uBackOffset;\nout vec4 finalColor;\n\n${BLEND_HELPERS}\nvoid main(void) {\n ivec2 frag = ivec2(gl_FragCoord.xy);\n ivec2 at = ivec2(frag.x - uOffset.x, uFlip ? uOffset.y - frag.y : frag.y - uOffset.y);\n vec4 front = texelFetch(uLayer, at, 0);\n${LAYER_COLOR}\n${BLEND_FRONT}}\n`;\n/**\n * A fill drawn straight onto what is below it in a blend mode, where its\n * layer would hold it alone (a flat fill, GeometryData.flat): its pixel as\n * fillFragment has it, then as compositeFragment composites its layer's,\n * coloured by the layer's row (uLayerRow, -1 for none) and blended by uMode.\n */\nexport const blendFillFragment = `#version 300 es\nprecision highp float;\nin vec4 vColor;\nin vec2 vTexel;\nflat in vec4 vMul;\nflat in vec4 vAdd;\nflat in int vSlot;\nuniform sampler2D uTextures[${FILL_TEXTURES}];\nuniform sampler2D uBack;\nuniform highp sampler2D uRows;\nuniform int uLayerRow;\nuniform int uMode;\nuniform ivec2 uBackOffset;\nout vec4 finalColor;\n\n${BLEND_HELPERS}\nvec4 texel(vec2 at) {\n vec4 t = vec4(0.0);\n switch (vSlot) {\n${slotTexel}\n }\n\n return t;\n}\n\nvoid main(void) {\n vec4 front = vec4(0.0);\n vec4 fill = vColor;\n bool clear = false;\n if (vSlot != 0) {\n vec4 t = texel(vTexel);\n clear = t.a == 0.0;\n fill = clear ? fill : vec4(t.rgb / t.a * vColor.rgb, t.a * vColor.a);\n }\n\n if (!clear) {\n vec4 c = clamp(fill * vMul + vAdd, 0.0, 1.0);\n front = vec4(c.rgb * c.a, c.a);\n }\n\n${layerColor(\"uLayerRow\")}\n${BLEND_FRONT}}\n`;\n//# sourceMappingURL=programs.js.map","import { GLYPH_FLOATS } from \"../geometry.js\";\nimport { COLOR_AT, DEPTH_AT, GLYPH_AT, ORIGIN_AT, POSITION_AT, RUN_AT, TEXEL_AT, TINT_AT, } from \"./programs.js\";\n/**\n * Bytes a vertex in the atlas: its position's two floats, its texel's two, then its colour's four\n * bytes, or a mesh's depth's float.\n */\nconst VERTEX_BYTES = 20;\n/** Bytes a vertex of advanced text's glyph quads, in an atlas of their own. */\nconst GLYPH_BYTES = GLYPH_FLOATS * 4;\n/** The fewest glyph vertices the glyph atlas holds once a text needs it. */\nconst GLYPHS_LEAST = 1024;\n/** The fewest vertices the atlas holds room for, and its indices thrice that. */\nconst LEAST = 1 << 16;\n/** Holes past which, and past the live vertices, the atlas is packed again. */\nconst SLACK = 1 << 16;\n/**\n * The geometry atlas: every geometry copied once into a vertex and an index\n * buffer, and advanced text's glyph quads into an atlas of their own, where\n * the draws find them by their places. A geometry let go of leaves a hole,\n * and each atlas is packed again from the geometries' own arrays once the\n * holes outweigh what is live.\n */\nexport class GeometryAtlas {\n gl;\n state;\n vertexArray;\n vertexBuffer;\n indexBuffer;\n vertexCapacity = 0;\n indexCapacity = 0;\n vertexTop = 0;\n indexTop = 0;\n live = 0;\n holes = 0;\n places = [];\n glyphArray;\n glyphBuffer;\n glyphIndexBuffer;\n /** The glyph atlas' room and top, of vertices and of indices, and its vertices live and let go of. */\n glyphs = {\n capacity: 0,\n top: 0,\n indexCapacity: 0,\n indexTop: 0,\n live: 0,\n holes: 0,\n };\n constructor(gl, state) {\n this.gl = gl;\n this.state = state;\n }\n /** The buffers and vertex arrays made, both atlases empty, as the context comes or comes back. */\n setUp() {\n const gl = this.gl;\n this.vertexArray = gl.createVertexArray();\n this.vertexBuffer = gl.createBuffer();\n this.indexBuffer = gl.createBuffer();\n this.state.bindVertexArray(this.vertexArray);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n gl.enableVertexAttribArray(POSITION_AT);\n gl.vertexAttribPointer(POSITION_AT, 2, gl.FLOAT, false, VERTEX_BYTES, 0);\n gl.enableVertexAttribArray(TEXEL_AT);\n gl.vertexAttribPointer(TEXEL_AT, 2, gl.FLOAT, false, VERTEX_BYTES, 8);\n gl.enableVertexAttribArray(COLOR_AT);\n gl.vertexAttribPointer(COLOR_AT, 4, gl.UNSIGNED_BYTE, true, VERTEX_BYTES, 16);\n // The same bytes as a mesh's depth, which the mesh program reads in place of the colour.\n gl.enableVertexAttribArray(DEPTH_AT);\n gl.vertexAttribPointer(DEPTH_AT, 1, gl.FLOAT, false, VERTEX_BYTES, 16);\n this.glyphArray = gl.createVertexArray();\n this.glyphBuffer = gl.createBuffer();\n this.glyphIndexBuffer = gl.createBuffer();\n this.state.bindVertexArray(this.glyphArray);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.glyphBuffer);\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.glyphIndexBuffer);\n gl.enableVertexAttribArray(POSITION_AT);\n gl.vertexAttribPointer(POSITION_AT, 2, gl.FLOAT, false, GLYPH_BYTES, 0);\n for (const [at, offset] of [\n [ORIGIN_AT, 8],\n [GLYPH_AT, 24],\n [RUN_AT, 40],\n [TINT_AT, 56],\n ]) {\n gl.enableVertexAttribArray(at);\n gl.vertexAttribPointer(at, 4, gl.FLOAT, false, GLYPH_BYTES, offset);\n }\n Object.assign(this.glyphs, {\n capacity: 0,\n top: 0,\n indexCapacity: 0,\n indexTop: 0,\n live: 0,\n holes: 0,\n });\n this.vertexCapacity = 0;\n this.indexCapacity = 0;\n this.places = [];\n }\n /**\n * The geometries removed since the last frame let go of, and those added\n * copied in: at the top while they fit, else into an atlas packed again,\n * grown to twice what is live.\n */\n place(geometries) {\n for (const id of geometries.removed) {\n const place = this.places[id];\n if (place?.glyphs) {\n this.places[id] = null;\n this.glyphs.live -= place.vertices;\n this.glyphs.holes += place.vertices;\n }\n else if (place) {\n this.places[id] = null;\n this.live -= place.vertices;\n this.holes += place.vertices;\n }\n }\n geometries.removed.length = 0;\n // Changed in place: copied again where they lie, else as added.\n for (const id of geometries.updated) {\n const place = this.places[id];\n const data = geometries.get(id);\n if (place && data && !data.glyphs && place.vertices === data.positions.length / 2) {\n this.copyVertices(data, place.vertexStart);\n }\n else if (place && data) {\n this.places[id] = null;\n if (place.glyphs) {\n this.glyphs.live -= place.vertices;\n this.glyphs.holes += place.vertices;\n }\n else {\n this.live -= place.vertices;\n this.holes += place.vertices;\n }\n geometries.added.push(id);\n }\n }\n geometries.updated.length = 0;\n let vertices = 0;\n let indices = 0;\n let glyphVertices = 0;\n let glyphIndices = 0;\n for (const id of geometries.added) {\n const data = geometries.get(id);\n if (data?.glyphs) {\n glyphVertices += data.glyphs.vertices.length / GLYPH_FLOATS;\n glyphIndices += data.indices.length;\n }\n else if (data) {\n vertices += data.positions.length / 2;\n indices += data.indices.length;\n }\n }\n // Each atlas packed again on its own, so that texts' quads made again often never repack\n // the shapes', nor shapes the texts'.\n const g = this.glyphs;\n const shapes = this.vertexTop + vertices > this.vertexCapacity ||\n this.indexTop + indices > this.indexCapacity ||\n (this.holes > SLACK && this.holes > this.live);\n const texts = g.top + glyphVertices > g.capacity ||\n g.indexTop + glyphIndices > g.indexCapacity ||\n (g.holes > GLYPHS_LEAST && g.holes > g.live);\n if (shapes) {\n this.repack(geometries);\n }\n if (texts) {\n this.repackGlyphs(geometries);\n }\n for (const id of geometries.added) {\n const data = geometries.get(id);\n if (data && !(data.glyphs ? texts : shapes)) {\n this.copyIn(id, data);\n }\n }\n geometries.added.length = 0;\n }\n /** Every live shape's geometry copied into new buffers, with room for twice what is live. */\n repack(geometries) {\n const gl = this.gl;\n const ids = geometries.live();\n let vertices = 0;\n let indices = 0;\n for (const id of ids) {\n const data = geometries.get(id);\n if (!data.glyphs) {\n vertices += data.positions.length / 2;\n indices += data.indices.length;\n }\n }\n this.vertexCapacity = Math.max(LEAST, vertices * 2);\n this.indexCapacity = Math.max(LEAST * 3, indices * 2);\n this.state.bindVertexArray(this.vertexArray);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, this.vertexCapacity * VERTEX_BYTES, gl.STATIC_DRAW);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indexCapacity * 4, gl.STATIC_DRAW);\n this.vertexTop = 0;\n this.indexTop = 0;\n this.live = 0;\n this.holes = 0;\n for (const id of ids) {\n const data = geometries.get(id);\n if (!data.glyphs) {\n this.copyIn(id, data);\n }\n }\n }\n /** Every live text's quads copied into new glyph buffers: none till a text needs them. */\n repackGlyphs(geometries) {\n const gl = this.gl;\n const g = this.glyphs;\n const ids = geometries.live();\n let vertices = 0;\n let indices = 0;\n for (const id of ids) {\n const data = geometries.get(id);\n if (data.glyphs) {\n vertices += data.glyphs.vertices.length / GLYPH_FLOATS;\n indices += data.indices.length;\n }\n }\n g.capacity = vertices > 0 ? Math.max(GLYPHS_LEAST, vertices * 2) : 0;\n g.indexCapacity = vertices > 0 ? Math.max(GLYPHS_LEAST * 2, indices * 2) : 0;\n this.state.bindVertexArray(this.glyphArray);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.glyphBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, g.capacity * GLYPH_BYTES, gl.STATIC_DRAW);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, g.indexCapacity * 4, gl.STATIC_DRAW);\n g.top = 0;\n g.indexTop = 0;\n g.live = 0;\n g.holes = 0;\n for (const id of ids) {\n const data = geometries.get(id);\n if (data.glyphs) {\n this.copyGlyphs(id, data);\n }\n }\n }\n /** `data` copied in at the top of the atlas, its indices made absolute. */\n copyIn(id, data) {\n if (data.glyphs) {\n this.copyGlyphs(id, data);\n return;\n }\n const gl = this.gl;\n const count = data.positions.length / 2;\n const base = this.vertexTop;\n this.copyVertices(data, base);\n const indices = new Uint32Array(data.indices.length);\n for (let i = 0; i < indices.length; i++) {\n indices[i] = data.indices[i] + base;\n }\n this.state.bindVertexArray(this.vertexArray);\n gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, this.indexTop * 4, indices);\n this.places[id] = {\n vertexStart: base,\n vertices: count,\n indexStart: this.indexTop,\n indices: indices.length,\n glyphs: null,\n flat: data.flat === true,\n };\n this.vertexTop += count;\n this.indexTop += indices.length;\n this.live += count;\n }\n /** `data`'s vertices interleaved into the atlas from vertex `base`. */\n copyVertices(data, base) {\n const gl = this.gl;\n const count = data.positions.length / 2;\n const bytes = new ArrayBuffer(count * VERTEX_BYTES);\n const floats = new Float32Array(bytes);\n const words = new Uint32Array(bytes);\n const texels = data.texels;\n const depths = data.depths;\n for (let i = 0; i < count; i++) {\n floats[i * 5] = data.positions[i * 2];\n floats[i * 5 + 1] = data.positions[i * 2 + 1];\n floats[i * 5 + 2] = texels ? texels[i * 2] : 0;\n floats[i * 5 + 3] = texels ? texels[i * 2 + 1] : 0;\n if (depths) {\n floats[i * 5 + 4] = depths[i];\n }\n else {\n words[i * 5 + 4] = data.colors[i];\n }\n }\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bufferSubData(gl.ARRAY_BUFFER, base * VERTEX_BYTES, floats);\n }\n /** Glyph quads copied in at the top of the glyph atlas, their indices made absolute in it. */\n copyGlyphs(id, data) {\n const gl = this.gl;\n const g = this.glyphs;\n const glyphs = data.glyphs;\n const count = glyphs.vertices.length / GLYPH_FLOATS;\n const indices = new Uint32Array(data.indices.length);\n for (let i = 0; i < indices.length; i++) {\n indices[i] = data.indices[i] + g.top;\n }\n this.state.bindVertexArray(this.glyphArray);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.glyphBuffer);\n gl.bufferSubData(gl.ARRAY_BUFFER, g.top * GLYPH_BYTES, glyphs.vertices);\n gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, g.indexTop * 4, indices);\n this.places[id] = {\n vertexStart: g.top,\n vertices: count,\n indexStart: g.indexTop,\n indices: indices.length,\n glyphs: { mode: glyphs.mode, table: glyphs.table },\n flat: false,\n };\n g.top += count;\n g.indexTop += indices.length;\n g.live += count;\n }\n /** The buffers and vertex arrays made on the context, deleted. */\n destroy() {\n const gl = this.gl;\n gl.deleteVertexArray(this.vertexArray);\n gl.deleteBuffer(this.vertexBuffer);\n gl.deleteBuffer(this.indexBuffer);\n gl.deleteVertexArray(this.glyphArray);\n gl.deleteBuffer(this.glyphBuffer);\n gl.deleteBuffer(this.glyphIndexBuffer);\n }\n}\n//# sourceMappingURL=atlas.js.map","// Pixel Bender kernels where Flash draws with them, as fragment shaders\n// around a kernel's GLSL (the player's scene/pixel-bender-glsl.ts, which\n// defines `vec4 pbKernel(vec2 outCoord)` and calls `pbNearest<t>` and\n// `pbLinear<t>` for each texture `t` it samples). What is here is how\n// each use reads its images and writes what the kernel gives, as adl\n// does (docs/architecture/bitmaps.md, \"Pixel Bender\"): an image read as\n// its premultiplied bytes times the float nearest 1/255, linearly in\n// 256ths with each step's byte cut down; floats as they are, linearly in\n// the same 256ths; as the CPU interpreter reads them. GLSL ES 3, each a\n// whole fragment shader.\n/** A byte's float as adl samples one: times the float nearest 1/255, not divided. */\nconst BYTE = \"0.003921568859368563\";\n/** Each fragment shader's first lines, so that one is the whole source a program cache keys by. */\nconst HEADER = \"#version 300 es\\nprecision highp float;\\n\";\n/** The most images a kernel's program binds besides its layer's: one with more is not drawn. */\nexport const KERNEL_IMAGES = 8;\n/** Whether `images` bind no more textures of their own than a program takes (KERNEL_IMAGES). */\nexport function kernelImagesFit(images) {\n let own = 0;\n for (let k = 0; k < images.length; k++) {\n if (!images[k].layer) {\n own++;\n }\n }\n return own <= KERNEL_IMAGES;\n}\n/**\n * Precision, as ints default to mediump in a fragment shader; a texel\n * coordinate as a texel's index, NaN as 0 and far past the edges kept in\n * int's range; a texel's bytes from 0 to 255, read exactly from the 8-bit\n * texture; and a kernel's output as adl writes it into a bitmap: clamped,\n * NaN as 0, rounded to a byte a half to the even, each colour at most its\n * alpha.\n */\nconst PRELUDE = `precision highp int;\nprecision highp sampler2D;\nivec2 pbFloor(vec2 x) {\n x = mix(x, vec2(0.0), isnan(x));\n return ivec2(clamp(floor(x), -1.0e9, 1.0e9));\n}\nvec4 pbBytes(vec4 v) {\n return floor(v * 255.0 + 0.5);\n}\nvec4 pbOutput(vec4 c) {\n c = mix(vec4(0.0), min(c, 1.0), greaterThan(c, vec4(0.0)));\n c = roundEven(c * 255.0) / 255.0;\n return vec4(min(c.rgb, c.a), c.a);\n}\n`;\n/**\n * Image `t`'s sampling from `pbTexel<t>`, its texel at an index (bytes from\n * 0 to 255, or floats), at the texel coordinates `at` gives for a kernel's.\n */\nfunction sampling(t, at, float) {\n if (float) {\n // The interpreter's floats: their texels as they are, linearly in 256ths, nothing cut.\n return `vec4 pbNearest${t}(vec2 p) {\n return pbTexel${t}(pbFloor(${at}));\n}\nvec4 pbLinear${t}(vec2 p) {\n vec2 f = ${at} - 0.5;\n vec2 below = floor(f);\n vec2 w = floor((f - below) * 256.0 + 0.5) / 256.0;\n w = mix(w, vec2(0.0), isnan(w));\n ivec2 a = pbFloor(below);\n vec4 row0 = pbTexel${t}(a) * (1.0 - w.x) + pbTexel${t}(a + ivec2(1, 0)) * w.x;\n vec4 row1 = pbTexel${t}(a + ivec2(0, 1)) * (1.0 - w.x) + pbTexel${t}(a + 1) * w.x;\n return row0 * (1.0 - w.y) + row1 * w.y;\n}\n`;\n }\n return `vec4 pbNearest${t}(vec2 p) {\n return pbTexel${t}(pbFloor(${at})) * ${BYTE};\n}\nvec4 pbLinear${t}(vec2 p) {\n vec2 f = ${at} - 0.5;\n vec2 below = floor(f);\n vec2 w = floor((f - below) * 256.0 + 0.5);\n w = mix(w, vec2(0.0), isnan(w));\n ivec2 a = pbFloor(below);\n vec4 row0 = floor((pbTexel${t}(a) * (256.0 - w.x) + pbTexel${t}(a + ivec2(1, 0)) * w.x) / 256.0);\n vec4 row1 = floor((pbTexel${t}(a + ivec2(0, 1)) * (256.0 - w.x) + pbTexel${t}(a + 1) * w.x) / 256.0);\n return floor((row0 * (256.0 - w.y) + row1 * w.y) / 256.0) * ${BYTE};\n}\n`;\n}\n/**\n * Image `t`, a texture of its own (`pbImage<t>`), clamped to its edges as\n * adl clamps a kernel's input: its sampler, its texels and its sampling, in\n * its own pixels.\n */\nfunction ownImage(t, float) {\n const texel = `texelFetch(pbImage${t}, clamp(at, ivec2(0), size - 1), 0)`;\n return `uniform sampler2D pbImage${t};\nvec4 pbTexel${t}(ivec2 at) {\n ivec2 size = textureSize(pbImage${t}, 0);\n return ${float ? texel : `pbBytes(${texel})`};\n}\n${sampling(t, \"p\", float)}`;\n}\n/**\n * The kernel's GLSL with what every use puts round it: PRELUDE, then each\n * image, by `layerTexel` for the layer's, its texel at an index, and\n * ownImage for the others; `layerAt` takes a kernel's coordinate to the\n * layer's texels.\n */\nexport function withImages(kernel, images, layerTexel, layerAt) {\n const parts = [PRELUDE];\n for (const { texture: t, layer, float, back } of images) {\n parts.push(layer\n ? `${layerTexel(t, back ?? false)}\\n${sampling(t, layerAt, false)}`\n : ownImage(t, float));\n }\n parts.push(kernel);\n return parts.join(\"\\n\");\n}\n/** The most kernels whose shaders a use keeps made (madeOnce), emptied when more come. */\nconst MADE = 64;\n/** A kernel's shader for its images, made once: a frame asks for it again on each of its uses. */\nexport function madeOnce(made, kernel, images, make) {\n let key = \"\";\n for (let k = 0; k < images.length; k++) {\n const i = images[k];\n key += `${i.texture}${i.layer ? (i.back ? \"B\" : \"L\") : \"\"}${i.float ? \"F\" : \"\"},`;\n }\n let byImages = made.get(kernel);\n if (!byImages) {\n if (made.size >= MADE) {\n made.clear();\n }\n byImages = new Map();\n made.set(kernel, byImages);\n }\n let source = byImages.get(key);\n if (source === undefined) {\n source = make();\n byImages.set(key, source);\n }\n return source;\n}\nconst madeFilters = new Map();\n/**\n * A ShaderFilter's pass (filter-plan.ts, KERNEL_PASS), run as the\n * filters' other passes are (webgl/filters.ts): the kernel's output over\n * the input's frame, `outCoord` its pixel's centre in stage pixels from\n * the corner of the bitmap the filter reads, `uKernelAt.xy` texels in from\n * the frame's, which starts at `uOutputAt` in the target drawn into, at\n * `uKernelAt.z` texels a stage pixel. The layer's image is the input\n * (uTexture, within uTextureRect), transparent past the frame,\n * `uKernelFrame` texels, as adl reads a filter's source; the others clamp\n * to their edges. The output is as adl writes it (pbOutput), and\n * transparent outside `uKernelRegion`, that bitmap grown by the filter's\n * extensions, in stage pixels.\n */\nexport function filterKernel(kernel, images) {\n return madeOnce(madeFilters, kernel, images, () => filterSource(kernel, images));\n}\nfunction filterSource(kernel, images) {\n const layer = (t) => `vec4 pbTexel${t}(ivec2 at) {\n if (any(lessThan(at, ivec2(0))) || any(greaterThanEqual(at, ivec2(uKernelFrame)))) {\n return vec4(0.0);\n }\n return pbBytes(texelFetch(uTexture, ivec2(uTextureRect.xy) + at, 0));\n}`;\n return `${HEADER}in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform highp vec4 uInputPixel;\nuniform vec4 uTextureRect;\nuniform vec3 uKernelAt;\nuniform vec2 uKernelFrame;\nuniform vec4 uKernelRegion;\nuniform vec2 uOutputAt;\n${withImages(kernel, images, layer, \"p * uKernelAt.z + uKernelAt.xy\")}\nvoid main(void) {\n // From the fragment's centre, exact, where an interpolated coordinate is a hair off a half.\n vec2 outCoord = (gl_FragCoord.xy - uOutputAt - uKernelAt.xy) / uKernelAt.z;\n if (any(lessThan(outCoord, uKernelRegion.xy)) || any(greaterThanEqual(outCoord, uKernelRegion.zw))) {\n finalColor = vec4(0.0);\n return;\n }\n finalColor = pbOutput(pbKernel(outCoord));\n}\n`;\n}\nconst madeBlends = new Map();\n/**\n * A blend shader's composite (webgl/composite.ts), drawn as the composite\n * program is (programs.ts, compositeFragment), its uniforms the same: as\n * adl runs one, a pixel at a time, each where the layer covers anything\n * and nothing where it does not, or over its whole rectangle (uWhole),\n * the kernel's coordinate (0.5, 0.5) and its first two inputs that pixel\n * of what is below and of the layer, coloured, whatever coordinate it\n * samples them at; its result in place of what was below, as adl writes\n * it (pbOutput). `rows` is the colour transform's reading of uRows\n * (programs.ts, LAYER_COLOR).\n */\nexport function blendKernel(kernel, images, rows) {\n return madeOnce(madeBlends, kernel, images, () => blendSource(kernel, images, rows));\n}\nfunction blendSource(kernel, images, rows) {\n const pixel = (t, back) => `vec4 pbTexel${t}(ivec2 at) {\n return pbBytes(${back ? \"pbBack\" : \"pbFront\"});\n}`;\n return `${HEADER}uniform sampler2D uLayer;\nuniform sampler2D uBack;\nuniform highp sampler2D uRows;\nuniform int uRow;\nuniform ivec2 uOffset;\nuniform bool uFlip;\nuniform ivec2 uBackOffset;\nuniform bool uWhole;\nout vec4 finalColor;\nvec4 pbFront;\nvec4 pbBack;\n${withImages(kernel, images, pixel, \"p\")}\nvoid main(void) {\n ivec2 frag = ivec2(gl_FragCoord.xy);\n ivec2 at = ivec2(frag.x - uOffset.x, uFlip ? uOffset.y - frag.y : frag.y - uOffset.y);\n vec4 front = texelFetch(uLayer, at, 0);\n${rows}\n pbBack = texelFetch(uBack, frag - uBackOffset, 0);\n if (!uWhole && pbBytes(front).a == 0.0) {\n finalColor = pbBack;\n return;\n }\n pbFront = front;\n finalColor = pbOutput(pbKernel(vec2(0.5)));\n}\n`;\n}\n/**\n * The layer shrunk to a texel a stage pixel for a kernel run once a pixel\n * (filter-plan.ts): each output texel the mean of the `uDown.x` by\n * `uDown.x` texels of the pixel it stands for, the grid from `uDown.yz`\n * texels past the input's corner, which may be less than 0; the texels of\n * a pixel past the frame, `uKernelFrame`, left out of the mean.\n */\nexport const PIXELS_DOWN = `${HEADER}precision highp int;\nin vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform vec4 uTextureRect;\nuniform vec3 uDown;\nuniform vec2 uKernelFrame;\nuniform vec2 uOutputAt;\nvoid main(void) {\n int n = int(uDown.x);\n ivec2 from = ivec2(gl_FragCoord.xy - uOutputAt) * n + ivec2(uDown.yz);\n ivec2 frame = ivec2(uKernelFrame);\n vec4 sum = vec4(0.0);\n float count = 0.0;\n for (int j = 0; j < 16; j++) {\n if (j >= n) { break; }\n for (int i = 0; i < 16; i++) {\n if (i >= n) { break; }\n ivec2 at = from + ivec2(i, j);\n if (all(greaterThanEqual(at, ivec2(0))) && all(lessThan(at, frame))) {\n sum += texelFetch(uTexture, ivec2(uTextureRect.xy) + at, 0);\n count += 1.0;\n }\n }\n }\n finalColor = count > 0.0 ? sum / count : vec4(0.0);\n}\n`;\n/**\n * A kernel's output, run a texel a stage pixel, drawn back over the\n * layer's frame: each texel its pixel's, the grid as PIXELS_DOWN had it.\n */\nexport const PIXELS_BACK = `${HEADER}precision highp int;\nin vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nuniform vec4 uTextureRect;\nuniform vec3 uDown;\nuniform vec2 uOutputAt;\nvoid main(void) {\n ivec2 at = (ivec2(gl_FragCoord.xy - uOutputAt) - ivec2(uDown.yz)) / int(uDown.x);\n at = clamp(at, ivec2(0), ivec2(uTextureRect.zw) - 1);\n finalColor = texelFetch(uTexture, ivec2(uTextureRect.xy) + at, 0);\n}\n`;\nconst madeFills = new Map();\n/**\n * A shader fill's program, after the mesh's vertex shader (programs.ts,\n * meshVertex), which carries the kernel's coordinates in vUVT with a depth\n * of 1: the kernel run once a pixel of Flash's, at its centre (uFrag as the\n * mesh's has it), its images clamped to their edges; its colours left\n * past its alpha, as adl composites them, but under a colour transform,\n * which takes them straight.\n */\nexport function fillKernel(kernel, images) {\n return madeOnce(madeFills, kernel, images, () => fillSource(kernel, images));\n}\nfunction fillSource(kernel, images) {\n return `${HEADER}in vec3 vUVT;\nflat in vec4 vMul;\nflat in vec4 vAdd;\nuniform vec4 uFrag;\nout vec4 finalColor;\n${withImages(kernel, images, () => \"\", \"p\")}\nvoid main(void) {\n float pixel = uFrag.w;\n vec2 f = vec2(gl_FragCoord.x + uFrag.x, uFrag.y + uFrag.z * gl_FragCoord.y);\n vec2 centre = (floor(f / pixel) + 0.5) * pixel;\n vec3 at = vUVT + dFdx(vUVT) * (centre.x - f.x) + dFdy(vUVT) * ((centre.y - f.y) * uFrag.z);\n vec4 c = pbKernel(at.xy / at.z);\n c = mix(vec4(0.0), min(c, 1.0), greaterThan(c, vec4(0.0)));\n if (vMul == vec4(1.0) && vAdd == vec4(0.0)) {\n finalColor = c;\n return;\n }\n if (c.a == 0.0) {\n finalColor = vec4(0.0);\n return;\n }\n vec4 s = clamp(vec4(c.rgb / c.a, c.a) * vMul + vAdd, 0.0, 1.0);\n finalColor = vec4(s.rgb * s.a, s.a);\n}\n`;\n}\n//# sourceMappingURL=kernel-shaders.js.map","/** What a size, and samples where they count, are keyed by. */\nconst SIZE_KEY = 65536;\nconst SAMPLES_KEY = 32;\n/**\n * Free targets kept by their size (and samples) for the next to take them:\n * an exact one found at once, a larger one among the sizes there are, each\n * size's list in the order they were freed. A frame's end lets go of those\n * idle too long, then of the least lately freed past a budget, oldest first\n * from the lists' heads, as the frame's own working set may pass it for a\n * while without what it gives back being made again.\n */\nexport class SizedPool {\n lists = new Map();\n bytesOf;\n /** The bytes all held take together. */\n bytes = 0;\n constructor(bytesOf) {\n this.bytesOf = bytesOf;\n }\n /** One of just `width` by `height` (and `samples`), the latest freed; none for none. */\n take(width, height, samples = 0) {\n return this.takeAt((width * SIZE_KEY + height) * SAMPLES_KEY + samples);\n }\n /** The smallest target that fits, at these samples and within `maxArea`; none for none. */\n takeFitting(width, height, samples = 0, maxArea = Number.POSITIVE_INFINITY) {\n let best = -1;\n let least = Number.POSITIVE_INFINITY;\n for (const key of this.lists.keys()) {\n const size = Math.floor(key / SAMPLES_KEY);\n const w = Math.floor(size / SIZE_KEY);\n const h = size % SIZE_KEY;\n if (key % SAMPLES_KEY === samples &&\n w >= width &&\n h >= height &&\n w * h <= maxArea &&\n w * h < least) {\n least = w * h;\n best = key;\n }\n }\n return best < 0 ? null : this.takeAt(best);\n }\n takeAt(key) {\n const list = this.lists.get(key);\n const item = list?.pop() ?? null;\n if (!item) {\n return null;\n }\n // An emptied size goes, so that finding a larger one looks at those held alone.\n if (list.length === 0) {\n this.lists.delete(key);\n }\n this.bytes -= this.bytesOf(item);\n return item;\n }\n /** `item` free again, freed in frame `frame`, of `samples` where they count. */\n give(item, frame, samples = 0) {\n item.usedAt = frame;\n const key = ((item.textureWidth ?? item.width) * SIZE_KEY + (item.textureHeight ?? item.height)) *\n SAMPLES_KEY +\n samples;\n let list = this.lists.get(key);\n if (!list) {\n list = [];\n this.lists.set(key, list);\n }\n list.push(item);\n this.bytes += this.bytesOf(item);\n }\n /**\n * Those freed more than `idle` frames before `frame` let go of, then the\n * least lately freed till they take `budget` bytes at most, each `drop`ped.\n */\n trim(frame, idle, budget, drop) {\n this.trimIdle(frame, idle, drop);\n trimTogether([{ pool: this, drop }], budget);\n }\n /** Those freed more than `idle` frames before `frame` let go of, each `drop`ped. */\n trimIdle(frame, idle, drop) {\n for (const [key, list] of this.lists) {\n let gone = 0;\n while (gone < list.length && frame - list[gone].usedAt > idle) {\n this.bytes -= this.bytesOf(list[gone]);\n drop(list[gone]);\n gone++;\n }\n if (gone === list.length) {\n this.lists.delete(key);\n }\n else if (gone > 0) {\n list.splice(0, gone);\n }\n }\n }\n /**\n * The key of the list whose head goes first past a budget: the least\n * lately freed, and of those freed in one frame the largest, so that as\n * few go as may; -1 for none.\n */\n firstOut() {\n let best = -1;\n let bestAt = 0;\n let bestBytes = 0;\n for (const [key, list] of this.lists) {\n const head = list[0];\n const bytes = this.bytesOf(head);\n if (best < 0 || head.usedAt < bestAt || (head.usedAt === bestAt && bytes > bestBytes)) {\n best = key;\n bestAt = head.usedAt;\n bestBytes = bytes;\n }\n }\n return best;\n }\n /** The head of list `key` (firstOut), as `firstOut` found it. */\n headOf(key) {\n return this.lists.get(key)[0];\n }\n /** The head of list `key` (firstOut) let go of, `drop`ped. */\n dropHead(key, drop) {\n const list = this.lists.get(key);\n const item = list.shift();\n this.bytes -= this.bytesOf(item);\n drop(item);\n if (list.length === 0) {\n this.lists.delete(key);\n }\n }\n /** The bytes those freed in frame `frame` take, which that frame drew with. */\n bytesFreedIn(frame) {\n let bytes = 0;\n for (const list of this.lists.values()) {\n for (let i = list.length - 1; i >= 0 && list[i].usedAt === frame; i--) {\n bytes += this.bytesOf(list[i]);\n }\n }\n return bytes;\n }\n /** The bytes `item` takes, as this pool counts them. */\n bytesFor(item) {\n return this.bytesOf(item);\n }\n /** Every one held let go of, as the context goes. */\n clear(drop) {\n for (const list of this.lists.values()) {\n for (const item of list) {\n drop(item);\n }\n }\n this.lists.clear();\n this.bytes = 0;\n }\n}\n/**\n * `pools` let go of till together they take `budget` bytes at most: the\n * least lately freed of all first, of those freed in one frame the\n * largest. One budget for all, as trimming one pool against what another\n * holds dropped a frame's own small layers while large multisampled\n * buffers idle for many frames stayed, each frame making them again.\n */\nexport function trimTogether(pools, budget) {\n let bytes = 0;\n for (const { pool } of pools) {\n bytes += pool.bytes;\n }\n while (bytes > budget) {\n let from = null;\n let key = -1;\n let at = 0;\n let size = 0;\n for (const trimmed of pools) {\n const k = trimmed.pool.firstOut();\n if (k < 0) {\n continue;\n }\n const head = trimmed.pool.headOf(k);\n const headBytes = trimmed.pool.bytesFor(head);\n if (!from || head.usedAt < at || (head.usedAt === at && headBytes > size)) {\n from = trimmed;\n key = k;\n at = head.usedAt;\n size = headBytes;\n }\n }\n if (!from) {\n break;\n }\n bytes -= size;\n from.pool.dropHead(key, from.drop);\n }\n}\n//# sourceMappingURL=pool.js.map","import { SizedPool, trimTogether } from \"./pool.js\";\nimport { LAYER_UNIT } from \"./programs.js\";\n/**\n * The most a multisampled target may take, colour and depth-stencil\n * together, 8 bytes a sample, as web's fittingSamples has for the\n * canvas.\n */\nexport const MSAA_BYTES = 256 * 1024 * 1024;\n/**\n * The samples a target of `width` by `height` takes for `samples`, a power\n * of two, as a driver rounds others for colour and depth-stencil alike\n * or not: halved till its buffers fit MSAA_BYTES, none (1) where two would\n * not. A layer goes so far, as one padded as far as a texture goes would\n * take gigabytes; the stage, as web's canvas, keeps 4 at least.\n */\nexport function fittingSamples(width, height, samples, least = 1) {\n let fitting = 1;\n while (fitting * 2 <= samples) {\n fitting *= 2;\n }\n const floor = Math.min(fitting, least);\n while (fitting > floor && width * height * fitting * 8 > MSAA_BYTES) {\n fitting /= 2;\n }\n return fitting;\n}\n/** The sizes a layer's texture is made in: rounded up to a multiple, so that one serves many. */\nexport const LAYER_STEP = 128;\n/**\n * The sizes a small layer's side is made in, under LAYER_STEP: a glow of a\n * few dozen pixels took a texture of 128 a side, and a crowd keeps\n * thousands of them as their filters' outputs.\n */\nconst SMALL_STEP = 16;\n/**\n * The free layers and multisampled buffers kept between frames past what\n * the last frame drew with, the least lately freed going first as a frame\n * ends; and the most kept in all. A stretch of frames each drawing\n * full-screen multisampled layers drew with 150 to 300 MiB a frame, and\n * trimmed to 128 MiB in all, made seven targets a frame again, as many as\n * it let go of.\n */\nconst FREE_BYTES = 128 * 1024 * 1024;\nconst WORKING_BYTES = 512 * 1024 * 1024;\n/** A side of a layer made for `n` pixels: rounded up to SMALL_STEP, past LAYER_STEP to that. */\nexport function layerSide(n) {\n return n <= LAYER_STEP\n ? Math.max(SMALL_STEP, Math.ceil(n / SMALL_STEP) * SMALL_STEP)\n : Math.ceil(n / LAYER_STEP) * LAYER_STEP;\n}\n/** The bytes multisampled buffers take: colour and depth-stencil, 8 a sample. */\nfunction msaaBytes(msaa) {\n return msaa.width * msaa.height * msaa.samples * 8;\n}\n/** The bytes a layer takes: its colour, and its stencil where it has one. */\nfunction layerBytes(layer) {\n return layer.textureWidth * layer.textureHeight * (layer.stencil ? 8 : 4);\n}\n/** Frames a free layer is kept undrawn into before it is let go of. */\nexport const LAYER_IDLE_FRAMES = 60;\n/** A whole layer's object from params `p` from `at` (plan.ts, layerParams): null for none. */\nexport function objectOf(p, at) {\n return p[at + 2] < 0 ? null : { x: p[at], y: p[at + 1], width: p[at + 2], height: p[at + 3] };\n}\n/** The framebuffer `open` is drawn into: its multisampled one while it has one, else its own. */\nexport function framebufferOf(open) {\n return open.msaa?.framebuffer ?? open.layer?.framebuffer ?? null;\n}\n/**\n * The backend's render targets: layers and the multisampled buffers they\n * are drawn through, pooled by their size and samples, taken for a frame's\n * layers, given back and let go of once idle; and the layers kept from\n * frame to frame.\n */\nexport class TargetPool {\n gl;\n state;\n /** Frames executed, which a layer's idleness is counted in. */\n frameCount = 0;\n /**\n * The samples the layers of the frame drawing take: the stage's, which a\n * BitmapData's frame draws with none of.\n */\n layerSamples = 1;\n /** Layers free to draw into, by their size. */\n freeLayers = new SizedPool(layerBytes);\n /** Multisampled buffers free to draw a layer into, kept while drawn into often enough. */\n freeMsaa = new SizedPool(msaaBytes);\n /** The layers kept from frame to frame, by their ids in Keeps. */\n kept = [];\n /** The widest and the tallest multisampled buffers found complete, by their samples. */\n completeMsaa = new Map();\n constructor(gl, state) {\n this.gl = gl;\n this.state = state;\n }\n /** The pools and the kept layers emptied, as the context comes or comes back. */\n setUp() {\n this.freeLayers = new SizedPool(layerBytes);\n this.kept = [];\n this.freeMsaa = new SizedPool(msaaBytes);\n this.completeMsaa = new Map();\n }\n get frame() {\n return this.frameCount;\n }\n get frameSamples() {\n return this.layerSamples;\n }\n /** A frame begun, its layers taking `samples`: the stage's, 1 for a BitmapData's frame. */\n beginFrame(samples) {\n this.layerSamples = samples;\n }\n /**\n * A frame of the canvas' ended: the free layers and multisampled buffers\n * undrawn into for LAYER_IDLE_FRAMES let go of, and the frame counted.\n */\n endFrame() {\n const drop = (l) => this.deleteLayer(l);\n const dropMsaa = (m) => this.deleteMultisampled(m);\n this.freeLayers.trimIdle(this.frameCount, LAYER_IDLE_FRAMES, drop);\n this.freeMsaa.trimIdle(this.frameCount, LAYER_IDLE_FRAMES, dropMsaa);\n trimTogether([\n { pool: this.freeLayers, drop },\n { pool: this.freeMsaa, drop: dropMsaa },\n ], \n // What this frame drew with stays for the next, which likely draws alike: holding it adds\n // nothing to what the frame itself took.\n Math.min(WORKING_BYTES, FREE_BYTES +\n this.freeLayers.bytesFreedIn(this.frameCount) +\n this.freeMsaa.bytesFreedIn(this.frameCount)));\n this.frameCount++;\n }\n /** The layer kept as output `id` (Keeps), or none. */\n keptLayer(id) {\n return this.kept[id] ?? null;\n }\n /** `layer` kept as output `id` (Keeps) for the frames after, the one kept before given back. */\n keep(id, layer) {\n const before = this.kept[id];\n if (before && before !== layer) {\n this.giveLayer(before);\n }\n this.kept[id] = layer;\n }\n /** The layer kept as output `id` given back, as Keeps let go of it. */\n release(id) {\n const layer = this.kept[id];\n if (layer) {\n this.giveLayer(layer);\n this.kept[id] = null;\n }\n }\n /**\n * `open`'s multisampled pixels resolved into its layer's texture, its\n * first `width` by `height`, once: what reads it after reads them.\n */\n resolve(open, width, height) {\n const msaa = open.msaa;\n const layer = open.layer;\n if (!msaa || !layer) {\n return;\n }\n const gl = this.gl;\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, msaa.framebuffer);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, layer.framebuffer);\n // The blit writes the whole rectangle, so what the layer held there goes:\n // said so, as ANGLE's Vulkan back end, SwiftShader's and a GPU's alike,\n // otherwise left a reused layer's old pixels where the blit had written\n // (tests/player/packed-filters.ts, once the pool keeps layers a frame).\n gl.invalidateSubFramebuffer(gl.DRAW_FRAMEBUFFER, [gl.COLOR_ATTACHMENT0], 0, 0, width, height);\n gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n // Bound as the state cache has it.\n gl.bindFramebuffer(gl.FRAMEBUFFER, msaa.framebuffer);\n open.msaa = null;\n // Free for the next layer: only those drawn into now hold multisampled buffers.\n this.freeMsaa.give(msaa, this.frameCount, msaa.samples);\n }\n /**\n * Multisampled buffers to draw `layer` into at `wanted` samples, as many\n * as fit, reusing its size or a slightly larger buffer; none where it\n * takes none, its own stencil then made if it has none.\n */\n layerMsaa(layer, wanted) {\n const samples = fittingSamples(layer.width, layer.height, wanted);\n // The resolve copies only the layer's rectangle. A larger MSAA buffer can serve it,\n // but bounding its area avoids clearing a large page for a small layer.\n const kept = samples > 1\n ? (this.freeMsaa.take(layer.width, layer.height, samples) ??\n this.freeMsaa.takeFitting(layer.width, layer.height, samples, layer.width * layer.height * 2))\n : null;\n if (kept) {\n return kept;\n }\n const msaa = samples > 1 ? this.multisampled(layer.width, layer.height, samples) : null;\n if (!msaa && !layer.stencil) {\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH24_STENCIL8, layer.textureWidth, layer.textureHeight);\n this.state.bindFramebuffer(layer.framebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n layer.stencil = stencil;\n }\n return msaa;\n }\n /** Multisampled buffers, or none where the driver leaves their framebuffer incomplete. */\n multisampled(width, height, samples) {\n const gl = this.gl;\n const color = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, color);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.RGBA8, width, height);\n const depthStencil = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencil);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH24_STENCIL8, width, height);\n const framebuffer = gl.createFramebuffer();\n this.state.bindFramebuffer(framebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, color);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencil);\n const msaa = {\n framebuffer,\n color,\n depthStencil,\n width,\n height,\n samples,\n usedAt: this.frameCount,\n };\n // Asking waits for the GPU process, milliseconds at a time, and the\n // answer hangs on the formats and the samples, which are always these,\n // and on each side against the largest a renderbuffer may have: one no\n // wider than the widest found complete of its samples, and no taller\n // than the tallest, which may be another, is not asked about.\n const complete = this.completeMsaa.get(samples);\n if (complete && width <= complete.width && height <= complete.height) {\n return msaa;\n }\n if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) !== gl.FRAMEBUFFER_COMPLETE) {\n this.deleteMultisampled(msaa);\n return null;\n }\n this.completeMsaa.set(samples, {\n width: Math.max(width, complete?.width ?? 0),\n height: Math.max(height, complete?.height ?? 0),\n });\n return msaa;\n }\n deleteMultisampled(msaa) {\n this.gl.deleteFramebuffer(msaa.framebuffer);\n this.gl.deleteRenderbuffer(msaa.color);\n this.gl.deleteRenderbuffer(msaa.depthStencil);\n }\n /**\n * A layer of at least `width` by `height`, the smallest of those free\n * that is, or one made, its sides rounded as layerSide rounds them;\n * `exact`, used as just the rounded size, which filters take so that a\n * frame's targets are alike: a larger texture serves it as one of that\n * size, as filters read it within its size (FilterTarget), so that a\n * layer whose size changes as its content moves finds one free.\n */\n takeLayer(width, height, exact = false) {\n width = layerSide(width);\n height = layerSide(height);\n // Bound excess area: oversized texture reuse also enlarges the MSAA target and clears. An\n // exact one takes its multisampled buffers and clears at its own size, so may go further.\n const found = this.freeLayers.take(width, height) ??\n this.freeLayers.takeFitting(width, height, 0, width * height * (exact ? 4 : 2));\n if (found) {\n found.usedAt = this.frameCount;\n found.width = exact ? width : found.textureWidth;\n found.height = exact ? height : found.textureHeight;\n return found;\n }\n return this.makeLayer(width, height);\n }\n /** A layer just `width` by `height`, made. */\n makeLayer(width, height) {\n const gl = this.gl;\n const texture = gl.createTexture();\n this.state.bindTexture(LAYER_UNIT, texture);\n this.state.activeTexture(LAYER_UNIT);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n // Read texel by texel: with no mipmaps, the default filter would leave it incomplete, reading 0.\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n const framebuffer = gl.createFramebuffer();\n this.state.bindFramebuffer(framebuffer);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n return {\n framebuffer,\n texture,\n stencil: null,\n width,\n height,\n textureWidth: width,\n textureHeight: height,\n usedAt: this.frameCount,\n };\n }\n /** A layer free again, kept for the layers after it while it is drawn into often enough. */\n giveLayer(layer) {\n this.freeLayers.give(layer, this.frameCount);\n }\n deleteLayer(layer) {\n this.state.dropTexture(layer.texture);\n this.gl.deleteFramebuffer(layer.framebuffer);\n this.gl.deleteTexture(layer.texture);\n if (layer.stencil) {\n this.gl.deleteRenderbuffer(layer.stencil);\n }\n }\n /** The free and the kept layers, and the free multisampled buffers, deleted. */\n destroy() {\n this.freeLayers.clear((l) => this.deleteLayer(l));\n for (const layer of this.kept) {\n if (layer) {\n this.deleteLayer(layer);\n }\n }\n this.freeMsaa.clear((m) => this.deleteMultisampled(m));\n }\n}\n//# sourceMappingURL=targets.js.map","import { linkProgram } from \"@swf2es/context3d/device\";\nimport { BLEND } from \"../filters.js\";\nimport { blendKernel, kernelImagesFit } from \"../kernel-shaders.js\";\nimport { ADD, ALPHA_MASK, KERNEL, LAYER, MULTIPLY, NORMAL, SCREEN } from \"../scene.js\";\nimport { BACK_UNIT, compositeFragment, compositeVertex, LAYER_COLOR, LAYER_UNIT, } from \"./programs.js\";\nimport { framebufferOf, LAYER_STEP } from \"./targets.js\";\n/**\n * Whether blend mode `mode` reads what is below, which GL's blending does\n * not compute, onto a target `opaque` throughout or not. Over an opaque\n * one, multiply's src × (1 − da) term is none, and premultiplied it is\n * s × d + d × (1 − sa), alpha as normal's: GL's blending (setModeBlend).\n * An alpha mask's is d × sa (ALPHA_MASK).\n */\nexport function readsBelow(mode, opaque = false) {\n return !(mode === NORMAL ||\n mode === ALPHA_MASK ||\n mode === LAYER ||\n mode === ADD ||\n mode === SCREEN ||\n (mode === MULTIPLY && opaque));\n}\n/**\n * GL's blending set for `mode` where it computes it (readsBelow false),\n * the fragment then its pixel alone (BLEND_FRONT's normal); else off, the\n * fragment the blend itself.\n */\nexport function setModeBlend(gl, state, mode) {\n switch (mode) {\n case ADD:\n state.setBlend(gl.ONE, gl.ONE);\n break;\n case SCREEN:\n state.setBlend(gl.ONE, gl.ONE_MINUS_SRC_COLOR);\n break;\n case NORMAL:\n case LAYER:\n state.setBlend(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n break;\n case MULTIPLY:\n state.setBlend(gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n break;\n case ALPHA_MASK:\n state.setBlend(gl.ZERO, gl.SRC_ALPHA);\n break;\n default:\n state.setBlend(null);\n }\n}\n/**\n * Layers composited onto what they are drawn over, in Flash's blend modes:\n * through GL's blending where it computes the blend, else by the composite\n * program from a copy of what is below, or by a blend shader's program\n * (KERNEL).\n */\nexport class Compositor {\n host;\n kernels;\n gl;\n state;\n /** The layers' composite program and where it takes its mode and row. */\n composite;\n modeLocation = null;\n compositeRowLocation = null;\n offsetLocation = null;\n flipLocation = null;\n backOffsetLocation = null;\n rectLocation = null;\n /** A copy of what is below a layer whose mode reads it, the target's size. */\n back = null;\n backFramebuffer = null;\n backWidth = 0;\n backHeight = 0;\n constructor(gl, state, host, \n /** Blend shaders' programs, the backend's one cache of kernels'. */\n kernels) {\n this.host = host;\n this.kernels = kernels;\n this.gl = gl;\n this.state = state;\n }\n /** The composite program made, and no copy yet, as the context comes or comes back. */\n setUp() {\n const gl = this.gl;\n this.composite = linkProgram(gl, compositeVertex, compositeFragment);\n this.state.useProgram(this.composite);\n gl.uniform1i(gl.getUniformLocation(this.composite, \"uLayer\"), LAYER_UNIT);\n gl.uniform1i(gl.getUniformLocation(this.composite, \"uBack\"), BACK_UNIT);\n gl.uniform1i(gl.getUniformLocation(this.composite, \"uRows\"), 0);\n this.modeLocation = gl.getUniformLocation(this.composite, \"uMode\");\n this.compositeRowLocation = gl.getUniformLocation(this.composite, \"uRow\");\n this.offsetLocation = gl.getUniformLocation(this.composite, \"uOffset\");\n this.flipLocation = gl.getUniformLocation(this.composite, \"uFlip\");\n this.backOffsetLocation = gl.getUniformLocation(this.composite, \"uBackOffset\");\n this.rectLocation = gl.getUniformLocation(this.composite, \"uRect\");\n this.back = null;\n this.backFramebuffer = null;\n this.backWidth = 0;\n this.backHeight = 0;\n }\n /**\n * `open` composited onto `under`, bound, in blend mode `mode`, coloured by\n * row `row` (or -1), over its rectangle alone: through GL's blending where\n * it computes Flash's blend, else from a copy of what is below there, the\n * result replacing it. Its rectangle is cut to `under`'s, as a filtered\n * one may reach past the canvas; in `under`'s framebuffer its rows run\n * up on the canvas and down in a layer.\n */\n compositeLayer(open, under, given, row) {\n const gl = this.gl;\n // A blend shader that will not link, of too many images, or with an image gone, composites as\n // normal.\n const kernel = given >= KERNEL ? this.useKernel(given - KERNEL) : null;\n const mode = given >= KERNEL && !kernel ? NORMAL : given;\n const state = this.state;\n const reads = readsBelow(mode, under.opaque);\n if (!this.cover(open, under) || (reads && !this.copyBelow(under))) {\n return;\n }\n const { dx, dy, x0, y0, width, height, fx, fy, backX, backY } = this.place;\n const flip = !under.layer;\n state.bindTexture(LAYER_UNIT, open.layer.texture);\n state.bindSampler(LAYER_UNIT, null);\n state.bindSampler(BACK_UNIT, null);\n state.bindVertexArray(null);\n // Less its corner on its page, where it is a held layer's rectangle of one (HELD), and past\n // the target's, where that is one.\n const ox = (under.ox ?? 0) - (open.ox ?? 0);\n const oy = (under.oy ?? 0) - (open.oy ?? 0);\n const offsetY = flip ? under.height - 1 - dy - oy : dy + oy;\n if (kernel) {\n const filters = this.host.filters();\n const entry = filters.chains[mode - KERNEL];\n state.useProgram(kernel.program);\n gl.uniform1i(kernel.at(\"uRow\"), row);\n gl.uniform2i(kernel.at(\"uOffset\"), dx + ox, offsetY);\n gl.uniform1i(kernel.at(\"uFlip\"), flip ? 1 : 0);\n gl.uniform2i(kernel.at(\"uBackOffset\"), backX, backY);\n gl.uniform1i(kernel.at(\"uWhole\"), filters.values[filters.start[entry]]);\n this.kernels.setUniforms(kernel, filters, entry, this.host);\n }\n else {\n state.useProgram(this.composite);\n // Its pixel alone where GL's blending computes the mode (MULTIPLY over an opaque target).\n gl.uniform1i(this.modeLocation, reads ? mode : NORMAL);\n gl.uniform1i(this.compositeRowLocation, row);\n gl.uniform2i(this.offsetLocation, dx + ox, offsetY);\n gl.uniform1i(this.flipLocation, flip ? 1 : 0);\n gl.uniform2i(this.backOffsetLocation, backX, backY);\n }\n setModeBlend(gl, state, reads ? -1 : mode);\n // Over the rectangle alone, in the target's clip space; the scissor keeps it to whole pixels.\n const tw = under.width;\n const th = under.height;\n gl.uniform4f(kernel ? kernel.at(\"uRect\") : this.rectLocation, (2 * x0) / tw - 1, (2 * y0) / th - 1, (2 * (x0 + width)) / tw - 1, (2 * (y0 + height)) / th - 1);\n state.scissor([fx, fy, width, height]);\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n state.scissor(null);\n }\n /** Where cover last found a rectangle on its target, and where copyBelow copied what is below it. */\n place = {\n dx: 0,\n dy: 0,\n x0: 0,\n y0: 0,\n width: 0,\n height: 0,\n fx: 0,\n fy: 0,\n backX: 0,\n backY: 0,\n };\n /**\n * Where `rect` lies on `under`, into place: cut to `under`'s, as a\n * filtered layer may reach past the canvas; in `under`'s framebuffer its\n * rows run up on the canvas and down in a layer. Whether any of it does.\n */\n cover(rect, under) {\n const place = this.place;\n const dx = rect.x - under.x;\n const dy = rect.y - under.y;\n const y = under.layer ? dy : under.height - dy - rect.height;\n place.dx = dx;\n place.dy = dy;\n place.x0 = Math.max(0, dx);\n place.y0 = Math.max(0, y);\n place.width = Math.min(under.width, dx + rect.width) - place.x0;\n place.height = Math.min(under.height, y + rect.height) - place.y0;\n // The rectangle's corner in the target's framebuffer, where the target is a held layer's\n // rectangle of a page (HOLD_PUSH).\n place.fx = place.x0 + (under.ox ?? 0);\n place.fy = place.y0 + (under.oy ?? 0);\n // Where the copy of what is below has the rectangle's corner, less where the target has it.\n place.backX = 0;\n place.backY = 0;\n return place.width > 0 && place.height > 0;\n }\n /**\n * What is below the rectangle cover found copied, for a blend that reads\n * it: bound to BACK_UNIT, where the copy has the rectangle's corner, less\n * where the target has it, into place, and `under`'s framebuffer bound again.\n */\n copyBelow(under) {\n const gl = this.gl;\n const state = this.state;\n const { fx, fy, width, height } = this.place;\n // Out of a multisampled page, its rectangle resolved into the page's own texture first, which\n // a blit may then copy anywhere: copied where it lies, the copy would stay as large as the\n // page's far corner.\n let from = framebufferOf(under);\n const paged = under.msaa !== null && under.layer !== null && under.ox !== undefined;\n if (paged) {\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, from);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, under.layer.framebuffer);\n gl.blitFramebuffer(fx, fy, fx + width, fy + height, fx, fy, fx + width, fy + height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n from = under.layer.framebuffer;\n }\n // Copied from its corner, or out of a multisampled target to where it lies, as a blit\n // resolving must keep its rectangle: then as large as the rectangle's far corner.\n const bx = under.msaa && !paged ? fx : 0;\n const by = under.msaa && !paged ? fy : 0;\n this.place.backX = fx - bx;\n this.place.backY = fy - by;\n const right = bx + width;\n const top = by + height;\n if (!this.back || this.backWidth < right || this.backHeight < top) {\n if (this.back) {\n state.dropTexture(this.back);\n gl.deleteTexture(this.back);\n gl.deleteFramebuffer(this.backFramebuffer);\n this.backFramebuffer = null;\n }\n this.back = gl.createTexture();\n this.backWidth = Math.max(this.backWidth, Math.ceil(right / LAYER_STEP) * LAYER_STEP);\n this.backHeight = Math.max(this.backHeight, Math.ceil(top / LAYER_STEP) * LAYER_STEP);\n state.bindTexture(BACK_UNIT, this.back);\n state.activeTexture(BACK_UNIT);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, this.backWidth, this.backHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n }\n // Blitted, not copied: the canvas' colour may have no alpha, which copyTexSubImage2D into an\n // RGBA texture refuses, where a blit fills it in.\n // Out of a multisampled target the blit resolves the rectangle alone.\n if (!this.backFramebuffer) {\n this.backFramebuffer = gl.createFramebuffer();\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, this.backFramebuffer);\n gl.framebufferTexture2D(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.back, 0);\n }\n else {\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, this.backFramebuffer);\n }\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, from);\n gl.blitFramebuffer(fx, fy, fx + width, fy + height, bx, by, right, top, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n // Both bindings back as the state cache has them.\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebufferOf(under));\n state.bindTexture(BACK_UNIT, this.back);\n state.bindSampler(BACK_UNIT, null);\n return true;\n }\n /**\n * The program of the blend shader of chain `chain` of the frame's\n * filters (KernelPrograms), in use; null for none, one that would not\n * link, one of more images than a program binds, or one whose image is gone.\n */\n useKernel(chain) {\n const filters = this.host.filters();\n if (!filters || chain >= filters.chainCount) {\n return null;\n }\n const i = filters.chains[chain];\n const source = filters.kernels[i];\n const images = source && filters.kind[i] === BLEND ? this.kernels.readImages(filters, i, this.host) : null;\n if (!source || !images || !kernelImagesFit(images)) {\n return null;\n }\n return this.kernels.use(compositeVertex, blendKernel(source, images, LAYER_COLOR), (program) => {\n const gl = this.gl;\n gl.uniform1i(gl.getUniformLocation(program, \"uLayer\"), LAYER_UNIT);\n gl.uniform1i(gl.getUniformLocation(program, \"uBack\"), BACK_UNIT);\n gl.uniform1i(gl.getUniformLocation(program, \"uRows\"), 0);\n });\n }\n /** The program and the copy made on the context, deleted. */\n destroy() {\n const gl = this.gl;\n gl.deleteProgram(this.composite);\n if (this.back) {\n gl.deleteTexture(this.back);\n gl.deleteFramebuffer(this.backFramebuffer);\n }\n }\n}\n//# sourceMappingURL=composite.js.map","import { linkProgram } from \"@swf2es/context3d/device\";\nimport { RUN, STENCIL_POP, STENCIL_PUSH } from \"../commands.js\";\nimport { FILL_SHADER } from \"../filters.js\";\nimport { fillKernel, kernelImagesFit } from \"../kernel-shaders.js\";\nimport { CLAMP, DRAW, MESH, MIRROR, NORMAL, PLANE, REPEAT, SHADED, SMOOTH, SNAP, } from \"../scene.js\";\nimport { setModeBlend } from \"./composite.js\";\nimport { BACK_UNIT, blendFillFragment, FILL_SLOT, FILL_TEXTURES, FILL_UNIT, fillFragment, fillVertex, glyphsFragment, glyphsVertex, meshFragment, meshVertex, OUTLINE_UNIT, RUN_MOST, RUN_UNIT, SNAP_BIT, TEXTURE_UNIT, } from \"./programs.js\";\nimport { framebufferOf } from \"./targets.js\";\n/** Last scene entry, table start, draw count, used units, then each unit's texture and sampling. */\nconst RUN_STRIDE = 4 + FILL_TEXTURES * 2;\n/** The most masks the stencil's eight bits count. */\nconst STENCIL_MOST = 255;\n/**\n * The draws of a scene list's entries into the target bound: fills in runs,\n * one multi-draw of the atlas's index ranges a run where WEBGL_multi_draw\n * is, meshes and advanced text's glyphs each by a program of its own, and\n * the masks' coverage into the stencil; and the view of the target drawn\n * into, which each program is told.\n */\nexport class Draws {\n host;\n kernels;\n gl;\n state;\n atlas;\n gpu;\n pool;\n /** The fill program, and where it takes its row, view and Flash's pixels a stage pixel. */\n program;\n rowLocation = null;\n viewLocation = null;\n fillUnitLocation = null;\n /**\n * The fill program that blends a fill straight onto what is below it\n * (drawBlended), a draw a call, and where it takes what the fill program\n * does and the blend's mode, its layer's row and where the copy of what\n * is below lies.\n */\n blendProgram;\n blendRowLocation = null;\n blendViewLocation = null;\n blendUnitLocation = null;\n blendModeLocation = null;\n blendLayerRowLocation = null;\n blendBackLocation = null;\n /** WEBGL_multi_draw, which draws a run of fills alike a call (drawEntries), where there is. */\n multi = null;\n /** Avoid the dynamically indexed uniform table used in the Intel GPU hang reproducer. */\n runTable = null;\n runBaseLocation = null;\n runTableHeight = 0;\n runTableMost = 0;\n tableRows = new Int32Array(RUN_MOST);\n tableCounts = new Int32Array(RUN_MOST);\n tableOffsets = new Int32Array(RUN_MOST);\n runs = new Int32Array(RUN_STRIDE * 256);\n commandStarts = new Uint32Array(256);\n prepared = false;\n /** A run's draws: their index counts, their offsets in bytes, and their rows (FILL_SLOT). */\n runCounts = new Int32Array(RUN_MOST);\n runOffsets = new Int32Array(RUN_MOST);\n runRows = new Int32Array(RUN_MOST);\n /** Draws gathered by gatherRun, and the fill units they sample, a bit each. */\n runCount = 0;\n runUnits = 0;\n /**\n * The texture and sampling each fill unit was last given (runSlot), -1 for\n * none, and the unit to take next when every one holds a texture.\n */\n unitIds = new Int32Array(FILL_TEXTURES).fill(-1);\n unitSampling = new Int32Array(FILL_TEXTURES);\n unitNext = 0;\n /** The meshes' program (MESH), and where it takes its row, view, fragments' place and mode. */\n mesh;\n meshRowLocation = null;\n meshViewLocation = null;\n meshFragLocation = null;\n meshModeLocation = null;\n /**\n * The view the target drawn into gives the fill program, and where its\n * fragments lie from the stage's origin (meshFragment's uFrag): told the\n * mesh program as it next draws a mesh, once they change (meshStale).\n */\n view = new Float32Array(4);\n frag = new Float32Array(4);\n meshStale = true;\n /** The row and mode (REPEAT, SMOOTH) the mesh program was told last, -1 for none. */\n meshRow = -1;\n meshMode = -1;\n /**\n * Advanced text's program (GeometryData.glyphs), where it takes its row, view, Flash's\n * pixels a stage pixel, mode and table; its vertices are in an atlas of their own.\n */\n glyphProgram;\n glyphRowLocation = null;\n glyphViewLocation = null;\n glyphUnitLocation = null;\n glyphModeLocation = null;\n glyphTableLocation = null;\n glyphStale = true;\n /** Flash's pixels a stage pixel: the target's pixels a stage pixel over those a pixel of Flash's. */\n unit = 1;\n /**\n * The row a fill drawn alone (without WEBGL_multi_draw) last told the fill\n * program, so that it is not told again; -1 for none (forgetRow).\n */\n lastRow = -1;\n /** Each shader fill's fragment shader by its entry in the frame's filters, for the generation it is of. */\n fillShaders = new Map();\n /** A shader fill's program as it is linked: its rows' unit. */\n prepareFill = (program) => {\n this.gl.uniform1i(this.gl.getUniformLocation(program, \"uRows\"), 0);\n };\n fillFilters = null;\n fillGeneration = -1;\n constructor(gl, state, atlas, gpu, pool, \n /** Where shader fills find the frame's filters, whose chains their draws name (SHADED). */\n host, \n /** Shader fills' programs, the backend's one cache of kernels'. */\n kernels) {\n this.host = host;\n this.kernels = kernels;\n this.gl = gl;\n this.state = state;\n this.atlas = atlas;\n this.gpu = gpu;\n this.pool = pool;\n }\n /** The fill, mesh and glyph programs made, as the context comes or comes back. */\n setUp(textureMost) {\n const gl = this.gl;\n this.multi = gl.getExtension(\"WEBGL_multi_draw\");\n try {\n this.program = linkProgram(gl, fillVertex(this.multi !== null), fillFragment);\n }\n catch (e) {\n if (!this.multi) {\n throw e;\n }\n // An extension offered whose shader directive the compiler refuses: a call a draw.\n this.multi = null;\n this.program = linkProgram(gl, fillVertex(false), fillFragment);\n }\n this.unitIds.fill(-1);\n this.rowLocation = gl.getUniformLocation(this.program, \"uRow\");\n this.viewLocation = gl.getUniformLocation(this.program, \"uView\");\n this.state.useProgram(this.program);\n gl.uniform1i(gl.getUniformLocation(this.program, \"uRows\"), 0);\n gl.uniform1iv(gl.getUniformLocation(this.program, \"uTextures\"), Array.from({ length: FILL_TEXTURES }, (_, k) => FILL_UNIT + k));\n this.runTable = null;\n this.runTableHeight = 0;\n this.runTableMost = textureMost;\n this.prepared = false;\n this.runBaseLocation = gl.getUniformLocation(this.program, \"uRunBase\");\n if (this.multi) {\n this.sizeRunTable(1);\n gl.uniform1i(gl.getUniformLocation(this.program, \"uRunTable\"), RUN_UNIT);\n }\n this.fillUnitLocation = gl.getUniformLocation(this.program, \"uUnit\");\n this.blendProgram = linkProgram(gl, fillVertex(false), blendFillFragment);\n this.blendRowLocation = gl.getUniformLocation(this.blendProgram, \"uRow\");\n this.blendViewLocation = gl.getUniformLocation(this.blendProgram, \"uView\");\n this.blendUnitLocation = gl.getUniformLocation(this.blendProgram, \"uUnit\");\n this.blendModeLocation = gl.getUniformLocation(this.blendProgram, \"uMode\");\n this.blendLayerRowLocation = gl.getUniformLocation(this.blendProgram, \"uLayerRow\");\n this.blendBackLocation = gl.getUniformLocation(this.blendProgram, \"uBackOffset\");\n this.state.useProgram(this.blendProgram);\n gl.uniform1i(gl.getUniformLocation(this.blendProgram, \"uRows\"), 0);\n gl.uniform1i(gl.getUniformLocation(this.blendProgram, \"uBack\"), BACK_UNIT);\n gl.uniform1iv(gl.getUniformLocation(this.blendProgram, \"uTextures\"), Array.from({ length: FILL_TEXTURES }, (_, k) => FILL_UNIT + k));\n this.mesh = linkProgram(gl, meshVertex, meshFragment);\n this.meshRowLocation = gl.getUniformLocation(this.mesh, \"uRow\");\n this.meshViewLocation = gl.getUniformLocation(this.mesh, \"uView\");\n this.meshFragLocation = gl.getUniformLocation(this.mesh, \"uFrag\");\n this.meshModeLocation = gl.getUniformLocation(this.mesh, \"uMode\");\n this.state.useProgram(this.mesh);\n gl.uniform1i(gl.getUniformLocation(this.mesh, \"uRows\"), 0);\n gl.uniform1i(gl.getUniformLocation(this.mesh, \"uTexture\"), TEXTURE_UNIT);\n this.meshStale = true;\n this.meshRow = -1;\n this.meshMode = -1;\n this.glyphProgram = linkProgram(gl, glyphsVertex, glyphsFragment);\n this.glyphRowLocation = gl.getUniformLocation(this.glyphProgram, \"uRow\");\n this.glyphViewLocation = gl.getUniformLocation(this.glyphProgram, \"uView\");\n this.glyphUnitLocation = gl.getUniformLocation(this.glyphProgram, \"uUnit\");\n this.glyphModeLocation = gl.getUniformLocation(this.glyphProgram, \"uMode\");\n this.glyphTableLocation = gl.getUniformLocation(this.glyphProgram, \"uTable\");\n this.state.useProgram(this.glyphProgram);\n gl.uniform1i(gl.getUniformLocation(this.glyphProgram, \"uRows\"), 0);\n gl.uniform1i(gl.getUniformLocation(this.glyphProgram, \"uSegments\"), OUTLINE_UNIT);\n this.glyphStale = true;\n this.lastRow = -1;\n }\n /** Upload before any draws, so that updating a run cannot stall earlier draws reading it. */\n prepare(commands, scene) {\n this.prepared = false;\n if (!this.multi) {\n return;\n }\n if (commands.length > this.commandStarts.length) {\n this.commandStarts = new Uint32Array(commands.ops.length / 4);\n }\n let count = 0;\n let run = 0;\n const ops = commands.ops;\n for (let k = 0; k < commands.length; k++) {\n const at = k * 4;\n const op = ops[at];\n if (op !== RUN && op !== STENCIL_PUSH && op !== STENCIL_POP) {\n continue;\n }\n const stencil = op !== RUN;\n const end = ops[at + 1] + ops[at + 2];\n this.commandStarts[k] = run;\n // Held layers execute in a different order. Save each run's bindings independently\n // of the commands executed before it.\n this.unitIds.fill(-1);\n this.unitNext = 0;\n for (let i = ops[at + 1]; i < end; i++) {\n if (scene.kind[i] !== DRAW) {\n continue;\n }\n const place = this.atlas.places[scene.geometry[i]];\n if (!place || place.glyphs || (!stencil && scene.sampler[i] & (MESH | PLANE | SHADED))) {\n continue;\n }\n i = this.gatherRun(scene, i, end, stencil);\n const needed = count + this.runCount;\n if (needed > RUN_MOST * this.runTableMost) {\n // An unusually large frame still draws by updating the first row a run at a time.\n return;\n }\n if (needed > this.tableRows.length) {\n const size = Math.min(RUN_MOST * this.runTableMost, Math.max(needed, this.tableRows.length * 2));\n const rows = new Int32Array(size);\n rows.set(this.tableRows);\n this.tableRows = rows;\n const counts = new Int32Array(size);\n counts.set(this.tableCounts);\n this.tableCounts = counts;\n const offsets = new Int32Array(size);\n offsets.set(this.tableOffsets);\n this.tableOffsets = offsets;\n }\n if (run + RUN_STRIDE > this.runs.length) {\n const runs = new Int32Array(this.runs.length * 2);\n runs.set(this.runs);\n this.runs = runs;\n }\n this.runs[run] = i;\n this.runs[run + 1] = count;\n this.runs[run + 2] = this.runCount;\n this.runs[run + 3] = this.runUnits;\n for (let j = 0; j < FILL_TEXTURES; j++) {\n if (this.runUnits & (1 << j)) {\n this.runs[run + 4 + j * 2] = this.unitIds[j];\n this.runs[run + 5 + j * 2] = this.unitSampling[j];\n }\n }\n run += RUN_STRIDE;\n for (let j = 0; j < this.runCount; j++) {\n this.tableRows[count] = this.runRows[j];\n this.tableCounts[count] = this.runCounts[j];\n this.tableOffsets[count++] = this.runOffsets[j];\n }\n }\n }\n const height = Math.ceil(count / RUN_MOST);\n if (height > 0) {\n this.sizeRunTable(height);\n const gl = this.gl;\n this.state.bindTexture(RUN_UNIT, this.runTable);\n this.state.activeTexture(RUN_UNIT);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, RUN_MOST, height, gl.RED_INTEGER, gl.INT, this.tableRows);\n }\n this.prepared = true;\n }\n sizeRunTable(height) {\n if (height <= this.runTableHeight) {\n return;\n }\n const gl = this.gl;\n if (this.runTable) {\n this.state.dropTexture(this.runTable);\n gl.deleteTexture(this.runTable);\n }\n this.runTableHeight = Math.min(this.runTableMost, Math.max(height, this.runTableHeight * 2));\n this.runTable = gl.createTexture();\n this.state.bindTexture(RUN_UNIT, this.runTable);\n this.state.activeTexture(RUN_UNIT);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R32I, RUN_MOST, this.runTableHeight);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n }\n /**\n * Draw into `open` from here on: its framebuffer bound, its viewport its\n * rectangle's size, and the stage placed on it as on the canvas, its\n * rectangle's corner the origin, its rows running up on the canvas and\n * down in a layer. The fill program takes the view.\n */\n drawInto(open, target) {\n const gl = this.gl;\n const state = this.state;\n const ox = open.ox ?? 0;\n const oy = open.oy ?? 0;\n state.bindFramebuffer(framebufferOf(open));\n state.viewport(ox, oy, open.width, open.height);\n state.useProgram(this.program);\n const down = open.layer ? 1 : -1;\n const view = this.view;\n view[0] = (2 * target.scale) / open.width;\n view[1] = (down * 2 * target.scale) / open.height;\n view[2] = -1 + (2 * (target.x - open.x)) / open.width;\n view[3] = -down * (1 - (2 * (target.y - open.y)) / open.height);\n gl.uniform4fv(this.viewLocation, view);\n // A layer's rows run down from its corner; the canvas' up from its bottom.\n const frag = this.frag;\n frag[0] = open.x - target.x - ox;\n frag[1] = (open.layer ? open.y : open.y + open.height) - target.y - oy;\n frag[2] = down;\n frag[3] = target.pixel;\n this.unit = target.scale / target.pixel;\n gl.uniform1f(this.fillUnitLocation, this.unit);\n this.meshStale = true;\n this.glyphStale = true;\n }\n /** The row the fill program was told forgotten, so that the next fill tells it again. */\n forgetRow() {\n this.lastRow = -1;\n }\n /** The fill program, its vertex array and rows bound, as runs and masks draw with them. */\n useFill() {\n this.state.useProgram(this.program);\n this.state.bindVertexArray(this.atlas.vertexArray);\n this.state.bindTexture(0, this.gpu.rowsTexture);\n }\n /** Entries `first` up to `end` drawn as fills, where the masks pushed pass. */\n drawRun(scene, first, end, command) {\n const gl = this.gl;\n // Premultiplied, as every blend mode will be.\n this.useFill();\n this.state.setBlend(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n this.drawEntries(scene, first, end, false, command);\n }\n /**\n * Whether entry `i` is a flat fill (GeometryData.flat), a bitmap's quad or\n * one fill of a shape, of no mesh, shader fill or text, whose texture, if\n * it samples one, is there. Drawn straight onto what is below in a blend\n * mode, it is as its layer would be composited, as no part of it is over\n * another.\n */\n blendable(scene, i) {\n if (scene.kind[i] !== DRAW || scene.sampler[i] & (MESH | PLANE | SHADED)) {\n return false;\n }\n const place = this.atlas.places[scene.geometry[i]];\n const id = scene.texture[i];\n return !!place && place.flat && !place.glyphs && (id < 0 || !!this.gpu.textures[id]);\n }\n /**\n * Entry `i`, blendable, drawn onto the target bound in blend mode `mode`,\n * coloured by its layer's row `layerRow` (or -1), where the masks pushed\n * pass: GL's blending computing add, screen and, where it does not\n * `reads` below, multiply, the program the rest from the copy of what is\n * below (Compositor.copyBelow), whose texel at a fragment is (`backX`,\n * `backY`) short of it.\n */\n drawBlended(scene, i, mode, reads, layerRow, backX, backY) {\n const gl = this.gl;\n const state = this.state;\n state.useProgram(this.blendProgram);\n state.bindVertexArray(this.atlas.vertexArray);\n state.bindTexture(0, this.gpu.rowsTexture);\n gl.uniform4fv(this.blendViewLocation, this.view);\n gl.uniform1f(this.blendUnitLocation, this.unit);\n // Its pixel alone where GL's blending computes the mode (readsBelow).\n gl.uniform1i(this.blendModeLocation, reads ? mode : NORMAL);\n gl.uniform1i(this.blendLayerRowLocation, layerRow);\n gl.uniform2i(this.blendBackLocation, backX, backY);\n this.gatherRun(scene, i, i + 1, false);\n if (this.runCount === 0) {\n return;\n }\n for (let k = 0; k < FILL_TEXTURES; k++) {\n if (this.runUnits & (1 << k)) {\n state.bindTexture(FILL_UNIT + k, this.gpu.textures[this.unitIds[k]]);\n state.bindSampler(FILL_UNIT + k, this.gpu.sampler(this.unitSampling[k]));\n }\n }\n gl.uniform1i(this.blendRowLocation, this.runRows[0]);\n setModeBlend(gl, state, reads ? -1 : mode);\n gl.drawElements(gl.TRIANGLES, this.runCounts[0], gl.UNSIGNED_INT, this.runOffsets[0]);\n }\n /**\n * Entries `first` up to `end`, a mask, pushed onto `masks` (STENCIL_PUSH)\n * or popped off them (STENCIL_POP), left out past STENCIL_MOST: its\n * coverage, once a pixel however its fills overlap, counted up into the\n * stencil where the masks pushed before it pass, and back down where it\n * and they did.\n */\n drawMask(scene, first, end, push, masks, command) {\n if (push ? masks.depth >= STENCIL_MOST || masks.past > 0 : masks.past > 0) {\n masks.past += push ? 1 : -1;\n return;\n }\n const gl = this.gl;\n const state = this.state;\n this.useFill();\n state.colorMask(0);\n state.stencil(gl.EQUAL, masks.depth, push ? gl.INCR : gl.DECR);\n this.drawEntries(scene, first, end, true, command);\n masks.depth += push ? 1 : -1;\n state.colorMask(15);\n this.maskBy(masks);\n }\n /** What is drawn from here on kept to where `masks` pass, by the stencil. */\n maskBy(masks) {\n const gl = this.gl;\n this.state.stencil(masks.depth > 0 ? gl.EQUAL : null, masks.depth, gl.KEEP);\n }\n /** The draws at `scene`'s entries from `first` up to `end`; for the stencil alone, untextured. */\n drawEntries(scene, first, end, stencil, command) {\n const gl = this.gl;\n const state = this.state;\n const places = this.atlas.places;\n let run = this.prepared ? this.commandStarts[command] : 0;\n // Whether the mesh or the glyph program is in use, till the next entry of neither.\n let other = false;\n for (let i = first; i < end; i++) {\n if (scene.kind[i] !== DRAW) {\n continue;\n }\n const place = places[scene.geometry[i]];\n if (!place) {\n continue;\n }\n // A mesh by the mesh program; in a mask, its triangles' coverage as a fill's. Glyphs by the\n // glyph program, in a mask too, which covers their shapes alone.\n if (place.glyphs) {\n this.drawGlyphs(scene, i, place);\n other = true;\n continue;\n }\n if (!stencil && scene.sampler[i] & (MESH | PLANE)) {\n other = this.drawMesh(scene, i, place) || other;\n continue;\n }\n if (!stencil && scene.sampler[i] & SHADED) {\n other = this.drawShaded(scene, i, place) || other;\n continue;\n }\n if (other) {\n this.useFill();\n other = false;\n }\n let base = 0;\n let draws;\n let units;\n const bindings = run + 4;\n if (this.prepared) {\n i = this.runs[run];\n base = this.runs[run + 1];\n draws = this.runs[run + 2];\n units = this.runs[run + 3];\n run += RUN_STRIDE;\n }\n else {\n i = this.gatherRun(scene, i, end, stencil);\n draws = this.runCount;\n units = this.runUnits;\n }\n if (draws === 0) {\n continue;\n }\n for (let k = 0; k < FILL_TEXTURES; k++) {\n if (units & (1 << k)) {\n const id = this.prepared ? this.runs[bindings + k * 2] : this.unitIds[k];\n const sampling = this.prepared ? this.runs[bindings + k * 2 + 1] : this.unitSampling[k];\n state.bindTexture(FILL_UNIT + k, this.gpu.textures[id]);\n state.bindSampler(FILL_UNIT + k, this.gpu.sampler(sampling));\n }\n }\n if (!this.multi) {\n if (this.runRows[0] !== this.lastRow) {\n this.lastRow = this.runRows[0];\n gl.uniform1i(this.rowLocation, this.lastRow);\n }\n gl.drawElements(gl.TRIANGLES, this.runCounts[0], gl.UNSIGNED_INT, this.runOffsets[0]);\n continue;\n }\n state.bindTexture(RUN_UNIT, this.runTable);\n state.bindSampler(RUN_UNIT, null);\n if (!this.prepared) {\n state.activeTexture(RUN_UNIT);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, draws, 1, gl.RED_INTEGER, gl.INT, this.runRows);\n }\n gl.uniform1i(this.runBaseLocation, base);\n this.multi.multiDrawElementsWEBGL(gl.TRIANGLES, this.prepared ? this.tableCounts : this.runCounts, base, gl.UNSIGNED_INT, this.prepared ? this.tableOffsets : this.runOffsets, base, draws);\n }\n if (other) {\n this.useFill();\n }\n }\n /**\n * The fills from entry `i` on that one call draws, as many as fit its\n * textures (FILL_TEXTURES, each with its sampling) and, without\n * WEBGL_multi_draw, one: their runCounts, runOffsets and runRows (FILL_SLOT),\n * and the units their textures take in runUnits. The last entry gathered,\n * past those whose texture is gone, which draw nothing.\n */\n gatherRun(scene, i, end, stencil) {\n const places = this.atlas.places;\n const textures = this.gpu.textures;\n const most = this.multi ? RUN_MOST : 1;\n let draws = 0;\n let last = i;\n this.runUnits = 0;\n for (let j = i; j < end && draws < most; j++) {\n if (scene.kind[j] !== DRAW) {\n continue;\n }\n const place = places[scene.geometry[j]];\n if (!place) {\n continue;\n }\n if (place.glyphs || (!stencil && scene.sampler[j] & (MESH | PLANE | SHADED))) {\n break;\n }\n const id = stencil ? -1 : scene.texture[j];\n let slot = 0;\n if (id >= 0) {\n if (!textures[id]) {\n last = j;\n continue;\n }\n const sampling = scene.sampler[j] & (SMOOTH | REPEAT | MIRROR);\n slot = this.runSlot(id, sampling);\n if (slot === 0) {\n break;\n }\n }\n this.runCounts[draws] = place.indices;\n this.runOffsets[draws] = place.indexStart * 4;\n this.runRows[draws] =\n scene.row[j] | (slot << FILL_SLOT) | (scene.sampler[j] & SNAP ? SNAP_BIT : 0);\n draws++;\n last = j;\n }\n this.runCount = draws;\n return last;\n }\n /**\n * The slot (FILL_SLOT) of the unit texture `id` is sampled from so in the\n * run: the one it was left on, else one the run has not taken, an empty\n * one first, so that a texture stays where it is from run to run; 0 when\n * the run has taken all.\n */\n runSlot(id, sampling) {\n for (let k = 0; k < FILL_TEXTURES; k++) {\n if (this.unitIds[k] === id && this.unitSampling[k] === sampling) {\n this.runUnits |= 1 << k;\n return k + 1;\n }\n }\n let free = -1;\n for (let n = 0; n < FILL_TEXTURES; n++) {\n const k = (this.unitNext + n) % FILL_TEXTURES;\n if (!(this.runUnits & (1 << k)) && (free < 0 || this.unitIds[k] < 0)) {\n free = k;\n if (this.unitIds[k] < 0) {\n break;\n }\n }\n }\n if (free < 0) {\n return 0;\n }\n this.unitIds[free] = id;\n this.unitSampling[free] = sampling;\n this.unitNext = (free + 1) % FILL_TEXTURES;\n this.runUnits |= 1 << free;\n return free + 1;\n }\n /**\n * Entry `i`, advanced text's glyph quads (GeometryData.glyphs), drawn by the glyph\n * program from its atlas, which is told the view as it changed, and its\n * text's mode and table; the glyph program left in use.\n */\n drawGlyphs(scene, i, place) {\n const gl = this.gl;\n const state = this.state;\n const glyphs = place.glyphs;\n state.useProgram(this.glyphProgram);\n state.bindVertexArray(this.atlas.glyphArray);\n if (this.glyphStale) {\n gl.uniform4fv(this.glyphViewLocation, this.view);\n gl.uniform1f(this.glyphUnitLocation, this.unit);\n this.glyphStale = false;\n }\n gl.uniform1i(this.glyphRowLocation, scene.row[i]);\n gl.uniform4fv(this.glyphModeLocation, glyphs.mode);\n gl.uniform4fv(this.glyphTableLocation, glyphs.table);\n state.bindTexture(OUTLINE_UNIT, this.gpu.outlines);\n state.bindSampler(OUTLINE_UNIT, null);\n gl.drawElements(gl.TRIANGLES, place.indices, gl.UNSIGNED_INT, place.indexStart * 4);\n }\n /**\n * Entry `i`, a mesh (MESH), drawn by the mesh program, which is told the\n * view as it changed, and its row and mode as they change; whether it\n * was drawn, the mesh program left in use.\n */\n drawMesh(scene, i, place) {\n const id = scene.texture[i];\n const plane = (scene.sampler[i] & PLANE) !== 0;\n const texture = id < 0\n ? null\n : plane\n ? (this.pool.keptLayer(id)?.texture ?? null)\n : (this.gpu.textures[id] ?? null);\n if (!texture) {\n return false;\n }\n const gl = this.gl;\n const state = this.state;\n state.useProgram(this.mesh);\n // The atlas' vertices, which a glyph draw before may have left bound for its own.\n state.bindVertexArray(this.atlas.vertexArray);\n if (this.meshStale) {\n gl.uniform4fv(this.meshViewLocation, this.view);\n gl.uniform4fv(this.meshFragLocation, this.frag);\n this.meshStale = false;\n }\n const row = scene.row[i];\n if (row !== this.meshRow) {\n this.meshRow = row;\n gl.uniform1i(this.meshRowLocation, row);\n }\n const mode = scene.sampler[i] & (REPEAT | SMOOTH | PLANE);\n if (mode !== this.meshMode) {\n this.meshMode = mode;\n gl.uniform3i(this.meshModeLocation, mode & REPEAT ? 1 : 0, mode & SMOOTH ? 1 : 0, mode & PLANE ? 1 : 0);\n }\n state.bindTexture(TEXTURE_UNIT, texture);\n // A plane's bitmap smoothed; a mesh's read texel by texel, but through a sampler without\n // mipmaps, as a texture with none needs.\n state.bindSampler(TEXTURE_UNIT, this.gpu.sampler(plane ? SMOOTH | CLAMP : CLAMP));\n gl.drawElements(gl.TRIANGLES, place.indices, gl.UNSIGNED_INT, place.indexStart * 4);\n return true;\n }\n /**\n * Entry `i`, a shader fill (SHADED), drawn by its kernel's program, after\n * the mesh's vertex shader, told the view, its row and its kernel's\n * uniforms; whether it was drawn, its program left in use.\n */\n drawShaded(scene, i, place) {\n const filters = this.host.filters();\n const chain = scene.texture[i];\n if (!filters || chain < 0 || chain >= filters.chainCount) {\n return false;\n }\n // A kernel the GPU will not link, of more images than a program binds, or with an image\n // gone, fills nothing. Its shader is found once a frame for its entry; its program is the\n // cache's, linked again where another took its place.\n const entry = filters.chains[chain];\n const fragment = this.fillShader(filters, entry);\n const kernel = fragment ? this.kernels.use(meshVertex, fragment, this.prepareFill) : null;\n if (!kernel) {\n return false;\n }\n const gl = this.gl;\n this.state.bindVertexArray(this.atlas.vertexArray);\n gl.uniform4fv(kernel.at(\"uView\"), this.view);\n gl.uniform4fv(kernel.at(\"uFrag\"), this.frag);\n gl.uniform1i(kernel.at(\"uRow\"), scene.row[i]);\n this.kernels.setUniforms(kernel, filters, entry, this.host);\n // The mesh program is told its uniforms again after another program drew.\n this.meshStale = true;\n this.meshRow = -1;\n this.meshMode = -1;\n gl.drawElements(gl.TRIANGLES, place.indices, gl.UNSIGNED_INT, place.indexStart * 4);\n return true;\n }\n /** The fragment shader of the shader fill at entry `i` of `filters`, made once a frame; null for none. */\n fillShader(filters, i) {\n if (this.fillFilters !== filters || this.fillGeneration !== filters.generation) {\n this.fillShaders.clear();\n this.fillFilters = filters;\n this.fillGeneration = filters.generation;\n }\n let fragment = this.fillShaders.get(i);\n if (fragment === undefined) {\n const source = filters.kernels[i];\n const images = source && filters.kind[i] === FILL_SHADER\n ? this.kernels.readImages(filters, i, this.host)\n : null;\n fragment = source && images && kernelImagesFit(images) ? fillKernel(source, images) : null;\n this.fillShaders.set(i, fragment);\n }\n return fragment;\n }\n /** The programs and draw table made on the context, deleted. */\n destroy() {\n if (this.runTable) {\n this.state.dropTexture(this.runTable);\n this.gl.deleteTexture(this.runTable);\n this.runTable = null;\n }\n const gl = this.gl;\n gl.deleteProgram(this.program);\n gl.deleteProgram(this.mesh);\n gl.deleteProgram(this.glyphProgram);\n }\n}\n//# sourceMappingURL=draws.js.map","// A filtered layer's chain of Flash's filters as passes planned ahead of the\n// GPU: for each pass, its program, the targets it reads and draws into, by\n// slot, their frames, and its uniforms' values, as the backend's runner\n// (webgl/filters.ts) draws them. Pure, so that a frame's chains can be\n// planned all at once and their passes run in any order their slots allow.\nimport { BEVEL, BLUR, blurShrink, COLOR_MATRIX, CONVOLUTION, DISPLACEMENT, GLOW, GRADIENT, SHADER, } from \"./filters.js\";\nimport { filterKernel, kernelImagesFit, PIXELS_BACK, PIXELS_DOWN, } from \"./kernel-shaders.js\";\n/** The passes' programs, each a fragment shader of filter-shaders.ts. */\nexport const BOX_PASS = 1;\nexport const SHRINK_PASS = 2;\nexport const READ_BACK_PASS = 3;\nexport const GLOW_PASS = 4;\nexport const BEVEL_PASS = 5;\nexport const GRADIENT_PASS = 6;\nexport const MATRIX_PASS = 7;\nexport const CONVOLUTION_PASS = 8;\nexport const DISPLACE_PASS = 9;\n/** A Pixel Bender kernel's pass, its program FilterPass.kernel. */\nexport const KERNEL_PASS = 10;\n/**\n * How a uniform's values are set: one to four floats, an array of vec4s, a\n * 4 by 4 matrix, an array of ivec4s, or a sampler, its value the texture of\n * the frame's it reads.\n */\nexport const FLOATS = 1;\nexport const VEC4S = 2;\nexport const MATRIX4 = 3;\nexport const IVEC4S = 4;\nexport const SAMPLER = 5;\n/** A pass's blurred input (FilterPass.blurred): none read, or the pass's input itself. */\nexport const NO_BLUR = -2;\nexport const INPUT_BLUR = -1;\n/** The most floats a convolution's matrix takes in its shader: 57 vec4s. */\nconst CONVOLUTION_FLOATS = 57 * 4;\n/**\n * A chain's passes, its targets by slot, each a frame of a width and\n * height, slot 0 the layer it runs on, and the slot its output is left\n * in. Kept from chain to chain, its records reused.\n */\nexport class FilterPlan {\n passes = [];\n count = 0;\n slotWidth = [];\n slotHeight = [];\n slots = 0;\n result = 0;\n /** The target's pixels a unit of its own, which the shaders read their input's size in. */\n resolution = 1;\n /** The uniforms: each one's name, how it is set, where its values start and how many. */\n uniformName = [];\n uniformKind = [];\n uniformAt = [];\n uniformCount = [];\n uniforms = 0;\n values = new Float32Array(1024);\n valueCount = 0;\n /** The ints of the IVEC4S uniforms, which floats would round: their uniformAt is in here. */\n ints = new Int32Array(64);\n intCount = 0;\n /** Empty, for a chain run at `resolution` on a layer of `width` by `height`. */\n reset(width, height, resolution) {\n this.count = 0;\n this.slots = 0;\n this.uniforms = 0;\n this.valueCount = 0;\n this.intCount = 0;\n this.resolution = resolution;\n this.result = this.slot(width, height);\n }\n /** A new slot, a target of `width` by `height`. */\n slot(width, height) {\n this.slotWidth[this.slots] = width;\n this.slotHeight[this.slots] = height;\n return this.slots++;\n }\n /** A pass begun, its uniforms the ones set after it until the next. */\n pass(program, input, readWidth, readHeight, output, width, height) {\n let pass = this.passes[this.count];\n if (!pass) {\n pass = {\n program: 0,\n input: 0,\n readWidth: 0,\n readHeight: 0,\n output: 0,\n width: 0,\n height: 0,\n blurred: NO_BLUR,\n across: 1,\n down: 1,\n texture: -1,\n kernel: null,\n first: 0,\n end: 0,\n };\n this.passes[this.count] = pass;\n }\n this.count++;\n pass.program = program;\n pass.input = input;\n pass.readWidth = readWidth;\n pass.readHeight = readHeight;\n pass.output = output;\n pass.width = width;\n pass.height = height;\n pass.blurred = NO_BLUR;\n pass.across = 1;\n pass.down = 1;\n pass.texture = -1;\n pass.kernel = null;\n pass.first = this.uniforms;\n pass.end = this.uniforms;\n return pass;\n }\n /** A uniform of `count` floats of the pass begun last, `x` and those after. */\n uniform(name, count, x, y = 0, z = 0, w = 0) {\n const four = this.four;\n four[0] = x;\n four[1] = y;\n four[2] = z;\n four[3] = w;\n this.uniformFrom(name, FLOATS, four, 0, count);\n }\n /** uniform's values, passed on without an array of their own. */\n four = new Float64Array(4);\n /** A uniform of the pass begun last, set `kind` from `count` of `source` from `at`. */\n uniformFrom(name, kind, source, at, count) {\n const u = this.uniforms++;\n this.uniformName[u] = name;\n this.uniformKind[u] = kind;\n this.uniformAt[u] = this.valueCount;\n this.uniformCount[u] = count;\n if (this.valueCount + count > this.values.length) {\n const grown = new Float32Array(Math.max(this.values.length * 2, this.valueCount + count));\n grown.set(this.values);\n this.values = grown;\n }\n for (let k = 0; k < count; k++) {\n this.values[this.valueCount + k] = source[at + k];\n }\n this.valueCount += count;\n this.passes[this.count - 1].end = this.uniforms;\n }\n /** An array of ivec4s of the pass begun last, `count` ints of `source` from `at`. */\n uniformInts(name, source, at, count) {\n const u = this.uniforms++;\n this.uniformName[u] = name;\n this.uniformKind[u] = IVEC4S;\n this.uniformAt[u] = this.intCount;\n this.uniformCount[u] = count;\n if (this.intCount + count > this.ints.length) {\n const grown = new Int32Array(Math.max(this.ints.length * 2, this.intCount + count));\n grown.set(this.ints);\n this.ints = grown;\n }\n this.ints.set(source.subarray(at, at + count), this.intCount);\n this.intCount += count;\n this.passes[this.count - 1].end = this.uniforms;\n }\n}\n/**\n * Chain `chain` of `filters` planned into `plan` over a layer of `width` by\n * `height` texels at `resolution`, `hasTexture` telling which of the\n * frame's textures there are: a filter whose texture is not leaves its\n * input as it is, as one that changes nothing does; `links` whether a\n * kernel's pass's fragment shader links, as one that does not leaves it\n * too; `object` where the layer's object lies in it.\n */\nexport function planChain(plan, filters, chain, width, height, resolution, hasTexture, links = () => true, object = null) {\n plan.reset(width, height, resolution);\n const end = filters.chains[chain + 1];\n for (let i = filters.chains[chain]; i < end; i++) {\n plan.result =\n filters.kind[i] === SHADER\n ? shader(plan, filters, i, plan.result, width, height, hasTexture, links, object)\n : planFilter(plan, filters.kind[i], filters.values, filters.start[i], filters.texture[i], plan.result, width, height, hasTexture);\n }\n}\n/** One filter, its values from `v[at]`, over slot `input`: the slot it drew into, or `input`. */\nfunction planFilter(plan, kind, v, at, texture, input, width, height, hasTexture) {\n switch (kind) {\n case BLUR:\n return blurFilter(plan, v, at, input, width, height);\n case GLOW:\n return glow(plan, v, at, input, width, height);\n case BEVEL:\n return bevel(plan, v, at, input, width, height);\n case GRADIENT:\n return hasTexture(texture) ? gradient(plan, v, at, texture, input, width, height) : input;\n case COLOR_MATRIX:\n return colorMatrix(plan, v, at, input, width, height);\n case CONVOLUTION:\n return convolution(plan, v, at, input, width, height);\n case DISPLACEMENT:\n return hasTexture(texture) ? displacement(plan, v, at, texture, input, width, height) : input;\n default:\n return input;\n }\n}\n/** A blur: the box's runs, done coarser and drawn back between their texels where that is close enough. */\nfunction blurFilter(plan, v, at, input, width, height) {\n const blurX = v[at];\n const blurY = v[at + 1];\n const quality = v[at + 2];\n if (!(quality > 0 && (blurX > 1 || blurY > 1))) {\n return input;\n }\n const texels = plan.resolution * v[at + 3];\n const across = blurShrink(blurX, quality, 1, texels);\n const down = blurShrink(blurY, quality, 1, texels);\n if (across === 1 && down === 1) {\n const out = plan.slot(width, height);\n boxRuns(plan, input, width, height, out, blurX, blurY, quality, texels, texels);\n return out;\n }\n const blurred = blurredOf(plan, input, width, height, blurX, blurY, quality, texels, across, down);\n const out = plan.slot(width, height);\n readBlurred(plan.pass(READ_BACK_PASS, input, width, height, out, width, height), blurred);\n return out;\n}\n/** A glow or a drop shadow: the input's alpha blurred, coarser where close enough, in its colour. */\nfunction glow(plan, v, at, input, width, height) {\n const blurX = v[at];\n const blurY = v[at + 1];\n const quality = v[at + 2];\n const strength = v[at + 8];\n const texels = plan.resolution * v[at + 3];\n const across = blurShrink(blurX, quality, strength, texels);\n const down = blurShrink(blurY, quality, strength, texels);\n const blurred = blurredOf(plan, input, width, height, blurX, blurY, quality, texels, across, down);\n const out = plan.slot(width, height);\n readBlurred(plan.pass(GLOW_PASS, input, width, height, out, width, height), blurred);\n plan.uniformFrom(\"uColor\", FLOATS, v, at + 4, 3);\n plan.uniform(\"uAlpha\", 1, v[at + 7]);\n plan.uniform(\"uStrength\", 1, strength);\n plan.uniformFrom(\"uOffset\", FLOATS, v, at + 9, 2);\n plan.uniform(\"uInner\", 1, v[at + 11]);\n plan.uniform(\"uKnockout\", 1, v[at + 12]);\n plan.uniform(\"uHide\", 1, v[at + 13]);\n return out;\n}\n/** A bevel: the input's alpha blurred, read on and back by its offset. */\nfunction bevel(plan, v, at, input, width, height) {\n const texels = plan.resolution * v[at + 3];\n const blurred = blurredOf(plan, input, width, height, v[at], v[at + 1], v[at + 2], texels, 1, 1);\n const out = plan.slot(width, height);\n readBlurred(plan.pass(BEVEL_PASS, input, width, height, out, width, height), blurred);\n plan.uniformFrom(\"uHighlight\", FLOATS, v, at + 4, 3);\n plan.uniformFrom(\"uShadow\", FLOATS, v, at + 7, 3);\n plan.uniform(\"uHighlightAlpha\", 1, v[at + 10]);\n plan.uniform(\"uShadowAlpha\", 1, v[at + 11]);\n plan.uniform(\"uStrength\", 1, v[at + 12]);\n plan.uniformFrom(\"uOffset\", FLOATS, v, at + 13, 2);\n plan.uniform(\"uType\", 1, v[at + 15]);\n plan.uniform(\"uKnockout\", 1, v[at + 16]);\n return out;\n}\n/** A gradient glow or bevel: the blurred alpha picking a colour of its gradient, texture `id`. */\nfunction gradient(plan, v, at, id, input, width, height) {\n const units = v[at + 3];\n const texels = plan.resolution * units;\n const blurred = blurredOf(plan, input, width, height, v[at], v[at + 1], v[at + 2], texels, 1, 1);\n const out = plan.slot(width, height);\n const pass = plan.pass(GRADIENT_PASS, input, width, height, out, width, height);\n readBlurred(pass, blurred);\n pass.texture = id;\n plan.uniform(\"uStrength\", 1, v[at + 4]);\n plan.uniformFrom(\"uOffset\", FLOATS, v, at + 5, 2);\n plan.uniform(\"uType\", 1, v[at + 7]);\n plan.uniform(\"uKnockout\", 1, v[at + 8]);\n plan.uniform(\"uBevel\", 1, v[at + 9]);\n const inset = v[at + 10];\n plan.uniform(\"uRegion\", 4, inset - v[at + 11] * units, inset - v[at + 12] * units, width / plan.resolution - inset + units + v[at + 13] * units, height / plan.resolution - inset + units + v[at + 14] * units);\n return out;\n}\nfunction colorMatrix(plan, v, at, input, width, height) {\n const out = plan.slot(width, height);\n plan.pass(MATRIX_PASS, input, width, height, out, width, height);\n plan.uniformFrom(\"uMatrix\", MATRIX4, v, at, 16);\n plan.uniformFrom(\"uOffset\", FLOATS, v, at + 16, 4);\n return out;\n}\n/** A convolution's weights, its matrix by rows padded to the shader's array. */\nconst weights = new Float32Array(CONVOLUTION_FLOATS);\nfunction convolution(plan, v, at, input, width, height) {\n const columns = v[at];\n const rows = v[at + 1];\n weights.fill(0);\n weights.set(v.subarray(at + 12, at + 12 + Math.min(columns * rows, weights.length)));\n const out = plan.slot(width, height);\n plan.pass(CONVOLUTION_PASS, input, width, height, out, width, height);\n plan.uniformFrom(\"uMatrix\", VEC4S, weights, 0, weights.length);\n plan.uniform(\"uSize\", 2, columns, rows);\n plan.uniformFrom(\"uEdge\", FLOATS, v, at + 2, 4);\n plan.uniform(\"uDivisor\", 1, v[at + 6]);\n plan.uniform(\"uReciprocal\", 1, v[at + 7]);\n plan.uniform(\"uBias\", 1, v[at + 8]);\n plan.uniform(\"uClamp\", 1, v[at + 9]);\n plan.uniform(\"uPreserve\", 1, v[at + 10]);\n const inset = v[at + 11];\n plan.uniform(\"uBox\", 4, inset, inset, width / plan.resolution - inset + 1, height / plan.resolution - inset + 1);\n return out;\n}\n/** A displacement map: each of the object's pixels read from where its map, texture `id`, moves it. */\nfunction displacement(plan, v, at, id, input, width, height) {\n const out = plan.slot(width, height);\n const pass = plan.pass(DISPLACE_PASS, input, width, height, out, width, height);\n pass.texture = id;\n plan.uniformFrom(\"uComponentX\", FLOATS, v, at, 4);\n plan.uniformFrom(\"uComponentY\", FLOATS, v, at + 4, 4);\n plan.uniformFrom(\"uScale\", FLOATS, v, at + 8, 2);\n plan.uniform(\"uMode\", 1, v[at + 10]);\n plan.uniformFrom(\"uColor\", FLOATS, v, at + 11, 4);\n plan.uniformFrom(\"uGrow\", FLOATS, v, at + 15, 2);\n const inset = v[at + 17];\n plan.uniform(\"uBox\", 4, inset, inset, width / plan.resolution - inset + 1, height / plan.resolution - inset + 1);\n plan.uniform(\"uMapAt\", 4, inset + v[at + 18], inset + v[at + 19], v[at + 20], v[at + 21]);\n return out;\n}\n/** A kernel's images, read as the plan's of a ShaderFilter are: each one's number and kind. */\nconst kernelImages = [];\n/**\n * A ShaderFilter, filter `i` of `filters`: its kernel (kernel-shaders.ts,\n * filterKernel) over the input, the bitmap it reads lying where the\n * object's does, grown by the filters before it, and its output that\n * grown by its extensions; its images and parameters as uniforms. Run\n * once a stage pixel, as Flash runs it over its bitmap of the object:\n * where a whole number of the input's texels make a stage pixel and the\n * bitmap starts on a texel, the input is shrunk to one a pixel on the\n * bitmap's grid, the mean of its texels within the frame, run, and drawn\n * back, each texel its pixel's; else run at each texel. One of whose\n * images there is no texture, of more images than a program binds, or\n * whose shader will not link, leaves its input be.\n */\nfunction shader(plan, filters, i, input, width, height, hasTexture, links, object) {\n const v = filters.values;\n const at = filters.start[i];\n const kernel = filters.kernels[i];\n const units = v[at];\n const inset = v[at + 1];\n const padding = v[at + 2];\n const count = v[at + 7];\n kernelImages.length = 0;\n for (let k = 0; k < count; k++) {\n const id = v[at + 9 + k * 3];\n if (id >= 0 && !hasTexture(id)) {\n return input;\n }\n kernelImages.push({ texture: v[at + 8 + k * 3], layer: id < 0, float: v[at + 10 + k * 3] > 0 });\n }\n const fragment = kernel ? filterKernel(kernel, kernelImages) : null;\n if (!fragment || !kernelImagesFit(kernelImages) || !links(fragment)) {\n return input;\n }\n // The bitmap this filter reads: the object's, grown by the filters before it.\n const res = plan.resolution;\n const texels = units * res;\n const before = (padding - inset) * res;\n const x = (object ? object.x : padding * res) - before;\n const y = (object ? object.y : padding * res) - before;\n const bitmapWidth = (object ? object.width : width - padding * res * 2) + before * 2;\n const bitmapHeight = (object ? object.height : height - padding * res * 2) + before * 2;\n const shrink = texels > 1 &&\n texels <= 16 &&\n Number.isInteger(texels) &&\n Number.isInteger(x) &&\n Number.isInteger(y)\n ? texels\n : 1;\n // The grid's first pixel from the frame's corner, at or before it, a line of it on the bitmap's.\n const startX = x - shrink * Math.ceil(x / shrink);\n const startY = y - shrink * Math.ceil(y / shrink);\n let from = input;\n let w = width;\n let h = height;\n if (shrink > 1) {\n w = Math.ceil((width - startX) / shrink);\n h = Math.ceil((height - startY) / shrink);\n from = plan.slot(w, h);\n plan.pass(KERNEL_PASS, input, width, height, from, w, h).kernel = PIXELS_DOWN;\n plan.uniform(\"uDown\", 3, shrink, startX, startY);\n plan.uniform(\"uKernelFrame\", 2, width, height);\n }\n let out = plan.slot(w, h);\n const pass = plan.pass(KERNEL_PASS, from, w, h, out, w, h);\n pass.kernel = fragment;\n plan.uniform(\"uKernelAt\", 3, (x - startX) / shrink, (y - startY) / shrink, texels / shrink);\n plan.uniform(\"uKernelFrame\", 2, w, h);\n plan.uniform(\"uKernelRegion\", 4, -v[at + 3], -v[at + 4], bitmapWidth / texels + v[at + 5], bitmapHeight / texels + v[at + 6]);\n for (let k = 0; k < count; k++) {\n if (v[at + 9 + k * 3] >= 0) {\n plan.uniformFrom(`pbImage${v[at + 8 + k * 3]}`, SAMPLER, v, at + 9 + k * 3, 1);\n }\n }\n const floats = at + 8 + count * 3;\n if (v[floats] > 0) {\n plan.uniformFrom(\"pbFloats\", VEC4S, v, floats + 1, v[floats]);\n }\n const intsAt = filters.intStart[i];\n const ints = filters.intStart[i + 1] - intsAt;\n if (ints > 0) {\n plan.uniformInts(\"pbInts\", filters.ints, intsAt, ints);\n }\n if (shrink > 1) {\n const pixels = out;\n out = plan.slot(width, height);\n plan.pass(KERNEL_PASS, pixels, w, h, out, width, height).kernel = PIXELS_BACK;\n plan.uniform(\"uDown\", 3, shrink, startX, startY);\n }\n return out;\n}\n/** `pass` reading `blurred` as its blur, or its input where nothing blurred it. */\nfunction readBlurred(pass, blurred) {\n pass.blurred = blurred ? blurred.slot : INPUT_BLUR;\n pass.across = blurred ? blurred.across : 1;\n pass.down = blurred ? blurred.down : 1;\n}\n/**\n * The box's runs over `input`'s frame into a new slot, `across` times\n * narrower and `down` times lower (blurShrink); null where no run would\n * change it.\n */\nfunction blurredOf(plan, input, width, height, blurX, blurY, quality, texels, across, down) {\n if (!(quality > 0 && (blurX > 1 || blurY > 1))) {\n return null;\n }\n let source = input;\n let w = width;\n let h = height;\n if (across > 1 || down > 1) {\n w = Math.ceil(width / across);\n h = Math.ceil(height / down);\n source = plan.slot(w, h);\n plan.pass(SHRINK_PASS, input, w * across, h * down, source, w, h);\n plan.uniform(\"uFactor\", 2, across, down);\n }\n const out = plan.slot(w, h);\n boxRuns(plan, source, w, h, out, blurX, blurY, quality, texels / across, texels / down);\n blurredScratch.slot = out;\n blurredScratch.across = across;\n blurredScratch.down = down;\n return blurredScratch;\n}\n/** What blurredOf gives, read before it is asked again. */\nconst blurredScratch = { slot: 0, across: 1, down: 1 };\n/**\n * The box's runs over slot `input`'s frame into slot `output`'s, through\n * slots between them, the second only where a third run needs one:\n * `texelsX` and `texelsY` to a stage pixel each way, which the blur is in,\n * each step a texel of the input.\n */\nfunction boxRuns(plan, input, width, height, output, blurX, blurY, quality, texelsX, texelsY) {\n const step = 1 / plan.resolution;\n const across = blurX > 1;\n const down = blurY > 1;\n const runs = quality * ((across ? 1 : 0) + (down ? 1 : 0));\n if (runs === 0) {\n plan.pass(BOX_PASS, input, width, height, output, width, height);\n plan.uniform(\"uDirection\", 2, 1, 0);\n plan.uniform(\"uWidth\", 1, 1);\n return;\n }\n const first = runs > 1 ? plan.slot(width, height) : -1;\n const second = runs > 2 ? plan.slot(width, height) : -1;\n let from = input;\n for (let k = 0; k < runs; k++) {\n const to = k === runs - 1 ? output : k % 2 === 0 ? first : second;\n plan.pass(BOX_PASS, from, width, height, to, width, height);\n if (across && (!down || k % 2 === 0)) {\n plan.uniform(\"uDirection\", 2, step, 0);\n plan.uniform(\"uWidth\", 1, blurX * texelsX);\n }\n else {\n plan.uniform(\"uDirection\", 2, 0, step);\n plan.uniform(\"uWidth\", 1, blurY * texelsY);\n }\n from = to;\n }\n}\n//# sourceMappingURL=filter-plan.js.map","import { linkProgram } from \"@swf2es/context3d/device\";\nimport { BEVEL_PASS, BOX_PASS, CONVOLUTION_PASS, DISPLACE_PASS, FilterPlan, FLOATS, GLOW_PASS, GRADIENT_PASS, IVEC4S, KERNEL_PASS, MATRIX_PASS, MATRIX4, NO_BLUR, planChain, READ_BACK_PASS, SAMPLER, SHRINK_PASS, VEC4S, } from \"../filter-plan.js\";\nimport * as shaders from \"../filter-shaders.js\";\nimport { CLAMP, SMOOTH } from \"../scene.js\";\n/**\n * The units a pass reads its input, the blur it combines with, and a\n * gradient from; a kernel's images take KernelPrograms' own (KERNEL_UNIT).\n */\nconst INPUT_UNIT = 4;\nconst BLURRED_UNIT = 5;\nconst EXTRA_UNIT = 6;\n/**\n * A triangle over the output's frame, the viewport, reading its input\n * from 0 to uCoord: the input's frame over its texture's size, or more of\n * it for a shrink.\n */\nconst VERTEX = `#version 300 es\nuniform vec2 uCoord;\nout vec2 vTextureCoord;\nvoid main(void) {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n vTextureCoord = p * uCoord;\n}\n`;\nconst HEADER = \"#version 300 es\\nprecision highp float;\\n\";\n/**\n * The input and the blur read within their rectangles (FilterTarget), as a\n * texture of their own size clamped to its edges reads, linearly: a texel\n * coordinate kept half a texel in from each edge reads the edge texel, as\n * the edge's clamp does.\n */\nconst READS = `uniform vec4 uTextureRect;\nuniform vec4 uBlurredRect;\nvec4 within(sampler2D t, vec4 rect, vec2 at) {\n vec2 texel = clamp(at * rect.zw, vec2(0.5), rect.zw - 0.5);\n return texture(t, (rect.xy + texel) / vec2(textureSize(t, 0)));\n}\n`;\n/** A filter's fragment shader reading its input and its blur within their rectangles (READS). */\nfunction withinRects(fragment) {\n const reads = fragment\n .replaceAll(\"texture(uTexture,\", \"within(uTexture, uTextureRect,\")\n .replaceAll(\"texture(uBlurred,\", \"within(uBlurred, uBlurredRect,\");\n // A read left as it was would read past its rectangle, into another's on a page: refused.\n if (/\\b(texture\\w*|texelFetch\\w*)\\s*\\(\\s*u(Texture|Blurred)\\b/.test(reads)) {\n throw new Error(\"a filter shader reads its input other than as texture(uTexture, at)\");\n }\n // After the samplers' declarations, which READS's function takes.\n const at = reads.lastIndexOf(\"uniform sampler2D\");\n const end = reads.indexOf(\"\\n\", at) + 1;\n return reads.slice(0, end) + READS + reads.slice(end);\n}\n/** The input as it is, read where the vertex shader says: halved, at a corner four texels share. */\nconst COPY = `in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nvoid main(void) {\n finalColor = texture(uTexture, vTextureCoord);\n}`;\n/**\n * Runs a layer's chain of Flash's filters, each a pass or a few over\n * targets the host lends: the shaders of filter-shaders.ts, reading their\n * input's size in the target's units, uInputSize, and its texels,\n * uInputPixel. Every target's rows run down, so the shaders' offsets keep\n * their sense. Each pass clears its whole output, which its\n * successor may read past the frame.\n */\nexport class FilterRunner {\n kernels;\n gl;\n state;\n host;\n passes = new Map();\n /** The kernel image units a kernel's pass has bound so far. */\n samplers = 0;\n /** Whether a kernel's fragment shader links (planChain's `links`), linking it now if not yet. */\n links = (fragment) => this.kernel(fragment) !== null;\n /** The chain being run, planned (filter-plan.ts), each slot's target and the last pass using it. */\n plan = new FilterPlan();\n targets = [];\n lastUse = [];\n hasTexture = (id) => id >= 0 && this.host.texture(id) !== null;\n /** The target's pixels a unit of its own, for the chain running. */\n resolution = 1;\n constructor(gl, state, host, kernels) {\n this.kernels = kernels;\n this.gl = gl;\n this.state = state;\n this.host = host;\n }\n /**\n * Chain `chain` of `filters` run over `input`'s first `width` by `height`\n * texels: the target its last pass drew into, `input` itself where none\n * changed it. Every other target, `input` too where it was replaced, goes\n * back to the host. `object` is where the layer's object lies in it\n * (planChain).\n */\n run(filters, chain, input, width, height, resolution, object = null) {\n const plan = this.plan;\n planChain(plan, filters, chain, width, height, resolution, this.hasTexture, this.links, object);\n return this.execute(plan, input);\n }\n /**\n * `input`'s first `width` by `height` texels at half the size each way,\n * each texel the mean of the four it covers, read once linearly at the\n * corner they share: a target the host lends, which the caller gives\n * back. Not a filter's pass, so at a texel a unit.\n */\n halve(input, width, height) {\n this.resolution = 1;\n const out = this.host.take(width, height);\n this.draw(this.use(\"copy\", COPY), input, width * 2, height * 2, out, width, height);\n return out;\n }\n /**\n * `plan`'s passes drawn in order, its slot 0 `input`: each slot's target\n * taken as a pass first draws into it and given back after the last pass\n * that reads it, but the one the plan leaves its output in.\n */\n execute(plan, input) {\n const targets = this.targets;\n const last = this.lastUse;\n targets.length = plan.slots;\n last.length = plan.slots;\n targets.fill(null);\n last.fill(-1);\n targets[0] = input;\n for (let k = 0; k < plan.count; k++) {\n const pass = plan.passes[k];\n last[pass.input] = k;\n last[pass.output] = k;\n if (pass.blurred >= 0) {\n last[pass.blurred] = k;\n }\n }\n for (let k = 0; k < plan.count; k++) {\n const pass = plan.passes[k];\n if (!targets[pass.output]) {\n targets[pass.output] = this.host.take(plan.slotWidth[pass.output], plan.slotHeight[pass.output]);\n }\n this.drawPass(plan, k, targets, true);\n for (let slot = 0; slot < plan.slots; slot++) {\n const target = targets[slot];\n if (target && last[slot] === k && slot !== plan.result) {\n this.host.give(target);\n targets[slot] = null;\n }\n }\n }\n return targets[plan.result];\n }\n /**\n * Pass `k` of `plan` drawn from and into `targets`, by slot, which hold\n * every one it reads and draws into; its output's rectangle cleared first\n * where `clear`, else left as it is, as a rectangle no pass drew into yet is.\n */\n drawPass(plan, k, targets, clear) {\n this.resolution = plan.resolution;\n const pass = plan.passes[k];\n const from = targets[pass.input];\n const to = targets[pass.output];\n // A kernel that will not link was left out as the chain was planned (links).\n const program = pass.program === KERNEL_PASS\n ? (this.kernel(pass.kernel) ?? this.use(\"copy\", COPY))\n : this.program(pass.program);\n this.samplers = 0;\n for (let u = pass.first; u < pass.end; u++) {\n this.setUniform(program, plan, u);\n }\n if (pass.texture >= 0) {\n this.state.bindTexture(EXTRA_UNIT, this.host.texture(pass.texture));\n this.state.bindSampler(EXTRA_UNIT, this.host.sampler(CLAMP));\n }\n if (pass.blurred !== NO_BLUR) {\n // The blur, or the input where nothing blurred it, with the scale between them.\n const blurred = pass.blurred >= 0 ? targets[pass.blurred] : from;\n this.state.bindTexture(BLURRED_UNIT, blurred.texture);\n this.state.bindSampler(BLURRED_UNIT, this.host.sampler(SMOOTH | CLAMP));\n this.set(program, \"uBlurredScale\", 2, from.width / (blurred.width * pass.across), from.height / (blurred.height * pass.down));\n this.set(program, \"uBlurredRect\", 4, blurred.x ?? 0, blurred.y ?? 0, blurred.width, blurred.height);\n }\n this.draw(program, from, pass.readWidth, pass.readHeight, to, pass.width, pass.height, clear);\n }\n /**\n * `pass`'s uniform `name`, of `count` floats, set to `x` and those after,\n * unless it was told them last: a frame's glows alike tell their passes\n * the same values over and over.\n */\n set(pass, name, count, x, y = 0, z = 0, w = 0) {\n let told = pass.told.get(name);\n if (!told) {\n told = new Float32Array(4).fill(Number.NaN);\n pass.told.set(name, told);\n }\n // Compared as the floats the uniform holds.\n if (told[0] === Math.fround(x) &&\n told[1] === Math.fround(y) &&\n told[2] === Math.fround(z) &&\n told[3] === Math.fround(w)) {\n return;\n }\n told[0] = x;\n told[1] = y;\n told[2] = z;\n told[3] = w;\n const gl = this.gl;\n const location = this.at(pass, name);\n switch (count) {\n case 1:\n gl.uniform1f(location, x);\n break;\n case 2:\n gl.uniform2f(location, x, y);\n break;\n case 3:\n gl.uniform3f(location, x, y, z);\n break;\n default:\n gl.uniform4f(location, x, y, z, w);\n }\n }\n /** Uniform `u` of `plan` set on `pass`, in use. */\n setUniform(pass, plan, u) {\n const gl = this.gl;\n const location = this.at(pass, plan.uniformName[u]);\n const values = plan.values;\n const at = plan.uniformAt[u];\n const count = plan.uniformCount[u];\n switch (plan.uniformKind[u]) {\n case MATRIX4:\n gl.uniformMatrix4fv(location, false, values, at, 16);\n break;\n case VEC4S:\n gl.uniform4fv(location, values, at, count);\n break;\n case IVEC4S:\n this.kernels.setInts(location, plan.ints, at, count);\n break;\n case SAMPLER:\n // As many as KERNEL_IMAGES, which the plan holds a kernel to.\n this.kernels.bindImage(location, this.samplers++, values[at], this.host);\n break;\n case FLOATS:\n this.set(pass, plan.uniformName[u], count, values[at], count > 1 ? values[at + 1] : 0, count > 2 ? values[at + 2] : 0, count > 3 ? values[at + 3] : 0);\n }\n }\n /** The pass of program `id` (filter-plan.ts), in use. */\n program(id) {\n switch (id) {\n case BOX_PASS:\n return this.use(\"box\", shaders.BOX);\n case SHRINK_PASS:\n return this.use(\"shrink\", shaders.SHRINK);\n case READ_BACK_PASS:\n return this.use(\"readBack\", shaders.READ_BACK);\n case GLOW_PASS:\n return this.use(\"glow\", shaders.GLOW);\n case BEVEL_PASS:\n return this.use(\"bevel\", shaders.BEVEL);\n case GRADIENT_PASS:\n return this.use(\"gradient\", shaders.GRADIENT);\n case MATRIX_PASS:\n return this.use(\"colorMatrix\", shaders.MATRIX);\n case CONVOLUTION_PASS:\n return this.use(\"convolution\", shaders.CONVOLUTION);\n case DISPLACE_PASS:\n return this.use(\"displacement\", shaders.DISPLACE);\n }\n throw new Error(`no filter pass ${id}`);\n }\n /**\n * `pass` drawn into `output`'s first `width` by `height` texels, the rest\n * of it cleared, reading `input` from its corner over `readWidth` by\n * `readHeight` texels.\n */\n draw(pass, input, readWidth, readHeight, output, width, height, clear = true) {\n const gl = this.gl;\n const state = this.state;\n const x = output.x ?? 0;\n const y = output.y ?? 0;\n state.bindFramebuffer(output.framebuffer);\n state.viewport(x, y, width, height);\n state.colorMask(15);\n state.stencil(null);\n state.setBlend(null);\n if (clear) {\n state.scissor([x, y, output.width, output.height]);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n }\n state.scissor(null);\n state.useProgram(pass.program);\n state.bindVertexArray(null);\n state.bindTexture(INPUT_UNIT, input.texture);\n state.bindSampler(INPUT_UNIT, this.host.sampler(SMOOTH | CLAMP));\n const res = this.resolution;\n this.set(pass, \"uInputSize\", 4, input.width / res, input.height / res, res / input.width, res / input.height);\n this.set(pass, \"uInputPixel\", 4, input.width, input.height, 1 / input.width, 1 / input.height);\n this.set(pass, \"uCoord\", 2, readWidth / input.width, readHeight / input.height);\n this.set(pass, \"uTextureRect\", 4, input.x ?? 0, input.y ?? 0, input.width, input.height);\n // A kernel's alone: the others need not be told.\n if (this.at(pass, \"uOutputAt\")) {\n this.set(pass, \"uOutputAt\", 2, x, y);\n }\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n }\n /** The pass of `fragment`, linked as first used, in use. */\n use(name, fragment) {\n const gl = this.gl;\n let pass = this.passes.get(name);\n if (!pass) {\n const program = linkProgram(gl, VERTEX, HEADER + withinRects(fragment));\n pass = {\n program,\n uniforms: new Map(),\n told: new Map(),\n };\n this.passes.set(name, pass);\n this.state.useProgram(program);\n gl.uniform1i(gl.getUniformLocation(program, \"uTexture\"), INPUT_UNIT);\n gl.uniform1i(gl.getUniformLocation(program, \"uBlurred\"), BLURRED_UNIT);\n gl.uniform1i(gl.getUniformLocation(program, \"uGradient\"), EXTRA_UNIT);\n gl.uniform1i(gl.getUniformLocation(program, \"uMap\"), EXTRA_UNIT);\n }\n this.state.useProgram(pass.program);\n return pass;\n }\n /** The pass of a kernel's fragment shader (KernelPrograms), in use; null where it would not link. */\n kernel(fragment) {\n return this.kernels.use(VERTEX, fragment, (program) => {\n this.gl.uniform1i(this.gl.getUniformLocation(program, \"uTexture\"), INPUT_UNIT);\n });\n }\n /** Where `pass` takes uniform `name`, asked once. */\n at(pass, name) {\n let location = pass.uniforms.get(name);\n if (location === undefined) {\n location = this.gl.getUniformLocation(pass.program, name);\n pass.uniforms.set(name, location);\n }\n return location;\n }\n destroy() {\n for (const pass of this.passes.values()) {\n this.gl.deleteProgram(pass.program);\n }\n this.passes.clear();\n }\n}\n//# sourceMappingURL=filters.js.map","import { ROW_FLOATS, ROWS_A_LINE } from \"../rows.js\";\nimport { MIRROR, REPEAT, SMOOTH } from \"../scene.js\";\nimport { OUTLINE_ROW, OUTLINE_UNIT, ROW_TEXELS, TEXTURE_UNIT } from \"./programs.js\";\n/**\n * The textures the programs read: the registry's, uploaded as they are\n * added or change, and the samplers they are read through; the rows, a\n * float texture uploaded once a frame; and advanced text's outlines.\n */\nexport class GpuTextures {\n gl;\n state;\n /** The textures uploaded, by the registry's ids, and their sizes; the samplers made, by their bits. */\n textures = [];\n sizes = [];\n samplers = [];\n rowsTexture;\n rowLines = 0;\n /** Advanced text's outlines (uploadOutlines), on OUTLINE_UNIT for the glyph program. */\n outlines = null;\n /** The outlines uploaded: of which epoch, how many segments, and the texture's rows. */\n outlineEpoch = -1;\n outlineCount = 0;\n outlineRows = 0;\n constructor(gl, state) {\n this.gl = gl;\n this.state = state;\n }\n /** The rows' texture made, and none other yet, as the context comes or comes back. */\n setUp() {\n const gl = this.gl;\n this.outlines = null;\n this.outlineEpoch = -1;\n this.outlineCount = 0;\n this.outlineRows = 0;\n this.textures = [];\n this.samplers = [];\n this.rowsTexture = gl.createTexture();\n this.state.bindTexture(0, this.rowsTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n this.rowLines = 0;\n }\n /** Whether texture `id` of the frame's is there, for a filter that reads it. */\n hasTexture = (id) => id >= 0 && (this.textures[id] ?? null) !== null;\n /**\n * Advanced text's outlines (GeometryData.glyphs), `count` segments of four floats each\n * in `data`, as the player's store holds them: uploaded whole for another\n * `epoch` or a larger store, else the rows added since.\n */\n uploadOutlines(data, count, epoch) {\n const gl = this.gl;\n if (gl.isContextLost() || count === 0) {\n return;\n }\n const rows = data.length / 4 / OUTLINE_ROW;\n let from = epoch === this.outlineEpoch ? this.outlineCount : 0;\n if (!this.outlines || rows !== this.outlineRows) {\n if (this.outlines) {\n this.state.dropTexture(this.outlines);\n gl.deleteTexture(this.outlines);\n }\n this.outlines = gl.createTexture();\n this.state.bindTexture(OUTLINE_UNIT, this.outlines);\n this.state.activeTexture(OUTLINE_UNIT);\n gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA32F, OUTLINE_ROW, rows);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n this.outlineRows = rows;\n from = 0;\n }\n if (from < count) {\n const first = Math.floor(from / OUTLINE_ROW);\n const height = Math.ceil(count / OUTLINE_ROW) - first;\n this.state.bindTexture(OUTLINE_UNIT, this.outlines);\n this.state.activeTexture(OUTLINE_UNIT);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, first, OUTLINE_ROW, height, gl.RGBA, gl.FLOAT, data, first * OUTLINE_ROW * 4);\n }\n this.outlineEpoch = epoch;\n this.outlineCount = count;\n }\n /** The textures removed since the last frame deleted, and those added or changed uploaded, their pixels let go. */\n uploadTextures(textures) {\n const gl = this.gl;\n for (const id of textures.removed) {\n const texture = this.textures[id];\n if (texture) {\n this.state.dropTexture(texture);\n gl.deleteTexture(texture);\n this.textures[id] = null;\n }\n }\n textures.removed.length = 0;\n for (const id of textures.pending) {\n const data = textures.get(id);\n if (!data?.pixels) {\n continue;\n }\n let texture = this.textures[id];\n if (!texture) {\n texture = gl.createTexture();\n this.textures[id] = texture;\n this.sizes[id * 2] = -1;\n }\n this.state.bindTexture(TEXTURE_UNIT, texture);\n this.state.activeTexture(TEXTURE_UNIT);\n // Floats, a kernel's image, make the texture again each time, as bytes may follow them.\n if (data.pixels instanceof Float32Array) {\n this.sizes[id * 2] = -1;\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, data.width, data.height, 0, gl.RGBA, gl.FLOAT, data.pixels);\n data.pixels = null;\n continue;\n }\n // Pixels of the same size go into the texture there is; another size makes it again.\n if (this.sizes[id * 2] === data.width && this.sizes[id * 2 + 1] === data.height) {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, data.width, data.height, gl.RGBA, gl.UNSIGNED_BYTE, data.pixels);\n data.pixels = null;\n continue;\n }\n this.sizes[id * 2] = data.width;\n this.sizes[id * 2 + 1] = data.height;\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, data.width, data.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data.pixels);\n data.pixels = null;\n }\n textures.pending.length = 0;\n }\n /** The sampler for `bits` (SMOOTH, and REPEAT or MIRROR), made as first asked for. */\n sampler(bits) {\n const known = this.samplers[bits];\n if (known) {\n return known;\n }\n const gl = this.gl;\n const sampler = gl.createSampler();\n const filter = bits & SMOOTH ? gl.LINEAR : gl.NEAREST;\n const wrap = bits & REPEAT ? gl.REPEAT : bits & MIRROR ? gl.MIRRORED_REPEAT : gl.CLAMP_TO_EDGE;\n gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, filter);\n gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, filter);\n gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, wrap);\n gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_T, wrap);\n this.samplers[bits] = sampler;\n return sampler;\n }\n /** The rows a frame wrote, uploaded in one call, the texture made taller first if they need it. */\n uploadRows(rows) {\n const gl = this.gl;\n const lines = Math.max(1, Math.ceil(rows.count / ROWS_A_LINE));\n const width = ROWS_A_LINE * ROW_TEXELS;\n this.state.bindTexture(0, this.rowsTexture);\n this.state.activeTexture(0);\n if (lines > this.rowLines) {\n this.rowLines = Math.max(lines, this.rowLines * 2);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, width, this.rowLines, 0, gl.RGBA, gl.FLOAT, null);\n }\n if (rows.count > 0) {\n // Whole lines: the data holds ROW_FLOATS a row for as many rows as its lines hold.\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, lines, gl.RGBA, gl.FLOAT, rows.data.subarray(0, lines * ROWS_A_LINE * ROW_FLOATS));\n }\n }\n /** The textures made on the context, deleted. */\n destroy() {\n const gl = this.gl;\n gl.deleteTexture(this.rowsTexture);\n if (this.outlines) {\n gl.deleteTexture(this.outlines);\n }\n for (const texture of this.textures) {\n if (texture) {\n gl.deleteTexture(texture);\n }\n }\n for (const sampler of this.samplers) {\n if (sampler) {\n gl.deleteSampler(sampler);\n }\n }\n }\n}\n//# sourceMappingURL=gpu-textures.js.map","// Rectangles placed side by side on pages, in shelves, in the order they\n// come: a frame's held layers and their filters' targets (plan, HOLD_PUSH),\n// each of a page a pass draws into with the others of its kind.\n/** Rectangles on pages `width` wide and at most `most` high, each page as high as they need. */\nexport class Shelves {\n /** Each rectangle's page, and its corner there. */\n page = [];\n x = [];\n y = [];\n count = 0;\n /** Each page's height, as far down as its rectangles reach. */\n heights = [];\n pages = 0;\n width = 0;\n most = 0;\n /** Where the shelf open starts, how high it is, and how far along it is filled. */\n shelf = 0;\n shelfHeight = 0;\n along = 0;\n /** Empty, for pages `width` wide and at most `most` high. */\n reset(width, most) {\n this.width = width;\n this.most = most;\n this.count = 0;\n this.pages = 0;\n this.shelf = 0;\n this.shelfHeight = 0;\n this.along = 0;\n }\n /** A rectangle `w` by `h` placed: its number; -1 for one larger than a page. */\n add(w, h) {\n if (w > this.width || h > this.most) {\n return -1;\n }\n if (this.pages === 0) {\n this.newPage();\n }\n if (this.along + w > this.width) {\n this.shelf += this.shelfHeight;\n this.shelfHeight = 0;\n this.along = 0;\n }\n if (this.shelf + h > this.most) {\n this.newPage();\n }\n const i = this.count++;\n const page = this.pages - 1;\n this.page[i] = page;\n this.x[i] = this.along;\n this.y[i] = this.shelf;\n this.along += w;\n this.shelfHeight = Math.max(this.shelfHeight, h);\n this.heights[page] = Math.max(this.heights[page], this.shelf + this.shelfHeight);\n return i;\n }\n newPage() {\n this.heights[this.pages++] = 0;\n this.shelf = 0;\n this.shelfHeight = 0;\n this.along = 0;\n }\n}\n//# sourceMappingURL=shelves.js.map","import { HELD, HOLD_POP, HOLD_PUSH, RUN, STENCIL_POP, STENCIL_PUSH, } from \"../commands.js\";\nimport { FilterPlan, planChain } from \"../filter-plan.js\";\nimport { Shelves } from \"../shelves.js\";\nimport { framebufferOf, LAYER_STEP, layerSide, objectOf, } from \"./targets.js\";\n/** The width of the pages held layers and their filters' targets are placed on, side by side. */\nconst PAGE_WIDTH = 2048;\n/** Keep content pages below the free pool's budget so they can be reused. */\nconst CONTENT_PAGE_BYTES = 64 * 1024 * 1024;\n/**\n * The frame's held layers (HOLD_PUSH), drawn ahead of the stage a level at\n * a time: their content side by side on pages, then their filters' passes\n * in waves, each wave's targets on pages of their own; their outputs left\n * on the pages for the frame's HELD composites.\n */\nexport class HeldLayers {\n gl;\n state;\n pool;\n draws;\n compositor;\n gpu;\n /** The filters' passes, the backend's. */\n filters;\n /**\n * The frame's held layers (HOLD_PUSH); the pages they took, null once\n * given back; the last wave each is read in, and whether an output is on\n * it, which keeps it for the frame.\n */\n holds = [];\n pages = [];\n pageUntil = [];\n pageKept = [];\n /** A page drawn into whole, a held layer's rectangle of one, and a held output composited. */\n pageOpen = { layer: null, msaa: null, x: 0, y: 0, width: 0, height: 0 };\n holdOpen = { layer: null, msaa: null, x: 0, y: 0, width: 0, height: 0 };\n heldOpen = { layer: null, msaa: null, x: 0, y: 0, width: 0, height: 0 };\n shelves = new Shelves();\n /** The masks pushed on the held layer whose content is drawn (drawHoldContent). */\n masks = { depth: 0, past: 0 };\n /** The largest side a texture may have. */\n textureMost = 4096;\n constructor(gl, state, pool, draws, compositor, gpu) {\n this.gl = gl;\n this.state = state;\n this.pool = pool;\n this.draws = draws;\n this.compositor = compositor;\n this.gpu = gpu;\n }\n /**\n * The filters' passes and the largest side a texture may have, as the\n * context comes or comes back.\n */\n setUp(filters, textureMost) {\n this.filters = filters;\n this.textureMost = textureMost;\n }\n /**\n * The frame's held layers (HOLD_PUSH), drawn ahead of the stage side by\n * side: their content on pages of their own, one bind, clear and resolve\n * a page; then their filters' passes in waves, the k-th pass of every\n * chain at once, each wave's targets on pages of its own, which no pass\n * of it reads. Each layer's output is left on its page for HELD. A layer\n * larger than a page is drawn alone, as a layer of its own.\n */\n drawHolds(commands, scene, filters, target) {\n const count = this.gatherHolds(commands);\n // A level at a time, which the planner gives in order: a held layer's content composites\n // those in it, of the levels before.\n for (let from = 0; from < count;) {\n let to = from + 1;\n while (to < count && this.holds[to].level === this.holds[from].level) {\n to++;\n }\n this.drawHoldLevel(from, to, commands, scene, filters, target);\n from = to;\n }\n }\n /** Held layers `from` up to `to`, of one level, drawn side by side (drawHolds). */\n drawHoldLevel(from, to, commands, scene, filters, target) {\n const gl = this.gl;\n const state = this.state;\n const holds = this.holds;\n // The pages this level takes, from here on, which its waves give back.\n const levelPages = this.pages.length;\n const shelves = this.shelves;\n this.draws.forgetRow();\n // Their content, each at the size its own layer would take, on pages no taller than the\n // frame's samples fit (fittingSamples), so that each takes them as its own layer did.\n let area = 0;\n let widest = 0;\n for (let h = from; h < to; h++) {\n area += layerSide(holds[h].width) * layerSide(holds[h].height);\n widest = Math.max(widest, layerSide(holds[h].width));\n }\n const samples = this.pool.frameSamples;\n let width = this.pageWidth(area, widest);\n const fitting = Math.max(LAYER_STEP, Math.floor(CONTENT_PAGE_BYTES / (width * samples * 8) / LAYER_STEP) * LAYER_STEP);\n shelves.reset(width, samples > 1 ? Math.min(this.textureMost, fitting) : this.textureMost);\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n hold.shelf = shelves.add(layerSide(hold.width), layerSide(hold.height));\n if (hold.shelf < 0) {\n this.drawHoldAlone(hold, commands, scene, filters, target);\n }\n }\n for (let p = 0; p < shelves.pages; p++) {\n const index = this.takePage(width, shelves.heights[p]);\n const page = this.pages[index];\n const whole = this.pageOpen;\n whole.layer = page;\n whole.msaa = this.pool.layerMsaa(page, samples);\n whole.width = page.width;\n whole.height = page.height;\n state.bindFramebuffer(framebufferOf(whole));\n state.scissor(null);\n state.stencil(null);\n state.colorMask(15);\n gl.clearColor(0, 0, 0, 0);\n gl.clearStencil(0);\n gl.stencilMask(0xff);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n if (hold.shelf < 0 || shelves.page[hold.shelf] !== p) {\n continue;\n }\n const content = this.holdOpen;\n content.layer = page;\n content.msaa = whole.msaa;\n content.x = hold.x;\n content.y = hold.y;\n content.width = hold.width;\n content.height = hold.height;\n content.ox = shelves.x[hold.shelf];\n content.oy = shelves.y[hold.shelf];\n // Kept to its rectangle by the viewport alone, as the composites in it scissor themselves.\n this.draws.drawInto(content, target);\n this.drawHoldContent(commands, hold, scene, content);\n this.slotOf(hold, 0, index, content.ox, content.oy, hold.width, hold.height);\n }\n this.pool.resolve(whole, page.width, page.height);\n }\n // Their filters, planned, then drawn a wave at a time: each wave's new targets on pages of its\n // own, which none of its passes reads, as each reads what earlier waves drew. A page goes back\n // once no pass after reads it, unless an output is on it.\n let waves = 0;\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n if (hold.shelf < 0) {\n continue;\n }\n const plan = hold.plan;\n planChain(plan, filters, hold.chain, hold.width, hold.height, target.resolution, this.gpu.hasTexture, this.filters.links, hold.object);\n hold.targets.length = plan.slots;\n hold.targets.fill(null, 1);\n hold.lastUse.length = plan.slots;\n hold.lastUse.fill(-1);\n for (let k = 0; k < plan.count; k++) {\n const pass = plan.passes[k];\n hold.lastUse[pass.input] = k;\n hold.lastUse[pass.output] = k;\n if (pass.blurred >= 0) {\n hold.lastUse[pass.blurred] = k;\n }\n }\n this.notePage(hold, 0);\n waves = Math.max(waves, plan.count);\n }\n for (let k = 0; k < waves; k++) {\n area = 0;\n widest = 0;\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n const plan = hold.plan;\n if (hold.shelf >= 0 && k < plan.count && !hold.targets[plan.passes[k].output]) {\n const slot = plan.passes[k].output;\n area += layerSide(plan.slotWidth[slot]) * layerSide(plan.slotHeight[slot]);\n widest = Math.max(widest, layerSide(plan.slotWidth[slot]));\n }\n }\n width = this.pageWidth(area, widest);\n shelves.reset(width, this.textureMost);\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n const plan = hold.plan;\n hold.wave = -1;\n if (hold.shelf >= 0 && k < plan.count && !hold.targets[plan.passes[k].output]) {\n const slot = plan.passes[k].output;\n hold.wave = shelves.add(layerSide(plan.slotWidth[slot]), layerSide(plan.slotHeight[slot]));\n }\n }\n const first = this.pages.length;\n for (let p = 0; p < shelves.pages; p++) {\n const page = this.pages[this.takePage(width, shelves.heights[p])];\n state.bindFramebuffer(page.framebuffer);\n state.scissor(null);\n state.colorMask(15);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n }\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n if (hold.wave >= 0) {\n const plan = hold.plan;\n const slot = plan.passes[k].output;\n this.slotOf(hold, slot, first + shelves.page[hold.wave], shelves.x[hold.wave], shelves.y[hold.wave], plan.slotWidth[slot], plan.slotHeight[slot]);\n this.notePage(hold, slot);\n }\n }\n // The passes drawing into one page together, so that it is bound once: a target drawn into\n // again, as a blur's runs take turns between two, is on an earlier wave's page.\n let left = 0;\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n hold.drawn = !(hold.shelf >= 0 && k < hold.plan.count);\n left += hold.drawn ? 0 : 1;\n }\n while (left > 0) {\n let page = -1;\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n if (hold.drawn) {\n continue;\n }\n const output = hold.targets[hold.plan.passes[k].output];\n if (page < 0) {\n page = output.index;\n }\n if (output.index === page) {\n this.filters.drawPass(hold.plan, k, hold.targets, false);\n hold.drawn = true;\n left--;\n }\n }\n }\n for (let index = levelPages; index < this.pages.length; index++) {\n const page = this.pages[index];\n if (page && !this.pageKept[index] && this.pageUntil[index] <= k) {\n this.pool.giveLayer(page);\n this.pages[index] = null;\n }\n }\n }\n for (let h = from; h < to; h++) {\n const hold = holds[h];\n if (hold.shelf >= 0) {\n hold.result = hold.targets[hold.plan.result];\n }\n }\n }\n /**\n * The width of a page for rectangles of `area` in all, the widest `widest`:\n * about square, in LAYER_STEP's steps, at most PAGE_WIDTH.\n */\n pageWidth(area, widest) {\n const square = Math.ceil(Math.sqrt(area) / LAYER_STEP) * LAYER_STEP;\n return Math.min(this.textureMost, PAGE_WIDTH, Math.max(widest, square));\n }\n /** A page of at least `width` by `height` taken for the frame: its index in `pages`. */\n takePage(width, height) {\n return this.addPage(this.pool.takeLayer(width, height), false);\n }\n /**\n * `layer` added to the frame's pages, read by no pass yet, kept for the\n * frame where `kept`: its index in `pages`.\n */\n addPage(layer, kept) {\n const index = this.pages.length;\n this.pages.push(layer);\n this.pageUntil.push(-1);\n this.pageKept.push(kept);\n return index;\n }\n /** Slot `slot` of `hold` noted on its page: read until its last pass, or kept as its output. */\n notePage(hold, slot) {\n const index = hold.targets[slot].index;\n this.pageUntil[index] = Math.max(this.pageUntil[index], hold.lastUse[slot]);\n if (slot === hold.plan.result) {\n this.pageKept[index] = true;\n }\n }\n /** The held layers' rectangles and operations (HOLD_PUSH), which the commands begin with: how many. */\n gatherHolds(commands) {\n const ops = commands.ops;\n const params = commands.params;\n const holds = this.holds;\n let count = 0;\n for (let k = 0; k < commands.length && ops[k * 4] === HOLD_PUSH; k++) {\n const from = ops[k * 4 + 1];\n let hold = holds[count];\n if (!hold) {\n hold = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n first: 0,\n end: 0,\n chain: 0,\n object: null,\n plan: new FilterPlan(),\n targets: [],\n slots: [],\n lastUse: [],\n result: null,\n shelf: -1,\n wave: -1,\n drawn: false,\n level: 0,\n };\n holds[count] = hold;\n }\n count++;\n hold.level = ops[k * 4 + 3];\n hold.x = params[from];\n hold.y = params[from + 1];\n hold.width = params[from + 2];\n hold.height = params[from + 3];\n hold.object = objectOf(params, from + 4);\n hold.first = k + 1;\n while (ops[k * 4] !== HOLD_POP) {\n k++;\n }\n hold.end = k;\n hold.chain = ops[k * 4 + 1];\n hold.result = null;\n hold.targets.length = 0;\n }\n return count;\n }\n /**\n * Slot `slot` of `hold`'s targets: the rectangle of page `index` from (x,\n * y) a target of `width` by `height` takes, as its own layer would; its\n * record kept from frame to frame.\n */\n slotOf(hold, slot, index, x, y, width, height) {\n const page = this.pages[index];\n let record = hold.slots[slot];\n if (!record) {\n record = {\n framebuffer: page.framebuffer,\n texture: page.texture,\n x,\n y,\n width,\n height,\n page,\n index,\n };\n hold.slots[slot] = record;\n }\n record.framebuffer = page.framebuffer;\n record.texture = page.texture;\n record.x = x;\n record.y = y;\n record.width = layerSide(width);\n record.height = layerSide(height);\n record.page = page;\n record.index = index;\n hold.targets[slot] = record;\n return record;\n }\n /**\n * Held layer `hold`'s draws, masks and held layers' composites into\n * `open`, bound, its stencil starting clear.\n */\n drawHoldContent(commands, hold, scene, open) {\n const state = this.state;\n const ops = commands.ops;\n const masks = this.masks;\n masks.depth = 0;\n masks.past = 0;\n state.stencil(null);\n state.colorMask(15);\n for (let k = hold.first; k < hold.end; k++) {\n const at = k * 4;\n switch (ops[at]) {\n case RUN:\n this.draws.drawRun(scene, ops[at + 1], ops[at + 1] + ops[at + 2], k);\n break;\n case STENCIL_PUSH:\n case STENCIL_POP:\n this.draws.drawMask(scene, ops[at + 1], ops[at + 1] + ops[at + 2], ops[at] === STENCIL_PUSH, masks, k);\n break;\n case HELD:\n this.draws.maskBy(masks);\n this.compositeHeld(ops[at + 1], open, ops[at + 2], ops[at + 3]);\n break;\n }\n }\n state.stencil(null);\n }\n /** Held output `held` composited onto `under`, bound, in blend mode `mode`, coloured by `row`. */\n compositeHeld(held, under, mode, row) {\n const hold = this.holds[held];\n const result = hold.result;\n if (!result) {\n return;\n }\n const open = this.heldOpen;\n open.layer = result.page;\n open.x = hold.x;\n open.y = hold.y;\n open.width = hold.width;\n open.height = hold.height;\n open.ox = result.x;\n open.oy = result.y;\n this.compositor.compositeLayer(open, under, mode, row);\n }\n /**\n * Held layer `hold`, too large for a page, drawn as a layer of its own and\n * filtered there, its output left in a page of its own.\n */\n drawHoldAlone(hold, commands, scene, filters, target) {\n const gl = this.gl;\n const state = this.state;\n const layer = this.pool.takeLayer(hold.width, hold.height, true);\n const open = {\n layer,\n msaa: this.pool.layerMsaa(layer, this.pool.frameSamples),\n x: hold.x,\n y: hold.y,\n width: hold.width,\n height: hold.height,\n };\n this.draws.drawInto(open, target);\n state.scissor(null);\n state.colorMask(15);\n state.stencil(null);\n gl.clearColor(0, 0, 0, 0);\n gl.clearStencil(0);\n gl.stencilMask(0xff);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n this.drawHoldContent(commands, hold, scene, open);\n this.pool.resolve(open, layer.width, layer.height);\n const output = this.filters.run(filters, hold.chain, layer, hold.width, hold.height, target.resolution, hold.object);\n const index = this.addPage(output, true);\n hold.result = this.slotOf(hold, 0, index, 0, 0, output.width, output.height);\n }\n /** The pages the frame took given back, as it ends. */\n givePages() {\n for (const page of this.pages) {\n if (page) {\n this.pool.giveLayer(page);\n }\n }\n this.pages.length = 0;\n this.pageUntil.length = 0;\n this.pageKept.length = 0;\n }\n}\n//# sourceMappingURL=holds.js.map","import { linkProgram, ShaderError } from \"@swf2es/context3d/device\";\nimport { CLAMP } from \"../scene.js\";\n/**\n * The first unit a kernel's own images are bound to, as many as\n * kernel-shaders.ts's KERNEL_IMAGES: past every unit the other programs\n * use (programs.ts's, and the filter passes' 4 to 6), as WebGL 2 has 32\n * for a draw's programs together.\n */\nexport const KERNEL_UNIT = 16;\n/** The most kernels' programs kept, the one used longest ago deleted for another. */\nconst KERNEL_PROGRAMS = 32;\n/**\n * The programs of Pixel Bender kernels, a ShaderFilter's, a blend\n * shader's or a shader fill's, by their fragment shaders, each a use's\n * own and so with one vertex shader:\n * linked as first used, the one used longest ago deleted past\n * KERNEL_PROGRAMS; null for one the GPU would not link, which its user\n * draws otherwise. One for the backend, which its users share.\n */\nexport class KernelPrograms {\n gl;\n state;\n programs = new Map();\n ints = new Int32Array(4);\n constructor(gl, state) {\n this.gl = gl;\n this.state = state;\n }\n /**\n * The program of `vertex` and `fragment`, in use; null where it would\n * not link. `prepare` is told it as it is linked, to set its samplers.\n */\n use(vertex, fragment, prepare) {\n const gl = this.gl;\n // By the fragment shader alone, a use's own, which a frame gives again as the same string.\n const key = fragment;\n let kernel = this.programs.get(key);\n if (kernel !== undefined) {\n // Used last now.\n this.programs.delete(key);\n }\n else {\n if (this.programs.size >= KERNEL_PROGRAMS) {\n const [oldest, old] = this.programs.entries().next().value;\n if (old) {\n gl.deleteProgram(old.program);\n }\n this.programs.delete(oldest);\n }\n kernel = null;\n try {\n const program = linkProgram(gl, vertex, fragment);\n const uniforms = new Map();\n kernel = {\n program,\n uniforms,\n told: new Map(),\n at(name) {\n let location = uniforms.get(name);\n if (location === undefined) {\n location = gl.getUniformLocation(program, name);\n uniforms.set(name, location);\n }\n return location;\n },\n };\n this.state.useProgram(program);\n prepare(program);\n }\n catch (e) {\n if (!(e instanceof ShaderError)) {\n throw e;\n }\n }\n }\n this.programs.set(key, kernel);\n if (kernel) {\n this.state.useProgram(kernel.program);\n }\n return kernel;\n }\n /** Texture `id` bound to a kernel's own image unit `k`, which its sampler at `location` names. */\n bindImage(location, k, id, host) {\n this.state.bindTexture(KERNEL_UNIT + k, host.texture(id));\n // Nearest: a float texture with a linear sampler is incomplete, and texelFetch reads either.\n this.state.bindSampler(KERNEL_UNIT + k, host.sampler(CLAMP));\n this.gl.uniform1i(location, KERNEL_UNIT + k);\n }\n /** `count` ints of `source` from `at` set as the ivec4 array at `location`, its program in use. */\n setInts(location, source, at, count) {\n let values = this.ints;\n if (count > values.length) {\n values = new Int32Array(count);\n }\n values.set(source.subarray(at, at + count));\n this.gl.uniform4iv(location, values, 0, count);\n }\n /** What readImages reads into, its records kept from call to call. */\n images = [];\n /**\n * The images of the kernel at entry `i` of `filters`, a blend shader's\n * or a shader fill's, its values laid out as a ShaderFilter's\n * (filters.ts, SHADER): -1 for what is below, -2 for the layer blended.\n * Null where a texture of its own is gone, as such a kernel is left out.\n */\n readImages(filters, i, host) {\n const v = filters.values;\n const at = filters.start[i];\n const count = v[at + 7];\n const images = this.images;\n for (let k = 0; k < count; k++) {\n const id = v[at + 9 + k * 3];\n if (id >= 0 && !host.texture(id)) {\n return null;\n }\n if (!images[k]) {\n images[k] = { texture: 0, layer: false, float: false, back: false };\n }\n const image = images[k];\n image.texture = v[at + 8 + k * 3];\n image.layer = id < 0;\n image.back = id === -1;\n image.float = v[at + 10 + k * 3] > 0;\n }\n images.length = count;\n return images;\n }\n /** The parameters and own images of the kernel at entry `i` of `filters` set on `kernel`, in use. */\n setUniforms(kernel, filters, i, host) {\n const v = filters.values;\n const at = filters.start[i];\n const count = v[at + 7];\n let unit = 0;\n for (let k = 0; k < count; k++) {\n const id = v[at + 9 + k * 3];\n if (id >= 0) {\n this.bindImage(kernel.at(`pbImage${v[at + 8 + k * 3]}`), unit++, id, host);\n }\n }\n const floats = at + 8 + count * 3;\n if (v[floats] > 0) {\n this.gl.uniform4fv(kernel.at(\"pbFloats\"), v, floats + 1, v[floats]);\n }\n const ints = filters.intStart[i];\n const n = filters.intStart[i + 1] - ints;\n if (n > 0) {\n this.setInts(kernel.at(\"pbInts\"), filters.ints, ints, n);\n }\n }\n /** Every program deleted, as the backend goes; none kept, as a lost context comes back. */\n clear() {\n for (const kernel of this.programs.values()) {\n if (kernel) {\n this.gl.deleteProgram(kernel.program);\n }\n }\n this.programs.clear();\n }\n}\n//# sourceMappingURL=kernels.js.map","import { LAYER_UNIT } from \"./programs.js\";\nimport { fittingSamples, LAYER_IDLE_FRAMES, } from \"./targets.js\";\n/**\n * The stage's own targets and their way onto the canvas: multisampled\n * buffers the canvas's size and the texture they resolve into, the layer a\n * frame that clears the stage is drawn into before an opaque canvas, and\n * the copies onto the canvas.\n */\nexport class Stage {\n gl;\n state;\n pool;\n /** The most samples the GPU takes, and whether the canvas has alpha, asked once. */\n maxSamples = 1;\n hasAlpha = false;\n /**\n * The stage's multisampled buffers, and the texture they resolve into before a canvas they may\n * not be resolved onto (present), made as first needed.\n */\n stageMsaa = null;\n stageResolved = null;\n /**\n * Whether the driver resolves the stage straight onto a canvas with alpha, found as it first does\n * (present): null till then. SwiftShader refuses it.\n */\n directResolve = null;\n /** The layer a frame that clears the stage is drawn into before an opaque canvas (stageAlpha). */\n stageLayer = null;\n constructor(gl, state, pool) {\n this.gl = gl;\n this.state = state;\n this.pool = pool;\n }\n /** Whether the canvas has alpha, as asked of the context in setUp. */\n get canvasAlpha() {\n return this.hasAlpha;\n }\n /** Nothing made yet, and the GPU and the canvas asked again, as the context comes or comes back. */\n setUp() {\n const gl = this.gl;\n this.stageMsaa = null;\n this.stageResolved = null;\n this.directResolve = null;\n this.stageLayer = null;\n this.maxSamples = gl.getParameter(gl.MAX_SAMPLES);\n this.hasAlpha = gl.getContextAttributes()?.alpha ?? false;\n }\n /**\n * The stage's multisampled pixels onto the canvas: resolved straight onto one with alpha where\n * the driver lets a resolve go there, else into a texture first, as an opaque canvas's must be, a\n * resolve keeping its format. Whether the driver lets it is found once, by the error it raises.\n */\n present(msaa) {\n const gl = this.gl;\n const { width, height } = msaa;\n if (this.hasAlpha && this.directResolve !== false) {\n const finding = this.directResolve === null;\n if (finding) {\n gl.getError();\n }\n this.toCanvas(msaa.framebuffer, width, height, false);\n if (finding) {\n this.directResolve = gl.getError() !== gl.INVALID_OPERATION;\n }\n if (this.directResolve) {\n return;\n }\n }\n const resolved = this.resolveTarget(width, height);\n this.state.bindFramebuffer(msaa.framebuffer);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, resolved.framebuffer);\n gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n this.toCanvas(resolved.framebuffer, width, height, false);\n }\n /** The texture the stage resolves into before the canvas (present), made as first needed. */\n resolveTarget(width, height) {\n if (this.stageResolved) {\n return this.stageResolved;\n }\n const gl = this.gl;\n const texture = gl.createTexture();\n this.state.bindTexture(LAYER_UNIT, texture);\n this.state.activeTexture(LAYER_UNIT);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n const framebuffer = gl.createFramebuffer();\n this.state.bindFramebuffer(framebuffer);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n this.stageResolved = { framebuffer, texture };\n return this.stageResolved;\n }\n /**\n * The first `width` by `height` pixels of `source` copied onto the canvas,\n * upside down where `flip`. Bound through the state cache first and as\n * it was after, so the cache holds what is bound, whatever it held.\n */\n toCanvas(source, width, height, flip) {\n const gl = this.gl;\n this.state.bindFramebuffer(source);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n const top = flip ? 0 : height;\n gl.blitFramebuffer(0, 0, width, height, 0, height - top, width, top, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, source);\n }\n /**\n * The layer the canvas' size a frame that clears the stage is drawn into\n * before an opaque canvas (execute): its own, kept apart from the free\n * layers so that none smaller takes it, made again for another size, let\n * go of once idle as they are.\n */\n stageAlpha(width, height) {\n const known = this.stageLayer;\n if (known && known.width === width && known.height === height) {\n known.usedAt = this.pool.frame;\n return known;\n }\n if (known) {\n this.pool.deleteLayer(known);\n }\n const layer = this.pool.makeLayer(width, height);\n this.stageLayer = layer;\n return layer;\n }\n /**\n * The stage's multisampled buffers, made again for another size or samples, their resolve's\n * texture let go of; none where it takes no samples.\n */\n stageBuffers(width, height, wanted) {\n const samples = fittingSamples(width, height, Math.min(wanted, this.maxSamples), 4);\n const known = this.stageMsaa;\n if (known && known.width === width && known.height === height && known.samples === samples) {\n return known;\n }\n this.dropStageBuffers();\n const msaa = samples > 1 ? this.pool.multisampled(width, height, samples) : null;\n if (!msaa) {\n return null;\n }\n this.stageMsaa = msaa;\n return msaa;\n }\n /** The stage's multisampled buffers and their resolve let go of, as samples or size change. */\n dropStageBuffers() {\n const gl = this.gl;\n if (this.stageMsaa) {\n this.pool.deleteMultisampled(this.stageMsaa);\n this.stageMsaa = null;\n }\n if (this.stageResolved) {\n this.state.dropTexture(this.stageResolved.texture);\n gl.deleteTexture(this.stageResolved.texture);\n gl.deleteFramebuffer(this.stageResolved.framebuffer);\n this.stageResolved = null;\n }\n }\n /** The stage's layer (stageAlpha) let go of, undrawn into for LAYER_IDLE_FRAMES. */\n dropIdleLayer() {\n const stage = this.stageLayer;\n if (stage && this.pool.frame - stage.usedAt > LAYER_IDLE_FRAMES) {\n this.pool.deleteLayer(stage);\n this.stageLayer = null;\n }\n }\n /** What the stage made on the context, deleted. */\n destroy() {\n this.dropStageBuffers();\n if (this.stageLayer) {\n this.pool.deleteLayer(this.stageLayer);\n }\n }\n}\n//# sourceMappingURL=stage.js.map","import { GlState, linkProgram } from \"@swf2es/context3d/device\";\nimport { CLEAR, COMPOSITE, FILTER, HELD, HOLD_POP, HOLD_PUSH, LAYER_POP, LAYER_PUSH, RUN, STENCIL_POP, STENCIL_PUSH, } from \"../commands.js\";\nimport { ADD, DARKEN, DIFFERENCE, HARDLIGHT, INVERT, LIGHTEN, MULTIPLY, NORMAL, OVERLAY, SCREEN, } from \"../scene.js\";\nimport { GeometryAtlas } from \"./atlas.js\";\nimport { Compositor, readsBelow } from \"./composite.js\";\nimport { Draws } from \"./draws.js\";\nimport { FilterRunner } from \"./filters.js\";\nimport { GpuTextures } from \"./gpu-textures.js\";\nimport { HeldLayers } from \"./holds.js\";\nimport { KernelPrograms } from \"./kernels.js\";\nimport { LAYER_UNIT, TEXTURE_UNIT } from \"./programs.js\";\nimport { Stage } from \"./stage.js\";\nimport { objectOf, TargetPool } from \"./targets.js\";\n/** The blend modes a flat fill may be drawn in straight onto what is below (blendDirect). */\nfunction direct(mode) {\n switch (mode) {\n case ADD:\n case SCREEN:\n case MULTIPLY:\n case LIGHTEN:\n case DARKEN:\n case DIFFERENCE:\n case OVERLAY:\n case HARDLIGHT:\n case INVERT:\n return true;\n default:\n return false;\n }\n}\n/** A triangle over the viewport, of no attributes. */\nconst OVER_VERTEX = `#version 300 es\nvoid main() {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}`;\n/** Flash's source over on whole bytes (WebGLBackend.compositeOver), both textures read at the pixel's own texel. */\nconst OVER_FRAGMENT = `#version 300 es\nprecision highp float;\nprecision highp int;\nuniform sampler2D uSource;\nuniform sampler2D uBelow;\nuniform ivec2 uAt;\nuniform bool uOpaque;\nout vec4 finalColor;\nvoid main() {\n ivec2 p = ivec2(gl_FragCoord.xy) - uAt;\n ivec4 s = ivec4(round(texelFetch(uSource, p, 0) * 255.0));\n ivec4 d = ivec4(round(texelFetch(uBelow, p, 0) * 255.0));\n ivec4 o = s.a == 255 ? s : s.a == 0 ? d : min(ivec4(255), s + ((d * (256 - s.a)) >> 8));\n if (uOpaque) {\n o.a = 255;\n }\n\n finalColor = vec4(o) / 255.0;\n}`;\nexport class WebGLBackend {\n gl;\n state;\n pool;\n stage;\n gpu;\n atlas;\n compositor;\n draws;\n holds;\n /** Pixel Bender kernels' programs, which the filters, the compositor and the draws share. */\n kernels;\n /** The filters' passes, their programs made as first run. */\n filters;\n /** The layers drawn into now, innermost last. */\n layers = [];\n /** The frame's filters being drawn, whose chains blend shaders' modes name (KERNEL). */\n frameFilters = null;\n /**\n * Samples a pixel the stage and its layers are drawn with, 1 for none:\n * Flash's anti-aliasing by the quality, as the host sets it.\n */\n samples = 1;\n /** The masks pushed on the target drawn into now (execute). */\n masks = { depth: 0, past: 0 };\n /** A layer's rectangle, as blendDirect reads it. */\n rect = { x: 0, y: 0, width: 0, height: 0 };\n /** The mask counts of the targets below the layers drawn into now, two numbers each. */\n below = [];\n /** The program `compositeOver` draws with, linked as first used; null till then and after a lost context. */\n overProgram = null;\n /** Framebuffers onto registry textures, drawn into or read, by texture id, with the texture they were made for. */\n textureFramebuffers = [];\n constructor(gl) {\n this.gl = gl;\n this.state = new GlState(gl);\n this.kernels = new KernelPrograms(gl, this.state);\n this.pool = new TargetPool(gl, this.state);\n this.stage = new Stage(gl, this.state, this.pool);\n this.gpu = new GpuTextures(gl, this.state);\n this.atlas = new GeometryAtlas(gl, this.state);\n this.compositor = new Compositor(gl, this.state, {\n filters: () => this.frameFilters,\n texture: (id) => this.gpu.textures[id] ?? null,\n sampler: (bits) => this.gpu.sampler(bits),\n }, this.kernels);\n this.draws = new Draws(gl, this.state, this.atlas, this.gpu, this.pool, {\n filters: () => this.frameFilters,\n texture: (id) => this.gpu.textures[id] ?? null,\n sampler: (bits) => this.gpu.sampler(bits),\n }, this.kernels);\n this.holds = new HeldLayers(gl, this.state, this.pool, this.draws, this.compositor, this.gpu);\n this.setUp();\n }\n /**\n * The context came back after it was lost: everything made again, every\n * geometry copied in again from the registry's arrays. The textures were\n * lost with it, which their owners add again (Textures.lost).\n */\n restore(geometries) {\n this.setUp();\n geometries.added.length = 0;\n geometries.removed.length = 0;\n geometries.updated.length = 0;\n this.atlas.repack(geometries);\n this.atlas.repackGlyphs(geometries);\n }\n /** Programs, buffers and textures made, as the context comes or comes back. */\n setUp() {\n const gl = this.gl;\n this.state.forget();\n // Kernels' programs made again as first used, the context's own gone with it.\n this.kernels.clear();\n const textureMost = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n this.draws.setUp(textureMost);\n this.compositor.setUp();\n this.filters = new FilterRunner(gl, this.state, {\n take: (width, height) => this.pool.takeLayer(width, height, true),\n give: (layer) => this.pool.giveLayer(layer),\n texture: (id) => this.gpu.textures[id] ?? null,\n sampler: (bits) => this.gpu.sampler(bits),\n }, this.kernels);\n this.holds.setUp(this.filters, textureMost);\n this.pool.setUp();\n this.layers = [];\n this.stage.setUp();\n this.atlas.setUp();\n this.gpu.setUp();\n // The context's own, gone with it.\n this.textureFramebuffers = [];\n this.overProgram = null;\n }\n /**\n * Draw a frame: what the geometries added and removed first, then the\n * rows, then the commands; onto the canvas, or into `root`, a layer the\n * target's size, as BitmapData.draw's frames go.\n */\n execute(commands, scene, rows, geometries, textures, filters, keeps, target, root = null) {\n // A frame drawn into a layer, for BitmapData, is no frame of the canvas': idle layers are\n // counted in the canvas' frames.\n const counted = root === null;\n const gl = this.gl;\n if (gl.isContextLost()) {\n return;\n }\n this.frameFilters = filters;\n this.atlas.place(geometries);\n this.gpu.uploadTextures(textures);\n for (const id of keeps.removed) {\n this.pool.release(id);\n }\n keeps.removed.length = 0;\n this.gpu.uploadRows(rows);\n this.draws.prepare(commands, scene);\n const state = this.state;\n state.scissor(null);\n state.colorMask(15);\n state.useProgram(this.draws.program);\n state.bindVertexArray(this.atlas.vertexArray);\n state.bindTexture(0, this.gpu.rowsTexture);\n // As many samples as the GPU takes; a BitmapData's frame supersamples instead, as Flash's draw\n // does. Its layers take the stage's, so that their edges are the stage's.\n const stage = root ? null : this.stage.stageBuffers(target.width, target.height, this.samples);\n // An erase or alpha blend outside any layer clears what it covers on the stage, as adl does,\n // which the blends after it read: an opaque canvas keeps no alpha, so such a frame is drawn\n // into a layer the canvas' size, then copied onto it. Multisampled buffers keep it already.\n const cleared = !root && !stage && !this.stage.canvasAlpha && commands.clearsTarget\n ? this.stage.stageAlpha(target.width, target.height)\n : null;\n const into = root ?? cleared;\n if (into) {\n // Its own stencil, for the masks drawn into it.\n this.pool.layerMsaa(into, 1);\n }\n this.pool.beginFrame(stage?.samples ?? 1);\n this.holds.drawHolds(commands, scene, filters, target);\n const canvas = {\n layer: into,\n msaa: stage,\n x: 0,\n y: 0,\n width: target.width,\n height: target.height,\n opaque: commands.opaqueStage,\n };\n this.layers.length = 0;\n this.draws.drawInto(canvas, target);\n this.draws.forgetRow();\n // The masks pushed on the target drawn into. A layer has a stencil of its own, and the\n // target below keeps its count meanwhile.\n const masks = this.masks;\n masks.depth = 0;\n masks.past = 0;\n const below = this.below;\n below.length = 0;\n state.stencil(null);\n const ops = commands.ops;\n for (let k = 0; k < commands.length; k++) {\n const at = k * 4;\n switch (ops[at]) {\n case CLEAR: {\n const p = commands.params;\n const from = ops[at + 1];\n gl.clearColor(p[from], p[from + 1], p[from + 2], p[from + 3]);\n gl.clearStencil(0);\n gl.stencilMask(0xff);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n break;\n }\n case RUN:\n this.draws.drawRun(scene, ops[at + 1], ops[at + 1] + ops[at + 2], k);\n break;\n case STENCIL_PUSH:\n case STENCIL_POP:\n this.draws.drawMask(scene, ops[at + 1], ops[at + 1] + ops[at + 2], ops[at] === STENCIL_PUSH, masks, k);\n break;\n case HOLD_PUSH:\n // Drawn ahead of the stage (drawHolds).\n while (ops[k * 4] !== HOLD_POP) {\n k++;\n }\n break;\n case HELD:\n this.draws.maskBy(masks);\n this.holds.compositeHeld(ops[at + 1], this.layers.at(-1) ?? canvas, ops[at + 2], ops[at + 3]);\n break;\n case LAYER_PUSH: {\n if (this.blendDirect(commands, k, scene, canvas)) {\n // Its run and its pop with it.\n k += 2;\n break;\n }\n below.push(masks.depth, masks.past);\n masks.depth = 0;\n masks.past = 0;\n const p = commands.params;\n const from = ops[at + 1];\n const width = p[from + 2];\n const height = p[from + 3];\n const filtered = ops[at + 2] === 1;\n // A filtered one of the size its filters' targets take for it, which they read alike.\n const layer = this.pool.takeLayer(width, height, filtered);\n const open = {\n layer,\n msaa: this.pool.layerMsaa(layer, this.pool.frameSamples),\n x: p[from],\n y: p[from + 1],\n width,\n height,\n object: objectOf(p, from + 4),\n };\n this.layers.push(open);\n this.draws.drawInto(open, target);\n state.stencil(null);\n state.colorMask(15);\n gl.clearColor(0, 0, 0, 0);\n gl.clearStencil(0);\n gl.stencilMask(0xff);\n // Its rectangle alone, as a layer taken may be larger, unless filters read past it, as far\n // as they read.\n state.scissor(filtered ? [0, 0, layer.width, layer.height] : [0, 0, width, height]);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n state.scissor(null);\n break;\n }\n case FILTER: {\n const open = this.layers.at(-1);\n if (open?.layer) {\n state.stencil(null);\n // Whole, as the filters read past its rectangle.\n this.pool.resolve(open, open.layer.width, open.layer.height);\n open.layer = this.filters.run(filters, ops[at + 1], open.layer, open.width, open.height, target.resolution, open.object);\n }\n break;\n }\n case LAYER_POP: {\n const open = this.layers.pop();\n masks.past = below.pop();\n masks.depth = below.pop();\n this.pool.resolve(open, open.width, open.height);\n const under = this.layers.at(-1) ?? canvas;\n this.draws.drawInto(under, target);\n // Composited where the masks on the target below let it be.\n this.draws.maskBy(masks);\n this.compositor.compositeLayer(open, under, ops[at + 1], ops[at + 2]);\n const keep = ops[at + 3];\n if (keep >= 0) {\n // Kept for the frames after, the output kept before given back.\n this.pool.keep(keep, open.layer);\n }\n else {\n this.pool.giveLayer(open.layer);\n }\n break;\n }\n case COMPOSITE: {\n const p = commands.params;\n const from = ops[at + 1];\n const layer = this.pool.keptLayer(p[from + 4]);\n if (layer) {\n const kept = {\n layer,\n msaa: null,\n x: p[from],\n y: p[from + 1],\n width: p[from + 2],\n height: p[from + 3],\n };\n this.draws.maskBy(masks);\n this.compositor.compositeLayer(kept, this.layers.at(-1) ?? canvas, ops[at + 2], ops[at + 3]);\n }\n break;\n }\n }\n }\n state.stencil(null);\n if (canvas.msaa) {\n this.stage.present(canvas.msaa);\n }\n if (cleared) {\n // Its rows run down, the canvas' up.\n this.stage.toCanvas(cleared.framebuffer, target.width, target.height, true);\n }\n this.holds.givePages();\n if (counted) {\n // The free layers, and the stage's (stageAlpha), undrawn into for LAYER_IDLE_FRAMES let go of.\n this.stage.dropIdleLayer();\n this.pool.endFrame();\n }\n }\n /**\n * A frame drawn into a layer `samples` times the size of a `width` by\n * `height` bitmap a side, as `execute` draws, then halved till a sample a\n * pixel, and read back: premultiplied RGBA bytes, a row at a time from\n * the top, as BitmapData.draw takes them.\n */\n snapshot(commands, scene, rows, geometries, textures, filters, keeps, target, width, height, samples) {\n const gl = this.gl;\n const bytes = new Uint8Array(width * height * 4);\n if (gl.isContextLost()) {\n return bytes;\n }\n const layer = this.drawSampled(commands, scene, rows, geometries, textures, filters, keeps, target, width, height, samples);\n this.state.bindFramebuffer(layer.framebuffer);\n gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, bytes);\n this.pool.giveLayer(layer);\n return bytes;\n }\n /**\n * BitmapData.draw on the GPU: the commands drawn as `snapshot` draws\n * them, into a layer of their own (the object may show the texture\n * itself), then over texture `id` of the registry at (x, y), as Flash's\n * store composites source over (compositeOver), where it stays: nothing\n * is read back; `opaque` for an opaque store's texture. Pending\n * textures, the one drawn into among them, are uploaded first. Whether\n * it was drawn; not on a lost context or without the texture.\n */\n drawIntoTexture(commands, scene, rows, geometries, textures, filters, keeps, target, width, height, samples, id, x, y, opaque) {\n const gl = this.gl;\n if (gl.isContextLost()) {\n return false;\n }\n const layer = this.drawSampled(commands, scene, rows, geometries, textures, filters, keeps, target, width, height, samples);\n const into = this.textureFramebuffer(id);\n if (into) {\n this.compositeOver(layer, into, x, y, width, height, opaque);\n }\n this.pool.giveLayer(layer);\n return into !== null;\n }\n /**\n * `layer`'s first `width` by `height` texels over those of `into` at\n * (x, y), as Flash's store composites source over, a channel at a time\n * on whole bytes: s + ((d * (256 - sa)) >> 8), at most 255, a source of\n * alpha 255 put as it is and one of 0 leaving what was there; an opaque\n * store's alpha 255 after. GL's own blending rounds where Flash floors,\n * a level apart: the destination's rectangle is copied into a layer of\n * its own first, and both read exactly.\n */\n compositeOver(layer, into, x, y, width, height, opaque) {\n const gl = this.gl;\n const state = this.state;\n state.scissor(null);\n const below = this.pool.takeLayer(width, height);\n this.blit(into, x, y, below.framebuffer, 0, 0, width, height);\n const over = this.overProgramMade();\n state.bindFramebuffer(into);\n state.viewport(x, y, width, height);\n state.colorMask(15);\n state.stencil(null);\n state.setBlend(null);\n state.useProgram(over.program);\n state.bindVertexArray(null);\n const nearest = this.gpu.sampler(0);\n state.bindTexture(TEXTURE_UNIT, layer.texture);\n state.bindSampler(TEXTURE_UNIT, nearest);\n state.bindTexture(LAYER_UNIT, below.texture);\n state.bindSampler(LAYER_UNIT, nearest);\n gl.uniform2i(over.at, x, y);\n gl.uniform1i(over.opaque, opaque ? 1 : 0);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n this.pool.giveLayer(below);\n }\n /** compositeOver's program, linked as first asked for. */\n overProgramMade() {\n if (this.overProgram) {\n return this.overProgram;\n }\n const gl = this.gl;\n const program = linkProgram(gl, OVER_VERTEX, OVER_FRAGMENT);\n this.state.useProgram(program);\n gl.uniform1i(gl.getUniformLocation(program, \"uSource\"), TEXTURE_UNIT);\n gl.uniform1i(gl.getUniformLocation(program, \"uBelow\"), LAYER_UNIT);\n this.overProgram = {\n program,\n at: gl.getUniformLocation(program, \"uAt\"),\n opaque: gl.getUniformLocation(program, \"uOpaque\"),\n };\n return this.overProgram;\n }\n /**\n * Texture `id`'s `width` by `height` texels read back, premultiplied RGBA\n * row by row; null on a lost context or without the texture.\n */\n readTexture(id, width, height) {\n const framebuffer = this.gl.isContextLost() ? null : this.textureFramebuffer(id);\n if (!framebuffer) {\n return null;\n }\n const bytes = new Uint8Array(width * height * 4);\n this.state.bindFramebuffer(framebuffer);\n this.gl.readPixels(0, 0, width, height, this.gl.RGBA, this.gl.UNSIGNED_BYTE, bytes);\n return bytes;\n }\n /**\n * Texture `id`'s `width` by `height` texels at (x, y) cleared to `pixel`,\n * premultiplied ARGB, which comes back exactly; false on a lost context\n * or without the texture.\n */\n fillTexture(textures, id, x, y, width, height, pixel) {\n const gl = this.gl;\n this.gpu.uploadTextures(textures);\n const framebuffer = gl.isContextLost() ? null : this.textureFramebuffer(id);\n if (!framebuffer) {\n return false;\n }\n this.state.bindFramebuffer(framebuffer);\n this.state.colorMask(15);\n this.state.scissor([x, y, width, height]);\n gl.clearColor(((pixel >>> 16) & 0xff) / 255, ((pixel >>> 8) & 0xff) / 255, (pixel & 0xff) / 255, (pixel >>> 24) / 255);\n gl.clear(gl.COLOR_BUFFER_BIT);\n this.state.scissor(null);\n return true;\n }\n /**\n * Texture `from`'s `width` by `height` texels at (x, y) copied to (dx, dy)\n * of texture `to`, replacing what was there: as a memmove where they are\n * one texture, through a layer of its own, as a texture copied into\n * itself is GL's feedback loop. Pending textures are uploaded first.\n * False on a lost context or without either texture.\n */\n copyTexture(textures, from, x, y, width, height, to, dx, dy) {\n const gl = this.gl;\n this.gpu.uploadTextures(textures);\n const source = gl.isContextLost() ? null : this.textureFramebuffer(from);\n const target = source ? this.textureFramebuffer(to) : null;\n if (!source || !target) {\n return false;\n }\n this.state.scissor(null);\n if (from !== to) {\n this.blit(source, x, y, target, dx, dy, width, height);\n return true;\n }\n const between = this.pool.takeLayer(width, height);\n this.state.bindFramebuffer(between.framebuffer);\n gl.invalidateSubFramebuffer(gl.FRAMEBUFFER, [gl.COLOR_ATTACHMENT0], 0, 0, width, height);\n this.blit(source, x, y, between.framebuffer, 0, 0, width, height);\n this.blit(between.framebuffer, 0, 0, target, dx, dy, width, height);\n this.pool.giveLayer(between);\n return true;\n }\n /** `width` by `height` texels at (x, y) of `from` blitted to (dx, dy) of `to`, the state cache's binding `to` after. */\n blit(from, x, y, to, dx, dy, width, height) {\n const gl = this.gl;\n this.state.bindFramebuffer(to);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, from);\n gl.blitFramebuffer(x, y, x + width, y + height, dx, dy, dx + width, dy + height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n // Bound as the state cache has it.\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, to);\n }\n /** A framebuffer onto texture `id`, made as first asked for; null for an id of no texture. */\n textureFramebuffer(id) {\n const gl = this.gl;\n const texture = this.gpu.textures[id] ?? null;\n const known = this.textureFramebuffers[id] ?? null;\n if (known?.texture === texture) {\n return known.framebuffer;\n }\n // The id names another texture now: its framebuffer goes with the one it was made for.\n if (known) {\n gl.deleteFramebuffer(known.framebuffer);\n this.textureFramebuffers[id] = null;\n }\n if (!texture) {\n return null;\n }\n const framebuffer = gl.createFramebuffer();\n this.state.bindFramebuffer(framebuffer);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n this.textureFramebuffers[id] = { texture, framebuffer };\n return framebuffer;\n }\n /**\n * A 3D object's bitmap drawn (PLANE): the commands, as `execute` draws\n * them, into a layer `samples` times the size of a `width` by `height`\n * bitmap a side, halved till a sample a texel, and kept as kept output\n * `keep` (Keeps), the one kept before given back. Called as the frame is\n * walked, before its own commands are drawn, which composite it.\n */\n drawPlane(keep, commands, scene, rows, geometries, textures, filters, keeps, target, width, height, samples) {\n const gl = this.gl;\n if (gl.isContextLost()) {\n return;\n }\n const layer = this.drawSampled(commands, scene, rows, geometries, textures, filters, keeps, target, width, height, samples);\n // Clear past the bitmap, which a layer taken may be larger than: its quad's smoothing reads\n // half a texel past its edges.\n this.state.bindFramebuffer(layer.framebuffer);\n this.state.stencil(null);\n this.state.colorMask(15);\n gl.clearColor(0, 0, 0, 0);\n for (const [x, y, w, h] of [\n [width, 0, layer.width - width, layer.height],\n [0, height, width, layer.height - height],\n ]) {\n if (w > 0 && h > 0) {\n this.state.scissor([x, y, w, h]);\n gl.clear(gl.COLOR_BUFFER_BIT);\n }\n }\n this.state.scissor(null);\n this.pool.keep(keep, layer);\n }\n /**\n * The commands drawn, as `execute` draws them, into a layer `samples`\n * times the size of a `width` by `height` bitmap a side, halved till a\n * sample a pixel: the layer, its first `width` by `height` the bitmap.\n */\n drawSampled(commands, scene, rows, geometries, textures, filters, keeps, target, width, height, samples) {\n let layer = this.pool.takeLayer(width * samples, height * samples);\n this.execute(commands, scene, rows, geometries, textures, filters, keeps, target, layer);\n for (let k = samples; k > 1; k /= 2) {\n const half = this.filters.halve(layer, (width * k) / 2, (height * k) / 2);\n this.pool.giveLayer(layer);\n layer = half;\n }\n return layer;\n }\n /** Advanced text's outlines uploaded (GpuTextures.uploadOutlines). */\n uploadOutlines(data, count, epoch) {\n this.gpu.uploadOutlines(data, count, epoch);\n }\n /** What the backend made on the context, deleted. */\n destroy() {\n this.draws.destroy();\n this.atlas.destroy();\n this.compositor.destroy();\n this.filters.destroy();\n this.kernels.clear();\n for (const open of this.layers) {\n if (open.layer) {\n this.pool.deleteLayer(open.layer);\n }\n }\n this.pool.destroy();\n this.stage.destroy();\n for (const known of this.textureFramebuffers) {\n if (known) {\n this.gl.deleteFramebuffer(known.framebuffer);\n }\n }\n this.textureFramebuffers = [];\n if (this.overProgram) {\n this.gl.deleteProgram(this.overProgram.program);\n this.overProgram = null;\n }\n this.gpu.destroy();\n this.state.forget();\n }\n /**\n * The layer pushed at command `k` drawn straight onto the target below,\n * if it may be: unfiltered and not kept, one run of a flat fill alone\n * (Draws.blendable) drawn normally in it, and a mode whose blend of the\n * fill pixel by pixel, its edges covering the pixels in part, is that\n * of the layer's pixels covered alike, as each is linear in what covers it\n * (add short of its sums' clamp); its colour on the quad's. A layer and its\n * resolve and composite left out, what reads what is below copies it as\n * the composite would. Whether it was.\n */\n blendDirect(commands, k, scene, canvas) {\n const ops = commands.ops;\n const at = k * 4;\n const run = at + 4;\n const pop = at + 8;\n if (k + 2 >= commands.length ||\n ops[at + 2] !== 0 ||\n ops[run] !== RUN ||\n ops[run + 2] !== 1 ||\n ops[run + 3] !== NORMAL ||\n ops[pop] !== LAYER_POP ||\n ops[pop + 3] >= 0 ||\n !direct(ops[pop + 1]) ||\n !this.draws.blendable(scene, ops[run + 1])) {\n return false;\n }\n const p = commands.params;\n const from = ops[at + 1];\n const under = this.layers.at(-1) ?? canvas;\n const rect = this.rect;\n rect.x = p[from];\n rect.y = p[from + 1];\n rect.width = p[from + 2];\n rect.height = p[from + 3];\n const mode = ops[pop + 1];\n const compositor = this.compositor;\n if (!compositor.cover(rect, under)) {\n return true;\n }\n // Drawn into already, as a kept output is composited (COMPOSITE); a copy of what is below\n // binds its framebuffer back.\n const reads = readsBelow(mode, under.opaque);\n const back = reads && compositor.copyBelow(under);\n this.draws.maskBy(this.masks);\n const place = compositor.place;\n // Kept to the layer's rectangle, as the composite is, past which nothing below is copied.\n this.state.scissor([place.fx, place.fy, place.width, place.height]);\n this.draws.drawBlended(scene, ops[run + 1], mode, reads, ops[pop + 2], back ? place.backX : 0, back ? place.backY : 0);\n this.state.scissor(null);\n return true;\n }\n}\n//# sourceMappingURL=backend.js.map","/**\n * `m`'s stretch, without its turn or mirror: m is a rotation or a mirror\n * times this symmetric stretch, and a line scaled both ways is as wide\n * through either (screenWidth reads |m's columns' sum|, which no rotation\n * changes), so its lines are the same stroked through the stretch alone\n * and then turned. A limb that turns on every frame of a loop, a spinning\n * particle squashed one way, every mirror and every instance alike then\n * share the lines of one context, where each angle was tessellated anew.\n * Rounded, so that one stretch has one key however its turn rounded it;\n * null where m flattens everything, or nearly, where rounding would.\n */\nexport function stretchOf(m, out) {\n const a = m[0];\n const b = m[1];\n const c = m[2];\n const d = m[3];\n // S = sqrt(mᵀm), in closed form for 2 by 2.\n const p = a * a + b * b;\n const q = c * c + d * d;\n const r = a * c + b * d;\n const det = Math.abs(a * d - b * c);\n const t = Math.sqrt(p + q + 2 * det);\n if (det === 0 || t === 0) {\n return null;\n }\n const off = roundStretch(r, t);\n const a2 = roundStretch(p + det, t);\n const d2 = roundStretch(q + det, t);\n // Near collapse, a scale of a few 65536ths rounds away, and the lines with it.\n const rounded = Math.abs(a2 * d2 - off * off);\n if (Math.abs(rounded - det) > 1e-3 * det) {\n return null;\n }\n // Into `out` where given: a turn each frame then makes no array to compare.\n const stretch = out ?? [0, 0, 0, 0];\n stretch[0] = a2;\n stretch[1] = off;\n stretch[2] = off;\n stretch[3] = d2;\n return stretch;\n}\nconst roundStretch = (x, t) => Math.round((x / t) * 65536) / 65536;\n/**\n * How far, in pixels of the screen, a line's edge may stand from where its\n * own stretch puts it when stroked through a nearby one on the grid\n * (settledStretch): a twentieth of a pixel, a twip, for a hairline, whose\n * width the stretch does not change; a wider line's width moves with the\n * stretch as well as its stroke, and its edges up to twice as far. A\n * fiftieth gave a hairline a step of 1/64 of its scale, and a crowded\n * room's hairlines, scaled a little more or less on each frame by their\n * tweens, a stretch of their own on most frames: nine in ten lines stroked\n * anew each frame were such hairlines.\n */\nconst EDGE_SLACK = 0.05;\n/**\n * How far, in pixels of the screen, a line's edge may stand from its own\n * stretch's place when stroked through an even one (settledStretch): two\n * twips, a tenth of a pixel. A part that turns inside a parent scaled a\n * little unevenly, as a limb in a squashed body, has a stretch that turns\n * with it, a new one each frame, and its lines were tessellated each frame;\n * stroked through one even scale, every angle shares them.\n */\nconst EVEN_SLACK = 0.1;\n/** The coarsest step of the stretches' grid, a hairline's: about 6% of a scale. */\nconst COARSEST_STEP = 1 / 16;\n/** The finest: a line wider than this allows is stroked through its own stretch. */\nconst FINEST_STEP = 1 / 4096;\n/**\n * The stretch `s` (stretchOf's, symmetric with a positive determinant)\n * moved to the nearest point of a grid, `widest` the width of its widest\n * line in twips and `least` a pixel of the screen; or `s` itself. A tween\n * that scales a little on every frame, a character that breathes, gave\n * each frame a stretch of its own, and its lines were tessellated again\n * on every frame of every loop, faster than the cache could keep them; the\n * grid gives such a pulse a few. Lines stroked through the grid's stretch\n * and taken back through its inverse (strokeFrame) follow the shape's path\n * exactly; only their width and joins see the small difference between\n * the two stretches, s q⁻¹'s from the identity, which the grid keeps under\n * EDGE_SLACK of a pixel at their edges. The grid is on the stretch's\n * logarithm, a symmetric matrix whose entries measure scale and shear\n * alike, in a step that is a power of two, so that stretches settled alike\n * share their contexts; one it would move further than a step, as it may\n * one that squashes nearly flat, is its own.\n */\nexport function settledStretch(s, widest, least, out) {\n // s = mean I + N, N = [[half, off], [off, -half]], N² = r² I: its scales are mean ± r, along\n // the axes P± = (I ± N / r) / 2 project on.\n const mean = (s[0] + s[3]) / 2;\n const half = (s[0] - s[3]) / 2;\n const off = s[1];\n const r = Math.sqrt(half * half + off * off);\n if (!(mean - r > 0)) {\n return s;\n }\n // Nearly even: stroked through the even stretch of the same area, k, which no turn changes,\n // and taken back through its inverse, a line is as wide as k makes it times what s q⁻¹ = s / k\n // stretches each way, between the smaller scale over k and the larger. Through s itself it is\n // one width all along, somewhere in that span as screenWidth reads s at its angle; its edges\n // share the difference, which must stay within the slack at every angle, so that a part\n // turning does not flip between the even stretch and its own. A hairline, a pixel wide however\n // small its scale, stretches with s / k as any line: a part squashed far keeps its own.\n if (r > 0) {\n const k = Math.sqrt((mean + r) * (mean - r));\n const stroked = Math.max(least, (widest / 20) * k);\n if ((stroked * 2 * r) / k <= 2 * EVEN_SLACK * least) {\n const even = out ?? [0, 0, 0, 0];\n even[0] = k;\n even[1] = 0;\n even[2] = 0;\n even[3] = k;\n return settledStretch(even, widest, least, even);\n }\n }\n // Half the widest line's width on the screen, at most as the larger scale makes it, times the\n // step must stay under the slack.\n const width = Math.max(least, (widest / 20) * (mean + r));\n const most = Math.min(COARSEST_STEP, (2 * EDGE_SLACK * least) / width);\n if (!(most >= FINEST_STEP)) {\n return s;\n }\n const step = 2 ** Math.floor(Math.log2(most));\n // Its logarithm, ln(mean + r) P+ + ln(mean - r) P-, is α I + β N; its entries go on the grid.\n const large = Math.log(mean + r);\n const small = Math.log(mean - r);\n const alpha = (large + small) / 2;\n const beta = r === 0 ? 1 / mean : (large - small) / (2 * r);\n const l11 = Math.round((alpha + beta * half) / step) * step;\n const l22 = Math.round((alpha - beta * half) / step) * step;\n const l12 = Math.round((beta * off) / step) * step;\n // And back: the grid's α' I + N', N'² = ρ² I, is e^(α' + ρ) P'+ + e^(α' - ρ) P'-.\n const h = (l11 - l22) / 2;\n const rho = Math.sqrt(h * h + l12 * l12);\n const up = Math.exp((l11 + l22) / 2 + rho);\n const down = Math.exp((l11 + l22) / 2 - rho);\n const across = rho === 0 ? 0 : (up - down) / (2 * rho);\n const q0 = (up + down) / 2 + across * h;\n const q1 = across * l12;\n const q3 = (up + down) / 2 - across * h;\n // s q⁻¹ near the identity, within a step by its norm, the most it stretches any direction: the\n // edges, half the widest line from the path, within the slack of their place. (Each entry\n // within a step alone let an edge stray to nearly twice that, 0.036 of a pixel measured.)\n const qDet = q0 * q3 - q1 * q1;\n const e0 = (s[0] * q3 - s[2] * q1) / qDet;\n const e1 = (s[1] * q3 - s[3] * q1) / qDet;\n const e2 = (s[2] * q0 - s[0] * q1) / qDet;\n const e3 = (s[3] * q0 - s[1] * q1) / qDet;\n // The spectral norm of D = s q⁻¹ - I: the root of the larger eigenvalue of DᵀD.\n const d0 = e0 - 1;\n const d3 = e3 - 1;\n const frobenius = d0 * d0 + e1 * e1 + e2 * e2 + d3 * d3;\n const det = d0 * d3 - e1 * e2;\n const norm = Math.sqrt((frobenius + Math.sqrt(Math.max(0, frobenius * frobenius - 4 * det * det))) / 2);\n if (!(norm <= step)) {\n return s;\n }\n // Into `out` where given, which may be `s`, as stretchOf's: a move each frame then makes no\n // array to compare.\n const q = out ?? [0, 0, 0, 0];\n q[0] = q0;\n q[1] = q1;\n q[2] = q1;\n q[3] = q3;\n return q;\n}\n/** The width of the layer's widest line, in twips. */\nfunction widestLine(layer) {\n let widest = 0;\n for (const { line } of layer.strokes) {\n widest = Math.max(widest, line.width);\n }\n return widest;\n}\n/** Whether every line of the layer scales both ways, whose width no rotation changes; one scaled one way alone turns with it. */\nexport function scalesEvenly(layer) {\n // A loop, not every() with a closure: a crowd's shapes ask on every frame.\n for (let i = 0; i < layer.strokes.length; i++) {\n const line = layer.strokes[i].line;\n if (line.noHScale || line.noVScale) {\n return false;\n }\n }\n return true;\n}\n/**\n * What a layer brings to the width its object's stretch is settled for\n * (settledStretch): its widest line, in twips, where its lines all scale\n * both ways; else nothing. An object's is the most of its layers'.\n */\nexport function evenWidth(layer) {\n return layer.strokes.length > 0 && scalesEvenly(layer) ? widestLine(layer) : 0;\n}\n//# sourceMappingURL=stretch.js.map","import { CURVE, LINE, MOVE, shapeLayers } from \"../display/shapes.js\";\n/** Most table entries a text's uniforms hold. */\nexport const ENTRIES = 48;\n/**\n * Chords a curve is cut into stray from it by this fraction of the em at\n * most: a 2048th, a hundredth of a pixel at 20 pixels, and few chords.\n */\nconst TOLERANCE = 2048;\n/** Segments to a row of the store's texture. */\nexport const ROW = 1024;\n/** The most segments kept: 16 bytes each, 16 MB. Past it the store starts again. */\nexport const MOST = ROW * 1024;\n/**\n * The most segments a glyph may have: every pixel of its quad goes through\n * them all, so a glyph past this is drawn as normal text is.\n */\nexport const GLYPH_MOST = 2048;\n/**\n * The most a field may ask of the shader, its glyphs' segments times the\n * pixels of their quads: past it, the field is drawn as normal text, so\n * that no SWF has the GPU go through millions of segments a pixel.\n */\nexport const FIELD_BUDGET = 2 ** 25;\n/** Floats a vertex: its position 2, then its origin, glyph, run and colour 4 each. */\nexport const STRIDE = 18;\n/**\n * The glyphs' outlines as segments, in the font's units over 20 (as\n * shapeLayers reads them), each glyph's a run of its own: added as a glyph\n * is first drawn, kept until the store is full, when it starts again. Its\n * `resets` count those, after which every glyph's run is another; its\n * `epoch` moves on with each, and as it grows, for a renderer to upload it\n * whole.\n */\nexport const store = {\n data: new Float32Array(ROW * 4 * 16),\n used: 0,\n epoch: 0,\n resets: 0,\n};\n/**\n * Whether a full store may start again as a glyph is reserved: not while\n * the renderer of swf2es's own walks a frame, whose texts drawn before\n * would then name runs let go of; it starts the store again between frames\n * instead, and a text that finds it full meanwhile is drawn as normal text.\n */\nlet resetsAllowed = true;\nexport function allowResets(allowed) {\n resetsAllowed = allowed;\n}\n/** What a glyph of more segments than GLYPH_MOST is known by, so that it is not cut again. */\nconst TOO_MANY = { start: 0, count: 0, xMin: 0, yMin: 0, xMax: 0, yMax: 0 };\n/** Each glyph's outline in the store as it now is; null for an empty one. */\nlet outlines = new WeakMap();\n/** Start the store again: every outline is cut again on its next draw. */\nexport function resetSegments() {\n store.used = 0;\n store.epoch++;\n store.resets++;\n outlines = new WeakMap();\n}\n/** The store let go of, back to its first size, as the last view that draws from it goes. */\nfunction freeSegments() {\n resetSegments();\n store.data = new Float32Array(ROW * 4 * 16);\n}\n/** The views that draw from the store, by which it is kept. */\nlet holders = 0;\n/** The store kept for a view, till the view lets go of it by what this returns: it goes with the last. */\nexport function holdSegments() {\n holders++;\n let held = true;\n return () => {\n if (held) {\n held = false;\n holders--;\n if (holders === 0) {\n freeSegments();\n }\n }\n };\n}\n/** How many segments the store holds, for tests. */\nexport function segmentsUsed() {\n return store.used;\n}\n/** Room for `count` more segments, the store grown to hold them: false past MOST. */\nfunction room(count) {\n const used = store.used;\n if (used + count > MOST) {\n return false;\n }\n if ((used + count) * 4 > store.data.length) {\n let length = store.data.length;\n while ((used + count) * 4 > length) {\n length *= 2;\n }\n const grown = new Float32Array(length);\n grown.set(store.data.subarray(0, used * 4));\n store.data = grown;\n store.epoch++;\n }\n return true;\n}\n/**\n * A glyph's outline cut into segments, its curves into chords that stray\n * from them by `tolerance` at most, as x0 y0 x1 y1 each.\n */\nexport function chordsOf(glyph, tolerance) {\n const shape = {\n id: 0,\n bounds: { xMin: 0, xMax: 0, yMin: 0, yMax: 0 },\n edgeBounds: null,\n fills: [{ type: \"solid\", color: 0xffffffff }],\n lines: [],\n records: glyph.records,\n truncated: false,\n };\n const layers = shapeLayers(shape);\n const points = [];\n const contours = layers.length > 0 ? layers[0].fills.flatMap((f) => f.contours) : [];\n for (const path of contours) {\n let x = 0;\n let y = 0;\n let startX = 0;\n let startY = 0;\n for (let i = 0; i < path.length;) {\n switch (path[i]) {\n case MOVE:\n if (x !== startX || y !== startY) {\n points.push(x, y, startX, startY);\n }\n x = startX = path[i + 1];\n y = startY = path[i + 2];\n i += 3;\n break;\n case LINE:\n points.push(x, y, path[i + 1], path[i + 2]);\n x = path[i + 1];\n y = path[i + 2];\n i += 3;\n break;\n case CURVE: {\n const cx = path[i + 1];\n const cy = path[i + 2];\n const ax = path[i + 3];\n const ay = path[i + 4];\n // A quadratic strays from its chords of a nth of it by |p0 - 2c + p1| / 4n² at most.\n const bend = Math.hypot(x - 2 * cx + ax, y - 2 * cy + ay);\n const n = Math.max(1, Math.min(64, Math.ceil(Math.sqrt(bend / (4 * tolerance)))));\n let px = x;\n let py = y;\n for (let k = 1; k <= n; k++) {\n const t = k / n;\n const u = 1 - t;\n const qx = u * u * x + 2 * u * t * cx + t * t * ax;\n const qy = u * u * y + 2 * u * t * cy + t * t * ay;\n points.push(px, py, qx, qy);\n px = qx;\n py = qy;\n }\n x = ax;\n y = ay;\n i += 5;\n break;\n }\n default:\n // A cubic, which no glyph has.\n i += 7;\n }\n }\n if (x !== startX || y !== startY) {\n points.push(x, y, startX, startY);\n }\n }\n return points;\n}\n/**\n * A glyph's outline in the store, cut on its first draw: null for an empty\n * glyph, undefined for one of more segments than GLYPH_MOST or past the\n * store's room.\n */\nfunction outlineOf(glyph, tolerance) {\n const known = outlines.get(glyph);\n if (known !== undefined) {\n return known === TOO_MANY ? undefined : known;\n }\n const points = chordsOf(glyph, tolerance);\n const count = points.length / 4;\n if (count === 0) {\n outlines.set(glyph, null);\n return null;\n }\n if (count > GLYPH_MOST) {\n outlines.set(glyph, TOO_MANY);\n return undefined;\n }\n if (!room(count)) {\n return undefined;\n }\n const outline = {\n start: store.used,\n count,\n xMin: Number.POSITIVE_INFINITY,\n yMin: Number.POSITIVE_INFINITY,\n xMax: Number.NEGATIVE_INFINITY,\n yMax: Number.NEGATIVE_INFINITY,\n };\n for (let i = 0; i < points.length; i += 2) {\n outline.xMin = Math.min(outline.xMin, points[i]);\n outline.xMax = Math.max(outline.xMax, points[i]);\n outline.yMin = Math.min(outline.yMin, points[i + 1]);\n outline.yMax = Math.max(outline.yMax, points[i + 1]);\n }\n store.data.set(points, store.used * 4);\n store.used += count;\n outlines.set(glyph, outline);\n return outline;\n}\n/** The corners of a glyph's quad, as signs: the margin goes out from it so. */\nconst CORNERS = [-1, -1, 1, -1, 1, 1, -1, 1];\n/** The vertices a builder writes, reused by the next: builders build one at a time. */\nlet scratch = new Float32Array(STRIDE * 4 * 64);\n/** Indices of quads in order, two triangles each: views of one array, which only grows. */\nlet quads = new Uint32Array(0);\n/** The indices of `count` quads of four vertices each, in order. */\nexport function quadIndices(count) {\n if (quads.length < count * 6) {\n const n = Math.max(count, quads.length / 3);\n quads = new Uint32Array(n * 6);\n for (let i = 0; i < n; i++) {\n const v = i * 4;\n const at = i * 6;\n quads[at] = v;\n quads[at + 1] = v + 1;\n quads[at + 2] = v + 2;\n quads[at + 3] = v;\n quads[at + 4] = v + 2;\n quads[at + 5] = v + 3;\n }\n }\n return quads.subarray(0, count * 6);\n}\n/** The finite value of `v`, 0 for NaN or an infinity, as a field's settings reach the shader. */\nconst finite = (v) => (Number.isFinite(v) ? v : 0);\n/** The table's furthest cutoff from the outline, in pixels. */\nfunction reachOf(table) {\n let reach = 0;\n for (let i = 0; i < table.length; i += 3) {\n reach = Math.max(reach, Math.abs(table[i + 1]), Math.abs(table[i + 2]));\n }\n return reach;\n}\n/**\n * The glyphs of a text drawn with advanced anti-aliasing: each glyph first\n * reserved (reserve), which cuts its outline and counts what it asks of\n * the shader, then, if all fit, added (add), and the quads taken (built).\n * One builds at a time: they share the vertices they write.\n */\nexport class GlyphQuads {\n grid;\n scale;\n glyphs = 0;\n tables = [];\n starts = [];\n entries = 0;\n cost = 0;\n thickness;\n sharpness;\n /** The epoch the reserved glyphs' outlines are of. */\n reserved = store.epoch;\n constructor(\n /** 0 none, 1 pixel, 2 subpixel. */\n grid, thickness, sharpness, \n /** Flash's pixels to a pixel of the text, as it is placed now, for the quads' reach and cost. */\n scale) {\n this.grid = grid;\n this.scale = scale;\n this.thickness = finite(thickness);\n this.sharpness = finite(sharpness);\n }\n /** Flash's pixels the shader may reach past the outline, at `size` pixels to the em, by `tables`. */\n reach(size, tables) {\n const ppem = size * this.scale;\n const moved = 0.0001 * ppem * (Math.abs(this.thickness) + Math.abs(this.sharpness) / 2);\n // And a pixel round, and two for the pen's snapping.\n return Math.max(reachOf(tables[0]), reachOf(tables[1])) + moved + 3;\n }\n /**\n * Cut a glyph of a font of `em` units and count it at `size` pixels to the\n * em: false where the text cannot be drawn so, a glyph past GLYPH_MOST\n * or the field past FIELD_BUDGET, for the whole text to be drawn as\n * normal text. The store may start again here: reserving every glyph\n * then goes again (intact).\n */\n reserve(glyph, em, size, tables) {\n const units = em / 20;\n let outline = outlineOf(glyph, units / TOLERANCE);\n if (outline === undefined && outlines.get(glyph) !== TOO_MANY && resetsAllowed) {\n resetSegments();\n outline = outlineOf(glyph, units / TOLERANCE);\n }\n if (outline === undefined) {\n return false;\n }\n if (outline === null) {\n return true;\n }\n const s = (size / units) * this.scale;\n const margin = 2 * this.reach(size, tables);\n const area = ((outline.xMax - outline.xMin) * s + margin) * ((outline.yMax - outline.yMin) * s + margin);\n this.cost += outline.count * area;\n return this.cost <= FIELD_BUDGET;\n }\n /**\n * Whether every glyph reserved since restart is still in the store as it\n * was: false where the store started again while they were reserved.\n */\n intact() {\n return this.reserved === store.epoch;\n }\n /** Reserve afresh, the store's epoch now. */\n restart() {\n this.cost = 0;\n this.reserved = store.epoch;\n }\n /**\n * Add a reserved glyph, its pen at (x, y) in the text's pixels, `size`\n * pixels to the em, in 0xRRGGBB and `alpha`, by the light or the dark of\n * `tables` as its colour is drawn: false where the tables' room is full,\n * which leaves the text to be drawn as normal text.\n */\n add(glyph, em, x, y, size, color, alpha, tables) {\n const units = em / 20;\n const outline = outlineOf(glyph, units / TOLERANCE);\n if (outline === null) {\n return true;\n }\n if (outline === undefined) {\n return false;\n }\n const light = this.code(tables[0]);\n const dark = this.code(tables[1]);\n if (light < 0 || dark < 0) {\n return false;\n }\n if ((this.glyphs + 1) * 4 * STRIDE > scratch.length) {\n const grown = new Float32Array(scratch.length * 2);\n grown.set(scratch.subarray(0, this.glyphs * 4 * STRIDE));\n scratch = grown;\n }\n const scale = size / units;\n // Where the quad reaches in the text's pixels, for bounds (filters, culling, layers): the\n // shader moves it out by the cutoffs from where the pen snaps.\n const out = this.reach(size, tables) / Math.max(this.scale, 1 / 64);\n const r = ((color >> 16) & 0xff) / 255;\n const g = ((color >> 8) & 0xff) / 255;\n const b = (color & 0xff) / 255;\n let at = this.glyphs * 4 * STRIDE;\n for (let k = 0; k < 8; k += 2) {\n const sx = CORNERS[k];\n const sy = CORNERS[k + 1];\n const gx = sx < 0 ? outline.xMin : outline.xMax;\n const gy = sy < 0 ? outline.yMin : outline.yMax;\n scratch[at] = x + gx * scale + sx * out;\n scratch[at + 1] = y + gy * scale + sy * out;\n scratch[at + 2] = x;\n scratch[at + 3] = y;\n scratch[at + 4] = light;\n scratch[at + 5] = dark;\n scratch[at + 6] = gx;\n scratch[at + 7] = gy;\n scratch[at + 8] = sx;\n scratch[at + 9] = sy;\n scratch[at + 10] = outline.start;\n scratch[at + 11] = outline.count;\n scratch[at + 12] = scale;\n scratch[at + 13] = size;\n scratch[at + 14] = r;\n scratch[at + 15] = g;\n scratch[at + 16] = b;\n scratch[at + 17] = alpha;\n at += STRIDE;\n }\n this.glyphs++;\n return true;\n }\n /** A table's place in the uniforms, its first entry plus 64 times its entries, added where new; -1 past their room. */\n code(table) {\n let t = this.tables.indexOf(table);\n if (t < 0) {\n if (this.entries + table.length / 3 > ENTRIES) {\n return -1;\n }\n t = this.tables.length;\n this.tables.push(table);\n this.starts.push(this.entries);\n this.entries += table.length / 3;\n }\n return this.starts[t] + (table.length / 3) * 64;\n }\n /** The quads of the glyphs added, null for none. */\n built() {\n if (this.glyphs === 0) {\n return null;\n }\n const table = new Float32Array(ENTRIES * 4);\n for (let t = 0; t < this.tables.length; t++) {\n const entries = this.tables[t];\n for (let i = 0; i < entries.length; i += 3) {\n const at = (this.starts[t] + i / 3) * 4;\n table[at] = entries[i];\n table[at + 1] = entries[i + 1];\n table[at + 2] = entries[i + 2];\n }\n }\n return {\n vertices: scratch.slice(0, this.glyphs * 4 * STRIDE),\n glyphs: this.glyphs,\n mode: new Float32Array([this.grid, this.thickness, this.sharpness, 0]),\n table,\n };\n }\n}\n/**\n * `quads` built anew as `each` reserves a text's glyphs, or null where one\n * cannot be drawn so, a glyph or the whole asking too much of the shader:\n * the text is then drawn as normal text, all of it alike. Reserving goes\n * again where the store started again meanwhile.\n */\nexport function reserveAll(quads, each) {\n for (let tries = 0; tries < 2; tries++) {\n quads.restart();\n if (!each(quads)) {\n return null;\n }\n if (quads.intact()) {\n return quads;\n }\n }\n return null;\n}\n//# sourceMappingURL=saffron.js.map","// Advanced anti-aliasing (Saffron) in the renderer: a text's glyphs as one\n// geometry of quads (text/saffron.ts' GlyphQuads), which the backend's\n// glyph program covers pixel by pixel from the glyphs' outlines. A field's quads lie\n// in its own pixels, a StaticText's in its definition's, under its matrix.\n// The view keeps each text's quads while what they were made of holds\n// (AdvancedTexts).\nimport { IDENTITY } from \"@swf2es/format\";\nimport { TextObject } from \"../display/textobjects.js\";\nimport { csmTables } from \"../text/csm.js\";\nimport { GUTTER, shownLines } from \"../text/layout.js\";\nimport { GlyphQuads, quadIndices, reserveAll, STRIDE, store as saffronStore, } from \"../text/saffron.js\";\n/** gridFitType's values, in the order the shader and CSMTextSettings number them. */\nconst GRIDS = [\"none\", \"pixel\", \"subpixel\"];\nconst NO_COLORS = new Uint32Array(0);\n/**\n * A field's embedded glyphs as quads, at `scale` of Flash's pixels to a\n * pixel of the field, of the lines it shows, each where its pen stood in\n * fractions of a twip, as adl places it; null where they cannot be drawn\n * so, a glyph or the whole asking too much of the shader, for the field to\n * be drawn as normal text, all of it alike.\n */\nfunction fieldQuads(o, scale) {\n const layout = o.layout;\n if (!o.model.text || layout.lines.length === 0) {\n return null;\n }\n const first = Math.min(Math.max(0, o.scrollV - 1), layout.lines.length - 1);\n // The lines that fit the field from there, one at least: adl draws no line part of the way.\n const last = first + shownLines(o, first) - 1;\n const dx = o.left * 20 - o.scrollH * 20;\n const dy = o.top * 20 - (layout.lines[first].y - GUTTER);\n const quads = reserveAll(new GlyphQuads(GRIDS.indexOf(o.gridFitType), o.thickness, o.sharpness, scale), (q) => {\n for (let l = first; l <= last; l++) {\n for (const c of layout.lines[l].chars) {\n if (c.shown &&\n c.font &&\n c.glyph &&\n !q.reserve(c.glyph, c.font.em, Math.max(0, c.format.size), csmTables(c.font))) {\n return false;\n }\n }\n }\n return true;\n });\n if (!quads) {\n return null;\n }\n const normal = [];\n let glyph = 0;\n for (let l = first; l <= last; l++) {\n const line = layout.lines[l];\n const baseline = (dy + line.y + line.ascent) / 20;\n for (const c of line.chars) {\n if (!c.shown || !c.font || !c.glyph) {\n continue;\n }\n if (!quads.add(c.glyph, c.font.em, (dx + c.at + c.kern) / 20, baseline, Math.max(0, c.format.size), c.format.color & 0xffffff, 1, csmTables(c.font))) {\n normal.push(glyph);\n }\n glyph++;\n }\n }\n return { geometry: geometryOf(quads), normal };\n}\n/**\n * A StaticText's glyphs as quads in its definition's space, at `scale` of\n * Flash's pixels to a pixel of it there; null where they cannot be drawn so.\n */\nfunction staticQuads(o, scale) {\n const csm = o.definition.csm;\n if (!csm?.useFlashType) {\n return null;\n }\n const glyphs = o.glyphs.glyphs;\n const quads = reserveAll(new GlyphQuads(csm.gridFit, csm.thickness, csm.sharpness, scale), (q) => glyphs.every((placed) => q.reserve(placed.glyph, placed.font.em, placed.height / 20, csmTables(placed.font))));\n if (!quads) {\n return null;\n }\n const normal = [];\n for (let i = 0; i < glyphs.length; i++) {\n const placed = glyphs[i];\n if (!quads.add(placed.glyph, placed.font.em, placed.x / 20, placed.y / 20, placed.height / 20, placed.color & 0xffffff, (placed.color >>> 24) / 255, csmTables(placed.font))) {\n normal.push(i);\n }\n }\n return { geometry: geometryOf(quads), normal };\n}\n/** The quads added as a geometry: their positions apart, for its bounds; null for none. */\nfunction geometryOf(quads) {\n const built = quads.built();\n if (!built) {\n return null;\n }\n const count = built.glyphs * 4;\n const positions = new Float32Array(count * 2);\n for (let k = 0; k < count; k++) {\n positions[k * 2] = built.vertices[k * STRIDE];\n positions[k * 2 + 1] = built.vertices[k * STRIDE + 1];\n }\n return {\n positions,\n colors: NO_COLORS,\n indices: quadIndices(built.glyphs),\n glyphs: { vertices: built.vertices, mode: built.mode, table: built.table },\n };\n}\n/** Texts' glyph quads as the view draws them, made again only as what they were made of changes. */\nexport class AdvancedTexts {\n geometries;\n /** Each advanced text's glyph quads, and what they were made of (advancedText); BitmapData.draw's apart. */\n advancedTexts = new WeakMap();\n drawnAdvanced = new WeakMap();\n constructor(geometries) {\n this.geometries = geometries;\n }\n /**\n * A text's glyphs as Saffron draws them, of its glyphs' quads made again\n * as its layout, scroll or place in its field, its settings, its scale\n * in Flash's pixels or the outlines' store change: their geometry, in the\n * field's pixels or the StaticText's definition's, and what places them\n * there in the text's space. Null where it cannot be drawn so, which is\n * kept too.\n */\n advancedText(o, a, b, c, d, target, drawing) {\n const field = o instanceof TextObject ? o : null;\n const m = field ? IDENTITY : staticMatrix(o);\n // Flash's pixels a pixel of the text: the target's pixels a stage pixel over a pixel of Flash's.\n // Kept in steps of a square root of two, the step down: the quads reach out as far as at the\n // scale itself or further, and their cost counts as at most twice less, so that a text that\n // grows or shrinks makes its quads again only now and then.\n const exact = Math.sqrt(Math.abs((a * d - b * c) * (m.a * m.d - m.b * m.c))) *\n (target.scale / target.pixel);\n const scale = exact > 0 && Number.isFinite(exact) ? Math.SQRT2 ** Math.floor(Math.log2(exact) * 2) : 1;\n const source = field ? field.layout : o.glyphs;\n // The stage's and BitmapData.draw's apart, as they draw it at scales of their own.\n const texts = drawing ? this.drawnAdvanced : this.advancedTexts;\n let kept = texts.get(o);\n if (kept &&\n kept.source === source &&\n kept.scale === scale &&\n kept.resets === saffronStore.resets &&\n (!field ||\n (kept.scrollV === field.scrollV &&\n kept.scrollH === field.scrollH &&\n kept.left === field.left &&\n kept.top === field.top &&\n kept.height === field.height &&\n kept.grid === field.gridFitType &&\n kept.thickness === field.thickness &&\n kept.sharpness === field.sharpness)) &&\n (!kept.handle || this.geometries.alive(kept.handle))) {\n return kept.glyphs ? { handle: kept.handle, normal: kept.glyphs.normal, m } : null;\n }\n if (kept?.handle && this.geometries.alive(kept.handle)) {\n this.geometries.remove(kept.handle.id);\n }\n const glyphs = field ? fieldQuads(field, scale) : staticQuads(o, scale);\n kept = {\n source,\n scale,\n resets: saffronStore.resets,\n scrollV: field?.scrollV ?? 0,\n scrollH: field?.scrollH ?? 0,\n left: field?.left ?? 0,\n top: field?.top ?? 0,\n height: field?.height ?? 0,\n grid: field?.gridFitType ?? \"\",\n thickness: field?.thickness ?? 0,\n sharpness: field?.sharpness ?? 0,\n glyphs,\n handle: glyphs?.geometry ? this.geometries.add(glyphs.geometry) : null,\n };\n texts.set(o, kept);\n return glyphs ? { handle: kept.handle, normal: glyphs.normal, m } : null;\n }\n}\n/** A StaticText's matrix, from its definition's space to its own pixels. */\nfunction staticMatrix(o) {\n const m = o.definition.definition.matrix;\n return { a: m.a, b: m.b, c: m.c, d: m.d, tx: m.tx / 20, ty: m.ty / 20 };\n}\n//# sourceMappingURL=advanced.js.map","// Pixel Bender kernels as GLSL ES 3.00, for what Flash draws with them: a\n// ShaderFilter, a blend shader and a shader fill (@swf2es/render's\n// kernel-shaders.ts runs them). The function made computes what the CPU\n// interpreter (bitmap/pixel-bender.ts), the reference, computes, with its\n// quirks measured in adl: equal and notEqual of scalars alone, a\n// comparison's result in i0 whatever its destination, ftoi rounding a half\n// to the even, select's first source only on exactly 1, the logical\n// operations bitwise. Each operation is written a lane at a time, in the\n// interpreter's order, so that a destination its source overlaps reads\n// what the lanes before it wrote, as there. The transcendentals and the\n// float rounding are the GPU's: close, not the same bits.\nimport { PbjOp, } from \"@swf2es/format\";\nimport { OUT_COORD } from \"../bitmap/pixel-bender.js\";\nconst LANES = \"xyzw\";\n/** A float32 as a GLSL literal that reads back as the same float. */\nfunction floatLiteral(v) {\n const f = Math.fround(v);\n if (Number.isNaN(f)) {\n return \"uintBitsToFloat(0x7fc00000u)\";\n }\n if (f === Number.POSITIVE_INFINITY) {\n return \"uintBitsToFloat(0x7f800000u)\";\n }\n if (f === Number.NEGATIVE_INFINITY) {\n return \"uintBitsToFloat(0xff800000u)\";\n }\n if (Object.is(f, -0)) {\n return \"-0.0\";\n }\n const s = String(f);\n return /[.e]/.test(s) ? s : `${s}.0`;\n}\nfunction intLiteral(v) {\n // A literal past int's range does not compile; the least int is written as a sum.\n return v === -2147483648 ? \"(-2147483647 - 1)\" : String(v | 0);\n}\n/** Scalar helpers for the operations whose GLSL builtins differ from adl's, or are undefined where adl is not. */\nconst HELPERS = `int pbFtoi(float x) {\n // A half to the even, written out: roundEven is not every driver's.\n float f = floor(x);\n float d = x - f;\n float r = d > 0.5 || (d == 0.5 && mod(f, 2.0) != 0.0) ? f + 1.0 : f;\n return r >= -2147483648.0 && r < 2147483648.0 ? int(r) : (-2147483647 - 1);\n}\nint pbDivide(int x, int y) {\n if (y == 0) { return 0; }\n // Magnitudes as uints, where int's least has one; truncated toward 0, as JavaScript's | 0.\n uint q = (x < 0 ? 0u - uint(x) : uint(x)) / (y < 0 ? 0u - uint(y) : uint(y));\n return (x < 0) != (y < 0) ? int(0u - q) : int(q);\n}\nfloat pbSign(float x) {\n return x > 0.0 ? 1.0 : (x < 0.0 ? -1.0 : 0.0);\n}\nfloat pbAtan2(float y, float x) {\n if (x == 0.0) {\n return y == 0.0 ? y : (y > 0.0 ? 1.5707964 : -1.5707964);\n }\n return atan(y, x);\n}\nfloat pbPow(float x, float y) {\n if (y == 0.0) { return 1.0; }\n if (x > 0.0) { return exp2(y * log2(x)); }\n if (x == 0.0) { return y > 0.0 ? 0.0 : uintBitsToFloat(0x7f800000u); }\n if (y != floor(y)) { return uintBitsToFloat(0x7fc00000u); }\n float m = exp2(y * log2(-x));\n return mod(y, 2.0) == 1.0 ? -m : m;\n}\n`;\n/** Writes a kernel's operations as GLSL statements, a lane at a time. */\nclass Writer {\n lines = [];\n floats = new Set();\n ints = new Set();\n textures = new Set();\n depth = 1;\n temps = 0;\n emit(line) {\n this.lines.push(`${\" \".repeat(this.depth)}${line}`);\n }\n open(line) {\n this.emit(line);\n this.depth++;\n }\n close(line = \"}\") {\n this.depth--;\n this.emit(line);\n }\n /** A line between two blocks, at the depth of the line that opened the first. */\n between(line) {\n this.depth--;\n this.emit(line);\n this.depth++;\n }\n temp() {\n return `t${this.temps++}`;\n }\n /** Register `index` of a kind, noted as used. */\n register(int, index) {\n (int ? this.ints : this.floats).add(index);\n return `${int ? \"i\" : \"f\"}${index}`;\n }\n /** A register's lane `channel`. */\n lane(r, channel) {\n return `${this.register(r.int, r.index)}.${LANES[channel]}`;\n }\n /** A destination's `k`th lane written, or a source's `k`th read, by its channels. */\n at(r, k) {\n return this.lane(r, r.channels[k] ?? 0);\n }\n /** Lane `row` of column `column` of a matrix whose columns start at `r`: a 2x2's are two lanes of one register. */\n cell(r, column, row) {\n if (r.matrix === 2) {\n return `${this.register(r.int, r.index)}.${LANES[column * 2 + row]}`;\n }\n return `${this.register(r.int, r.index + column)}.${LANES[row]}`;\n }\n}\nconst made = new WeakMap();\n/** `kernel` as GLSL, made once a kernel. */\nexport function kernelGlslOf(kernel) {\n let glsl = made.get(kernel);\n if (!glsl) {\n glsl = kernelGlsl(kernel);\n made.set(kernel, glsl);\n }\n return glsl;\n}\n/** `kernel`'s operations as GLSL (KernelGlsl). */\nexport function kernelGlsl(kernel) {\n const w = new Writer();\n for (const op of kernel.operations) {\n operation(w, op);\n }\n // The parameters' registers, which start each pixel as the parameters set them.\n const floatParams = new Set();\n const intParams = new Set();\n for (const p of kernel.parameters) {\n if (p.output || p.name === OUT_COORD) {\n continue;\n }\n for (const index of parameterRegisters(p.register)) {\n (p.register.int ? intParams : floatParams).add(index);\n w.register(p.register.int, index);\n }\n }\n // The pixel's coordinate, set after the registers start: noted as used before they are declared.\n const coord = kernel.parameters.find((p) => !p.output && p.name === OUT_COORD);\n const coordLines = [];\n if (coord && !coord.register.int && !coord.register.matrix) {\n const r = coord.register;\n coordLines.push(` ${w.at(r, 0)} = outCoord.x;`);\n if (r.channels.length > 1) {\n coordLines.push(` ${w.at(r, 1)} = outCoord.y;`);\n }\n }\n const outputs = kernel.parameters.filter((p) => p.output);\n const output = outputs[outputs.length - 1]?.register;\n const result = output ? outputOf(w, output) : \"vec4(0.0, 0.0, 0.0, 1.0)\";\n const floats = [...floatParams].sort((a, b) => a - b);\n const ints = [...intParams].sort((a, b) => a - b);\n const declarations = [];\n for (const index of [...w.floats].sort((a, b) => a - b)) {\n const k = floats.indexOf(index);\n declarations.push(` vec4 f${index} = ${k >= 0 ? `pbFloats[${k}]` : \"vec4(0.0)\"};`);\n }\n for (const index of [...w.ints].sort((a, b) => a - b)) {\n const k = ints.indexOf(index);\n declarations.push(` ivec4 i${index} = ${k >= 0 ? `pbInts[${k}]` : \"ivec4(0)\"};`);\n }\n const uniforms = [];\n if (floats.length > 0) {\n uniforms.push(`uniform vec4 pbFloats[${floats.length}];`);\n }\n if (ints.length > 0) {\n uniforms.push(`uniform ivec4 pbInts[${ints.length}];`);\n }\n const source = [\n ...uniforms,\n HELPERS,\n \"vec4 pbKernel(vec2 outCoord) {\",\n ...declarations,\n ...coordLines,\n ...w.lines,\n ` return ${result};`,\n \"}\",\n \"\",\n ].join(\"\\n\");\n return {\n source,\n textures: [...w.textures].sort((a, b) => a - b),\n floatParams: floats,\n intParams: ints,\n };\n}\n/** The registers a parameter's numbers fill: a matrix's columns, or its one register. */\nfunction parameterRegisters(r) {\n if (r.matrix > 2) {\n return Array.from({ length: r.matrix }, (_, c) => r.index + c);\n }\n return [r.index];\n}\n/**\n * The output pixel: the output register's lanes, an int one's zeros, as\n * the interpreter gives; three channels are opaque.\n */\nfunction outputOf(w, r) {\n const lanes = r.channels.slice(0, Math.max(1, r.size || r.channels.length));\n const values = lanes.map((c) => (r.int ? \"0.0\" : w.lane(r, c)));\n while (values.length < 3) {\n values.push(\"0.0\");\n }\n if (values.length < 4) {\n values.push(\"1.0\");\n }\n return `vec4(${values.slice(0, 4).join(\", \")})`;\n}\nfunction operation(w, op) {\n switch (op.op) {\n case PbjOp.load: {\n const o = op;\n const value = o.dst.int ? intLiteral(o.value) : floatLiteral(o.value);\n for (let k = 0; k < o.dst.size; k++) {\n w.emit(`${w.at(o.dst, k)} = ${value};`);\n }\n return;\n }\n case PbjOp.sampleNearest:\n case PbjOp.sampleLinear: {\n const o = op;\n w.textures.add(o.texture);\n const kind = o.op === PbjOp.sampleLinear ? \"pbLinear\" : \"pbNearest\";\n const x = w.at(o.src, 0);\n const y = w.at(o.src, 1);\n const coord = o.src.int ? `vec2(float(${x}), float(${y}))` : `vec2(${x}, ${y})`;\n const t = w.temp();\n w.open(\"{\");\n w.emit(`vec4 ${t} = ${kind}${o.texture}(${coord});`);\n for (let k = 0; k < o.dst.size; k++) {\n w.emit(`${w.at(o.dst, k)} = ${t}.${LANES[k]};`);\n }\n w.close();\n return;\n }\n case PbjOp.if:\n w.open(`if (${w.at(op.src, 0)} != 0) {`);\n return;\n case PbjOp.else:\n w.between(\"} else {\");\n return;\n case PbjOp.endIf:\n w.close();\n return;\n case PbjOp.select: {\n // Only exactly 1 selects the first, unlike if's any other than 0.\n const o = op;\n const c = w.temp();\n w.open(\"{\");\n w.emit(`bool ${c} = ${w.at(o.condition, 0)} == 1;`);\n for (let k = 0; k < o.dst.size; k++) {\n w.emit(`${w.at(o.dst, k)} = ${c} ? ${w.at(o.a, k)} : ${w.at(o.b, k)};`);\n }\n w.close();\n return;\n }\n case PbjOp.nop:\n return;\n default: {\n const o = op;\n if (o.src.matrix) {\n matrixOp(w, o);\n }\n else if (o.dst.int && o.src.int) {\n intOp(w, o);\n }\n else {\n floatOp(w, o);\n }\n }\n }\n}\n/** The comparisons' results go to i0's first lanes, whatever their destination. */\nfunction compareInto(w, k) {\n return `${w.register(true, 0)}.${LANES[k]}`;\n}\nfunction floatOp(w, o) {\n const n = o.dst.size;\n const d = (k) => w.at(o.dst, k);\n const s = (k) => w.at(o.src, k);\n const each = (f) => {\n for (let k = 0; k < n; k++) {\n w.emit(`${d(k)} = ${f(d(k), s(k))};`);\n }\n };\n switch (o.op) {\n case PbjOp.mov:\n each((_, b) => b);\n return;\n case PbjOp.add:\n each((a, b) => `${a} + ${b}`);\n return;\n case PbjOp.sub:\n each((a, b) => `${a} - ${b}`);\n return;\n case PbjOp.mul:\n each((a, b) => `${a} * ${b}`);\n return;\n case PbjOp.div:\n each((a, b) => `${a} / ${b}`);\n return;\n case PbjOp.atan2:\n each((a, b) => `pbAtan2(${a}, ${b})`);\n return;\n case PbjOp.pow:\n each((a, b) => `pbPow(${a}, ${b})`);\n return;\n case PbjOp.mod:\n each((a, b) => `${a} - ${b} * floor(${a} / ${b})`);\n return;\n case PbjOp.min:\n // As SSE's minss: the source where either is NaN.\n each((a, b) => `${a} < ${b} ? ${a} : ${b}`);\n return;\n case PbjOp.max:\n each((a, b) => `${a} > ${b} ? ${a} : ${b}`);\n return;\n case PbjOp.step:\n each((a, b) => `${a} < ${b} ? 0.0 : 1.0`);\n return;\n case PbjOp.equal:\n // adl compares scalars alone: of vectors, equal is false and notEqual true.\n w.emit(`${compareInto(w, 0)} = ${n === 1 ? `${d(0)} == ${s(0)} ? 1 : 0` : \"0\"};`);\n return;\n case PbjOp.notEqual:\n w.emit(`${compareInto(w, 0)} = ${n === 1 ? `${d(0)} == ${s(0)} ? 0 : 1` : \"1\"};`);\n return;\n case PbjOp.lessThan:\n case PbjOp.lessThanEqual:\n case PbjOp.vectorEqual:\n case PbjOp.vectorNotEqual: {\n const test = { 42: \"<\", 43: \"<=\", 59: \"==\", 60: \"!=\" }[o.op];\n for (let k = 0; k < n; k++) {\n w.emit(`${compareInto(w, k)} = ${d(k)} ${test} ${s(k)} ? 1 : 0;`);\n }\n return;\n }\n case PbjOp.dot:\n case PbjOp.distance:\n case PbjOp.length: {\n // A sum a lane at a time, into the destination's first lane.\n const count = o.op === PbjOp.length ? o.src.size : n;\n const t = w.temp();\n w.open(\"{\");\n w.emit(`float ${t} = 0.0;`);\n for (let k = 0; k < count; k++) {\n if (o.op === PbjOp.dot) {\n w.emit(`${t} += ${d(k)} * ${s(k)};`);\n }\n else if (o.op === PbjOp.distance) {\n w.emit(`${t} += (${d(k)} - ${s(k)}) * (${d(k)} - ${s(k)});`);\n }\n else {\n w.emit(`${t} += ${s(k)} * ${s(k)};`);\n }\n }\n w.emit(`${d(0)} = ${o.op === PbjOp.dot ? t : `sqrt(${t})`};`);\n w.close();\n return;\n }\n case PbjOp.normalize: {\n const t = w.temp();\n w.open(\"{\");\n w.emit(`float ${t} = 0.0;`);\n for (let k = 0; k < n; k++) {\n w.emit(`${t} += ${s(k)} * ${s(k)};`);\n }\n w.emit(`${t} = sqrt(${t});`);\n for (let k = 0; k < n; k++) {\n w.emit(`${d(k)} = ${s(k)} / ${t};`);\n }\n w.close();\n return;\n }\n case PbjOp.cross: {\n const t = w.temp();\n w.open(\"{\");\n w.emit(`vec3 ${t}a = vec3(${d(0)}, ${d(1)}, ${d(2)});`);\n w.emit(`vec3 ${t}b = vec3(${s(0)}, ${s(1)}, ${s(2)});`);\n w.emit(`${d(0)} = ${t}a.y * ${t}b.z - ${t}a.z * ${t}b.y;`);\n w.emit(`${d(1)} = ${t}a.z * ${t}b.x - ${t}a.x * ${t}b.z;`);\n w.emit(`${d(2)} = ${t}a.x * ${t}b.y - ${t}a.y * ${t}b.x;`);\n w.close();\n return;\n }\n case PbjOp.floatToInt:\n each((_, b) => `pbFtoi(${b})`);\n return;\n case PbjOp.intToFloat:\n each((_, b) => `float(${b})`);\n return;\n case PbjOp.floatToBool:\n // The float's bits, as they are.\n each((_, b) => `floatBitsToInt(${b})`);\n return;\n case PbjOp.boolToFloat:\n case PbjOp.boolToInt:\n // The int 1 or 0, its bits taken as a float's.\n each((_, b) => `intBitsToFloat(${b} == 0 ? 0 : 1)`);\n return;\n case PbjOp.matMatMul:\n case PbjOp.matVecMul:\n case PbjOp.vecMatMul:\n // adl takes them on registers that are no matrices; what it does then is not known.\n return;\n default:\n each((_, b) => mathOf(o.op, b));\n return;\n }\n}\n/** The functions of one argument. */\nfunction mathOf(op, x) {\n switch (op) {\n case PbjOp.rcp:\n return `1.0 / ${x}`;\n case PbjOp.sin:\n return `sin(${x})`;\n case PbjOp.cos:\n return `cos(${x})`;\n case PbjOp.tan:\n return `tan(${x})`;\n case PbjOp.asin:\n return `asin(${x})`;\n case PbjOp.acos:\n return `acos(${x})`;\n case PbjOp.atan:\n return `atan(${x})`;\n case PbjOp.exp:\n return `exp(${x})`;\n case PbjOp.exp2:\n return `exp2(${x})`;\n case PbjOp.log:\n return `log(${x})`;\n case PbjOp.log2:\n return `log2(${x})`;\n case PbjOp.sqrt:\n return `sqrt(${x})`;\n case PbjOp.rsqrt:\n return `1.0 / sqrt(${x})`;\n case PbjOp.abs:\n return `abs(${x})`;\n case PbjOp.sign:\n // 0 for NaN, as adl has it.\n return `pbSign(${x})`;\n case PbjOp.floor:\n return `floor(${x})`;\n case PbjOp.ceil:\n return `ceil(${x})`;\n default:\n // fract\n return `${x} - floor(${x})`;\n }\n}\nfunction intOp(w, o) {\n const n = o.dst.size;\n const d = (k) => w.at(o.dst, k);\n const s = (k) => w.at(o.src, k);\n const each = (f) => {\n for (let k = 0; k < n; k++) {\n w.emit(`${d(k)} = ${f(d(k), s(k))};`);\n }\n };\n switch (o.op) {\n case PbjOp.add:\n each((a, b) => `${a} + ${b}`);\n return;\n case PbjOp.sub:\n each((a, b) => `${a} - ${b}`);\n return;\n case PbjOp.mul:\n each((a, b) => `${a} * ${b}`);\n return;\n case PbjOp.div:\n // Flash crashes dividing by 0; 0 here.\n each((a, b) => `pbDivide(${a}, ${b})`);\n return;\n case PbjOp.mov:\n case PbjOp.intToBool:\n each((_, b) => b);\n return;\n case PbjOp.equal:\n w.emit(`${compareInto(w, 0)} = ${n === 1 ? `${d(0)} == ${s(0)} ? 1 : 0` : \"0\"};`);\n return;\n case PbjOp.notEqual:\n w.emit(`${compareInto(w, 0)} = ${n === 1 ? `${d(0)} == ${s(0)} ? 0 : 1` : \"1\"};`);\n return;\n case PbjOp.lessThan:\n case PbjOp.lessThanEqual:\n case PbjOp.vectorEqual:\n case PbjOp.vectorNotEqual: {\n const test = { 42: \"<\", 43: \"<=\", 59: \"==\", 60: \"!=\" }[o.op];\n for (let k = 0; k < n; k++) {\n w.emit(`${compareInto(w, k)} = ${d(k)} ${test} ${s(k)} ? 1 : 0;`);\n }\n return;\n }\n // The logical operations are bitwise, as adl does them.\n case PbjOp.logicalNot:\n w.emit(`${d(0)} = ~${s(0)};`);\n return;\n case PbjOp.logicalAnd:\n w.emit(`${d(0)} = ${d(0)} & ${s(0)};`);\n return;\n case PbjOp.logicalOr:\n w.emit(`${d(0)} = ${d(0)} | ${s(0)};`);\n return;\n case PbjOp.logicalXor:\n w.emit(`${d(0)} = ${d(0)} ^ ${s(0)};`);\n return;\n case PbjOp.any:\n case PbjOp.all: {\n const any = o.op === PbjOp.any;\n const t = w.temp();\n w.open(\"{\");\n w.emit(`int ${t} = ${any ? \"0\" : \"-1\"};`);\n for (let k = 0; k < n; k++) {\n w.emit(`${t} ${any ? \"|\" : \"&\"}= ${s(k)};`);\n }\n w.emit(`${d(0)} = ${t};`);\n w.close();\n }\n }\n}\n/** An operation on matrices, each column as its registers hold it. */\nfunction matrixOp(w, o) {\n const n = o.src.matrix;\n const src = (c, r) => w.cell(o.src, c, r);\n // A destination that is no matrix takes the columns' lanes from its own on, as far as they go.\n const dst = (c, r) => o.dst.matrix ? w.cell(o.dst, c, r) : w.lane(o.dst, Math.min(3, (o.dst.channels[c] ?? 0) + r));\n const t = w.temp();\n switch (o.op) {\n case PbjOp.matMatMul: {\n w.open(\"{\");\n for (let c = 0; c < n; c++) {\n for (let r = 0; r < n; r++) {\n const terms = Array.from({ length: n }, (_, k) => `${dst(k, r)} * ${src(c, k)}`);\n w.emit(`float ${t}_${c}_${r} = ${terms.join(\" + \")};`);\n }\n }\n for (let c = 0; c < n; c++) {\n for (let r = 0; r < n; r++) {\n w.emit(`${dst(c, r)} = ${t}_${c}_${r};`);\n }\n }\n w.close();\n return;\n }\n case PbjOp.matVecMul:\n case PbjOp.vecMatMul: {\n const v = (k) => w.at(o.dst, k);\n w.open(\"{\");\n for (let k = 0; k < n; k++) {\n w.emit(`float ${t}_${k} = ${v(k)};`);\n }\n for (let k = 0; k < n; k++) {\n const terms = Array.from({ length: n }, (_, j) => `${o.op === PbjOp.matVecMul ? src(j, k) : src(k, j)} * ${t}_${j}`);\n w.emit(`${v(k)} = ${terms.join(\" + \")};`);\n }\n w.close();\n return;\n }\n default: {\n // add, sub, mul and mov, element by element.\n const sign = { [PbjOp.add]: \"+\", [PbjOp.sub]: \"-\", [PbjOp.mul]: \"*\" }[o.op];\n for (let c = 0; c < n; c++) {\n for (let r = 0; r < n; r++) {\n const to = dst(c, r);\n w.emit(`${to} = ${sign ? `${to} ${sign} ${src(c, r)}` : src(c, r)};`);\n }\n }\n }\n }\n}\n/**\n * `values`, each input parameter's numbers by the parameter as the\n * interpreter takes them, packed into the uniforms `glsl` reads: each\n * parameter register's four lanes, a matrix by its columns.\n */\nexport function kernelParameters(glsl, values) {\n const floats = new Float32Array(glsl.floatParams.length * 4);\n const ints = new Int32Array(glsl.intParams.length * 4);\n for (const [p, v] of values) {\n const r = p.register;\n const registers = r.int ? glsl.intParams : glsl.floatParams;\n const lanes = r.int ? ints : floats;\n if (!r.matrix) {\n const base = registers.indexOf(r.index) * 4;\n if (base < 0) {\n continue;\n }\n for (const [k, c] of r.channels.slice(0, r.size || r.channels.length).entries()) {\n lanes[base + c] = v[k] ?? 0;\n }\n continue;\n }\n // A matrix's numbers by columns; a 2x2's columns are two lanes each of one register.\n for (let c = 0; c < r.matrix; c++) {\n for (let k = 0; k < r.matrix; k++) {\n const at = r.matrix === 2\n ? registers.indexOf(r.index) * 4 + c * 2 + k\n : registers.indexOf(r.index + c) * 4 + k;\n if (at >= 0) {\n lanes[at] = v[c * r.matrix + k] ?? 0;\n }\n }\n }\n }\n return { floats, ints };\n}\n//# sourceMappingURL=pixel-bender-glsl.js.map","// A display object's filters as the renderer's passes (@swf2es/render's\n// filters.ts), worked out to match adl: each one's values in the target's\n// units, how far it pads past the object, cut where the padding would not\n// fit a texture, and how far in the object's pixels start for those that\n// read them. The rules they share with BitmapData.applyFilter are in\n// display/filters.ts and bitmap/filters.ts.\nimport { BEVEL, BLUR, COLOR_MATRIX, CONVOLUTION, DISPLACEMENT, GLOW, GRADIENT, SHADER, } from \"@swf2es/render\";\nimport { rgbaOf } from \"../bitmap/bitmap.js\";\nimport { channelWeights, displacementAlpha, displacementGrowth, filterGrowth, gradientTable, integerKernel, paddedDistance, } from \"../bitmap/filters.js\";\nimport { emptyKernel, filterOffset } from \"../display/filters.js\";\nimport { kernelGlslOf, kernelParameters } from \"./pixel-bender-glsl.js\";\nconst NO_INTS = new Int32Array(0);\n/**\n * The passes of `records` at `units` of the target to a stage pixel, none\n * padding past `cap`: null where none is drawn, as a displacement map is\n * not yet. A gradient's texture is kept from `previous` where its colours\n * are the same, as a tween of a gradient filter's blur writes them again.\n */\nexport function planFilters(records, units, cap = Number.POSITIVE_INFINITY, previous = null) {\n const planned = [];\n for (const record of records) {\n const kind = kindOf(record);\n // A displacement whose map is gone leaves the object be, as does a ShaderFilter never set.\n if ((kind === DISPLACEMENT && !mapOf(record)) || (kind === SHADER && !record.shaderUse)) {\n continue;\n }\n if (kind > 0) {\n const wanted = paddingOf(kind, record, units);\n planned.push({ record, kind, wanted, padding: Math.min(wanted, cap), inset: 0 });\n }\n }\n if (planned.length === 0) {\n return null;\n }\n let inset = 0;\n for (let i = planned.length - 1; i >= 0; i--) {\n inset += planned[i].padding;\n planned[i].inset = inset;\n }\n const passes = planned.map((p) => passOf(p, units, inset));\n for (const pass of passes) {\n pass.texture = pass.colors ? sameColors(pass.colors, previous) : null;\n }\n return {\n passes,\n padding: inset,\n wanted: planned.map((p) => p.wanted),\n whole: planned.some((p) => p.kind === SHADER),\n };\n}\n/** The texture of a gradient of `previous`'s with the same colours, if any. */\nfunction sameColors(colors, previous) {\n for (const pass of previous?.passes ?? []) {\n const known = pass.colors;\n if (known &&\n pass.texture &&\n known.length === colors.length &&\n known.every((c, i) => c === colors[i])) {\n return pass.texture;\n }\n }\n return null;\n}\nfunction kindOf(f) {\n switch (f.kind) {\n case \"blur\":\n return BLUR;\n case \"glow\":\n case \"dropShadow\":\n return GLOW;\n case \"bevel\":\n return BEVEL;\n case \"gradientGlow\":\n case \"gradientBevel\":\n return GRADIENT;\n case \"colorMatrix\":\n return COLOR_MATRIX;\n case \"convolution\":\n return CONVOLUTION;\n case \"displacementMap\":\n return DISPLACEMENT;\n case \"shader\":\n return SHADER;\n default:\n return 0;\n }\n}\n/**\n * A displacement's map, the copy the object took when its filters were\n * set, or the live one where none was taken; null where it is gone.\n */\nfunction mapOf(f) {\n const map = (f.mapSnapshot ?? f.mapBitmap);\n const store = map?.$store ?? null;\n return store && !store.disposed && store.width > 0 && store.height > 0 ? store : null;\n}\n/** Whether `records` holds a filter the renderer does not draw yet. */\nexport function undrawnFilter(records) {\n for (const f of records) {\n if (kindOf(f) === 0) {\n return true;\n }\n }\n return false;\n}\n/**\n * How far a filter pads past the object, in the target's units: its reach\n * in stage pixels, the blur's passes and the distance it is cast, at\n * `units` a stage pixel and in whole units; a convolution's its taps' and\n * the pixel right and down adl's bitmap of the object has; a colour\n * matrix none. A reach that is no number pads nothing.\n */\nfunction paddingOf(kind, f, units) {\n const blur = (f.quality * Math.max(f.blurX, f.blurY)) / 2;\n let reach;\n switch (kind) {\n case BLUR:\n reach = blur;\n break;\n case GLOW:\n reach = blur + Math.abs(paddedDistance(f.kind === \"dropShadow\" ? f.distance || 0 : 0));\n break;\n case BEVEL:\n reach = blur + Math.abs(paddedDistance(f.distance || 0));\n break;\n case GRADIENT:\n reach = Math.max(...filterGrowth(f)) + 1;\n break;\n case CONVOLUTION:\n return Math.max(f.matrixX >> 1, f.matrixY >> 1) + 1;\n case DISPLACEMENT:\n // Its colour mode's fill round the object, and the pixel right and down adl's bitmap has.\n return Math.max(...displacementGrowth(f)) + 1;\n case SHADER:\n reach = Math.max(...f.extensions);\n break;\n default:\n return 0;\n }\n const padding = Math.ceil(reach * units);\n return Number.isNaN(padding) ? 0 : padding;\n}\n/** A filter's values, in the order its kind lists them (@swf2es/render's filters.ts). */\nfunction passOf(p, units, padding) {\n const f = p.record;\n const pass = {\n kind: p.kind,\n values: new Float32Array(0),\n colors: null,\n texture: null,\n map: null,\n kernel: null,\n images: [],\n ints: NO_INTS,\n };\n const blur = [f.blurX || 0, f.blurY || 0, f.quality, units];\n switch (p.kind) {\n case BLUR:\n pass.values = Float32Array.from(blur);\n break;\n case GLOW: {\n const shadow = f.kind === \"dropShadow\";\n const [ox, oy] = offsetOf(f, shadow ? f.distance || 0 : 0, units);\n pass.values = Float32Array.from([\n ...blur,\n ...rgb(f.color),\n f.alpha,\n f.strength,\n ox,\n oy,\n f.inner ? 1 : 0,\n f.knockout ? 1 : 0,\n shadow && f.hideObject ? 1 : 0,\n ]);\n break;\n }\n case BEVEL: {\n const [ox, oy] = offsetOf(f, f.distance || 0, units);\n pass.values = Float32Array.from([\n ...blur,\n ...rgb(f.highlightColor),\n ...rgb(f.shadowColor),\n f.highlightAlpha,\n f.shadowAlpha,\n f.strength,\n ox,\n oy,\n typeOf(f),\n f.knockout ? 1 : 0,\n ]);\n break;\n }\n case GRADIENT: {\n const [ox, oy] = offsetOf(f, f.distance || 0, units);\n pass.values = Float32Array.from([\n ...blur,\n f.strength,\n ox,\n oy,\n typeOf(f),\n f.knockout ? 1 : 0,\n f.kind === \"gradientBevel\" ? 1 : 0,\n p.inset,\n ...filterGrowth(f),\n ]);\n pass.colors = rgbaOf(gradientTable(f));\n break;\n }\n case COLOR_MATRIX: {\n // Column-major for GLSL: column j is input channel j's part of each output.\n const values = new Float32Array(20);\n for (let row = 0; row < 4; row++) {\n for (let col = 0; col < 4; col++) {\n values[col * 4 + row] = f.matrix[row * 5 + col] || 0;\n }\n values[16 + row] = (f.matrix[row * 5 + 4] || 0) / 255;\n }\n pass.values = values;\n break;\n }\n case CONVOLUTION: {\n const k = f.matrixX * f.matrixY > 0 ? f : emptyKernel(f);\n const count = k.matrixX * k.matrixY;\n const matrix = Array.from({ length: count }, (_, i) => k.matrix[i] || 0);\n const divisor = k.divisor || 1;\n const reciprocal = integerKernel(matrix, divisor);\n pass.values = Float32Array.from([\n k.matrixX,\n k.matrixY,\n (k.color >> 16) & 0xff,\n (k.color >> 8) & 0xff,\n k.color & 0xff,\n Math.floor(k.alpha * 255),\n divisor,\n reciprocal === null ? 0 : reciprocal / 65536,\n k.bias || 0,\n k.clamp ? 1 : 0,\n k.preserveAlpha ? 1 : 0,\n p.inset,\n ...matrix,\n ]);\n break;\n }\n case DISPLACEMENT: {\n const map = mapOf(f);\n const alpha = displacementAlpha(f);\n pass.values = Float32Array.from([\n ...channelWeights(f.componentX),\n ...channelWeights(f.componentY),\n f.scaleX || 0,\n f.scaleY || 0,\n [\"wrap\", \"clamp\", \"ignore\", \"color\"].indexOf(f.mode),\n ...rgb(f.color).map((c) => c * alpha),\n alpha,\n ...displacementGrowth(f),\n p.inset,\n f.mapPoint[0],\n f.mapPoint[1],\n map.width,\n map.height,\n ]);\n pass.map = map;\n break;\n }\n case SHADER:\n shaderPass(pass, f, p.inset, padding, units);\n break;\n }\n return pass;\n}\n/**\n * A ShaderFilter's values (@swf2es/render's filters.ts, SHADER): its first\n * input the object, and each other image the kernel samples a texture\n * chainOf fills in; its parameters' ints apart, which floats would round.\n */\nfunction shaderPass(pass, f, inset, padding, units) {\n const use = f.shaderUse;\n const glsl = kernelGlslOf(use.kernel);\n const { floats, ints } = kernelParameters(glsl, use.values);\n const first = use.kernel.inputs[0]?.index ?? -1;\n const values = [units, inset, padding, ...f.extensions, glsl.textures.length];\n for (const t of glsl.textures) {\n const image = t === first ? undefined : use.images.get(t);\n if (image) {\n pass.images.push({ image, at: values.length + 1 });\n }\n values.push(t, -1, image?.floats ? 1 : 0);\n }\n values.push(floats.length, ...floats);\n pass.values = Float32Array.from(values);\n pass.ints = ints;\n pass.kernel = glsl.source;\n}\nfunction rgb(color) {\n return [((color >> 16) & 0xff) / 255, ((color >> 8) & 0xff) / 255, (color & 0xff) / 255];\n}\n/** A bevel's or a gradient filter's type: inner 0, outer 1, full 2. */\nfunction typeOf(f) {\n switch (f.type) {\n case \"inner\":\n return 0;\n case \"outer\":\n return 1;\n default:\n return 2;\n }\n}\n/** A filter's offset, `distance` stage pixels at its angle, in the target's units. */\nfunction offsetOf(f, distance, units) {\n const offset = [0, 0];\n filterOffset(offset, f, distance, units);\n return offset;\n}\n//# sourceMappingURL=filters.js.map","// A shape layer's fills as geometries of the renderer's (@swf2es/render): each fill tessellated\n// (fills.ts), in order, a geometry for each stretch of solid fills, each stretch of fills of one\n// bitmap sampled alike, and each gradient fill, its vertices carrying where they sample in texels;\n// then drawTriangles' textured triangles, a geometry each mesh. What is left out is counted.\nimport { IDENTITY } from \"@swf2es/format\";\nimport { invert } from \"../display/geometry.js\";\nimport { RADIAL_MAX } from \"../display/gradients.js\";\nimport { regionOf, resolveFills } from \"./fills.js\";\n/**\n * What the renderer cannot draw yet, counted as it is met, for a test or a\n * probe to read: advanced text drawn as normal; clips within masks left\n * out; displacement maps and other filters it has no pass for, ignored.\n */\nexport const unsupported = {\n /** Texts with advanced anti-aliasing, drawn as normal. */\n advancedTexts: 0,\n /**\n * Masks that mask nothing, a 3D one or one inside what it masks; and what\n * would clip a mask's own coverage (its mask, scrollRect, clip layer or\n * gutter), which it is drawn without.\n */\n masks: 0,\n /** Blend modes no blend is drawn for, a Pixel Bender shader's, drawn as normal. */\n blendModes: 0,\n filters: 0,\n};\n/** Whether `a` and `b` sample one bitmap alike, and so may share a part. */\nfunction samplesAlike(a, b) {\n return a.image === b.image && a.smooth === b.smooth && a.repeat === b.repeat;\n}\nconst WHITE = 0xffffffff;\n/** The texels a linear gradient's ramp has: 256 across the gradient square, -819.2 to 819.2. */\nconst RAMP = 256;\n/** A straight ARGB colour as a vertex carries it: its bytes red, green, blue and alpha from the lowest. */\nexport function vertexColor(argb) {\n return ((((argb >>> 16) & 0xff) | (argb & 0xff00) | ((argb & 0xff) << 16) | (argb & 0xff000000)) >>> 0);\n}\n/**\n * What the part open is gathered in, grown as it needs and kept for the\n * next: a drawing redrawn on every frame made each part's numbers in lists\n * and copied them out, garbage on every frame. A part copies out what it used.\n */\nconst SCRATCH_VERTICES = 512;\n/** The vertices past which scratch grown for a large drawing is let go of after it, not kept. */\nconst MOST_KEPT_VERTICES = 65536;\nlet scratchPositions = new Float32Array(SCRATCH_VERTICES * 2);\nlet scratchColors = new Uint32Array(SCRATCH_VERTICES);\nlet scratchTexels = new Float32Array(SCRATCH_VERTICES * 2);\nlet scratchIndices = new Uint32Array(SCRATCH_VERTICES * 3);\n/** `array` with room for `n` elements, its first `used` kept. */\nfunction roomy(array, n, used) {\n if (n <= array.length) {\n return array;\n }\n const grown = new array.constructor(Math.max(n, array.length * 2));\n grown.set(array.subarray(0, used));\n return grown;\n}\n/** The scratch back at its usual size, where a large drawing grew it. */\nfunction shrinkScratch() {\n if (scratchColors.length > MOST_KEPT_VERTICES) {\n scratchPositions = new Float32Array(SCRATCH_VERTICES * 2);\n scratchColors = new Uint32Array(SCRATCH_VERTICES);\n scratchTexels = new Float32Array(SCRATCH_VERTICES * 2);\n }\n if (scratchIndices.length > MOST_KEPT_VERTICES * 3) {\n scratchIndices = new Uint32Array(SCRATCH_VERTICES * 3);\n }\n}\n/** The parts being gathered: positions, colours, texels and indices of the part open. */\nclass Gathered {\n parts = [];\n vertices = 0;\n corners = 0;\n paint = null;\n region = null;\n /** The fills in the part open, which is flat (GeometryData.flat) with one alone. */\n fills = 0;\n /**\n * Open a part for `paint`, the one open first closed, unless both are\n * solid, or both sample one bitmap alike (samplesAlike): a drawing of a\n * bitmap fill a triangle so draws in a few parts. A shader fill is a part\n * of its own.\n */\n open(paint, region) {\n if (paint === null && this.paint === null) {\n return;\n }\n const open = this.paint;\n if (paint?.type === \"image\" && open?.type === \"image\" && samplesAlike(paint, open)) {\n return;\n }\n this.close();\n this.paint = paint;\n this.region = region;\n }\n /** The index the next vertex takes in the part. */\n get next() {\n return this.vertices;\n }\n /** Room for `vertices` more vertices and `corners` more indices, which vertex and triangle take. */\n reserve(vertices, corners) {\n const n = this.vertices + vertices;\n scratchPositions = roomy(scratchPositions, n * 2, this.vertices * 2);\n scratchColors = roomy(scratchColors, n, this.vertices);\n scratchTexels = roomy(scratchTexels, n * 2, this.vertices * 2);\n scratchIndices = roomy(scratchIndices, this.corners + corners, this.corners);\n }\n /** A vertex at (x, y) of `color`, sampling at texel (u, v), in room reserve made. */\n vertex(x, y, color, u, v) {\n const n = this.vertices;\n scratchPositions[n * 2] = x;\n scratchPositions[n * 2 + 1] = y;\n scratchColors[n] = color;\n scratchTexels[n * 2] = u;\n scratchTexels[n * 2 + 1] = v;\n this.vertices = n + 1;\n }\n /** A fill begun in the part open: its vertices and triangles follow. */\n fill() {\n this.fills++;\n }\n /** A triangle of the part's vertices `a`, `b` and `c`, in room reserve made. */\n triangle(a, b, c) {\n const n = this.corners;\n scratchIndices[n] = a;\n scratchIndices[n + 1] = b;\n scratchIndices[n + 2] = c;\n this.corners = n + 3;\n }\n close() {\n const n = this.vertices;\n const shader = this.paint?.type === \"shader\";\n if (this.corners > 0) {\n this.parts.push({\n geometry: {\n positions: scratchPositions.slice(0, n * 2),\n // A shader fill's vertices carry a depth where others carry their colour (MESH's).\n colors: shader ? NO_COLORS : scratchColors.slice(0, n),\n texels: this.paint ? scratchTexels.slice(0, n * 2) : undefined,\n depths: shader ? new Float32Array(n).fill(1) : undefined,\n indices: scratchIndices.slice(0, this.corners),\n // One fill's triangles cover each point of it once; fills of a drawing may overlap.\n flat: this.fills === 1,\n },\n paint: this.paint,\n region: this.region,\n mesh: null,\n });\n }\n this.vertices = 0;\n this.corners = 0;\n this.fills = 0;\n }\n}\n/**\n * Where a textured fill samples, in texels, at (x, y) of the shape. A\n * bitmap: through its matrix's inverse. A linear gradient: across its ramp,\n * half a pixel back so that a pixel's centre reads what Flash reads at its\n * corner. A radial one: across the region its texture was computed over.\n * at() leaves the texel in u and v, not in a pair made for each vertex,\n * and one is set again for each fill (sampling), not made for each.\n */\nclass Sampling {\n u = 0;\n v = 0;\n region = null;\n kind = \"image\";\n m = IDENTITY;\n columns = 0;\n rows = 0;\n set(paint, contours) {\n this.m = invert(paint.matrix);\n // A shader's coordinates are its matrix's inverse of the shape's, as a bitmap's texels are.\n this.kind = paint.type !== \"gradient\" ? \"image\" : paint.radial ? \"radial\" : \"linear\";\n this.region = this.kind === \"radial\" ? regionOf(contours) : null;\n this.columns = this.region ? radialTexels(this.region.width) : 0;\n this.rows = this.region ? radialTexels(this.region.height) : 0;\n return this;\n }\n at(x, y) {\n const m = this.m;\n switch (this.kind) {\n case \"image\":\n this.u = m.a * x + m.c * y + m.tx;\n this.v = m.b * x + m.d * y + m.ty;\n break;\n case \"linear\": {\n const sx = m.a * (x - 0.5) + m.c * (y - 0.5) + m.tx;\n const sy = m.b * (x - 0.5) + m.d * (y - 0.5) + m.ty;\n this.u = ((sx + 819.2) * RAMP) / 1638.4;\n this.v = (sy + 819.2) / 1638.4;\n break;\n }\n default: {\n const r = this.region;\n this.u = ((x - r.x) * this.columns) / r.width;\n this.v = ((y - r.y) * this.rows) / r.height;\n }\n }\n }\n}\n/** The one Sampling fillParts sets for each textured fill. */\nconst sampling = new Sampling();\n/** The texels a radial gradient's texture has across `pixels` of its region. */\nexport function radialTexels(pixels) {\n return Math.min(RADIAL_MAX, pixels);\n}\n/**\n * `layer`'s fills as geometries in order, positions in the shape's pixels,\n * then its meshes, drawn after the fills, as drawTriangles' are. A fill of\n * a bitmap the SWF lacks is red, as Flash draws it.\n */\nexport function layerParts(layer, tessellator, masking = false) {\n const parts = layer.fills.length > 0 ? fillParts(layer, tessellator, masking) : [];\n for (const mesh of layer.meshes ?? []) {\n const part = meshPart(mesh);\n if (part) {\n parts.push(part);\n }\n }\n return parts;\n}\nconst NO_COLORS = new Uint32Array(0);\n/** A mesh's triangles, three vertices each, as a geometry: its u and v the texels, its t their depths. */\nfunction meshPart(mesh) {\n // Three vertices a triangle, as drawTriangles keeps them.\n const count = mesh.positions.length / 2;\n if (count === 0) {\n return null;\n }\n const texels = new Float32Array(count * 2);\n const depths = new Float32Array(count);\n for (let k = 0; k < count; k++) {\n texels[k * 2] = mesh.uvt[k * 3];\n texels[k * 2 + 1] = mesh.uvt[k * 3 + 1];\n depths[k] = mesh.uvt[k * 3 + 2];\n }\n const indices = new Uint32Array(count);\n for (let k = 0; k < count; k++) {\n indices[k] = k;\n }\n return {\n geometry: { positions: mesh.positions, colors: NO_COLORS, texels, depths, indices },\n paint: null,\n region: null,\n mesh,\n };\n}\n/** `layer`'s fills as geometries in order. */\nfunction fillParts(layer, tessellator, masking) {\n // A drawing used as a mask fills non-zero, whatever its winding (fills.ts, resolveFills).\n const geometries = resolveFills(layer, masking, tessellator);\n const out = new Gathered();\n for (let i = 0; i < layer.fills.length; i++) {\n const { fill, contours } = layer.fills[i];\n const textured = fill.type === \"image\" || fill.type === \"gradient\" || fill.type === \"shader\" ? fill : null;\n // A paint whose matrix collapses the plane covers nothing.\n if (textured) {\n const m = textured.matrix;\n if (m.a * m.d - m.b * m.c === 0) {\n continue;\n }\n }\n const how = textured ? sampling.set(textured, contours) : null;\n out.open(textured, how?.region ?? null);\n const color = textured ? WHITE : vertexColor(fill.type === \"solid\" ? fill.color : 0xffff0000);\n // A fill refused, or of nothing, adds no vertex.\n const geometry = geometries[i];\n if (geometry && geometry.vertices.length > 0) {\n const { vertices, indices, indexOffset = 0 } = geometry;\n out.reserve(vertices.length / 2, indices.length);\n out.fill();\n const first = out.next;\n for (let k = 0; k < vertices.length; k += 2) {\n const x = vertices[k];\n const y = vertices[k + 1];\n how?.at(x, y);\n out.vertex(x, y, color, how ? how.u : 0, how ? how.v : 0);\n }\n for (let k = 0; k < indices.length; k += 3) {\n out.triangle(first + indices[k] - indexOffset, first + indices[k + 1] - indexOffset, first + indices[k + 2] - indexOffset);\n }\n }\n }\n out.close();\n shrinkScratch();\n return out.parts;\n}\n/** A bitmap's quad, `width` by `height` pixels, its texels its pixels. */\nexport function bitmapQuad(width, height) {\n return {\n positions: Float32Array.of(0, 0, width, 0, width, height, 0, height),\n colors: Uint32Array.of(WHITE, WHITE, WHITE, WHITE),\n texels: Float32Array.of(0, 0, width, 0, width, height, 0, height),\n indices: Uint32Array.of(0, 1, 2, 0, 2, 3),\n flat: true,\n };\n}\n//# sourceMappingURL=shapes.js.map","import { flatten } from \"../display/shapes.js\";\n/**\n * Each fill of `layer` tessellated, in one call, or null where the\n * tessellator refused it. Resolved once at construction, so colour copies\n * do not tessellate again. A drawing used as a mask fills non-zero, even\n * where drawPath asked for even-odd.\n */\nexport function resolveFills(layer, masking, tessellate) {\n const rules = layer.fills.map(({ winding }) => masking || winding === \"nonZero\");\n // The contours go as they are, their curves flattened in the call.\n const contours = new Array(layer.fills.length);\n for (let i = 0; i < layer.fills.length; i++) {\n contours[i] = layer.fills[i].contours;\n }\n return tessellate.layer(contours, rules) ?? layer.fills.map(() => null);\n}\n/** The bounds of a fill's contours, whole pixels out. */\nexport function regionOf(contours) {\n let x0 = Number.POSITIVE_INFINITY;\n let y0 = Number.POSITIVE_INFINITY;\n let x1 = Number.NEGATIVE_INFINITY;\n let y1 = Number.NEGATIVE_INFINITY;\n for (const path of contours) {\n const points = flatten(path);\n for (let i = 0; i < points.length; i += 2) {\n x0 = Math.min(x0, points[i]);\n x1 = Math.max(x1, points[i]);\n y0 = Math.min(y0, points[i + 1]);\n y1 = Math.max(y1, points[i + 1]);\n }\n }\n if (!(x1 >= x0 && y1 >= y0)) {\n return { x: 0, y: 0, width: 1, height: 1 };\n }\n const x = Math.floor(x0);\n const y = Math.floor(y0);\n return { x, y, width: Math.max(1, Math.ceil(x1) - x), height: Math.max(1, Math.ceil(y1) - y) };\n}\n//# sourceMappingURL=fills.js.map","// The textures a shape's paints sample (RenderView): a bitmap store's\n// pixels, uploaded again as they change, and a gradient's ramp or radial\n// texture, kept by the region it covers. A store's texture is also its GPU\n// copy (GpuCopy), which BitmapData.draw draws into on the GPU (RenderView's\n// drawInto): it then holds the store's pixels alone, is shown as it is and\n// never let go of for being idle, till a script reads the pixels back.\nimport { CLAMP, IDLE_FRAMES, MESH, MIRROR, REPEAT, SMOOTH, } from \"@swf2es/render\";\nimport { argbOf, BitmapStore, characterStore, rgbaInto, } from \"../bitmap/bitmap.js\";\nimport { radialPixels, ramp } from \"../display/gradients.js\";\nimport { makeRoom, moveLast, same } from \"../display/value-lists.js\";\nimport { radialTexels } from \"./shapes.js\";\n/**\n * How many frames a gradient's texture may go undrawn: a morph tweening a\n * gradient makes a new one for each ratio, up to a megabyte each, which\n * the usual idle frames would hold hundreds of.\n */\nexport const GRADIENT_IDLE_FRAMES = 30;\n/** Regions a gradient's textures are kept for, as a shape that changes draws it over them. */\nconst GRADIENT_REGIONS = 8;\n/** A store's texture as its GPU copy: what a draw left there, read back as a script reads the store. */\nclass StoreCopy {\n paints;\n store;\n handle;\n version = -1;\n constructor(paints, store, handle) {\n this.paints = paints;\n this.store = store;\n this.handle = handle;\n }\n read() {\n const bytes = this.paints.readStore(this.handle, this.store.width, this.store.height);\n // Gone with a lost context: what the CPU held before the draws.\n if (!bytes) {\n return this.store.lostOnGpu(this);\n }\n this.paints.readBack(this.store);\n return argbOf(bytes);\n }\n copy(source, rect, dx, dy) {\n return this.paints.copyStore(source, rect, this.handle, dx, dy);\n }\n fill(rect, pixel) {\n return this.paints.fillStore(this.handle, rect, pixel);\n }\n destroy() {\n this.paints.release(this.store, this.handle);\n }\n}\n/** Bitmaps' and gradients' textures, made as first drawn and kept while they are. */\nexport class Paints {\n textures;\n gpu;\n stores = new WeakMap();\n /** Each gradient's textures, by the region a radial one covers (null for a linear one), the latest used last. */\n gradients = new WeakMap();\n /** A store's texture held for draws alone let go of if the store is collected undisposed. */\n collected = new FinalizationRegistry((handle) => {\n if (this.textures.alive(handle)) {\n this.textures.remove(handle.id);\n }\n });\n constructor(textures, gpu = null) {\n this.textures = textures;\n this.gpu = gpu;\n }\n /**\n * The texture a part's paint or mesh samples: its bitmap's, else null till\n * it is decoded, or its gradient's.\n */\n paintTexture(part) {\n if (part.mesh) {\n const store = part.mesh.image;\n return store.disposed ? null : this.storeTexture(store);\n }\n const paint = part.paint;\n if (paint.type === \"image\") {\n const store = paint.image instanceof BitmapStore ? paint.image : characterStore(paint.image);\n return store && !store.disposed ? this.storeTexture(store) : null;\n }\n return this.gradientTexture(paint, part.region);\n }\n /**\n * `store`'s texture, its pixels as drawn (`drawable`) uploaded again if\n * they changed since, converted into the bytes the texture keeps (Textures'\n * `bytes`), so that a store drawn into every frame allocates none.\n */\n storeTexture(store, idle) {\n const kept = this.stores.get(store);\n if (kept && this.textures.alive(kept.handle)) {\n const id = kept.handle.id;\n // What was drawn, filled or copied into the texture is newest there: shown as it is.\n if (kept.copy !== null && store.gpu === kept.copy && store.newerOnGpu) {\n kept.version = store.version;\n return kept.handle;\n }\n if (kept.version !== store.version) {\n kept.version = store.version;\n this.textures.set(id, store.width, store.height, this.bytesOf(store, id), idle);\n }\n else if (idle !== undefined) {\n this.textures.idleWithin(id, idle);\n }\n return kept.handle;\n }\n // A texture a draw alone wrote, gone with a lost context: the CPU's pixels are the store's again.\n if (kept?.copy && store.gpu === kept.copy) {\n store.lostOnGpu(kept.copy);\n }\n if (kept?.copy) {\n store.copies.delete(kept.copy);\n }\n if (kept) {\n this.collected.unregister(kept);\n }\n const bytes = this.bytesOf(store, -1);\n const handle = this.textures.add(store.width, store.height, bytes, idle);\n this.stores.set(store, { handle, version: store.version, copy: null, pinned: false });\n return handle;\n }\n /**\n * `store` drawn into on the GPU, its texture (`storeTexture`) the newest\n * of its pixels now: kept however long it goes undrawn, till they are\n * read back, the store disposed or collected.\n */\n drawn(store) {\n const kept = this.stores.get(store);\n if (!kept) {\n return;\n }\n if (!kept.copy) {\n kept.copy = new StoreCopy(this, store, kept.handle);\n store.copies.add(kept.copy);\n }\n store.drawnOnGpu(kept.copy);\n kept.version = store.version;\n if (!kept.pinned) {\n kept.pinned = true;\n this.textures.idleFor(kept.handle.id, Number.POSITIVE_INFINITY);\n this.collected.register(store, kept.handle, kept);\n }\n }\n /**\n * `store`'s texture read back: the CPU holds the pixels again, and the\n * texture goes idle as any other.\n */\n readBack(store) {\n const kept = this.stores.get(store);\n if (kept?.pinned) {\n kept.pinned = false;\n this.collected.unregister(kept);\n this.textures.idleFor(kept.handle.id, IDLE_FRAMES);\n }\n }\n /** Texture `handle`'s pixels read back for a store `width` by `height`; null once it is gone. */\n readStore(handle, width, height) {\n return this.gpu && this.textures.alive(handle) ? this.gpu.read(handle.id, width, height) : null;\n }\n /** `rect` of texture `handle` cleared to `pixel`: a store's fill on the GPU. */\n fillStore(handle, rect, pixel) {\n return !!this.gpu && this.textures.alive(handle) && this.gpu.fill(handle.id, rect, pixel);\n }\n /**\n * `rect` of `source` copied to (dx, dy) of texture `handle`, a store's\n * copy on the GPU: the source's texture first made of its pixels where\n * they are newer, as when it is drawn. Not from an opaque store holding\n * alpha, whose texture holds its pixels as drawn, not as they are.\n */\n copyStore(source, rect, handle, dx, dy) {\n if (!this.gpu || !this.textures.alive(handle) || source.disposed || source.holdsAlpha) {\n return false;\n }\n const from = this.storeTexture(source);\n return this.textures.alive(handle) && this.gpu.copy(from.id, rect, handle.id, dx, dy);\n }\n /** `store`'s texture let go of, as the store is disposed. */\n release(store, handle) {\n const kept = this.stores.get(store);\n if (kept?.handle === handle) {\n this.stores.delete(store);\n this.collected.unregister(kept);\n }\n if (this.textures.alive(handle)) {\n this.textures.remove(handle.id);\n }\n }\n /**\n * `store`'s pixels as drawn, in bytes Textures lends for texture `id`: an\n * opaque store holding alpha made opaque as they are converted, rather\n * than through a copy of its own.\n */\n bytesOf(store, id) {\n const pixels = store.readable;\n const bytes = this.textures.bytes(pixels.length * 4, id);\n rgbaInto(pixels, bytes, store.holdsAlpha);\n return bytes;\n }\n /** Premultiplied ARGB in bytes Textures lends. */\n rgba(pixels) {\n const bytes = this.textures.bytes(pixels.length * 4);\n rgbaInto(pixels, bytes);\n return bytes;\n }\n /**\n * A gradient's texture: a linear one's ramp of 256 colours, a radial one\n * computed over its region, a texel a pixel up to 512 a side\n * (display/gradients.ts).\n */\n gradientTexture(fill, region) {\n let made = this.gradients.get(fill);\n if (!made) {\n made = [];\n this.gradients.set(fill, made);\n }\n // By its region's numbers, the latest used first: a fill is drawn over one region, or a few\n // as its shape changes.\n let known = null;\n for (let i = made.length - 1; i >= 0; i--) {\n const r = made[i].region;\n if (r === region ||\n (r &&\n region &&\n same(r.x, region.x) &&\n same(r.y, region.y) &&\n same(r.width, region.width) &&\n same(r.height, region.height))) {\n known = i === made.length - 1 ? made[i] : moveLast(made, i);\n break;\n }\n }\n if (known && this.textures.alive(known.handle)) {\n return known.handle;\n }\n const colors = ramp(fill.stops, fill.linearRgb);\n let handle;\n if (fill.radial && region) {\n const columns = radialTexels(region.width);\n const rows = radialTexels(region.height);\n const pixels = radialPixels(colors, fill.matrix, fill.focal, fill.spread, region, columns, rows);\n handle = this.textures.add(columns, rows, this.rgba(pixels), GRADIENT_IDLE_FRAMES);\n }\n else {\n handle = this.textures.add(colors.length, 1, this.rgba(colors), GRADIENT_IDLE_FRAMES);\n }\n // Its region's texture made again, or a new region's kept: those let go of forgotten, and the\n // least lately used past GRADIENT_REGIONS.\n if (known) {\n known.handle = handle;\n }\n else {\n const list = made;\n makeRoom(list, GRADIENT_REGIONS, (e) => !this.textures.alive(e.handle), (e) => {\n if (this.textures.alive(e.handle)) {\n this.textures.remove(e.handle.id);\n }\n });\n list.push({ region: region && { ...region }, handle });\n }\n return handle;\n }\n}\n/**\n * How a part's paint is sampled. A bitmap fill, or a mesh's bitmap:\n * smoothed if it asks and `smoothing` (RenderView.smoothing), repeated or\n * clamped. A linear gradient's ramp: texel by texel, spread as it wraps; a\n * radial one's, smoothed.\n */\nexport function paintSampler(part, smoothing) {\n const mesh = part.mesh;\n if (mesh) {\n return MESH | (mesh.smooth && smoothing ? SMOOTH : 0) | (mesh.repeat ? REPEAT : CLAMP);\n }\n const paint = part.paint;\n if (paint.type === \"image\") {\n return (paint.smooth && smoothing ? SMOOTH : 0) | (paint.repeat ? REPEAT : CLAMP);\n }\n if (paint.radial) {\n return SMOOTH | CLAMP;\n }\n return paint.spread === 1 ? MIRROR : paint.spread === 2 ? REPEAT : CLAMP;\n}\n//# sourceMappingURL=paints.js.map","// A filtered object's layer (RenderView): its filters worked out for the\n// units it is drawn at, again only as they change, and cut to what fits a\n// texture; their passes added to the frame's filters; and their output\n// kept, to be composited again where nothing it was made of changed.\nimport { BLEND, drawnArea, filteredRect, } from \"@swf2es/render\";\nimport { rgbaInto } from \"../bitmap/bitmap.js\";\nimport { Container } from \"../display/container.js\";\nimport { TRANSFORM } from \"../display/displayobject.js\";\nimport { filterRoom, paddingCap, sameFilterRecords, } from \"../display/filters.js\";\nimport { planFilters } from \"./filters.js\";\nimport { GRADIENT_IDLE_FRAMES } from \"./paints.js\";\nimport { kernelGlslOf, kernelParameters } from \"./pixel-bender-glsl.js\";\nexport class FilterLayers {\n geometries;\n textures;\n keeps;\n paints;\n /** Each filtered object's filters worked out, for the records, units and room they were for. */\n filterPlans = new WeakMap();\n /** A filtered object's drawn area, measured where its padding may not fit (fitFilters). */\n drawn = [];\n /** What each filtered object's output was kept for. */\n outputs = new WeakMap();\n /** The filtered layers drawn this frame, each its output's record and its layer number. */\n ran = [];\n movedArea = new Float64Array(4);\n /** The textures of the images ShaderFilters' kernels sample, by image. */\n images = new WeakMap();\n /** Each blend shader's or shader fill's values and kernel, and where in them its images' textures go. */\n kernels = new WeakMap();\n /** A reused output's rectangle (keptOutput). */\n keptRect = new Int32Array(4);\n constructor(geometries, textures, keeps, paints) {\n this.geometries = geometries;\n this.textures = textures;\n this.keeps = keeps;\n this.paints = paints;\n }\n /**\n * Whether `o`'s filters' output kept last can be drawn again, its rectangle then in keptRect;\n * else whether to keep what they make now. Kept while nothing they ran on changed but where it is\n * on the stage: not past a change in `o` but a move, in what is in it, in its scale or turn on\n * the stage (a b c d), a move of what it scrolls, its filters, or the screen's scale; and drawn\n * again only while its rectangle moved with it, its size the same and its corner within a pixel.\n * One that changes frame after frame is not kept, as keeping it would cost a target for nothing.\n * `frames` and `generation` are the view's: the stage's frames drawn, and what outputs are kept at;\n * `whole` how its layer covers whole pixels (@swf2es/render's SceneList.wholes).\n */\n keptOutput(o, plan, sliceKey, a, b, c, d, tx, ty, target, frames, generation, whole) {\n let k = this.outputs.get(o);\n if (!k) {\n k = {\n handle: null,\n plan,\n generation,\n seenAt: -1,\n sliceKey,\n scrolled: false,\n measured: false,\n kept: false,\n reused: false,\n keeping: false,\n changing: 0,\n linear: [a, b, c, d],\n x: 0,\n y: 0,\n pad: 0,\n area: new Float64Array(4),\n rect: new Int32Array(4),\n };\n this.outputs.set(o, k);\n }\n const x = tx * target.scale;\n const y = ty * target.scale;\n const l = k.linear;\n // One not drawn on the frame before was hidden, or off the list, where a walk cleared its flags\n // and its children's without it hearing of a change.\n // A slice moves what it draws as its owner's other children change, which its flags miss.\n const changed = k.seenAt !== frames - 1 ||\n k.sliceKey !== sliceKey ||\n k.plan !== plan ||\n k.generation !== generation ||\n (o.dirty & ~TRANSFORM) !== 0 ||\n (o.dirty & TRANSFORM && (o.scroll !== null || k.scrolled)) ||\n (o instanceof Container && o.descendantsDirty) ||\n l[0] !== a ||\n l[1] !== b ||\n l[2] !== c ||\n l[3] !== d;\n k.seenAt = frames;\n k.sliceKey = sliceKey;\n k.scrolled = o.scroll !== null;\n let same = false;\n if (!changed && k.measured) {\n // Its area as measured, moved as it moved, measured into a rectangle again.\n const moved = this.movedArea;\n moved[0] = k.area[0] + x - k.x;\n moved[1] = k.area[1] + y - k.y;\n moved[2] = k.area[2] + x - k.x;\n moved[3] = k.area[3] + y - k.y;\n const rect = this.keptRect;\n filteredRect(moved, 0, k.pad, target, rect, 0, whole);\n same =\n rect[2] === k.rect[2] &&\n rect[3] === k.rect[3] &&\n Math.abs(rect[0] - x - (k.rect[0] - k.x)) <= 1 &&\n Math.abs(rect[1] - y - (k.rect[1] - k.y)) <= 1;\n }\n k.reused = !changed && same && k.kept && k.handle !== null && this.keeps.alive(k.handle);\n if (k.reused) {\n k.changing = 0;\n return k;\n }\n // Unchanged but not kept, as after it was filtered without keeping: kept now.\n k.changing = changed || !same ? k.changing + 1 : 0;\n k.keeping = k.changing <= 1;\n k.kept = false;\n k.plan = plan;\n k.generation = generation;\n l[0] = a;\n l[1] = b;\n l[2] = c;\n l[3] = d;\n k.x = x;\n k.y = y;\n // Let go of at the end of the first frame it is not drawn: one whose object was not drawn on\n // the frame before is drawn anew (`changed`), and a timeline makes filtered objects anew as it\n // plays, whose outputs, kept for a second, held hundreds of MB.\n if (k.keeping && (!k.handle || !this.keeps.alive(k.handle))) {\n k.handle = this.keeps.add(0);\n }\n if (k.keeping) {\n this.keeps.use(k.handle.id);\n }\n return k;\n }\n /** `output`'s object's filters drawn this frame as layer `layer`, for noteKept to measure. */\n ranLayer(output, layer) {\n this.ran.push(output, layer);\n }\n /** What the filtered layers drawn this frame measured, for their outputs kept to be drawn again. */\n noteKept(scene) {\n const ran = this.ran;\n for (let i = 0; i < ran.length; i += 2) {\n const k = ran[i];\n const layer = ran[i + 1];\n for (let j = 0; j < 4; j++) {\n k.area[j] = scene.areas[layer * 4 + j];\n k.rect[j] = scene.layers[layer * 4 + j];\n }\n // Kept where its output was: a layer of no size draws nothing, and keeps nothing, nor does one\n // in a layer of no size, which the planner leaves out with all in it.\n k.measured = k.rect[2] > 0 && k.rect[3] > 0;\n k.kept = k.keeping && k.measured && drawnWithin(scene, layer);\n }\n ran.length = 0;\n }\n /**\n * `o`'s filters worked out for the units they are drawn at and the room a\n * texture has, again only as one of those or their values change: null\n * where it has none drawn.\n */\n filterPlan(o, filterUnits, scale, drawing) {\n const records = o.filters;\n // A stage scaled to nothing filters at a unit a pixel rather than not at all.\n const units = filterUnits ?? (Number.isFinite(scale) && scale > 0 ? scale : 1);\n const kept = this.filterPlans.get(o);\n // A draw for BitmapData plans at its own units, leaving the stage's plans be.\n if (drawing) {\n return kept?.units === units\n ? kept.plan\n : planFilters(records, units, Number.POSITIVE_INFINITY, kept?.plan ?? null);\n }\n if (kept && kept.units === units) {\n if (kept.records === records) {\n return kept.plan;\n }\n // Set again with the same values, as a tween writes them on each frame.\n if (sameFilterRecords(records, kept.records)) {\n kept.records = records;\n return kept.plan;\n }\n }\n const plan = planFilters(records, units, Number.POSITIVE_INFINITY, kept?.plan ?? null);\n this.filterPlans.set(o, { records, units, plan, cap: Number.POSITIVE_INFINITY, capped: null });\n return plan;\n }\n /**\n * `plan`, `o`'s, with its padding cut where it would not fit a texture\n * round what `o` drew, the scene's entries from `from` on: its area cut\n * to the target, as PixiJS's filter system measures it (measure.ts in\n * @swf2es/render). Only a padding past what fits round the whole target asks\n * for the area. `textureLimit` is the view's, the largest texture side the context makes.\n */\n fitFilters(o, plan, from, scene, rows, target, resolution, scale, drawing, textureLimit) {\n const res = resolution;\n const width = target.width / res;\n const height = target.height / res;\n if (plan.padding <= filterRoom(textureLimit, res, width, height)) {\n return plan;\n }\n const area = this.drawn;\n drawnArea(scene, rows, this.geometries, from, scale * res, area);\n const room = filterRoom(textureLimit, res, Math.min(area[2] / res, width) - Math.max(area[0] / res, 0), Math.min(area[3] / res, height) - Math.max(area[1] / res, 0));\n const cap = paddingCap(plan.wanted, room);\n const kept = this.filterPlans.get(o);\n if (cap === Number.POSITIVE_INFINITY || !kept) {\n return plan;\n }\n if (drawing) {\n return planFilters(kept.records, kept.units, cap, plan) ?? plan;\n }\n if (kept.cap !== cap || !kept.capped) {\n kept.cap = cap;\n kept.capped = planFilters(kept.records, kept.units, cap, kept.capped ?? plan) ?? plan;\n }\n return kept.capped;\n }\n /** `plan`'s passes added to the frame's filters as a chain, their gradients' textures uploaded: its number. */\n chainOf(plan, filters) {\n for (const pass of plan.passes) {\n let texture = -1;\n if (pass.colors) {\n if (!pass.texture || !this.textures.alive(pass.texture)) {\n // A copy, in bytes Textures lends, as the backend lets the pixels it uploads go.\n const bytes = this.textures.bytes(pass.colors.length);\n bytes.set(pass.colors);\n pass.texture = this.textures.add(256, 1, bytes, GRADIENT_IDLE_FRAMES);\n }\n texture = pass.texture.id;\n this.textures.use(texture);\n }\n else if (pass.map) {\n // Its map as it is now, a texture of its pixels kept as a bitmap's is.\n if (pass.map.disposed) {\n continue;\n }\n // A map set anew is a copy anew, as a tween writing the filters takes one each frame:\n // its texture goes soon once the next one takes its place.\n texture = this.paints.storeTexture(pass.map, GRADIENT_IDLE_FRAMES).id;\n this.textures.use(texture);\n }\n for (const { image, at } of pass.images) {\n pass.values[at] = this.imageTexture(image).id;\n }\n filters.add(pass.kind, pass.values, texture, pass.kernel, pass.ints);\n }\n return filters.close();\n }\n /**\n * A kernel used outside the filters added to the frame's filters as a\n * chain of its own (@swf2es/render's BLEND, which a layer's KERNEL mode\n * names, or FILL_SHADER, which a SHADED draw does), once a frame: its\n * number. A blend shader's first input is what is below and its second\n * the layer, as adl binds them; `whole` blends over the layer's whole\n * rectangle, as adl blends a filtered object's bitmap, rather than where\n * it covers anything. A shader fill's inputs are all images.\n */\n kernelChain(use, filters, kind, whole = false) {\n let made = this.kernels.get(use);\n if (!made) {\n const glsl = kernelGlslOf(use.kernel);\n const { floats, ints } = kernelParameters(glsl, use.values);\n const bound = kind === BLEND ? use.kernel.inputs.slice(0, 2).map((i) => i.index) : [];\n // As a ShaderFilter's values (@swf2es/render's SHADER), whether it blends whole first.\n const values = [0, 0, 0, 0, 0, 0, 0, glsl.textures.length];\n const images = [];\n for (const t of glsl.textures) {\n const image = bound.includes(t) ? undefined : use.images.get(t);\n if (image) {\n images.push({ image, at: values.length + 1 });\n }\n values.push(t, image ? 0 : t === bound[0] ? -1 : -2, image?.floats ? 1 : 0);\n }\n values.push(floats.length, ...floats);\n made = {\n values: Float32Array.from(values),\n ints,\n kernel: glsl.source,\n images,\n filters: null,\n generation: -1,\n whole: false,\n chain: -1,\n };\n this.kernels.set(use, made);\n }\n // Once a frame: a fill drawn in many parts, or by many instances, names one chain.\n if (made.filters === filters &&\n made.generation === filters.generation &&\n made.whole === whole) {\n return made.chain;\n }\n for (const { image, at } of made.images) {\n made.values[at] = this.imageTexture(image).id;\n }\n made.values[0] = whole ? 1 : 0;\n filters.add(kind, made.values, -1, made.kernel, made.ints);\n made.filters = filters;\n made.generation = filters.generation;\n made.whole = whole;\n made.chain = filters.close();\n return made.chain;\n }\n /** An image a kernel samples as a texture, made once, again only after a lost context took it. */\n imageTexture(image) {\n let handle = this.images.get(image);\n if (!handle || !this.textures.alive(handle)) {\n handle = this.textures.add(image.width, image.height, imageTexels(image, this.textures), GRADIENT_IDLE_FRAMES);\n this.images.set(image, handle);\n }\n this.textures.use(handle.id);\n return handle;\n }\n}\n/**\n * An image's texels: a BitmapData's premultiplied RGBA bytes, or floats\n * as they are, four a texel, the channels they lack 0, as the CPU samples\n * them.\n */\nfunction imageTexels(image, textures) {\n if (image.pixels) {\n // In bytes Textures lends: an input that changes every frame is a new image each frame.\n const bytes = textures.bytes(image.pixels.length * 4);\n rgbaInto(image.pixels, bytes);\n return bytes;\n }\n const floats = image.floats;\n const c = image.channels;\n const n = image.width * image.height;\n if (c === 4) {\n return floats.subarray(0, n * 4);\n }\n const out = new Float32Array(n * 4);\n for (let i = 0; i < n; i++) {\n for (let k = 0; k < c; k++) {\n out[i * 4 + k] = floats[i * c + k];\n }\n }\n return out;\n}\n/** Whether every layer `layer` is in has a size, as the planner draws only such. */\nfunction drawnWithin(scene, layer) {\n const r = scene.layers;\n for (let p = scene.parents[layer]; p >= 0; p = scene.parents[p]) {\n if (r[p * 4 + 2] <= 0 || r[p * 4 + 3] <= 0) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=filter-layers.js.map","import { LINE } from \"../display/shapes.js\";\nimport { vertexColor } from \"./shapes.js\";\n/**\n * How far, in pixels of the screen, a line's flattened curves and its\n * round joins' and caps' chords may stray from the curve: a tenth of one,\n * where the fills' finer flatness made strokes several times the\n * triangles, which a software rasteriser pays for; a\n * quarter shows on the references' curved lines. A 9-slice's lines take\n * half that, as its small rounded corners, which Flash draws as exact\n * curves, show a tenth.\n */\nconst STROKE_FLATNESS = 0.1;\n/**\n * A line's width on the stage through the linear transform (a b c d): its\n * own width scaled as its scale mode allows, never under `least`, a pixel\n * of the screen, which is also a hairline's.\n */\nexport function strokeWidth(line, a, b, c, d, least) {\n const sx = Math.abs(a + c);\n const sy = Math.abs(b + d);\n const scale = line.noHScale\n ? line.noVScale\n ? 1\n : sy\n : line.noVScale\n ? sx\n : Math.sqrt((sx * sx + sy * sy) / 2);\n return Math.max(least, (line.width / 20) * scale);\n}\n/** A line's flags in the input: drawn as triangles that may overlap; its paths' outlines filled as one. */\nconst OVERLAPS = 1;\nconst TOGETHER = 2;\n/**\n * `layer`'s lines through the linear transform (a b c d), at least `least`\n * wide, as wide as `by` makes them (a 9-slice's line space) or null, built\n * by `builder`; those of whole alpha as triangles that may overlap where\n * `opaque`. Null for none, or where the builder refused them (a position\n * not a number, or past its memory); undefined where it had no instance, or\n * unwound again, which a later frame may try again.\n */\nexport function layerStrokes(layer, a, b, c, d, least, builder, by = null, opaque = false) {\n // Seen through a transform that collapses the plane, lines cover nothing.\n if (a * d - b * c === 0) {\n return null;\n }\n const built = build(layer, a, b, c, d, least, builder, by, opaque);\n // Once more where libtess2 trapped: the builder's next instance fills the outlines by the bands.\n return built === undefined && builder.unwound\n ? build(layer, a, b, c, d, least, builder, by, opaque)\n : built;\n}\n/**\n * The layer packed into the builder's input and built: null where the\n * builder refused it, undefined where it had no instance or unwound.\n */\nfunction build(layer, a, b, c, d, least, builder, by, opaque) {\n let size = 6;\n for (const { paths } of layer.strokes) {\n size += 7;\n for (const path of paths) {\n size += 5 + path.length;\n }\n }\n const input = builder.input(size);\n if (!input) {\n return undefined;\n }\n input[0] = a;\n input[1] = b;\n input[2] = c;\n input[3] = d;\n // `least` is a pixel of the screen, in the stage's pixels the lines are drawn in.\n input[4] = (by ? STROKE_FLATNESS / 2 : STROKE_FLATNESS) * least;\n input[5] = layer.strokes.length;\n let at = 6;\n for (const { line, paths, closes, triangles } of layer.strokes) {\n input[at] = by\n ? strokeWidth(line, by[0], by[1], by[2], by[3], least) / 2\n : strokeWidth(line, a, b, c, d, least) / 2;\n // Codes a SWF reserves draw round.\n input[at + 1] = line.startCap <= 2 ? line.startCap : 0;\n input[at + 2] = line.join <= 2 ? line.join : 0;\n input[at + 3] = Math.max(1, line.miterLimit);\n input[at + 4] = vertexColor(line.color);\n input[at + 5] =\n (opaque && line.color >>> 24 === 255 ? OVERLAPS : 0) | (triangles ? TOGETHER : 0);\n input[at + 6] = paths.length;\n at += 7;\n // Each path as strokePaths gives it.\n let next = 0;\n for (let i = 0; i < paths.length; i++) {\n const path = paths[i];\n const close = closes?.[next]?.at === i ? closes[next++] : null;\n const home = Boolean(triangles) || (close?.x === path[1] && close.y === path[2]);\n const extra = close && !home;\n input[at] = home ? 1 : 0;\n input[at + 1] = path.length + (extra ? 3 : 0);\n input.set(path, at + 2);\n at += 2 + path.length;\n if (extra) {\n input[at] = LINE;\n input[at + 1] = close.x;\n input[at + 2] = close.y;\n at += 3;\n }\n }\n }\n const built = builder.build(at);\n return built === undefined && !builder.unwound ? null : built;\n}\n//# sourceMappingURL=strokes.js.map","// A shape layer's lines as the renderer of swf2es's own keeps them: stroked\n// by the tessellator's line builder (strokes.ts) for each transform a layer\n// is seen through, found again\n// by a hash of the transform's numbers, and kept while the geometries keep\n// them, within a budget of vertices for those not drawn lately.\nimport { IDLE_FRAMES } from \"@swf2es/render\";\nimport { evenWidth, scalesEvenly } from \"../display/stretch.js\";\nimport { same } from \"../display/value-lists.js\";\nimport { layerStrokes } from \"./strokes.js\";\n/**\n * The vertices kept lines may hold before those drawn neither this frame\n * nor the last go, the least lately drawn first: a layer seen through ever\n * new transforms, as a zoom shows it, would otherwise keep each for the\n * geometries' idle frames. Past it with nothing idle, it grows to half\n * again what is drawn, and comes back down as less is.\n */\nconst LINE_VERTICES = 1_000_000;\n/**\n * How often, in frames, the kept lines are looked over whatever they hold:\n * those the geometries let go of, and those that stroked to nothing, add\n * no vertices that would bring the budget on.\n */\nconst SWEEP_FRAMES = 60;\n/** The bits of a number, read as two ints, for mixHash. */\nconst hashFloat = new Float64Array(1);\nconst hashInts = new Int32Array(hashFloat.buffer);\n/** `h` mixed with the bits of `x`, zero's two signs alike and every NaN, as same() takes them. */\nfunction mixHash(h, x) {\n hashFloat[0] = x === 0 ? 0 : Number.isNaN(x) ? Number.NaN : x;\n return Math.imul(Math.imul(h ^ hashInts[0], 0x9e3779b1) ^ hashInts[1], 0x85ebca6b);\n}\n/** Each shape layer's lines, by the transform they are stroked through (take). */\nexport class LineCache {\n geometries;\n tessellator;\n budget;\n /**\n * Lines stroked anew and lines found stroked already, which the bench and the draw counts read.\n */\n counts = { strokeContexts: 0, strokeReuses: 0 };\n byLayer = new WeakMap();\n /** Every entry, and the vertices they hold. */\n entries = [];\n vertices = 0;\n limit;\n /** The frame the entries were last looked over. */\n swept = 0;\n constructor(geometries, tessellator, budget = LINE_VERTICES) {\n this.geometries = geometries;\n this.tessellator = tessellator;\n this.budget = budget;\n this.limit = budget;\n }\n /** How many transforms' lines are kept, of every layer. */\n get kept() {\n return this.entries.length;\n }\n /** `layer`'s lines as of its drawing's `version`, what is known of them worked out again for another. */\n of(layer, version) {\n let lines = this.byLayer.get(layer);\n if (!lines) {\n lines = {\n version: -1,\n even: false,\n width: 0,\n whole: false,\n byHash: new Map(),\n };\n this.byLayer.set(layer, lines);\n }\n if (lines.version !== version) {\n lines.version = version;\n lines.even = scalesEvenly(layer);\n lines.width = evenWidth(layer);\n lines.whole = false;\n for (let i = 0; !lines.whole && i < layer.strokes.length; i++) {\n lines.whole = layer.strokes[i].line.color >>> 24 === 255;\n }\n }\n return lines;\n }\n /**\n * `layer`'s lines through the linear transform (a b c d), at least `least`\n * wide, drawn opaque or not: stroked again for another transform, screen\n * or version of its drawing, the old ones kept while drawn as the\n * geometries keep them.\n */\n take(layer, version, a, b, c, d, least, by, drawnOpaque) {\n const frame = this.geometries.frame;\n if (frame - this.swept >= SWEEP_FRAMES) {\n this.trim(frame);\n }\n const lines = this.of(layer, version);\n // Only a line of whole alpha draws otherwise when opaque (layerStrokes): a layer of none keeps\n // one geometry through a fade.\n const opaque = drawnOpaque && lines.whole;\n // Found by a hash of the key's numbers, compared as numbers: a layer seen by many instances\n // keeps a transform for each, and a key formatted on every frame cost more than drawing it.\n let hash = mixHash(mixHash(mixHash(mixHash(mixHash(opaque ? 1 : 0, a), b), c), d), least);\n if (by) {\n hash = mixHash(mixHash(mixHash(mixHash(hash, by[0]), by[1]), by[2]), by[3]);\n }\n let bucket = lines.byHash.get(hash);\n let known = null;\n for (let i = 0; bucket && i < bucket.length; i++) {\n const e = bucket[i];\n if (same(e.a, a) &&\n same(e.b, b) &&\n same(e.c, c) &&\n same(e.d, d) &&\n same(e.least, least) &&\n e.opaque === opaque &&\n (e.by === null\n ? by === null\n : by !== null &&\n same(e.by[0], by[0]) &&\n same(e.by[1], by[1]) &&\n same(e.by[2], by[2]) &&\n same(e.by[3], by[3]))) {\n known = e;\n break;\n }\n }\n if (known &&\n known.version === version &&\n (!known.handle || this.geometries.alive(known.handle))) {\n known.usedAt = frame;\n this.counts.strokeReuses++;\n return known.handle;\n }\n if (known?.handle && this.geometries.alive(known.handle)) {\n this.geometries.remove(known.handle.id);\n }\n this.counts.strokeContexts++;\n const data = layerStrokes(layer, a, b, c, d, least, this.tessellator.lines, by, opaque);\n // Not built, as where no instance could be made: none kept, so that a later frame asks again.\n if (data === undefined) {\n return null;\n }\n const handle = data ? this.geometries.add(data) : null;\n const vertices = data ? data.positions.length / 2 : 0;\n if (known) {\n this.vertices += vertices - known.vertices;\n known.handle = handle;\n known.version = version;\n known.vertices = vertices;\n known.usedAt = frame;\n }\n else {\n if (!bucket) {\n bucket = [];\n lines.byHash.set(hash, bucket);\n }\n const entry = {\n a,\n b,\n c,\n d,\n least,\n by: by ? [by[0], by[1], by[2], by[3]] : null,\n opaque,\n handle,\n version,\n within: lines,\n hash,\n vertices,\n usedAt: frame,\n };\n bucket.push(entry);\n this.entries.push(entry);\n this.vertices += vertices;\n }\n if (this.vertices > this.limit) {\n this.trim(frame);\n }\n return handle;\n }\n /**\n * The kept lines looked over: those the geometries let go of, or that\n * stroked to nothing and went undrawn for their idle frames, forgotten;\n * then, past three quarters of the budget, those drawn neither in this\n * `frame` nor the last let go of, the least lately drawn first; the limit\n * set to half again what is left, the budget at least.\n */\n trim(frame) {\n this.swept = frame;\n const entries = this.entries;\n const most = (this.budget * 3) / 4;\n let kept = 0;\n for (const e of entries) {\n if (e.handle ? this.geometries.alive(e.handle) : frame - e.usedAt <= IDLE_FRAMES) {\n entries[kept++] = e;\n }\n else {\n this.forget(e);\n }\n }\n entries.length = kept;\n if (this.vertices > most) {\n // Mid-walk, those drawn last frame may yet be drawn in this one.\n const idle = entries.filter((e) => e.usedAt < frame - 1).sort((x, y) => x.usedAt - y.usedAt);\n for (let i = 0; i < idle.length && this.vertices > most; i++) {\n if (idle[i].handle) {\n this.geometries.remove(idle[i].handle.id);\n }\n this.forget(idle[i]);\n }\n kept = 0;\n for (const e of entries) {\n if (e.vertices >= 0) {\n entries[kept++] = e;\n }\n }\n entries.length = kept;\n }\n this.limit = Math.max(this.budget, this.vertices * 1.5);\n }\n /** `layer`'s lines let go of, as its drawing draws it no more: the next sweep forgets them. */\n drop(layer) {\n for (const bucket of this.byLayer.get(layer)?.byHash.values() ?? []) {\n for (const e of bucket) {\n if (e.handle && this.geometries.alive(e.handle)) {\n this.geometries.remove(e.handle.id);\n }\n }\n }\n }\n /** Line entry `e` taken out of its layer's lines, its vertices no longer counted. */\n forget(e) {\n const bucket = e.within.byHash.get(e.hash);\n const at = bucket ? bucket.indexOf(e) : -1;\n if (bucket && at >= 0) {\n bucket.splice(at, 1);\n if (bucket.length === 0) {\n e.within.byHash.delete(e.hash);\n }\n }\n this.vertices -= e.vertices;\n e.vertices = -1;\n }\n}\n//# sourceMappingURL=lines.js.map","import { deviceMetrics } from \"../text/fonts.js\";\nimport { GUTTER, shownLines } from \"../text/layout.js\";\n/** Device text rasterized at its largest stretch, with bounded extra texture resolution. */\nexport function deviceTextResolution(world, pixels) {\n const [a, b, c, d] = world;\n const x = a * a + b * b;\n const y = c * c + d * d;\n const cross = a * c + b * d;\n const stretch = Math.sqrt((x + y + Math.hypot(x - y, 2 * cross)) / 2);\n const base = Number.isFinite(pixels) && pixels > 0 ? pixels : 1;\n if (!Number.isFinite(stretch)) {\n return base;\n }\n // A turn alone must not cross a resolution boundary through rounding error.\n return Math.max(base, Math.min(8 * base, Math.ceil(stretch * base - 1e-6)));\n}\n/**\n * Whether text laid out at (x, y), `width` by `height`, reaches outside its\n * field, which then clips it: where it lies, as a margin or an indent puts\n * it, not its size alone.\n */\nexport function overruns(field, x, y, width, height) {\n // Within a millionth of a pixel, the field's own size in pixels from its text's in twips\n // rounds off: advanced text, thickened, would be clipped where it only meets the edge.\n const e = 1e-6;\n return (x < field.left - e ||\n y < field.top - e ||\n x + width > field.left + field.width + e ||\n y + height > field.top + field.height + e);\n}\n/** A glyph's outline as a shape of one white fill, in the font's units over 20, as shapeLayers takes twips. */\nexport function glyphShape(glyph) {\n return {\n id: 0,\n bounds: { xMin: 0, xMax: 0, yMin: 0, yMax: 0 },\n edgeBounds: null,\n fills: [{ type: \"solid\", color: 0xffffffff }],\n lines: [],\n records: glyph.records,\n truncated: false,\n };\n}\n/**\n * A TextField's items: its background and border; each line from the\n * first scrolled to that fits, a character of an embedded font as its\n * glyph at its size and in its colour, a run of a device font in one\n * format as one item on the line's baseline; then, focused, its selection\n * and caret. `omitted` learns what is\n * left out.\n */\nexport function fieldItems(o, omitted) {\n const items = [];\n if (o.background) {\n items.push(rect(o.left, o.top, o.width, o.height, 0xff000000 | o.backgroundColor));\n }\n // A border covers the pixels at both edges, x and x + width, as adl draws it.\n if (o.border) {\n const color = 0xff000000 | o.borderColor;\n items.push(rect(o.left, o.top, o.width + 1, 1, color), rect(o.left, o.top + o.height, o.width + 1, 1, color), rect(o.left, o.top + 1, 1, o.height - 1, color), rect(o.left + o.width, o.top + 1, 1, o.height - 1, color));\n }\n if (!o.model.text) {\n caret(o, items);\n return items;\n }\n const layout = o.layout;\n const first = Math.min(Math.max(0, o.scrollV - 1), layout.lines.length - 1);\n // The lines that fit the field from there, one at least: adl draws no line part of the way.\n const last = first + shownLines(o, first) - 1;\n const dx = o.left * 20 - o.scrollH * 20;\n const dy = o.top * 20 - (layout.lines[first].y - GUTTER);\n omitted.advanced ||= o.antiAliasType === \"advanced\";\n let bottom = 0;\n let right = 0;\n let left = Number.POSITIVE_INFINITY;\n const textFrom = items.length;\n for (let l = first; l <= last; l++) {\n const line = layout.lines[l];\n const baseline = (dy + line.y + line.ascent) / 20;\n let run = [];\n const flush = () => {\n if (run.length > 0) {\n items.push(deviceRun(o, run, dx, baseline));\n run = [];\n }\n };\n for (const c of line.chars) {\n if (!c.shown) {\n continue;\n }\n if (c.font) {\n flush();\n if (c.glyph) {\n const s = (Math.max(0, c.format.size) * 20) / c.font.em;\n items.push({\n kind: \"glyph\",\n glyph: c.glyph,\n em: c.font.em,\n m: { a: s, b: 0, c: 0, d: s, tx: (dx + c.x + c.kern) / 20, ty: baseline },\n color: 0xff000000 | c.format.color,\n });\n }\n }\n else if (run.length > 0 && run[0].format !== c.format) {\n flush();\n run.push(c);\n }\n else {\n run.push(c);\n }\n }\n flush();\n bottom = Math.max(bottom, dy + line.y + line.ascent + line.descent);\n right = Math.max(right, dx + line.x + line.width);\n left = Math.min(left, dx + line.x);\n }\n // Clipped inside the gutter, as adl clips it: 2 pixels in from each edge.\n const inner = {\n left: o.left + GUTTER / 20,\n top: o.top + GUTTER / 20,\n width: o.width - (2 * GUTTER) / 20,\n height: o.height - (2 * GUTTER) / 20,\n };\n const top = (dy + layout.lines[first].y) / 20;\n if (overruns(inner, left / 20, top, (right - left) / 20, bottom / 20 - top)) {\n omitted.clip = {\n x: inner.left,\n y: inner.top,\n width: Math.max(0, inner.width),\n height: Math.max(0, inner.height),\n };\n omitted.clipFrom = textFrom;\n omitted.clipTo = items.length;\n }\n caret(o, items);\n return items;\n}\n/**\n * A StaticText's items: each glyph at its height and in its colour, its\n * alpha too, under the text's matrix. Where CSMTextSettings ask for\n * advanced anti-aliasing, `omitted` learns it is drawn as normal.\n */\nexport function staticItems(o, omitted) {\n const m = o.definition.definition.matrix;\n omitted.advanced ||= Boolean(o.definition.csm?.useFlashType);\n const items = [];\n for (const placed of o.glyphs.glyphs) {\n // The fill is in the font's units over 20: a height in twips over the em puts it in pixels.\n const s = placed.height / placed.font.em;\n const x = placed.x / 20;\n const y = placed.y / 20;\n items.push({\n kind: \"glyph\",\n glyph: placed.glyph,\n em: placed.font.em,\n m: {\n a: m.a * s,\n b: m.b * s,\n c: m.c * s,\n d: m.d * s,\n tx: m.a * x + m.c * y + m.tx / 20,\n ty: m.b * x + m.d * y + m.ty / 20,\n },\n color: placed.color,\n });\n }\n return items;\n}\nfunction rect(x, y, width, height, color) {\n return { kind: \"rect\", x, y, width, height, color: color >>> 0 };\n}\n/**\n * A focused input field's caret, a pixel wide and its line's height, in\n * the colour of the text before it, and its selection shaded under it,\n * as adl draws them.\n */\nfunction caret(o, items) {\n if (!o.focused || !(o.type === \"input\" || o.selectable)) {\n return;\n }\n const lines = o.layout.lines;\n if (lines.length === 0) {\n return;\n }\n const first = Math.min(Math.max(0, o.scrollV - 1), lines.length - 1);\n const last = first + shownLines(o, first) - 1;\n const dx = o.left * 20 - o.scrollH * 20;\n const dy = o.top * 20 - (lines[first].y - GUTTER);\n const inner = { left: o.left + GUTTER / 20, right: o.left + o.width - GUTTER / 20 };\n const place = (i) => {\n const line = lines.find((l) => i < l.end) ?? lines[lines.length - 1];\n const c = line.chars[i - line.start];\n const shown = line.chars.filter((ch) => ch.shown);\n const end = shown[shown.length - 1];\n const x = c ? c.x : end ? end.x + end.advance : line.x;\n return { line, x: (dx + x) / 20 };\n };\n const [begin, end] = o.selection;\n if (begin < end) {\n const from = place(begin);\n const to = place(end);\n const a = lines.indexOf(from.line);\n const b = lines.indexOf(to.line);\n for (let i = Math.max(a, first); i <= Math.min(b, last); i++) {\n const line = lines[i];\n const leftX = i === a ? from.x : (dx + line.x) / 20;\n const shown = line.chars.filter((ch) => ch.shown);\n const lastShown = shown.length > 0 ? shown[shown.length - 1] : null;\n const rightX = i === b ? to.x : (dx + (lastShown ? lastShown.x + lastShown.advance : line.x)) / 20;\n const l = Math.max(leftX, inner.left);\n const r = Math.min(rightX, inner.right);\n // 0x3399ff at 0.4.\n items.push(rect(l, (dy + line.y) / 20, Math.max(0, r - l), (line.ascent + line.descent) / 20, 0x663399ff));\n }\n }\n const at = place(o.caret);\n const index = lines.indexOf(at.line);\n if (o.type === \"input\" &&\n index >= first &&\n index <= last &&\n at.x >= inner.left &&\n at.x <= inner.right) {\n const format = o.model.formats[Math.max(0, o.caret - 1)] ?? o.model.defaultFormat;\n const height = Math.max(1, (at.line.ascent + at.line.descent) / 20);\n items.push(rect(at.x, (dy + at.line.y) / 20, 1, height, 0xff000000 | format.color));\n }\n}\n/** A run of a device font's characters in one format, from where the layout put its first, its top at its ascent above the baseline. */\nfunction deviceRun(o, run, dx, baseline) {\n const f = run[0].format;\n const text = run.map((c) => (o.displayAsPassword ? \"*\" : o.model.text[c.index])).join(\"\");\n // As layout sizes it: a size below nothing is none.\n const size = Math.max(0, f.size);\n const metrics = deviceMetrics(f.font, size, f.bold, f.italic);\n return {\n kind: \"device\",\n text,\n family: f.font,\n size,\n bold: f.bold,\n italic: f.italic,\n color: (0xff000000 | f.color) >>> 0,\n letterSpacing: Number.isFinite(f.letterSpacing) ? f.letterSpacing : 0,\n ascent: metrics.ascent,\n descent: metrics.descent,\n x: (dx + run[0].x) / 20,\n top: baseline - metrics.ascent,\n };\n}\n//# sourceMappingURL=text.js.map","import { CLAMP, NORMAL, SMOOTH, SNAP, } from \"@swf2es/render\";\nimport { concatColorInto, IDENTITY_COLOR } from \"../display/color.js\";\nimport { makeRoom, moveLast, same } from \"../display/value-lists.js\";\nimport { cssFont } from \"../text/fonts.js\";\n/** Device texts with runs kept, past which those let go of are looked for and forgotten. */\nconst RUN_KEYS = 512;\n/** Runs kept of one text, in its styles, sizes and resolutions. */\nconst TEXT_RUNS = 8;\n/**\n * How many frames a run of device text may go undrawn: a counter or a field\n * typed into makes a new one each frame, which the usual idle frames would\n * hold hundreds of.\n */\nconst TEXT_IDLE_FRAMES = 30;\n/** The most texels a run of device text has a side, under every WebGL 2's least texture size. */\nconst TEXT_MOST = 4096;\nexport class TextItems {\n geometries;\n textures;\n parts;\n /** A text item's colour, and that before its object's, made in place for each item drawn. */\n itemColor = { ...IDENTITY_COLOR };\n itemColored = { ...IDENTITY_COLOR };\n /** Device text rasterized, by its text; among its runs, by style, metrics and resolution. */\n runs = new Map();\n /** The canvas device text is rasterized on, made as first needed. */\n textCanvas = null;\n constructor(geometries, textures, parts) {\n this.geometries = geometries;\n this.textures = textures;\n this.parts = parts;\n }\n /** How many device texts' runs it keeps drawn. */\n get runCount() {\n return this.runs.size;\n }\n /**\n * A text's item under the object's transform (a b c d tx ty) and colour\n * transform: a glyph its fill, a rectangle the unit quad, each placed by\n * its row and coloured by its colour as a multiplier before the object's;\n * a device run its rasterized texture, a texel a canvas pixel.\n */\n drawTextItem(scene, rows, item, a, b, c, d, tx, ty, color, resolution) {\n // Its colour as a multiplier, and that before the object's, in slots of its own: the row\n // made of them copies them.\n const tint = item.color;\n const own = this.itemColor;\n own.rMul = ((tint >>> 16) & 0xff) / 255;\n own.gMul = ((tint >>> 8) & 0xff) / 255;\n own.bMul = (tint & 0xff) / 255;\n own.aMul = (tint >>> 24) / 255;\n const colored = color ? concatColorInto(this.itemColored, color, own) : own;\n if (item.kind === \"device\") {\n const run = this.deviceRun(item, resolution);\n if (!run) {\n return;\n }\n // A texel a canvas pixel, the run's origin `left` texels in, past its overhang.\n const k = 1 / run.resolution;\n const x = item.x - run.left * k;\n const row = rows.add(a * k, b * k, c * k, d * k, a * x + c * item.top + tx, b * x + d * item.top + ty, colored);\n const quad = this.parts.quad(run.width, run.height);\n this.geometries.use(quad.id);\n this.textures.use(run.handle.id);\n scene.draw(quad.id, row, NORMAL, run.handle.id, SMOOTH | CLAMP);\n return;\n }\n const geometry = item.kind === \"glyph\" ? this.parts.glyphGeometry(item.glyph) : this.parts.unitQuad();\n if (!geometry) {\n return;\n }\n const m = item.kind === \"glyph\"\n ? item.m\n : { a: item.width, b: 0, c: 0, d: item.height, tx: item.x, ty: item.y };\n this.geometries.use(geometry.id);\n // A glyph's outline on quarters of a stage pixel, as Flash places it.\n scene.draw(geometry.id, placedRow(rows, a, b, c, d, tx, ty, m, colored), NORMAL, -1, item.kind === \"glyph\" ? SNAP : 0);\n }\n /**\n * A run of device text rasterized white at `resolution` canvas pixels a\n * stage pixel, or less where that would pass TEXT_MOST texels a side: its\n * ink whole, the overhang left of its origin and past its advance too, its\n * top at the ascent above the baseline; premultiplied, and kept while\n * drawn, for every colour it is drawn in. Null for nothing to draw.\n */\n deviceRun(item, resolution) {\n // By its text, a string there is already; then its style compared as values.\n let runs = this.runs.get(item.text);\n for (let i = runs ? runs.length - 1 : -1; i >= 0; i--) {\n const run = runs[i];\n if (run.family === item.family &&\n same(run.size, item.size) &&\n run.bold === item.bold &&\n run.italic === item.italic &&\n same(run.letterSpacing, item.letterSpacing) &&\n same(run.ascent, item.ascent) &&\n same(run.descent, item.descent) &&\n same(run.asked, resolution) &&\n this.textures.alive(run.handle)) {\n return i === runs.length - 1 ? run : moveLast(runs, i);\n }\n }\n if (!this.textCanvas) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\", { willReadFrequently: true });\n if (!context) {\n return null;\n }\n this.textCanvas = { canvas, context };\n }\n const { canvas, context } = this.textCanvas;\n let scale = resolution;\n let size = { left: 0, width: 0, height: 0 };\n for (let tries = 0; tries < 2; tries++) {\n size = this.measureRun(context, item, scale);\n const most = Math.max(size.width, size.height);\n if (most <= TEXT_MOST) {\n break;\n }\n scale *= TEXT_MOST / most;\n }\n const { left, width, height } = size;\n if (item.size <= 0 || width <= 2 || height <= 2 || width > TEXT_MOST || height > TEXT_MOST) {\n return null;\n }\n canvas.width = width;\n canvas.height = height;\n this.fontAt(context, item, scale);\n context.fillStyle = \"#ffffff\";\n context.textBaseline = \"alphabetic\";\n context.fillText(item.text, left, item.ascent * scale + 1);\n const pixels = new Uint8Array(context.getImageData(0, 0, width, height).data.buffer);\n // The canvas gives straight colour; textures hold it premultiplied.\n for (let i = 0; i < pixels.length; i += 4) {\n const alpha = pixels[i + 3];\n pixels[i] = Math.round((pixels[i] * alpha) / 255);\n pixels[i + 1] = Math.round((pixels[i + 1] * alpha) / 255);\n pixels[i + 2] = Math.round((pixels[i + 2] * alpha) / 255);\n }\n // Those let go of are forgotten, so that text typed and scrolled keeps no lists for them.\n if (this.runs.size > RUN_KEYS) {\n for (const [text, list] of this.runs) {\n let kept = 0;\n for (const r of list) {\n if (this.textures.alive(r.handle)) {\n list[kept++] = r;\n }\n }\n list.length = kept;\n if (kept === 0) {\n this.runs.delete(text);\n }\n }\n runs = this.runs.get(item.text);\n }\n const run = {\n handle: this.textures.add(width, height, pixels, TEXT_IDLE_FRAMES),\n width,\n height,\n left,\n resolution: scale,\n family: item.family,\n size: item.size,\n bold: item.bold,\n italic: item.italic,\n letterSpacing: item.letterSpacing,\n ascent: item.ascent,\n descent: item.descent,\n asked: resolution,\n };\n if (!runs) {\n runs = [];\n this.runs.set(item.text, runs);\n }\n // Its text's runs gone with their textures, and the least lately used past TEXT_RUNS.\n makeRoom(runs, TEXT_RUNS, (r) => !this.textures.alive(r.handle), (r) => {\n if (this.textures.alive(r.handle)) {\n this.textures.remove(r.handle.id);\n }\n });\n runs.push(run);\n return run;\n }\n /** The run's font and spacing set on the canvas at `scale` canvas pixels a stage pixel. */\n fontAt(context, item, scale) {\n context.font = cssFont(item.family, item.size * scale, item.bold, item.italic);\n context.letterSpacing = `${item.letterSpacing * scale}px`;\n }\n /** The texels a run takes at `scale`: its ink left of its origin, and its whole width and height, a texel spare round. */\n measureRun(context, item, scale) {\n this.fontAt(context, item, scale);\n const m = context.measureText(item.text);\n const left = Math.max(0, Math.ceil(m.actualBoundingBoxLeft)) + 1;\n const right = Math.max(m.width, Math.ceil(m.actualBoundingBoxRight));\n return {\n left,\n width: Math.ceil(left + right) + 1,\n height: Math.ceil((item.ascent + item.descent) * scale) + 2,\n };\n }\n}\n/** A row for what `m` places within an object under the transform (a b c d tx ty). */\nexport function placedRow(rows, a, b, c, d, tx, ty, m, color) {\n return rows.add(a * m.a + c * m.b, b * m.a + d * m.b, a * m.c + c * m.d, b * m.c + d * m.d, a * m.tx + c * m.ty + tx, b * m.tx + d * m.ty + ty, color);\n}\n//# sourceMappingURL=text-items.js.map","// Masks as the view draws them (RenderView): a mask's draws begun, used\n// for what it masks and popped, as stencil markers in the scene list; a\n// rectangle, a scroll's or a text's gutter, as the unit quad; and an\n// object drawn whole as a mask, fills alone.\nimport { IDENTITY } from \"@swf2es/format\";\nimport { MASK_BEGIN, MASK_POP, MASK_USE, NORMAL, SNAP, } from \"@swf2es/render\";\nimport { BitmapObject } from \"../display/bitmapobject.js\";\nimport { Container } from \"../display/container.js\";\nimport { CLEAN } from \"../display/displayobject.js\";\nimport { ShapeObject } from \"../display/shapeobject.js\";\nimport { facing } from \"../display/shapes.js\";\nimport { StaticTextObject, TextObject } from \"../display/textobjects.js\";\nimport { unsupported } from \"./shapes.js\";\nimport { fieldItems, staticItems } from \"./text.js\";\nimport { placedRow } from \"./text-items.js\";\nexport class Masks {\n geometries;\n parts;\n /** The masks pushed and not yet popped, as each one's first draw and count. */\n stack = [];\n constructor(geometries, parts) {\n this.geometries = geometries;\n this.parts = parts;\n }\n /** A mask begun: its draws follow, till it is used (maskUse); its first entry's index. */\n maskBegin(scene) {\n scene.marker(MASK_BEGIN);\n return scene.length;\n }\n /**\n * The mask begun at entry `first` (maskBegin) used from here, its draws\n * those since. Begun and used around the mask's draws, with no closure:\n * one in the walk kept every number it took in a context made on each\n * call, boxed, though no mask was drawn.\n */\n maskUse(scene, first) {\n const count = scene.length - first;\n scene.marker(MASK_USE, first, count);\n this.stack.push(first, count);\n }\n /** The mask pushed last taken out: its draws named again. */\n popMask(scene) {\n const count = this.stack.pop();\n const first = this.stack.pop();\n scene.marker(MASK_POP, first, count);\n }\n /** A rectangle of `o`'s space, x y width height, under its transform (a b c d tx ty), as a mask's draw. */\n rectMask(scene, rows, a, b, c, d, tx, ty, x, y, width, height) {\n const quad = this.parts.unitQuad();\n const row = placedRow(rows, a, b, c, d, tx, ty, { a: width, b: 0, c: 0, d: height, tx: x, ty: y }, null);\n this.geometries.use(quad.id);\n scene.draw(quad.id, row, NORMAL);\n }\n /**\n * `o` and all in it drawn as a mask, under its parent's transform: fills\n * alone, a drawing's non-zero, glyphs and bitmaps' rectangles, whatever\n * their visibility, as Flash masks by them. `own` says (a b c d tx ty) is\n * already `o`'s own place, as a mask elsewhere on the list is found; else\n * its own matrix is applied. Flags are cleared as the walk clears them.\n */\n walkMask(scene, rows, snapshotting, o, pa, pb, pc, pd, ptx, pty, own) {\n const m = own ? IDENTITY : o.flatPlaced;\n // What would clip a mask's own coverage needs a stencil within the stencil: drawn whole, and counted.\n if (o.mask || o.scroll || o.clipDepth > 0) {\n unsupported.masks++;\n }\n const a = pa * m.a + pc * m.b;\n const b = pb * m.a + pd * m.b;\n const c = pa * m.c + pc * m.d;\n const d = pb * m.c + pd * m.d;\n const tx = pa * m.tx + pc * m.ty + ptx;\n const ty = pb * m.tx + pd * m.ty + pty;\n const shape = o instanceof ShapeObject ? o.drawn() : null;\n const version = o.drawing ? o.drawing.version : 0;\n const layers = o.drawing\n ? facing(o.drawing.layers, a * d - b * c < 0, version)\n : (shape?.layers ?? null);\n // A mask's drawing drawn again lets go of its old layers too.\n if (o.drawing && layers) {\n this.parts.dropUndrawn(o, layers, version);\n }\n // Its row made as its first draw needs it, in place: a closure here kept every number it took\n // in a context made on each call, boxed, as the walk's did.\n let row = -1;\n if (layers) {\n for (let i = 0; i < layers.length; i++) {\n for (const { part, handle } of this.parts.partsOf(layers[i], version, o.drawing !== null)) {\n // A mesh of a bitmap disposed of draws nothing, as it is drawn, and so masks nothing.\n if (part.mesh?.image.disposed) {\n continue;\n }\n this.geometries.use(handle.id);\n if (row < 0) {\n row = rows.add(a, b, c, d, tx, ty, null);\n }\n scene.draw(handle.id, row, NORMAL);\n }\n }\n }\n if (o instanceof TextObject || o instanceof StaticTextObject) {\n const omitted = { advanced: false, clip: null, clipFrom: 0, clipTo: 0 };\n for (const item of o instanceof TextObject\n ? fieldItems(o, omitted)\n : staticItems(o, omitted)) {\n const geometry = item.kind === \"glyph\" ? this.parts.glyphGeometry(item.glyph) : null;\n if (item.kind === \"glyph\" && geometry) {\n const glyphRow = placedRow(rows, a, b, c, d, tx, ty, item.m, null);\n this.geometries.use(geometry.id);\n scene.draw(geometry.id, glyphRow, NORMAL, -1, SNAP);\n }\n }\n }\n const store = o instanceof BitmapObject ? o.store : null;\n if (store && !store.disposed && store.width > 0 && store.height > 0) {\n const quad = this.parts.quad(store.width, store.height);\n this.geometries.use(quad.id);\n if (row < 0) {\n row = rows.add(a, b, c, d, tx, ty, null);\n }\n scene.draw(quad.id, row, NORMAL);\n }\n if (o instanceof Container) {\n for (const child of o.children) {\n this.walkMask(scene, rows, snapshotting, child, a, b, c, d, tx, ty, false);\n }\n if (!snapshotting) {\n o.descendantsDirty = false;\n }\n }\n // A draw for BitmapData leaves them for the stage's.\n if (!snapshotting) {\n o.dirty = CLEAN;\n }\n }\n}\n//# sourceMappingURL=masks.js.map","import { shapeLayers } from \"../display/shapes.js\";\nimport { bitmapQuad, layerParts } from \"./shapes.js\";\nimport { glyphShape } from \"./text.js\";\n/** Quads made, past which those let go of are looked for and forgotten. */\nconst QUAD_KEYS = 512;\nexport class Parts {\n geometries;\n tessellator;\n lineCache;\n made = new WeakMap();\n maskMade = new WeakMap();\n /**\n * The layers each object's drawing (Graphics) was last drawn as, and of\n * which version: those its next version leaves out are let go of then.\n */\n drawnLayers = new WeakMap();\n /** Quads by their width, then their height: numbers, not a key formatted from them. */\n quads = new Map();\n /** Quads made since the last were let go of, which past QUAD_KEYS looks for those gone. */\n quadsMade = 0;\n /** Each glyph's fill, made once for every text drawn in it; null for an empty glyph. */\n glyphs = new WeakMap();\n constructor(geometries, tessellator, lineCache) {\n this.geometries = geometries;\n this.tessellator = tessellator;\n this.lineCache = lineCache;\n }\n /**\n * `o`'s drawing drawn as `layers` of `version`: the parts of the layers it\n * was last drawn as and is no more let go of now. A drawing cleared and\n * drawn again on every frame, as a software 3D engine draws its\n * triangles, makes new layers each time, whose old parts the idle frames\n * would otherwise keep for hundreds of frames.\n */\n dropUndrawn(o, layers, version) {\n const last = this.drawnLayers.get(o);\n if (last?.version === version) {\n // Another set of the same version, mirrored (facing) or sliced, kept beside the first.\n if (layers !== last.source) {\n for (const layer of layers) {\n last.layers.add(layer);\n }\n }\n return;\n }\n if (last) {\n const now = new Set(layers);\n for (const layer of last.layers) {\n if (!now.has(layer)) {\n this.dropParts(this.made, layer);\n this.dropParts(this.maskMade, layer);\n this.lineCache.drop(layer);\n }\n }\n }\n this.drawnLayers.set(o, { version, source: layers, layers: new Set(layers) });\n }\n /** `layer`'s parts in `cache` let go of. */\n dropParts(cache, layer) {\n const made = cache.get(layer);\n if (!made) {\n return;\n }\n for (const { handle } of made.parts) {\n if (this.geometries.alive(handle)) {\n this.geometries.remove(handle.id);\n }\n }\n cache.delete(layer);\n }\n /**\n * `layer`'s parts, made if they were not, or one was let go of, or its\n * drawing changed since; a drawing used as a mask's apart, filled non-zero.\n */\n partsOf(layer, version, masking = false) {\n const cache = masking ? this.maskMade : this.made;\n const made = cache.get(layer);\n // Additions and frame advances cannot invalidate handles; removals can, even mid-frame.\n if (made && made.version === version) {\n const removalVersion = this.geometries.removalVersion;\n if (made.checkedAt === removalVersion) {\n return made.parts;\n }\n let alive = true;\n for (let i = 0; alive && i < made.parts.length; i++) {\n alive = this.geometries.alive(made.parts[i].handle);\n }\n if (alive) {\n made.checkedAt = removalVersion;\n return made.parts;\n }\n }\n for (const { handle } of made?.parts ?? []) {\n if (this.geometries.alive(handle)) {\n this.geometries.remove(handle.id);\n }\n }\n const parts = layerParts(layer, this.tessellator, masking).map((part) => ({\n part,\n handle: this.geometries.add(part.geometry),\n }));\n cache.set(layer, { parts, version, checkedAt: this.geometries.removalVersion });\n return parts;\n }\n /** A glyph's outline as a white fill, in the font's units over 20, as shapeLayers takes twips. */\n glyphGeometry(glyph) {\n const known = this.glyphs.get(glyph);\n if (known === null || (known && this.geometries.alive(known))) {\n return known;\n }\n const layers = shapeLayers(glyphShape(glyph));\n const part = layers.length > 0 ? layerParts(layers[0], this.tessellator)[0] : undefined;\n const handle = part ? this.geometries.add(part.geometry) : null;\n this.glyphs.set(glyph, handle);\n return handle;\n }\n /** A white square of a pixel, for a row to scale to a rectangle. */\n unitQuad() {\n return this.quad(1, 1);\n }\n /** A bitmap's quad of its size, made once for every bitmap of that size. */\n quad(width, height) {\n let byHeight = this.quads.get(width);\n const known = byHeight?.get(height);\n if (known && this.geometries.alive(known)) {\n return known;\n }\n // Device text makes quads of many sizes: those let go of are forgotten.\n if (++this.quadsMade > QUAD_KEYS) {\n this.quadsMade = 0;\n for (const [w, heights] of this.quads) {\n for (const [h, handle] of heights) {\n if (!this.geometries.alive(handle)) {\n heights.delete(h);\n }\n else {\n this.quadsMade++;\n }\n }\n if (heights.size === 0) {\n this.quads.delete(w);\n }\n }\n // Its width's map, which the sweep may have let go of.\n byHeight = this.quads.get(width);\n }\n if (!byHeight) {\n byHeight = new Map();\n this.quads.set(width, byHeight);\n }\n const handle = this.geometries.add(bitmapQuad(width, height));\n byHeight.set(height, handle);\n return handle;\n }\n}\n//# sourceMappingURL=parts.js.map","import { Commands, Filters, Rows, SceneList, } from \"@swf2es/render\";\nimport { IDENTITY_COLOR } from \"../display/color.js\";\nimport { Container } from \"../display/container.js\";\nimport { TRANSFORM } from \"../display/displayobject.js\";\nimport { sameFilterRecords } from \"../display/filters.js\";\n/** A geometry's colours where its vertices carry none, a 3D object's quad's. */\nconst NO_COLORS = new Uint32Array(0);\n/**\n * A 3D object's quad written into its geometry's arrays in place: its\n * corners, its texels the bitmap's, `width` by `height`, and each corner's\n * depth its w's inverse. Whether any of it changed, as stored.\n */\nfunction planeQuadData(data, quad, width, height) {\n // A function, not a closure over `changed`: it ran for every 3D object on every frame.\n let changed = false;\n for (let i = 0; i < 8; i++) {\n changed = setStored(data.positions, i, quad.positions[i]) || changed;\n }\n for (let i = 0; i < 4; i++) {\n changed = setStored(data.texels, i * 2, i === 1 || i === 2 ? width : 0) || changed;\n changed = setStored(data.texels, i * 2 + 1, i >= 2 ? height : 0) || changed;\n changed = setStored(data.depths, i, 1 / quad.ws[i]) || changed;\n }\n return changed;\n}\n/** `v` stored at `array[i]` as a 32-bit float: whether that changed it. */\nfunction setStored(array, i, v) {\n const stored = Math.fround(v);\n if (array[i] === stored) {\n return false;\n }\n array[i] = stored;\n return true;\n}\nexport class Planes {\n geometries;\n /** Each 3D object's kept bitmap (drawPlane). */\n keptBitmaps = new WeakMap();\n /** Each 3D object's quad as last made (quadGeometry). */\n quads = new WeakMap();\n /** What each 3D object's bitmap was drawn of, which it is kept while unchanged (drawPlane). */\n states = new WeakMap();\n /** BitmapData.draw's kept bitmaps of 3D objects, apart from the stage's. */\n drawnBitmaps = new WeakMap();\n /**\n * How many 3D objects and masks from outside them passes have placed: a\n * pass that places one draws a bitmap that cannot be kept (drawPlane).\n */\n placed = 0;\n /** What `placed` was as each open pass began (enter), which its leave compares with. */\n entered = [];\n /** Where drawPlane works out a quad. */\n quad = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n positions: new Float64Array(8),\n ws: new Float64Array(4),\n };\n /** How many 3D objects' passes the walk is in, and each depth's lists, kept for the next. */\n depth = 0;\n passes = [];\n constructor(geometries) {\n this.geometries = geometries;\n }\n /** What `o`'s bitmap was last drawn of (drawPlane), made on its first. */\n state(o) {\n let k = this.states.get(o);\n if (!k) {\n k = {\n seenAt: -1,\n generation: -1,\n rect: null,\n scrolled: false,\n filters: [],\n unkeepable: false,\n mask: null,\n left: 0,\n top: 0,\n texels: 0,\n samples: 0,\n width: 0,\n height: 0,\n color: { ...IDENTITY_COLOR },\n colored: false,\n };\n this.states.set(o, k);\n }\n return k;\n }\n /**\n * `o`'s quad as `quad` has it, made again as it moves: its texels the bitmap's, `width` by\n * `height`, each corner's depth its w.\n */\n quadGeometry(o, width, height) {\n let kept = this.quads.get(o);\n if (!kept || !this.geometries.alive(kept.handle)) {\n const data = {\n positions: new Float32Array(8),\n colors: NO_COLORS,\n texels: new Float32Array(8),\n depths: new Float32Array(4),\n indices: Uint32Array.of(0, 1, 2, 0, 2, 3),\n };\n planeQuadData(data, this.quad, width, height);\n kept = { handle: this.geometries.add(data), data };\n this.quads.set(o, kept);\n }\n else if (planeQuadData(kept.data, this.quad, width, height)) {\n this.geometries.update(kept.handle.id);\n }\n return kept.handle;\n }\n /** Whether the walk is in a 3D object's pass, whose pixels are its bitmap's, not the stage's. */\n get inPass() {\n return this.depth > 0;\n }\n /**\n * A 3D object, or a mask from outside one, placed by the walk: in a pass,\n * placed by what moves with all above it, which the pass's bitmap then\n * cannot be kept past.\n */\n place() {\n if (this.depth > 0) {\n this.placed++;\n }\n }\n /**\n * A 3D object's pass begun, a depth further in: its lists. Each enter is\n * paired with a leave in a finally, as the walk inside may throw.\n */\n enter() {\n const pass = this.pass(this.depth);\n this.entered.push(this.placed);\n this.depth++;\n return pass;\n }\n /** The pass begun last ended: whether it placed anything (place), which keeps its bitmap from being kept. */\n leave() {\n this.depth--;\n return this.placed !== this.entered.pop();\n }\n /** The lists of a pass at `depth`, made on its first. */\n pass(depth) {\n let pass = this.passes[depth];\n if (!pass) {\n pass = {\n scene: new SceneList(),\n rows: new Rows(),\n filters: new Filters(),\n commands: new Commands(),\n };\n this.passes[depth] = pass;\n }\n return pass;\n }\n}\n/**\n * Whether nothing a 3D object's bitmap holds changed since the frame\n * before drew it: in it but its own transform, which moves its quad\n * alone, nor its filters' values, which setting flags as a transform.\n * One whose pass placed a 3D object or a mask from outside it in it\n * (unkeepable) is drawn anew on every frame, as those move with what\n * above them moves, which flags nothing in it; and BitmapData.draw draws\n * anew.\n */\nexport function planeUnchanged(o, k, frames, snapshotting) {\n return (!snapshotting &&\n !k.unkeepable &&\n k.seenAt === frames - 1 &&\n (o.dirty & ~TRANSFORM) === 0 &&\n !(o.dirty & TRANSFORM && (o.scroll !== null || k.scrolled)) &&\n !(o instanceof Container && o.descendantsDirty) &&\n sameFilterRecords(k.filters, o.filters));\n}\n//# sourceMappingURL=planes.js.map","const openMenus = new WeakMap();\n/** The last item's caption, naming the host's build where it gives one. */\nexport function aboutCaption(build) {\n return build ? `About swf2es (${build})` : \"About swf2es\";\n}\n/**\n * DOM menus stay outside the canvas and exist only while open.\n * `shown` is what the canvas shows in stage coordinates, which may reach\n * past the stage into the margins, as Flash takes the pointer there too;\n * the stage where it is not given.\n */\nexport function bindContextMenu(canvas, player, point, shown = () => null) {\n const document = canvas.ownerDocument;\n const window = document.defaultView;\n const root = canvas.getRootNode();\n const focusTarget = root instanceof ShadowRoot ? root.host : canvas;\n const keyboardEvents = new WeakSet();\n let dismiss = null;\n const open = (event) => {\n if (event.defaultPrevented || player.destroyed) {\n return;\n }\n const keyboard = keyboardEvents.has(event);\n const [x, y] = keyboard\n ? [\n player.scripting?.mouseStageX ?? player.width / 2,\n player.scripting?.mouseStageY ?? player.height / 2,\n ]\n : point(event);\n const area = shown() ?? { x: 0, y: 0, width: player.width, height: player.height };\n if (x < area.x || y < area.y || x >= area.x + area.width || y >= area.y + area.height) {\n return;\n }\n event.preventDefault();\n openMenus.get(document)?.();\n dismiss?.();\n const items = player.contextMenu({\n x,\n y,\n ctrlKey: event.ctrlKey,\n altKey: event.altKey,\n shiftKey: event.shiftKey,\n });\n if (player.destroyed) {\n return;\n }\n items.push({\n caption: aboutCaption(player.build),\n enabled: true,\n separatorBefore: items.length > 0,\n select: () => window?.open(\"https://swf2es.github.io/swf2es/\", \"_blank\", \"noopener\"),\n });\n const lifetime = new AbortController();\n const options = { capture: true, signal: lifetime.signal };\n const prior = document.activeElement;\n const host = document.createElement(\"div\");\n host.dataset.swf2esContextMenu = \"\";\n host.setAttribute(\"popover\", \"manual\");\n host.style.cssText =\n \"position:fixed;inset:auto;margin:0;padding:0;border:0;background:none;z-index:2147483647\";\n const shadow = host.attachShadow({ mode: \"open\" });\n const style = document.createElement(\"style\");\n style.textContent = `\n :host { color-scheme: light dark; }\n [role=menu] { box-sizing:border-box; min-width:190px; max-width:calc(100vw - 8px);\n max-height:calc(100dvh - 8px); overflow:auto; padding:4px; border:1px solid #777;\n border-radius:6px; background:Canvas; color:CanvasText;\n box-shadow:0 4px 16px #0006; font:13px system-ui,sans-serif; }\n [role=menu]:focus { outline:none; }\n button { display:block; width:100%; box-sizing:border-box; padding:6px 18px;\n border:0; border-radius:3px; background:transparent; color:inherit;\n text-align:left; font:inherit; white-space:pre-wrap; overflow-wrap:anywhere; cursor:default; }\n button:focus-visible, button:focus, button:hover:not(:disabled) {\n outline:none; background:Highlight; color:HighlightText; }\n button:disabled { color:GrayText; }\n button[aria-checked=true]::before { content:\"✓ \"; }\n hr { border:0; border-top:1px solid GrayText; margin:4px; }\n `;\n const menu = document.createElement(\"div\");\n menu.setAttribute(\"role\", \"menu\");\n menu.setAttribute(\"aria-label\", \"SWF context menu\");\n menu.tabIndex = -1;\n const buttons = [];\n let closed = false;\n const close = (restore = false) => {\n if (closed) {\n return;\n }\n closed = true;\n lifetime.abort();\n host.remove();\n dismiss = null;\n if (openMenus.get(document) === close) {\n openMenus.delete(document);\n }\n if (restore && prior?.isConnected) {\n prior.focus({ preventScroll: true });\n }\n };\n dismiss = close;\n openMenus.set(document, close);\n const select = (item) => {\n if (closed) {\n return;\n }\n close(true);\n if (!player.destroyed) {\n item.select();\n }\n };\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (item.separatorBefore && i > 0) {\n const separator = document.createElement(\"hr\");\n separator.setAttribute(\"role\", \"separator\");\n menu.append(separator);\n }\n const button = document.createElement(\"button\");\n button.type = \"button\";\n button.setAttribute(\"role\", item.checked === undefined ? \"menuitem\" : \"menuitemradio\");\n if (item.checked !== undefined) {\n button.setAttribute(\"aria-checked\", String(item.checked));\n }\n button.textContent = item.caption;\n button.disabled = !item.enabled;\n button.tabIndex = -1;\n button.addEventListener(\"click\", () => select(item));\n if (item.enabled) {\n buttons.push(button);\n }\n menu.append(button);\n }\n shadow.append(style, menu);\n // The top layer escapes the embedding element's overflow and keeps menus in full screen.\n const parent = root instanceof ShadowRoot ? root : (document.fullscreenElement ?? document.body);\n parent.append(host);\n host.showPopover?.();\n const rect = host.getBoundingClientRect();\n const canvasRect = canvas.getBoundingClientRect();\n const clientX = keyboard ? canvasRect.left + canvasRect.width / 2 : event.clientX;\n const clientY = keyboard ? canvasRect.top + canvasRect.height / 2 : event.clientY;\n host.style.left = `${Math.max(4, Math.min(clientX, (window?.innerWidth ?? 0) - rect.width - 4))}px`;\n host.style.top = `${Math.max(4, Math.min(clientY, (window?.innerHeight ?? 0) - rect.height - 4))}px`;\n // From the keyboard the first item takes focus; from the pointer none does, as in a native\n // menu, so no item looks chosen before the pointer reaches it.\n (keyboard ? (buttons[0] ?? menu) : menu).focus({ preventScroll: true });\n const inside = (e) => e.composedPath().includes(host);\n document.addEventListener(\"pointerdown\", (e) => {\n if (!inside(e)) {\n close();\n }\n }, options);\n host.addEventListener(\"pointerdown\", (e) => e.stopPropagation());\n document.addEventListener(\"focusin\", (e) => {\n if (!inside(e)) {\n close();\n }\n }, options);\n host.addEventListener(\"contextmenu\", (e) => {\n e.preventDefault();\n e.stopPropagation();\n });\n window?.addEventListener(\"blur\", () => close(), options);\n window?.addEventListener(\"resize\", () => close(), options);\n document.addEventListener(\"scroll\", (e) => {\n if (!inside(e)) {\n close();\n }\n }, options);\n document.addEventListener(\"keyup\", (e) => e.stopPropagation(), options);\n document.addEventListener(\"keydown\", (e) => {\n e.stopPropagation();\n const index = buttons.indexOf(shadow.activeElement);\n let next = index;\n switch (e.key) {\n case \"ArrowDown\":\n next = (index + 1) % buttons.length;\n break;\n case \"ArrowUp\":\n next = index < 0 ? buttons.length - 1 : (index - 1 + buttons.length) % buttons.length;\n break;\n case \"Home\":\n next = 0;\n break;\n case \"End\":\n next = buttons.length - 1;\n break;\n case \"Enter\":\n case \" \":\n e.preventDefault();\n buttons[index]?.click();\n return;\n case \"Escape\":\n e.preventDefault();\n close(true);\n return;\n case \"Tab\":\n close(true);\n return;\n default:\n return;\n }\n e.preventDefault();\n buttons[next]?.focus({ preventScroll: true });\n }, options);\n };\n const keyboardMenu = (event) => {\n const e = event;\n if (e.defaultPrevented || (e.key !== \"ContextMenu\" && !(e.key === \"F10\" && e.shiftKey))) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n const menu = new MouseEvent(\"contextmenu\", { bubbles: true, composed: true, cancelable: true });\n keyboardEvents.add(menu);\n canvas.dispatchEvent(menu);\n };\n canvas.addEventListener(\"contextmenu\", open);\n focusTarget.addEventListener(\"keydown\", keyboardMenu, { capture: true });\n if (focusTarget !== canvas) {\n focusTarget.addEventListener(\"contextmenu\", open);\n }\n return () => {\n dismiss?.();\n canvas.removeEventListener(\"contextmenu\", open);\n focusTarget.removeEventListener(\"contextmenu\", open);\n focusTarget.removeEventListener(\"keydown\", keyboardMenu, { capture: true });\n };\n}\n//# sourceMappingURL=context-menu.js.map","// A Shape's stale bitmap cache as the view draws it (RenderView): Flash\n// shows the cache of a Shape given another of the same bounds while\n// cached, until it is drawn at another scale or turn, or its cache goes.\nimport { cached } from \"../display/shapeobject.js\";\nexport class StaleShapes {\n /** Each stale cache a Shape has shown, and the scale and turn it was first drawn at. */\n stales = new WeakMap();\n /**\n * The shape a Shape draws: the one Flash's stale bitmap cache shows, given\n * another of the same bounds while cached (display/shapeobject.ts), while\n * it stands on the stage at the scale and turn (a b c d) it was first\n * drawn at and stays cached; from a frame either changes, what it is\n * (`cache-replace`). Only a frame that\n * draws it decides: one walked hidden draws nothing of it, and\n * BitmapData.draw's walk is in the bitmap's space, which shows the cache\n * as the stage last did.\n */\n staleShape(o, hidden, snapshotting, a, b, c, d) {\n const cache = o.stale;\n if (!cache || hidden) {\n return o.drawn();\n }\n let seen = this.stales.get(o);\n if (snapshotting) {\n return seen?.cache === cache && seen.spent ? o.drawn() : cache.shape;\n }\n if (!seen || seen.cache !== cache) {\n // A first frame with its cache off already draws it as it is.\n seen = { cache, a, b, c, d, spent: !cached(o) };\n this.stales.set(o, seen);\n }\n else if (!seen.spent &&\n (seen.a !== a || seen.b !== b || seen.c !== c || seen.d !== d || !cached(o))) {\n seen.spent = true;\n }\n return seen.spent ? o.drawn() : cache.shape;\n }\n}\n//# sourceMappingURL=stale-shapes.js.map","// The renderer as the player drives it (docs/renderer.md): a view that\n// owns a WebGL 2 canvas, walks the display list into a scene list and its\n// rows, and has @swf2es/render plan and draw it.\nimport { IDENTITY } from \"@swf2es/format\";\nimport { Tessellator } from \"@swf2es/native/render\";\nimport { ALPHA_MASK, BLEND, BLEND_NAMES, CLAMP, Commands, FILL_SHADER, Filters, Geometries, KERNEL, Keeps, LAYER, measureLayers, NO_WHOLE, NORMAL, PLANE, plan, Rows, SceneList, SHADED, SMOOTH, Textures, WHOLE_ALIASED, WHOLE_SMOOTH, } from \"@swf2es/render\";\nimport { WebGLBackend } from \"@swf2es/render/webgl\";\nimport { argbOf } from \"../bitmap/bitmap.js\";\nimport { BitmapObject } from \"../display/bitmapobject.js\";\nimport { concatColor, concatColorInto, IDENTITY_COLOR, sameColor } from \"../display/color.js\";\nimport { Container } from \"../display/container.js\";\nimport { CLEAN } from \"../display/displayobject.js\";\nimport { concat, invert, shifted } from \"../display/geometry.js\";\nimport { bitmapScale, drawnRect, outsideMaskMap, placeQuad } from \"../display/plane.js\";\nimport { sliceDrawn, sliceLayers } from \"../display/scale9.js\";\nimport { cached, ShapeObject } from \"../display/shapeobject.js\";\nimport { facing } from \"../display/shapes.js\";\nimport { settledStretch, stretchOf } from \"../display/stretch.js\";\nimport { StaticTextObject, TextObject } from \"../display/textobjects.js\";\nimport { Clips } from \"../display/walk.js\";\nimport { allowResets, holdSegments, MOST, resetSegments, store as saffronStore, } from \"../text/saffron.js\";\nimport { AdvancedTexts } from \"./advanced.js\";\nimport { FilterLayers } from \"./filter-layers.js\";\nimport { undrawnFilter } from \"./filters.js\";\nimport { syncHidden } from \"./hidden.js\";\nimport { LineCache } from \"./lines.js\";\nimport { Masks } from \"./masks.js\";\nimport { Paints, paintSampler } from \"./paints.js\";\nimport { Parts } from \"./parts.js\";\nimport { Planes, planeUnchanged } from \"./planes.js\";\nimport { bindCanvasPointer } from \"./pointer.js\";\nimport { unsupported } from \"./shapes.js\";\nimport { StaleShapes } from \"./stale-shapes.js\";\nimport { deviceTextResolution, fieldItems, staticItems } from \"./text.js\";\nimport { placedRow, TextItems } from \"./text-items.js\";\n/** No transform, where a walk starts. */\nconst UNIT_PLACE = [1, 0, 0, 1, 0, 0];\n/**\n * Draws the player's display list on a canvas of its own. Each render\n * walks the whole list, writing a row for each object drawn and an entry\n * for each of its layers' geometries, each geometry made once and kept\n * while drawn; then plans the frame and has the backend draw it.\n */\nexport class RenderView {\n canvas;\n gl;\n /** View pixels a stage pixel, before the resolution: a host showing the stage larger. */\n scale = 1;\n /** Screen pixels a stage pixel, which hairlines will be drawn a pixel of; the scale's if null. */\n screenScale = null;\n background;\n transparent;\n /** Lines stroked anew and lines found stroked already (LineCache.counts). */\n counts;\n resolution;\n width;\n height;\n stageQuality = \"HIGH\";\n backend;\n tessellator;\n /** Whether the view made its canvas, whose context it then loses with itself. */\n ownCanvas;\n /** The tessellator the view made, which it disposes of with itself; none if it was given one. */\n ownTessellator;\n scene = new SceneList();\n rows = new Rows();\n geometries = new Geometries();\n textures = new Textures();\n commands = new Commands();\n filters = new Filters();\n lineCache;\n parts;\n paints = new Paints(this.textures, {\n read: (id, width, height) => this.backend.readTexture(id, width, height),\n fill: (id, r, pixel) => this.backend.fillTexture(this.textures, id, r.x, r.y, r.width, r.height, pixel),\n copy: (from, r, to, dx, dy) => this.backend.copyTexture(this.textures, from, r.x, r.y, r.width, r.height, to, dx, dy),\n });\n staleShapes = new StaleShapes();\n textItems;\n advancedTexts;\n masks;\n filterLayers;\n planes;\n /** The largest texture side the context makes, which a filtered layer's padding must fit. */\n textureLimit;\n /** The outlines' store kept while the view is (text/saffron.ts, holdSegments), let go of with it. */\n releaseOutlines = holdSegments();\n /** The walk's depth, and a colour transform a depth, which a concatenation there is made in. */\n walkDepth = 0;\n /** Each depth's transform on the stage, a b c d tx ty, which its children are placed under. */\n places = new Float64Array(6 * 64);\n /** A Bitmap's placement moved onto whole pixels (wholePixels). */\n moved = new Float64Array(6);\n colorSlots = [];\n /** The sliced owner whose children are walked now, its slice, and its parent's linear transform. */\n sliceOwner = null;\n ownerSlice = null;\n ownerParent = [1, 0, 0, 1];\n /** The outputs kept: filtered objects' (FilterLayers) and 3D objects' bitmaps (Planes). */\n keeps = new Keeps();\n /** Moves on as what every kept output was made at changes: the scale, the stage's quality. */\n keptGeneration = 0;\n keptScale = 0;\n keptQuality = \"\";\n keptScreen = null;\n /** The stage's frames drawn. */\n frames = 0;\n /** Where a frame is drawn, filled in as it is. */\n target = { width: 0, height: 0, scale: 1, x: 0, y: 0, resolution: 1, pixel: 1 };\n /**\n * What BitmapData.draw draws alone, while it is drawn (snapshot), and the\n * matrix it is drawn through, after its scroll's shift.\n */\n drawRoot = null;\n /**\n * Whether the walk is BitmapData.draw's, which leaves the objects' flags\n * for the stage's frame; a 3D object's pass in the frame clears them, as\n * the frame's walk would.\n */\n snapshotting = false;\n /** Target pixels a pixel of what filters run on, where not the scale: in a 3D object's bitmap. */\n filterUnits = null;\n drawMatrix = IDENTITY;\n /**\n * The alpha mask drawn for what it masks (drawAlphaMask), which the walk\n * places where it stands on the stage and draws though it is a mask.\n */\n placedAlphaMask = null;\n /**\n * Whether an alpha mask's objects are walked, whose flags their own place\n * on the list may have cleared first: their filters run anew, keeping no\n * output, as nothing would say when one changed.\n */\n inAlphaMask = false;\n /** An object's transform's linear part, made its stretch in place (stretchOf). */\n stretchScratch = [0, 0, 0, 0];\n constructor(options) {\n // First, so that a page that cannot run the render module throws before a context is made.\n this.ownTessellator = options.fillTessellator ? null : new Tessellator();\n this.tessellator = options.fillTessellator ?? this.ownTessellator.tessellate;\n this.width = options.width;\n this.height = options.height;\n this.resolution = options.resolution ?? 1;\n this.background = options.background ?? 0xffffff;\n this.transparent = options.transparent ?? false;\n this.ownCanvas = !options.canvas;\n this.canvas = options.canvas ?? document.createElement(\"canvas\");\n const gl = this.canvas.getContext(\"webgl2\", {\n alpha: this.transparent,\n antialias: false,\n depth: false,\n premultipliedAlpha: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer ?? false,\n stencil: true,\n });\n if (!gl) {\n throw new Error(\"the renderer needs WebGL 2\");\n }\n this.gl = gl;\n this.backend = new WebGLBackend(gl);\n this.samples = options.samples ?? 1;\n this.textureLimit = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n this.lineCache = new LineCache(this.geometries, this.tessellator);\n this.counts = this.lineCache.counts;\n this.parts = new Parts(this.geometries, this.tessellator, this.lineCache);\n this.textItems = new TextItems(this.geometries, this.textures, this.parts);\n this.advancedTexts = new AdvancedTexts(this.geometries);\n this.masks = new Masks(this.geometries, this.parts);\n this.filterLayers = new FilterLayers(this.geometries, this.textures, this.keeps, this.paints);\n this.planes = new Planes(this.geometries);\n this.canvas.addEventListener(\"webglcontextlost\", this.lost);\n this.canvas.addEventListener(\"webglcontextrestored\", this.restored);\n this.resize(this.width, this.height, this.resolution);\n }\n /** A lost context is asked back, as Flash's player would have it, by preventing the default. */\n lost = (event) => {\n event.preventDefault();\n };\n /** The context came back: the backend made again, and every texture added again as it is drawn. */\n restored = () => {\n this.backend.restore(this.geometries);\n this.textures.lost();\n this.keeps.lost();\n };\n /**\n * Whether bitmaps that ask to be are smoothed: not at the stage's low\n * quality, nor in a draw for BitmapData at a sample a pixel.\n */\n get smoothing() {\n return this.snapshotting ? this.scale > 1 : this.stageQuality !== \"LOW\";\n }\n /**\n * Samples a pixel the stage and its blend and filter layers are\n * multisampled with, as the GPU allows, 1 for none: Flash's anti-aliasing,\n * which its host sets by the stage's quality, none at low whatever is set.\n * A BitmapData's draw supersamples instead, as Flash's does.\n */\n get samples() {\n return this.wantedSamples;\n }\n set samples(samples) {\n this.wantedSamples = Math.max(1, Math.floor(samples) || 1);\n this.backend.samples = this.stageQuality === \"LOW\" ? 1 : this.wantedSamples;\n }\n /** The samples the host asked for, which the stage's low quality sets aside (`samples`). */\n wantedSamples = 1;\n /** The stage's quality, \"LOW\" to \"BEST\", which will decide bitmaps' smoothing. */\n get quality() {\n return this.stageQuality;\n }\n set quality(quality) {\n this.stageQuality = quality;\n // Flash draws edges aliased at low, whatever samples the host asked for.\n this.samples = this.wantedSamples;\n }\n /**\n * The rectangle of the stage, from (x, y), the canvas shows: its size\n * the canvas's (resize), in stage\n * pixels, where a host's margins or alignment show more of the stage or\n * less than its own.\n */\n setViewport(x, y, _width, _height) {\n this.viewX = x;\n this.viewY = y;\n }\n /** The stage's point the canvas's corner shows (setViewport). */\n viewX = 0;\n viewY = 0;\n /** Canvas pixels a stage pixel (resize). */\n get canvasResolution() {\n return this.resolution;\n }\n /** How many geometries it keeps, which a page may check. */\n get geometryCount() {\n return this.geometries.count;\n }\n /** How many device texts' runs it keeps drawn (rasterized device text), which a page may check. */\n get textRuns() {\n return this.textItems.runCount;\n }\n /** The canvas made `width` by `height` stage pixels at `resolution` canvas pixels each. */\n resize(width, height, resolution = this.resolution) {\n this.width = width;\n this.height = height;\n this.resolution = resolution;\n this.canvas.width = Math.max(1, Math.round(width * resolution));\n this.canvas.height = Math.max(1, Math.round(height * resolution));\n }\n /** Draw `root`'s display list. */\n render(root) {\n this.scene.reset();\n this.rows.reset();\n this.filters.reset();\n // The drawing buffer, which a browser may hold smaller than the canvas asks for.\n const target = this.target;\n target.width = this.gl.drawingBufferWidth;\n target.height = this.gl.drawingBufferHeight;\n target.scale = this.scale * this.resolution;\n target.resolution = this.resolution;\n // A pixel of the screen, where the host says what that is (screenScale).\n target.pixel = this.screenScale ? target.scale / this.screenScale : 1;\n // Outputs kept at another scale, with bitmaps smoothed otherwise or hairlines at another\n // width, are drawn again.\n if (target.scale !== this.keptScale ||\n this.stageQuality !== this.keptQuality ||\n this.screenScale !== this.keptScreen) {\n this.keptScale = target.scale;\n this.keptQuality = this.stageQuality;\n this.keptScreen = this.screenScale;\n this.keptGeneration++;\n }\n // The outlines' store started again between frames, before it fills: not in a walk, where the\n // quads drawn before would name runs it let go of (text/saffron.ts, allowResets).\n if (saffronStore.used > MOST * 0.75) {\n resetSegments();\n }\n allowResets(false);\n try {\n this.walkFrom(root);\n }\n finally {\n allowResets(true);\n }\n measureLayers(this.scene, this.rows, this.geometries, target);\n this.filterLayers.noteKept(this.scene);\n this.frames++;\n plan(this.scene, this.transparent ? 0 : (0xff000000 | this.background) >>> 0, this.commands);\n this.uploadOutlines();\n this.backend.execute(this.commands, this.scene, this.rows, this.geometries, this.textures, this.filters, this.keeps, target);\n this.geometries.endFrame();\n this.textures.endFrame();\n this.keeps.endFrame();\n }\n /**\n * `o` and what is in it, under its parent's transform on the stage (a b\n * c d tx ty) and colour transform. Masks are walked but not drawn, nor\n * what is hidden; every object's flags are cleared, as the player\n * expects of a renderer.\n */\n walk(o, tint, hidden) {\n if (hidden) {\n syncHidden(o, this.snapshotting);\n return;\n }\n // Its parent's transform from the stack of them, where its own goes for its children: numbers\n // a recursive call passed were boxed, six an object on every frame.\n const depth = this.walkDepth++;\n let places = this.places;\n const at = depth * 6;\n const pa = places[at];\n const pb = places[at + 1];\n const pc = places[at + 2];\n const pd = places[at + 3];\n const ptx = places[at + 4];\n const pty = places[at + 5];\n const root = o === this.drawRoot;\n // An alpha mask drawn for what it masks is placed by its parent's slot alone (drawAlphaMask).\n const placing = o === this.placedAlphaMask;\n const m = root ? this.drawMatrix : placing ? IDENTITY : o.flatPlaced;\n const a = pa * m.a + pc * m.b;\n const b = pb * m.a + pd * m.b;\n const c = pa * m.c + pc * m.d;\n const d = pb * m.c + pd * m.d;\n const tx = pa * m.tx + pc * m.ty + ptx;\n const ty = pb * m.tx + pd * m.ty + pty;\n // Its own after its parent's, where its rows and its children read it.\n if (at + 12 > places.length) {\n const grown = new Float64Array(places.length * 2);\n grown.set(places);\n this.places = grown;\n places = grown;\n }\n places[at + 6] = a;\n places[at + 7] = b;\n places[at + 8] = c;\n places[at + 9] = d;\n places[at + 10] = tx;\n places[at + 11] = ty;\n if (!hidden && o.visible) {\n noteUnsupported(o);\n }\n // What BitmapData.draw takes is drawn though hidden, or a mask.\n hidden ||= !root && !placing && (!o.visible || o.maskOf !== null || o.clipDepth > 0);\n // BitmapData.draw takes its object without its own colour transform, as adl draws it.\n const own = root ? null : o.colorTransform;\n // Into a slot of its depth's, which its subtree's walk alone reads: rows copy what they take.\n let color = own ? (tint ? this.concatAt(depth, tint, own) : own) : tint;\n // Its mask, drawn where it stands on the stage, then its scroll's rectangle, clip all it draws;\n // a 3D mask, or one inside what it masks, masks nothing in Flash. A script's mask on the display\n // list masks by its alpha where both are cached as bitmaps, as adl draws it (the `alpha-masks`\n // case): what it masks drawn as a layer, the mask's own layer composited onto it by its alpha\n // (drawAlphaMask). A timeline's masks clip by their shapes, cached or not (`alpha-masks-avm1`).\n // One met while an alpha mask is drawn clips by its shape: two masks each holding what the other\n // masks would otherwise draw each other without end.\n let clipped = false;\n let alphaMask = null;\n // A 3D object's content is drawn into its bitmap (drawPlane), which a 2D mask clips there, in\n // its pass, not its quad on the stage.\n const plane = !hidden && !root && o.space !== null;\n if (!hidden && !plane && o.mask) {\n const mask = !o.maskOf && !o.mask.encloses(o) && !o.mask.space ? o.mask : null;\n if (mask?.parent && !this.inAlphaMask && cached(o) && cached(mask)) {\n alphaMask = mask;\n }\n else if (mask) {\n const w = this.placedMask(mask);\n const first = this.masks.maskBegin(this.scene);\n this.masks.walkMask(this.scene, this.rows, this.snapshotting, mask, w.a, w.b, w.c, w.d, w.tx, w.ty, true);\n this.masks.maskUse(this.scene, first);\n clipped = true;\n }\n else {\n unsupported.masks++;\n }\n }\n // A blend mode draws it as a layer, composited onto what is below in its mode. An explicit\n // layer with children colours their combined pixels, its own fills with them, which then take\n // no colour of their own; without children, it colours each fill.\n // A layer of no children is its fills, drawn as normal; a mode it has no blend for (a Pixel\n // Bender shader's) is drawn as normal, and counted.\n // BitmapData.draw takes its object with no blend mode, as with no transform or colour.\n // A blend shader's mode names its kernel's chain of the frame's filters; \"shader\" with none is\n // normal. A filtered object blends as the bitmap Flash keeps of it, over its whole rectangle.\n const shading = !root && !hidden && o.blendMode === \"shader\";\n const named = shading\n ? o.blendShader\n ? KERNEL +\n this.filterLayers.kernelChain(o.blendShader, this.filters, BLEND, !plane && o.filters.length > 0)\n : NORMAL\n : root\n ? NORMAL\n : BLEND_NAMES.indexOf(o.blendMode);\n if (named < 0 && !hidden) {\n unsupported.blendModes++;\n }\n const childful = o instanceof Container && o.children.length > 0;\n // A 3D object's layer is its bitmap already.\n const mode = hidden || named < 0 || (named === LAYER && (!childful || plane)) ? NORMAL : named;\n // Its filters draw it as a layer too, which they run over before its blend: adl filters the\n // object, then blends what they make, in its colour from the stage down, as a bitmap of it. The\n // 9-slice grid that reshapes what it draws itself (display/scale9.ts): its own, sliced as its\n // morphs take their new ratios, so that its bounds are this frame's; or, for a Shape, its\n // owner's, kept as the owner's children are walked, unless it is filtered, which adl draws as a\n // bitmap of it, stretched whole (sliceFor). Masks are hidden, and draw unsliced; so does what\n // BitmapData.draw takes, its Shapes by its grid too, which draws with no transform of its own.\n const ownSlice = !hidden && o.scale9Grid && !root ? sliceDrawn(o) : null;\n const slice = ownSlice ??\n (!hidden &&\n o instanceof ShapeObject &&\n o.parent !== null &&\n o.parent === this.sliceOwner &&\n o.filters.length === 0\n ? this.ownerSlice\n : null);\n // A 3D object's content is drawn in its own space into a bitmap, which its quad then places in\n // perspective (drawPlane); its filters run in the bitmap, its blend on the quad.\n const filtering = hidden || plane || o.filters.length === 0\n ? null\n : this.filterLayers.filterPlan(o, this.filterUnits, this.scale, this.drawRoot !== null);\n // Its colour, which a 3D object's bitmap takes, all above it drawn into it.\n const full = color;\n // A ShaderFilter's kernel runs over Flash's bitmap of the object, of whole pixels.\n const whole = !filtering?.whole\n ? NO_WHOLE\n : this.stageQuality === \"LOW\"\n ? WHOLE_ALIASED\n : WHOLE_SMOOTH;\n let layerRow = -1;\n let layer = -1;\n let drawnFrom = 0;\n let output = null;\n // Its filters run before its alpha mask is applied, as Flash masks the bitmap they make: then in\n // a layer of their own, composited as normal into the one the mask is, which takes its mode.\n const wrapped = alphaMask !== null && filtering !== null;\n const inner = wrapped ? NORMAL : mode;\n if (wrapped) {\n this.scene.layerBegin();\n }\n if (mode !== NORMAL || filtering || alphaMask) {\n if (mode === LAYER || filtering) {\n layerRow = color ? this.rows.add(1, 0, 0, 1, 0, 0, color) : -1;\n color = null;\n }\n // What its filters made last, where nothing they ran on changed: composited again where it\n // moved to, and all in it walked hidden, as Flash draws a filtered object's bitmap again.\n // A blend shader's layer is composited anew each frame: a kept one's mode is a byte.\n output =\n filtering && !this.drawRoot && mode < KERNEL && !this.inAlphaMask\n ? this.filterLayers.keptOutput(o, filtering, slice?.key ?? \"\", a, b, c, d, tx, ty, this.target, this.frames, this.keptGeneration, whole)\n : null;\n if (output?.reused) {\n const k = output.handle;\n const rect = this.filterLayers.keptRect;\n this.scene.keptLayer(k.id, inner, layerRow, rect[0], rect[1], rect[2], rect[3]);\n this.keeps.use(k.id);\n hidden = true;\n }\n else {\n // Over the rectangle of what is drawn in it, which measureLayers finds; its padding is set\n // once its filters are fitted to that.\n drawnFrom = this.scene.length;\n const keep = output?.keeping ? output.handle.id : -1;\n layer = this.scene.layerBegin(filtering ? 0 : -1, keep, whole);\n }\n }\n // Drawn in its pass, which walked all in it, its flags cleared: walked here no further. Else\n // walked hidden, to clear them.\n const passed = plane && this.drawPlane(o, full, pa, pb, pc, pd, ptx, pty);\n hidden ||= plane;\n // Its scroll's rectangle clips what it draws, inside its layer.\n const r = hidden ? null : o.scroll;\n if (r) {\n // A rectangle of no size clips everything, as an empty one does.\n const width = Math.max(0, r.xMax - r.xMin);\n const height = Math.max(0, r.yMax - r.yMin);\n const first = this.masks.maskBegin(this.scene);\n this.masks.rectMask(this.scene, this.rows, a, b, c, d, tx, ty, r.xMin, r.yMin, width, height);\n this.masks.maskUse(this.scene, first);\n }\n // A shape takes a morph's new ratio as it is drawn, which its bounds and hit tests follow; one\n // whose bitmap cache Flash shows stale draws what that shows (staleShape).\n const shape = o instanceof ShapeObject\n ? this.staleShapes.staleShape(o, hidden, this.snapshotting, a, b, c, d)\n : null;\n // adl culls drawTriangles' triangles as they turn on the screen, or in a BitmapData's draw.\n const version = o.drawing ? o.drawing.version : 0;\n const drawn = o.drawing\n ? facing(o.drawing.layers, a * d - b * c < 0, version)\n : (shape?.layers ?? null);\n const layers = hidden || !drawn\n ? null\n : slice\n ? sliceLayers(drawn, slice, ownSlice ? null : o.placed, version)\n : drawn;\n if (o.drawing && layers) {\n this.parts.dropUndrawn(o, layers, version);\n }\n // A sliced line keeps the width it has in its owner's parent's space, as adl's does, times a\n // Shape child's own scale; made as a stroked layer first needs it.\n let lineBy = null;\n let row = -1;\n let lineRow = -1;\n // Lines that scale both ways, stroked through the transform's settled stretch, which every\n // angle and instance shares (display/stretch.ts), and placed by the rest of it.\n let stretch;\n let stretchRow = -1;\n if (layers) {\n // A pixel of the screen, in the stage's pixels: the least a line is wide.\n const least = 1 / (this.screenScale ?? this.scale * this.resolution);\n // Alpha left whole by the colour transform: a line's overlaps then draw nothing new.\n const opaque = !color || color.aMul + color.aAdd / 255 >= 1;\n // Read once for the object, not for each textured part.\n const smoothing = this.smoothing;\n for (let i = 0; i < layers.length; i++) {\n for (const { part, handle } of this.parts.partsOf(layers[i], version)) {\n // Kept while drawn, even with no texture yet: a layer let go of is tessellated again whole.\n this.geometries.use(handle.id);\n // A shader fill's draw names its kernel's chain of the frame's filters.\n if (part.paint?.type === \"shader\") {\n if (row < 0) {\n row = this.rows.addPlaced(this.places, at + 6, color);\n }\n const chain = this.filterLayers.kernelChain(part.paint.use, this.filters, FILL_SHADER);\n this.scene.draw(handle.id, row, NORMAL, chain, SHADED);\n continue;\n }\n const textured = part.paint !== null || part.mesh !== null;\n const texture = textured ? this.paints.paintTexture(part) : null;\n if (textured && !texture) {\n continue;\n }\n if (row < 0) {\n row = this.rows.addPlaced(this.places, at + 6, color);\n }\n if (texture) {\n this.textures.use(texture.id);\n }\n this.scene.draw(handle.id, row, NORMAL, texture?.id ?? -1, texture ? paintSampler(part, smoothing) : 0);\n }\n // The layer's lines after its fills: through its stretch where they scale both ways, else\n // stroked in the stage's axes and placed by the translation alone.\n if (layers[i].strokes.length === 0) {\n continue;\n }\n if (slice && !lineBy) {\n lineBy = ownSlice ? [pa, pb, pc, pd] : this.childLineSpace(o);\n }\n const even = !lineBy && this.lineCache.of(layers[i], version).even;\n if (even && stretch === undefined) {\n // Settled for the widest line of the object's layers that scale both ways (evenWidth).\n let widest = 0;\n for (let k = 0; k < layers.length; k++) {\n widest = Math.max(widest, this.lineCache.of(layers[k], version).width);\n }\n const m = this.stretchScratch;\n m[0] = a;\n m[1] = b;\n m[2] = c;\n m[3] = d;\n stretch = stretchOf(m, m);\n stretch = stretch && settledStretch(stretch, widest, least, stretch);\n }\n const by = even ? stretch : null;\n const lines = by\n ? this.lineCache.take(layers[i], version, by[0], by[1], by[2], by[3], least, null, opaque)\n : this.lineCache.take(layers[i], version, a, b, c, d, least, lineBy, opaque);\n if (!lines) {\n continue;\n }\n if (by && stretchRow < 0) {\n // m s⁻¹, s symmetric: what turns and mirrors the stretched lines into place.\n const det = by[0] * by[3] - by[1] * by[1];\n const n0 = by[3] / det;\n const n1 = -by[1] / det;\n const n3 = by[0] / det;\n stretchRow = this.rows.add(a * n0 + c * n1, b * n0 + d * n1, a * n1 + c * n3, b * n1 + d * n3, tx, ty, color);\n }\n else if (!by && lineRow < 0) {\n lineRow = this.rows.addTranslated(this.places, at + 6, color);\n }\n this.geometries.use(lines.id);\n this.scene.draw(lines.id, by ? stretchRow : lineRow, NORMAL);\n }\n }\n if (!hidden && (o instanceof TextObject || o instanceof StaticTextObject)) {\n const omitted = { advanced: false, clip: null, clipFrom: 0, clipTo: 0 };\n const items = o instanceof TextObject ? fieldItems(o, omitted) : staticItems(o, omitted);\n // Its embedded glyphs as Saffron draws them, all in one geometry drawn where the first of\n // them was, else as normal text.\n // In a 3D object's bitmap, whose pixels are not the stage's, as normal text.\n const advanced = omitted.advanced && !this.planes.inPass\n ? this.advancedTexts.advancedText(o, a, b, c, d, this.target, this.drawRoot !== null)\n : null;\n if (omitted.advanced && !advanced) {\n unsupported.advancedTexts++;\n }\n let glyphsDrawn = false;\n let glyph = 0;\n let normal = 0;\n // Device text as sharp as the text is shown: canvas pixels a stage pixel, at its stretch.\n const resolution = o instanceof TextObject && !o.embedFonts\n ? deviceTextResolution([a, b, c, d], this.scale * this.resolution)\n : 1;\n // Its text, where it runs over, clipped inside the gutter; its box and caret are not.\n const clip = omitted.clip;\n for (let k = 0; k < items.length; k++) {\n if (clip && k === omitted.clipFrom) {\n const first = this.masks.maskBegin(this.scene);\n this.masks.rectMask(this.scene, this.rows, a, b, c, d, tx, ty, clip.x, clip.y, clip.width, clip.height);\n this.masks.maskUse(this.scene, first);\n }\n // A glyph whose tables found no room among Saffron's is drawn as normal text.\n const item = items[k];\n let drawnNormal = false;\n if (advanced && item.kind === \"glyph\") {\n drawnNormal = advanced.normal[normal] === glyph;\n normal += drawnNormal ? 1 : 0;\n glyph++;\n }\n if (!advanced || item.kind !== \"glyph\" || drawnNormal) {\n this.textItems.drawTextItem(this.scene, this.rows, item, a, b, c, d, tx, ty, color, resolution);\n }\n else if (!glyphsDrawn && advanced.handle) {\n glyphsDrawn = true;\n this.geometries.use(advanced.handle.id);\n this.scene.draw(advanced.handle.id, placedRow(this.rows, a, b, c, d, tx, ty, advanced.m, color), NORMAL);\n }\n if (clip && k === omitted.clipTo - 1) {\n this.masks.popMask(this.scene);\n }\n }\n }\n const store = o instanceof BitmapObject && !hidden ? o.store : null;\n if (store && !store.disposed && store.width > 0 && store.height > 0) {\n const quad = this.parts.quad(store.width, store.height);\n const texture = this.paints.storeTexture(store);\n const moved = wholePixels(this.places, at + 6, this.target.scale / this.target.pixel, this.moved);\n if (moved) {\n row = this.rows.addPlaced(this.moved, 0, color);\n }\n else if (row < 0) {\n row = this.rows.addPlaced(this.places, at + 6, color);\n }\n this.geometries.use(quad.id);\n this.textures.use(texture.id);\n const smooth = !moved && o.smoothing && this.smoothing;\n this.scene.draw(quad.id, row, NORMAL, texture.id, (smooth ? SMOOTH : 0) | CLAMP);\n }\n if (o instanceof Container && !passed) {\n // A timeline's clip layer clips the children after it, up to its clip depth: kept track of\n // only where a child is one, as most containers have none.\n const children = o.children;\n let clips = null;\n let open = 0;\n // A sliced owner's Shapes are sliced by its grid, their lines as wide as in its parent's space.\n const owner = this.sliceOwner;\n const ownerSlice = this.ownerSlice;\n const ownerParent = this.ownerParent;\n this.sliceOwner = ownSlice ? o : null;\n this.ownerSlice = ownSlice;\n if (ownSlice) {\n this.ownerParent = [pa, pb, pc, pd];\n }\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!clips && child.clipDepth > 0) {\n clips = new Clips();\n }\n if (clips) {\n const n = clips.enter(child);\n for (; open > n; open--) {\n this.masks.popMask(this.scene);\n }\n }\n if (child.clipDepth > 0 && !hidden) {\n const first = this.masks.maskBegin(this.scene);\n this.masks.walkMask(this.scene, this.rows, this.snapshotting, child, a, b, c, d, tx, ty, false);\n this.masks.maskUse(this.scene, first);\n open++;\n continue;\n }\n this.walk(child, color, hidden);\n }\n this.sliceOwner = owner;\n this.ownerSlice = ownerSlice;\n this.ownerParent = ownerParent;\n for (; open > 0; open--) {\n this.masks.popMask(this.scene);\n }\n if (!this.snapshotting) {\n o.descendantsDirty = false;\n }\n }\n if (r) {\n this.masks.popMask(this.scene);\n }\n if (output?.reused) {\n // Composited again already.\n }\n else if (filtering) {\n const fitted = this.filterLayers.fitFilters(o, filtering, drawnFrom, this.scene, this.rows, this.target, this.resolution, this.scale, this.drawRoot !== null, this.textureLimit);\n this.scene.padLayer(layer, fitted.padding);\n this.scene.layerEnd(inner, layerRow, this.filterLayers.chainOf(fitted, this.filters));\n if (output) {\n output.pad = fitted.padding;\n this.filterLayers.ranLayer(output, layer);\n }\n }\n if (alphaMask) {\n this.drawAlphaMask(alphaMask);\n this.scene.layerEnd(mode, wrapped ? -1 : layerRow);\n }\n else if (!filtering && mode !== NORMAL) {\n this.scene.layerEnd(mode, layerRow);\n }\n if (clipped) {\n this.masks.popMask(this.scene);\n }\n this.walkDepth--;\n // A draw for BitmapData leaves them for the stage's.\n if (!this.snapshotting) {\n o.dirty = CLEAN;\n }\n }\n /**\n * `mask`, an alpha mask, drawn into a layer of its own as it would be\n * drawn where it stands on the stage, though it is a mask: in its colour\n * and its ancestors', its filters run, from a slot of the walk's above\n * the object it masks. The layer is composited onto that object's\n * (ALPHA_MASK), which ends after it.\n */\n drawAlphaMask(mask) {\n const w = this.placedMask(mask);\n const depth = this.walkDepth;\n const at = depth + 1;\n if ((at + 2) * 6 > this.places.length) {\n const grown = new Float64Array(this.places.length * 2);\n grown.set(this.places);\n this.places = grown;\n }\n const places = this.places;\n places[at * 6] = w.a;\n places[at * 6 + 1] = w.b;\n places[at * 6 + 2] = w.c;\n places[at * 6 + 3] = w.d;\n places[at * 6 + 4] = w.tx;\n places[at * 6 + 5] = w.ty;\n const placed = this.placedAlphaMask;\n const inMask = this.inAlphaMask;\n this.walkDepth = at;\n this.placedAlphaMask = mask;\n this.inAlphaMask = true;\n this.scene.layerBegin();\n this.walk(mask, ancestorsColor(mask), false);\n this.scene.layerEnd(ALPHA_MASK, -1);\n this.placedAlphaMask = placed;\n this.inAlphaMask = inMask;\n this.walkDepth = depth;\n }\n /**\n * The linear transform a Shape child of a sliced owner draws its lines\n * as wide through: the owner's parent's, kept as the owner's children\n * are walked, times its own matrix.\n */\n childLineSpace(o) {\n const q = this.ownerParent;\n const m = o.matrix;\n return [\n q[0] * m.a + q[2] * m.b,\n q[1] * m.a + q[3] * m.b,\n q[0] * m.c + q[2] * m.d,\n q[1] * m.c + q[3] * m.d,\n ];\n }\n /** `o` walked from the stage's origin, untinted; the stage's, moved by its viewport. */\n walkFrom(o) {\n this.walkDepth = 0;\n this.places.set(UNIT_PLACE);\n if (!this.drawRoot) {\n this.places[4] = -this.viewX;\n this.places[5] = -this.viewY;\n }\n this.walk(o, null, false);\n }\n /** `parent` and `child` concatenated into depth `depth`'s colour slot, made once and kept. */\n concatAt(depth, parent, child) {\n let slot = this.colorSlots[depth];\n if (!slot) {\n slot = { ...IDENTITY_COLOR };\n this.colorSlots[depth] = slot;\n }\n return concatColorInto(slot, parent, child);\n }\n /**\n * A 3D object drawn as Flash draws it (display/plane.ts): what it and its\n * children draw, in its own space, a texel a pixel at `samples` a side\n * and averaged down, into a bitmap kept as a kept output, in a pass of\n * its own before the frame's (drawPlaneContent), in its colour `full`,\n * filtered; then the bitmap's quad, placed by its plane in its parent's\n * space (a b c d tx ty on the stage), smoothed at each pixel of Flash's.\n * The bitmap is kept while nothing it holds changes (unchanged). Nothing\n * where its quad has a corner behind the eye, or it draws nothing, or a\n * 3D object masks it, which leaves nothing of it in Flash. Whether all in\n * it was walked, or needs no walk, its flags clear.\n */\n drawPlane(o, full, a, b, c, d, tx, ty) {\n if (o.mask?.space) {\n return false;\n }\n // Counted in another's bitmap, placed by what moves with all above it.\n this.planes.place();\n // What it draws, measured again only where something in it may have changed.\n const k = this.planes.state(o);\n const unchanged = planeUnchanged(o, k, this.frames, this.snapshotting);\n const rect = unchanged && k.rect ? k.rect : drawnRect(o);\n const quad = this.planes.quad;\n if (!rect ||\n !placeQuad(o.placed, rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, quad)) {\n return false;\n }\n const { samples, texels } = bitmapScale(quad.width, quad.height, this.textureLimit);\n const width = Math.max(1, Math.ceil(quad.width * texels));\n const height = Math.max(1, Math.ceil(quad.height * texels));\n // Let go of on the first frame it is not drawn: one not drawn on the frame before is drawn\n // anew, and a timeline makes 3D objects anew as it plays. BitmapData.draw's apart, in its\n // colour and at its quality, which the stage's bitmap must not take.\n const keeps = this.snapshotting ? this.planes.drawnBitmaps : this.planes.keptBitmaps;\n let keep = keeps.get(o);\n const alive = keep !== undefined && this.keeps.alive(keep);\n if (!keep || !alive) {\n keep = this.keeps.add(0);\n keeps.set(o, keep);\n }\n this.keeps.use(keep.id);\n // Its quad, made before its content's pass, in which a 3D object inside it works out its own in\n // `quad`.\n const handle = this.planes.quadGeometry(o, width, height);\n this.geometries.use(handle.id);\n const row = this.rows.add(a, b, c, d, tx, ty, null);\n const left = quad.x;\n const top = quad.y;\n // Its bitmap kept where it holds what it would draw now: nothing in it has a flag to clear.\n const same = alive &&\n unchanged &&\n k.generation === this.keptGeneration &&\n k.mask === o.mask &&\n (!o.mask || o.encloses(o.mask)) &&\n k.left === left &&\n k.top === top &&\n k.texels === texels &&\n k.samples === samples &&\n k.width === width &&\n k.height === height &&\n (full ? k.colored && sameColor(k.color, full) : !k.colored);\n if (!same) {\n k.unkeepable = this.drawPlaneContent(o, full, left, top, texels, samples, width, height, keep.id);\n }\n if (!this.snapshotting) {\n k.seenAt = this.frames;\n k.generation = this.keptGeneration;\n k.rect = rect;\n k.scrolled = o.scroll !== null;\n k.filters = o.filters;\n k.mask = o.mask;\n k.left = left;\n k.top = top;\n k.texels = texels;\n k.samples = samples;\n k.width = width;\n k.height = height;\n k.colored = full !== null;\n if (full) {\n Object.assign(k.color, full);\n }\n }\n this.scene.draw(handle.id, row, NORMAL, keep.id, PLANE);\n return true;\n }\n /**\n * A 3D object's content drawn into its bitmap, kept as kept output `keep`:\n * walked with the object as the root of a pass of its own, as\n * BitmapData.draw walks its object, placed by its own space's pixels from\n * the bitmap's corner (left, top) at `texels` a pixel, at `samples` target pixels\n * each, with lists of its own, which a 3D object in it nests in again.\n */\n drawPlaneContent(o, full, left, top, texels, samples, width, height, keep) {\n const pass = this.planes.enter();\n const outer = this.passState();\n const target = {\n width: width * samples,\n height: height * samples,\n scale: samples,\n x: 0,\n y: 0,\n resolution: 1,\n pixel: samples,\n };\n this.scene = pass.scene;\n this.rows = pass.rows;\n this.filters = pass.filters;\n this.commands = pass.commands;\n this.target = target;\n this.scale = samples;\n // Filters at the bitmap's units of the object's pixels, which a large object has fewer of.\n this.filterUnits = samples * texels;\n this.resolution = 1;\n this.screenScale = 1;\n this.drawRoot = o;\n // Its scroll's rectangle at its bitmap's origin, as its bounds have it.\n const m = { a: texels, b: 0, c: 0, d: texels, tx: -left * texels, ty: -top * texels };\n this.drawMatrix = o.scroll ? shifted(m, o.scroll) : m;\n this.sliceOwner = null;\n this.ownerSlice = null;\n let placed = false;\n try {\n this.scene.reset();\n this.rows.reset();\n this.filters.reset();\n // A walk from a slot of its own above the object's own in the frame's, as from the stage's\n // origin.\n const at = this.walkDepth + 1;\n this.walkDepth = at;\n if ((at + 2) * 6 > this.places.length) {\n const grown = new Float64Array(this.places.length * 2);\n grown.set(this.places);\n this.places = grown;\n }\n this.places.set(UNIT_PLACE, at * 6);\n this.walk(o, full, false);\n measureLayers(this.scene, this.rows, this.geometries, target);\n plan(this.scene, 0, this.commands);\n this.backend.drawPlane(keep, this.commands, this.scene, this.rows, this.geometries, this.textures, this.filters, this.keeps, target, width, height, samples);\n }\n finally {\n placed = this.planes.leave();\n this.restorePass(outer);\n }\n return placed;\n }\n /** What advanced text's quads name of the outlines' store, uploaded. */\n uploadOutlines() {\n this.backend.uploadOutlines(saffronStore.data, saffronStore.used, saffronStore.epoch);\n }\n /**\n * `o` drawn alone, as BitmapData.draw takes a display object, through `m`\n * into a `width` by `height` bitmap, read back as premultiplied ARGB: at\n * `samples` a side and averaged, as Flash covers edges (4 at its high\n * quality). Built at the draw's own\n * scale, a hairline a pixel of the bitmap, then drawn `samples` times\n * larger, filters and device text at that many units a pixel; no flag of\n * any object is cleared, nor an output kept, which are the stage's.\n */\n snapshot(o, m, width, height, samples = 4) {\n const pixels = this.drawAlone(o, m, width, height, samples, (n) => argbOf(this.backend.snapshot(this.commands, this.scene, this.rows, this.geometries, this.textures, this.filters, this.keeps, this.target, width, height, n)));\n return pixels ?? new Uint32Array(Math.max(0, width * height));\n }\n /**\n * `o` drawn as `snapshot` draws it, then composited source over into\n * `store` at (x, y) on the GPU, into the store's texture, where it stays\n * till a script reads the pixels (Paints): nothing is read back, nor the\n * store uploaded again to show it. Not for a store too large for a\n * texture, nor an opaque one holding alpha, whose pixels read two ways\n * (BitmapStore.holdsAlpha); false, having drawn nothing, for those.\n */\n drawInto(store, o, m, x, y, width, height, samples) {\n if (store.disposed ||\n store.holdsAlpha ||\n Math.max(store.width, store.height) > this.textureLimit ||\n this.gl.isContextLost()) {\n return false;\n }\n const handle = this.paints.storeTexture(store);\n const drawn = this.drawAlone(o, m, width, height, samples, (n) => this.backend.drawIntoTexture(this.commands, this.scene, this.rows, this.geometries, this.textures, this.filters, this.keeps, this.target, width, height, n, handle.id, x, y, !store.transparent));\n if (!drawn) {\n return false;\n }\n this.paints.drawn(store);\n return true;\n }\n /**\n * `o` walked and planned alone, through `m` into a `width` by `height`\n * bitmap at `samples` a side, as few as a texture holds, then `draw`n\n * with the samples taken; null for a size no texture holds.\n */\n drawAlone(o, m, width, height, samples, draw) {\n // As many samples as a texture holds, halved as BitmapData.draw's are.\n let n = Math.max(1, samples);\n while (n > 1 && Math.max(width, height) * n > this.textureLimit) {\n n /= 2;\n }\n if (width <= 0 || height <= 0 || Math.max(width, height) > this.textureLimit) {\n return null;\n }\n const stage = this.passState();\n this.target = {\n width: width * n,\n height: height * n,\n scale: n,\n x: 0,\n y: 0,\n resolution: 1,\n pixel: n,\n };\n this.scale = n;\n this.resolution = 1;\n this.screenScale = 1;\n this.drawRoot = o;\n this.snapshotting = true;\n this.drawMatrix = o.scroll ? shifted(m, o.scroll) : m;\n try {\n this.scene.reset();\n this.rows.reset();\n this.filters.reset();\n if (saffronStore.used > MOST * 0.75) {\n resetSegments();\n }\n allowResets(false);\n this.walkFrom(o);\n measureLayers(this.scene, this.rows, this.geometries, this.target);\n plan(this.scene, 0, this.commands);\n this.uploadOutlines();\n return draw(n);\n }\n finally {\n allowResets(true);\n this.restorePass(stage);\n }\n }\n /**\n * What a pass of its own, BitmapData.draw's or a 3D object's bitmap's,\n * swaps out of the walk, for it to be put back (restorePass).\n */\n passState() {\n return {\n scene: this.scene,\n rows: this.rows,\n filters: this.filters,\n commands: this.commands,\n target: this.target,\n scale: this.scale,\n filterUnits: this.filterUnits,\n resolution: this.resolution,\n screenScale: this.screenScale,\n drawRoot: this.drawRoot,\n drawMatrix: this.drawMatrix,\n snapshotting: this.snapshotting,\n walkDepth: this.walkDepth,\n sliceOwner: this.sliceOwner,\n ownerSlice: this.ownerSlice,\n };\n }\n restorePass(s) {\n this.scene = s.scene;\n this.rows = s.rows;\n this.filters = s.filters;\n this.commands = s.commands;\n this.target = s.target;\n this.scale = s.scale;\n this.filterUnits = s.filterUnits;\n this.resolution = s.resolution;\n this.screenScale = s.screenScale;\n this.drawRoot = s.drawRoot;\n this.drawMatrix = s.drawMatrix;\n this.snapshotting = s.snapshotting;\n this.walkDepth = s.walkDepth;\n this.sliceOwner = s.sliceOwner;\n this.ownerSlice = s.ownerSlice;\n }\n /**\n * Where a mask is drawn: on the stage, or, in a draw for BitmapData, in\n * the bitmap, where it stands to what is drawn as it stands on the stage.\n */\n placedMask(mask) {\n const root = this.drawRoot;\n // In a 3D object's bitmap by the matrices up to it, or Flash's rule for one outside it.\n if (root && this.planes.inPass) {\n return this.planeMask(root, mask);\n }\n const onStage = toStageFlat(mask);\n if (!root) {\n // Moved by the viewport, as the stage's walk is (walkFrom).\n return this.viewX === 0 && this.viewY === 0\n ? onStage\n : { ...onStage, tx: onStage.tx - this.viewX, ty: onStage.ty - this.viewY };\n }\n // One drawn through no inverse, scaled to nothing on the stage, has no place to measure the mask\n // from: it masks as it stands on the stage.\n const rootInverse = invert(toStageFlat(root));\n return rootInverse ? concat(concat(onStage, rootInverse), this.drawMatrix) : onStage;\n }\n /**\n * Where a mask is drawn in the bitmap of `o`, a 3D object, the root of its\n * bitmap's pass: one in the object by its matrices up to it; one outside\n * it by Flash's rule for that (display/plane.ts, outsideMaskMap).\n */\n planeMask(o, mask) {\n let m;\n if (o.encloses(mask)) {\n m = mask.flatPlaced;\n for (let p = mask.parent; p && p !== o; p = p.parent) {\n m = concat(m, p.flatPlaced);\n }\n }\n else {\n m = outsideMaskMap(o, mask);\n this.planes.place();\n }\n return concat(m, this.drawMatrix);\n }\n /** The mouse, touches and wheel on the canvas to `player`'s stage (pointer.ts); what undoes it. */\n bindPointer(player) {\n // The stage the canvas shows, read as each event comes: the host may zoom the view.\n const view = this;\n return bindCanvasPointer(this.canvas, player, {\n get bounds() {\n const k = view.scale * view.resolution;\n return {\n x: view.viewX,\n y: view.viewY,\n width: view.canvas.width / k,\n height: view.canvas.height / k,\n };\n },\n });\n }\n /** What the view made on its context let go of, the context with it if the canvas is its own, and its tessellator. */\n destroy() {\n this.canvas.removeEventListener(\"webglcontextlost\", this.lost);\n this.canvas.removeEventListener(\"webglcontextrestored\", this.restored);\n this.backend.destroy();\n this.releaseOutlines();\n this.ownTessellator?.dispose();\n if (this.ownCanvas && !this.gl.isContextLost()) {\n this.gl.getExtension(\"WEBGL_lose_context\")?.loseContext();\n }\n }\n}\n/** Count what `o` asks of the renderer that it does not draw yet (shapes.ts, unsupported). */\nfunction noteUnsupported(o) {\n if (o.filters.length > 0 && undrawnFilter(o.filters)) {\n unsupported.filters++;\n }\n}\n/**\n * Whether the placement at `places[at]` only moves a Bitmap, at `unit` of\n * Flash's pixels a stage pixel; if so, `out` is it moved onto whole pixels\n * of Flash's. Flash draws such a bitmap texel for pixel, smoothed or not,\n * on the pixel its twips round to, a fraction of 8 twips (0.4 of a pixel)\n * or more up (the bitmap-sampling case, drawn in adl).\n */\nfunction wholePixels(places, at, unit, out) {\n if (places[at + 1] !== 0 ||\n places[at + 2] !== 0 ||\n Math.abs(places[at] * unit - 1) > 1e-9 ||\n Math.abs(places[at + 3] * unit - 1) > 1e-9) {\n return false;\n }\n out[0] = places[at];\n out[1] = 0;\n out[2] = 0;\n out[3] = places[at + 3];\n out[4] = Math.floor((Math.round(places[at + 4] * unit * 20) + 12) / 20) / unit;\n out[5] = Math.floor((Math.round(places[at + 5] * unit * 20) + 12) / 20) / unit;\n return true;\n}\n/** Where `o` stands on the stage, its matrices as the walk takes them, after their scroll's shift. */\nfunction toStageFlat(o) {\n let m = o.flatPlaced;\n for (let p = o.parent; p; p = p.parent) {\n m = concat(m, p.flatPlaced);\n }\n return m;\n}\n/** The colour `o`'s ancestors give what it draws, as the walk concatenates it; null for none. */\nfunction ancestorsColor(o) {\n let color = null;\n for (let p = o.parent; p; p = p.parent) {\n const own = p.colorTransform;\n if (own) {\n color = color ? concatColor(own, color) : own;\n }\n }\n return color;\n}\n//# sourceMappingURL=view.js.map","import { Container } from \"../display/container.js\";\nimport { CLEAN } from \"../display/displayobject.js\";\nimport { ShapeObject } from \"../display/shapeobject.js\";\n/**\n * Finish a subtree that draws nothing, including children of a reused filter output.\n * Hidden morphs still take their new ratio, which bounds and hit tests observe. A\n * BitmapData snapshot leaves the stage's dirty flags alone, as the normal walk does.\n */\nexport function syncHidden(o, snapshotting) {\n // Nothing in it invalidated since it was last finished, which marks every\n // ancestor's descendants dirty: its morphs have their ratios' blends, and\n // its flags are clear. A hidden subtree, as a reused filter output's\n // content mostly is, is then passed over whole rather than walked again.\n if (o.dirty === CLEAN && !(o instanceof Container && o.descendantsDirty)) {\n return;\n }\n if (o instanceof ShapeObject) {\n o.drawn();\n }\n if (o instanceof Container) {\n const children = o.children;\n for (let i = 0; i < children.length; i++) {\n syncHidden(children[i], snapshotting);\n }\n if (!snapshotting) {\n o.descendantsDirty = false;\n }\n }\n if (!snapshotting) {\n o.dirty = CLEAN;\n }\n}\n//# sourceMappingURL=hidden.js.map","import { filterRect } from \"../bitmap/filters.js\";\nimport { bounds, toStage } from \"./bounds.js\";\nimport { apply, concat, isProjective } from \"./geometry.js\";\n/**\n * The samples a side the bitmap is drawn at before it is averaged to a\n * texel a pixel, as Flash's high quality covers edges.\n */\nconst SAMPLES = 4;\n/**\n * The most texels a side of a bitmap: larger, the object is drawn into it\n * at less than a texel a pixel.\n */\nconst LARGEST = 2048;\n/** The most texels the samples a bitmap is drawn at may take (16 MiB): past it, fewer samples. */\nconst SAMPLED_TEXELS = 4 * 1024 * 1024;\n/**\n * The samples a side, and texels a pixel of the object's space, a bitmap of\n * a w by h rectangle is drawn at.\n */\nexport function bitmapScale(width, height, largest) {\n const texels = Math.min(1, Math.min(LARGEST, largest) / Math.max(width, height));\n const w = Math.max(1, Math.ceil(width * texels));\n const h = Math.max(1, Math.ceil(height * texels));\n let samples = SAMPLES;\n while (samples > 1 &&\n (w * samples > largest || h * samples > largest || w * h * samples * samples > SAMPLED_TEXELS)) {\n samples /= 2;\n }\n return { samples, texels };\n}\n/**\n * The quad of the bitmap of what the object draws over xMin to xMax and\n * yMin to yMax of its own space, by its plane in its parent's space, `m`,\n * into `out`: false, and nothing to draw, where a corner is behind the eye,\n * as Flash draws none of it. The bitmap reaches from the rectangle's left\n * and top out to whole pixels, a texel a pixel, and a texel of nothing\n * around. Flash draws it a texel wider and taller than it is, about its\n * centre, and half a pixel of the stage right and down: so unturned at a\n * texel a pixel its left and top edges stay where they are, and magnified\n * it grows as much each way.\n */\nexport function placeQuad(m, xMin, yMin, xMax, yMax, out) {\n const xFrom = Math.floor(xMin);\n const yFrom = Math.floor(yMin);\n const across = Math.ceil(xMax) - xFrom;\n const down = Math.ceil(yMax) - yFrom;\n if (!(across >= 1 && down >= 1 && across < 1e6 && down < 1e6)) {\n return false;\n }\n const [u, v, w] = isProjective(m) ? [m.u, m.v, m.w] : [0, 0, 1];\n const cx = xFrom + across / 2;\n const cy = yFrom + down / 2;\n const at = (x, y) => {\n const q = u * x + v * y + w;\n return [(m.a * x + m.c * y + m.tx) / q, (m.b * x + m.d * y + m.ty) / q];\n };\n // Half a pixel of the stage right and down, in the object's space: through the inverse of\n // how its plane moves a point at the centre.\n const [ax, ay] = at(cx - 0.5, cy);\n const [bx, by] = at(cx + 0.5, cy);\n const [dx, dy] = at(cx, cy - 0.5);\n const [ex, ey] = at(cx, cy + 0.5);\n const jxx = bx - ax;\n const jyx = by - ay;\n const jxy = ex - dx;\n const jyy = ey - dy;\n const det = jxx * jyy - jxy * jyx;\n const shiftX = det ? (0.5 * jyy - 0.5 * jxy) / det : 0;\n const shiftY = det ? (0.5 * jxx - 0.5 * jyx) / det : 0;\n const sx = (across + 1) / across;\n const sy = (down + 1) / down;\n const left = cx + shiftX - (across / 2 + 1) * sx;\n const right = cx + shiftX + (across / 2 + 1) * sx;\n const top = cy + shiftY - (down / 2 + 1) * sy;\n const bottom = cy + shiftY + (down / 2 + 1) * sy;\n for (let i = 0; i < 4; i++) {\n const x = i === 1 || i === 2 ? right : left;\n const y = i >= 2 ? bottom : top;\n const q = u * x + v * y + w;\n if (!(q > 0)) {\n return false;\n }\n out.positions[i * 2] = (m.a * x + m.c * y + m.tx) / q;\n out.positions[i * 2 + 1] = (m.b * x + m.d * y + m.ty) / q;\n out.ws[i] = q;\n }\n out.x = xFrom - 1;\n out.y = yFrom - 1;\n out.width = across + 2;\n out.height = down + 2;\n return true;\n}\n/**\n * What a 3D object draws in its own space, which its bitmap holds: its\n * bounds, its children's and its lines', out as far as its filters reach;\n * null for nothing.\n */\nexport function drawnRect(o) {\n const r = bounds(o, true, true);\n let rect = r && {\n x: r.xMin,\n y: r.yMin,\n width: r.xMax - r.xMin,\n height: r.yMax - r.yMin,\n };\n for (const f of o.filters) {\n rect = rect && filterRect(rect, f);\n }\n return rect;\n}\n/**\n * The map from the space of `mask`, a 2D mask outside the 3D object `o`, to\n * `o`'s, as Flash clips the bitmap it draws `o` into: the mask is placed by\n * its matrices up to the nearest 3D object above it (or the stage), and then\n * moved as if the bitmap's corner, `o`'s bounds' top left in its own space,\n * were where `o`'s bounds' top left is on the stage. So a mask over a turned\n * card clips a part of the card that is not under it (the `three-d-mask` case).\n */\nexport function outsideMaskMap(o, mask) {\n let m = mask.placed;\n for (let p = mask.parent; p && !p.space; p = p.parent) {\n m = concat(m, p.placed);\n }\n const own = bounds(o, true) ?? { xMin: 0, yMin: 0, xMax: 0, yMax: 0 };\n const up = toStage(o, null);\n let left = Number.POSITIVE_INFINITY;\n let top = Number.POSITIVE_INFINITY;\n for (let i = 0; i < 4; i++) {\n const [x, y] = apply(up, i & 1 ? own.xMax : own.xMin, i & 2 ? own.yMax : own.yMin);\n left = Math.min(left, x);\n top = Math.min(top, y);\n }\n return {\n a: m.a,\n b: m.b,\n c: m.c,\n d: m.d,\n tx: m.tx + own.xMin - Math.round(left),\n ty: m.ty + own.yMin - Math.round(top),\n };\n}\n//# sourceMappingURL=plane.js.map","// The pointer, touches and wheel on the renderer's canvas, taken to the\n// player's stage from the browser's events themselves: Flash's display\n// list chooses the target, and the same rules hold for moves outside the\n// canvas, releases outside it, touches, the wheel, the cursor and the menu.\nimport { canvasPoint, wheelLines } from \"../input/canvas.js\";\nimport { bindContextMenu } from \"./context-menu.js\";\n/**\n * The mouse, touches and wheel on `canvas` to `player`'s stage, of which\n * the canvas shows `shown`; what undoes it. An event over the canvas\n * counts where the canvas is its target: over an element on\n * top of it, as a menu or a host's control, it is outside.\n */\nexport function bindCanvasPointer(canvas, player, shown) {\n const page = canvas.ownerDocument.defaultView;\n // Live: read once, it follows the element's style as the page changes it.\n const style = page.getComputedStyle(canvas);\n // A point on the stage, a touch's size there, and whether it is over the canvas's pixels.\n const at = [\n 0,\n 0,\n 0,\n 0,\n false,\n ];\n const place = (e, w = 0, h = 0) => {\n const [cx, cy, sx, sy] = canvasPoint(canvas, style, e.clientX, e.clientY);\n const bounds = shown.bounds;\n const kx = bounds.width / canvas.width;\n const ky = bounds.height / canvas.height;\n at[0] = cx * kx + bounds.x;\n at[1] = cy * ky + bounds.y;\n at[2] = (w / sx) * kx;\n at[3] = (h / sy) * ky;\n // Its first target, the canvas itself where it is in a shadow root, whose host the page's\n // listeners see as the target.\n at[4] =\n e.composedPath()[0] === canvas &&\n cx >= 0 &&\n cy >= 0 &&\n cx < canvas.width &&\n cy < canvas.height;\n return at;\n };\n // A move is posted, handled when the player next advances or before the\n // next press, release, leave or key; a frame callback of its own handles\n // it where the host does not advance (a paused player, say).\n let frame = 0;\n const flushSoon = () => {\n frame ||= page.requestAnimationFrame(() => {\n frame = 0;\n player.pointer?.flush();\n player.touch?.flush();\n });\n };\n const unbindMenu = bindContextMenu(canvas, player, (e) => {\n const [x, y] = place(e);\n return [x, y];\n }, () => shown.bounds);\n // Each touch's last point, which a cancel, whose own may be anywhere, ends at.\n const touches = new Map();\n const touched = (type, e) => {\n const touch = player.touch;\n if (!touch) {\n return;\n }\n const [x, y, width, height] = place(e, e.width, e.height);\n const t = {\n x,\n y,\n id: e.pointerId,\n primary: e.isPrimary,\n width,\n height,\n pressure: e.pressure,\n altKey: e.altKey,\n ctrlKey: e.ctrlKey,\n shiftKey: e.shiftKey,\n time: e.timeStamp,\n };\n if (type === \"up\") {\n touches.delete(t.id);\n }\n else {\n touches.set(t.id, t);\n }\n if (type === \"move\") {\n touch.post(t);\n flushSoon();\n return;\n }\n touch.handle(type === \"down\" ? \"begin\" : \"end\", t);\n };\n // The mouse's or a pen's, at the point `place` last found.\n const send = (type, e) => {\n const p = {\n x: at[0],\n y: at[1],\n button: e.button,\n buttons: e.buttons,\n altKey: e.altKey,\n ctrlKey: e.ctrlKey,\n shiftKey: e.shiftKey,\n time: e.timeStamp,\n };\n if (type === \"move\" && player.pointer) {\n player.pointer.post(p);\n flushSoon();\n return;\n }\n player.pointer?.handle(type, p);\n };\n // Every move on the page: one over the canvas, and, while the mouse's button is down after a\n // press on it, one anywhere, as Flash keeps the mouse until the release. A release outside after\n // a press that held the mouse leaves it at the next move outside, as Flash's mouseLeave comes.\n // A lifted finger leaves the canvas too, as a touch: the mouse it moved stays, as Flash's does.\n const pressed = new Set();\n let leaveNext = false;\n const move = (e) => {\n const touch = e.pointerType === \"touch\";\n const inside = place(e, e.width, e.height)[4];\n if (touch) {\n if (inside || pressed.has(e.pointerId)) {\n touched(\"move\", e);\n }\n return;\n }\n if (inside || player.pointer?.captured) {\n leaveNext = false;\n send(\"move\", e);\n }\n else if (leaveNext) {\n leaveNext = false;\n send(\"leave\", e);\n }\n };\n // A press over the stage the canvas shows: in a letterbox's bars it is on no stage.\n const down = (e) => {\n if (!place(e, e.width, e.height)[4]) {\n return;\n }\n pressed.add(e.pointerId);\n if (e.pointerType === \"touch\") {\n touched(\"down\", e);\n }\n else {\n send(\"down\", e);\n }\n };\n // A release over the canvas, or outside it after a press on it.\n const up = (e) => {\n const inside = place(e, e.width, e.height)[4];\n const ours = pressed.delete(e.pointerId);\n if (!inside && !ours) {\n return;\n }\n if (e.pointerType === \"touch\") {\n touched(\"up\", e);\n return;\n }\n const held = !inside && !!player.pointer?.captured;\n send(\"up\", e);\n leaveNext ||= held && !player.pointer?.captured;\n };\n const leave = (e) => {\n if (e.pointerType !== \"touch\") {\n place(e);\n send(\"leave\", e);\n }\n };\n // The browser takes a touch back so, as for a system gesture, and the touch ends where it last\n // was, without its tap or click. A mouse's cancel, as a native drag starts, leaves its press:\n // its release outside still comes to the player.\n const cancel = (e) => {\n if (e.pointerType !== \"touch\") {\n return;\n }\n pressed.delete(e.pointerId);\n const t = touches.get(e.pointerId);\n if (t) {\n touches.delete(t.id);\n player.touch?.handle(\"cancel\", { ...t, time: e.timeStamp });\n }\n };\n // The wheel in Flash's lines (input/canvas.ts). The page scrolls unless the SWF takes the wheel\n // where the pointer is. With Ctrl, as a touchpad's pinch comes too, the page zooms and the SWF\n // hears nothing.\n const left = { lines: 0 };\n const wheel = (e) => {\n const pointer = player.pointer;\n if (!pointer || e.deltaY === 0 || e.ctrlKey) {\n return;\n }\n const delta = wheelLines(left, e);\n const [x, y] = place(e);\n const p = {\n x,\n y,\n buttons: e.buttons,\n altKey: e.altKey,\n shiftKey: e.shiftKey,\n time: e.timeStamp,\n };\n if (pointer.wheel(p, delta)) {\n e.preventDefault();\n }\n };\n page.addEventListener(\"pointermove\", move);\n canvas.addEventListener(\"pointerdown\", down);\n page.addEventListener(\"pointerup\", up);\n canvas.addEventListener(\"pointerleave\", leave);\n page.addEventListener(\"pointercancel\", cancel);\n canvas.addEventListener(\"wheel\", wheel, { passive: false });\n // A finger's drags are the SWF's, not the page's pans and zooms.\n const touchAction = canvas.style.touchAction;\n canvas.style.touchAction = \"none\";\n // Flash's arrow, auto's or a forced one, is the arrow, not the page's cursor.\n const pointer = player.pointer;\n if (pointer) {\n pointer.onCursor = (cursor) => {\n canvas.style.cursor = cursor;\n };\n canvas.style.cursor = pointer.cursor();\n }\n return () => {\n unbindMenu();\n if (pointer) {\n pointer.onCursor = null;\n canvas.style.cursor = \"\";\n }\n canvas.style.touchAction = touchAction;\n if (frame) {\n page.cancelAnimationFrame(frame);\n frame = 0;\n }\n player.pointer?.flush();\n player.touch?.flush();\n page.removeEventListener(\"pointermove\", move);\n canvas.removeEventListener(\"pointerdown\", down);\n page.removeEventListener(\"pointerup\", up);\n canvas.removeEventListener(\"pointerleave\", leave);\n page.removeEventListener(\"pointercancel\", cancel);\n canvas.removeEventListener(\"wheel\", wheel);\n };\n}\n//# sourceMappingURL=pointer.js.map","// What the pointer binding (scene/pointer.ts) takes from the browser:\n// where a client point lies on a canvas's pixels as CSS shows them, and the\n// wheel's movement in Flash's lines.\n/**\n * Where a client point lies on `canvas`'s pixels. CSS `object-fit` shows\n * them in a box of their own within the element's content box,\n * letterboxed by `contain`, cropped by `cover`, centred as the default\n * `object-position` puts it. Also the CSS pixels a canvas pixel spans each\n * way. `style` is the canvas's live computed style.\n */\nexport function canvasPoint(canvas, style, clientX, clientY) {\n // The content box: the element's rectangle within its borders and padding.\n const px = (v) => Number.parseFloat(v ?? \"\") || 0;\n const rect = canvas.getBoundingClientRect();\n let left = rect.left + px(style.borderLeftWidth) + px(style.paddingLeft);\n let top = rect.top + px(style.borderTopWidth) + px(style.paddingTop);\n const width = rect.width -\n px(style.borderLeftWidth) -\n px(style.paddingLeft) -\n px(style.borderRightWidth) -\n px(style.paddingRight);\n const height = rect.height -\n px(style.borderTopWidth) -\n px(style.paddingTop) -\n px(style.borderBottomWidth) -\n px(style.paddingBottom);\n let sx = width / canvas.width;\n let sy = height / canvas.height;\n const fit = style.objectFit;\n if (fit === \"contain\" || fit === \"scale-down\" || fit === \"cover\" || fit === \"none\") {\n let scale = fit === \"cover\" ? Math.max(sx, sy) : fit === \"none\" ? 1 : Math.min(sx, sy);\n if (fit === \"scale-down\") {\n scale = Math.min(scale, 1);\n }\n left += (width - canvas.width * scale) / 2;\n top += (height - canvas.height * scale) / 2;\n sx = scale;\n sy = scale;\n }\n return [(clientX - left) / sx, (clientY - top) / sy, sx, sy];\n}\n/**\n * The wheel's movement in Flash's lines, up positive: 3 a notch, Flash's\n * delta on Windows. A browser gives a notch as 3 lines, or as about 100\n * pixels, fewer where the page is zoomed or the screen scaled, and several\n * at once as their multiple; a touchpad's few pixels at a time add up in\n * `left`, 100 to 3 lines, till a whole line is taken.\n */\nexport function wheelLines(left, e) {\n const size = Math.abs(e.deltaY);\n if (e.deltaMode !== 0) {\n left.lines = -e.deltaY * (e.deltaMode === 2 ? 3 : 1);\n }\n else if (size >= 50) {\n left.lines = -Math.sign(e.deltaY) * 3 * Math.max(1, Math.round(size / 100));\n }\n else {\n left.lines -= (e.deltaY * 3) / 100;\n }\n const delta = Math.trunc(left.lines);\n left.lines -= delta;\n return delta;\n}\n//# sourceMappingURL=canvas.js.map"],"names":["Float64Array","Uint32Array","r","Error","Number","Math","Float32Array","RangeError","Object","Uint16Array","l","Uint8Array","i","f","Int32Array","Array","a","t","o","Map","WeakSet","s","ArrayBuffer","h","e","u","p","WeakMap","g","Set","String","FinalizationRegistry","m","document","to","ShadowRoot","AbortController","MouseEvent"],"mappings":"oIAWO,OAAM,EACT,SAAW,IAAK,AAChB,MAAO,IAAIA,aAAa,EAAG,AAC3B,QAAS,IAAIC,YAAY,EAAG,AAE5B,SAAU,EAAM,AAChB,aAAc,EAAM,AACpB,MAAM,AACN,KAAK,AACL,MAAM,AACN,aAAY,EAAU,CAAC,CAAC,CAAE,CACtB,IAAI,CAAC,KAAK,CAAG,EAAQ,WAAW,EAAI,UACpC,IAAI,CAAC,IAAI,CAAG,EAAQ,YAAY,EAAI,QACpC,IAAI,CAAC,KAAK,CAAG,EAAQ,KAAK,EAAI,GAC9B,GAAAC,EAAA,IACJ,CAEA,IAAI,SAAU,CACV,OAAO,IAAI,CAAC,WAAW,AAC3B,CAEA,IAAI,UAAW,CACX,OAAO,IAAI,CAAC,QAAQ,EAAE,OAAO,OAAO,YAAc,CACtD,CAEA,MAAM,CAAC,CAAE,CACL,GAAI,CAAC,IAAI,CAAC,QAAQ,CAAE,CAChB,GAAI,CACA,IAAI,CAAC,QAAQ,CAAG,GAAAA,EAAA,GAAe,KAC3B,MAAM,AAAIC,MAAM,sCACpB,EACJ,CACA,KAAM,CACF,OAAO,IACX,CACA,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EACjC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAACC,OAAO,IAAI,CAAC,KAAK,EAAI,IAAI,CAAC,OAAO,EAC7D,CACA,IAAM,EAAI,IAAI,CAAC,QAAQ,CACvB,GAAI,EAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAK,EAAE,M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A;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE,EAAS;AAC1B,CAAC,CAAC,CASW,EAAQ,CAAC;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE,EAAS;AAC1B,CAAC,CAAC,CAOW,EAAQ,CAAC;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,CAQW,EAAW,CAAC;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE,EAAS;AAC1B,CAAC,CAAC,CAWW,EAAW,CAAC;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,CAEW,EAAS,CAAC;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE,EAAS;AAC1B,CAAC,CAAC,CAQW,EAAc,CAAC;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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