@pixerate/editor 0.262.1 → 0.264.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 (89) hide show
  1. package/dist/animation-editor/index.cjs +60 -60
  2. package/dist/animation-editor/index.js +4 -4
  3. package/dist/brushes/index.cjs +158 -71
  4. package/dist/brushes/index.d.cts +3 -3
  5. package/dist/brushes/index.d.ts +3 -3
  6. package/dist/brushes/index.js +113 -26
  7. package/dist/brushes/library.d.cts +2 -0
  8. package/dist/brushes/library.d.ts +2 -0
  9. package/dist/brushes/profiles.d.cts +21 -2
  10. package/dist/brushes/profiles.d.ts +21 -2
  11. package/dist/brushes/ui.d.cts +57 -4
  12. package/dist/brushes/ui.d.ts +57 -4
  13. package/dist/{brushstrokeRender-25Q5BEY6.js → brushstrokeRender-3MOI7PH4.js} +3 -3
  14. package/dist/{brushstrokeRender-N6UPZSQS.cjs → brushstrokeRender-SMMPIJF2.cjs} +13 -13
  15. package/dist/canvas/index.cjs +15 -14
  16. package/dist/canvas/index.js +3 -2
  17. package/dist/canvas/stickers.d.cts +5 -1
  18. package/dist/canvas/stickers.d.ts +5 -1
  19. package/dist/{chunk-X2EXYY4J.js → chunk-4OJC4MCD.js} +9 -8
  20. package/dist/{chunk-J5UQHWVL.js → chunk-6JL2D5SG.js} +27 -15
  21. package/dist/{chunk-APX63ILU.js → chunk-ACFSFUQH.js} +31 -0
  22. package/dist/{chunk-TZOX7KWV.cjs → chunk-BY5EBP26.cjs} +35 -14
  23. package/dist/{chunk-CQVTGBQI.js → chunk-CECCP2V7.js} +1 -1
  24. package/dist/{chunk-F7CPSRLN.js → chunk-DOZ6F2K2.js} +12 -4
  25. package/dist/{chunk-5IW65VQ6.js → chunk-EE7SAYBF.js} +24 -3
  26. package/dist/{chunk-PYTJBVW5.cjs → chunk-F3KKR6DD.cjs} +37 -36
  27. package/dist/{chunk-YLUIFXSL.cjs → chunk-FQC5TDB6.cjs} +35 -35
  28. package/dist/{chunk-UVZ7RQOE.cjs → chunk-G5ADO47G.cjs} +1 -1
  29. package/dist/{chunk-D4TE5JNW.js → chunk-HAUDEVMC.js} +1 -1
  30. package/dist/{chunk-EHALWBBD.js → chunk-JEML4FSA.js} +1 -1
  31. package/dist/{chunk-43NT242D.cjs → chunk-KXNZNOEF.cjs} +86 -86
  32. package/dist/{chunk-JSDND7DF.cjs → chunk-OTN6VB5S.cjs} +32 -1
  33. package/dist/{chunk-AVTPZO4Z.cjs → chunk-PE6YJMQT.cjs} +37 -25
  34. package/dist/{chunk-QAR2N7HZ.js → chunk-ROBSFJ6F.js} +1 -1
  35. package/dist/{chunk-7AUQ2UJ3.cjs → chunk-USJX5SW4.cjs} +10 -10
  36. package/dist/{chunk-3TQW5MPW.cjs → chunk-V7MJ4HIN.cjs} +23 -23
  37. package/dist/{chunk-6NZL24W4.js → chunk-WWI6FLH2.js} +1 -1
  38. package/dist/{chunk-RVGP2XLF.cjs → chunk-XORJ7UZO.cjs} +21 -13
  39. package/dist/image-editor/controller.d.cts +3 -0
  40. package/dist/image-editor/controller.d.ts +3 -0
  41. package/dist/image-editor/index.cjs +792 -788
  42. package/dist/image-editor/index.js +10 -6
  43. package/dist/image-editor/stickers.d.cts +7 -2
  44. package/dist/image-editor/stickers.d.ts +7 -2
  45. package/dist/image-editor/types.d.cts +7 -0
  46. package/dist/image-editor/types.d.ts +7 -0
  47. package/dist/paint-editor/brush-library-tools.d.cts +8 -1
  48. package/dist/paint-editor/brush-library-tools.d.ts +8 -1
  49. package/dist/paint-editor/controller.d.cts +7 -2
  50. package/dist/paint-editor/controller.d.ts +7 -2
  51. package/dist/paint-editor/index.cjs +581 -524
  52. package/dist/paint-editor/index.d.cts +1 -1
  53. package/dist/paint-editor/index.d.ts +1 -1
  54. package/dist/paint-editor/index.js +105 -48
  55. package/dist/paint-editor/sticker-art.d.cts +20 -10
  56. package/dist/paint-editor/sticker-art.d.ts +20 -10
  57. package/dist/paint-editor/stickers.d.cts +8 -1
  58. package/dist/paint-editor/stickers.d.ts +8 -1
  59. package/dist/paint-editor/stroke.d.cts +2 -0
  60. package/dist/paint-editor/stroke.d.ts +2 -0
  61. package/dist/stickers/browser.d.cts +10 -3
  62. package/dist/stickers/browser.d.ts +10 -3
  63. package/dist/stickers/combine.d.cts +2 -0
  64. package/dist/stickers/combine.d.ts +2 -0
  65. package/dist/stickers/conformance.d.cts +1 -1
  66. package/dist/stickers/conformance.d.ts +1 -1
  67. package/dist/stickers/errors.d.cts +1 -1
  68. package/dist/stickers/errors.d.ts +1 -1
  69. package/dist/stickers/fake.d.cts +4 -2
  70. package/dist/stickers/fake.d.ts +4 -2
  71. package/dist/stickers/helpers.d.cts +16 -2
  72. package/dist/stickers/helpers.d.ts +16 -2
  73. package/dist/stickers/index.cjs +116 -29
  74. package/dist/stickers/index.js +106 -19
  75. package/dist/stickers/tools.d.cts +9 -2
  76. package/dist/stickers/tools.d.ts +9 -2
  77. package/dist/stickers/types.d.cts +32 -5
  78. package/dist/stickers/types.d.ts +32 -5
  79. package/dist/vector/controller.d.cts +13 -0
  80. package/dist/vector/controller.d.ts +13 -0
  81. package/dist/vector/index.cjs +1218 -1207
  82. package/dist/vector/index.js +19 -8
  83. package/dist/vector/stickers.d.cts +7 -2
  84. package/dist/vector/stickers.d.ts +7 -2
  85. package/package.json +1 -1
  86. package/skills/pixerate-brushes/SKILL.md +11 -3
  87. package/skills/pixerate-brushes-design/SKILL.md +1 -0
  88. package/skills/pixerate-stickers/SKILL.md +20 -9
  89. package/skills/pixerate-vector/SKILL.md +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21;
2
2
 
3
3
 
4
- var _chunkRVGP2XLFcjs = require('../chunk-RVGP2XLF.cjs');
4
+ var _chunkXORJ7UZOcjs = require('../chunk-XORJ7UZO.cjs');
5
5
 
6
6
 
7
7
 
@@ -11,11 +11,11 @@ var _chunkRVGP2XLFcjs = require('../chunk-RVGP2XLF.cjs');
11
11
 
12
12
 
13
13
 
14
- var _chunkPYTJBVW5cjs = require('../chunk-PYTJBVW5.cjs');
14
+ var _chunkF3KKR6DDcjs = require('../chunk-F3KKR6DD.cjs');
15
15
 
16
16
 
17
17
 
18
- var _chunkAVTPZO4Zcjs = require('../chunk-AVTPZO4Z.cjs');
18
+ var _chunkPE6YJMQTcjs = require('../chunk-PE6YJMQT.cjs');
19
19
 
20
20
 
21
21
  var _chunkCBVNCWJMcjs = require('../chunk-CBVNCWJM.cjs');
@@ -30,7 +30,7 @@ var _chunk7TD63DZPcjs = require('../chunk-7TD63DZP.cjs');
30
30
 
31
31
 
32
32
 
33
- var _chunk43NT242Dcjs = require('../chunk-43NT242D.cjs');
33
+ var _chunkKXNZNOEFcjs = require('../chunk-KXNZNOEF.cjs');
34
34
  require('../chunk-3ZRNK3RO.cjs');
35
35
 
36
36
 
@@ -88,7 +88,7 @@ var _chunkJLWLX52Lcjs = require('../chunk-JLWLX52L.cjs');
88
88
 
89
89
 
90
90
  var _chunkK7ENM55Pcjs = require('../chunk-K7ENM55P.cjs');
91
- require('../chunk-7AUQ2UJ3.cjs');
91
+ require('../chunk-USJX5SW4.cjs');
92
92
 
93
93
 
94
94
 
@@ -143,7 +143,7 @@ require('../chunk-7AUQ2UJ3.cjs');
143
143
 
144
144
 
145
145
 
146
- var _chunkTZOX7KWVcjs = require('../chunk-TZOX7KWV.cjs');
146
+ var _chunkBY5EBP26cjs = require('../chunk-BY5EBP26.cjs');
147
147
 
148
148
 
149
149
 
@@ -151,7 +151,8 @@ var _chunkTZOX7KWVcjs = require('../chunk-TZOX7KWV.cjs');
151
151
 
152
152
 
153
153
 
154
- var _chunkJSDND7DFcjs = require('../chunk-JSDND7DF.cjs');
154
+
155
+ var _chunkOTN6VB5Scjs = require('../chunk-OTN6VB5S.cjs');
155
156
  require('../chunk-CVFAAZXE.cjs');
156
157
 
157
158
 
@@ -603,13 +604,13 @@ var samplers = /* @__PURE__ */ new WeakMap();
603
604
  function stampSampler(ref2, art) {
604
605
  let kind = null;
605
606
  try {
606
- kind = _chunkJSDND7DFcjs.editorStampOf.call(void 0, ref2.includes(":") ? ref2 : `editor:${ref2}`);
607
+ kind = _chunkOTN6VB5Scjs.editorStampOf.call(void 0, ref2.includes(":") ? ref2 : `editor:${ref2}`);
607
608
  } catch (e3) {
608
609
  return null;
609
610
  }
610
611
  if (kind) {
611
612
  const k = kind;
612
- return (u, v, seed) => _chunkJSDND7DFcjs.stampCoverage.call(void 0, k, u, v, seed);
613
+ return (u, v, seed) => _chunkOTN6VB5Scjs.stampCoverage.call(void 0, k, u, v, seed);
613
614
  }
614
615
  const a = _optionalChain([art, 'optionalCall', _5 => _5(ref2)]);
615
616
  if (!a || !(a.width > 0 && a.height > 0)) return null;
@@ -1737,7 +1738,7 @@ function shadowToLight(shadow) {
1737
1738
  return new (0, _chunk474IQG74cjs.TiledSurface)(1, tiles, 0);
1738
1739
  }
1739
1740
  function lightTwinBrush(brush) {
1740
- return _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0,
1741
+ return _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0,
1741
1742
  {
1742
1743
  tip: { ...brush.tip, blend: "normal", pressureOpacity: brush.tip.pressureOpacity || brush.light.pressure },
1743
1744
  behavior: { ...brush.behavior, mixing: "rgb" },
@@ -2538,49 +2539,77 @@ var defaultStickerRasterizer = async (asset, size) => {
2538
2539
  const img = ctx.getImageData(0, 0, w, h);
2539
2540
  return { width: w, height: h, data: img.data };
2540
2541
  };
2541
- var StickerArtCache = (_class10 = class {constructor() { _class10.prototype.__init52.call(this);_class10.prototype.__init53.call(this); }
2542
+ var StickerArtCache = (_class10 = class _StickerArtCache {constructor() { _class10.prototype.__init52.call(this);_class10.prototype.__init53.call(this);_class10.prototype.__init54.call(this);_class10.prototype.__init55.call(this); }
2542
2543
  __init52() {this.entries = /* @__PURE__ */ new Map()}
2543
- /** The art for `ref` when it has loaded (editor stamps never need any). */
2544
- __init53() {this.get = (ref2) => {
2545
- const e = this.entries.get(ref2);
2544
+ /** Descriptions by ref (their variants pick the art), shared by the loads that need them. */
2545
+ __init53() {this.descriptions = /* @__PURE__ */ new Map()}
2546
+ __init54() {this.variants = /* @__PURE__ */ new Map()}
2547
+ static key(ref2, variant = "light") {
2548
+ return variant === "dark" ? `${ref2}#dark` : ref2;
2549
+ }
2550
+ /** The art for `ref` in `variant` (default `light`) when it has loaded (editor stamps never need any). */
2551
+ __init55() {this.get = (ref2, variant) => {
2552
+ const e = this.entries.get(_StickerArtCache.key(ref2, variant));
2546
2553
  return _optionalChain([e, 'optionalAccess', _47 => _47.status]) === "ready" ? e.art : void 0;
2547
2554
  }}
2555
+ /** The variant to draw `ref` in on a dark or light background: `dark` once the sticker is known to have it. */
2556
+ variantFor(ref2, dark) {
2557
+ return dark && _optionalChain([this, 'access', _48 => _48.variants, 'access', _49 => _49.get, 'call', _50 => _50(ref2), 'optionalAccess', _51 => _51.includes, 'call', _52 => _52("dark")]) ? "dark" : "light";
2558
+ }
2548
2559
  /** `ready`, `loading`, `failed` (with the reason) or `none` (never asked for). Editor stamps are always `ready`. */
2549
- status(ref2) {
2550
- if (_chunkJSDND7DFcjs.editorStampOf.call(void 0, ref2)) return { status: "ready" };
2551
- const e = this.entries.get(ref2);
2552
- if (!e) return { status: "none" };
2560
+ status(ref2, variant) {
2561
+ if (_chunkOTN6VB5Scjs.editorStampOf.call(void 0, ref2)) return { status: "ready" };
2562
+ const e = this.entries.get(_StickerArtCache.key(ref2, variant));
2563
+ if (!e) return this.descriptions.has(ref2) && !this.variants.has(ref2) ? { status: "loading" } : { status: "none" };
2553
2564
  return e.status === "failed" ? { status: "failed", error: e.error } : { status: e.status };
2554
2565
  }
2555
2566
  /**
2556
- * Loads and rasterises `ref` from `provider` once (later calls share the load). Unknown refs
2557
- * reject with the closest known ones; failures are kept so they are reported, and retried on
2558
- * the next call.
2567
+ * Loads and rasterises `ref` from `provider` once per variant (later calls share the load): the
2568
+ * dark variant when `dark` and the sticker has one, else the light. Unknown refs reject with the
2569
+ * closest known ones; failures are kept so they are reported, and retried on the next call.
2559
2570
  */
2560
- ensure(provider, ref2, rasterize) {
2561
- if (_chunkJSDND7DFcjs.editorStampOf.call(void 0, ref2)) return Promise.resolve(null);
2562
- const e = this.entries.get(ref2);
2563
- if (_optionalChain([e, 'optionalAccess', _48 => _48.status]) === "ready") return Promise.resolve(e.art);
2564
- if (_optionalChain([e, 'optionalAccess', _49 => _49.status]) === "loading") return e.promise;
2571
+ async ensure(provider, ref2, rasterize, dark = false) {
2572
+ if (_chunkOTN6VB5Scjs.editorStampOf.call(void 0, ref2)) return null;
2573
+ let described = this.descriptions.get(ref2);
2574
+ if (!described) {
2575
+ described = _chunkPE6YJMQTcjs.describeStickerRef.call(void 0, provider, ref2);
2576
+ this.descriptions.set(ref2, described);
2577
+ }
2578
+ let d;
2579
+ try {
2580
+ d = await described;
2581
+ } catch (err) {
2582
+ this.descriptions.delete(ref2);
2583
+ this.entries.set(_StickerArtCache.key(ref2), { status: "failed", error: err instanceof Error ? err.message : String(err) });
2584
+ throw err;
2585
+ }
2586
+ this.variants.set(ref2, _nullishCoalesce(d.variants, () => ( ["light"])));
2587
+ return this.load(provider, ref2, d, _chunkOTN6VB5Scjs.stickerVariantFor.call(void 0, d, dark), rasterize);
2588
+ }
2589
+ load(provider, ref2, d, variant, rasterize) {
2590
+ const key = _StickerArtCache.key(ref2, variant);
2591
+ const e = this.entries.get(key);
2592
+ if (_optionalChain([e, 'optionalAccess', _53 => _53.status]) === "ready") return Promise.resolve(e.art);
2593
+ if (_optionalChain([e, 'optionalAccess', _54 => _54.status]) === "loading") return e.promise;
2565
2594
  const promise = (async () => {
2566
- const d = await _chunkAVTPZO4Zcjs.describeStickerRef.call(void 0, provider, ref2);
2567
- const id = _chunkJSDND7DFcjs.stickerIdFor.call(void 0, provider, ref2);
2595
+ const id = _chunkOTN6VB5Scjs.stickerIdFor.call(void 0, provider, ref2);
2568
2596
  const max = _nullishCoalesce(provider.capabilities.maxSize, () => ( STICKER_ART_SIZE));
2569
2597
  const size = Math.min(STICKER_ART_SIZE, max);
2570
- const asset = await provider.load(id, d.formats.includes("png") ? { format: "png", size } : { format: _nullishCoalesce(d.formats[0], () => ( "svg")), size });
2598
+ const v = variant === "dark" ? { variant } : {};
2599
+ const asset = await provider.load(id, d.formats.includes("png") ? { format: "png", size, ...v } : { format: _nullishCoalesce(d.formats[0], () => ( "svg")), size, ...v });
2571
2600
  const px = await rasterize(asset, size);
2572
2601
  if (!(px.width > 0 && px.height > 0) || px.data.length !== px.width * px.height * 4) throw new (0, _chunkU67EN7GGcjs.StickerError)("load_failed", `The art for "${ref2}" came back empty or the wrong size.`);
2573
2602
  return { ...px, tintable: d.tintable };
2574
2603
  })();
2575
- this.entries.set(ref2, { status: "loading", promise });
2604
+ this.entries.set(key, { status: "loading", promise });
2576
2605
  return promise.then(
2577
2606
  (art) => {
2578
- this.entries.set(ref2, { status: "ready", art });
2607
+ this.entries.set(key, { status: "ready", art });
2579
2608
  return art;
2580
2609
  },
2581
2610
  (err) => {
2582
2611
  const message = err instanceof Error ? err.message : String(err);
2583
- this.entries.set(ref2, { status: "failed", error: message });
2612
+ this.entries.set(key, { status: "failed", error: message });
2584
2613
  throw err;
2585
2614
  }
2586
2615
  );
@@ -2588,6 +2617,8 @@ var StickerArtCache = (_class10 = class {constructor() { _class10.prototype.__in
2588
2617
  /** Forgets every load (a new provider). */
2589
2618
  clear() {
2590
2619
  this.entries.clear();
2620
+ this.descriptions.clear();
2621
+ this.variants.clear();
2591
2622
  }
2592
2623
  }, _class10);
2593
2624
  function sampleArt(art, x, y, out) {
@@ -2635,17 +2666,17 @@ function stickerRect(s) {
2635
2666
  function stickerStamp(s) {
2636
2667
  if (s.ref) {
2637
2668
  try {
2638
- return _chunkJSDND7DFcjs.editorStampOf.call(void 0, s.ref);
2669
+ return _chunkOTN6VB5Scjs.editorStampOf.call(void 0, s.ref);
2639
2670
  } catch (e4) {
2640
2671
  return null;
2641
2672
  }
2642
2673
  }
2643
- return s.stamp && _chunkJSDND7DFcjs.STAMP_KINDS.includes(s.stamp) ? s.stamp : null;
2674
+ return s.stamp && _chunkOTN6VB5Scjs.STAMP_KINDS.includes(s.stamp) ? s.stamp : null;
2644
2675
  }
2645
2676
  function drawSticker(medium, s, art) {
2646
2677
  const kind = stickerStamp(s);
2647
2678
  if (!kind) {
2648
- const a2 = _optionalChain([art, 'optionalCall', _50 => _50(s.ref)]);
2679
+ const a2 = _optionalChain([art, 'optionalCall', _55 => _55(s.ref, s.variant)]);
2649
2680
  return a2 ? drawArtSticker(medium, s, a2) : stickerRect(s);
2650
2681
  }
2651
2682
  const rect = stickerRect(s);
@@ -2665,7 +2696,7 @@ function drawSticker(medium, s, art) {
2665
2696
  const v = (-dx * sa + dy * ca) / rad2;
2666
2697
  if (u < -1.05 || u > 1.05 || v < -1.05 || v > 1.05) continue;
2667
2698
  let c = 0;
2668
- for (let k = 0; k < 4; k++) c += _chunkJSDND7DFcjs.stampCoverage.call(void 0, kind, u + ((k & 1) - 0.5) / rad2 / 2, v + ((k >> 1) - 0.5) / rad2 / 2, s.seed);
2699
+ for (let k = 0; k < 4; k++) c += _chunkOTN6VB5Scjs.stampCoverage.call(void 0, kind, u + ((k & 1) - 0.5) / rad2 / 2, v + ((k >> 1) - 0.5) / rad2 / 2, s.seed);
2669
2700
  c /= 4;
2670
2701
  if (c <= 0) continue;
2671
2702
  cov[p] = c;
@@ -2728,7 +2759,7 @@ function jitterColor(hex2, amount, seed, i) {
2728
2759
  return "#" + [out.r, out.g, out.b].map((c) => Math.round(Math.min(1, Math.max(0, c)) * 255).toString(16).padStart(2, "0")).join("");
2729
2760
  }
2730
2761
  var StickerSpray = (_class11 = class {
2731
- constructor(init) {;_class11.prototype.__init54.call(this);_class11.prototype.__init55.call(this);_class11.prototype.__init56.call(this);_class11.prototype.__init57.call(this);_class11.prototype.__init58.call(this);
2762
+ constructor(init) {;_class11.prototype.__init56.call(this);_class11.prototype.__init57.call(this);_class11.prototype.__init58.call(this);_class11.prototype.__init59.call(this);_class11.prototype.__init60.call(this);
2732
2763
  this.init = init;
2733
2764
  const b = init.brush;
2734
2765
  this.smoother = new PenSmoother(b.tip.smoothing, b.pressureSmoothing);
@@ -2740,16 +2771,16 @@ var StickerSpray = (_class11 = class {
2740
2771
  this.next = init.nextId;
2741
2772
  }
2742
2773
 
2743
- __init54() {this.dabCount = 0}
2744
- __init55() {this.stickers = []}
2774
+ __init56() {this.dabCount = 0}
2775
+ __init57() {this.stickers = []}
2745
2776
  /** Refs the spray picked but could not draw because their art had not loaded. */
2746
- __init56() {this.skipped = /* @__PURE__ */ new Set()}
2777
+ __init58() {this.skipped = /* @__PURE__ */ new Set()}
2747
2778
 
2748
2779
 
2749
2780
 
2750
2781
 
2751
- __init57() {this.lastRaw = null}
2752
- __init58() {this.lastFed = null}
2782
+ __init59() {this.lastRaw = null}
2783
+ __init60() {this.lastFed = null}
2753
2784
 
2754
2785
  push(points) {
2755
2786
  const rects = [];
@@ -2792,7 +2823,8 @@ var StickerSpray = (_class11 = class {
2792
2823
  }
2793
2824
  const ref2 = _nullishCoalesce(st.stamps[Math.floor(_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 57) * st.stamps.length)], () => ( "editor:dot"));
2794
2825
  const stamp = stickerStamp({ ref: ref2 });
2795
- if (!stamp && !_optionalChain([this, 'access', _51 => _51.init, 'access', _52 => _52.art, 'optionalCall', _53 => _53(ref2)])) {
2826
+ const variant = stamp ? "light" : _nullishCoalesce(_optionalChain([this, 'access', _56 => _56.init, 'access', _57 => _57.variant, 'optionalCall', _58 => _58(ref2)]), () => ( "light"));
2827
+ if (!stamp && !_optionalChain([this, 'access', _59 => _59.init, 'access', _60 => _60.art, 'optionalCall', _61 => _61(ref2, variant)])) {
2796
2828
  this.skipped.add(ref2);
2797
2829
  this.next++;
2798
2830
  return;
@@ -2807,7 +2839,8 @@ var StickerSpray = (_class11 = class {
2807
2839
  rotation: Math.round((-d.angle * 180 / Math.PI + (_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 59) * 2 - 1) * 180 * st.rotationJitter) * 10) / 10,
2808
2840
  color: st.colorJitter > 0 ? jitterColor(base.color, st.colorJitter, seed, i) : base.color,
2809
2841
  opacity: Math.round(Math.min(1, d.opacity * this.init.brush.tip.opacity * base.alpha) * 1e3) / 1e3,
2810
- seed: Math.floor(_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 65) * 1e9)
2842
+ seed: Math.floor(_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 65) * 1e9),
2843
+ ...variant === "dark" ? { variant } : {}
2811
2844
  };
2812
2845
  this.stickers.push(sticker);
2813
2846
  rects.push(drawSticker(this.medium, sticker, this.init.art));
@@ -2837,12 +2870,12 @@ function normalizeStickerUpdate(u) {
2837
2870
  const out = {};
2838
2871
  if (u.ref !== void 0 && u.stamp !== void 0) throw new Error("Give ref or stamp, not both (stamp is the older name for an editor stamp).");
2839
2872
  if (u.stamp !== void 0) {
2840
- if (!_chunkJSDND7DFcjs.STAMP_KINDS.includes(u.stamp)) throw new Error(`stamp ${JSON.stringify(u.stamp)} is not a stamp; use ${_chunkJSDND7DFcjs.STAMP_KINDS.join(", ")}, or ref for any sticker (find_stickers).`);
2873
+ if (!_chunkOTN6VB5Scjs.STAMP_KINDS.includes(u.stamp)) throw new Error(`stamp ${JSON.stringify(u.stamp)} is not a stamp; use ${_chunkOTN6VB5Scjs.STAMP_KINDS.join(", ")}, or ref for any sticker (find_stickers).`);
2841
2874
  out.ref = `editor:${u.stamp}`;
2842
2875
  out.stamp = u.stamp;
2843
2876
  }
2844
2877
  if (u.ref !== void 0) {
2845
- out.ref = _chunkJSDND7DFcjs.normalizeStickerRef.call(void 0, u.ref);
2878
+ out.ref = _chunkOTN6VB5Scjs.normalizeStickerRef.call(void 0, u.ref);
2846
2879
  const stamp = stickerStamp({ ref: out.ref });
2847
2880
  if (stamp) out.stamp = stamp;
2848
2881
  else out.stamp = void 0;
@@ -2911,10 +2944,10 @@ function stickerAt(stickers, x, y, art) {
2911
2944
  if (s.size < 16) return s;
2912
2945
  const kind = stickerStamp(s);
2913
2946
  if (kind) {
2914
- if (_chunkJSDND7DFcjs.stampCoverage.call(void 0, kind, u, v, s.seed) > 0.25) return s;
2947
+ if (_chunkOTN6VB5Scjs.stampCoverage.call(void 0, kind, u, v, s.seed) > 0.25) return s;
2915
2948
  continue;
2916
2949
  }
2917
- const pic = _optionalChain([art, 'optionalCall', _54 => _54(s.ref)]);
2950
+ const pic = _optionalChain([art, 'optionalCall', _62 => _62(s.ref, s.variant)]);
2918
2951
  if (!pic) return s;
2919
2952
  const scale = Math.max(pic.width, pic.height) / 2;
2920
2953
  if (sampleArt(pic, u * scale + pic.width / 2, v * scale + pic.height / 2, [0, 0, 0, 0])[3] > 0.25) return s;
@@ -2942,7 +2975,7 @@ function union(a, b) {
2942
2975
  return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
2943
2976
  }
2944
2977
  var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
2945
- constructor(host, init) {;_class12.prototype.__init59.call(this);_class12.prototype.__init60.call(this);_class12.prototype.__init61.call(this);_class12.prototype.__init62.call(this);_class12.prototype.__init63.call(this);_class12.prototype.__init64.call(this);_class12.prototype.__init65.call(this);_class12.prototype.__init66.call(this);_class12.prototype.__init67.call(this);_class12.prototype.__init68.call(this);_class12.prototype.__init69.call(this);_class12.prototype.__init70.call(this);_class12.prototype.__init71.call(this);_class12.prototype.__init72.call(this);_class12.prototype.__init73.call(this);_class12.prototype.__init74.call(this);
2978
+ constructor(host, init) {;_class12.prototype.__init61.call(this);_class12.prototype.__init62.call(this);_class12.prototype.__init63.call(this);_class12.prototype.__init64.call(this);_class12.prototype.__init65.call(this);_class12.prototype.__init66.call(this);_class12.prototype.__init67.call(this);_class12.prototype.__init68.call(this);_class12.prototype.__init69.call(this);_class12.prototype.__init70.call(this);_class12.prototype.__init71.call(this);_class12.prototype.__init72.call(this);_class12.prototype.__init73.call(this);_class12.prototype.__init74.call(this);_class12.prototype.__init75.call(this);_class12.prototype.__init76.call(this);
2946
2979
  this.host = host;
2947
2980
  this.init = init;
2948
2981
  this.layerId = init.layerId;
@@ -2952,7 +2985,7 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
2952
2985
  const brush = init.brush;
2953
2986
  if (init.wet) this.wetDriver = init.wet.driver;
2954
2987
  if (init.light && !init.wet && !init.sticker) this.lightTwin = this.makeLightTwin(init.light.surface);
2955
- const effect = _nullishCoalesce(_optionalChain([init, 'access', _55 => _55.effect, 'optionalAccess', _56 => _56.pixels]), () => ( null));
2988
+ const effect = _nullishCoalesce(_optionalChain([init, 'access', _63 => _63.effect, 'optionalAccess', _64 => _64.pixels]), () => ( null));
2956
2989
  this.apply = {
2957
2990
  mode: brush.engine === "eraser" ? "erase" : "paint",
2958
2991
  color: init.color,
@@ -2965,11 +2998,11 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
2965
2998
  };
2966
2999
  if (this.wetDriver) {
2967
3000
  } else if (init.sticker) {
2968
- this.stickerSpray = new StickerSpray({ brush, target: this.tileTarget(), color: init.colorHex, seed: init.seed, copies: this.copies, nextId: init.sticker.nextId, paint: _nullishCoalesce(init.paint, () => ( null)), effect, art: init.sticker.art });
3001
+ this.stickerSpray = new StickerSpray({ brush, target: this.tileTarget(), color: init.colorHex, seed: init.seed, copies: this.copies, nextId: init.sticker.nextId, paint: _nullishCoalesce(init.paint, () => ( null)), effect, art: init.sticker.art, variant: init.sticker.variant });
2969
3002
  } else if (init.thick) {
2970
3003
  const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
2971
3004
  this.thickDriver = new ThickStrokeDriver({ brush, target: this.tileTarget(), channels: init.thick.channels, color: rgb(init.color), load: init.mixerLoad, seed: init.seed, copies: this.copies, paint: _nullishCoalesce(init.paint, () => ( null)), effect });
2972
- } else if (brush.engine === "mixer" || brush.engine === "blender" || brush.engine === "smudge" || _chunkTZOX7KWVcjs.usesPaintExchange.call(void 0, brush, Boolean(init.paint))) {
3005
+ } else if (brush.engine === "mixer" || brush.engine === "blender" || brush.engine === "smudge" || _chunkBY5EBP26cjs.usesPaintExchange.call(void 0, brush, Boolean(init.paint))) {
2973
3006
  const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
2974
3007
  this.wet = new PaintDabStroke(brush, {
2975
3008
  target: this.tileTarget(),
@@ -2993,29 +3026,29 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
2993
3026
 
2994
3027
 
2995
3028
  /** The raw input so far (what a replay feeds back in). */
2996
- __init59() {this.points = []}
3029
+ __init61() {this.points = []}
2997
3030
 
2998
3031
 
2999
- __init60() {this.touched = /* @__PURE__ */ new Set()}
3000
- __init61() {this.fresh = /* @__PURE__ */ new Set()}
3001
- __init62() {this.dry = null}
3002
- __init63() {this.wet = null}
3003
- __init64() {this.wetDriver = null}
3004
- __init65() {this.thickDriver = null}
3005
- __init66() {this.stickerSpray = null}
3032
+ __init62() {this.touched = /* @__PURE__ */ new Set()}
3033
+ __init63() {this.fresh = /* @__PURE__ */ new Set()}
3034
+ __init64() {this.dry = null}
3035
+ __init65() {this.wet = null}
3036
+ __init66() {this.wetDriver = null}
3037
+ __init67() {this.thickDriver = null}
3038
+ __init68() {this.stickerSpray = null}
3006
3039
  /** Light paint: the stroke's twin over the light channel, and what it left there. */
3007
- __init67() {this.lightTwin = null}
3008
- __init68() {this.lightResult = null}
3040
+ __init69() {this.lightTwin = null}
3041
+ __init70() {this.lightResult = null}
3009
3042
  /** A wet stroke that ended while the simulation was mid-batch: it commits when the driver catches up. */
3010
- __init69() {this.wetEndPending = false}
3043
+ __init71() {this.wetEndPending = false}
3011
3044
 
3012
3045
 
3013
- __init70() {this.bounds = null}
3014
- __init71() {this.lastRaw = null}
3015
- __init72() {this.closed = false}
3016
- __init73() {this.result = null}
3046
+ __init72() {this.bounds = null}
3047
+ __init73() {this.lastRaw = null}
3048
+ __init74() {this.closed = false}
3049
+ __init75() {this.result = null}
3017
3050
  /** The mask stencils this stroke was painted with when they are not the editor's (replays). */
3018
- __init74() {this.maskStencils = null}
3051
+ __init76() {this.maskStencils = null}
3019
3052
  /** The stroke's twin over the light channel: the same marks in grey at the brush's light amount (see `light.ts`). */
3020
3053
  makeLightTwin(light) {
3021
3054
  const init = this.init;
@@ -3056,11 +3089,11 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
3056
3089
  offset: this.init.offset,
3057
3090
  lockTransparency: this.init.lockTransparency,
3058
3091
  selection: _nullishCoalesce(this.init.selection, () => ( null)),
3059
- readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _57 => _57.live, 'access', _58 => _58.get, 'call', _59 => _59(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _60 => _60.data]), () => ( null)),
3092
+ readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _65 => _65.live, 'access', _66 => _66.get, 'call', _67 => _67(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _68 => _68.data]), () => ( null)),
3060
3093
  writeTile: (tx, ty) => {
3061
3094
  const key = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
3062
3095
  if (!this.touched.has(key)) {
3063
- const src = _nullishCoalesce(_optionalChain([this, 'access', _61 => _61.base, 'access', _62 => _62.tiles, 'access', _63 => _63.get, 'call', _64 => _64(key), 'optionalAccess', _65 => _65.data]), () => ( defaultTile(this.base)));
3096
+ const src = _nullishCoalesce(_optionalChain([this, 'access', _69 => _69.base, 'access', _70 => _70.tiles, 'access', _71 => _71.get, 'call', _72 => _72(key), 'optionalAccess', _73 => _73.data]), () => ( defaultTile(this.base)));
3064
3097
  this.live.set(key, { data: new Uint8ClampedArray(src), uniform: null });
3065
3098
  this.touched.add(key);
3066
3099
  }
@@ -3079,8 +3112,8 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
3079
3112
  if (filter) points = points.map(filter);
3080
3113
  for (const p of points) this.points.push(p);
3081
3114
  this.lastRaw = points[points.length - 1];
3082
- _optionalChain([this, 'access', _66 => _66.host, 'access', _67 => _67.sampled, 'optionalCall', _68 => _68(this, points)]);
3083
- _optionalChain([this, 'access', _69 => _69.lightTwin, 'optionalAccess', _70 => _70.push, 'call', _71 => _71(points)]);
3115
+ _optionalChain([this, 'access', _74 => _74.host, 'access', _75 => _75.sampled, 'optionalCall', _76 => _76(this, points)]);
3116
+ _optionalChain([this, 'access', _77 => _77.lightTwin, 'optionalAccess', _78 => _78.push, 'call', _79 => _79(points)]);
3084
3117
  if (this.wetDriver) {
3085
3118
  this.wetUpdate(this.wetDriver.push(points));
3086
3119
  return;
@@ -3093,7 +3126,7 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
3093
3126
  }
3094
3127
  /** Impasto strokes: the layer's thick-paint channels with the stroke so far. */
3095
3128
  thickChannels() {
3096
- return _nullishCoalesce(_optionalChain([this, 'access', _72 => _72.thickDriver, 'optionalAccess', _73 => _73.channels, 'call', _74 => _74()]), () => ( null));
3129
+ return _nullishCoalesce(_optionalChain([this, 'access', _80 => _80.thickDriver, 'optionalAccess', _81 => _81.channels, 'call', _82 => _82()]), () => ( null));
3097
3130
  }
3098
3131
  /** Shows a wet stroke's progress (the wet layer's display). */
3099
3132
  wetUpdate(rects) {
@@ -3139,8 +3172,8 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
3139
3172
  }
3140
3173
  }
3141
3174
  for (const [key, { tx, ty, r }] of regions) {
3142
- const src = _nullishCoalesce(_optionalChain([this, 'access', _75 => _75.base, 'access', _76 => _76.tiles, 'access', _77 => _77.get, 'call', _78 => _78(key), 'optionalAccess', _79 => _79.data]), () => ( defaultTile(this.base)));
3143
- const prev = this.touched.has(key) ? _optionalChain([this, 'access', _80 => _80.live, 'access', _81 => _81.get, 'call', _82 => _82(key), 'optionalAccess', _83 => _83.data]) : void 0;
3175
+ const src = _nullishCoalesce(_optionalChain([this, 'access', _83 => _83.base, 'access', _84 => _84.tiles, 'access', _85 => _85.get, 'call', _86 => _86(key), 'optionalAccess', _87 => _87.data]), () => ( defaultTile(this.base)));
3176
+ const prev = this.touched.has(key) ? _optionalChain([this, 'access', _88 => _88.live, 'access', _89 => _89.get, 'call', _90 => _90(key), 'optionalAccess', _91 => _91.data]) : void 0;
3144
3177
  this.touched.add(key);
3145
3178
  const data = _chunkFQPUF2W2cjs.applyStrokeToTile.call(void 0, this.dry.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
3146
3179
  this.live.set(key, { data, uniform: null });
@@ -3162,7 +3195,7 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
3162
3195
  }
3163
3196
  this.update(this.dry ? this.dry.finish() : this.thickDriver ? this.thickDriver.finish() : this.stickerSpray ? this.stickerSpray.finish() : this.wet.finish());
3164
3197
  this.closed = true;
3165
- if (_optionalChain([this, 'access', _84 => _84.lightTwin, 'optionalAccess', _85 => _85.open])) this.lightTwin.end();
3198
+ if (_optionalChain([this, 'access', _92 => _92.lightTwin, 'optionalAccess', _93 => _93.open])) this.lightTwin.end();
3166
3199
  const ch = this.base.channels;
3167
3200
  const tiles = new Map(this.base.tiles);
3168
3201
  let changed = false;
@@ -3177,8 +3210,8 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
3177
3210
  const surface = changed ? new (0, _chunk474IQG74cjs.TiledSurface)(ch, tiles, this.base.defaultValue) : null;
3178
3211
  const dabs = this.dry ? this.dry.dabCount : this.thickDriver ? this.thickDriver.dabCount : this.stickerSpray ? this.stickerSpray.dabCount : this.wet.dabCount;
3179
3212
  this.result = { layerId: this.layerId, bounds: changed ? this.bounds : null, dabs, strokeId: null };
3180
- if (_optionalChain([this, 'access', _86 => _86.stickerSpray, 'optionalAccess', _87 => _87.skipped, 'access', _88 => _88.size])) this.result.skippedStickers = [...this.stickerSpray.skipped];
3181
- const carried = _nullishCoalesce(_optionalChain([this, 'access', _89 => _89.wet, 'optionalAccess', _90 => _90.load]), () => ( _optionalChain([this, 'access', _91 => _91.thickDriver, 'optionalAccess', _92 => _92.load])));
3213
+ if (_optionalChain([this, 'access', _94 => _94.stickerSpray, 'optionalAccess', _95 => _95.skipped, 'access', _96 => _96.size])) this.result.skippedStickers = [...this.stickerSpray.skipped];
3214
+ const carried = _nullishCoalesce(_optionalChain([this, 'access', _97 => _97.wet, 'optionalAccess', _98 => _98.load]), () => ( _optionalChain([this, 'access', _99 => _99.thickDriver, 'optionalAccess', _100 => _100.load])));
3182
3215
  if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried : _chunkFQPUF2W2cjs.cleanMixer.call(void 0, carried);
3183
3216
  this.host.commit(this, surface, false);
3184
3217
  return this.result;
@@ -3187,7 +3220,7 @@ var PaintStrokeSession = (_class12 = class _PaintStrokeSession {
3187
3220
  cancel() {
3188
3221
  if (this.closed) return;
3189
3222
  this.closed = true;
3190
- if (_optionalChain([this, 'access', _93 => _93.lightTwin, 'optionalAccess', _94 => _94.open])) this.lightTwin.cancel();
3223
+ if (_optionalChain([this, 'access', _101 => _101.lightTwin, 'optionalAccess', _102 => _102.open])) this.lightTwin.cancel();
3191
3224
  this.lightResult = null;
3192
3225
  this.host.commit(this, null, true);
3193
3226
  }
@@ -3209,7 +3242,7 @@ function brushLoadForStroke(brush, current, color) {
3209
3242
  if (brush.engine === "mixer") return mixerLoadForStroke(brush, current, color);
3210
3243
  if (brush.engine === "impasto") return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
3211
3244
  if (brush.engine === "wet") return brush.wet.tool === "paint" ? { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null } : _chunkFQPUF2W2cjs.EMPTY_MIXER_LOAD;
3212
- if (_chunkTZOX7KWVcjs.usesPaintExchange.call(void 0, brush)) return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
3245
+ if (_chunkBY5EBP26cjs.usesPaintExchange.call(void 0, brush)) return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
3213
3246
  return _chunkFQPUF2W2cjs.EMPTY_MIXER_LOAD;
3214
3247
  }
3215
3248
 
@@ -3219,36 +3252,36 @@ var STENCIL_SHAPES = ["rect", "ellipse", "polygon"];
3219
3252
  var finite = (v) => typeof v === "number" && Number.isFinite(v);
3220
3253
  var pt = (p) => p && finite(p.x) && finite(p.y) ? { x: p.x, y: p.y } : void 0;
3221
3254
  function normalizeStencil(raw, id, base) {
3222
- const kind = STENCIL_KINDS.includes(raw.kind) ? raw.kind : _optionalChain([base, 'optionalAccess', _95 => _95.kind]);
3255
+ const kind = STENCIL_KINDS.includes(raw.kind) ? raw.kind : _optionalChain([base, 'optionalAccess', _103 => _103.kind]);
3223
3256
  if (!kind) throw new Error(`kind ${JSON.stringify(raw.kind)} is not a stencil; use ${STENCIL_KINDS.join(", ")}.`);
3224
3257
  const s = {
3225
3258
  id,
3226
3259
  kind,
3227
- mode: raw.mode === "guide" || raw.mode === "mask" ? raw.mode : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _96 => _96.mode]), () => ( (kind === "ruler" || kind === "arc" ? "guide" : "mask"))),
3228
- enabled: typeof raw.enabled === "boolean" ? raw.enabled : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _97 => _97.enabled]), () => ( true)),
3229
- invert: typeof raw.invert === "boolean" ? raw.invert : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _98 => _98.invert]), () => ( false)),
3230
- snap: finite(raw.snap) ? Math.min(400, Math.max(1, raw.snap)) : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _99 => _99.snap]), () => ( 40)),
3231
- feather: finite(raw.feather) ? Math.min(100, Math.max(0, raw.feather)) : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _100 => _100.feather]), () => ( 1))
3260
+ mode: raw.mode === "guide" || raw.mode === "mask" ? raw.mode : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _104 => _104.mode]), () => ( (kind === "ruler" || kind === "arc" ? "guide" : "mask"))),
3261
+ enabled: typeof raw.enabled === "boolean" ? raw.enabled : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _105 => _105.enabled]), () => ( true)),
3262
+ invert: typeof raw.invert === "boolean" ? raw.invert : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _106 => _106.invert]), () => ( false)),
3263
+ snap: finite(raw.snap) ? Math.min(400, Math.max(1, raw.snap)) : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _107 => _107.snap]), () => ( 40)),
3264
+ feather: finite(raw.feather) ? Math.min(100, Math.max(0, raw.feather)) : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _108 => _108.feather]), () => ( 1))
3232
3265
  };
3233
3266
  if (kind === "ruler" || kind === "line") {
3234
- s.from = _nullishCoalesce(pt(raw.from), () => ( _optionalChain([base, 'optionalAccess', _101 => _101.from])));
3235
- s.to = _nullishCoalesce(pt(raw.to), () => ( _optionalChain([base, 'optionalAccess', _102 => _102.to])));
3267
+ s.from = _nullishCoalesce(pt(raw.from), () => ( _optionalChain([base, 'optionalAccess', _109 => _109.from])));
3268
+ s.to = _nullishCoalesce(pt(raw.to), () => ( _optionalChain([base, 'optionalAccess', _110 => _110.to])));
3236
3269
  if (!s.from || !s.to) throw new Error(`A ${kind} needs from and to points ({x, y} in document pixels).`);
3237
3270
  if (Math.hypot(s.to.x - s.from.x, s.to.y - s.from.y) < 1) throw new Error(`A ${kind}'s from and to must be at least 1 px apart.`);
3238
3271
  } else if (kind === "arc") {
3239
- s.center = _nullishCoalesce(pt(raw.center), () => ( _optionalChain([base, 'optionalAccess', _103 => _103.center])));
3240
- s.radius = finite(raw.radius) ? raw.radius : _optionalChain([base, 'optionalAccess', _104 => _104.radius]);
3272
+ s.center = _nullishCoalesce(pt(raw.center), () => ( _optionalChain([base, 'optionalAccess', _111 => _111.center])));
3273
+ s.radius = finite(raw.radius) ? raw.radius : _optionalChain([base, 'optionalAccess', _112 => _112.radius]);
3241
3274
  if (!s.center || !(s.radius > 0)) throw new Error("An arc needs a center ({x, y}) and a radius above 0.");
3242
- s.startAngle = finite(raw.startAngle) ? raw.startAngle : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _105 => _105.startAngle]), () => ( 0));
3243
- s.endAngle = finite(raw.endAngle) ? raw.endAngle : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _106 => _106.endAngle]), () => ( 360));
3275
+ s.startAngle = finite(raw.startAngle) ? raw.startAngle : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _113 => _113.startAngle]), () => ( 0));
3276
+ s.endAngle = finite(raw.endAngle) ? raw.endAngle : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _114 => _114.endAngle]), () => ( 360));
3244
3277
  } else {
3245
- s.shape = STENCIL_SHAPES.includes(raw.shape) ? raw.shape : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _107 => _107.shape]), () => ( "rect"));
3278
+ s.shape = STENCIL_SHAPES.includes(raw.shape) ? raw.shape : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _115 => _115.shape]), () => ( "rect"));
3246
3279
  if (s.shape === "polygon") {
3247
- const pts = Array.isArray(raw.points) ? raw.points.map(pt).filter((p) => Boolean(p)) : _optionalChain([base, 'optionalAccess', _108 => _108.points]);
3280
+ const pts = Array.isArray(raw.points) ? raw.points.map(pt).filter((p) => Boolean(p)) : _optionalChain([base, 'optionalAccess', _116 => _116.points]);
3248
3281
  if (!pts || pts.length < 3) throw new Error("A polygon stencil needs at least 3 points.");
3249
3282
  s.points = pts;
3250
3283
  } else {
3251
- const r = _nullishCoalesce(raw.rect, () => ( _optionalChain([base, 'optionalAccess', _109 => _109.rect])));
3284
+ const r = _nullishCoalesce(raw.rect, () => ( _optionalChain([base, 'optionalAccess', _117 => _117.rect])));
3252
3285
  if (!r || !finite(r.x) || !finite(r.y) || !(r.width > 0) || !(r.height > 0)) throw new Error(`A ${s.shape} stencil needs rect {x, y, width, height} with a width and height above 0.`);
3253
3286
  s.rect = { x: r.x, y: r.y, width: r.width, height: r.height };
3254
3287
  }
