spryte 0.0.0-stage → 0.1.0

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -2
  3. package/dist/backend.d.ts +69 -0
  4. package/dist/backend.d.ts.map +1 -0
  5. package/dist/backend.js +2 -0
  6. package/dist/backend.js.map +1 -0
  7. package/dist/bitmap-font.d.ts +55 -0
  8. package/dist/bitmap-font.d.ts.map +1 -0
  9. package/dist/bitmap-font.js +103 -0
  10. package/dist/bitmap-font.js.map +1 -0
  11. package/dist/canvas2d.d.ts +45 -0
  12. package/dist/canvas2d.d.ts.map +1 -0
  13. package/dist/canvas2d.js +210 -0
  14. package/dist/canvas2d.js.map +1 -0
  15. package/dist/color.d.ts +7 -0
  16. package/dist/color.d.ts.map +1 -0
  17. package/dist/color.js +49 -0
  18. package/dist/color.js.map +1 -0
  19. package/dist/copies.d.ts +45 -0
  20. package/dist/copies.d.ts.map +1 -0
  21. package/dist/copies.js +43 -0
  22. package/dist/copies.js.map +1 -0
  23. package/dist/draw.d.ts +188 -0
  24. package/dist/draw.d.ts.map +1 -0
  25. package/dist/draw.js +603 -0
  26. package/dist/draw.js.map +1 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +7 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/renderer.d.ts +17 -0
  32. package/dist/renderer.d.ts.map +1 -0
  33. package/dist/renderer.js +61 -0
  34. package/dist/renderer.js.map +1 -0
  35. package/dist/shader.d.ts +34 -0
  36. package/dist/shader.d.ts.map +1 -0
  37. package/dist/shader.js +40 -0
  38. package/dist/shader.js.map +1 -0
  39. package/dist/target.d.ts +13 -0
  40. package/dist/target.d.ts.map +1 -0
  41. package/dist/target.js +18 -0
  42. package/dist/target.js.map +1 -0
  43. package/dist/webgl2.d.ts +90 -0
  44. package/dist/webgl2.d.ts.map +1 -0
  45. package/dist/webgl2.js +868 -0
  46. package/dist/webgl2.js.map +1 -0
  47. package/package.json +54 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAsC,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAc,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE3D,OAAO,EAAE,IAAI,EAA4D,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAwB,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Draw } from "./draw.js";