@@ -3330,7 +3363,7 @@ var StencilSnapper = class {
3330
3363
  const { distance } = nearestOnStencil(s, p);
3331
3364
  if (distance <= s.snap && (!best || distance < best.d)) best = { s, d: distance };
3332
3365
  }
3333
- this.guide = _nullishCoalesce(_optionalChain([best, 'optionalAccess', _110 => _110.s]), () => ( null));
3366
+ this.guide = _nullishCoalesce(_optionalChain([best, 'optionalAccess', _118 => _118.s]), () => ( null));
3334
3367
  }
3335
3368
  if (!this.guide) return p;
3336
3369
  const q = nearestOnStencil(this.guide, p).point;
@@ -3471,15 +3504,15 @@ function readLoad(raw) {
3471
3504
  function readStrokeBrush(raw) {
3472
3505
  if (raw && typeof raw === "object" && "kind" in raw && !("engine" in raw)) {
3473
3506
  try {
3474
- return _chunkTZOX7KWVcjs.resolveBrush.call(void 0, _chunkTZOX7KWVcjs.normalizeBrushSpec.call(void 0, raw));
3507
+ return _chunkBY5EBP26cjs.resolveBrush.call(void 0, _chunkBY5EBP26cjs.normalizeBrushSpec.call(void 0, raw));
3475
3508
  } catch (e5) {
3476
3509
  }
3477
3510
  }
3478
- return _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, _nullishCoalesce(raw, () => ( {})));
3511
+ return _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, _nullishCoalesce(raw, () => ( {})));
3479
3512
  }
3480
3513
  function strokeToJSON(stroke) {
3481
3514
  const { brush, ...rest } = stroke;
3482
- return { ...JSON.parse(JSON.stringify(rest)), brush: _chunkTZOX7KWVcjs.migrateBrushV1.call(void 0, brush) };
3515
+ return { ...JSON.parse(JSON.stringify(rest)), brush: _chunkBY5EBP26cjs.migrateBrushV1.call(void 0, brush) };
3483
3516
  }
3484
3517
  function normalizeBrushStroke(raw) {
3485
3518
  if (!raw || typeof raw !== "object") return null;
@@ -3503,7 +3536,7 @@ function normalizeBrushStroke(raw) {
3503
3536
  const st = [];
3504
3537
  for (const raw2 of r.stencils) {
3505
3538
  try {
3506
- st.push(normalizeStencil(raw2, typeof _optionalChain([raw2, 'optionalAccess', _111 => _111.id]) === "string" ? raw2.id : "stencil"));
3539
+ st.push(normalizeStencil(raw2, typeof _optionalChain([raw2, 'optionalAccess', _119 => _119.id]) === "string" ? raw2.id : "stencil"));
3507
3540
  } catch (e6) {
3508
3541
  }
3509
3542
  }
@@ -3549,11 +3582,11 @@ function varyStroke(stroke, m, v) {
3549
3582
  if (ps !== 1) q.pressure = Math.min(1, Math.max(0, (_nullishCoalesce(p.pressure, () => ( 1))) * ps));
3550
3583
  return q;
3551
3584
  });
3552
- const brush = s !== 1 ? _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { ...stroke.brush, tip: { ...stroke.brush.tip, size: stroke.brush.tip.size * s } }) : stroke.brush;
3585
+ const brush = s !== 1 ? _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { ...stroke.brush, tip: { ...stroke.brush.tip, size: stroke.brush.tip.size * s } }) : stroke.brush;
3553
3586
  const out = { ...stroke, brush, points };
3554
- if (_optionalChain([stroke, 'access', _112 => _112.paint, 'optionalAccess', _113 => _113.type]) === "gradient" && s !== 1) out.paint = _chunkFQPUF2W2cjs.scalePaintGradient.call(void 0, stroke.paint, s);
3555
- if (_optionalChain([stroke, 'access', _114 => _114.paint, 'optionalAccess', _115 => _115.type]) === "effect" && stroke.paint.map && s !== 1) out.paint = { ...stroke.paint, map: { ...stroke.paint.map, length: Math.min(4096, Math.max(16, Math.round(stroke.paint.map.length * s))) } };
3556
- if (_optionalChain([stroke, 'access', _116 => _116.copies, 'optionalAccess', _117 => _117.length])) {
3587
+ if (_optionalChain([stroke, 'access', _120 => _120.paint, 'optionalAccess', _121 => _121.type]) === "gradient" && s !== 1) out.paint = _chunkFQPUF2W2cjs.scalePaintGradient.call(void 0, stroke.paint, s);
3588
+ if (_optionalChain([stroke, 'access', _122 => _122.paint, 'optionalAccess', _123 => _123.type]) === "effect" && stroke.paint.map && s !== 1) out.paint = { ...stroke.paint, map: { ...stroke.paint.map, length: Math.min(4096, Math.max(16, Math.round(stroke.paint.map.length * s))) } };
3589
+ if (_optionalChain([stroke, 'access', _124 => _124.copies, 'optionalAccess', _125 => _125.length])) {
3557
3590
  const inv = invertAffine(m);
3558
3591
  out.copies = stroke.copies.map((c) => composeAffine(m, composeAffine(c, inv)));
3559
3592
  }
@@ -3572,7 +3605,7 @@ var paperNodes = /* @__PURE__ */ new WeakMap();
3572
3605
  function paperNode(paper, light) {
3573
3606
  let n = paperNodes.get(paper);
3574
3607
  const metal = (_nullishCoalesce(paper.metallic, () => ( 0))) > 0;
3575
- if (!n || metal && (_optionalChain([n, 'access', _118 => _118.light, 'optionalAccess', _119 => _119.azimuth]) !== _optionalChain([light, 'optionalAccess', _120 => _120.azimuth]) || _optionalChain([n, 'access', _121 => _121.light, 'optionalAccess', _122 => _122.elevation]) !== _optionalChain([light, 'optionalAccess', _123 => _123.elevation]))) {
3608
+ if (!n || metal && (_optionalChain([n, 'access', _126 => _126.light, 'optionalAccess', _127 => _127.azimuth]) !== _optionalChain([light, 'optionalAccess', _128 => _128.azimuth]) || _optionalChain([n, 'access', _129 => _129.light, 'optionalAccess', _130 => _130.elevation]) !== _optionalChain([light, 'optionalAccess', _131 => _131.elevation]))) {
3576
3609
  n = { type: "paper", id: PAPER_NODE_ID, name: "Paper", visible: true, opacity: 1, blend: "normal", paper, ...metal && light ? { light: { azimuth: light.azimuth, elevation: light.elevation } } : {} };
3577
3610
  paperNodes.set(paper, n);
3578
3611
  }
@@ -3693,17 +3726,17 @@ function header(state, options) {
3693
3726
  if (options.swatches !== void 0) out.swatches = JSON.parse(JSON.stringify(options.swatches));
3694
3727
  if (options.mixingPad !== void 0) out.mixingPad = JSON.parse(JSON.stringify(options.mixingPad));
3695
3728
  if (options.wet !== void 0) out.wet = JSON.parse(JSON.stringify(options.wet));
3696
- if (_optionalChain([state, 'access', _124 => _124.wetEvents, 'optionalAccess', _125 => _125.length])) out.wetEvents = JSON.parse(JSON.stringify(state.wetEvents));
3697
- if (_optionalChain([state, 'access', _126 => _126.paintEvents, 'optionalAccess', _127 => _127.length])) out.paintEvents = JSON.parse(JSON.stringify(state.paintEvents));
3729
+ if (_optionalChain([state, 'access', _132 => _132.wetEvents, 'optionalAccess', _133 => _133.length])) out.wetEvents = JSON.parse(JSON.stringify(state.wetEvents));
3730
+ if (_optionalChain([state, 'access', _134 => _134.paintEvents, 'optionalAccess', _135 => _135.length])) out.paintEvents = JSON.parse(JSON.stringify(state.paintEvents));
3698
3731
  if (state.origin && (state.origin.x || state.origin.y)) out.origin = { ...state.origin };
3699
3732
  return out;
3700
3733
  }
3701
3734
  function serializePaintDocument(state, options = {}) {
3702
- const { layers, assets } = _chunk43NT242Dcjs.serializeLayers.call(void 0, state.layers);
3735
+ const { layers, assets } = _chunkKXNZNOEFcjs.serializeLayers.call(void 0, state.layers);
3703
3736
  return { ...header(state, options), layers, assets };
3704
3737
  }
3705
3738
  async function serializePaintDocumentExternal(state, store, options = {}) {
3706
- const { layers, assets } = await _chunk43NT242Dcjs.serializeLayersExternal.call(void 0, state.layers, store);
3739
+ const { layers, assets } = await _chunkKXNZNOEFcjs.serializeLayersExternal.call(void 0, state.layers, store);
3707
3740
  return { ...header(state, options), layers, assets };
3708
3741
  }
3709
3742
  function paintLayersOnly(layers, problems) {
@@ -3711,7 +3744,7 @@ function paintLayersOnly(layers, problems) {
3711
3744
  for (const l of layers) {
3712
3745
  if (l.type === "pixel") {
3713
3746
  const { filters, source, ...rest } = l;
3714
- if (_optionalChain([filters, 'optionalAccess', _128 => _128.length])) problems.push(`Layer "${l.name}": its filters are an image editor feature and were dropped.`);
3747
+ if (_optionalChain([filters, 'optionalAccess', _136 => _136.length])) problems.push(`Layer "${l.name}": its filters are an image editor feature and were dropped.`);
3715
3748
  if (source) problems.push(`Layer "${l.name}" refers to an image editor source image; it loads empty.`);
3716
3749
  out.push(rest);
3717
3750
  } else if (l.type === "group") out.push({ ...l, children: paintLayersOnly(l.children, problems) });
@@ -3740,9 +3773,9 @@ function deserializePaintDocument(raw) {
3740
3773
  const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
3741
3774
  const paper = normalizePaper(_nullishCoalesce(r.paper, () => ( {})));
3742
3775
  const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
3743
- const layers = paintLayersOnly(_chunk43NT242Dcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
3776
+ const layers = paintLayersOnly(_chunkKXNZNOEFcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
3744
3777
  const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
3745
- const activeLayerId = wanted && _chunkPVJMTLPJcjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.flattenLayers.call(void 0, layers), 'access', _129 => _129.filter, 'call', _130 => _130((l) => l.type === "pixel"), 'access', _131 => _131.pop, 'call', _132 => _132(), 'optionalAccess', _133 => _133.id]), () => ( null));
3778
+ const activeLayerId = wanted && _chunkPVJMTLPJcjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.flattenLayers.call(void 0, layers), 'access', _137 => _137.filter, 'call', _138 => _138((l) => l.type === "pixel"), 'access', _139 => _139.pop, 'call', _140 => _140(), 'optionalAccess', _141 => _141.id]), () => ( null));
3746
3779
  const wetEvents = Array.isArray(r.wetEvents) ? r.wetEvents.filter((e) => e && typeof e === "object" && Number.isInteger(e.clock) && typeof e.kind === "string") : [];
3747
3780
  const state = { canvas, paper, layers, activeLayerId, strokes: readStrokes(r.strokes, problems) };
3748
3781
  if (wetEvents.length) state.wetEvents = wetEvents;
@@ -3756,7 +3789,7 @@ async function deserializePaintDocumentAsync(raw, store) {
3756
3789
  if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
3757
3790
  const r = raw;
3758
3791
  const problems = [];
3759
- const assets = await _chunk43NT242Dcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
3792
+ const assets = await _chunkKXNZNOEFcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
3760
3793
  const loaded = deserializePaintDocument({ ...r, assets });
3761
3794
  return { ...loaded, problems: [...problems, ...loaded.problems] };
3762
3795
  }
@@ -3887,7 +3920,7 @@ async function decodeImageBlob(blob) {
3887
3920
  if (!ctx) throw new Error("No 2D context to decode with.");
3888
3921
  ctx.drawImage(bitmap, 0, 0);
3889
3922
  const data = new Uint8ClampedArray(ctx.getImageData(0, 0, bitmap.width, bitmap.height).data);
3890
- _optionalChain([bitmap, 'access', _134 => _134.close, 'optionalCall', _135 => _135()]);
3923
+ _optionalChain([bitmap, 'access', _142 => _142.close, 'optionalCall', _143 => _143()]);
3891
3924
  return { width: bitmap.width, height: bitmap.height, data };
3892
3925
  }
3893
3926
  function downloadBytes(bytes, fileName, mimeType) {
@@ -3924,7 +3957,7 @@ function wetPaperInput(paper) {
3924
3957
  };
3925
3958
  }
3926
3959
  var WetStrokeDriver = (_class13 = class {
3927
- constructor(init) {;_class13.prototype.__init75.call(this);_class13.prototype.__init76.call(this);_class13.prototype.__init77.call(this);_class13.prototype.__init78.call(this);_class13.prototype.__init79.call(this);_class13.prototype.__init80.call(this);_class13.prototype.__init81.call(this);_class13.prototype.__init82.call(this);_class13.prototype.__init83.call(this);_class13.prototype.__init84.call(this);_class13.prototype.__init85.call(this);_class13.prototype.__init86.call(this);_class13.prototype.__init87.call(this);
3960
+ constructor(init) {;_class13.prototype.__init77.call(this);_class13.prototype.__init78.call(this);_class13.prototype.__init79.call(this);_class13.prototype.__init80.call(this);_class13.prototype.__init81.call(this);_class13.prototype.__init82.call(this);_class13.prototype.__init83.call(this);_class13.prototype.__init84.call(this);_class13.prototype.__init85.call(this);_class13.prototype.__init86.call(this);_class13.prototype.__init87.call(this);_class13.prototype.__init88.call(this);_class13.prototype.__init89.call(this);
3928
3961
  this.init = init;
3929
3962
  const brush = init.brush;
3930
3963
  this.smoother = new PenSmoother(brush.tip.smoothing, brush.pressureSmoothing);
@@ -3952,30 +3985,30 @@ var WetStrokeDriver = (_class13 = class {
3952
3985
  this.sampler = g ? new (0, _chunkFQPUF2W2cjs.PaintGradientSampler)(g.map.by === "across-tip" ? { ...g, map: { by: "distance", length: 300, repeat: "mirror" } } : g, init.seed) : null;
3953
3986
  }
3954
3987
 
3955
- __init75() {this.dabCount = 0}
3956
- __init76() {this.bounds = null}
3988
+ __init77() {this.dabCount = 0}
3989
+ __init78() {this.bounds = null}
3957
3990
  /** The world's clock at which each raw point was applied (recorded with the stroke). */
3958
- __init77() {this.steps = []}
3991
+ __init79() {this.steps = []}
3959
3992
 
3960
3993
 
3961
3994
 
3962
- __init78() {this.queue = []}
3963
- __init79() {this.finishing = false}
3964
- __init80() {this.finished = false}
3965
- __init81() {this.lastRaw = null}
3966
- __init82() {this.lastFed = null}
3967
- __init83() {this.tip = new Float32Array(0)}
3968
- __init84() {this.cov = new Float32Array(0)}
3969
- __init85() {this.paint = [0, 0, 0]}
3970
- __init86() {this.centre = [0, 0, 0]}
3995
+ __init80() {this.queue = []}
3996
+ __init81() {this.finishing = false}
3997
+ __init82() {this.finished = false}
3998
+ __init83() {this.lastRaw = null}
3999
+ __init84() {this.lastFed = null}
4000
+ __init85() {this.tip = new Float32Array(0)}
4001
+ __init86() {this.cov = new Float32Array(0)}
4002
+ __init87() {this.paint = [0, 0, 0]}
4003
+ __init88() {this.centre = [0, 0, 0]}
3971
4004
 
3972
4005
 
3973
4006
 
3974
- __init87() {this.sample = { rgb: [0, 0, 0], alpha: 1 }}
4007
+ __init89() {this.sample = { rgb: [0, 0, 0], alpha: 1 }}
3975
4008
 
3976
4009
  /** What copy 0's brush carries after the dabs so far. */
3977
4010
  get load() {
3978
- return _nullishCoalesce(_optionalChain([this, 'access', _136 => _136.states, 'access', _137 => _137[0], 'access', _138 => _138.exchange, 'optionalAccess', _139 => _139.load]), () => ( null));
4011
+ return _nullishCoalesce(_optionalChain([this, 'access', _144 => _144.states, 'access', _145 => _145[0], 'access', _146 => _146.exchange, 'optionalAccess', _147 => _147.load]), () => ( null));
3979
4012
  }
3980
4013
  /** Whether every point (and the end) has been applied. */
3981
4014
  get done() {
@@ -4128,7 +4161,7 @@ var WET_GPU_MODES = ["auto", "off"];
4128
4161
  var GPU_LEAD = 16;
4129
4162
  var DISPLAY_TILES_PER_TICK = 24;
4130
4163
  var PaintWetLayers = (_class14 = class {
4131
- constructor(host, options = {}) {;_class14.prototype.__init88.call(this);_class14.prototype.__init89.call(this);_class14.prototype.__init90.call(this);_class14.prototype.__init91.call(this);_class14.prototype.__init92.call(this);_class14.prototype.__init93.call(this);_class14.prototype.__init94.call(this);_class14.prototype.__init95.call(this);_class14.prototype.__init96.call(this);_class14.prototype.__init97.call(this);_class14.prototype.__init98.call(this);_class14.prototype.__init99.call(this);_class14.prototype.__init100.call(this);_class14.prototype.__init101.call(this);_class14.prototype.__init102.call(this);_class14.prototype.__init103.call(this);
4164
+ constructor(host, options = {}) {;_class14.prototype.__init90.call(this);_class14.prototype.__init91.call(this);_class14.prototype.__init92.call(this);_class14.prototype.__init93.call(this);_class14.prototype.__init94.call(this);_class14.prototype.__init95.call(this);_class14.prototype.__init96.call(this);_class14.prototype.__init97.call(this);_class14.prototype.__init98.call(this);_class14.prototype.__init99.call(this);_class14.prototype.__init100.call(this);_class14.prototype.__init101.call(this);_class14.prototype.__init102.call(this);_class14.prototype.__init103.call(this);_class14.prototype.__init104.call(this);_class14.prototype.__init105.call(this);
4132
4165
  this.host = host;
4133
4166
  this.options = options;
4134
4167
  this.speed = Math.max(1, Math.min(2e3, _nullishCoalesce(options.speed, () => ( 120))));
@@ -4138,27 +4171,27 @@ var PaintWetLayers = (_class14 = class {
4138
4171
  }
4139
4172
 
4140
4173
 
4141
- __init88() {this.world = null}
4142
- __init89() {this.tilt = { ..._chunkYHDHFJUCcjs.FLAT }}
4143
- __init90() {this.settings = /* @__PURE__ */ new Map()}
4144
- __init91() {this.paused = false}
4174
+ __init90() {this.world = null}
4175
+ __init91() {this.tilt = { ..._chunkYHDHFJUCcjs.FLAT }}
4176
+ __init92() {this.settings = /* @__PURE__ */ new Map()}
4177
+ __init93() {this.paused = false}
4145
4178
  /** Wet strokes dry as soon as they end (one undo step with the stroke). */
4146
- __init92() {this.instantDry = false}
4179
+ __init94() {this.instantDry = false}
4147
4180
 
4148
- __init93() {this.overlay = false}
4181
+ __init95() {this.overlay = false}
4149
4182
 
4150
4183
  /** The live wet stroke, if any. */
4151
- __init94() {this.driver = null}
4152
- __init95() {this.lastTick = null}
4153
- __init96() {this.ticking = null}
4154
- __init97() {this.stepsOwed = 0}
4155
- __init98() {this.displaying = null}
4156
- __init99() {this.leadAt = 0}
4184
+ __init96() {this.driver = null}
4185
+ __init97() {this.lastTick = null}
4186
+ __init98() {this.ticking = null}
4187
+ __init99() {this.stepsOwed = 0}
4188
+ __init100() {this.displaying = null}
4189
+ __init101() {this.leadAt = 0}
4157
4190
 
4158
4191
 
4159
- __init100() {this.gpu = null}
4160
- __init101() {this.gpuSupport = null}
4161
- __init102() {this.gpuStarting = null}
4192
+ __init102() {this.gpu = null}
4193
+ __init103() {this.gpuSupport = null}
4194
+ __init104() {this.gpuStarting = null}
4162
4195
  // --- Engine B ------------------------------------------------------------------
4163
4196
  /** Starts the GPU engine for the world (once; it may turn out unavailable). */
4164
4197
  startGpu() {
@@ -4194,8 +4227,8 @@ var PaintWetLayers = (_class14 = class {
4194
4227
  if (mode === this.gpuMode) return this.engineInfo();
4195
4228
  this.gpuMode = mode;
4196
4229
  if (mode === "off") {
4197
- _optionalChain([this, 'access', _140 => _140.world, 'optionalAccess', _141 => _141.attachGpu, 'call', _142 => _142(null)]);
4198
- _optionalChain([this, 'access', _143 => _143.gpu, 'optionalAccess', _144 => _144.destroy, 'call', _145 => _145()]);
4230
+ _optionalChain([this, 'access', _148 => _148.world, 'optionalAccess', _149 => _149.attachGpu, 'call', _150 => _150(null)]);
4231
+ _optionalChain([this, 'access', _151 => _151.gpu, 'optionalAccess', _152 => _152.destroy, 'call', _153 => _153()]);
4199
4232
  this.gpu = null;
4200
4233
  this.gpuSupport = null;
4201
4234
  } else if (this.world) this.startGpu();
@@ -4203,13 +4236,13 @@ var PaintWetLayers = (_class14 = class {
4203
4236
  }
4204
4237
  engineInfo() {
4205
4238
  const w = this.world;
4206
- const base = { mode: this.gpuMode, adapter: _nullishCoalesce(_optionalChain([this, 'access', _146 => _146.gpuSupport, 'optionalAccess', _147 => _147.adapter]), () => ( null)), maxTiles: _nullishCoalesce(_optionalChain([this, 'access', _148 => _148.gpuSupport, 'optionalAccess', _149 => _149.maxSlots]), () => ( 0)), minTiles: this.gpuMinTiles, activeTiles: _nullishCoalesce(_optionalChain([w, 'optionalAccess', _150 => _150.activeTiles, 'call', _151 => _151()]), () => ( 0)), cpu: this.backend() };
4239
+ const base = { mode: this.gpuMode, adapter: _nullishCoalesce(_optionalChain([this, 'access', _154 => _154.gpuSupport, 'optionalAccess', _155 => _155.adapter]), () => ( null)), maxTiles: _nullishCoalesce(_optionalChain([this, 'access', _156 => _156.gpuSupport, 'optionalAccess', _157 => _157.maxSlots]), () => ( 0)), minTiles: this.gpuMinTiles, activeTiles: _nullishCoalesce(_optionalChain([w, 'optionalAccess', _158 => _158.activeTiles, 'call', _159 => _159()]), () => ( 0)), cpu: this.backend() };
4207
4240
  if (this.gpuMode === "off") return { ...base, state: "off", reason: "Forced to the CPU." };
4208
4241
  if (this.gpuStarting) return { ...base, state: "starting", reason: null };
4209
- if (_optionalChain([w, 'optionalAccess', _152 => _152.gpuError])) return { ...base, state: "failed", reason: w.gpuError };
4242
+ if (_optionalChain([w, 'optionalAccess', _160 => _160.gpuError])) return { ...base, state: "failed", reason: w.gpuError };
4210
4243
  if (this.gpuSupport && !this.gpuSupport.supported) return { ...base, state: "unavailable", reason: this.gpuSupport.reason };
4211
4244
  if (!this.gpu) return { ...base, state: "not-started", reason: "Starts with the first wet stroke." };
4212
- if (_optionalChain([w, 'optionalAccess', _153 => _153.gpuActive])) return { ...base, state: "active", reason: null };
4245
+ if (_optionalChain([w, 'optionalAccess', _161 => _161.gpuActive])) return { ...base, state: "active", reason: null };
4213
4246
  return { ...base, state: "standby", reason: `The GPU takes over at ${this.gpuMinTiles} wet tiles (256 px).` };
4214
4247
  }
4215
4248
  /** The world (made on first use, at the canvas size). */
@@ -4248,13 +4281,13 @@ var PaintWetLayers = (_class14 = class {
4248
4281
  if (!this.canExtend(left, top)) throw new Error("Wet paint only moves by whole 256 px tiles, between strokes.");
4249
4282
  for (const [id, s] of this.settings) if (s.flow.center) this.settings.set(id, { ...s, flow: { ...s.flow, center: { x: s.flow.center.x + left, y: s.flow.center.y + top } } });
4250
4283
  const old = this.world;
4251
- const snap = _optionalChain([old, 'optionalAccess', _154 => _154.laneIds, 'call', _155 => _155(), 'access', _156 => _156.length]) ? old.snapshot() : null;
4284
+ const snap = _optionalChain([old, 'optionalAccess', _162 => _162.laneIds, 'call', _163 => _163(), 'access', _164 => _164.length]) ? old.snapshot() : null;
4252
4285
  this.dropWorld();
4253
4286
  this.lastTick = null;
4254
4287
  this.stepsOwed = 0;
4255
4288
  if (!old || !snap) return;
4256
4289
  const moved = _chunkYHDHFJUCcjs.moveWetSnapshot.call(void 0, snap, old, { width, height }, left, top, (l) => {
4257
- const flow = _optionalChain([this, 'access', _157 => _157.settings, 'access', _158 => _158.get, 'call', _159 => _159(l.id), 'optionalAccess', _160 => _160.flow]);
4290
+ const flow = _optionalChain([this, 'access', _165 => _165.settings, 'access', _166 => _166.get, 'call', _167 => _167(l.id), 'optionalAccess', _168 => _168.flow]);
4258
4291
  return {
4259
4292
  base: _chunk474IQG74cjs.translateSurface.call(void 0, l.base, left, top),
4260
4293
  ...l.light ? { light: _chunk474IQG74cjs.translateSurface.call(void 0, l.light, left, top) } : {},
@@ -4273,11 +4306,11 @@ var PaintWetLayers = (_class14 = class {
4273
4306
  }
4274
4307
  /** Layers holding a wet layer (wet or drying). */
4275
4308
  wetLayerIds() {
4276
- return _nullishCoalesce(_optionalChain([this, 'access', _161 => _161.world, 'optionalAccess', _162 => _162.laneIds, 'call', _163 => _163()]), () => ( []));
4309
+ return _nullishCoalesce(_optionalChain([this, 'access', _169 => _169.world, 'optionalAccess', _170 => _170.laneIds, 'call', _171 => _171()]), () => ( []));
4277
4310
  }
4278
4311
  /** Whether a batch is running (edits wait). */
4279
4312
  get busy() {
4280
- return Boolean(_optionalChain([this, 'access', _164 => _164.world, 'optionalAccess', _165 => _165.busy]));
4313
+ return Boolean(_optionalChain([this, 'access', _172 => _172.world, 'optionalAccess', _173 => _173.busy]));
4281
4314
  }
4282
4315
  /** Resolves when no batch is running. */
4283
4316
  async idle() {
@@ -4306,13 +4339,13 @@ var PaintWetLayers = (_class14 = class {
4306
4339
  setParams(layerId, update) {
4307
4340
  const s = this.settingsOf(layerId);
4308
4341
  s.params = _chunkYHDHFJUCcjs.normalizeWetParams.call(void 0, update, s.params);
4309
- if (_optionalChain([this, 'access', _166 => _166.world, 'optionalAccess', _167 => _167.hasLane, 'call', _168 => _168(layerId)])) this.world.setParams(layerId, s.params);
4342
+ if (_optionalChain([this, 'access', _174 => _174.world, 'optionalAccess', _175 => _175.hasLane, 'call', _176 => _176(layerId)])) this.world.setParams(layerId, s.params);
4310
4343
  return { ...s.params };
4311
4344
  }
4312
4345
  setFlow(layerId, update) {
4313
4346
  const s = this.settingsOf(layerId);
4314
4347
  s.flow = _chunkYHDHFJUCcjs.normalizeFlow.call(void 0, update, s.flow);
4315
- if (_optionalChain([this, 'access', _169 => _169.world, 'optionalAccess', _170 => _170.hasLane, 'call', _171 => _171(layerId)])) {
4348
+ if (_optionalChain([this, 'access', _177 => _177.world, 'optionalAccess', _178 => _178.hasLane, 'call', _179 => _179(layerId)])) {
4316
4349
  const { width, height } = this.host.canvas();
4317
4350
  this.world.setFlow(layerId, _chunkYHDHFJUCcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
4318
4351
  }
@@ -4320,29 +4353,29 @@ var PaintWetLayers = (_class14 = class {
4320
4353
  }
4321
4354
  setTilt(update) {
4322
4355
  this.tilt = _chunkYHDHFJUCcjs.normalizeTilt.call(void 0, update, this.tilt);
4323
- _optionalChain([this, 'access', _172 => _172.world, 'optionalAccess', _173 => _173.setTilt, 'call', _174 => _174(this.tilt)]);
4356
+ _optionalChain([this, 'access', _180 => _180.world, 'optionalAccess', _181 => _181.setTilt, 'call', _182 => _182(this.tilt)]);
4324
4357
  return { ...this.tilt };
4325
4358
  }
4326
4359
  /** The paper changed. */
4327
4360
  paperChanged() {
4328
- _optionalChain([this, 'access', _175 => _175.world, 'optionalAccess', _176 => _176.setPaper, 'call', _177 => _177(wetPaperInput(this.host.paper()))]);
4361
+ _optionalChain([this, 'access', _183 => _183.world, 'optionalAccess', _184 => _184.setPaper, 'call', _185 => _185(wetPaperInput(this.host.paper()))]);
4329
4362
  }
4330
4363
  /** A layer as tools describe it. */
4331
4364
  info(layerId) {
4332
4365
  const s = this.settingsOf(layerId);
4333
- const st = _optionalChain([this, 'access', _178 => _178.world, 'optionalAccess', _179 => _179.hasLane, 'call', _180 => _180(layerId)]) ? this.world.stats(layerId) : null;
4366
+ const st = _optionalChain([this, 'access', _186 => _186.world, 'optionalAccess', _187 => _187.hasLane, 'call', _188 => _188(layerId)]) ? this.world.stats(layerId) : null;
4334
4367
  return {
4335
4368
  layerId,
4336
4369
  wet: Boolean(st && st.wetCells > 0),
4337
- wetCells: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _181 => _181.wetCells]), () => ( 0)),
4338
- wetBounds: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _182 => _182.wetBounds]), () => ( null)),
4339
- activeTiles: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _183 => _183.activeTiles]), () => ( 0)),
4370
+ wetCells: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _189 => _189.wetCells]), () => ( 0)),
4371
+ wetBounds: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _190 => _190.wetBounds]), () => ( null)),
4372
+ activeTiles: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _191 => _191.activeTiles]), () => ( 0)),
4340
4373
  params: { ...s.params },
4341
4374
  flow: { ...s.flow }
4342
4375
  };
4343
4376
  }
4344
4377
  backend() {
4345
- return _nullishCoalesce(_optionalChain([this, 'access', _184 => _184.world, 'optionalAccess', _185 => _185.backend, 'call', _186 => _186()]), () => ( null));
4378
+ return _nullishCoalesce(_optionalChain([this, 'access', _192 => _192.world, 'optionalAccess', _193 => _193.backend, 'call', _194 => _194()]), () => ( null));
4346
4379
  }
4347
4380
  /** Shows the current wet pixels (at most `maxTiles` reshaded per layer). */
4348
4381
  syncDisplays(maxTiles = Infinity) {
@@ -4391,7 +4424,7 @@ var PaintWetLayers = (_class14 = class {
4391
4424
  const w = this.world;
4392
4425
  if (!w) return;
4393
4426
  for (const id of w.laneIds()) {
4394
- if (w.isActive(id) || _optionalChain([this, 'access', _187 => _187.driver, 'optionalAccess', _188 => _188.init, 'access', _189 => _189.laneId]) === id) continue;
4427
+ if (w.isActive(id) || _optionalChain([this, 'access', _195 => _195.driver, 'optionalAccess', _196 => _196.init, 'access', _197 => _197.laneId]) === id) continue;
4395
4428
  const base = w.getBase(id);
4396
4429
  const light = w.isLit(id) ? w.getLight(id) : null;
4397
4430
  w.removeLane(id);
@@ -4473,10 +4506,10 @@ var PaintWetLayers = (_class14 = class {
4473
4506
  if (!d || !this.world) return;
4474
4507
  const rects = d.flush();
4475
4508
  if (rects.length) this.syncDisplays(DISPLAY_TILES_PER_TICK);
4476
- if (d.done) _optionalChain([this, 'access', _190 => _190.onDriverDone, 'optionalCall', _191 => _191(d)]);
4509
+ if (d.done) _optionalChain([this, 'access', _198 => _198.onDriverDone, 'optionalCall', _199 => _199(d)]);
4477
4510
  }
4478
4511
  /** Called when a live stroke that ended mid-batch has finished applying. */
4479
- __init103() {this.onDriverDone = null}
4512
+ __init105() {this.onDriverDone = null}
4480
4513
  /** Steps `steps` times now (agents, tests). Returns the steps run. */
4481
4514
  async advance(steps) {
4482
4515
  await this.idle();
@@ -4517,13 +4550,13 @@ var PaintWetLayers = (_class14 = class {
4517
4550
  /** The layer's light paint with all its wet paint dried (`null` without a wet layer or light), without changing anything. */
4518
4551
  bakedLight(layerId) {
4519
4552
  const w = this.world;
4520
- if (!_optionalChain([w, 'optionalAccess', _192 => _192.hasLane, 'call', _193 => _193(layerId)]) || !w.isLit(layerId)) return null;
4553
+ if (!_optionalChain([w, 'optionalAccess', _200 => _200.hasLane, 'call', _201 => _201(layerId)]) || !w.isLit(layerId)) return null;
4521
4554
  return w.bakedLight(layerId);
4522
4555
  }
4523
4556
  /** The layer's pixels with all its wet paint dried (deterministic), without changing anything. */
4524
4557
  bakedSurface(layerId) {
4525
4558
  const w = this.world;
4526
- if (!_optionalChain([w, 'optionalAccess', _194 => _194.hasLane, 'call', _195 => _195(layerId)])) return null;
4559
+ if (!_optionalChain([w, 'optionalAccess', _202 => _202.hasLane, 'call', _203 => _203(layerId)])) return null;
4527
4560
  return w.bakedSurface(layerId);
4528
4561
  }
4529
4562
  /** A snapshot of the world for undo (`null` when there is none). */
@@ -4544,13 +4577,13 @@ var PaintWetLayers = (_class14 = class {
4544
4577
  this.syncDisplays();
4545
4578
  }
4546
4579
  dropWorld() {
4547
- _optionalChain([this, 'access', _196 => _196.world, 'optionalAccess', _197 => _197.destroy, 'call', _198 => _198()]);
4580
+ _optionalChain([this, 'access', _204 => _204.world, 'optionalAccess', _205 => _205.destroy, 'call', _206 => _206()]);
4548
4581
  this.world = null;
4549
4582
  this.driver = null;
4550
4583
  }
4551
4584
  /** Forgets everything wet (a new canvas, a resize, opening a document). */
4552
4585
  reset() {
4553
- _optionalChain([this, 'access', _199 => _199.world, 'optionalAccess', _200 => _200.destroy, 'call', _201 => _201()]);
4586
+ _optionalChain([this, 'access', _207 => _207.world, 'optionalAccess', _208 => _208.destroy, 'call', _209 => _209()]);
4554
4587
  this.world = null;
4555
4588
  this.driver = null;
4556
4589
  this.settings.clear();
@@ -4580,9 +4613,9 @@ var PaintWetLayers = (_class14 = class {
4580
4613
  return out;
4581
4614
  }
4582
4615
  destroy() {
4583
- _optionalChain([this, 'access', _202 => _202.world, 'optionalAccess', _203 => _203.destroy, 'call', _204 => _204()]);
4616
+ _optionalChain([this, 'access', _210 => _210.world, 'optionalAccess', _211 => _211.destroy, 'call', _212 => _212()]);
4584
4617
  this.world = null;
4585
- _optionalChain([this, 'access', _205 => _205.gpu, 'optionalAccess', _206 => _206.destroy, 'call', _207 => _207()]);
4618
+ _optionalChain([this, 'access', _213 => _213.gpu, 'optionalAccess', _214 => _214.destroy, 'call', _215 => _215()]);
4586
4619
  this.gpu = null;
4587
4620
  }
4588
4621
  }, _class14);
@@ -4595,7 +4628,7 @@ function wetPigmentOf(hex2, body) {
4595
4628
  var thumbWorld = null;
4596
4629
  function paintWetTestStroke(brush, paper, color, width, height) {
4597
4630
  if (!thumbWorld || thumbWorld.width !== width || thumbWorld.height !== height) {
4598
- _optionalChain([thumbWorld, 'optionalAccess', _208 => _208.destroy, 'call', _209 => _209()]);
4631
+ _optionalChain([thumbWorld, 'optionalAccess', _216 => _216.destroy, 'call', _217 => _217()]);
4599
4632
  thumbWorld = new (0, _chunkYHDHFJUCcjs.WetWorld)(width, height, wetPaperInput(paper), { kernel: "typescript", threads: 0 });
4600
4633
  } else thumbWorld.setPaper(wetPaperInput(paper));
4601
4634
  const w = thumbWorld;
@@ -4680,7 +4713,7 @@ function renderBrushThumbnail(brush, options) {
4680
4713
  const width = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.width, () => ( 160)))));
4681
4714
  const height = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.height, () => ( 48)))));
4682
4715
  const maxSize = height * 0.42;
4683
- const b = brush.tip.size > maxSize ? _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: maxSize } }, brush) : brush;
4716
+ const b = brush.tip.size > maxSize ? _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: maxSize } }, brush) : brush;
4684
4717
  const rgba = [...hexToRgb8(options.color), 255];
4685
4718
  let surface = _chunk474IQG74cjs.emptySurface.call(void 0, 4);
4686
4719
  if (b.engine === "eraser") {
@@ -4829,12 +4862,12 @@ function perspectiveDirections(g, p) {
4829
4862
  }
4830
4863
  var SNAP_DECIDE_DISTANCE = 6;
4831
4864
  var PerspectiveSnapper = (_class15 = class {
4832
- constructor(guide) {;_class15.prototype.__init104.call(this);_class15.prototype.__init105.call(this);
4865
+ constructor(guide) {;_class15.prototype.__init106.call(this);_class15.prototype.__init107.call(this);
4833
4866
  this.guide = guide;
4834
4867
  }
4835
4868
 
4836
- __init104() {this.start = null}
4837
- __init105() {this.dir = null}
4869
+ __init106() {this.start = null}
4870
+ __init107() {this.dir = null}
4838
4871
  /** The line the stroke follows, once chosen. */
4839
4872
  get line() {
4840
4873
  return this.start && this.dir ? { from: this.start, direction: this.dir } : null;
@@ -4940,11 +4973,11 @@ function readSwatch(raw) {
4940
4973
  if (!raw || typeof raw !== "object") return null;
4941
4974
  const r = raw;
4942
4975
  const g = _chunkFQPUF2W2cjs.readPaintSource.call(void 0, r.paint);
4943
- const color = typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : _optionalChain([g, 'optionalAccess', _210 => _210.type]) === "gradient" ? _chunkFQPUF2W2cjs.paintSourceColor.call(void 0, g) : null;
4976
+ const color = typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : _optionalChain([g, 'optionalAccess', _218 => _218.type]) === "gradient" ? _chunkFQPUF2W2cjs.paintSourceColor.call(void 0, g) : null;
4944
4977
  if (!color) return null;
4945
4978
  const out = { color };
4946
4979
  if (typeof r.name === "string" && r.name.trim()) out.name = r.name.trim().slice(0, 80);
4947
- if (_optionalChain([g, 'optionalAccess', _211 => _211.type]) === "gradient") out.paint = g;
4980
+ if (_optionalChain([g, 'optionalAccess', _219 => _219.type]) === "gradient") out.paint = g;
4948
4981
  return out;
4949
4982
  }
4950
4983
  var DEFAULT_SWATCHES = [
@@ -4963,7 +4996,7 @@ var DEFAULT_SWATCHES = [
4963
4996
  // src/paint-editor/mixing-pad.ts
4964
4997
  var MIXING_PAD_WIDTH = 360;
4965
4998
  var MIXING_PAD_HEIGHT = 220;
4966
- var PAD_PAINT = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, {
4999
+ var PAD_PAINT = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, {
4967
5000
  id: "pad-paint",
4968
5001
  name: "Pad paint",
4969
5002
  category: "mixer",
@@ -4971,7 +5004,7 @@ var PAD_PAINT = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, {
4971
5004
  tip: { size: 28, hardness: 0.75, spacing: 0.1, opacity: 1, flow: 0.7, pressureSize: false, pressureOpacity: false },
4972
5005
  mixer: { wet: 0.45, load: 1, mix: 0.4, loadEachStroke: true, cleanEachStroke: true, mixing: "pigment" }
4973
5006
  });
4974
- var PAD_KNIFE = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, {
5007
+ var PAD_KNIFE = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, {
4975
5008
  id: "pad-knife",
4976
5009
  name: "Palette knife",
4977
5010
  category: "smudge",
@@ -4981,19 +5014,19 @@ var PAD_KNIFE = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, {
4981
5014
  // A knife drags streaks of paint and folds them into each other, mixing them as pigment.
4982
5015
  smudge: { strength: 0.6, length: 0.8, mixing: "pigment" }
4983
5016
  });
4984
- var PAD_BLOB = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, {
5017
+ var PAD_BLOB = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, {
4985
5018
  id: "pad-blob",
4986
5019
  name: "Pad blob",
4987
5020
  category: "custom",
4988
5021
  engine: "dab",
4989
5022
  tip: { size: 20, hardness: 1, spacing: 0.1, opacity: 1, flow: 1, pressureSize: false, pressureOpacity: false }
4990
5023
  });
4991
- var MixingPad = (_class16 = class {constructor() { _class16.prototype.__init106.call(this);_class16.prototype.__init107.call(this);_class16.prototype.__init108.call(this);_class16.prototype.__init109.call(this); }
4992
- __init106() {this.width = MIXING_PAD_WIDTH}
4993
- __init107() {this.height = MIXING_PAD_HEIGHT}
4994
- __init108() {this.surface = _chunk474IQG74cjs.emptySurface.call(void 0, 4)}
5024
+ var MixingPad = (_class16 = class {constructor() { _class16.prototype.__init108.call(this);_class16.prototype.__init109.call(this);_class16.prototype.__init110.call(this);_class16.prototype.__init111.call(this); }
5025
+ __init108() {this.width = MIXING_PAD_WIDTH}
5026
+ __init109() {this.height = MIXING_PAD_HEIGHT}
5027
+ __init110() {this.surface = _chunk474IQG74cjs.emptySurface.call(void 0, 4)}
4995
5028
  /** Increments on every change (for redrawing). */
4996
- __init109() {this.version = 0}
5029
+ __init111() {this.version = 0}
4997
5030
  /** Paints (`paint`, with `color`) or smears (`knife`) through `points` in pad pixels. */
4998
5031
  stroke(points, options) {
4999
5032
  if (!points.length) throw new Error("points is empty; give at least one {x, y} in pad pixels.");
@@ -5003,7 +5036,7 @@ var MixingPad = (_class16 = class {constructor() { _class16.prototype.__init106.
5003
5036
  }
5004
5037
  }
5005
5038
  let brush = options.tool === "knife" ? PAD_KNIFE : PAD_PAINT;
5006
- if (options.size !== void 0) brush = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: options.size } }, brush);
5039
+ if (options.size !== void 0) brush = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: options.size } }, brush);
5007
5040
  return this.run(brush, points, options.color);
5008
5041
  }
5009
5042
  /** Paints `points` with `brush` in `color` on the pad. */
@@ -5102,10 +5135,10 @@ var MixingPad = (_class16 = class {constructor() { _class16.prototype.__init106.
5102
5135
  const off = used.length === 1 ? 0 : 0.45 * R;
5103
5136
  const x = Math.min(cx + R - r, Math.max(cx - R + r, cx + Math.cos(a) * off));
5104
5137
  const y = Math.min(cy + R - r, Math.max(cy - R + r, cy + Math.sin(a) * off));
5105
- const blob = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: Math.max(2, 2 * r) } }, PAD_BLOB);
5138
+ const blob = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: Math.max(2, 2 * r) } }, PAD_BLOB);
5106
5139
  this.run(blob, [{ x, y }], p.color.toLowerCase());
5107
5140
  });
5108
- const knife = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_KNIFE.tip, size: Math.max(12, R * 0.5) } }, PAD_KNIFE);
5141
+ const knife = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_KNIFE.tip, size: Math.max(12, R * 0.5) } }, PAD_KNIFE);
5109
5142
  for (let k = 0; k < passes; k++) {
5110
5143
  const stir = [];
5111
5144
  const turns = 1.6;
@@ -5120,7 +5153,7 @@ var MixingPad = (_class16 = class {constructor() { _class16.prototype.__init106.
5120
5153
  paints2.map((p) => hexToRgb8(p.color).map((v) => v / 255)),
5121
5154
  paints2.map((p) => p.parts)
5122
5155
  );
5123
- const core = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: R * 1.1, hardness: 0.55 } }, PAD_BLOB);
5156
+ const core = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: R * 1.1, hardness: 0.55 } }, PAD_BLOB);
5124
5157
  const hex2 = "#" + mixed.map((v) => Math.round(v * 255).toString(16).padStart(2, "0")).join("");
5125
5158
  this.run(core, [{ x: cx, y: cy }], hex2);
5126
5159
  return { color: this.pick(cx, cy, 2), bounds };
@@ -5131,7 +5164,7 @@ var MixingPad = (_class16 = class {constructor() { _class16.prototype.__init106.
5131
5164
  }
5132
5165
  /** Replaces the pad with a PNG (data URL or base64) of the pad's size, as `toPng` writes. */
5133
5166
  fromPng(png) {
5134
- const bytes = png.startsWith("data:") ? _optionalChain([_chunkW5M3J7PVcjs.parseDataUrl.call(void 0, png), 'optionalAccess', _212 => _212.bytes]) : _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, png);
5167
+ const bytes = png.startsWith("data:") ? _optionalChain([_chunkW5M3J7PVcjs.parseDataUrl.call(void 0, png), 'optionalAccess', _220 => _220.bytes]) : _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, png);
5135
5168
  if (!bytes || !_chunkW5M3J7PVcjs.isPng.call(void 0, bytes)) throw new Error("The pad image is not a PNG data URL or base64 PNG.");
5136
5169
  const img = _chunkW5M3J7PVcjs.decodePng.call(void 0, bytes);
5137
5170
  if (img.width !== this.width || img.height !== this.height) throw new Error(`The pad image is ${img.width}\xD7${img.height}; a mixing pad is ${this.width}\xD7${this.height}.`);
@@ -5160,21 +5193,21 @@ var MixingPad = (_class16 = class {constructor() { _class16.prototype.__init106.
5160
5193
  var copyJSON = (v) => JSON.parse(JSON.stringify(v));
5161
5194
  var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
5162
5195
  function libraryBrush(spec, builtin, resolved) {
5163
- const brush = resolved ? _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, resolved, resolved) : _chunkTZOX7KWVcjs.resolveBrush.call(void 0, spec);
5196
+ const brush = resolved ? _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, resolved, resolved) : _chunkBY5EBP26cjs.resolveBrush.call(void 0, spec);
5164
5197
  if (builtin) brush.builtin = true;
5165
5198
  else delete brush.builtin;
5166
5199
  return { spec, brush, builtin };
5167
5200
  }
5168
5201
  var builtins = null;
5169
5202
  function builtinLibraryBrushes() {
5170
- return builtins ??= _chunkTZOX7KWVcjs.BRUSH_PRESETS.map((spec) => {
5171
- const resolved = _chunkTZOX7KWVcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id);
5203
+ return builtins ??= _chunkBY5EBP26cjs.BRUSH_PRESETS.map((spec) => {
5204
+ const resolved = _chunkBY5EBP26cjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id);
5172
5205
  return libraryBrush(spec, true, resolved);
5173
5206
  });
5174
5207
  }
5175
5208
  function seededStorage(brushes) {
5176
5209
  if (!brushes.length) return void 0;
5177
- let stored = JSON.stringify({ format: "pixerate-brushes", version: 1, brushes: brushes.map(_chunkTZOX7KWVcjs.brushToJSON) });
5210
+ let stored = JSON.stringify({ format: "pixerate-brushes", version: 1, brushes: brushes.map(_chunkBY5EBP26cjs.brushToJSON) });
5178
5211
  return {
5179
5212
  get: async () => stored,
5180
5213
  set: async (_key, value) => {
@@ -5187,28 +5220,28 @@ var paints = (b) => {
5187
5220
  return JSON.stringify(rest);
5188
5221
  };
5189
5222
  function brushSpecOf(next, from) {
5190
- const plain = _chunkTZOX7KWVcjs.migrateBrushV1.call(void 0, next);
5223
+ const plain = _chunkBY5EBP26cjs.migrateBrushV1.call(void 0, next);
5191
5224
  const out = copyJSON(plain);
5192
5225
  if (from.description) out.description = from.description;
5193
- if (_optionalChain([from, 'access', _213 => _213.tags, 'optionalAccess', _214 => _214.length])) out.tags = [...from.tags];
5226
+ if (_optionalChain([from, 'access', _221 => _221.tags, 'optionalAccess', _222 => _222.length])) out.tags = [...from.tags];
5194
5227
  if (out.kind === "mark" && from.kind === "mark") {
5195
5228
  if (from.medium) out.medium = from.medium;
5196
5229
  if (from.variety) out.variety = from.variety;
5197
5230
  }
5198
5231
  const colour = { ..._nullishCoalesce(from.colour, () => ( {})) };
5199
- if (_optionalChain([plain, 'access', _215 => _215.colour, 'optionalAccess', _216 => _216.default]) !== void 0) colour.default = plain.colour.default;
5232
+ if (_optionalChain([plain, 'access', _223 => _223.colour, 'optionalAccess', _224 => _224.default]) !== void 0) colour.default = plain.colour.default;
5200
5233
  else if (isObject(colour.default) && colour.default.type === "gradient") delete colour.default;
5201
5234
  if (Object.keys(colour).length) out.colour = copyJSON(colour);
5202
5235
  else delete out.colour;
5203
- if ((_nullishCoalesce(_optionalChain([out, 'access', _217 => _217.light, 'optionalAccess', _218 => _218.amount]), () => ( 0))) > 0 && (_optionalChain([from, 'access', _219 => _219.light, 'optionalAccess', _220 => _220.spill]) || _optionalChain([from, 'access', _221 => _221.light, 'optionalAccess', _222 => _222.glow]) !== void 0)) {
5236
+ if ((_nullishCoalesce(_optionalChain([out, 'access', _225 => _225.light, 'optionalAccess', _226 => _226.amount]), () => ( 0))) > 0 && (_optionalChain([from, 'access', _227 => _227.light, 'optionalAccess', _228 => _228.spill]) || _optionalChain([from, 'access', _229 => _229.light, 'optionalAccess', _230 => _230.glow]) !== void 0)) {
5204
5237
  out.light = { ...out.light, ...from.light.spill ? { spill: { ...from.light.spill } } : {}, ...from.light.glow !== void 0 ? { glow: from.light.glow } : {} };
5205
5238
  }
5206
- if (_optionalChain([from, 'access', _223 => _223.motion, 'optionalAccess', _224 => _224.live]) !== void 0 || _optionalChain([from, 'access', _225 => _225.motion, 'optionalAccess', _226 => _226.fps]) !== void 0) {
5239
+ if (_optionalChain([from, 'access', _231 => _231.motion, 'optionalAccess', _232 => _232.live]) !== void 0 || _optionalChain([from, 'access', _233 => _233.motion, 'optionalAccess', _234 => _234.fps]) !== void 0) {
5207
5240
  out.motion = { ..._nullishCoalesce(out.motion, () => ( {})), ...from.motion.live !== void 0 ? { live: from.motion.live } : {}, ...from.motion.fps !== void 0 ? { fps: from.motion.fps } : {} };
5208
5241
  }
5209
5242
  try {
5210
- const hinted = _chunkTZOX7KWVcjs.normalizeBrushSpec.call(void 0, out, []);
5211
- if (paints(_chunkTZOX7KWVcjs.resolveBrush.call(void 0, hinted)) === paints(_chunkTZOX7KWVcjs.resolveBrush.call(void 0, plain))) return hinted;
5243
+ const hinted = _chunkBY5EBP26cjs.normalizeBrushSpec.call(void 0, out, []);
5244
+ if (paints(_chunkBY5EBP26cjs.resolveBrush.call(void 0, hinted)) === paints(_chunkBY5EBP26cjs.resolveBrush.call(void 0, plain))) return hinted;
5212
5245
  } catch (e7) {
5213
5246
  }
5214
5247
  return plain;
@@ -5345,11 +5378,11 @@ function tilesUnder(surface, rect, offset, out) {
5345
5378
  for (let ty = y0; ty <= y1; ty++) for (let tx = x0; tx <= x1; tx++) out.push(_nullishCoalesce(surface.tiles.get(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)), () => ( null)));
5346
5379
  }
5347
5380
  var sameRefs = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
5348
- var BacklightCache = (_class17 = class {constructor() { _class17.prototype.__init110.call(this);_class17.prototype.__init111.call(this);_class17.prototype.__init112.call(this);_class17.prototype.__init113.call(this); }
5349
- __init110() {this.tiles = /* @__PURE__ */ new Map()}
5350
- __init111() {this.key = ""}
5351
- __init112() {this.spillOf = null}
5352
- __init113() {this.out = null}
5381
+ var BacklightCache = (_class17 = class {constructor() { _class17.prototype.__init112.call(this);_class17.prototype.__init113.call(this);_class17.prototype.__init114.call(this);_class17.prototype.__init115.call(this); }
5382
+ __init112() {this.tiles = /* @__PURE__ */ new Map()}
5383
+ __init113() {this.key = ""}
5384
+ __init114() {this.spillOf = null}
5385
+ __init115() {this.out = null}
5353
5386
  /**
5354
5387
  * The backlight layer's pixels for `layers` (bottom first) on `paper` over a `width` × `height`
5355
5388
  * canvas, or `null` when the paper has no backlight. `spillFrom` is the committed painting (the
@@ -5375,8 +5408,8 @@ var BacklightCache = (_class17 = class {constructor() { _class17.prototype.__ini
5375
5408
  refs.length = 0;
5376
5409
  for (const l of layers) {
5377
5410
  tilesUnder(l.surface, rect, l.offset, refs);
5378
- tilesUnder(_optionalChain([l, 'access', _227 => _227.thick, 'optionalAccess', _228 => _228.height]), rect, l.offset, refs);
5379
- tilesUnder(_optionalChain([l, 'access', _229 => _229.thick, 'optionalAccess', _230 => _230.material]), rect, l.offset, refs);
5411
+ tilesUnder(_optionalChain([l, 'access', _235 => _235.thick, 'optionalAccess', _236 => _236.height]), rect, l.offset, refs);
5412
+ tilesUnder(_optionalChain([l, 'access', _237 => _237.thick, 'optionalAccess', _238 => _238.material]), rect, l.offset, refs);
5380
5413
  }
5381
5414
  const k = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
5382
5415
  let r = this.tiles.get(k);
@@ -5470,8 +5503,8 @@ function computeTile(paper, grain, amount, rect, layers) {
5470
5503
  const lr = { x: rect.x - l.offset.x, y: rect.y - l.offset.y, width: rect.width, height: rect.height };
5471
5504
  if (!l.surface.tiles.size) continue;
5472
5505
  const px = _chunk474IQG74cjs.readRegion.call(void 0, l.surface, lr);
5473
- const h = _optionalChain([l, 'access', _231 => _231.thick, 'optionalAccess', _232 => _232.height, 'access', _233 => _233.tiles, 'access', _234 => _234.size]) ? _chunk474IQG74cjs.readRegion.call(void 0, l.thick.height, lr) : null;
5474
- const m = h && _optionalChain([l, 'access', _235 => _235.thick, 'optionalAccess', _236 => _236.material, 'access', _237 => _237.tiles, 'access', _238 => _238.size]) ? _chunk474IQG74cjs.readRegion.call(void 0, l.thick.material, lr) : null;
5506
+ const h = _optionalChain([l, 'access', _239 => _239.thick, 'optionalAccess', _240 => _240.height, 'access', _241 => _241.tiles, 'access', _242 => _242.size]) ? _chunk474IQG74cjs.readRegion.call(void 0, l.thick.height, lr) : null;
5507
+ const m = h && _optionalChain([l, 'access', _243 => _243.thick, 'optionalAccess', _244 => _244.material, 'access', _245 => _245.tiles, 'access', _246 => _246.size]) ? _chunk474IQG74cjs.readRegion.call(void 0, l.thick.material, lr) : null;
5475
5508
  const op = l.opacity;
5476
5509
  for (let i = 0; i < n; i++) {
5477
5510
  const a8 = px[i * 4 + 3];
@@ -5546,7 +5579,7 @@ async function replayPainting(source, target, options = {}) {
5546
5579
  const maxStrokes = _nullishCoalesce(options.strokes, () => ( source.strokes.length));
5547
5580
  const chunk = Math.max(1, _nullishCoalesce(options.wetChunk, () => ( 0))) || Infinity;
5548
5581
  let strokes = 0;
5549
- await target.prepareEffectPaints(source.strokes.slice(0, maxStrokes).flatMap((st) => _optionalChain([st, 'access', _239 => _239.paint, 'optionalAccess', _240 => _240.type]) === "effect" ? [st.paint] : []));
5582
+ await target.prepareEffectPaints(source.strokes.slice(0, maxStrokes).flatMap((st) => _optionalChain([st, 'access', _247 => _247.paint, 'optionalAccess', _248 => _248.type]) === "effect" ? [st.paint] : []));
5550
5583
  const advanceTo = async (clock) => {
5551
5584
  const now = target.getState().wet.clock;
5552
5585
  let left = clock - now;
@@ -5554,7 +5587,7 @@ async function replayPainting(source, target, options = {}) {
5554
5587
  const n = Math.min(left, chunk);
5555
5588
  await target.advanceWet({ steps: n });
5556
5589
  left -= n;
5557
- if (Number.isFinite(chunk)) await _optionalChain([options, 'access', _241 => _241.onWetSteps, 'optionalCall', _242 => _242(target.getState().wet.clock)]);
5590
+ if (Number.isFinite(chunk)) await _optionalChain([options, 'access', _249 => _249.onWetSteps, 'optionalCall', _250 => _250(target.getState().wet.clock)]);
5558
5591
  }
5559
5592
  };
5560
5593
  const sr = (r) => ({ x: r.x * s, y: r.y * s, width: r.width * s, height: r.height * s });
@@ -5567,14 +5600,14 @@ async function replayPainting(source, target, options = {}) {
5567
5600
  else if (e.kind === "clear") target.clearLayer(e.layerId);
5568
5601
  else if (e.kind === "live-strokes") {
5569
5602
  const d = e.data;
5570
- if (_optionalChain([d, 'optionalAccess', _243 => _243.rasterized])) target.replaceLiveStrokes(e.layerId, null);
5603
+ if (_optionalChain([d, 'optionalAccess', _251 => _251.rasterized])) target.replaceLiveStrokes(e.layerId, null);
5571
5604
  else {
5572
- const list = (_nullishCoalesce(_optionalChain([d, 'optionalAccess', _244 => _244.strokes]), () => ( []))).map((st2) => s === 1 ? st2 : { ...varyStroke(st2, scaleM, { scale: s }), ...st2.stencils ? { stencils: st2.stencils.map((x) => scaleStencil(x, s)) } : {} });
5573
- await target.prepareEffectPaints(list.flatMap((st2) => _optionalChain([st2, 'access', _245 => _245.paint, 'optionalAccess', _246 => _246.type]) === "effect" ? [st2.paint] : []));
5605
+ const list = (_nullishCoalesce(_optionalChain([d, 'optionalAccess', _252 => _252.strokes]), () => ( []))).map((st2) => s === 1 ? st2 : { ...varyStroke(st2, scaleM, { scale: s }), ...st2.stencils ? { stencils: st2.stencils.map((x) => scaleStencil(x, s)) } : {} });
5606
+ await target.prepareEffectPaints(list.flatMap((st2) => _optionalChain([st2, 'access', _253 => _253.paint, 'optionalAccess', _254 => _254.type]) === "effect" ? [st2.paint] : []));
5574
5607
  target.replaceLiveStrokes(e.layerId, list);
5575
5608
  }
5576
5609
  } else if (e.kind === "stickers") {
5577
- const list = (_nullishCoalesce(_optionalChain([e, 'access', _247 => _247.data, 'optionalAccess', _248 => _248.stickers]), () => ( []))).map((x) => s === 1 ? x : { ...x, x: x.x * s, y: x.y * s, size: x.size * s });
5610
+ const list = (_nullishCoalesce(_optionalChain([e, 'access', _255 => _255.data, 'optionalAccess', _256 => _256.stickers]), () => ( []))).map((x) => s === 1 ? x : { ...x, x: x.x * s, y: x.y * s, size: x.size * s });
5578
5611
  target.replaceStickers(e.layerId, list);
5579
5612
  } else target.flattenRelief(e.layerId);
5580
5613
  continue;
@@ -5587,8 +5620,8 @@ async function replayPainting(source, target, options = {}) {
5587
5620
  switch (e.kind) {
5588
5621
  case "dry": {
5589
5622
  const rect = e.data;
5590
- const ids = _optionalChain([e, 'access', _249 => _249.layerId, 'optionalAccess', _250 => _250.split, 'call', _251 => _251(","), 'access', _252 => _252.filter, 'call', _253 => _253(Boolean)]);
5591
- if (_optionalChain([ids, 'optionalAccess', _254 => _254.length])) for (const id of ids) target.dryPaint({ layerId: id, rect: rect ? sr(rect) : void 0 });
5623
+ const ids = _optionalChain([e, 'access', _257 => _257.layerId, 'optionalAccess', _258 => _258.split, 'call', _259 => _259(","), 'access', _260 => _260.filter, 'call', _261 => _261(Boolean)]);
5624
+ if (_optionalChain([ids, 'optionalAccess', _262 => _262.length])) for (const id of ids) target.dryPaint({ layerId: id, rect: rect ? sr(rect) : void 0 });
5592
5625
  else target.dryPaint({ rect: rect ? sr(rect) : void 0 });
5593
5626
  break;
5594
5627
  }
@@ -5619,7 +5652,7 @@ async function replayPainting(source, target, options = {}) {
5619
5652
  strokes++;
5620
5653
  if (!target.getLayer(st.layerId)) continue;
5621
5654
  const init = { layerId: st.layerId, color: st.color, brush: st.brush, seed: st.seed, copies: _nullishCoalesce(st.copies, () => ( [])), ...st.load ? { load: st.load } : {}, ...st.paint ? { paint: st.paint } : {}, snapToPerspective: false, stencils: false, maskStencils: (_nullishCoalesce(st.stencils, () => ( []))).map((x) => s === 1 ? x : scaleStencil(x, s)) };
5622
- if (st.brush.engine === "wet" && _optionalChain([st, 'access', _255 => _255.steps, 'optionalAccess', _256 => _256.length]) === st.points.length) {
5655
+ if (st.brush.engine === "wet" && _optionalChain([st, 'access', _263 => _263.steps, 'optionalAccess', _264 => _264.length]) === st.points.length) {
5623
5656
  await target.wetIdle();
5624
5657
  await advanceTo(st.steps[0]);
5625
5658
  const session = target.beginStroke({ ...init, start: st.points[0] });
@@ -5639,7 +5672,7 @@ async function replayPainting(source, target, options = {}) {
5639
5672
  await target.wetIdle();
5640
5673
  target.paintStroke({ ...init, points: st.points });
5641
5674
  }
5642
- await _optionalChain([options, 'access', _257 => _257.onStroke, 'optionalCall', _258 => _258(strokes)]);
5675
+ await _optionalChain([options, 'access', _265 => _265.onStroke, 'optionalCall', _266 => _266(strokes)]);
5643
5676
  }
5644
5677
  void IDENTITY_AFFINE;
5645
5678
  }
@@ -5684,7 +5717,7 @@ async function buildTimeLapse(source, target, options = {}) {
5684
5717
  wetChunk: wetEvery > 0 ? wetEvery : 0,
5685
5718
  onStroke: (i) => {
5686
5719
  if (i % perFrame === 0 || i === total) shoot(i);
5687
- _optionalChain([options, 'access', _259 => _259.onProgress, 'optionalCall', _260 => _260(total ? i / total : 1)]);
5720
+ _optionalChain([options, 'access', _267 => _267.onProgress, 'optionalCall', _268 => _268(total ? i / total : 1)]);
5688
5721
  },
5689
5722
  onWetSteps: wetEvery > 0 ? () => shoot(-1) : void 0
5690
5723
  });
@@ -5771,10 +5804,10 @@ function mixPixels(before, after, amount) {
5771
5804
  }
5772
5805
  return out;
5773
5806
  }
5774
- var PaintEffectsRenderer = (_class18 = class {constructor() { _class18.prototype.__init114.call(this);_class18.prototype.__init115.call(this);_class18.prototype.__init116.call(this); }
5775
- __init114() {this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: 3 })}
5776
- __init115() {this.descriptions = /* @__PURE__ */ new Map()}
5777
- __init116() {this.provider = null}
5807
+ var PaintEffectsRenderer = (_class18 = class {constructor() { _class18.prototype.__init116.call(this);_class18.prototype.__init117.call(this);_class18.prototype.__init118.call(this); }
5808
+ __init116() {this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: 3 })}
5809
+ __init117() {this.descriptions = /* @__PURE__ */ new Map()}
5810
+ __init118() {this.provider = null}
5778
5811
  /** Forgets cached descriptions and renderers when the provider changes. */
5779
5812
  follow(provider) {
5780
5813
  if (provider === this.provider) return;
@@ -5864,7 +5897,7 @@ async function libraryCall(call) {
5864
5897
  try {
5865
5898
  return await call();
5866
5899
  } catch (e) {
5867
- throw e instanceof _chunkTZOX7KWVcjs.BrushLibraryError ? new PaintEditorError(e.message) : e;
5900
+ throw e instanceof _chunkBY5EBP26cjs.BrushLibraryError ? new PaintEditorError(e.message) : e;
5868
5901
  }
5869
5902
  }
5870
5903
  var HEX3 = /^#[0-9a-f]{6}$/i;
@@ -5887,12 +5920,12 @@ function unionRect(a, b) {
5887
5920
  const y = Math.min(a.y, b.y);
5888
5921
  return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
5889
5922
  }
5890
- var isPixelLayer = (l) => _optionalChain([l, 'optionalAccess', _261 => _261.type]) === "pixel";
5923
+ var isPixelLayer = (l) => _optionalChain([l, 'optionalAccess', _269 => _269.type]) === "pixel";
5891
5924
  var PaintEditorController = (_class19 = class _PaintEditorController {
5892
5925
 
5893
- __init117() {this.extensions = {}}
5894
- __init118() {this.undoStack = []}
5895
- __init119() {this.redoStack = []}
5926
+ __init119() {this.extensions = {}}
5927
+ __init120() {this.undoStack = []}
5928
+ __init121() {this.redoStack = []}
5896
5929
 
5897
5930
  /** The brush library this editor lists, saves into and paints from (shared with other editors when the host passes one). */
5898
5931
 
@@ -5902,107 +5935,107 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
5902
5935
  /** The library's brushes as last read, each as stored (facets) and as the engine paints it. */
5903
5936
 
5904
5937
  /** The brush id asked for at construction, while the library had not listed it yet. */
5905
- __init120() {this.pendingBrushId = null}
5906
- __init121() {this.brushesLoaded = Promise.resolve()}
5938
+ __init122() {this.pendingBrushId = null}
5939
+ __init123() {this.brushesLoaded = Promise.resolve()}
5907
5940
 
5908
5941
  /** The library list in the state (the same array until the user brushes change, so thumbnails are not redrawn). */
5909
- __init122() {this.library = null}
5942
+ __init124() {this.library = null}
5910
5943
 
5911
- __init123() {this.secondaryColor = "#ffffff"}
5944
+ __init125() {this.secondaryColor = "#ffffff"}
5912
5945
  /** Gradient paint chosen with `setPaint` (`null`: the paint colour). */
5913
- __init124() {this.gradient = null}
5946
+ __init126() {this.gradient = null}
5914
5947
  /** Effect paint chosen with `setEffectPaint` (rendered), and one still rendering. */
5915
- __init125() {this.effectPaint = null}
5916
- __init126() {this.effectPaintPending = null}
5948
+ __init127() {this.effectPaint = null}
5949
+ __init128() {this.effectPaintPending = null}
5917
5950
  /** Changes whenever the paint is chosen, so an effect paint that finishes rendering late does not take over. */
5918
- __init127() {this.paintEpoch = 0}
5951
+ __init129() {this.paintEpoch = 0}
5919
5952
  /** Rendered effect paints by `effectPaintKey` (most recently used last). */
5920
- __init128() {this.effectPaintPixels = /* @__PURE__ */ new Map()}
5921
- __init129() {this.mixerLoad = _chunkFQPUF2W2cjs.EMPTY_MIXER_LOAD}
5922
- __init130() {this.view = { ...DEFAULT_VIEW, pan: { ...DEFAULT_VIEW.pan } }}
5953
+ __init130() {this.effectPaintPixels = /* @__PURE__ */ new Map()}
5954
+ __init131() {this.mixerLoad = _chunkFQPUF2W2cjs.EMPTY_MIXER_LOAD}
5955
+ __init132() {this.view = { ...DEFAULT_VIEW, pan: { ...DEFAULT_VIEW.pan } }}
5923
5956
 
5924
- __init131() {this.selectedStroke = null}
5925
- __init132() {this.selectedSticker = null}
5957
+ __init133() {this.selectedStroke = null}
5958
+ __init134() {this.selectedSticker = null}
5926
5959
  /** A sticker drag in progress (`previewSticker`): the document before it, so the drop undoes in one step, and the one it showed last. */
5927
- __init133() {this.stickerPreview = null}
5960
+ __init135() {this.stickerPreview = null}
5928
5961
 
5929
- __init134() {this.listeners = /* @__PURE__ */ new Set()}
5930
- __init135() {this.commitListeners = /* @__PURE__ */ new Set()}
5931
- __init136() {this.sampleListeners = /* @__PURE__ */ new Set()}
5962
+ __init136() {this.listeners = /* @__PURE__ */ new Set()}
5963
+ __init137() {this.commitListeners = /* @__PURE__ */ new Set()}
5964
+ __init138() {this.sampleListeners = /* @__PURE__ */ new Set()}
5932
5965
  /** Origins set by `withOrigin`, innermost last. */
5933
- __init137() {this.origins = []}
5966
+ __init139() {this.origins = []}
5934
5967
  /** `group` in progress: commits fold into one step, recorded when it ends. */
5935
- __init138() {this.grouping = null}
5968
+ __init140() {this.grouping = null}
5936
5969
  /** `previewPaint` in progress: nothing is emitted or recorded. */
5937
- __init139() {this.previewing = false}
5938
- __init140() {this.version = 0}
5939
- __init141() {this.cached = null}
5940
- __init142() {this.session = null}
5941
- __init143() {this.live = null}
5942
- __init144() {this.liveLayers = null}
5943
- __init145() {this.dirty = "all"}
5944
- __init146() {this.seedCounter = 1}
5945
- __init147() {this.strokeCounter = 1}
5970
+ __init141() {this.previewing = false}
5971
+ __init142() {this.version = 0}
5972
+ __init143() {this.cached = null}
5973
+ __init144() {this.session = null}
5974
+ __init145() {this.live = null}
5975
+ __init146() {this.liveLayers = null}
5976
+ __init147() {this.dirty = "all"}
5977
+ __init148() {this.seedCounter = 1}
5978
+ __init149() {this.strokeCounter = 1}
5946
5979
  /** Light paint: each layer's spill settings (saved with the document, not undo steps; missing = the defaults). */
5947
- __init148() {this.lightSpills = {}}
5948
- __init149() {this.lightCaches = /* @__PURE__ */ new Map()}
5980
+ __init150() {this.lightSpills = {}}
5981
+ __init151() {this.lightCaches = /* @__PURE__ */ new Map()}
5949
5982
  /** Backlit paper: the light through the paint as drawn (live strokes too), and as committed (its spill). */
5950
- __init150() {this.backlightView = new BacklightCache()}
5951
- __init151() {this.backlightCommitted = new BacklightCache()}
5983
+ __init152() {this.backlightView = new BacklightCache()}
5984
+ __init153() {this.backlightCommitted = new BacklightCache()}
5952
5985
  /** Live effect paint: playing and the frame rate cap (editor state), and the time the view shows. */
5953
- __init152() {this.effectPlaybackState = { playing: true, fps: 30 }}
5954
- __init153() {this.effectTime = 0}
5986
+ __init154() {this.effectPlaybackState = { playing: true, fps: 30 }}
5987
+ __init155() {this.effectTime = 0}
5955
5988
  /** While a frame is drawn: the time live effect strokes are drawn at (else their own time). */
5956
- __init154() {this.liveEffectAt = null}
5989
+ __init156() {this.liveEffectAt = null}
5957
5990
  /** The view's stroke layers at `effectTime`, each with the document surface it was drawn from (stale once that changes). */
5958
- __init155() {this.animatedLayers = /* @__PURE__ */ new Map()}
5991
+ __init157() {this.animatedLayers = /* @__PURE__ */ new Map()}
5959
5992
  /** `renderAnimationFrame` / `withEffectTime`: layer surfaces at another time, for one render. */
5960
- __init156() {this.frameOverride = null}
5993
+ __init158() {this.frameOverride = null}
5961
5994
  /** The area each stroke painted (document pixels; `null`: nothing), learnt as it is painted or drawn, so a stroke layer edit redraws only where it changes (see `drawLiveStrokes`). */
5962
- __init157() {this.paintedBounds = /* @__PURE__ */ new WeakMap()}
5995
+ __init159() {this.paintedBounds = /* @__PURE__ */ new WeakMap()}
5963
5996
 
5964
- __init158() {this.swatches = DEFAULT_SWATCHES.map((s) => ({ ...s }))}
5965
- __init159() {this.pad = new MixingPad()}
5966
- __init160() {this.savedPads = []}
5967
- __init161() {this.nextPadId = 1}
5968
- __init162() {this.tracingVersion = 1}
5969
- __init163() {this.tracingCache = null}
5970
- __init164() {this.imagePixels = /* @__PURE__ */ new Map()}
5971
- __init165() {this.nextReferenceId = 1}
5972
- __init166() {this.viewCompositor = createPaintCompositor()}
5973
- __init167() {this.exportCompositor = createPaintCompositor()}
5997
+ __init160() {this.swatches = DEFAULT_SWATCHES.map((s) => ({ ...s }))}
5998
+ __init161() {this.pad = new MixingPad()}
5999
+ __init162() {this.savedPads = []}
6000
+ __init163() {this.nextPadId = 1}
6001
+ __init164() {this.tracingVersion = 1}
6002
+ __init165() {this.tracingCache = null}
6003
+ __init166() {this.imagePixels = /* @__PURE__ */ new Map()}
6004
+ __init167() {this.nextReferenceId = 1}
6005
+ __init168() {this.viewCompositor = createPaintCompositor()}
6006
+ __init169() {this.exportCompositor = createPaintCompositor()}
5974
6007
  /** Wet media: the simulation, its settings and time. */
5975
6008
 
5976
6009
 
5977
6010
  /** Where the light comes from for thick paint (saved with the document, not undo steps). */
5978
- __init168() {this.lighting = { ...DEFAULT_LIGHTING }}
5979
- __init169() {this.litCaches = /* @__PURE__ */ new Map()}
6011
+ __init170() {this.lighting = { ...DEFAULT_LIGHTING }}
6012
+ __init171() {this.litCaches = /* @__PURE__ */ new Map()}
5980
6013
  /** The live impasto stroke's channels. */
5981
- __init170() {this.liveThick = null}
6014
+ __init172() {this.liveThick = null}
5982
6015
  /** Set while an operation that changes wet paint runs: the simulation before it (for undo). */
5983
- __init171() {this.wetOp = null}
6016
+ __init173() {this.wetOp = null}
5984
6017
  /** The effects provider slot (see `setEffectsProvider`). */
5985
- __init172() {this.effects = new (0, _chunkL2JTLW6Bcjs.EffectsSlot)()}
6018
+ __init174() {this.effects = new (0, _chunkL2JTLW6Bcjs.EffectsSlot)()}
5986
6019
  /** The sticker library slot (see `setStickersProvider`). */
5987
- __init173() {this.stickers = new (0, _chunkJSDND7DFcjs.StickersSlot)(_chunkRVGP2XLFcjs.editorStickers.call(void 0, ))}
5988
- __init174() {this.stickerArt = new StickerArtCache()}
6020
+ __init175() {this.stickers = new (0, _chunkOTN6VB5Scjs.StickersSlot)(_chunkXORJ7UZOcjs.editorStickers.call(void 0, ))}
6021
+ __init176() {this.stickerArt = new StickerArtCache()}
5989
6022
 
5990
- __init175() {this.effectsRenderer = new PaintEffectsRenderer()}
5991
- __init176() {this.paperEffectNodeCache = null}
5992
- constructor(options = {}) {;_class19.prototype.__init117.call(this);_class19.prototype.__init118.call(this);_class19.prototype.__init119.call(this);_class19.prototype.__init120.call(this);_class19.prototype.__init121.call(this);_class19.prototype.__init122.call(this);_class19.prototype.__init123.call(this);_class19.prototype.__init124.call(this);_class19.prototype.__init125.call(this);_class19.prototype.__init126.call(this);_class19.prototype.__init127.call(this);_class19.prototype.__init128.call(this);_class19.prototype.__init129.call(this);_class19.prototype.__init130.call(this);_class19.prototype.__init131.call(this);_class19.prototype.__init132.call(this);_class19.prototype.__init133.call(this);_class19.prototype.__init134.call(this);_class19.prototype.__init135.call(this);_class19.prototype.__init136.call(this);_class19.prototype.__init137.call(this);_class19.prototype.__init138.call(this);_class19.prototype.__init139.call(this);_class19.prototype.__init140.call(this);_class19.prototype.__init141.call(this);_class19.prototype.__init142.call(this);_class19.prototype.__init143.call(this);_class19.prototype.__init144.call(this);_class19.prototype.__init145.call(this);_class19.prototype.__init146.call(this);_class19.prototype.__init147.call(this);_class19.prototype.__init148.call(this);_class19.prototype.__init149.call(this);_class19.prototype.__init150.call(this);_class19.prototype.__init151.call(this);_class19.prototype.__init152.call(this);_class19.prototype.__init153.call(this);_class19.prototype.__init154.call(this);_class19.prototype.__init155.call(this);_class19.prototype.__init156.call(this);_class19.prototype.__init157.call(this);_class19.prototype.__init158.call(this);_class19.prototype.__init159.call(this);_class19.prototype.__init160.call(this);_class19.prototype.__init161.call(this);_class19.prototype.__init162.call(this);_class19.prototype.__init163.call(this);_class19.prototype.__init164.call(this);_class19.prototype.__init165.call(this);_class19.prototype.__init166.call(this);_class19.prototype.__init167.call(this);_class19.prototype.__init168.call(this);_class19.prototype.__init169.call(this);_class19.prototype.__init170.call(this);_class19.prototype.__init171.call(this);_class19.prototype.__init172.call(this);_class19.prototype.__init173.call(this);_class19.prototype.__init174.call(this);_class19.prototype.__init175.call(this);_class19.prototype.__init176.call(this);_class19.prototype.__init177.call(this);_class19.prototype.__init178.call(this);_class19.prototype.__init179.call(this);_class19.prototype.__init180.call(this);_class19.prototype.__init181.call(this);_class19.prototype.__init182.call(this);
6023
+ __init177() {this.effectsRenderer = new PaintEffectsRenderer()}
6024
+ __init178() {this.paperEffectNodeCache = null}
6025
+ constructor(options = {}) {;_class19.prototype.__init119.call(this);_class19.prototype.__init120.call(this);_class19.prototype.__init121.call(this);_class19.prototype.__init122.call(this);_class19.prototype.__init123.call(this);_class19.prototype.__init124.call(this);_class19.prototype.__init125.call(this);_class19.prototype.__init126.call(this);_class19.prototype.__init127.call(this);_class19.prototype.__init128.call(this);_class19.prototype.__init129.call(this);_class19.prototype.__init130.call(this);_class19.prototype.__init131.call(this);_class19.prototype.__init132.call(this);_class19.prototype.__init133.call(this);_class19.prototype.__init134.call(this);_class19.prototype.__init135.call(this);_class19.prototype.__init136.call(this);_class19.prototype.__init137.call(this);_class19.prototype.__init138.call(this);_class19.prototype.__init139.call(this);_class19.prototype.__init140.call(this);_class19.prototype.__init141.call(this);_class19.prototype.__init142.call(this);_class19.prototype.__init143.call(this);_class19.prototype.__init144.call(this);_class19.prototype.__init145.call(this);_class19.prototype.__init146.call(this);_class19.prototype.__init147.call(this);_class19.prototype.__init148.call(this);_class19.prototype.__init149.call(this);_class19.prototype.__init150.call(this);_class19.prototype.__init151.call(this);_class19.prototype.__init152.call(this);_class19.prototype.__init153.call(this);_class19.prototype.__init154.call(this);_class19.prototype.__init155.call(this);_class19.prototype.__init156.call(this);_class19.prototype.__init157.call(this);_class19.prototype.__init158.call(this);_class19.prototype.__init159.call(this);_class19.prototype.__init160.call(this);_class19.prototype.__init161.call(this);_class19.prototype.__init162.call(this);_class19.prototype.__init163.call(this);_class19.prototype.__init164.call(this);_class19.prototype.__init165.call(this);_class19.prototype.__init166.call(this);_class19.prototype.__init167.call(this);_class19.prototype.__init168.call(this);_class19.prototype.__init169.call(this);_class19.prototype.__init170.call(this);_class19.prototype.__init171.call(this);_class19.prototype.__init172.call(this);_class19.prototype.__init173.call(this);_class19.prototype.__init174.call(this);_class19.prototype.__init175.call(this);_class19.prototype.__init176.call(this);_class19.prototype.__init177.call(this);_class19.prototype.__init178.call(this);_class19.prototype.__init179.call(this);_class19.prototype.__init180.call(this);_class19.prototype.__init181.call(this);_class19.prototype.__init182.call(this);_class19.prototype.__init183.call(this);_class19.prototype.__init184.call(this);
5993
6026
  this.historyLimit = Math.max(1, _nullishCoalesce(options.historyLimit, () => ( 200)));
5994
6027
  this.rasterizeSticker = _nullishCoalesce(options.rasterizeSticker, () => ( defaultStickerRasterizer));
5995
6028
  if (options.stickers) this.stickers.set(options.stickers);
5996
6029
  this.doc = createPaintDocument({ width: options.width, height: options.height, dpi: options.dpi, paper: this.resolvePaper(options.paper) });
5997
- const seed = (_nullishCoalesce(options.brushes, () => ( []))).map((b) => _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { ...b, builtin: false }));
5998
- this.brushLibrary = _nullishCoalesce(options.brushLibrary, () => ( _chunkTZOX7KWVcjs.createBrushLibrary.call(void 0, { storage: seededStorage(seed) })));
5999
- this.brushEntries = [...builtinLibraryBrushes(), ...seed.map((b) => libraryBrush(_chunkTZOX7KWVcjs.migrateBrushV1.call(void 0, b), false, b))];
6000
- const wanted = _nullishCoalesce(options.brushId, () => ( _chunkTZOX7KWVcjs.DEFAULT_BRUSH_ID));
6001
- const start = _nullishCoalesce(this.findEntry(wanted), () => ( this.findEntry(_chunkTZOX7KWVcjs.DEFAULT_BRUSH_ID)));
6002
- this.brush = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, start.brush);
6030
+ const seed = (_nullishCoalesce(options.brushes, () => ( []))).map((b) => _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { ...b, builtin: false }));
6031
+ this.brushLibrary = _nullishCoalesce(options.brushLibrary, () => ( _chunkBY5EBP26cjs.createBrushLibrary.call(void 0, { storage: seededStorage(seed) })));
6032
+ this.brushEntries = [...builtinLibraryBrushes(), ...seed.map((b) => libraryBrush(_chunkBY5EBP26cjs.migrateBrushV1.call(void 0, b), false, b))];
6033
+ const wanted = _nullishCoalesce(options.brushId, () => ( _chunkBY5EBP26cjs.DEFAULT_BRUSH_ID));
6034
+ const start = _nullishCoalesce(this.findEntry(wanted), () => ( this.findEntry(_chunkBY5EBP26cjs.DEFAULT_BRUSH_ID)));
6035
+ this.brush = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, start.brush);
6003
6036
  this.brushSpec = copyJSON(start.spec);
6004
6037
  this.unsubscribeLibrary = this.brushLibrary.subscribe(() => void this.refreshBrushes().catch(() => void 0));
6005
- if (options.brushLibrary && seed.length) void this.brushLibrary.importFile(seed.map(_chunkTZOX7KWVcjs.brushToJSON)).catch(() => void 0);
6038
+ if (options.brushLibrary && seed.length) void this.brushLibrary.importFile(seed.map(_chunkBY5EBP26cjs.brushToJSON)).catch(() => void 0);
6006
6039
  void this.refreshBrushes().catch(() => void 0);
6007
6040
  this.pendingBrushId = start.brush.id === wanted ? null : wanted;
6008
6041
  this.color = options.color ? parseColor(options.color) : "#1f2937";
@@ -6016,7 +6049,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6016
6049
  canvas: () => this.doc.canvas,
6017
6050
  paper: () => this.doc.paper,
6018
6051
  layerSurface: (id) => {
6019
- const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _262 => _262.layer]);
6052
+ const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _270 => _270.layer]);
6020
6053
  return isPixelLayer(l) ? l.surface : null;
6021
6054
  },
6022
6055
  updateSurfaces: (surfaces, rects) => {
@@ -6025,7 +6058,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6025
6058
  this.doc = { ...this.doc, layers };
6026
6059
  this.emit(rects.length ? rects : "all");
6027
6060
  },
6028
- layerLight: (id) => _nullishCoalesce(_optionalChain([this, 'access', _263 => _263.doc, 'access', _264 => _264.light, 'optionalAccess', _265 => _265[id]]), () => ( null)),
6061
+ layerLight: (id) => _nullishCoalesce(_optionalChain([this, 'access', _271 => _271.doc, 'access', _272 => _272.light, 'optionalAccess', _273 => _273[id]]), () => ( null)),
6029
6062
  updateLights: (lights) => {
6030
6063
  let light = this.doc.light;
6031
6064
  for (const [id, surface] of lights) if (_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id)) light = withLayerLight(light, id, surface);
@@ -6036,7 +6069,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6036
6069
  },
6037
6070
  options.wet
6038
6071
  );
6039
- this.wet.onDriverDone = () => _optionalChain([this, 'access', _266 => _266.session, 'optionalAccess', _267 => _267.completeWetEnd, 'call', _268 => _268()]);
6072
+ this.wet.onDriverDone = () => _optionalChain([this, 'access', _274 => _274.session, 'optionalAccess', _275 => _275.completeWetEnd, 'call', _276 => _276()]);
6040
6073
  }
6041
6074
  // --- State and events ----------------------------------------------------------
6042
6075
  subscribe(listener) {
@@ -6160,7 +6193,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6160
6193
  if (placement.bottom) this.moveLayer(layer.id, 0, null);
6161
6194
  fn(layer.id);
6162
6195
  if (this.wetOp || this.pendingWetEvents.length) throw new PaintEditorError("Wet paint can't be previewed; suggest it with a dry brush.");
6163
- const found = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, layer.id), 'optionalAccess', _269 => _269.layer]);
6196
+ const found = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, layer.id), 'optionalAccess', _277 => _277.layer]);
6164
6197
  const surface = found && isPixelLayer(found) ? found.surface : null;
6165
6198
  const bounds = surface ? _chunk474IQG74cjs.contentBounds.call(void 0, surface) : null;
6166
6199
  const box = bounds ? clipToCanvas(bounds, this.doc.canvas) : null;
@@ -6213,8 +6246,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6213
6246
  selectedSticker: this.selectedSticker,
6214
6247
  canUndo: this.undoStack.length > 0 && !this.session,
6215
6248
  canRedo: this.redoStack.length > 0 && !this.session,
6216
- undoLabel: _nullishCoalesce(_optionalChain([last, 'optionalAccess', _270 => _270.label]), () => ( null)),
6217
- redoLabel: _nullishCoalesce(_optionalChain([next, 'optionalAccess', _271 => _271.label]), () => ( null)),
6249
+ undoLabel: _nullishCoalesce(_optionalChain([last, 'optionalAccess', _278 => _278.label]), () => ( null)),
6250
+ redoLabel: _nullishCoalesce(_optionalChain([next, 'optionalAccess', _279 => _279.label]), () => ( null)),
6218
6251
  guides: this.guides,
6219
6252
  swatches: this.swatches,
6220
6253
  mixingPadVersion: this.pad.version,
@@ -6227,10 +6260,10 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6227
6260
  overlay: this.wet.overlay,
6228
6261
  instantDry: this.wet.instantDry,
6229
6262
  speed: this.wet.speed,
6230
- clock: _nullishCoalesce(_optionalChain([this, 'access', _272 => _272.wet, 'access', _273 => _273.world, 'optionalAccess', _274 => _274.clock]), () => ( 0)),
6263
+ clock: _nullishCoalesce(_optionalChain([this, 'access', _280 => _280.wet, 'access', _281 => _281.world, 'optionalAccess', _282 => _282.clock]), () => ( 0)),
6231
6264
  tilt: { ...this.wet.tilt },
6232
6265
  gpu: this.wet.gpuMode,
6233
- gpuActive: Boolean(_optionalChain([this, 'access', _275 => _275.wet, 'access', _276 => _276.world, 'optionalAccess', _277 => _277.gpuActive]))
6266
+ gpuActive: Boolean(_optionalChain([this, 'access', _283 => _283.wet, 'access', _284 => _284.world, 'optionalAccess', _285 => _285.gpuActive]))
6234
6267
  },
6235
6268
  version: this.version
6236
6269
  };
@@ -6249,7 +6282,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6249
6282
  return d;
6250
6283
  }
6251
6284
  // --- History -------------------------------------------------------------------
6252
- __init177() {this.docRevision = 0}
6285
+ __init179() {this.docRevision = 0}
6253
6286
  /**
6254
6287
  * Bumped on every change to the painting (a committed or amended step, undo, redo, opening a
6255
6288
  * document), not on wet-paint frames or view changes. `createPaintEditorDocument` uses it.
@@ -6340,9 +6373,9 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6340
6373
  return wetIds;
6341
6374
  }
6342
6375
  /** Records a wet event (for replays) in the document being built. */
6343
- __init178() {this.pendingWetEvents = []}
6376
+ __init180() {this.pendingWetEvents = []}
6344
6377
  logWet(e) {
6345
- this.pendingWetEvents.push({ clock: _nullishCoalesce(_optionalChain([this, 'access', _278 => _278.wet, 'access', _279 => _279.world, 'optionalAccess', _280 => _280.clock]), () => ( 0)), at: this.doc.strokes.length, ...e });
6378
+ this.pendingWetEvents.push({ clock: _nullishCoalesce(_optionalChain([this, 'access', _286 => _286.wet, 'access', _287 => _287.world, 'optionalAccess', _288 => _288.clock]), () => ( 0)), at: this.doc.strokes.length, ...e });
6346
6379
  }
6347
6380
  /** The document with a paint event appended (for replays). */
6348
6381
  withPaintEvent(doc, e) {
@@ -6488,7 +6521,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6488
6521
  }
6489
6522
  let next = { ...shiftDocument(this.withWetEvents(this.doc), left, top), canvas: { ...was, width, height } };
6490
6523
  for (const id of keptWet) {
6491
- const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, next.layers, id), 'optionalAccess', _281 => _281.layer]);
6524
+ const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, next.layers, id), 'optionalAccess', _289 => _289.layer]);
6492
6525
  if (isPixelLayer(l)) next = { ...next, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, next.layers, id, () => ({ ...l, surface: _chunk474IQG74cjs.translateSurface.call(void 0, l.surface, l.offset.x, l.offset.y), offset: { x: 0, y: 0 } })) };