2
+ export interface RendererOptions {
3
+ /** `auto` (default) uses WebGL2 and falls back to Canvas 2D; `webgl2` throws where it's unavailable. */
4
+ backend?: "auto" | "webgl2" | "2d";
5
+ /** Linear filtering for images by default. Pass false for pixel art. Default true. */
6
+ smooth?: boolean;
7
+ }
8
+ /**
9
+ * A `Draw` for a canvas: WebGL2 when available, otherwise the Canvas 2D fallback, loaded on demand so WebGL2
10
+ * browsers (nearly all) never download it. Frames before the fallback finishes loading draw nothing.
11
+ *
12
+ * The canvas's backing size is yours to set; call `draw.resize(canvas.width, canvas.height)` after changing it.
13
+ * Each frame: `draw.begin(clear, logicalWidth, logicalHeight, backingPixelsPerUnit)`, draw, `draw.end()`.
14
+ * Call `draw.dispose()` when you're done with the canvas.
15
+ */
16
+ export declare function createRenderer(canvas: HTMLCanvasElement, options?: RendererOptions): Draw;
17
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,WAAW,eAAe;IAC9B,wGAAwG;IACxG,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACnC,sFAAsF;IACtF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,GAAE,eAAoB,GAAG,IAAI,CA0B7F"}
@@ -0,0 +1,61 @@
1
+ import { Draw } from "./draw.js";
2
+ import { WebGL2Backend } from "./webgl2.js";
3
+ /**
4
+ * A `Draw` for a canvas: WebGL2 when available, otherwise the Canvas 2D fallback, loaded on demand so WebGL2
5
+ * browsers (nearly all) never download it. Frames before the fallback finishes loading draw nothing.
6
+ *
7
+ * The canvas's backing size is yours to set; call `draw.resize(canvas.width, canvas.height)` after changing it.
8
+ * Each frame: `draw.begin(clear, logicalWidth, logicalHeight, backingPixelsPerUnit)`, draw, `draw.end()`.
9
+ * Call `draw.dispose()` when you're done with the canvas.
10
+ */
11
+ export function createRenderer(canvas, options = {}) {
12
+ const choice = options.backend ?? "auto";
13
+ if (choice !== "2d") {
14
+ // alpha:false lets the compositor skip blending; desynchronized lowers input latency where supported.
15
+ // preserveDrawingBuffer:false is fastest; captures render and read in the same task.
16
+ const gl = canvas.getContext("webgl2", {
17
+ alpha: false,
18
+ antialias: false,
19
+ premultipliedAlpha: true,
20
+ desynchronized: true,
21
+ powerPreference: "high-performance",
22
+ });
23
+ if (gl)
24
+ return new Draw(new WebGL2Backend(gl), options.smooth ?? true);
25
+ if (choice === "webgl2")
26
+ throw new Error('spryte: WebGL2 is unavailable in this browser (use backend: "auto" to fall back to Canvas 2D)');
27
+ }
28
+ const ctx = canvas.getContext("2d", { alpha: false, desynchronized: true });
29
+ if (!ctx)
30
+ throw new Error("spryte: no WebGL2 or Canvas 2D context available (is the canvas already using another context type?)");
31
+ const draw = new Draw(pending(ctx), options.smooth ?? true);
32
+ draw.ready = import("./canvas2d.js").then((m) => draw.setBackend(new m.Canvas2DBackend(ctx)), (cause) => {
33
+ throw new Error("spryte: the Canvas 2D fallback failed to load", { cause });
34
+ });
35
+ return draw;
36
+ }
37
+ /**
38
+ * Stands in while the Canvas 2D fallback loads (a few milliseconds, on browsers without WebGL2): draws nothing,
39
+ * but `raw` is already the real context.
40
+ */
41
+ function pending(ctx) {
42
+ const noop = () => { };
43
+ return {
44
+ kind: "2d",
45
+ raw: { kind: "2d", ctx },
46
+ begin: noop,
47
+ quad: noop,
48
+ quads: noop,
49
+ copies: noop,
50
+ setBlend: noop,
51
+ setClip: noop,
52
+ end: noop,
53
+ resize: noop,
54
+ invalidate: noop,
55
+ setTarget: noop,
56
+ setShader: noop,
57
+ disposeTarget: noop,
58
+ dispose: noop,
59
+ };
60
+ }
61
+ //# sourceMappingURL=renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAS5C;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,MAAyB,EAAE,OAAO,GAAoB,EAAE;IACrF,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC;IACzC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,sGAAsG;QACtG,qFAAqF;QACrF,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE;YACrC,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,KAAK;YAChB,kBAAkB,EAAE,IAAI;YACxB,cAAc,EAAE,IAAI;YACpB,eAAe,EAAE,kBAAkB;SACpC,CAAC,CAAC;QACH,IAAI,EAAE;YAAE,OAAO,IAAI,IAAI,CAAC,IAAI,aAAa,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;QACvE,IAAI,MAAM,KAAK,QAAQ;YACrB,MAAM,IAA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1,34 @@
1
+ /** A uniform value: a float, or a vec2/vec3/vec4 as an array. */
2
+ export type UniformValue = number | readonly [number, number] | readonly [number, number, number] | readonly [number, number, number, number];
3
+ /**
4
+ * A custom fragment effect, applied to everything drawn inside `draw.withShader(shader, fn)`.
5
+ *
6
+ * The source defines `vec4 effect(vec4 color, vec2 uv)`, which returns the pixel's colour. `color` is the
7
+ * draw's tint and alpha, premultiplied. `source(uv)` samples the image being drawn. Declare your own uniforms
8
+ * and set them with `set()`. Return premultiplied colour (rgb already multiplied by alpha).
9
+ *
10
+ * ```ts
11
+ * const wave = draw.createShader(`
12
+ * uniform float time;
13
+ * vec4 effect(vec4 color, vec2 uv) {
14
+ * uv.x += sin(uv.y * 40.0 + time * 6.0) * 0.01;
15
+ * return source(uv) * color;
16
+ * }
17
+ * `);
18
+ * wave.set("time", t);
19
+ * draw.withShader(wave, () => draw.sprite(hero, x, y));
20
+ * ```
21
+ *
22
+ * WebGL2 only. On the Canvas 2D fallback, drawing inside `withShader` happens without the effect (warned once).
23
+ */
24
+ export declare class Shader {
25
+ readonly source: string;
26
+ /** @internal Uniform values by name. */
27
+ readonly uniforms: Map<string, UniformValue>;
28
+ /** @internal Called when a uniform changes, so pending draws flush with the old value first. */
29
+ onChange: (() => void) | undefined;
30
+ constructor(source: string);
31
+ /** Set a uniform declared in the source. Applies to draws made after this call. */
32
+ set(name: string, value: UniformValue): this;
33
+ }
34
+ //# sourceMappingURL=shader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../src/shader.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GACzB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GACjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MAAM;IAML,QAAQ,CAAC,MAAM,EAAE,MAAM;IALnC,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,4BAAmC;IACpD,gGAAgG;IAChG,QAAQ,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAEnC,YAAqB,MAAM,EAAE,MAAM,EAElC;IAED,mFAAmF;IACnF,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAI3C;CACF"}
package/dist/shader.js ADDED
@@ -0,0 +1,40 @@
1
+ /**
2
+ * A custom fragment effect, applied to everything drawn inside `draw.withShader(shader, fn)`.
3
+ *
4
+ * The source defines `vec4 effect(vec4 color, vec2 uv)`, which returns the pixel's colour. `color` is the
5
+ * draw's tint and alpha, premultiplied. `source(uv)` samples the image being drawn. Declare your own uniforms
6
+ * and set them with `set()`. Return premultiplied colour (rgb already multiplied by alpha).
7
+ *
8
+ * ```ts
9
+ * const wave = draw.createShader(`
10
+ * uniform float time;
11
+ * vec4 effect(vec4 color, vec2 uv) {
12
+ * uv.x += sin(uv.y * 40.0 + time * 6.0) * 0.01;
13
+ * return source(uv) * color;
14
+ * }
15
+ * `);
16
+ * wave.set("time", t);
17
+ * draw.withShader(wave, () => draw.sprite(hero, x, y));
18
+ * ```
19
+ *
20
+ * WebGL2 only. On the Canvas 2D fallback, drawing inside `withShader` happens without the effect (warned once).
21
+ */
22
+ export class Shader {
23
+ source;
24
+ /** @internal Uniform values by name. */
25
+ uniforms = new Map();
26
+ /** @internal Called when a uniform changes, so pending draws flush with the old value first. */
27
+ onChange;
28
+ constructor(source) {
29
+ this.source = source;
30
+ if (!/\bvec4\s+effect\s*\(/.test(source))
31
+ throw new Error("spryte: a shader must define `vec4 effect(vec4 color, vec2 uv)`");
32
+ }
33
+ /** Set a uniform declared in the source. Applies to draws made after this call. */
34
+ set(name, value) {
35
+ this.onChange?.();
36
+ this.uniforms.set(name, value);
37
+ return this;
38
+ }
39
+ }
40
+ //# sourceMappingURL=shader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader.js","sourceRoot":"","sources":["../src/shader.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,MAAM;IAMI,MAAM;IAL3B,wCAAwC;IAC/B,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IACpD,gGAAgG;IAChG,QAAQ,CAA2B;IAEnC,YAAqB,MAAc;sBAAd,MAAM;QACzB,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IAC/H,CAAC;IAED,mFAAmF;IACnF,GAAG,CAAC,IAAY,EAAE,KAAmB;QACnC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * An offscreen image you draw into with `draw.into(target, fn)` and then draw like any image:
3
+ * post-processing, cached static layers, minimaps, trails. Size is in pixels.
4
+ *
5
+ * On WebGL2 the contents live on the GPU and are lost if the context is lost: redraw them when
6
+ * `draw.contextLost` turns false again, or redraw every frame.
7
+ */
8
+ export declare class RenderTarget {
9
+ readonly width: number;
10
+ readonly height: number;
11
+ constructor(width: number, height: number);
12
+ }
13
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../src/target.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,YAAY;IAErB,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;IAFzB,YACW,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EAGxB;CACF"}
package/dist/target.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * An offscreen image you draw into with `draw.into(target, fn)` and then draw like any image:
3
+ * post-processing, cached static layers, minimaps, trails. Size is in pixels.
4
+ *
5
+ * On WebGL2 the contents live on the GPU and are lost if the context is lost: redraw them when
6
+ * `draw.contextLost` turns false again, or redraw every frame.
7
+ */
8
+ export class RenderTarget {
9
+ width;
10
+ height;
11
+ constructor(width, height) {
12
+ this.width = width;
13
+ this.height = height;
14
+ if (!(width > 0 && height > 0))
15
+ throw new Error(`spryte: render target size must be positive, got ${width}×${height}`);
16
+ }
17
+ }
18
+ //# sourceMappingURL=target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.js","sourceRoot":"","sources":["../src/target.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,OAAO,YAAY;IAEZ,KAAK;IACL,MAAM;IAFjB,YACW,KAAa,EACb,MAAc;qBADd,KAAK;sBACL,MAAM;QAEf,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,KAAK,IAAI,MAAM,EAAE,CAAC,CAAC;IACzH,CAAC;CACF"}
@@ -0,0 +1,90 @@
1
+ import type { Backend, BlendMode, ClipRect, Matrix, RawContext, TextureSource } from "./backend.js";
2
+ import { type CopySpec } from "./copies.js";
3
+ import type { Shader } from "./shader.js";
4
+ import { RenderTarget } from "./target.js";
5
+ /** Instanced, multi-texture WebGL2 sprite batcher behind the `draw` API. */
6
+ export declare class WebGL2Backend implements Backend {
7
+ readonly kind: "webgl2";
8
+ readonly raw: RawContext;
9
+ private readonly gl;
10
+ private readonly capacity;
11
+ private readonly data;
12
+ private readonly f32;
13
+ private readonly u32;
14
+ private instanceBuffer;
15
+ private readonly textures;
16
+ private white;
17
+ /** Filtering lives in sampler objects, so one upload serves smooth and pixelated draws. */
18
+ private nearest;
19
+ private linear;
20
+ private main;
21
+ /** The program sprite batches draw with: `main`, or a custom shader's inside `withShader`. */
22
+ private active;
23
+ private shader;
24
+ private readonly customs;
25
+ private vao;
26
+ private quadBuffer;
27
+ private copyPipe;
28
+ private each;
29
+ private stagingScale;
30
+ private stagingRot;
31
+ private staging;
32
+ private readonly targets;
33
+ /** Where drawing goes: a render target, or null for the canvas. */
34
+ private target;
35
+ /** Height in pixels of the current destination, for flipping scissor rectangles. */
36
+ private outH;
37
+ private viewW;
38
+ private viewH;
39
+ /** True between webglcontextlost and webglcontextrestored: drawing is skipped. */
40
+ private lost;
41
+ private readonly onLost;
42
+ private readonly onRestored;
43
+ private readonly units;
44
+ private readonly unitSmooth;
45
+ private unitCount;
46
+ private lastUnit;
47
+ private lastSmooth;
48
+ private lastSrc;
49
+ private last;
50
+ private count;
51
+ private blend;
52
+ private submitted;
53
+ /** Draw calls this frame, counting the batch still pending (read before `end()` flushes it). */
54
+ get drawCalls(): number;
55
+ constructor(gl: WebGL2RenderingContext);
56
+ /** True while the GPU context is lost (e.g. a mobile tab was backgrounded or the driver reset). */
57
+ get contextLost(): boolean;
58
+ /** Create program, buffers and the white texture. Runs at start and after a context restore. */
59
+ private setup;
60
+ begin(clear: number, width: number, height: number): void;
61
+ quad(m: Matrix, src: TextureSource | null, sx: number, sy: number, sw: number, sh: number, color: number, flash: number, smooth: boolean): void;
62
+ quads(t: Matrix, m: Matrix, positions: ArrayLike<number>, count: number, src: TextureSource, sx: number, sy: number, sw: number, sh: number, color: number, flash: number, smooth: boolean, snap: boolean): void;
63
+ copies(c: CopySpec): void;
64
+ /** Upload one float attribute: a Float32Array as is, anything else through a reused staging array. */
65
+ private attribute;
66
+ setBlend(mode: BlendMode): void;
67
+ setClip(rect: ClipRect | null): void;
68
+ end(): void;
69
+ resize(): void;
70
+ invalidate(src: TextureSource): void;
71
+ /** Release every GPU object this backend created, so renderers can be created and destroyed repeatedly. */
72
+ dispose(): void;
73
+ setShader(shader: Shader | null): void;
74
+ setTarget(target: RenderTarget | null, clear: number | null, width: number, height: number): void;
75
+ disposeTarget(target: RenderTarget): void;
76
+ /** A target's framebuffer and texture, created on first use. */
77
+ private targetStore;
78
+ private eachPipeline;
79
+ private copyPipeline;
80
+ private flush;
81
+ /** Upload `u_view` to a program if the destination size changed since it last drew. The program must be bound. */
82
+ private syncView;
83
+ private syncUniforms;
84
+ private custom;
85
+ private texture;
86
+ /** Texture parameters for the bound texture. Filtering comes from the samplers; this keeps the texture complete without them. */
87
+ private wrap;
88
+ private applyBlend;
89
+ }
90
+ //# sourceMappingURL=webgl2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl2.d.ts","sourceRoot":"","sources":["../src/webgl2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,KAAK,QAAQ,EAAU,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAuL3C,4EAA4E;AAC5E,qBAAa,aAAc,YAAW,OAAO;IAC3C,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;IAClC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAyB;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2C;IAChE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA+B;IACnD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA8B;IAElD,OAAO,CAAC,cAAc,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2C;IACpE,OAAO,CAAC,KAAK,CAAiB;IAC9B,2FAA2F;IAC3F,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAA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