6493
6526
  }
6494
6527
  if (this.wet.world) {
@@ -6532,7 +6565,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6532
6565
  }
6533
6566
  // --- Layers --------------------------------------------------------------------
6534
6567
  getLayer(id) {
6535
- return _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _282 => _282.layer]);
6568
+ return _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _290 => _290.layer]);
6536
6569
  }
6537
6570
  /** The active pixel layer (or `undefined`). */
6538
6571
  getActiveLayer() {
@@ -6551,7 +6584,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6551
6584
  walk(this.doc.layers, null, 0);
6552
6585
  return out;
6553
6586
  }
6554
- describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _283 => _283.parent, 'optionalAccess', _284 => _284.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _285 => _285.path, 'access', _286 => _286.length]), () => ( 0))) {
6587
+ describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _291 => _291.parent, 'optionalAccess', _292 => _292.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _293 => _293.path, 'access', _294 => _294.length]), () => ( 0))) {
6555
6588
  let bounds = null;
6556
6589
  if (l.type === "pixel") {
6557
6590
  const b = _chunk474IQG74cjs.contentBounds.call(void 0, l.surface);
@@ -6568,8 +6601,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6568
6601
  locks: { ..._nullishCoalesce(l.locks, () => ( {})) },
6569
6602
  active: l.id === this.doc.activeLayerId,
6570
6603
  bounds,
6571
- ..._optionalChain([this, 'access', _287 => _287.doc, 'access', _288 => _288.liveStrokes, 'optionalAccess', _289 => _289[l.id]]) ? { liveStrokes: this.doc.liveStrokes[l.id].length } : {},
6572
- ..._optionalChain([l, 'access', _290 => _290.effects, 'optionalAccess', _291 => _291.items, 'access', _292 => _292.length]) ? { effects: l.effects.items.length } : {},
6604
+ ..._optionalChain([this, 'access', _295 => _295.doc, 'access', _296 => _296.liveStrokes, 'optionalAccess', _297 => _297[l.id]]) ? { liveStrokes: this.doc.liveStrokes[l.id].length } : {},
6605
+ ..._optionalChain([l, 'access', _298 => _298.effects, 'optionalAccess', _299 => _299.items, 'access', _300 => _300.length]) ? { effects: l.effects.items.length } : {},
6573
6606
  parentId,
6574
6607
  depth
6575
6608
  };
@@ -6601,7 +6634,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6601
6634
  this.requireIdle("adding a layer");
6602
6635
  const count = _chunkPVJMTLPJcjs.flattenLayers.call(void 0, this.doc.layers).length;
6603
6636
  const type = _nullishCoalesce(options.type, () => ( "pixel"));
6604
- const name = _optionalChain([options, 'access', _293 => _293.name, 'optionalAccess', _294 => _294.trim, 'call', _295 => _295()]) || (type === "group" ? `Group ${count + 1}` : type === "strokes" ? `Strokes ${count + 1}` : `Layer ${count + 1}`);
6637
+ const name = _optionalChain([options, 'access', _301 => _301.name, 'optionalAccess', _302 => _302.trim, 'call', _303 => _303()]) || (type === "group" ? `Group ${count + 1}` : type === "strokes" ? `Strokes ${count + 1}` : `Layer ${count + 1}`);
6605
6638
  const layer = type === "group" ? { type: "group", id: newPaintLayerId(), name, visible: true, opacity: 1, blend: "pass-through", children: [] } : createPaintLayer(name);
6606
6639
  let parentId = null;
6607
6640
  let index;
@@ -6613,7 +6646,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6613
6646
  } else if (above) {
6614
6647
  const loc = _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, above);
6615
6648
  if (!loc) throw new PaintEditorError(`Unknown layer "${above}". Call list_layers for the ids.`);
6616
- parentId = _nullishCoalesce(_optionalChain([loc, 'access', _296 => _296.parent, 'optionalAccess', _297 => _297.id]), () => ( null));
6649
+ parentId = _nullishCoalesce(_optionalChain([loc, 'access', _304 => _304.parent, 'optionalAccess', _305 => _305.id]), () => ( null));
6617
6650
  index = loc.index + 1;
6618
6651
  }
6619
6652
  const layers = _chunkPVJMTLPJcjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
@@ -6719,7 +6752,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6719
6752
  }
6720
6753
  requireEffect(id, effectId) {
6721
6754
  const l = this.requireLayer(id);
6722
- const items = _nullishCoalesce(_optionalChain([l, 'access', _298 => _298.effects, 'optionalAccess', _299 => _299.items]), () => ( []));
6755
+ const items = _nullishCoalesce(_optionalChain([l, 'access', _306 => _306.effects, 'optionalAccess', _307 => _307.items]), () => ( []));
6723
6756
  const i = items.findIndex((e) => e.id === effectId);
6724
6757
  if (i === -1) throw new PaintEditorError(`Layer "${l.name}" has no effect "${effectId}". Effects: ${items.map((e) => `${e.id} (${e.kind})`).join(", ") || "none"}; call list_layer_effects.`);
6725
6758
  return i;
@@ -6742,7 +6775,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6742
6775
  }
6743
6776
  const layers = _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
6744
6777
  let active = this.doc.activeLayerId;
6745
- if (active && !_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.flattenLayers.call(void 0, layers), 'access', _300 => _300.filter, 'call', _301 => _301((x) => x.type === "pixel"), 'access', _302 => _302.pop, 'call', _303 => _303(), 'optionalAccess', _304 => _304.id]), () => ( null));
6778
+ if (active && !_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.flattenLayers.call(void 0, layers), 'access', _308 => _308.filter, 'call', _309 => _309((x) => x.type === "pixel"), 'access', _310 => _310.pop, 'call', _311 => _311(), 'optionalAccess', _312 => _312.id]), () => ( null));
6746
6779
  this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(_chunkPVJMTLPJcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.stickersWithout(_chunkPVJMTLPJcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.liveStrokesWithout(_chunkPVJMTLPJcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.lightWithout(_chunkPVJMTLPJcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)) });
6747
6780
  return { removed: id, activeLayerId: active };
6748
6781
  }
@@ -6768,7 +6801,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6768
6801
  return l.type === "group" ? { ...l, id: id2, children: l.children.map(copy) } : { ...l, id: id2 };
6769
6802
  };
6770
6803
  const dup = { ...copy(loc.layer), name: `${loc.layer.name} copy` };
6771
- const layers = _chunkPVJMTLPJcjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _305 => _305.parent, 'optionalAccess', _306 => _306.id]), () => ( null)), loc.index + 1);
6804
+ const layers = _chunkPVJMTLPJcjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _313 => _313.parent, 'optionalAccess', _314 => _314.id]), () => ( null)), loc.index + 1);
6772
6805
  this.commit("Duplicate layer", this.withWetEvents({ ...this.doc, layers, activeLayerId: dup.id, ...this.doc.thick ? { thick } : {}, ...this.doc.stickers ? { stickers } : {}, ...this.doc.liveStrokes ? { liveStrokes } : {}, ...this.doc.light ? { light } : {} }));
6773
6806
  return this.describeLayer(dup);
6774
6807
  }
@@ -6777,7 +6810,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6777
6810
  this.requireIdle("moving a layer");
6778
6811
  const loc = _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id);
6779
6812
  if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
6780
- const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _307 => _307.parent, 'optionalAccess', _308 => _308.id]), () => ( null)) : parentId;
6813
+ const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _315 => _315.parent, 'optionalAccess', _316 => _316.id]), () => ( null)) : parentId;
6781
6814
  if (target) {
6782
6815
  const g = this.requireLayer(target);
6783
6816
  if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
@@ -6796,7 +6829,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6796
6829
  const pre = _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id);
6797
6830
  if (pre) {
6798
6831
  const sib = pre.parent ? pre.parent.children : this.doc.layers;
6799
- this.dryLayersFirst([id, _optionalChain([sib, 'access', _309 => _309[pre.index - 1], 'optionalAccess', _310 => _310.id])].filter((x) => Boolean(x)));
6832
+ this.dryLayersFirst([id, _optionalChain([sib, 'access', _317 => _317[pre.index - 1], 'optionalAccess', _318 => _318.id])].filter((x) => Boolean(x)));
6800
6833
  }
6801
6834
  const loc = _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id);
6802
6835
  if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
@@ -6816,7 +6849,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6816
6849
  const merged = { ...below, surface, offset: { x: 0, y: 0 } };
6817
6850
  const layers = _chunkPVJMTLPJcjs.mapLayer.call(void 0, _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
6818
6851
  const toDoc = (t, l) => t ? _chunk474IQG74cjs.translateSurface.call(void 0, t, l.offset.x, l.offset.y) : void 0;
6819
- const mergedLight = _optionalChain([this, 'access', _311 => _311.doc, 'access', _312 => _312.light, 'optionalAccess', _313 => _313[upper.id]]) || _optionalChain([this, 'access', _314 => _314.doc, 'access', _315 => _315.light, 'optionalAccess', _316 => _316[below.id]]) ? mergeLight(toDoc(_optionalChain([this, 'access', _317 => _317.doc, 'access', _318 => _318.light, 'optionalAccess', _319 => _319[below.id]]), below), upper.visible ? toDoc(_optionalChain([this, 'access', _320 => _320.doc, 'access', _321 => _321.light, 'optionalAccess', _322 => _322[upper.id]]), upper) : void 0, _chunk474IQG74cjs.translateSurface.call(void 0, upper.surface, upper.offset.x, upper.offset.y)) : void 0;
6852
+ const mergedLight = _optionalChain([this, 'access', _319 => _319.doc, 'access', _320 => _320.light, 'optionalAccess', _321 => _321[upper.id]]) || _optionalChain([this, 'access', _322 => _322.doc, 'access', _323 => _323.light, 'optionalAccess', _324 => _324[below.id]]) ? mergeLight(toDoc(_optionalChain([this, 'access', _325 => _325.doc, 'access', _326 => _326.light, 'optionalAccess', _327 => _327[below.id]]), below), upper.visible ? toDoc(_optionalChain([this, 'access', _328 => _328.doc, 'access', _329 => _329.light, 'optionalAccess', _330 => _330[upper.id]]), upper) : void 0, _chunk474IQG74cjs.translateSurface.call(void 0, upper.surface, upper.offset.x, upper.offset.y)) : void 0;
6820
6853
  const lightAfter = _nullishCoalesce(this.lightWithout([upper.id, below.id]).light, () => ( (this.doc.light ? { ...this.doc.light } : void 0)));
6821
6854
  const light = mergedLight ? { ..._nullishCoalesce(lightAfter, () => ( {})), [below.id]: mergedLight } : lightAfter;
6822
6855
  this.commit("Merge down", this.withWetEvents({ ...this.doc, layers, activeLayerId: below.id, ...this.thickWithout([upper.id]), ...this.stickersWithout([upper.id, below.id]), ...this.liveStrokesWithout([upper.id, below.id]), ...light ? { light } : {} }));
@@ -6831,7 +6864,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6831
6864
  this.wet.world.removeLane(l.id);
6832
6865
  }
6833
6866
  const bounds = this.describeLayer(l).bounds;
6834
- this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4) })), ...this.thickWithout([l.id]), ...this.stickersWithout([l.id]), ..._optionalChain([this, 'access', _323 => _323.doc, 'access', _324 => _324.liveStrokes, 'optionalAccess', _325 => _325[l.id]]) ? { liveStrokes: { ...this.doc.liveStrokes, [l.id]: [] } } : {}, ...this.lightWithout([l.id]) }, { kind: "clear", layerId: l.id }));
6867
+ this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4) })), ...this.thickWithout([l.id]), ...this.stickersWithout([l.id]), ..._optionalChain([this, 'access', _331 => _331.doc, 'access', _332 => _332.liveStrokes, 'optionalAccess', _333 => _333[l.id]]) ? { liveStrokes: { ...this.doc.liveStrokes, [l.id]: [] } } : {}, ...this.lightWithout([l.id]) }, { kind: "clear", layerId: l.id }));
6835
6868
  return { layerId: l.id, bounds };
6836
6869
  }
6837
6870
  /**
@@ -6841,8 +6874,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6841
6874
  fillLayer(options = {}) {
6842
6875
  this.requireIdle("filling");
6843
6876
  const fillTarget = this.paintTarget(options.layerId, "fill");
6844
- if (_optionalChain([this, 'access', _326 => _326.doc, 'access', _327 => _327.stickers, 'optionalAccess', _328 => _328[fillTarget.id], 'optionalAccess', _329 => _329.length])) throw new PaintEditorError(`Layer "${fillTarget.name}" is a sticker layer; fill another layer (add_layer).`);
6845
- if (_optionalChain([this, 'access', _330 => _330.doc, 'access', _331 => _331.liveStrokes, 'optionalAccess', _332 => _332[fillTarget.id]])) throw new PaintEditorError(`Layer "${fillTarget.name}" is a stroke layer (its pixels are drawn from its strokes); fill another layer (add_layer), or rasterize it first (rasterize_stroke_layer).`);
6877
+ if (_optionalChain([this, 'access', _334 => _334.doc, 'access', _335 => _335.stickers, 'optionalAccess', _336 => _336[fillTarget.id], 'optionalAccess', _337 => _337.length])) throw new PaintEditorError(`Layer "${fillTarget.name}" is a sticker layer; fill another layer (add_layer).`);
6878
+ if (_optionalChain([this, 'access', _338 => _338.doc, 'access', _339 => _339.liveStrokes, 'optionalAccess', _340 => _340[fillTarget.id]])) throw new PaintEditorError(`Layer "${fillTarget.name}" is a stroke layer (its pixels are drawn from its strokes); fill another layer (add_layer), or rasterize it first (rasterize_stroke_layer).`);
6846
6879
  this.dryLayersFirst([_nullishCoalesce(_nullishCoalesce(options.layerId, () => ( this.doc.activeLayerId)), () => ( ""))]);
6847
6880
  const l = this.paintTarget(options.layerId, "fill");
6848
6881
  const color = options.color === void 0 ? this.color : parseColor(options.color);
@@ -6875,7 +6908,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6875
6908
  offset: l.offset
6876
6909
  };
6877
6910
  const surface = this.applyCoverage(l, coverage, rect, apply);
6878
- const lit = _optionalChain([this, 'access', _333 => _333.doc, 'access', _334 => _334.light, 'optionalAccess', _335 => _335[l.id]]);
6911
+ const lit = _optionalChain([this, 'access', _341 => _341.doc, 'access', _342 => _342.light, 'optionalAccess', _343 => _343[l.id]]);
6879
6912
  const light = lit ? withLayerLight(this.doc.light, l.id, scaleLight(lit, 1 - opacity)) : void 0;
6880
6913
  this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), ...light ? { light } : {} }), { kind: "fill", layerId: l.id, data: { color, opacity, grain: grainAmount, pressure, blend } }));
6881
6914
  return { layerId: l.id, bounds: rect };
@@ -6885,7 +6918,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6885
6918
  const tiles = new Map(base.tiles);
6886
6919
  for (const { tx, ty } of _chunk474IQG74cjs.tilesInRect.call(void 0, { x: rect.x - l.offset.x, y: rect.y - l.offset.y, width: rect.width, height: rect.height })) {
6887
6920
  const key = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
6888
- const src = _nullishCoalesce(_optionalChain([base, 'access', _336 => _336.tiles, 'access', _337 => _337.get, 'call', _338 => _338(key), 'optionalAccess', _339 => _339.data]), () => ( new Uint8ClampedArray(_chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4)));
6921
+ const src = _nullishCoalesce(_optionalChain([base, 'access', _344 => _344.tiles, 'access', _345 => _345.get, 'call', _346 => _346(key), 'optionalAccess', _347 => _347.data]), () => ( new Uint8ClampedArray(_chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4)));
6889
6922
  const tile = _chunk474IQG74cjs.finishTile.call(void 0, _chunkFQPUF2W2cjs.applyStrokeToTile.call(void 0, coverage, src, 4, tx, ty, apply), 4, 0);
6890
6923
  if (tile) tiles.set(key, tile);
6891
6924
  else tiles.delete(key);
@@ -6918,7 +6951,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6918
6951
  }
6919
6952
  /** The effect a layer is drawn from, or `undefined` for other layers. */
6920
6953
  getEffectLayer(layerId) {
6921
- return _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, layerId) ? _optionalChain([this, 'access', _340 => _340.doc, 'access', _341 => _341.effectLayers, 'optionalAccess', _342 => _342[layerId]]) : void 0;
6954
+ return _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, layerId) ? _optionalChain([this, 'access', _348 => _348.doc, 'access', _349 => _349.effectLayers, 'optionalAccess', _350 => _350[layerId]]) : void 0;
6922
6955
  }
6923
6956
  /** The effect paper (without its pixels), or `null`. */
6924
6957
  getPaperEffect() {
@@ -6955,8 +6988,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6955
6988
  /** A pixel layer that takes effect pixels: unlocked, visible, no sticker layer, no wet paint. */
6956
6989
  effectTarget(layerId, what) {
6957
6990
  const l = this.paintTarget(layerId, what);
6958
- if (_optionalChain([this, 'access', _343 => _343.doc, 'access', _344 => _344.stickers, 'optionalAccess', _345 => _345[l.id], 'optionalAccess', _346 => _346.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; ${what} another layer (add_layer).`);
6959
- if (_optionalChain([this, 'access', _347 => _347.doc, 'access', _348 => _348.liveStrokes, 'optionalAccess', _349 => _349[l.id]])) throw new PaintEditorError(`Layer "${l.name}" is a stroke layer (its pixels are drawn from its strokes); ${what} another layer (add_layer), or rasterize it first (rasterize_stroke_layer).`);
6991
+ if (_optionalChain([this, 'access', _351 => _351.doc, 'access', _352 => _352.stickers, 'optionalAccess', _353 => _353[l.id], 'optionalAccess', _354 => _354.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; ${what} another layer (add_layer).`);
6992
+ if (_optionalChain([this, 'access', _355 => _355.doc, 'access', _356 => _356.liveStrokes, 'optionalAccess', _357 => _357[l.id]])) throw new PaintEditorError(`Layer "${l.name}" is a stroke layer (its pixels are drawn from its strokes); ${what} another layer (add_layer), or rasterize it first (rasterize_stroke_layer).`);
6960
6993
  if (this.wet.wetLayerIds().includes(l.id)) throw new PaintEditorError(`Layer "${l.name}" holds wet paint; effects go on dried paint, so dry it first (dry_paint) and try again.`);
6961
6994
  return l;
6962
6995
  }
@@ -6995,8 +7028,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
6995
7028
  const was = this.doc.paperEffect;
6996
7029
  const paperEffect = {
6997
7030
  ...this.sourceOf(d, values, options.time),
6998
- opacity: _nullishCoalesce(_nullishCoalesce(options.opacity, () => ( _optionalChain([was, 'optionalAccess', _350 => _350.opacity]))), () => ( 1)),
6999
- blend: _nullishCoalesce(_nullishCoalesce(options.blend, () => ( _optionalChain([was, 'optionalAccess', _351 => _351.blend]))), () => ( "multiply")),
7031
+ opacity: _nullishCoalesce(_nullishCoalesce(options.opacity, () => ( _optionalChain([was, 'optionalAccess', _358 => _358.opacity]))), () => ( 1)),
7032
+ blend: _nullishCoalesce(_nullishCoalesce(options.blend, () => ( _optionalChain([was, 'optionalAccess', _359 => _359.blend]))), () => ( "multiply")),
7000
7033
  image: { width: pixels.width, height: pixels.height, data: new Uint8ClampedArray(pixels.data) },
7001
7034
  version: nextPaperEffectVersion()
7002
7035
  };
@@ -7049,8 +7082,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7049
7082
  const above = _nullishCoalesce(options.aboveId, () => ( this.doc.activeLayerId));
7050
7083
  const loc = above ? _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, above) : null;
7051
7084
  if (options.aboveId !== void 0 && !loc) throw new PaintEditorError(`Layer "${options.aboveId}" was removed while the effect rendered.`);
7052
- const layer = { ...createPaintLayer(_optionalChain([options, 'access', _352 => _352.name, 'optionalAccess', _353 => _353.trim, 'call', _354 => _354()]) || d.name), surface: _chunk474IQG74cjs.surfaceFromPixels.call(void 0, pixels, 4), opacity: _nullishCoalesce(options.opacity, () => ( 1)), blend: _nullishCoalesce(options.blend, () => ( "normal")) };
7053
- const layers = _chunkPVJMTLPJcjs.insertLayer.call(void 0, this.doc.layers, layer, _nullishCoalesce(_optionalChain([loc, 'optionalAccess', _355 => _355.parent, 'optionalAccess', _356 => _356.id]), () => ( null)), loc ? loc.index + 1 : void 0);
7085
+ const layer = { ...createPaintLayer(_optionalChain([options, 'access', _360 => _360.name, 'optionalAccess', _361 => _361.trim, 'call', _362 => _362()]) || d.name), surface: _chunk474IQG74cjs.surfaceFromPixels.call(void 0, pixels, 4), opacity: _nullishCoalesce(options.opacity, () => ( 1)), blend: _nullishCoalesce(options.blend, () => ( "normal")) };
7086
+ const layers = _chunkPVJMTLPJcjs.insertLayer.call(void 0, this.doc.layers, layer, _nullishCoalesce(_optionalChain([loc, 'optionalAccess', _363 => _363.parent, 'optionalAccess', _364 => _364.id]), () => ( null)), loc ? loc.index + 1 : void 0);
7054
7087
  const source = this.sourceOf(d, values, options.time);
7055
7088
  this.commit("Add effect layer", { ...this.doc, layers, activeLayerId: layer.id, effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [layer.id]: source } });
7056
7089
  return { layer: this.describeLayer(layer), source };
@@ -7203,7 +7236,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7203
7236
  /** Renders the effect paints of recorded strokes (default all of them) before a replay. */
7204
7237
  async prepareStrokeEffects(strokeIds) {
7205
7238
  const ids = strokeIds ? new Set(strokeIds) : null;
7206
- const paints2 = this.doc.strokes.filter((s) => (!ids || ids.has(s.id)) && _optionalChain([s, 'access', _357 => _357.paint, 'optionalAccess', _358 => _358.type]) === "effect").map((s) => s.paint);
7239
+ const paints2 = this.doc.strokes.filter((s) => (!ids || ids.has(s.id)) && _optionalChain([s, 'access', _365 => _365.paint, 'optionalAccess', _366 => _366.type]) === "effect").map((s) => s.paint);
7207
7240
  await this.prepareEffectPaints(paints2);
7208
7241
  }
7209
7242
  /** A small preview of the effect paint (a PNG data URL `size` px wide), or `null` without a rendered one. */
@@ -7232,7 +7265,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7232
7265
  * its pixels are not rendered.
7233
7266
  */
7234
7267
  strokeEffect(init, brush) {
7235
- if (!_chunkTZOX7KWVcjs.brushTakesPaint.call(void 0, brush)) return null;
7268
+ if (!_chunkBY5EBP26cjs.brushTakesPaint.call(void 0, brush)) return null;
7236
7269
  let source = null;
7237
7270
  if (init.paint !== void 0) {
7238
7271
  if (!isPaintEffectPaint(init.paint)) return null;
@@ -7266,14 +7299,14 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7266
7299
  const before = _chunk474IQG74cjs.readRegion.call(void 0, l.surface, rect);
7267
7300
  const inputs = { source: { width: rect.width, height: rect.height, data: before } };
7268
7301
  const heightInput = d.inputs.find((i) => i.kind === "image" && /^(height|depth|relief)$/i.test(i.name));
7269
- const relief = _optionalChain([this, 'access', _359 => _359.doc, 'access', _360 => _360.thick, 'optionalAccess', _361 => _361[l.id]]);
7302
+ const relief = _optionalChain([this, 'access', _367 => _367.doc, 'access', _368 => _368.thick, 'optionalAccess', _369 => _369[l.id]]);
7270
7303
  if (heightInput && relief) {
7271
7304
  const h = _chunk474IQG74cjs.readRegion.call(void 0, relief.height, rect);
7272
7305
  const rgba = new Uint8ClampedArray(rect.width * rect.height * 4);
7273
7306
  for (let i = 0; i < h.length; i++) rgba.set([h[i], h[i], h[i], 255], i * 4);
7274
7307
  inputs[heightInput.name] = { width: rect.width, height: rect.height, data: rgba };
7275
7308
  }
7276
- const sourceInput = _nullishCoalesce(_optionalChain([d, 'access', _362 => _362.inputs, 'access', _363 => _363.find, 'call', _364 => _364((i) => i.kind === "image" && i.name !== _optionalChain([heightInput, 'optionalAccess', _365 => _365.name])), 'optionalAccess', _366 => _366.name]), () => ( "source"));
7309
+ const sourceInput = _nullishCoalesce(_optionalChain([d, 'access', _370 => _370.inputs, 'access', _371 => _371.find, 'call', _372 => _372((i) => i.kind === "image" && i.name !== _optionalChain([heightInput, 'optionalAccess', _373 => _373.name])), 'optionalAccess', _374 => _374.name]), () => ( "source"));
7277
7310
  if (sourceInput !== "source") {
7278
7311
  inputs[sourceInput] = inputs.source;
7279
7312
  delete inputs.source;
@@ -7289,11 +7322,11 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7289
7322
  return this.brushEntries.find((e) => e.brush.id === id);
7290
7323
  }
7291
7324
  findBrush(id) {
7292
- return _optionalChain([this, 'access', _367 => _367.findEntry, 'call', _368 => _368(id), 'optionalAccess', _369 => _369.brush]);
7325
+ return _optionalChain([this, 'access', _375 => _375.findEntry, 'call', _376 => _376(id), 'optionalAccess', _377 => _377.brush]);
7293
7326
  }
7294
7327
  requireEntry(id) {
7295
7328
  const e = this.findEntry(id);
7296
- if (!e) throw new PaintEditorError(`Unknown brush "${id}". ${_chunkTZOX7KWVcjs.closest.call(void 0, id, this.brushEntries.map((x) => x.brush.id))}Call list_brush_presets for the ids.`);
7329
+ if (!e) throw new PaintEditorError(`Unknown brush "${id}". ${_chunkBY5EBP26cjs.closest.call(void 0, id, this.brushEntries.map((x) => x.brush.id))}Call list_brush_presets for the ids.`);
7297
7330
  return e;
7298
7331
  }
7299
7332
  requireBrush(id) {
@@ -7319,11 +7352,11 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7319
7352
  /** A library brush by id, as the engine paints it (`undefined` when unknown). */
7320
7353
  getBrush(id) {
7321
7354
  const b = this.findBrush(id);
7322
- return b ? _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, b, b) : void 0;
7355
+ return b ? _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, b, b) : void 0;
7323
7356
  }
7324
7357
  /** A library brush by id as stored (its facets), or without an id the active brush as edited. */
7325
7358
  getBrushSpec(id) {
7326
- const spec = id === void 0 ? this.brushSpec : _optionalChain([this, 'access', _370 => _370.findEntry, 'call', _371 => _371(id), 'optionalAccess', _372 => _372.spec]);
7359
+ const spec = id === void 0 ? this.brushSpec : _optionalChain([this, 'access', _378 => _378.findEntry, 'call', _379 => _379(id), 'optionalAccess', _380 => _380.spec]);
7327
7360
  return spec ? copyJSON(spec) : void 0;
7328
7361
  }
7329
7362
  /**
@@ -7337,7 +7370,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7337
7370
  const baseSpec = entry ? entry.spec : this.brushSpec;
7338
7371
  if (changes.paint !== void 0 && changes.paint !== null) this.readStrokePaint(changes.paint);
7339
7372
  const unchanged = !Object.keys(changes).length;
7340
- const next = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { ...changes, id: base.id }, base);
7373
+ const next = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { ...changes, id: base.id }, base);
7341
7374
  if (entry) this.takeBrushColour(entry.spec);
7342
7375
  this.useBrush(next, unchanged ? baseSpec : brushSpecOf(next, baseSpec), unchanged && base.builtin === true);
7343
7376
  return this.brush;
@@ -7355,8 +7388,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7355
7388
  const base = copyJSON(entry ? entry.spec : this.brushSpec);
7356
7389
  for (const k of unset) delete base[k];
7357
7390
  const spec = this.readBrushPatch(base, patch, problems);
7358
- if (entry || _optionalChain([patch, 'access', _373 => _373.colour, 'optionalAccess', _374 => _374.default]) !== void 0) this.takeBrushColour(spec);
7359
- this.useBrush(unchanged && entry ? entry.brush : _chunkTZOX7KWVcjs.resolveBrush.call(void 0, spec), spec, unchanged && _optionalChain([entry, 'optionalAccess', _375 => _375.builtin]) === true);
7391
+ if (entry || _optionalChain([patch, 'access', _381 => _381.colour, 'optionalAccess', _382 => _382.default]) !== void 0) this.takeBrushColour(spec);
7392
+ this.useBrush(unchanged && entry ? entry.brush : _chunkBY5EBP26cjs.resolveBrush.call(void 0, spec), spec, unchanged && _optionalChain([entry, 'optionalAccess', _383 => _383.builtin]) === true);
7360
7393
  return { brush: this.brush, spec: copyJSON(this.brushSpec), problems };
7361
7394
  }
7362
7395
  /**
@@ -7366,15 +7399,15 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7366
7399
  */
7367
7400
  setBrushSpec(spec) {
7368
7401
  const problems = [];
7369
- const paint = _optionalChain([spec, 'access', _376 => _376.colour, 'optionalAccess', _377 => _377.default]);
7402
+ const paint = _optionalChain([spec, 'access', _384 => _384.colour, 'optionalAccess', _385 => _385.default]);
7370
7403
  if (paint && typeof paint === "object" && "type" in paint && paint.type === "gradient") this.readStrokePaint(paint);
7371
7404
  let next;
7372
7405
  try {
7373
- next = _chunkTZOX7KWVcjs.normalizeBrushSpec.call(void 0, { ...spec, id: this.brush.id }, problems);
7406
+ next = _chunkBY5EBP26cjs.normalizeBrushSpec.call(void 0, { ...spec, id: this.brush.id }, problems);
7374
7407
  } catch (e) {
7375
7408
  throw new PaintEditorError(e.message);
7376
7409
  }
7377
- this.useBrush(_chunkTZOX7KWVcjs.resolveBrush.call(void 0, next), next, false);
7410
+ this.useBrush(_chunkBY5EBP26cjs.resolveBrush.call(void 0, next), next, false);
7378
7411
  return { brush: this.brush, spec: copyJSON(this.brushSpec), problems };
7379
7412
  }
7380
7413
  /**
@@ -7383,22 +7416,22 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7383
7416
  */
7384
7417
  brushChanges(patch, from) {
7385
7418
  const entry = typeof from === "string" ? this.requireEntry(from) : null;
7386
- const base = entry ? entry.brush : typeof from === "object" ? _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, from, from) : this.brush;
7387
- const spec = entry ? entry.spec : typeof from === "object" ? _chunkTZOX7KWVcjs.migrateBrushV1.call(void 0, base) : this.brushSpec;
7388
- return engineChanges(base, _chunkTZOX7KWVcjs.resolveBrush.call(void 0, this.readBrushPatch(spec, patch, [])));
7419
+ const base = entry ? entry.brush : typeof from === "object" ? _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, from, from) : this.brush;
7420
+ const spec = entry ? entry.spec : typeof from === "object" ? _chunkBY5EBP26cjs.migrateBrushV1.call(void 0, base) : this.brushSpec;
7421
+ return engineChanges(base, _chunkBY5EBP26cjs.resolveBrush.call(void 0, this.readBrushPatch(spec, patch, [])));
7389
7422
  }
7390
7423
  readBrushPatch(base, patch, problems) {
7391
7424
  const { id: _id, name, ...rest } = patch;
7392
- const paint = _optionalChain([rest, 'access', _378 => _378.colour, 'optionalAccess', _379 => _379.default]);
7425
+ const paint = _optionalChain([rest, 'access', _386 => _386.colour, 'optionalAccess', _387 => _387.default]);
7393
7426
  if (paint && typeof paint === "object" && "type" in paint && paint.type === "gradient") this.readStrokePaint(paint);
7394
7427
  try {
7395
- return _chunkTZOX7KWVcjs.normalizeBrushSpec.call(void 0, _chunkPYTJBVW5cjs.mergeBrushPatch.call(void 0, base, { ...rest, ...name !== void 0 ? { name } : {} }), problems);
7428
+ return _chunkBY5EBP26cjs.normalizeBrushSpec.call(void 0, _chunkF3KKR6DDcjs.mergeBrushPatch.call(void 0, base, { ...rest, ...name !== void 0 ? { name } : {} }), problems);
7396
7429
  } catch (e) {
7397
7430
  throw new PaintEditorError(e.message);
7398
7431
  }
7399
7432
  }
7400
7433
  useBrush(next, spec, builtin) {
7401
- next = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, next, next);
7434
+ next = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, next, next);
7402
7435
  if (builtin) next.builtin = true;
7403
7436
  else delete next.builtin;
7404
7437
  this.brush = next;
@@ -7414,9 +7447,9 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7414
7447
  * saved brush.
7415
7448
  */
7416
7449
  async saveBrush(options) {
7417
- if (!_chunkTZOX7KWVcjs.BRUSH_ID.test(options.id)) throw new PaintEditorError(`Brush id "${options.id}" is invalid; use lowercase letters, digits and dashes (e.g. "my-pencil").`);
7450
+ if (!_chunkBY5EBP26cjs.BRUSH_ID.test(options.id)) throw new PaintEditorError(`Brush id "${options.id}" is invalid; use lowercase letters, digits and dashes (e.g. "my-pencil").`);
7418
7451
  if (this.brushLibrary.isBuiltin(options.id)) throw new PaintEditorError(`"${options.id}" is a built-in brush; save under another id.`);
7419
- const spec = options.brush ? brushSpecOf(_chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, options.brush, this.brush), this.brushSpec) : this.brushSpec;
7452
+ const spec = options.brush ? brushSpecOf(_chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, options.brush, this.brush), this.brushSpec) : this.brushSpec;
7420
7453
  const { brush } = await libraryCall(() => this.brushLibrary.save({ ...spec, id: options.id, name: _nullishCoalesce(options.name, () => ( spec.name)) }, { overwrite: true }));
7421
7454
  await this.refreshBrushes();
7422
7455
  return this.requireBrush(brush.id);
@@ -7429,7 +7462,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7429
7462
  }
7430
7463
  /** The user's saved brushes, as the engine paints them. */
7431
7464
  getUserBrushes() {
7432
- return this.brushEntries.filter((e) => !e.builtin).map((e) => _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, e.brush, e.brush));
7465
+ return this.brushEntries.filter((e) => !e.builtin).map((e) => _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, e.brush, e.brush));
7433
7466
  }
7434
7467
  /** A brush library file (version 2) of the given brushes (default: the user's brushes). */
7435
7468
  exportBrushes(ids) {
@@ -7452,9 +7485,9 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7452
7485
  }
7453
7486
  // --- Colour --------------------------------------------------------------------
7454
7487
 
7455
- __init179() {this.colorLocked = false}
7488
+ __init181() {this.colorLocked = false}
7456
7489
  /** The brush default colour the paint colour came from (resolved again when the scheme changes), or `null`. */
7457
- __init180() {this.brushColour = null}
7490
+ __init182() {this.brushColour = null}
7458
7491
  /**
7459
7492
  * The host's colour scheme: a paint colour that came from a brush's light / dark default
7460
7493
  * resolves to the new side. Editor state, not an undo step.
@@ -7465,6 +7498,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7465
7498
  this.colorScheme = next;
7466
7499
  const hex2 = this.brushColour ? _chunkLRTR4ASZcjs.brushColourHex.call(void 0, this.brushColour, next) : null;
7467
7500
  if (hex2) this.color = hex2;
7501
+ const refs = brushStickerRefs(this.brush);
7502
+ if (refs.some((r) => !_chunkOTN6VB5Scjs.editorStampOf.call(void 0, r))) void this.prepareStickers(refs).catch(() => this.emit([]));
7468
7503
  this.emit([]);
7469
7504
  }
7470
7505
  /** Locks the paint colour: choosing a brush with a default colour keeps it. Editor state, not an undo step. */
@@ -7480,7 +7515,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7480
7515
  */
7481
7516
  takeBrushColour(spec) {
7482
7517
  if (this.colorLocked) return;
7483
- const d = _optionalChain([spec, 'access', _380 => _380.colour, 'optionalAccess', _381 => _381.default]);
7518
+ const d = _optionalChain([spec, 'access', _388 => _388.colour, 'optionalAccess', _389 => _389.default]);
7484
7519
  const hex2 = d !== void 0 ? _chunkLRTR4ASZcjs.brushColourHex.call(void 0, d, this.colorScheme) : null;
7485
7520
  if (!hex2) return;
7486
7521
  this.color = hex2;
@@ -7491,8 +7526,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7491
7526
  }
7492
7527
  /** A brush that always paints its own colour (`colour.own`): that colour, resolved for the scheme now; else `null`. */
7493
7528
  ownColour(brushId) {
7494
- const spec = brushId !== void 0 ? _optionalChain([this, 'access', _382 => _382.findEntry, 'call', _383 => _383(brushId), 'optionalAccess', _384 => _384.spec]) : this.brushSpec;
7495
- const d = _optionalChain([spec, 'optionalAccess', _385 => _385.colour, 'optionalAccess', _386 => _386.own]) ? spec.colour.default : void 0;
7529
+ const spec = brushId !== void 0 ? _optionalChain([this, 'access', _390 => _390.findEntry, 'call', _391 => _391(brushId), 'optionalAccess', _392 => _392.spec]) : this.brushSpec;
7530
+ const d = _optionalChain([spec, 'optionalAccess', _393 => _393.colour, 'optionalAccess', _394 => _394.own]) ? spec.colour.default : void 0;
7496
7531
  return d !== void 0 ? _chunkLRTR4ASZcjs.brushColourHex.call(void 0, d, this.colorScheme) : null;
7497
7532
  }
7498
7533
  /** Sets the paint colour (and goes back to one colour from gradient paint). */
@@ -7535,7 +7570,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7535
7570
  * brush's gradient, else the editor's gradient paint. Erasers, blenders and smudges take none.
7536
7571
  */
7537
7572
  strokeGradient(init, brush, color) {
7538
- if (!_chunkTZOX7KWVcjs.brushTakesPaint.call(void 0, brush)) return null;
7573
+ if (!_chunkBY5EBP26cjs.brushTakesPaint.call(void 0, brush)) return null;
7539
7574
  let g = null;
7540
7575
  if (init.paint !== void 0) {
7541
7576
  if (isPaintEffectPaint(init.paint)) return null;
@@ -7612,7 +7647,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7612
7647
  // --- Strokes -------------------------------------------------------------------
7613
7648
  strokeBrush(init) {
7614
7649
  let brush = init.brushId !== void 0 ? this.requireBrush(init.brushId) : this.brush;
7615
- if (init.brush) brush = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { ...init.brush, id: brush.id }, brush);
7650
+ if (init.brush) brush = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { ...init.brush, id: brush.id }, brush);
7616
7651
  return brush;
7617
7652
  }
7618
7653
  /**
@@ -7645,30 +7680,30 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7645
7680
  return l;
7646
7681
  })();
7647
7682
  const brush = this.strokeBrush(init);
7648
- if (this.previewing && _chunkTZOX7KWVcjs.isWetBrush.call(void 0, brush)) throw new PaintEditorError(`Wet paint can't be previewed; the ${brush.name} brush paints wet media. Suggest it with a dry brush.`);
7683
+ if (this.previewing && _chunkBY5EBP26cjs.isWetBrush.call(void 0, brush)) throw new PaintEditorError(`Wet paint can't be previewed; the ${brush.name} brush paints wet media. Suggest it with a dry brush.`);
7649
7684
  const effect = this.strokeEffect(init, brush);
7650
7685
  if (brush.light.amount > 0) {
7651
7686
  if (brush.engine === "sticker") throw new PaintEditorError(`The ${brush.name} brush sprays stickers, which don't take light yet; paint light with a dab or particle light brush (glow-gel, neon-marker; list_brush_presets lists them), or set light.amount to 0 (set_brush).`);
7652
7687
  }
7653
- if (_optionalChain([doc, 'access', _387 => _387.liveStrokes, 'optionalAccess', _388 => _388[layer.id]])) {
7688
+ if (_optionalChain([doc, 'access', _395 => _395.liveStrokes, 'optionalAccess', _396 => _396[layer.id]])) {
7654
7689
  const why = liveStrokeRefusal(brush);
7655
7690
  if (why) throw new PaintEditorError(`Layer "${layer.name}" is a stroke layer. ${why}`);
7656
7691
  }
7657
- if (_optionalChain([doc, 'access', _389 => _389.liveStrokes, 'optionalAccess', _390 => _390[layer.id]]) && _optionalChain([effect, 'optionalAccess', _391 => _391.source, 'access', _392 => _392.live])) {
7692
+ if (_optionalChain([doc, 'access', _397 => _397.liveStrokes, 'optionalAccess', _398 => _398[layer.id]]) && _optionalChain([effect, 'optionalAccess', _399 => _399.source, 'access', _400 => _400.live])) {
7658
7693
  const key = effectPaintKey(effect.source);
7659
7694
  const { sources } = this.liveEffects(doc);
7660
7695
  if (!sources.some((p) => effectPaintKey(p) === key) && sources.length >= MAX_LIVE_EFFECT_SOURCES) {
7661
7696
  throw new PaintEditorError(`The painting already plays ${MAX_LIVE_EFFECT_SOURCES} live effects, the most it can; paint with one of them, or set_effect_paint with live false to bake this one.`);
7662
7697
  }
7663
7698
  }
7664
- const stickerLayer = Boolean(_optionalChain([doc, 'access', _393 => _393.stickers, 'optionalAccess', _394 => _394[layer.id], 'optionalAccess', _395 => _395.length]));
7699
+ const stickerLayer = Boolean(_optionalChain([doc, 'access', _401 => _401.stickers, 'optionalAccess', _402 => _402[layer.id], 'optionalAccess', _403 => _403.length]));
7665
7700
  if (brush.engine === "sticker") {
7666
7701
  if (!stickerLayer && _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface)) throw new PaintEditorError(`Layer "${layer.name}" already has paint; spray stickers onto an empty layer (add_layer) so they stay editable.`);
7667
7702
  } else if (stickerLayer) {
7668
7703
  throw new PaintEditorError(`Layer "${layer.name}" is a sticker layer (its pixels are drawn from its stickers); paint on another layer (add_layer).`);
7669
7704
  }
7670
7705
  let wet;
7671
- if (_chunkTZOX7KWVcjs.isWetBrush.call(void 0, brush)) {
7706
+ if (_chunkBY5EBP26cjs.isWetBrush.call(void 0, brush)) {
7672
7707
  this.requireWetIdle("painting");
7673
7708
  if (layer.offset.x || layer.offset.y) {
7674
7709
  const moved = { ...layer, surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, layer.offset.x, layer.offset.y), offset: { x: 0, y: 0 } };
@@ -7701,7 +7736,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7701
7736
  copies: [IDENTITY_AFFINE, ...copiesW].map(affineCopy),
7702
7737
  mask: init.maskStencils ? this.stencilSelection(init.maskStencils) : init.stencils !== false ? this.stencilSelection() : null,
7703
7738
  paint: effect ? null : wetGradient,
7704
- effect: _nullishCoalesce(_optionalChain([effect, 'optionalAccess', _396 => _396.pixels]), () => ( null))
7739
+ effect: _nullishCoalesce(_optionalChain([effect, 'optionalAccess', _404 => _404.pixels]), () => ( null))
7705
7740
  });
7706
7741
  init = { ...init, seed: seedW, load };
7707
7742
  wet = { driver, surface: () => world.display(id).surface };
@@ -7712,7 +7747,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7712
7747
  }
7713
7748
  let color = init.color === void 0 ? _nullishCoalesce(this.ownColour(init.brushId), () => ( this.color)) : parseColor(init.color);
7714
7749
  const tracing = this.guides.tracing;
7715
- if (init.color === void 0 && init.start && _optionalChain([tracing, 'optionalAccess', _397 => _397.visible]) && tracing.sampleColors) color = _nullishCoalesce(this.sampleTracingColor(init.start.x, init.start.y), () => ( color));
7750
+ if (init.color === void 0 && init.start && _optionalChain([tracing, 'optionalAccess', _405 => _405.visible]) && tracing.sampleColors) color = _nullishCoalesce(this.sampleTracingColor(init.start.x, init.start.y), () => ( color));
7716
7751
  const perspective = this.guides.perspective;
7717
7752
  const snapper = init.snapToPerspective && perspective.enabled && perspective.snap ? new PerspectiveSnapper(perspective) : null;
7718
7753
  const useStencils = init.stencils !== false;
@@ -7745,10 +7780,10 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7745
7780
  mixerLoad: _nullishCoalesce(init.load, () => ( brushLoadForStroke(brush, this.mixerLoad, [rgba[0] / 255, rgba[1] / 255, rgba[2] / 255]))),
7746
7781
  secondary: rgbaOf(this.secondaryColor),
7747
7782
  wet,
7748
- thick: brush.engine === "impasto" ? { channels: _nullishCoalesce(_optionalChain([doc, 'access', _398 => _398.thick, 'optionalAccess', _399 => _399[layer.id]]), () => ( emptyThickChannels())) } : void 0,
7783
+ thick: brush.engine === "impasto" ? { channels: _nullishCoalesce(_optionalChain([doc, 'access', _406 => _406.thick, 'optionalAccess', _407 => _407[layer.id]]), () => ( emptyThickChannels())) } : void 0,
7749
7784
  // Light paint: a twin of the stroke paints the light channel (laying, dimming, moving light).
7750
- light: !wet && brush.engine !== "sticker" && (brush.light.amount > 0 || _optionalChain([doc, 'access', _400 => _400.light, 'optionalAccess', _401 => _401[layer.id]])) ? { surface: _nullishCoalesce(_optionalChain([doc, 'access', _402 => _402.light, 'optionalAccess', _403 => _403[layer.id]]), () => ( emptyLight())) } : null,
7751
- sticker: brush.engine === "sticker" ? { nextId: this.nextStickerNumber(doc), art: this.stickerArt.get } : void 0,
7785
+ light: !wet && brush.engine !== "sticker" && (brush.light.amount > 0 || _optionalChain([doc, 'access', _408 => _408.light, 'optionalAccess', _409 => _409[layer.id]])) ? { surface: _nullishCoalesce(_optionalChain([doc, 'access', _410 => _410.light, 'optionalAccess', _411 => _411[layer.id]]), () => ( emptyLight())) } : null,
7786
+ sticker: brush.engine === "sticker" ? { nextId: this.nextStickerNumber(doc), art: this.stickerArt.get, variant: (ref2) => this.stickerArt.variantFor(ref2, this.colorScheme === "dark") } : void 0,
7752
7787
  stampArt: this.stickerArt.get,
7753
7788
  paint: effect ? null : this.strokeGradient(init, brush, color),
7754
7789
  effect
@@ -7762,7 +7797,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7762
7797
  const stroke = {
7763
7798
  id: `s${this.strokeCounter++}`,
7764
7799
  layerId: session.layerId,
7765
- brush: _chunkTZOX7KWVcjs.brushToJSON.call(void 0, init.brush),
7800
+ brush: _chunkBY5EBP26cjs.brushToJSON.call(void 0, init.brush),
7766
7801
  color: init.colorHex,
7767
7802
  points: session.points.map((p) => ({ ...p })),
7768
7803
  seed: init.seed
@@ -7787,12 +7822,12 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7787
7822
  const before = this.doc;
7788
7823
  const host = {
7789
7824
  update: (layerId, surface, rects) => {
7790
- if (_optionalChain([this, 'access', _404 => _404.session, 'optionalAccess', _405 => _405.init, 'access', _406 => _406.wet])) {
7825
+ if (_optionalChain([this, 'access', _412 => _412.session, 'optionalAccess', _413 => _413.init, 'access', _414 => _414.wet])) {
7791
7826
  this.wet.syncDisplays();
7792
7827
  return;
7793
7828
  }
7794
7829
  this.live = { layerId, surface };
7795
- const ch = _optionalChain([this, 'access', _407 => _407.session, 'optionalAccess', _408 => _408.thickChannels, 'call', _409 => _409()]);
7830
+ const ch = _optionalChain([this, 'access', _415 => _415.session, 'optionalAccess', _416 => _416.thickChannels, 'call', _417 => _417()]);
7796
7831
  this.liveThick = ch ? { layerId, channels: ch } : null;
7797
7832
  this.emit(rects);
7798
7833
  },
@@ -7805,7 +7840,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7805
7840
  const wetStroke = Boolean(s.init.wet);
7806
7841
  if (wetStroke) this.wet.driver = null;
7807
7842
  const brush = s.init.brush;
7808
- if (!cancelled && _optionalChain([s, 'access', _410 => _410.result, 'optionalAccess', _411 => _411.mixerLoad])) this.keepLoad(brush, s.result.mixerLoad);
7843
+ if (!cancelled && _optionalChain([s, 'access', _418 => _418.result, 'optionalAccess', _419 => _419.mixerLoad])) this.keepLoad(brush, s.result.mixerLoad);
7809
7844
  if (cancelled || !surface) {
7810
7845
  if (this.wetOp) {
7811
7846
  const snap = this.wetOp.before;
@@ -7821,7 +7856,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7821
7856
  }
7822
7857
  const stroke = this.record(s);
7823
7858
  s.result.strokeId = stroke.id;
7824
- this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _412 => _412.result, 'optionalAccess', _413 => _413.bounds]), () => ( null)));
7859
+ this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _420 => _420.result, 'optionalAccess', _421 => _421.bounds]), () => ( null)));
7825
7860
  if (wetStroke && this.wet.instantDry) {
7826
7861
  this.wet.dry(s.layerId);
7827
7862
  this.logWet({ kind: "dry", layerId: s.layerId, at: this.doc.strokes.length + 1 });
@@ -7832,8 +7867,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7832
7867
  const ch = s.thickChannels();
7833
7868
  const thick = ch ? { ..._nullishCoalesce(this.doc.thick, () => ( {})), [l.id]: ch } : this.doc.thick;
7834
7869
  const sprayed = s.stickers();
7835
- const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _414 => _414.doc, 'access', _415 => _415.stickers, 'optionalAccess', _416 => _416[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
7836
- const wetLight = wetStroke && _optionalChain([this, 'access', _417 => _417.wet, 'access', _418 => _418.world, 'optionalAccess', _419 => _419.hasLane, 'call', _420 => _420(l.id)]) ? this.wet.world.lightDisplay(l.id) : null;
7870
+ const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _422 => _422.doc, 'access', _423 => _423.stickers, 'optionalAccess', _424 => _424[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
7871
+ const wetLight = wetStroke && _optionalChain([this, 'access', _425 => _425.wet, 'access', _426 => _426.world, 'optionalAccess', _427 => _427.hasLane, 'call', _428 => _428(l.id)]) ? this.wet.world.lightDisplay(l.id) : null;
7837
7872
  const light = withLayerLight(this.doc.light, l.id, _nullishCoalesce(s.lightChannel(), () => ( wetLight)));
7838
7873
  this.commit(`${brush.name} stroke`, this.withWetEvents(withLiveStroke({ ...this.doc, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke], ...thick ? { thick } : {}, ...stickers ? { stickers } : {}, ...light ? { light } : {} }, stroke)), wetStroke ? before : this.doc);
7839
7874
  this.notifySample("end", s, [], stroke.id);
@@ -7865,18 +7900,18 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7865
7900
  if (cancelled || !surface) return;
7866
7901
  const stroke = this.record(s);
7867
7902
  s.result.strokeId = stroke.id;
7868
- this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _421 => _421.result, 'optionalAccess', _422 => _422.bounds]), () => ( null)));
7903
+ this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _429 => _429.result, 'optionalAccess', _430 => _430.bounds]), () => ( null)));
7869
7904
  const l = _chunkPVJMTLPJcjs.findLayer.call(void 0, out.layers, s.layerId).layer;
7870
7905
  const offset = s.init.wet ? { x: 0, y: 0 } : l.offset;
7871
7906
  const ch = s.thickChannels();
7872
7907
  const sprayed = s.stickers();
7873
- const lit = _nullishCoalesce(s.lightChannel(), () => ( (s.init.wet && _optionalChain([this, 'access', _423 => _423.wet, 'access', _424 => _424.world, 'optionalAccess', _425 => _425.hasLane, 'call', _426 => _426(l.id)]) ? this.wet.world.lightDisplay(l.id) : null)));
7908
+ const lit = _nullishCoalesce(s.lightChannel(), () => ( (s.init.wet && _optionalChain([this, 'access', _431 => _431.wet, 'access', _432 => _432.world, 'optionalAccess', _433 => _433.hasLane, 'call', _434 => _434(l.id)]) ? this.wet.world.lightDisplay(l.id) : null)));
7874
7909
  out = withLiveStroke({
7875
7910
  ...out,
7876
7911
  layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface, offset })),
7877
7912
  strokes: [...out.strokes, stroke],
7878
7913
  ...ch ? { thick: { ..._nullishCoalesce(out.thick, () => ( {})), [l.id]: ch } } : {},
7879
- ...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _427 => _427.stickers, 'optionalAccess', _428 => _428[l.id]]), () => ( [])), ...sprayed] } } : {},
7914
+ ...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _435 => _435.stickers, 'optionalAccess', _436 => _436[l.id]]), () => ( [])), ...sprayed] } } : {},
7880
7915
  ...lit ? { light: withLayerLight(out.light, l.id, lit) } : {}
7881
7916
  }, stroke);
7882
7917
  }
@@ -7949,11 +7984,11 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7949
7984
  throw e;
7950
7985
  }
7951
7986
  const run = last;
7952
- if (_optionalChain([run, 'optionalAccess', _429 => _429.result, 'access', _430 => _430.mixerLoad])) this.keepLoad(run.brush, run.result.mixerLoad);
7953
- if (doc !== before || this.wetOp) this.commit(`${_nullishCoalesce(_optionalChain([run, 'optionalAccess', _431 => _431.brush, 'access', _432 => _432.name]), () => ( "Brush"))} path stroke`, this.withWetEvents(doc), before);
7987
+ if (_optionalChain([run, 'optionalAccess', _437 => _437.result, 'access', _438 => _438.mixerLoad])) this.keepLoad(run.brush, run.result.mixerLoad);
7988
+ if (doc !== before || this.wetOp) this.commit(`${_nullishCoalesce(_optionalChain([run, 'optionalAccess', _439 => _439.brush, 'access', _440 => _440.name]), () => ( "Brush"))} path stroke`, this.withWetEvents(doc), before);
7954
7989
  else this.emit([]);
7955
- const layerId = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([run, 'optionalAccess', _433 => _433.result, 'access', _434 => _434.layerId]), () => ( stroke.layerId)), () => ( this.doc.activeLayerId)), () => ( ""));
7956
- return { layerId, bounds, dabs, strokeIds, ..._optionalChain([run, 'optionalAccess', _435 => _435.result, 'access', _436 => _436.mixerLoad]) ? { mixerLoad: run.result.mixerLoad } : {}, ..._optionalChain([run, 'optionalAccess', _437 => _437.result, 'access', _438 => _438.wet]) !== void 0 ? { wet: run.result.wet } : {} };
7990
+ const layerId = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([run, 'optionalAccess', _441 => _441.result, 'access', _442 => _442.layerId]), () => ( stroke.layerId)), () => ( this.doc.activeLayerId)), () => ( ""));
7991
+ return { layerId, bounds, dabs, strokeIds, ..._optionalChain([run, 'optionalAccess', _443 => _443.result, 'access', _444 => _444.mixerLoad]) ? { mixerLoad: run.result.mixerLoad } : {}, ..._optionalChain([run, 'optionalAccess', _445 => _445.result, 'access', _446 => _446.wet]) !== void 0 ? { wet: run.result.wet } : {} };
7957
7992
  }
7958
7993
  /** Checks stroke samples (finite x and y, pressure 0..1) and returns them; throws a sentence naming the bad point. */
7959
7994
  checkPoints(points) {
@@ -7976,7 +8011,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7976
8011
  */
7977
8012
  replayStrokes(options) {
7978
8013
  this.requireIdle("replaying");
7979
- if (!_optionalChain([options, 'access', _439 => _439.strokeIds, 'optionalAccess', _440 => _440.length])) throw new PaintEditorError("strokeIds is empty; pass ids from list_strokes.");
8014
+ if (!_optionalChain([options, 'access', _447 => _447.strokeIds, 'optionalAccess', _448 => _448.length])) throw new PaintEditorError("strokeIds is empty; pass ids from list_strokes.");
7980
8015
  const strokes = options.strokeIds.map((id) => {
7981
8016
  const s = this.doc.strokes.find((x) => x.id === id);
7982
8017
  if (!s) throw new PaintEditorError(`Unknown stroke "${id}". Call list_strokes for the ids.`);
@@ -7990,7 +8025,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
7990
8025
  if (options.layerId !== void 0) this.paintTarget(options.layerId, "replay onto");
7991
8026
  if (options.color === void 0) {
7992
8027
  for (const s of strokes) {
7993
- if (_optionalChain([s, 'access', _441 => _441.paint, 'optionalAccess', _442 => _442.type]) === "effect" && !this.effectPaintImage(s.paint)) {
8028
+ if (_optionalChain([s, 'access', _449 => _449.paint, 'optionalAccess', _450 => _450.type]) === "effect" && !this.effectPaintImage(s.paint)) {
7994
8029
  throw new PaintEditorError(`Stroke "${s.id}" paints with the effect "${s.paint.effect}"${s.paint.provider ? ` from provider "${s.paint.provider}"` : ""}, which is not rendered in this editor; render it first (prepareStrokeEffects; the replay_strokes tool does this) or recolour the replay with color.`);
7995
8030
  }
7996
8031
  }
@@ -8013,7 +8048,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8013
8048
  let brush = v.brush;
8014
8049
  if (options.brushId !== void 0) {
8015
8050
  const b = this.requireBrush(options.brushId);
8016
- brush = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
8051
+ brush = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
8017
8052
  }
8018
8053
  const layerId = _nullishCoalesce(options.layerId, () => ( s.layerId));
8019
8054
  if (!_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, layerId)) throw new PaintEditorError(`Stroke "${s.id}" was painted on layer "${layerId}", which no longer exists; pass layerId to replay it elsewhere.`);
@@ -8048,7 +8083,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8048
8083
  /** A layer's light paint: whether it has any, where (document pixels), its brightest value 0..255, and its spill. */
8049
8084
  lightOf(layerId) {
8050
8085
  const l = this.wetLayer(layerId, "read the light of");
8051
- const info = lightInfo(_optionalChain([this, 'access', _443 => _443.doc, 'access', _444 => _444.light, 'optionalAccess', _445 => _445[l.id]]));
8086
+ const info = lightInfo(_optionalChain([this, 'access', _451 => _451.doc, 'access', _452 => _452.light, 'optionalAccess', _453 => _453[l.id]]));
8052
8087
  const bounds = info.bounds ? { ...info.bounds, x: info.bounds.x + l.offset.x, y: info.bounds.y + l.offset.y } : null;
8053
8088
  return { layerId: l.id, hasLight: info.peak > 0, bounds, peak: info.peak, spill: { ...this.lightSpillOf(l.id) } };
8054
8089
  }
@@ -8099,7 +8134,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8099
8134
  const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
8100
8135
  if (!id) return null;
8101
8136
  this.requireLayer(id);
8102
- const ch = _optionalChain([this, 'access', _446 => _446.doc, 'access', _447 => _447.thick, 'optionalAccess', _448 => _448[id]]);
8137
+ const ch = _optionalChain([this, 'access', _454 => _454.doc, 'access', _455 => _455.thick, 'optionalAccess', _456 => _456[id]]);
8103
8138
  if (!ch) return null;
8104
8139
  const r = reliefInfo(ch);
8105
8140
  return { layerId: id, bounds: r.bounds, maxHeight: r.maxHeight };
@@ -8209,7 +8244,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8209
8244
  wetState() {
8210
8245
  const st = this.getState().wet;
8211
8246
  const backend = this.wet.backend();
8212
- return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess', _449 => _449.message]), () => ( _chunkYHDHFJUCcjs.wetSupport.call(void 0, ).message)), engine: this.wet.engineInfo() };
8247
+ return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess', _457 => _457.message]), () => ( _chunkYHDHFJUCcjs.wetSupport.call(void 0, ).message)), engine: this.wet.engineInfo() };
8213
8248
  }
8214
8249
  /**
8215
8250
  * Engine B, the WebGPU accelerator for large wet areas: whether it may run, its state (`off`,
@@ -8294,7 +8329,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8294
8329
  }
8295
8330
  /** Records a settings change as a wet event (not an undo step). */
8296
8331
  recordWetSetting(e) {
8297
- this.doc = { ...this.doc, wetEvents: [..._nullishCoalesce(this.doc.wetEvents, () => ( [])), { clock: _nullishCoalesce(_optionalChain([this, 'access', _450 => _450.wet, 'access', _451 => _451.world, 'optionalAccess', _452 => _452.clock]), () => ( 0)), at: this.doc.strokes.length, ...e }] };
8332
+ this.doc = { ...this.doc, wetEvents: [..._nullishCoalesce(this.doc.wetEvents, () => ( [])), { clock: _nullishCoalesce(_optionalChain([this, 'access', _458 => _458.wet, 'access', _459 => _459.world, 'optionalAccess', _460 => _460.clock]), () => ( 0)), at: this.doc.strokes.length, ...e }] };
8298
8333
  }
8299
8334
  /** Changes a layer's wet settings (viscosity, evaporation, granulation…). Editor settings saved with the document, not an undo step. */
8300
8335
  setWetParams(layerId, update) {
@@ -8363,7 +8398,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8363
8398
  if (override) return Array.from(override).reduce((ls, [id, surface]) => _chunkPVJMTLPJcjs.mapLayer.call(void 0, ls, id, (l) => ({ ...l, surface })), this.doc.layers);
8364
8399
  const live = this.live;
8365
8400
  if (!live) return this.animatedView();
8366
- if (_optionalChain([this, 'access', _453 => _453.liveLayers, 'optionalAccess', _454 => _454.key]) === live.surface) return this.liveLayers.layers;
8401
+ if (_optionalChain([this, 'access', _461 => _461.liveLayers, 'optionalAccess', _462 => _462.key]) === live.surface) return this.liveLayers.layers;
8367
8402
  const layers = _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
8368
8403
  this.liveLayers = { key: live.surface, layers };
8369
8404
  return layers;
@@ -8386,7 +8421,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8386
8421
  tracingNode(t) {
8387
8422
  const { width, height } = this.doc.canvas;
8388
8423
  const key = this.tracingVersion * 100003 + width * 7 + height;
8389
- if (_optionalChain([this, 'access', _455 => _455.tracingCache, 'optionalAccess', _456 => _456.key]) === key && this.tracingCache.node.opacity === t.opacity) return this.tracingCache.node;
8424
+ if (_optionalChain([this, 'access', _463 => _463.tracingCache, 'optionalAccess', _464 => _464.key]) === key && this.tracingCache.node.opacity === t.opacity) return this.tracingCache.node;
8390
8425
  const src = _nullishCoalesce(this.imagePixels.get(t.src), () => ( this.decodeImage(t.src)));
8391
8426
  const image = resampleInto(src, t.rect, width, height);
8392
8427
  const node = { type: "image", id: TRACING_NODE_ID, name: "Tracing", visible: true, opacity: t.opacity, blend: "normal", image, version: key + Math.round(t.opacity * 1e3) / 1e4 };
@@ -8413,8 +8448,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8413
8448
  let out = layers;
8414
8449
  const ids = /* @__PURE__ */ new Set([...Object.keys(_nullishCoalesce(thick, () => ( {}))), ...live ? [live.layerId] : []]);
8415
8450
  for (const id of ids) {
8416
- const ch = _optionalChain([live, 'optionalAccess', _457 => _457.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _458 => _458[id]]);
8417
- const l = ch && _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, out, id), 'optionalAccess', _459 => _459.layer]);
8451
+ const ch = _optionalChain([live, 'optionalAccess', _465 => _465.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _466 => _466[id]]);
8452
+ const l = ch && _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, out, id), 'optionalAccess', _467 => _467.layer]);
8418
8453
  if (!ch || !isPixelLayer(l)) continue;
8419
8454
  let cache = this.litCaches.get(id);
8420
8455
  if (!cache) this.litCaches.set(id, cache = new LitCache());
@@ -8434,13 +8469,13 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8434
8469
  if (!ids.size) return layers;
8435
8470
  let out = layers;
8436
8471
  for (const id of ids) {
8437
- const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, out, id), 'optionalAccess', _460 => _460.layer]);
8472
+ const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, out, id), 'optionalAccess', _468 => _468.layer]);
8438
8473
  if (!isPixelLayer(l)) continue;
8439
8474
  let cache = this.lightCaches.get(id);
8440
8475
  if (!cache) this.lightCaches.set(id, cache = new LightCache());
8441
- const glowed = cache.glow(l.surface, light[id], _optionalChain([this, 'access', _461 => _461.liveThick, 'optionalAccess', _462 => _462.layerId]) === id ? this.liveThick.channels : _optionalChain([this, 'access', _463 => _463.doc, 'access', _464 => _464.thick, 'optionalAccess', _465 => _465[id]]));
8476
+ const glowed = cache.glow(l.surface, light[id], _optionalChain([this, 'access', _469 => _469.liveThick, 'optionalAccess', _470 => _470.layerId]) === id ? this.liveThick.channels : _optionalChain([this, 'access', _471 => _471.doc, 'access', _472 => _472.thick, 'optionalAccess', _473 => _473[id]]));
8442
8477
  if (glowed !== l.surface) out = _chunkPVJMTLPJcjs.mapLayer.call(void 0, out, id, () => ({ ...l, surface: glowed }));
8443
- const committed = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _466 => _466.layer]);
8478
+ const committed = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _474 => _474.layer]);
8444
8479
  const spill = light[id] && isPixelLayer(committed) ? cache.spill(committed.surface, light[id], this.lightSpillOf(id)) : null;
8445
8480
  if (spill) out = insertAfter(out, id, { type: "pixel", id: `${id}${SPILL_SUFFIX}`, name: `${l.name} light`, visible: l.visible, opacity: l.opacity, blend: "linear-dodge", surface: spill, offset: { ...l.offset } });
8446
8481
  }
@@ -8452,7 +8487,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8452
8487
  if (!l.visible) continue;
8453
8488
  if (l.type === "group") this.backlitLayers(l.children, committed, opacity * l.opacity, out);
8454
8489
  else if (isPixelLayer(l)) {
8455
- const thick = !committed && _optionalChain([this, 'access', _467 => _467.liveThick, 'optionalAccess', _468 => _468.layerId]) === l.id ? this.liveThick.channels : _optionalChain([this, 'access', _469 => _469.doc, 'access', _470 => _470.thick, 'optionalAccess', _471 => _471[l.id]]);
8490
+ const thick = !committed && _optionalChain([this, 'access', _475 => _475.liveThick, 'optionalAccess', _476 => _476.layerId]) === l.id ? this.liveThick.channels : _optionalChain([this, 'access', _477 => _477.doc, 'access', _478 => _478.thick, 'optionalAccess', _479 => _479[l.id]]);
8456
8491
  out.push({ surface: l.surface, offset: l.offset, opacity: opacity * l.opacity, ...thick ? { thick } : {} });
8457
8492
  }
8458
8493
  }
@@ -8481,7 +8516,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8481
8516
  if (backlight) layers = [...layers, backlight];
8482
8517
  if (options.layerIds) {
8483
8518
  const picked = [];
8484
- for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _472 => _472.layer]), () => ( this.requireLayer(id))));
8519
+ for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _480 => _480.layer]), () => ( this.requireLayer(id))));
8485
8520
  layers = picked.map((l) => ({ ...l, visible: true }));
8486
8521
  }
8487
8522
  const under = options.paper === false ? [] : [paperNode(this.doc.paper, this.lighting)];
@@ -8497,7 +8532,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8497
8532
  */
8498
8533
  compositeTiles(rect, onTile, options = {}) {
8499
8534
  const dirty = options.dirty === "all" ? void 0 : options.dirty;
8500
- this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access', _473 => _473.live, 'optionalAccess', _474 => _474.layerId]), () => ( this.doc.activeLayerId)) });
8535
+ this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access', _481 => _481.live, 'optionalAccess', _482 => _482.layerId]), () => ( this.doc.activeLayerId)) });
8501
8536
  }
8502
8537
  /** The canvas as canvas-sized RGBA (paper included by default). */
8503
8538
  compositePixels(options = {}) {
@@ -8576,7 +8611,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8576
8611
  const spills = Object.fromEntries(Object.entries(this.lightSpills).filter(([id]) => _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id)));
8577
8612
  if (Object.keys(spills).length) ext.lightSpill = spills;
8578
8613
  else delete ext.lightSpill;
8579
- const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _475 => _475.layer])));
8614
+ const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _483 => _483.layer])));
8580
8615
  if (effectLayers) ext.effectLayers = effectLayers;
8581
8616
  else delete ext.effectLayers;
8582
8617
  if (this.doc.paperEffect) ext.paperEffect = paperEffectToJSON(this.doc.paperEffect);
@@ -8596,10 +8631,10 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8596
8631
  const ok = list.flatMap((x) => {
8597
8632
  if (!x || typeof x.id !== "string" || !Number.isFinite(x.x) || !Number.isFinite(x.y) || !(x.size > 0)) return [];
8598
8633
  try {
8599
- const ref2 = _chunkJSDND7DFcjs.normalizeStickerRef.call(void 0, _nullishCoalesce(x.ref, () => ( x.stamp)));
8600
- const stamp = _chunkJSDND7DFcjs.editorStampOf.call(void 0, ref2);
8601
- const { stamp: _old, ...rest } = x;
8602
- return [{ ...rest, ref: ref2, ...stamp ? { stamp } : {} }];
8634
+ const ref2 = _chunkOTN6VB5Scjs.normalizeStickerRef.call(void 0, _nullishCoalesce(x.ref, () => ( x.stamp)));
8635
+ const stamp = _chunkOTN6VB5Scjs.editorStampOf.call(void 0, ref2);
8636
+ const { stamp: _old, variant, ...rest } = x;
8637
+ return [{ ...rest, ref: ref2, ...stamp ? { stamp } : {}, ...variant === "dark" && !stamp ? { variant } : {} }];
8603
8638
  } catch (e9) {
8604
8639
  return [];
8605
8640
  }
@@ -8612,7 +8647,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8612
8647
  if (ext.liveStrokes && typeof ext.liveStrokes === "object") {
8613
8648
  const liveStrokes = {};
8614
8649
  for (const [id, list] of Object.entries(ext.liveStrokes)) {
8615
- if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _476 => _476.layer])) || !Array.isArray(list)) continue;
8650
+ if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _484 => _484.layer])) || !Array.isArray(list)) continue;
8616
8651
  const ok = list.map(normalizeBrushStroke).filter((x) => x !== null).map((x) => ({ ...x, layerId: id }));
8617
8652
  if (ok.length !== list.length) problems.push(`Some strokes of stroke layer "${id}" could not be read; they were dropped (the layer's pixels are kept until a stroke is edited).`);
8618
8653
  liveStrokes[id] = ok;
@@ -8622,7 +8657,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8622
8657
  if (ext.effectLayers && typeof ext.effectLayers === "object") {
8623
8658
  const effectLayers = {};
8624
8659
  for (const [id, v] of Object.entries(ext.effectLayers)) {
8625
- if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _477 => _477.layer]))) continue;
8660
+ if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _485 => _485.layer]))) continue;
8626
8661
  const source = readPaintEffectSource(v);
8627
8662
  if (source) effectLayers[id] = source;
8628
8663
  else problems.push(`The effect of layer "${id}" could not be read; it loads as a plain layer.`);
@@ -8650,7 +8685,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8650
8685
  if (ext.light && typeof ext.light === "object") {
8651
8686
  const light = {};
8652
8687
  for (const [id, v] of Object.entries(ext.light)) {
8653
- if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _478 => _478.layer]))) continue;
8688
+ if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _486 => _486.layer]))) continue;
8654
8689
  try {
8655
8690
  light[id] = lightFromJSON(v);
8656
8691
  } catch (e) {
@@ -8686,7 +8721,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8686
8721
  this.readGuides(loaded.guides, loaded.state, loaded.problems);
8687
8722
  if (Array.isArray(loaded.swatches)) this.swatches = loaded.swatches.map(readSwatch).filter((x) => x !== null);
8688
8723
  for (const s of loaded.state.strokes) {
8689
- const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _479 => _479.exec, 'call', _480 => _480(s.id), 'optionalAccess', _481 => _481[1]]), () => ( 0)));
8724
+ const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _487 => _487.exec, 'call', _488 => _488(s.id), 'optionalAccess', _489 => _489[1]]), () => ( 0)));
8690
8725
  if (n >= this.strokeCounter) this.strokeCounter = n + 1;
8691
8726
  }
8692
8727
  this.undoStack = [];
@@ -8694,7 +8729,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8694
8729
  this.doc = this.readThick(loaded.state, loaded.extensions, loaded.problems);
8695
8730
  for (const list of Object.values(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) {
8696
8731
  for (const s of list) {
8697
- const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _482 => _482.exec, 'call', _483 => _483(s.id), 'optionalAccess', _484 => _484[1]]), () => ( 0)));
8732
+ const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _490 => _490.exec, 'call', _491 => _491(s.id), 'optionalAccess', _492 => _492[1]]), () => ( 0)));
8698
8733
  if (n >= this.strokeCounter) this.strokeCounter = n + 1;
8699
8734
  }
8700
8735
  }
@@ -8710,7 +8745,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8710
8745
  this.viewCompositor.clear();
8711
8746
  this.emit();
8712
8747
  const refs = Object.values(_nullishCoalesce(this.doc.stickers, () => ( {}))).flatMap((list) => list.map((x) => x.ref));
8713
- if (refs.some((r) => !_chunkJSDND7DFcjs.editorStampOf.call(void 0, r))) void this.prepareStickers(refs).catch(() => this.emit([]));
8748
+ if (refs.some((r) => !_chunkOTN6VB5Scjs.editorStampOf.call(void 0, r))) void this.prepareStickers(refs).catch(() => this.emit([]));
8714
8749
  return loaded.problems;
8715
8750
  }
8716
8751
  /** Opens a saved document (clears the history). Returns what could not be read. */
@@ -8791,10 +8826,10 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8791
8826
  return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
8792
8827
  });
8793
8828
  const layers = toStandard(dried);
8794
- const result = _chunk43NT242Dcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
8829
+ const result = _chunkKXNZNOEFcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
8795
8830
  for (const [mode, names] of changed) {
8796
- const label = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _485 => _485.find, 'call', _486 => _486((m) => m.id === mode), 'optionalAccess', _487 => _487.label]), () => ( mode));
8797
- const std = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _488 => _488.find, 'call', _489 => _489((m) => m.id === _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _490 => _490.label]), () => ( _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)));
8831
+ const label = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _493 => _493.find, 'call', _494 => _494((m) => m.id === mode), 'optionalAccess', _495 => _495.label]), () => ( mode));
8832
+ const std = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _496 => _496.find, 'call', _497 => _497((m) => m.id === _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _498 => _498.label]), () => ( _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)));
8798
8833
  const list = names.map((n) => `"${n}"`).join(", ");
8799
8834
  const one = names.length === 1;
8800
8835
  result.warnings.push(`${label} blending has no PSD equivalent; ${list} ${one ? "was" : "were"} written as ${std}, the nearest Photoshop mode, so ${one ? "it looks" : "they look"} different in Photoshop (the merged image is exact).`);
@@ -8916,7 +8951,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8916
8951
  const { src, pixels } = this.importImage(options, "The reference image");
8917
8952
  const ref2 = {
8918
8953
  id: `ref${this.nextReferenceId++}`,
8919
- name: _optionalChain([options, 'access', _491 => _491.name, 'optionalAccess', _492 => _492.trim, 'call', _493 => _493()]) || `Reference ${this.guides.references.length + 1}`,
8954
+ name: _optionalChain([options, 'access', _499 => _499.name, 'optionalAccess', _500 => _500.trim, 'call', _501 => _501()]) || `Reference ${this.guides.references.length + 1}`,
8920
8955
  src,
8921
8956
  width: pixels.width,
8922
8957
  height: pixels.height,
@@ -8995,7 +9030,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
8995
9030
  try {
8996
9031
  const px = this.decodeImage(ref2.src, `Reference "${ref2.name}"`);
8997
9032
  guides.references.push({ id: ref2.id, name: String(_nullishCoalesce(ref2.name, () => ( ref2.id))), src: ref2.src, width: px.width, height: px.height, x: Number(ref2.x) || 0, y: Number(ref2.y) || 0, displayWidth: Number(ref2.displayWidth) || 240, visible: ref2.visible !== false });
8998
- const n = Number(_nullishCoalesce(_optionalChain([/^ref(\d+)$/, 'access', _494 => _494.exec, 'call', _495 => _495(ref2.id), 'optionalAccess', _496 => _496[1]]), () => ( 0)));
9033
+ const n = Number(_nullishCoalesce(_optionalChain([/^ref(\d+)$/, 'access', _502 => _502.exec, 'call', _503 => _503(ref2.id), 'optionalAccess', _504 => _504[1]]), () => ( 0)));
8999
9034
  if (n >= this.nextReferenceId) this.nextReferenceId = n + 1;
9000
9035
  } catch (e) {
9001
9036
  problems.push(e.message);
@@ -9006,7 +9041,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9006
9041
  guides.stencils = [];
9007
9042
  r.stencils.forEach((raw2, i) => {
9008
9043
  try {
9009
- const id = typeof _optionalChain([raw2, 'optionalAccess', _497 => _497.id]) === "string" && /^stencil\d+$/.test(raw2.id) ? raw2.id : `stencil${this.nextStencilId}`;
9044
+ const id = typeof _optionalChain([raw2, 'optionalAccess', _505 => _505.id]) === "string" && /^stencil\d+$/.test(raw2.id) ? raw2.id : `stencil${this.nextStencilId}`;
9010
9045
  guides.stencils.push(normalizeStencil(raw2, id));
9011
9046
  const n = Number(id.slice(7));
9012
9047
  if (n >= this.nextStencilId) this.nextStencilId = n + 1;
@@ -9029,12 +9064,12 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9029
9064
  /** The next free sticker number (ids `st<n>` are unique across the document). */
9030
9065
  nextStickerNumber(doc = this.doc) {
9031
9066
  let n = 0;
9032
- for (const list of Object.values(_nullishCoalesce(doc.stickers, () => ( {})))) for (const st of list) n = Math.max(n, Number(_nullishCoalesce(_optionalChain([/^st(\d+)$/, 'access', _498 => _498.exec, 'call', _499 => _499(st.id), 'optionalAccess', _500 => _500[1]]), () => ( 0))));
9067
+ for (const list of Object.values(_nullishCoalesce(doc.stickers, () => ( {})))) for (const st of list) n = Math.max(n, Number(_nullishCoalesce(_optionalChain([/^st(\d+)$/, 'access', _506 => _506.exec, 'call', _507 => _507(st.id), 'optionalAccess', _508 => _508[1]]), () => ( 0))));
9033
9068
  return n + 1;
9034
9069
  }
9035
9070
  stickerLayer(layerId) {
9036
9071
  const l = this.wetLayer(layerId, "edit the stickers of");
9037
- const stickers = _optionalChain([this, 'access', _501 => _501.doc, 'access', _502 => _502.stickers, 'optionalAccess', _503 => _503[l.id]]);
9072
+ const stickers = _optionalChain([this, 'access', _509 => _509.doc, 'access', _510 => _510.stickers, 'optionalAccess', _511 => _511[l.id]]);
9038
9073
  if (!stickers) throw new PaintEditorError(`Layer "${l.name}" has no stickers; spray some with a sticker brush (sticker-stars; list_brush_presets lists them).`);
9039
9074
  return { layer: l, stickers };
9040
9075
  }
@@ -9056,36 +9091,53 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9056
9091
  }
9057
9092
  /**
9058
9093
  * Loads the art of `refs` (provider stickers; editor stamps need none) so sprays and placements
9059
- * can draw them. Rejects with a `PaintEditorError` naming an unknown ref and the closest known
9094
+ * can draw them: their dark variants when the colour scheme is dark and they have one. Rejects with a `PaintEditorError` naming an unknown ref and the closest known
9060
9095
  * ones, or a sticker whose art failed. Emits when art arrives, so views redraw.
9061
9096
  */
9062
9097
  async prepareStickers(refs) {
9063
- const list = [...new Set(refs.map((r) => this.readStickerRef(r)))].filter((r) => !_chunkJSDND7DFcjs.editorStampOf.call(void 0, r));
9098
+ const list = [...new Set(refs.map((r) => this.readStickerRef(r)))].filter((r) => !_chunkOTN6VB5Scjs.editorStampOf.call(void 0, r));
9064
9099
  try {
9065
- await Promise.all(list.map((r) => this.stickerArt.ensure(this.stickers.provider, r, this.rasterizeSticker)));
9100
+ await Promise.all(list.map((r) => this.stickerArt.ensure(this.stickers.provider, r, this.rasterizeSticker, this.colorScheme === "dark")));
9066
9101
  } catch (e) {
9067
9102
  throw new PaintEditorError(e instanceof Error ? e.message : String(e));
9068
9103
  } finally {
9069
9104
  if (list.length) this.emit([]);
9070
9105
  }
9071
9106
  }
9072
- /** Whether a sticker's art is ready to draw: `ready` (always for editor stamps), `loading`, `failed` (with why) or `none`. */
9107
+ /** Whether a sticker's art is ready to draw in the variant the colour scheme picks: `ready` (always for editor stamps), `loading`, `failed` (with why) or `none`. */
9073
9108
  stickerArtStatus(ref2) {
9074
- return this.stickerArt.status(this.readStickerRef(ref2));
9109
+ const r = this.readStickerRef(ref2);
9110
+ return this.stickerArt.status(r, this.stickerArt.variantFor(r, this.colorScheme === "dark"));
9111
+ }
9112
+ /**
9113
+ * A sticker whose ref is new (placed or restamped) in the variant the colour scheme picks: `dark`
9114
+ * on a dark scheme when its sticker has one (known once its art was asked for).
9115
+ */
9116
+ withStickerVariant(s) {
9117
+ const { variant: _old, ...rest } = s;
9118
+ const v = _chunkOTN6VB5Scjs.editorStampOf.call(void 0, s.ref) ? "light" : this.stickerArt.variantFor(s.ref, this.colorScheme === "dark");
9119
+ return v === "dark" ? { ...rest, variant: v } : rest;
9075
9120
  }
9076
9121
  readStickerRef(ref2) {
9077
9122
  try {
9078
- return _chunkJSDND7DFcjs.normalizeStickerRef.call(void 0, ref2);
9123
+ return _chunkOTN6VB5Scjs.normalizeStickerRef.call(void 0, ref2);
9079
9124
  } catch (e) {
9080
9125
  throw new PaintEditorError(e.message);
9081
9126
  }
9082
9127
  }
9083
9128
  /** Refuses to redraw stickers whose art has not loaded (they would vanish), naming them and what to call. */
9084
9129
  requireStickerArt(stickers) {
9085
- const missing = [...new Set(stickers.filter((s) => !stickerStamp(s) && !this.stickerArt.get(s.ref)).map((s) => s.ref))];
9130
+ const missing = stickers.filter((s) => !stickerStamp(s) && !this.stickerArt.get(s.ref, s.variant));
9086
9131
  if (missing.length) {
9087
- for (const r of missing) void this.stickerArt.ensure(this.stickers.provider, r, this.rasterizeSticker).then(() => this.emit([]), () => this.emit([]));
9088
- throw new PaintEditorError(`The art for ${missing.map((r) => `"${r}"`).join(", ")} has not loaded yet; it is loading now (prepareStickers), so try again when it has.`);
9132
+ const dark = this.colorScheme === "dark";
9133
+ const loads = /* @__PURE__ */ new Map();
9134
+ for (const s of missing) {
9135
+ loads.set(`${s.ref}#${_nullishCoalesce(s.variant, () => ( "light"))}`, [s.ref, s.variant === "dark"]);
9136
+ if (dark) loads.set(`${s.ref}#dark`, [s.ref, true]);
9137
+ }
9138
+ for (const [r, d] of loads.values()) void this.stickerArt.ensure(this.stickers.provider, r, this.rasterizeSticker, d).then(() => this.emit([]), () => this.emit([]));
9139
+ const refs = [...new Set(missing.map((s) => s.ref))];
9140
+ throw new PaintEditorError(`The art for ${refs.map((r) => `"${r}"`).join(", ")} has not loaded yet; it is loading now (prepareStickers), so try again when it has.`);
9089
9141
  }
9090
9142
  }
9091
9143
  /** A layer's stickers, bottom first. */
@@ -9093,7 +9145,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9093
9145
  const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
9094
9146
  if (!id) return [];
9095
9147
  this.requireLayer(id);
9096
- return (_nullishCoalesce(_optionalChain([this, 'access', _504 => _504.doc, 'access', _505 => _505.stickers, 'optionalAccess', _506 => _506[id]]), () => ( []))).map((s) => ({ ...s }));
9148
+ return (_nullishCoalesce(_optionalChain([this, 'access', _512 => _512.doc, 'access', _513 => _513.stickers, 'optionalAccess', _514 => _514[id]]), () => ( []))).map((s) => ({ ...s }));
9097
9149
  }
9098
9150
  /**
9099
9151
  * Replaces a layer's stickers and redraws its pixels from them (one undo step). With `dirty`,
@@ -9114,7 +9166,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9114
9166
  }
9115
9167
  /** The document from before the sticker preview on screen, or `null` when none is (anything else changed the document since). */
9116
9168
  previewBase() {
9117
- return _optionalChain([this, 'access', _507 => _507.stickerPreview, 'optionalAccess', _508 => _508.shown]) === this.doc ? this.stickerPreview.base : null;
9169
+ return _optionalChain([this, 'access', _515 => _515.stickerPreview, 'optionalAccess', _516 => _516.shown]) === this.doc ? this.stickerPreview.base : null;
9118
9170
  }
9119
9171
  readStickerUpdate(update) {
9120
9172
  try {
@@ -9129,7 +9181,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9129
9181
  const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
9130
9182
  if (!id) return null;
9131
9183
  this.requireLayer(id);
9132
- const hit = stickerAt(_nullishCoalesce(_optionalChain([this, 'access', _509 => _509.doc, 'access', _510 => _510.stickers, 'optionalAccess', _511 => _511[id]]), () => ( [])), x, y, this.stickerArt.get);
9184
+ const hit = stickerAt(_nullishCoalesce(_optionalChain([this, 'access', _517 => _517.doc, 'access', _518 => _518.stickers, 'optionalAccess', _519 => _519[id]]), () => ( [])), x, y, this.stickerArt.get);
9133
9185
  return hit ? { ...hit } : null;
9134
9186
  }
9135
9187
  /** Picks a sticker for the panel and canvas (`null` for none). Editor state, not an undo step. */
@@ -9148,7 +9200,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9148
9200
  if (_chunkPVJMTLPJcjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it first.`);
9149
9201
  const i = stickers.findIndex((s) => s.id === id);
9150
9202
  if (i < 0) throw new PaintEditorError(`Layer "${layer.name}" has no sticker "${id}". Call list_stickers for the ids.`);
9151
- const next = { ...stickers[i], ...this.readStickerUpdate(update) };
9203
+ const u = this.readStickerUpdate(update);
9204
+ const next = u.ref !== void 0 ? this.withStickerVariant({ ...stickers[i], ...u }) : { ...stickers[i], ...u };
9152
9205
  const list = stickers.map((s, j) => j === i ? next : s);
9153
9206
  const dirty = [stickerRect(stickers[i]), stickerRect(next)];
9154
9207
  const base = _nullishCoalesce(this.previewBase(), () => ( this.doc));
@@ -9172,7 +9225,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9172
9225
  const i = stickers.findIndex((s) => s.id === id);
9173
9226
  if (i < 0) throw new PaintEditorError(`Layer "${layer.name}" has no sticker "${id}". Call list_stickers for the ids.`);
9174
9227
  const u = this.readStickerUpdate(update);
9175
- const next = { ...stickers[i], ...u };
9228
+ const next = u.ref !== void 0 ? this.withStickerVariant({ ...stickers[i], ...u }) : { ...stickers[i], ...u };
9176
9229
  this.commitStickers("Edit sticker", layer, stickers.map((s, j) => j === i ? next : s), [stickerRect(stickers[i]), stickerRect(next)]);
9177
9230
  return { ...next };
9178
9231
  }
@@ -9185,8 +9238,8 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9185
9238
  const layer = this.wetLayer(layerId, "add stickers to");
9186
9239
  if (!input.length) throw new PaintEditorError("Pass at least one sticker (ref, x, y).");
9187
9240
  if (input.length > MAX_ADD_STICKERS) throw new PaintEditorError(`At most ${MAX_ADD_STICKERS} stickers per call; split them over several calls.`);
9188
- const existing = _optionalChain([this, 'access', _512 => _512.doc, 'access', _513 => _513.stickers, 'optionalAccess', _514 => _514[layer.id]]);
9189
- if (!_optionalChain([existing, 'optionalAccess', _515 => _515.length])) {
9241
+ const existing = _optionalChain([this, 'access', _520 => _520.doc, 'access', _521 => _521.stickers, 'optionalAccess', _522 => _522[layer.id]]);
9242
+ if (!_optionalChain([existing, 'optionalAccess', _523 => _523.length])) {
9190
9243
  if (this.wet.wetLayerIds().includes(layer.id) || _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface)) throw new PaintEditorError(`Layer "${layer.name}" already has paint; add stickers to an empty layer (add_layer) or a sticker layer so they stay editable.`);
9191
9244
  }
9192
9245
  let n = this.nextStickerNumber();
@@ -9201,9 +9254,9 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9201
9254
  }
9202
9255
  if (raw.seed !== void 0 && !Number.isInteger(raw.seed)) throw new PaintEditorError(`Sticker ${i}: seed must be a whole number.`);
9203
9256
  const id = n++;
9204
- return { id: `st${id}`, size: 48, rotation: 0, color: this.color, opacity: 1, seed: _nullishCoalesce(raw.seed, () => ( _chunk3K6HWEXZcjs.mix32.call(void 0, id * 2654435761 >>> 0) & 2147483647)), ...u };
9257
+ return this.withStickerVariant({ id: `st${id}`, size: 48, rotation: 0, color: this.color, opacity: 1, seed: _nullishCoalesce(raw.seed, () => ( _chunk3K6HWEXZcjs.mix32.call(void 0, id * 2654435761 >>> 0) & 2147483647)), ...u });
9205
9258
  });
9206
- this.commitStickers("Add stickers", layer, [..._nullishCoalesce(existing, () => ( [])), ...added], _optionalChain([existing, 'optionalAccess', _516 => _516.length]) ? added.map(stickerRect) : void 0);
9259
+ this.commitStickers("Add stickers", layer, [..._nullishCoalesce(existing, () => ( [])), ...added], _optionalChain([existing, 'optionalAccess', _524 => _524.length]) ? added.map(stickerRect) : void 0);
9207
9260
  return added.map((s) => ({ ...s }));
9208
9261
  }
9209
9262
  /** Brings stickers to the top (`front`) or bottom of their layer (one undo step). */
@@ -9242,20 +9295,20 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9242
9295
  }
9243
9296
  liveStrokeLayer(layerId, what) {
9244
9297
  const l = this.wetLayer(layerId, what);
9245
- const strokes = _optionalChain([this, 'access', _517 => _517.doc, 'access', _518 => _518.liveStrokes, 'optionalAccess', _519 => _519[l.id]]);
9298
+ const strokes = _optionalChain([this, 'access', _525 => _525.doc, 'access', _526 => _526.liveStrokes, 'optionalAccess', _527 => _527[l.id]]);
9246
9299
  if (!strokes) throw new PaintEditorError(`Layer "${l.name}" is not a stroke layer; add one with add_layer {type: "strokes"} (or convert_to_stroke_layer on an empty layer), then paint on it.`);
9247
9300
  return { layer: l, strokes };
9248
9301
  }
9249
9302
  /** Whether a layer is a live stroke layer. */
9250
9303
  isLiveStrokeLayer(layerId) {
9251
- return Boolean(_optionalChain([this, 'access', _520 => _520.doc, 'access', _521 => _521.liveStrokes, 'optionalAccess', _522 => _522[layerId]]));
9304
+ return Boolean(_optionalChain([this, 'access', _528 => _528.doc, 'access', _529 => _529.liveStrokes, 'optionalAccess', _530 => _530[layerId]]));
9252
9305
  }
9253
9306
  /** Makes an empty pixel layer a live stroke layer (one undo step). */
9254
9307
  convertToLiveStrokes(layerId) {
9255
9308
  this.requireIdle("converting a layer");
9256
9309
  const l = this.paintTarget(layerId, "convert");
9257
- if (_optionalChain([this, 'access', _523 => _523.doc, 'access', _524 => _524.liveStrokes, 'optionalAccess', _525 => _525[l.id]])) return this.describeLayer(l);
9258
- if (_optionalChain([this, 'access', _526 => _526.doc, 'access', _527 => _527.stickers, 'optionalAccess', _528 => _528[l.id], 'optionalAccess', _529 => _529.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; add a stroke layer instead (add_layer {type: "strokes"}).`);
9310
+ if (_optionalChain([this, 'access', _531 => _531.doc, 'access', _532 => _532.liveStrokes, 'optionalAccess', _533 => _533[l.id]])) return this.describeLayer(l);
9311
+ if (_optionalChain([this, 'access', _534 => _534.doc, 'access', _535 => _535.stickers, 'optionalAccess', _536 => _536[l.id], 'optionalAccess', _537 => _537.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; add a stroke layer instead (add_layer {type: "strokes"}).`);
9259
9312
  if (_chunk474IQG74cjs.contentBounds.call(void 0, l.surface) || this.wet.wetLayerIds().includes(l.id)) throw new PaintEditorError(`Layer "${l.name}" already has paint, which isn't kept as strokes; convert an empty layer or add a stroke layer (add_layer {type: "strokes"}).`);
9260
9313
  this.commit("Convert to stroke layer", { ...this.doc, liveStrokes: { ..._nullishCoalesce(this.doc.liveStrokes, () => ( {})), [l.id]: [] } });
9261
9314
  return this.describeLayer(this.getLayer(l.id));
@@ -9268,7 +9321,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9268
9321
  findLiveStroke(id) {
9269
9322
  for (const [layerId, strokes] of Object.entries(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) {
9270
9323
  const index = strokes.findIndex((x) => x.id === id);
9271
- const layer = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, layerId), 'optionalAccess', _530 => _530.layer]);
9324
+ const layer = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, layerId), 'optionalAccess', _538 => _538.layer]);
9272
9325
  if (index >= 0 && isPixelLayer(layer)) return { layer, strokes, index };
9273
9326
  }
9274
9327
  const baked = this.doc.strokes.some((x) => x.id === id);
@@ -9288,15 +9341,15 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9288
9341
  let brush = was.brush;
9289
9342
  if (update.brushId !== void 0) {
9290
9343
  const b = this.requireBrush(update.brushId);
9291
- brush = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: was.brush.tip.size } }, b);
9344
+ brush = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: was.brush.tip.size } }, b);
9292
9345
  }
9293
9346
  if (update.brush !== void 0) {
9294
9347
  if (!update.brush || typeof update.brush !== "object") throw new PaintEditorError("brush must be an object of brush settings (as set_brush takes).");
9295
- brush = _chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { ...update.brush, id: brush.id }, brush);
9348
+ brush = _chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { ...update.brush, id: brush.id }, brush);
9296
9349
  }
9297
9350
  const why = liveStrokeRefusal(brush);
9298
9351
  if (why) throw new PaintEditorError(why);
9299
- const next = { ...was, brush: _chunkTZOX7KWVcjs.brushToJSON.call(void 0, brush) };
9352
+ const next = { ...was, brush: _chunkBY5EBP26cjs.brushToJSON.call(void 0, brush) };
9300
9353
  if (update.seed !== void 0) {
9301
9354
  if (!Number.isInteger(update.seed) || update.seed < 0) throw new PaintEditorError(`seed ${update.seed} must be a whole number of 0 or more.`);
9302
9355
  next.seed = update.seed;
@@ -9363,9 +9416,9 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9363
9416
  const layers = /* @__PURE__ */ new Map();
9364
9417
  for (const f of found) layers.set(f.layer.id, f.layer);
9365
9418
  for (const [layerId, layer] of layers) {
9366
- const gone = (_nullishCoalesce(_optionalChain([doc, 'access', _531 => _531.liveStrokes, 'optionalAccess', _532 => _532[layerId]]), () => ( []))).filter((x) => ids.includes(x.id));
9419
+ const gone = (_nullishCoalesce(_optionalChain([doc, 'access', _539 => _539.liveStrokes, 'optionalAccess', _540 => _540[layerId]]), () => ( []))).filter((x) => ids.includes(x.id));
9367
9420
  for (const x of gone) bounds = unionRect(bounds, this.strokeArea(x));
9368
- doc = this.withLiveStrokes(doc, layer, (_nullishCoalesce(_optionalChain([doc, 'access', _533 => _533.liveStrokes, 'optionalAccess', _534 => _534[layerId]]), () => ( []))).filter((x) => !ids.includes(x.id)), this.strokeAreas(gone));
9421
+ doc = this.withLiveStrokes(doc, layer, (_nullishCoalesce(_optionalChain([doc, 'access', _541 => _541.liveStrokes, 'optionalAccess', _542 => _542[layerId]]), () => ( []))).filter((x) => !ids.includes(x.id)), this.strokeAreas(gone));
9369
9422
  }
9370
9423
  this.commit(ids.length === 1 ? "Remove stroke" : "Remove strokes", doc);
9371
9424
  return { removed: [...ids], bounds };
@@ -9433,7 +9486,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9433
9486
  }
9434
9487
  withLiveStrokes(doc, layer, list, dirty) {
9435
9488
  if (_chunkPVJMTLPJcjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it (update_layer locks) first.`);
9436
- const current = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, layer.id), 'optionalAccess', _535 => _535.layer]);
9489
+ const current = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, layer.id), 'optionalAccess', _543 => _543.layer]);
9437
9490
  const surface = this.drawLiveStrokes(_nullishCoalesce(current, () => ( layer)), list, dirty);
9438
9491
  const next = { ...doc, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, doc.layers, layer.id, (l) => ({ ...l, surface, offset: { x: 0, y: 0 } })), liveStrokes: { ..._nullishCoalesce(doc.liveStrokes, () => ( {})), [layer.id]: [...list] } };
9439
9492
  return this.withPaintEvent(next, { kind: "live-strokes", layerId: layer.id, data: { strokes: list.map((x) => JSON.parse(JSON.stringify(x))) } });
@@ -9511,7 +9564,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9511
9564
  if (!this.animatedLayers.size) return this.doc.layers;
9512
9565
  let layers = this.doc.layers;
9513
9566
  for (const [id, a] of this.animatedLayers) {
9514
- const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _536 => _536.layer]);
9567
+ const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _544 => _544.layer]);
9515
9568
  if (isPixelLayer(l) && l.surface === a.base) layers = _chunkPVJMTLPJcjs.mapLayer.call(void 0, layers, id, () => ({ ...l, surface: a.surface }));
9516
9569
  }
9517
9570
  return layers;
@@ -9521,7 +9574,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9521
9574
  const layers = [];
9522
9575
  const sources = /* @__PURE__ */ new Map();
9523
9576
  for (const [id, strokes] of Object.entries(_nullishCoalesce(doc.liveStrokes, () => ( {})))) {
9524
- const layer = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, id), 'optionalAccess', _537 => _537.layer]);
9577
+ const layer = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, id), 'optionalAccess', _545 => _545.layer]);
9525
9578
  const live = strokes.filter(isLiveEffect);
9526
9579
  if (!isPixelLayer(layer) || !live.length) continue;
9527
9580
  layers.push({ layer, strokes });
@@ -9646,13 +9699,13 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9646
9699
  return this.withEffectTime(time, () => this.compositePixels(options));
9647
9700
  }
9648
9701
  // --- Stencils --------------------------------------------------------------------
9649
- __init181() {this.stencilCache = null}
9650
- __init182() {this.nextStencilId = 1}
9702
+ __init183() {this.stencilCache = null}
9703
+ __init184() {this.nextStencilId = 1}
9651
9704
  /** The mask stencils' coverage over the canvas (cached), or `null` when none masks. */
9652
9705
  stencilSelection(stencils = this.guides.stencils) {
9653
9706
  const { width, height } = this.doc.canvas;
9654
9707
  const size = `${width}x${height}`;
9655
- if (_optionalChain([this, 'access', _538 => _538.stencilCache, 'optionalAccess', _539 => _539.key]) === stencils && this.stencilCache.size === size) return this.stencilCache.mask;
9708
+ if (_optionalChain([this, 'access', _546 => _546.stencilCache, 'optionalAccess', _547 => _547.key]) === stencils && this.stencilCache.size === size) return this.stencilCache.mask;
9656
9709
  const mask = stencilMask(stencils, width, height);
9657
9710
  this.stencilCache = { key: stencils, size, mask };
9658
9711
  return mask;
@@ -9714,7 +9767,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9714
9767
  makeSwatch(color, name) {
9715
9768
  const p = typeof color === "string" ? { type: "color", color: parseColor(color) } : this.readStrokePaint(color);
9716
9769
  const out = { color: _chunkFQPUF2W2cjs.paintSourceColor.call(void 0, p, { paint: this.color, secondary: this.secondaryColor }) };
9717
- if (_optionalChain([name, 'optionalAccess', _540 => _540.trim, 'call', _541 => _541()])) out.name = name.trim();
9770
+ if (_optionalChain([name, 'optionalAccess', _548 => _548.trim, 'call', _549 => _549()])) out.name = name.trim();
9718
9771
  if (p.type === "gradient") out.paint = p;
9719
9772
  return out;
9720
9773
  }
@@ -9766,7 +9819,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9766
9819
  * mix becomes the paint colour. Returns the mixed colour and the pile's bounds.
9767
9820
  */
9768
9821
  mixOnPad(paints2, options = {}) {
9769
- const parsed = (_nullishCoalesce(paints2, () => ( []))).map((p, i) => ({ color: parseColor(_optionalChain([p, 'optionalAccess', _542 => _542.color]), `paints[${i}].color`), parts: _optionalChain([p, 'optionalAccess', _543 => _543.parts]) }));
9822
+ const parsed = (_nullishCoalesce(paints2, () => ( []))).map((p, i) => ({ color: parseColor(_optionalChain([p, 'optionalAccess', _550 => _550.color]), `paints[${i}].color`), parts: _optionalChain([p, 'optionalAccess', _551 => _551.parts]) }));
9770
9823
  let r;
9771
9824
  try {
9772
9825
  r = this.pad.mix(parsed, options);
@@ -9855,7 +9908,7 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
9855
9908
  }
9856
9909
  /** A layer's tile surface (live while stroking), for thumbnails. */
9857
9910
  layerSurface(id) {
9858
- const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _544 => _544.layer]);
9911
+ const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _552 => _552.layer]);
9859
9912
  return isPixelLayer(l) ? l.surface : null;
9860
9913
  }
9861
9914
  }, _class19.__initStatic(), _class19);
@@ -9877,7 +9930,7 @@ function insertAfter(layers, id, node) {
9877
9930
  return layers.map((l) => l.type === "group" ? { ...l, children: insertAfter(l.children, id, node) } : l);
9878
9931
  }
9879
9932
  function isLiveEffect(s) {
9880
- return _optionalChain([s, 'access', _545 => _545.paint, 'optionalAccess', _546 => _546.type]) === "effect" && s.paint.live === true;
9933
+ return _optionalChain([s, 'access', _553 => _553.paint, 'optionalAccess', _554 => _554.type]) === "effect" && s.paint.live === true;
9881
9934
  }
9882
9935
  function framePaint(p, t) {
9883
9936
  return { ...p, time: p.time + t };
@@ -9902,7 +9955,7 @@ function clipRect(r, width, height) {
9902
9955
  return x1 > x0 && y1 > y0 ? { x: x0, y: y0, width: x1 - x0, height: y1 - y0 } : null;
9903
9956
  }
9904
9957
  function withLiveStroke(doc, stroke) {
9905
- const list = _optionalChain([doc, 'access', _547 => _547.liveStrokes, 'optionalAccess', _548 => _548[stroke.layerId]]);
9958
+ const list = _optionalChain([doc, 'access', _555 => _555.liveStrokes, 'optionalAccess', _556 => _556[stroke.layerId]]);
9906
9959
  return list ? { ...doc, liveStrokes: { ...doc.liveStrokes, [stroke.layerId]: [...list, stroke] } } : doc;
9907
9960
  }
9908
9961
  function shiftDocument(doc, dx, dy) {
@@ -9929,9 +9982,9 @@ function shiftDocument(doc, dx, dy) {
9929
9982
  if (doc.liveStrokes) out.liveStrokes = Object.fromEntries(Object.entries(doc.liveStrokes).map(([id, list]) => [id, list.map(moveStroke)]));
9930
9983
  if (doc.paintEvents) {
9931
9984
  out.paintEvents = doc.paintEvents.map((e) => {
9932
- const list = e.kind === "stickers" ? _optionalChain([e, 'access', _549 => _549.data, 'optionalAccess', _550 => _550.stickers]) : void 0;
9985
+ const list = e.kind === "stickers" ? _optionalChain([e, 'access', _557 => _557.data, 'optionalAccess', _558 => _558.stickers]) : void 0;
9933
9986
  if (list) return { ...e, data: { ...e.data, stickers: moveStickers(list) } };
9934
- const strokes = e.kind === "live-strokes" ? _optionalChain([e, 'access', _551 => _551.data, 'optionalAccess', _552 => _552.strokes]) : void 0;
9987
+ const strokes = e.kind === "live-strokes" ? _optionalChain([e, 'access', _559 => _559.data, 'optionalAccess', _560 => _560.strokes]) : void 0;
9935
9988
  return strokes ? { ...e, data: { ...e.data, strokes: strokes.map(moveStroke) } } : e;
9936
9989
  });
9937
9990
  }
@@ -10020,8 +10073,8 @@ function strokeSchedule(points) {
10020
10073
  return total > 0 ? acc.map((d) => d / total) : points.map(() => 1);
10021
10074
  }
10022
10075
  function strokeDuration(points, max = 1800) {
10023
- const t0 = _optionalChain([points, 'access', _553 => _553[0], 'optionalAccess', _554 => _554.t]);
10024
- const t1 = _optionalChain([points, 'access', _555 => _555[points.length - 1], 'optionalAccess', _556 => _556.t]);
10076
+ const t0 = _optionalChain([points, 'access', _561 => _561[0], 'optionalAccess', _562 => _562.t]);
10077
+ const t1 = _optionalChain([points, 'access', _563 => _563[points.length - 1], 'optionalAccess', _564 => _564.t]);
10025
10078
  let ms;
10026
10079
  if (points.every((p) => Number.isFinite(p.t)) && t1 > t0) ms = t1 - t0;
10027
10080
  else {
@@ -10075,7 +10128,7 @@ var PaintDirector = class {
10075
10128
  }
10076
10129
  where(id) {
10077
10130
  const a = this.presence.get(id);
10078
- return { x: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _557 => _557.x]), () => ( 0)), y: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _558 => _558.y]), () => ( 0)) };
10131
+ return { x: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _565 => _565.x]), () => ( 0)), y: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _566 => _566.y]), () => ( 0)) };
10079
10132
  }
10080
10133
  /** Glides to `to`; an actor that just appeared starts there instead of the corner. */
10081
10134
  async glide(id, to, ms = 380) {
@@ -10122,8 +10175,8 @@ var PaintDirector = class {
10122
10175
  }
10123
10176
  case "replay": {
10124
10177
  await this.say(id, command.note, 500);
10125
- const source = c.getStrokes().filter((s) => _optionalChain([command, 'access', _559 => _559.replay, 'access', _560 => _560.strokeIds, 'optionalAccess', _561 => _561.includes, 'call', _562 => _562(s.id)]));
10126
- const first = _optionalChain([source, 'access', _563 => _563[0], 'optionalAccess', _564 => _564.points, 'access', _565 => _565[0]]);
10178
+ const source = c.getStrokes().filter((s) => _optionalChain([command, 'access', _567 => _567.replay, 'access', _568 => _568.strokeIds, 'optionalAccess', _569 => _569.includes, 'call', _570 => _570(s.id)]));
10179
+ const first = _optionalChain([source, 'access', _571 => _571[0], 'optionalAccess', _572 => _572.points, 'access', _573 => _573[0]]);
10127
10180
  if (first) await this.glide(id, first);
10128
10181
  const result = c.replayStrokes(command.replay);
10129
10182
  if (result.bounds) await this.glide(id, centre(result.bounds), 520);
@@ -10305,7 +10358,7 @@ function createPaintStickerTools(c) {
10305
10358
  type: "object",
10306
10359
  properties: {
10307
10360
  ref: { type: "string", minLength: 1, description: "The sticker: a ref provider:id from find_stickers (e.g. editor:star). Give ref or stamp." },
10308
- stamp: { type: "string", enum: [..._chunkJSDND7DFcjs.STAMP_KINDS], description: "Older form: an editor stamp (same as ref editor:<stamp>)." },
10361
+ stamp: { type: "string", enum: [..._chunkOTN6VB5Scjs.STAMP_KINDS], description: "Older form: an editor stamp (same as ref editor:<stamp>)." },
10309
10362
  x: { type: "number", description: "Centre x in document pixels." },
10310
10363
  y: { type: "number", description: "Centre y in document pixels." },
10311
10364
  size: { type: "number", minimum: 2, maximum: 2048, description: "Diameter in pixels (default 48)." },
@@ -10343,7 +10396,7 @@ function createPaintStickerTools(c) {
10343
10396
  layerId: LAYER_ID,
10344
10397
  id: { type: "string", description: "Sticker id from list_stickers." },
10345
10398
  ref: { type: "string", minLength: 1, description: "Another sticker: a ref provider:id from find_stickers." },
10346
- stamp: { type: "string", enum: [..._chunkJSDND7DFcjs.STAMP_KINDS], description: "Older form: another editor stamp (same as ref editor:<stamp>)." },
10399
+ stamp: { type: "string", enum: [..._chunkOTN6VB5Scjs.STAMP_KINDS], description: "Older form: another editor stamp (same as ref editor:<stamp>)." },
10347
10400
  x: { type: "number", description: "Centre x in document pixels." },
10348
10401
  y: { type: "number", description: "Centre y in document pixels." },
10349
10402
  size: { type: "number", minimum: 2, maximum: 2048, description: "Diameter in pixels." },
@@ -11557,10 +11610,10 @@ function createPaintEditorToolProvider(controller, options = {}) {
11557
11610
  name: "set_brush",
11558
11611
  title: "Set the brush",
11559
11612
  description: "Chooses the active brush (id, from list_brush_presets) and / or changes it with facets laid over it (objects merge, lists and values replace, marks of another kind replace the marks; the brush library's create_brush fields); unset removes whole facets first (unset colour drops a brush's own gradient). Strokes without a brush use it. Editor state, not an undo step: the changes stay on the active brush until the library's create_brush or update_brush stores a brush. Returns the active brush as facets, the engine it paints with, and problems (values clamped or dropped).",
11560
- inputSchema: { type: "object", properties: { id: { type: "string", description: "Brush id from list_brush_presets to start from (default the active brush)." }, name: { type: "string", minLength: 1, maxLength: 80, description: "Display name." }, ..._chunkPYTJBVW5cjs.BRUSH_PATCH_PROPERTIES, unset: _chunkPYTJBVW5cjs.BRUSH_UNSET_PROPERTY }, additionalProperties: false },
11613
+ inputSchema: { type: "object", properties: { id: { type: "string", description: "Brush id from list_brush_presets to start from (default the active brush)." }, name: { type: "string", minLength: 1, maxLength: 80, description: "Display name." }, ..._chunkF3KKR6DDcjs.BRUSH_PATCH_PROPERTIES, unset: _chunkF3KKR6DDcjs.BRUSH_UNSET_PROPERTY }, additionalProperties: false },
11561
11614
  annotations: { title: "Set the brush", ...SET4 },
11562
11615
  handler: async ({ id, unset, ...patch }) => {
11563
- const stamps = _optionalChain([patch, 'access', _566 => _566.tip, 'optionalAccess', _567 => _567.stamps]);
11616
+ const stamps = _optionalChain([patch, 'access', _574 => _574.tip, 'optionalAccess', _575 => _575.stamps]);
11564
11617
  if (stamps) await c.prepareStickers(stamps);
11565
11618
  const r = c.setBrushFacets(patch, id, unset);
11566
11619
  return { brush: r.spec, engine: r.brush.engine, problems: r.problems };
@@ -11653,7 +11706,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
11653
11706
  points: POINTS,
11654
11707
  layerId: LAYER_ID4,
11655
11708
  brushId: { type: "string", description: "Brush id from list_brush_presets (default the active brush)." },
11656
- brush: { type: "object", description: "Facets to change for this stroke only, laid over brushId or the active brush (as set_brush takes them).", properties: _chunkPYTJBVW5cjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false },
11709
+ brush: { type: "object", description: "Facets to change for this stroke only, laid over brushId or the active brush (as set_brush takes them).", properties: _chunkF3KKR6DDcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false },
11657
11710
  color: { ...COLOR3, description: "Paint colour #rrggbb (default the paint colour)." },
11658
11711
  paint: { ..._chunkFQPUF2W2cjs.PAINT_SOURCE_JSON_SCHEMA, description: "What this stroke paints with instead of the editor's paint: a colour, or gradient paint that changes colour as the stroke goes (by distance, pressure, tilt, speed, direction, time, across the tip or at random). Wins over the brush's own gradient." },
11659
11712
  seed: { type: "integer", minimum: 0, description: "Jitter seed (default a new one); the same seed and points give the same marks." },
@@ -11669,7 +11722,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
11669
11722
  const base = a.brushId ? c.getBrush(a.brushId) : c.getState().brush;
11670
11723
  const brush = a.brush ? c.brushChanges(a.brush, a.brushId) : void 0;
11671
11724
  if (base) {
11672
- const refs = brushStickerRefs(_chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { ..._nullishCoalesce(brush, () => ( {})), id: base.id }, base));
11725
+ const refs = brushStickerRefs(_chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { ..._nullishCoalesce(brush, () => ( {})), id: base.id }, base));
11673
11726
  if (refs.length) await c.prepareStickers(refs);
11674
11727
  }
11675
11728
  const stroke = { points: a.points, layerId: a.layerId, brushId: a.brushId, brush, color: a.color, paint: a.paint, seed: a.seed, snapToPerspective: a.snapToPerspective };
@@ -11689,7 +11742,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
11689
11742
  pressure: { type: "array", minItems: 1, maxItems: 64, items: { type: "number", minimum: 0, maximum: 1 }, description: "Pen pressure along each subpath, spread evenly from start to end (default full pressure); [0.2, 1, 0.2] tapers both ends." },
11690
11743
  layerId: LAYER_ID4,
11691
11744
  brushId: { type: "string", description: "Brush id from list_brush_presets (default the active brush)." },
11692
- brush: { type: "object", description: "Facets to change for this stroke only, laid over brushId or the active brush (as set_brush takes them).", properties: _chunkPYTJBVW5cjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false },
11745
+ brush: { type: "object", description: "Facets to change for this stroke only, laid over brushId or the active brush (as set_brush takes them).", properties: _chunkF3KKR6DDcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false },
11693
11746
  color: { ...COLOR3, description: "Paint colour #rrggbb (default the paint colour)." },
11694
11747
  paint: { ..._chunkFQPUF2W2cjs.PAINT_SOURCE_JSON_SCHEMA, description: "What the strokes paint with instead of the editor's paint: a colour, or gradient paint that changes colour as each stroke goes." },
11695
11748
  seed: { type: "integer", minimum: 0, description: "Jitter seed of the first subpath, the next ones take the following seeds (default new ones); the same seed and path give the same marks." }
@@ -11704,7 +11757,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
11704
11757
  const base = a.brushId ? c.getBrush(a.brushId) : c.getState().brush;
11705
11758
  const brush = a.brush ? c.brushChanges(a.brush, a.brushId) : void 0;
11706
11759
  if (base) {
11707
- const refs = brushStickerRefs(_chunkTZOX7KWVcjs.normalizePaintBrush.call(void 0, { ..._nullishCoalesce(brush, () => ( {})), id: base.id }, base));
11760
+ const refs = brushStickerRefs(_chunkBY5EBP26cjs.normalizePaintBrush.call(void 0, { ..._nullishCoalesce(brush, () => ( {})), id: base.id }, base));
11708
11761
  if (refs.length) await c.prepareStickers(refs);
11709
11762
  }
11710
11763
  const path = options.origin && typeof a.path === "string" && a.path.trim() ? _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, a.path, { offset: { x: -options.origin.x, y: -options.origin.y } }) : a.path;
@@ -11755,7 +11808,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
11755
11808
  if (ids) {
11756
11809
  for (const id of ids) if (!all.some((s) => s.id === id)) throw new Error(`Unknown stroke "${id}". Call list_strokes without ids for the ids.`);
11757
11810
  }
11758
- return { total: all.length, strokes: picked.map((s) => strokeSummary(s, Boolean(ids), live ? true : liveIds.has(s.id) && _optionalChain([c, 'access', _568 => _568.document, 'access', _569 => _569.liveStrokes, 'optionalAccess', _570 => _570[s.layerId], 'optionalAccess', _571 => _571.includes, 'call', _572 => _572(s)]) === true)) };
11811
+ return { total: all.length, strokes: picked.map((s) => strokeSummary(s, Boolean(ids), live ? true : liveIds.has(s.id) && _optionalChain([c, 'access', _576 => _576.document, 'access', _577 => _577.liveStrokes, 'optionalAccess', _578 => _578[s.layerId], 'optionalAccess', _579 => _579.includes, 'call', _580 => _580(s)]) === true)) };
11759
11812
  }
11760
11813
  });
11761
11814
  add({
@@ -11788,7 +11841,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
11788
11841
  properties: {
11789
11842
  id: { type: "string", description: "Stroke id from list_strokes {live: true}." },
11790
11843
  brushId: { type: "string", description: "Brush id from list_brush_presets; the stroke keeps its size." },
11791
- brush: { type: "object", properties: _chunkPYTJBVW5cjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false, description: "Facets to change on top of brushId or the stroke\u2019s brush (as set_brush takes them); missing fields keep their values." },
11844
+ brush: { type: "object", properties: _chunkF3KKR6DDcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false, description: "Facets to change on top of brushId or the stroke\u2019s brush (as set_brush takes them); missing fields keep their values." },
11792
11845
  color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "New colour #rrggbb (replaces gradient paint)." },
11793
11846
  paint: { anyOf: [_chunkFQPUF2W2cjs.PAINT_SOURCE_JSON_SCHEMA, { type: "null", description: "Back to the stroke\u2019s plain colour." }], description: "A colour or gradient paint for the stroke; null drops its gradient." },
11794
11847
  seed: { type: "integer", minimum: 0, description: "Another jitter seed: particles, scatter and texture fall differently." }
@@ -12037,9 +12090,9 @@ function createPaintEditorToolProvider(controller, options = {}) {
12037
12090
  tools.push(...createPaintReplayTools(c));
12038
12091
  tools.push(...createPaintStickerTools(c));
12039
12092
  tools.push(..._chunkYHDHFJUCcjs.createPigmentTools.call(void 0, ));
12040
- tools.push(..._chunkAVTPZO4Zcjs.createStickerTools.call(void 0, { provider: () => c.stickersProvider }));
12093
+ tools.push(..._chunkPE6YJMQTcjs.createStickerTools.call(void 0, { provider: () => c.stickersProvider }));
12041
12094
  tools.push(
12042
- ..._chunk43NT242Dcjs.createLayerEffectTools.call(void 0,
12095
+ ..._chunkKXNZNOEFcjs.createLayerEffectTools.call(void 0,
12043
12096
  {
12044
12097
  requireLayer: (id) => void c.getLayerEffects(id),
12045
12098
  getLayerEffects: (id) => c.getLayerEffects(id),
@@ -12064,16 +12117,16 @@ function createPaintEditorToolProvider(controller, options = {}) {
12064
12117
  }
12065
12118
  function hostTool({ coordinates, ...tool }, { origin, onChange }) {
12066
12119
  if (!origin && !onChange) return tool;
12067
- const write = !_optionalChain([tool, 'access', _573 => _573.annotations, 'optionalAccess', _574 => _574.readOnlyHint]);
12120
+ const write = !_optionalChain([tool, 'access', _581 => _581.annotations, 'optionalAccess', _582 => _582.readOnlyHint]);
12068
12121
  const done = (result) => {
12069
- if (write) _optionalChain([onChange, 'optionalCall', _575 => _575({ tool: tool.name })]);
12070
- return origin && _optionalChain([coordinates, 'optionalAccess', _576 => _576.out]) ? fromDocument(result, coordinates.out, origin) : result;
12122
+ if (write) _optionalChain([onChange, 'optionalCall', _583 => _583({ tool: tool.name })]);
12123
+ return origin && _optionalChain([coordinates, 'optionalAccess', _584 => _584.out]) ? fromDocument(result, coordinates.out, origin) : result;
12071
12124
  };
12072
12125
  return {
12073
12126
  ...tool,
12074
12127
  ...origin ? { description: hostedText(_nullishCoalesce(tool.description, () => ( ""))), inputSchema: hostedSchema(tool.inputSchema) } : {},
12075
12128
  handler: (args, context) => {
12076
- const r = tool.handler(origin && _optionalChain([coordinates, 'optionalAccess', _577 => _577.in]) ? toDocument(args, coordinates.in, origin) : args, context);
12129
+ const r = tool.handler(origin && _optionalChain([coordinates, 'optionalAccess', _585 => _585.in]) ? toDocument(args, coordinates.in, origin) : args, context);
12077
12130
  return r instanceof Promise ? r.then(done) : done(r);
12078
12131
  }
12079
12132
  };
@@ -12090,22 +12143,25 @@ function strokeSummary(s, withPoints, live) {
12090
12143
  color: s.color,
12091
12144
  points: withPoints ? s.points : s.points.length,
12092
12145
  seed: s.seed,
12093
- copies: _nullishCoalesce(_optionalChain([s, 'access', _578 => _578.copies, 'optionalAccess', _579 => _579.length]), () => ( 0)),
12146
+ copies: _nullishCoalesce(_optionalChain([s, 'access', _586 => _586.copies, 'optionalAccess', _587 => _587.length]), () => ( 0)),
12094
12147
  live,
12095
12148
  bounds: { x: Math.floor(Math.min(...xs) - pad), y: Math.floor(Math.min(...ys) - pad), width: Math.ceil(Math.max(...xs) - Math.min(...xs) + 2 * pad), height: Math.ceil(Math.max(...ys) - Math.min(...ys) + 2 * pad) }
12096
12149
  };
12097
12150
  }
12098
12151
 
12099
12152
  // src/paint-editor/brush-library-tools.ts
12153
+ function paintBrushPreviewRenderer(paper = () => DEFAULT_PAPER) {
12154
+ return (brush, { width, height, color }) => {
12155
+ const t = renderBrushThumbnail(_chunkBY5EBP26cjs.resolveBrush.call(void 0, brush), { paper: paper(), width, height, color: color.toLowerCase() });
12156
+ return { data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, _chunkW5M3J7PVcjs.encodePng.call(void 0, t.width, t.height, t.data)), mimeType: "image/png" };
12157
+ };
12158
+ }
12100
12159
  function createPaintBrushLibraryToolProvider(controller, options = {}) {
12101
- return _chunkPYTJBVW5cjs.createBrushLibraryToolProvider.call(void 0, controller.brushLibrary, {
12102
- profile: _chunkTZOX7KWVcjs.PAINT_PROFILE,
12160
+ return _chunkF3KKR6DDcjs.createBrushLibraryToolProvider.call(void 0, controller.brushLibrary, {
12161
+ profile: _chunkBY5EBP26cjs.PAINT_PROFILE,
12103
12162
  stickers: () => controller.stickers.provider,
12104
12163
  ...options,
12105
- renderPreview: (brush, { width, height, color }) => {
12106
- const t = renderBrushThumbnail(_chunkTZOX7KWVcjs.resolveBrush.call(void 0, brush), { paper: controller.getState().document.paper, width, height, color: color.toLowerCase() });
12107
- return { data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, _chunkW5M3J7PVcjs.encodePng.call(void 0, t.width, t.height, t.data)), mimeType: "image/png" };
12108
- }
12164
+ renderPreview: paintBrushPreviewRenderer(() => controller.getState().document.paper)
12109
12165
  });
12110
12166
  }
12111
12167
 
@@ -12119,20 +12175,20 @@ var PAINT_TOOLS = [
12119
12175
  { id: "rotate", label: "Rotate view", key: "r" }
12120
12176
  ];
12121
12177
  var PaintGesture = (_class20 = class {
12122
- constructor(controller, box) {;_class20.prototype.__init183.call(this);_class20.prototype.__init184.call(this);_class20.prototype.__init185.call(this);_class20.prototype.__init186.call(this);_class20.prototype.__init187.call(this);_class20.prototype.__init188.call(this);
12178
+ constructor(controller, box) {;_class20.prototype.__init185.call(this);_class20.prototype.__init186.call(this);_class20.prototype.__init187.call(this);_class20.prototype.__init188.call(this);_class20.prototype.__init189.call(this);_class20.prototype.__init190.call(this);
12123
12179
  this.controller = controller;
12124
12180
  this.box = box;
12125
12181
  }
12126
12182
 
12127
12183
 
12128
- __init183() {this.tool = "brush"}
12184
+ __init185() {this.tool = "brush"}
12129
12185
  /** The last refusal (a hidden or locked layer), for the editor to show. */
12130
- __init184() {this.error = null}
12186
+ __init186() {this.error = null}
12131
12187
  /** The predicted tail of the current stroke in document pixels (draw it as a thin preview). */
12132
- __init185() {this.predicted = []}
12133
- __init186() {this.mode = null}
12134
- __init187() {this.penAt = null}
12135
- __init188() {this.penDown = false}
12188
+ __init187() {this.predicted = []}
12189
+ __init188() {this.mode = null}
12190
+ __init189() {this.penAt = null}
12191
+ __init190() {this.penDown = false}
12136
12192
  doc(e) {
12137
12193
  const b = this.box();
12138
12194
  const s = this.controller.getState();
@@ -12188,13 +12244,13 @@ var PaintGesture = (_class20 = class {
12188
12244
  const p = this.doc(e);
12189
12245
  const s = this.controller.getState();
12190
12246
  const layerId = s.document.activeLayerId;
12191
- if (!layerId || !_optionalChain([s, 'access', _580 => _580.document, 'access', _581 => _581.liveStrokes, 'optionalAccess', _582 => _582[layerId]])) {
12247
+ if (!layerId || !_optionalChain([s, 'access', _588 => _588.document, 'access', _589 => _589.liveStrokes, 'optionalAccess', _590 => _590[layerId]])) {
12192
12248
  this.error = "Pick a stroke layer in the Layers panel (or add one) to select its strokes.";
12193
12249
  return false;
12194
12250
  }
12195
12251
  try {
12196
12252
  const hit = this.controller.liveStrokeAt(layerId, p.x, p.y);
12197
- this.controller.selectStroke(_nullishCoalesce(_optionalChain([hit, 'optionalAccess', _583 => _583.id]), () => ( null)));
12253
+ this.controller.selectStroke(_nullishCoalesce(_optionalChain([hit, 'optionalAccess', _591 => _591.id]), () => ( null)));
12198
12254
  if (!hit) return false;
12199
12255
  this.mode = { kind: "move-stroke", pointerId: e.pointerId, id: hit.id, from: p, to: p };
12200
12256
  return true;
@@ -12206,7 +12262,7 @@ var PaintGesture = (_class20 = class {
12206
12262
  /** While a stroke is dragged: how far it has moved (document pixels), to draw its outline there. */
12207
12263
  get strokeDrag() {
12208
12264
  const m = this.mode;
12209
- return _optionalChain([m, 'optionalAccess', _584 => _584.kind]) === "move-stroke" ? { id: m.id, dx: m.to.x - m.from.x, dy: m.to.y - m.from.y } : null;
12265
+ return _optionalChain([m, 'optionalAccess', _592 => _592.kind]) === "move-stroke" ? { id: m.id, dx: m.to.x - m.from.x, dy: m.to.y - m.from.y } : null;
12210
12266
  }
12211
12267
  /**
12212
12268
  * The Stickers tool: pressing a sticker picks it and dragging moves it (one undo step at the
@@ -12280,7 +12336,7 @@ var PaintGesture = (_class20 = class {
12280
12336
  if (!m || m.pointerId !== e.pointerId) return;
12281
12337
  this.mode = null;
12282
12338
  this.predicted = [];
12283
- if (m.kind === "stroke") _optionalChain([this, 'access', _585 => _585.controller, 'access', _586 => _586.activeStroke, 'optionalAccess', _587 => _587.end, 'call', _588 => _588()]);
12339
+ if (m.kind === "stroke") _optionalChain([this, 'access', _593 => _593.controller, 'access', _594 => _594.activeStroke, 'optionalAccess', _595 => _595.end, 'call', _596 => _596()]);
12284
12340
  if (m.kind === "move-stroke") {
12285
12341
  const dx = Math.round((this.doc(e).x - m.from.x) * 100) / 100;
12286
12342
  const dy = Math.round((this.doc(e).y - m.from.y) * 100) / 100;
@@ -12304,8 +12360,8 @@ var PaintGesture = (_class20 = class {
12304
12360
  cancel() {
12305
12361
  this.penDown = false;
12306
12362
  this.predicted = [];
12307
- if (_optionalChain([this, 'access', _589 => _589.mode, 'optionalAccess', _590 => _590.kind]) === "stroke") _optionalChain([this, 'access', _591 => _591.controller, 'access', _592 => _592.activeStroke, 'optionalAccess', _593 => _593.cancel, 'call', _594 => _594()]);
12308
- if (_optionalChain([this, 'access', _595 => _595.mode, 'optionalAccess', _596 => _596.kind]) === "sticker") this.controller.cancelStickerPreview();
12363
+ if (_optionalChain([this, 'access', _597 => _597.mode, 'optionalAccess', _598 => _598.kind]) === "stroke") _optionalChain([this, 'access', _599 => _599.controller, 'access', _600 => _600.activeStroke, 'optionalAccess', _601 => _601.cancel, 'call', _602 => _602()]);
12364
+ if (_optionalChain([this, 'access', _603 => _603.mode, 'optionalAccess', _604 => _604.kind]) === "sticker") this.controller.cancelStickerPreview();
12309
12365
  this.mode = null;
12310
12366
  }
12311
12367
  get active() {
@@ -12370,13 +12426,13 @@ function handlePaintShortcut(controller, gesture, e) {
12370
12426
  return true;
12371
12427
  }
12372
12428
  var PaintCanvasPresenter = (_class21 = class {
12373
- constructor(controller) {;_class21.prototype.__init189.call(this);_class21.prototype.__init190.call(this);_class21.prototype.__init191.call(this);
12429
+ constructor(controller) {;_class21.prototype.__init191.call(this);_class21.prototype.__init192.call(this);_class21.prototype.__init193.call(this);
12374
12430
  this.controller = controller;
12375
12431
  }
12376
12432
 
12377
- __init189() {this.uploaded = /* @__PURE__ */ new Map()}
12378
- __init190() {this.scratch = null}
12379
- __init191() {this.size = ""}
12433
+ __init191() {this.uploaded = /* @__PURE__ */ new Map()}
12434
+ __init192() {this.scratch = null}
12435
+ __init193() {this.size = ""}
12380
12436
  /** Draws what changed into `ctx` (a canvas the size of the document); returns the tiles drawn. */
12381
12437
  render(ctx) {
12382
12438
  const { width, height } = this.controller.document.canvas;
@@ -12408,7 +12464,7 @@ function guideOverlay(controller, drag) {
12408
12464
  const size = s.document.canvas;
12409
12465
  const out = [];
12410
12466
  const layerId = s.document.activeLayerId;
12411
- const strokePicked = layerId && s.selectedStroke ? _optionalChain([s, 'access', _597 => _597.document, 'access', _598 => _598.liveStrokes, 'optionalAccess', _599 => _599[layerId], 'optionalAccess', _600 => _600.some, 'call', _601 => _601((x) => x.id === s.selectedStroke)]) : false;
12467
+ const strokePicked = layerId && s.selectedStroke ? _optionalChain([s, 'access', _605 => _605.document, 'access', _606 => _606.liveStrokes, 'optionalAccess', _607 => _607[layerId], 'optionalAccess', _608 => _608.some, 'call', _609 => _609((x) => x.id === s.selectedStroke)]) : false;
12412
12468
  const area = strokePicked ? controller.liveStrokeArea(s.selectedStroke) : null;
12413
12469
  if (area) {
12414
12470
  const dx = drag && drag.id === s.selectedStroke ? drag.dx : 0;
@@ -12421,7 +12477,7 @@ function guideOverlay(controller, drag) {
12421
12477
  ];
12422
12478
  for (let i = 0; i < 4; i++) out.push({ from: box[i], to: box[(i + 1) % 4], kind: "stroke" });
12423
12479
  }
12424
- const picked = layerId && s.selectedSticker ? _optionalChain([s, 'access', _602 => _602.document, 'access', _603 => _603.stickers, 'optionalAccess', _604 => _604[layerId], 'optionalAccess', _605 => _605.find, 'call', _606 => _606((x) => x.id === s.selectedSticker)]) : void 0;
12480
+ const picked = layerId && s.selectedSticker ? _optionalChain([s, 'access', _610 => _610.document, 'access', _611 => _611.stickers, 'optionalAccess', _612 => _612[layerId], 'optionalAccess', _613 => _613.find, 'call', _614 => _614((x) => x.id === s.selectedSticker)]) : void 0;
12425
12481
  if (picked) {
12426
12482
  const r = picked.size / 2 + 2;
12427
12483
  const a = picked.rotation * Math.PI / 180;
@@ -12451,7 +12507,7 @@ var PAPER_SLIDERS = [
12451
12507
  ];
12452
12508
  function readPath(obj, path) {
12453
12509
  let v = obj;
12454
- for (const k of path.split(".")) v = _optionalChain([v, 'optionalAccess', _607 => _607[k]]);
12510
+ for (const k of path.split(".")) v = _optionalChain([v, 'optionalAccess', _615 => _615[k]]);
12455
12511
  return typeof v === "number" ? v : 0;
12456
12512
  }
12457
12513
  function patchPath(obj, path, value) {
@@ -12567,7 +12623,7 @@ function startWetClock(controller, frame, cancel) {
12567
12623
  id = raf(loop);
12568
12624
  return () => {
12569
12625
  stopped = true;
12570
- _optionalChain([caf, 'optionalCall', _608 => _608(id)]);
12626
+ _optionalChain([caf, 'optionalCall', _616 => _616(id)]);
12571
12627
  };
12572
12628
  }
12573
12629
  function drawWaterOverlay(controller, ctx) {
@@ -12598,7 +12654,7 @@ var DOT_ROTATION_LABELS = { follow: "Follow motion", random: "Random", fixed: "T
12598
12654
  var STAMP_LABELS = { dot: "Dot", star: "Star", heart: "Heart", leaf: "Leaf", flower: "Flower", confetti: "Confetti", splat: "Splat", sparkle: "Sparkle", ring: "Ring" };
12599
12655
  function toggleStickerRef(refs, ref2) {
12600
12656
  if (refs.includes(ref2)) return refs.length > 1 ? refs.filter((r) => r !== ref2) : [...refs];
12601
- return refs.length < _chunkTZOX7KWVcjs.MAX_STICKER_STAMPS ? [...refs, ref2] : [...refs];
12657
+ return refs.length < _chunkBY5EBP26cjs.MAX_STICKER_STAMPS ? [...refs, ref2] : [...refs];
12602
12658
  }
12603
12659
  function stickerRefLabel(ref2) {
12604
12660
  const stamp = ref2.startsWith("editor:") ? ref2.slice(7) : null;
@@ -12611,7 +12667,7 @@ function toggleStamp(stamps, stamp) {
12611
12667
  }
12612
12668
  function toggleDotTexture(textures, stamp) {
12613
12669
  if (textures.includes(stamp)) return textures.filter((s) => s !== stamp);
12614
- return textures.length < _chunkTZOX7KWVcjs.MAX_DOT_TEXTURES ? [...textures, stamp] : [...textures];
12670
+ return textures.length < _chunkBY5EBP26cjs.MAX_DOT_TEXTURES ? [...textures, stamp] : [...textures];
12615
12671
  }
12616
12672
  var PATH_STROKE_TAPERS = [
12617
12673
  { id: "even", label: "Even" },
@@ -12925,7 +12981,7 @@ function createPaintChangeFeed(controller, options = {}) {
12925
12981
  const doc = state.document;
12926
12982
  const layers = /* @__PURE__ */ new Map();
12927
12983
  for (const l of controller.listLayers()) layers.set(l.id, { name: l.name, visible: l.visible, opacity: l.opacity, blend: l.blend });
12928
- return { doc, strokes: new Map(doc.strokes.map((s) => [s.id, s])), events: _nullishCoalesce(_optionalChain([doc, 'access', _609 => _609.paintEvents, 'optionalAccess', _610 => _610.length]), () => ( 0)), layers, stroking: state.stroking };
12984
+ return { doc, strokes: new Map(doc.strokes.map((s) => [s.id, s])), events: _nullishCoalesce(_optionalChain([doc, 'access', _617 => _617.paintEvents, 'optionalAccess', _618 => _618.length]), () => ( 0)), layers, stroking: state.stroking };
12929
12985
  };
12930
12986
  let last = take();
12931
12987
  const check = () => {
@@ -12956,7 +13012,7 @@ function createPaintChangeFeed(controller, options = {}) {
12956
13012
  if (edited) pending = void 0;
12957
13013
  const change = {
12958
13014
  seq: ++seq,
12959
- origin: _nullishCoalesce(_optionalChain([commit, 'optionalAccess', _611 => _611.origin]), () => ( "user")),
13015
+ origin: _nullishCoalesce(_optionalChain([commit, 'optionalAccess', _619 => _619.origin]), () => ( "user")),
12960
13016
  ...commit ? { commit } : {},
12961
13017
  addedStrokes,
12962
13018
  removedStrokes,
@@ -13023,7 +13079,7 @@ function createPaintProposals(options) {
13023
13079
  };
13024
13080
  const strokeIds = () => new Set(controller.getStrokes().map((s) => s.id));
13025
13081
  const validate = (input) => {
13026
- if (!_optionalChain([input, 'access', _612 => _612.title, 'optionalAccess', _613 => _613.trim, 'call', _614 => _614()])) throw new PaintEditorError("A proposal needs a title: what it adds, in a few words.");
13082
+ if (!_optionalChain([input, 'access', _620 => _620.title, 'optionalAccess', _621 => _621.trim, 'call', _622 => _622()])) throw new PaintEditorError("A proposal needs a title: what it adds, in a few words.");
13027
13083
  if (!Array.isArray(input.ops) || !input.ops.length) throw new PaintEditorError("A proposal needs at least one op (stroke, wash or echo).");
13028
13084
  const place = _nullishCoalesce(input.place, () => ( "top"));
13029
13085
  if (place === "above") {
@@ -13035,7 +13091,7 @@ function createPaintProposals(options) {
13035
13091
  input.ops.forEach((op, i) => {
13036
13092
  const at = `ops[${i}]`;
13037
13093
  if (op.kind === "stroke") {
13038
- if (!_optionalChain([op, 'access', _615 => _615.points, 'optionalAccess', _616 => _616.length])) throw new PaintEditorError(`${at}: a stroke needs points in document pixels.`);
13094
+ if (!_optionalChain([op, 'access', _623 => _623.points, 'optionalAccess', _624 => _624.length])) throw new PaintEditorError(`${at}: a stroke needs points in document pixels.`);
13039
13095
  points += op.points.length;
13040
13096
  if (op.color !== void 0 && !HEX4.test(op.color)) throw new PaintEditorError(`${at}: color "${op.color}" is not #rrggbb.`);
13041
13097
  const brush = op.brushId ? controller.getBrush(op.brushId) : controller.getState().brush;
@@ -13047,7 +13103,7 @@ function createPaintProposals(options) {
13047
13103
  if (!HEX4.test(_nullishCoalesce(op.color, () => ( "")))) throw new PaintEditorError(`${at}: a wash needs color as #rrggbb.`);
13048
13104
  if (op.opacity !== void 0 && !(op.opacity > 0 && op.opacity <= 1)) throw new PaintEditorError(`${at}: opacity must be in (0, 1].`);
13049
13105
  } else if (op.kind === "echo") {
13050
- if (!_optionalChain([op, 'access', _617 => _617.strokeIds, 'optionalAccess', _618 => _618.length])) throw new PaintEditorError(`${at}: an echo needs strokeIds (list_strokes).`);
13106
+ if (!_optionalChain([op, 'access', _625 => _625.strokeIds, 'optionalAccess', _626 => _626.length])) throw new PaintEditorError(`${at}: an echo needs strokeIds (list_strokes).`);
13051
13107
  const unknown = op.strokeIds.filter((id) => !known.has(id));
13052
13108
  if (unknown.length) throw new PaintEditorError(`${at}: unknown stroke ${unknown.map((u) => `"${u}"`).join(", ")}. Call list_strokes for the ids.`);
13053
13109
  if (op.color !== void 0 && !HEX4.test(op.color)) throw new PaintEditorError(`${at}: color "${op.color}" is not #rrggbb.`);
@@ -13096,7 +13152,7 @@ function createPaintProposals(options) {
13096
13152
  ...input.layerId ? { layerId: input.layerId } : {},
13097
13153
  ...input.layerName ? { layerName: input.layerName } : {}
13098
13154
  });
13099
- const topLayerId = () => _optionalChain([controller, 'access', _619 => _619.listLayers, 'call', _620 => _620(), 'access', _621 => _621.find, 'call', _622 => _622((l) => l.parentId === null), 'optionalAccess', _623 => _623.id]);
13155
+ const topLayerId = () => _optionalChain([controller, 'access', _627 => _627.listLayers, 'call', _628 => _628(), 'access', _629 => _629.find, 'call', _630 => _630((l) => l.parentId === null), 'optionalAccess', _631 => _631.id]);
13100
13156
  return {
13101
13157
  getState: () => state,
13102
13158
  subscribe(listener) {
@@ -13283,7 +13339,7 @@ function createPaintProposalToolProvider(proposals, options = {}) {
13283
13339
  },
13284
13340
  annotations: { title: "Propose paint", ...WRITE6 },
13285
13341
  handler: (args, context) => {
13286
- const origin = _optionalChain([context, 'access', _624 => _624.actor, 'optionalAccess', _625 => _625.id]) ? `agent:${context.actor.id}` : options.fallbackOrigin;
13342
+ const origin = _optionalChain([context, 'access', _632 => _632.actor, 'optionalAccess', _633 => _633.id]) ? `agent:${context.actor.id}` : options.fallbackOrigin;
13287
13343
  const proposal = proposals.propose({ ...args, ...origin ? { origin } : {} });
13288
13344
  const { id: _id, missing: _missing, createdAt: _createdAt, ...rest } = describe(proposal);
13289
13345
  return { proposalId: proposal.id, ...rest };
@@ -13405,7 +13461,7 @@ function toolList(provider) {
13405
13461
  function uiTables() {
13406
13462
  return {
13407
13463
  tools: PAINT_TOOLS,
13408
- brushOptions: _chunk43NT242Dcjs.BRUSH_OPTION_CONTROLS,
13464
+ brushOptions: _chunkKXNZNOEFcjs.BRUSH_OPTION_CONTROLS,
13409
13465
  blendMenu: BLEND_MENU_GROUPS,
13410
13466
  layerEffects: _chunkPVJMTLPJcjs.LAYER_EFFECT_MENU.map(({ kind, label }) => ({ kind, label, controls: _chunkPVJMTLPJcjs.layerEffectControls.call(void 0, _chunkPVJMTLPJcjs.defaultLayerEffect.call(void 0, kind, kind)) })),
13411
13467
  sliders: { paper: PAPER_SLIDERS, wet: WET_PARAM_SLIDERS, wetTilt: WET_TILT_SLIDERS, wetSpeed: WET_SPEED_SLIDER, light: LIGHT_SLIDERS, stroke: STROKE_SLIDERS, sticker: STICKER_SLIDERS },
@@ -13831,4 +13887,5 @@ function createPaintConformanceHost(setup, options) {
13831
13887
 
13832
13888
 
13833
13889
 
13834
- exports.BACKLIGHT_SPILL = BACKLIGHT_SPILL; exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunk2VX55NFMcjs.BLEND_MODES; exports.BRUSH_ID = _chunkTZOX7KWVcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkTZOX7KWVcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = _chunkPYTJBVW5cjs.BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkTZOX7KWVcjs.BUILTIN_BRUSHES; exports.BristleStroke = BristleStroke; exports.DEFAULT_BACKLIGHT_COLOR = DEFAULT_BACKLIGHT_COLOR; exports.DEFAULT_BEHAVIOR = _chunkTZOX7KWVcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkTZOX7KWVcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkTZOX7KWVcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkTZOX7KWVcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkYHDHFJUCcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkTZOX7KWVcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHT = _chunkTZOX7KWVcjs.DEFAULT_LIGHT; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkTZOX7KWVcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkFQPUF2W2cjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkFQPUF2W2cjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkTZOX7KWVcjs.DEFAULT_PARTICLE; exports.DEFAULT_SPRAY = _chunkTZOX7KWVcjs.DEFAULT_SPRAY; exports.DEFAULT_STICKER = _chunkTZOX7KWVcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkTZOX7KWVcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkYHDHFJUCcjs.DEFAULT_WET_PARAMS; exports.DOT_ROTATIONS = _chunkTZOX7KWVcjs.DOT_ROTATIONS; exports.DOT_ROTATION_LABELS = DOT_ROTATION_LABELS; exports.DOT_TEXTURE_ORDERS = _chunkTZOX7KWVcjs.DOT_TEXTURE_ORDERS; exports.DOT_TEXTURE_ORDER_LABELS = DOT_TEXTURE_ORDER_LABELS; exports.DryStroke = DryStroke; exports.EFFECT_MAP_REPEATS = EFFECT_MAP_REPEATS; exports.EFFECT_STRIP_HEIGHT = EFFECT_STRIP_HEIGHT; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkPXDIAYB6cjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkPXDIAYB6cjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunkI3Y2Q3PMcjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkTZOX7KWVcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LIVE_STROKE_ENGINES = LIVE_STROKE_ENGINES; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkFQPUF2W2cjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_DOT_TEXTURES = _chunkTZOX7KWVcjs.MAX_DOT_TEXTURES; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_LIVE_EFFECT_SOURCES = MAX_LIVE_EFFECT_SOURCES; exports.MAX_PATH_SAMPLES = MAX_PATH_SAMPLES; exports.MAX_STICKER_STAMPS = _chunkTZOX7KWVcjs.MAX_STICKER_STAMPS; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkTZOX7KWVcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunk2VX55NFMcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkTZOX7KWVcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkTZOX7KWVcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkFQPUF2W2cjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_CONTRACT_FORMAT_VERSION = PAINT_CONTRACT_FORMAT_VERSION; exports.PAINT_DOCUMENT_JSON_SCHEMA = PAINT_DOCUMENT_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkFQPUF2W2cjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkFQPUF2W2cjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkFQPUF2W2cjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkFQPUF2W2cjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SHORTCUTS = PAINT_SHORTCUTS; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkFQPUF2W2cjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TARGET = PAINT_TARGET; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = PAPER_FAMILIES; exports.PAPER_LIBRARY = PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkTZOX7KWVcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkTZOX7KWVcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PATH_STROKE_TAPERS = PATH_STROKE_TAPERS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkFQPUF2W2cjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkFQPUF2W2cjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkPXDIAYB6cjs.PaperGrain; exports.ParticleStroke = ParticleStroke; exports.PenDabWalker = PenDabWalker; exports.PenSmoother = PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.RIBBON_PAIRS = _chunkTZOX7KWVcjs.RIBBON_PAIRS; exports.RIBBON_PAIR_LABELS = RIBBON_PAIR_LABELS; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkJSDND7DFcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_ART_SIZE = STICKER_ART_SIZE; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.STROKE_SLIDERS = STROKE_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerArtCache = StickerArtCache; exports.StickerBrowser = _chunkRVGP2XLFcjs.StickerBrowser; exports.StickerSpray = StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunk3K6HWEXZcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkYHDHFJUCcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkTZOX7KWVcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkYHDHFJUCcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkTZOX7KWVcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkFQPUF2W2cjs.addPaintGradientStop; exports.addPolygonArea = addPolygonArea; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.backlightOf = backlightOf; exports.brushEngineControls = _chunkPYTJBVW5cjs.brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkTZOX7KWVcjs.brushTakesPaint; exports.brushToJSON = _chunkTZOX7KWVcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintAgentStrokes = createPaintAgentStrokes; exports.createPaintBrushLibraryToolProvider = createPaintBrushLibraryToolProvider; exports.createPaintChangeFeed = createPaintChangeFeed; exports.createPaintCompositor = createPaintCompositor; exports.createPaintConformanceHost = createPaintConformanceHost; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintProposalToolProvider = createPaintProposalToolProvider; exports.createPaintProposals = createPaintProposals; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.defaultStickerRasterizer = defaultStickerRasterizer; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectDabField = effectDabField; exports.effectLayersToJSON = effectLayersToJSON; exports.effectPaintKey = effectPaintKey; exports.effectPaintSize = effectPaintSize; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkPXDIAYB6cjs.grainCatch; exports.grainHeights = _chunkPXDIAYB6cjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunk3K6HWEXZcjs.hash2; exports.hexToPaintRgb = _chunkFQPUF2W2cjs.hexToPaintRgb; exports.hexToRgb8 = hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunkI3Y2Q3PMcjs.hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunk2VX55NFMcjs.isBlendMode; exports.isGradientPaint = _chunkFQPUF2W2cjs.isGradientPaint; exports.isPaintEffectPaint = isPaintEffectPaint; exports.isPainterlyBlendMode = _chunk2VX55NFMcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkTZOX7KWVcjs.isWetBrush; exports.isWetCapable = _chunkTZOX7KWVcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.liveStrokeBounds = liveStrokeBounds; exports.liveStrokeRefusal = liveStrokeRefusal; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunk3K6HWEXZcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = _chunkPYTJBVW5cjs.multiColorSliders; exports.multiColorToPaint = _chunkTZOX7KWVcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkTZOX7KWVcjs.normalizeBehavior; exports.normalizeBristle = _chunkTZOX7KWVcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkTZOX7KWVcjs.normalizeDynamics; exports.normalizeFlow = _chunkYHDHFJUCcjs.normalizeFlow; exports.normalizeHexColor = _chunkFQPUF2W2cjs.normalizeHexColor; exports.normalizeImpasto = _chunkTZOX7KWVcjs.normalizeImpasto; exports.normalizeLight = _chunkTZOX7KWVcjs.normalizeLight; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkTZOX7KWVcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkTZOX7KWVcjs.normalizePaintBrush; exports.normalizePaper = normalizePaper; exports.normalizeParticle = _chunkTZOX7KWVcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkTZOX7KWVcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkTZOX7KWVcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkYHDHFJUCcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintAgentStrokePoints = paintAgentStrokePoints; exports.paintContracts = paintContracts; exports.paintGradientMappingFor = _chunkFQPUF2W2cjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintProposalGhost = paintProposalGhost; exports.paintShortcutFor = paintShortcutFor; exports.paintSourceColor = _chunkFQPUF2W2cjs.paintSourceColor; exports.paintSourceCss = _chunkFQPUF2W2cjs.paintSourceCss; exports.paintToMultiColor = _chunkTZOX7KWVcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = paperPreset; exports.parseBrushLibrary = _chunkTZOX7KWVcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkFQPUF2W2cjs.parsePaintSource; exports.patchBrushValue = _chunkPYTJBVW5cjs.patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunk3K6HWEXZcjs.rand01; exports.randSigned = _chunk3K6HWEXZcjs.randSigned; exports.readEffectStrokeMap = readEffectStrokeMap; exports.readPaintEffectPaint = readPaintEffectPaint; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkFQPUF2W2cjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkFQPUF2W2cjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = renderPaper; exports.renderStickers = renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkFQPUF2W2cjs.resolvePaintGradient; exports.reversePaintGradient = _chunkFQPUF2W2cjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.sampleArt = sampleArt; exports.sampleEffectAt = sampleEffectAt; exports.sampleEffectField = sampleEffectField; exports.samplePath = samplePath; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkFQPUF2W2cjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunk3K6HWEXZcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkFQPUF2W2cjs.solidPaint; exports.stampCoverage = _chunkJSDND7DFcjs.stampCoverage; exports.standardBlendMode = _chunk2VX55NFMcjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerAt = stickerAt; exports.stickerRect = stickerRect; exports.stickerRefLabel = stickerRefLabel; exports.stickerStamp = stickerStamp; exports.stickerSurface = stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.strokeToJSON = strokeToJSON; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = toStrokePoint; exports.toggleDotTexture = toggleDotTexture; exports.toggleStamp = toggleStamp; exports.toggleStickerRef = toggleStickerRef; exports.translateStencil = translateStencil; exports.updatePaintGradientStop = _chunkFQPUF2W2cjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkTZOX7KWVcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = wetPaperInput; exports.wetPigmentOf = wetPigmentOf; exports.wetSupport = _chunkYHDHFJUCcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunkI3Y2Q3PMcjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback;
13890
+
13891
+ exports.BACKLIGHT_SPILL = BACKLIGHT_SPILL; exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunk2VX55NFMcjs.BLEND_MODES; exports.BRUSH_ID = _chunkBY5EBP26cjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkBY5EBP26cjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = _chunkF3KKR6DDcjs.BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkBY5EBP26cjs.BUILTIN_BRUSHES; exports.BristleStroke = BristleStroke; exports.DEFAULT_BACKLIGHT_COLOR = DEFAULT_BACKLIGHT_COLOR; exports.DEFAULT_BEHAVIOR = _chunkBY5EBP26cjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkBY5EBP26cjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkBY5EBP26cjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkBY5EBP26cjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkYHDHFJUCcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkBY5EBP26cjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHT = _chunkBY5EBP26cjs.DEFAULT_LIGHT; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkBY5EBP26cjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkFQPUF2W2cjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkFQPUF2W2cjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkBY5EBP26cjs.DEFAULT_PARTICLE; exports.DEFAULT_SPRAY = _chunkBY5EBP26cjs.DEFAULT_SPRAY; exports.DEFAULT_STICKER = _chunkBY5EBP26cjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkBY5EBP26cjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkYHDHFJUCcjs.DEFAULT_WET_PARAMS; exports.DOT_ROTATIONS = _chunkBY5EBP26cjs.DOT_ROTATIONS; exports.DOT_ROTATION_LABELS = DOT_ROTATION_LABELS; exports.DOT_TEXTURE_ORDERS = _chunkBY5EBP26cjs.DOT_TEXTURE_ORDERS; exports.DOT_TEXTURE_ORDER_LABELS = DOT_TEXTURE_ORDER_LABELS; exports.DryStroke = DryStroke; exports.EFFECT_MAP_REPEATS = EFFECT_MAP_REPEATS; exports.EFFECT_STRIP_HEIGHT = EFFECT_STRIP_HEIGHT; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkPXDIAYB6cjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkPXDIAYB6cjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunkI3Y2Q3PMcjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkBY5EBP26cjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LIVE_STROKE_ENGINES = LIVE_STROKE_ENGINES; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkFQPUF2W2cjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_DOT_TEXTURES = _chunkBY5EBP26cjs.MAX_DOT_TEXTURES; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_LIVE_EFFECT_SOURCES = MAX_LIVE_EFFECT_SOURCES; exports.MAX_PATH_SAMPLES = MAX_PATH_SAMPLES; exports.MAX_STICKER_STAMPS = _chunkBY5EBP26cjs.MAX_STICKER_STAMPS; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkBY5EBP26cjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunk2VX55NFMcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkBY5EBP26cjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkBY5EBP26cjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkFQPUF2W2cjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_CONTRACT_FORMAT_VERSION = PAINT_CONTRACT_FORMAT_VERSION; exports.PAINT_DOCUMENT_JSON_SCHEMA = PAINT_DOCUMENT_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkFQPUF2W2cjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkFQPUF2W2cjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkFQPUF2W2cjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkFQPUF2W2cjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkFQPUF2W2cjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SHORTCUTS = PAINT_SHORTCUTS; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkFQPUF2W2cjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TARGET = PAINT_TARGET; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = PAPER_FAMILIES; exports.PAPER_LIBRARY = PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkBY5EBP26cjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkBY5EBP26cjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PATH_STROKE_TAPERS = PATH_STROKE_TAPERS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkFQPUF2W2cjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkFQPUF2W2cjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkPXDIAYB6cjs.PaperGrain; exports.ParticleStroke = ParticleStroke; exports.PenDabWalker = PenDabWalker; exports.PenSmoother = PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.RIBBON_PAIRS = _chunkBY5EBP26cjs.RIBBON_PAIRS; exports.RIBBON_PAIR_LABELS = RIBBON_PAIR_LABELS; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkOTN6VB5Scjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_ART_SIZE = STICKER_ART_SIZE; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.STROKE_SLIDERS = STROKE_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerArtCache = StickerArtCache; exports.StickerBrowser = _chunkXORJ7UZOcjs.StickerBrowser; exports.StickerSpray = StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunk3K6HWEXZcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkYHDHFJUCcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkBY5EBP26cjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkYHDHFJUCcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkBY5EBP26cjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkFQPUF2W2cjs.addPaintGradientStop; exports.addPolygonArea = addPolygonArea; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.backlightOf = backlightOf; exports.brushEngineControls = _chunkF3KKR6DDcjs.brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkBY5EBP26cjs.brushTakesPaint; exports.brushToJSON = _chunkBY5EBP26cjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintAgentStrokes = createPaintAgentStrokes; exports.createPaintBrushLibraryToolProvider = createPaintBrushLibraryToolProvider; exports.createPaintChangeFeed = createPaintChangeFeed; exports.createPaintCompositor = createPaintCompositor; exports.createPaintConformanceHost = createPaintConformanceHost; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintProposalToolProvider = createPaintProposalToolProvider; exports.createPaintProposals = createPaintProposals; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.defaultStickerRasterizer = defaultStickerRasterizer; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectDabField = effectDabField; exports.effectLayersToJSON = effectLayersToJSON; exports.effectPaintKey = effectPaintKey; exports.effectPaintSize = effectPaintSize; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkPXDIAYB6cjs.grainCatch; exports.grainHeights = _chunkPXDIAYB6cjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunk3K6HWEXZcjs.hash2; exports.hexToPaintRgb = _chunkFQPUF2W2cjs.hexToPaintRgb; exports.hexToRgb8 = hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunkI3Y2Q3PMcjs.hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunk2VX55NFMcjs.isBlendMode; exports.isGradientPaint = _chunkFQPUF2W2cjs.isGradientPaint; exports.isPaintEffectPaint = isPaintEffectPaint; exports.isPainterlyBlendMode = _chunk2VX55NFMcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkBY5EBP26cjs.isWetBrush; exports.isWetCapable = _chunkBY5EBP26cjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.liveStrokeBounds = liveStrokeBounds; exports.liveStrokeRefusal = liveStrokeRefusal; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunk3K6HWEXZcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = _chunkF3KKR6DDcjs.multiColorSliders; exports.multiColorToPaint = _chunkBY5EBP26cjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkBY5EBP26cjs.normalizeBehavior; exports.normalizeBristle = _chunkBY5EBP26cjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkBY5EBP26cjs.normalizeDynamics; exports.normalizeFlow = _chunkYHDHFJUCcjs.normalizeFlow; exports.normalizeHexColor = _chunkFQPUF2W2cjs.normalizeHexColor; exports.normalizeImpasto = _chunkBY5EBP26cjs.normalizeImpasto; exports.normalizeLight = _chunkBY5EBP26cjs.normalizeLight; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkBY5EBP26cjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkBY5EBP26cjs.normalizePaintBrush; exports.normalizePaper = normalizePaper; exports.normalizeParticle = _chunkBY5EBP26cjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkBY5EBP26cjs.normalizeStickerSettings; exports.normalizeStickerUpdate = normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkBY5EBP26cjs.normalizeWetBrush; exports.normalizeWetParams = _chunkYHDHFJUCcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintAgentStrokePoints = paintAgentStrokePoints; exports.paintBrushPreviewRenderer = paintBrushPreviewRenderer; exports.paintContracts = paintContracts; exports.paintGradientMappingFor = _chunkFQPUF2W2cjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintProposalGhost = paintProposalGhost; exports.paintShortcutFor = paintShortcutFor; exports.paintSourceColor = _chunkFQPUF2W2cjs.paintSourceColor; exports.paintSourceCss = _chunkFQPUF2W2cjs.paintSourceCss; exports.paintToMultiColor = _chunkBY5EBP26cjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = paperPreset; exports.parseBrushLibrary = _chunkBY5EBP26cjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkFQPUF2W2cjs.parsePaintSource; exports.patchBrushValue = _chunkF3KKR6DDcjs.patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunk3K6HWEXZcjs.rand01; exports.randSigned = _chunk3K6HWEXZcjs.randSigned; exports.readEffectStrokeMap = readEffectStrokeMap; exports.readPaintEffectPaint = readPaintEffectPaint; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkFQPUF2W2cjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkFQPUF2W2cjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = renderPaper; exports.renderStickers = renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkFQPUF2W2cjs.resolvePaintGradient; exports.reversePaintGradient = _chunkFQPUF2W2cjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.sampleArt = sampleArt; exports.sampleEffectAt = sampleEffectAt; exports.sampleEffectField = sampleEffectField; exports.samplePath = samplePath; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkFQPUF2W2cjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunk3K6HWEXZcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkFQPUF2W2cjs.solidPaint; exports.stampCoverage = _chunkOTN6VB5Scjs.stampCoverage; exports.standardBlendMode = _chunk2VX55NFMcjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerAt = stickerAt; exports.stickerRect = stickerRect; exports.stickerRefLabel = stickerRefLabel; exports.stickerStamp = stickerStamp; exports.stickerSurface = stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.strokeToJSON = strokeToJSON; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = toStrokePoint; exports.toggleDotTexture = toggleDotTexture; exports.toggleStamp = toggleStamp; exports.toggleStickerRef = toggleStickerRef; exports.translateStencil = translateStencil; exports.updatePaintGradientStop = _chunkFQPUF2W2cjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkBY5EBP26cjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = wetPaperInput; exports.wetPigmentOf = wetPigmentOf; exports.wetSupport = _chunkYHDHFJUCcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunkI3Y2Q3PMcjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback;