@pixerate/editor 0.124.0 → 0.124.1

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 (41) hide show
  1. package/dist/{chunk-IWSMDQE5.cjs → chunk-4QQZV5Y5.cjs} +18 -29
  2. package/dist/chunk-4QQZV5Y5.cjs.map +1 -0
  3. package/dist/{chunk-IOXKXQNW.cjs → chunk-CN4PJHUG.cjs} +59 -3
  4. package/dist/chunk-CN4PJHUG.cjs.map +1 -0
  5. package/dist/{chunk-TK53AB4Q.cjs → chunk-FHYDQOPC.cjs} +3 -3
  6. package/dist/{chunk-TK53AB4Q.cjs.map → chunk-FHYDQOPC.cjs.map} +1 -1
  7. package/dist/{chunk-VFAKN46Z.js → chunk-JRXJTPES.js} +2 -2
  8. package/dist/{chunk-YVVSTD3B.js → chunk-ORHMVUR6.js} +8 -19
  9. package/dist/chunk-ORHMVUR6.js.map +1 -0
  10. package/dist/{chunk-TGKT5QAB.js → chunk-QEG3GRN2.js} +58 -2
  11. package/dist/chunk-QEG3GRN2.js.map +1 -0
  12. package/dist/effects/index.cjs +51 -34
  13. package/dist/effects/index.cjs.map +1 -1
  14. package/dist/effects/index.d.cts +35 -3
  15. package/dist/effects/index.d.ts +35 -3
  16. package/dist/effects/index.js +20 -3
  17. package/dist/effects/index.js.map +1 -1
  18. package/dist/{export-8RnlngAv.d.ts → export-BGtXgMJ3.d.ts} +3 -1
  19. package/dist/{export-DM3h7QEI.d.ts → export-BdfY_lH0.d.ts} +4 -2
  20. package/dist/{export-BzSRXyH6.d.cts → export-CbpjwxaI.d.cts} +4 -2
  21. package/dist/{export-TqXMOlDt.d.cts → export-WmYoWmLM.d.cts} +3 -1
  22. package/dist/image-editor/index.cjs +110 -121
  23. package/dist/image-editor/index.cjs.map +1 -1
  24. package/dist/image-editor/index.d.cts +2 -2
  25. package/dist/image-editor/index.d.ts +2 -2
  26. package/dist/image-editor/index.js +7 -18
  27. package/dist/image-editor/index.js.map +1 -1
  28. package/dist/paint-editor/index.cjs +3 -3
  29. package/dist/paint-editor/index.d.cts +2 -2
  30. package/dist/paint-editor/index.d.ts +2 -2
  31. package/dist/paint-editor/index.js +2 -2
  32. package/dist/video-editor/index.cjs +270 -270
  33. package/dist/video-editor/index.d.cts +2 -2
  34. package/dist/video-editor/index.d.ts +2 -2
  35. package/dist/video-editor/index.js +3 -3
  36. package/package.json +1 -1
  37. package/dist/chunk-IOXKXQNW.cjs.map +0 -1
  38. package/dist/chunk-IWSMDQE5.cjs.map +0 -1
  39. package/dist/chunk-TGKT5QAB.js.map +0 -1
  40. package/dist/chunk-YVVSTD3B.js.map +0 -1
  41. /package/dist/{chunk-VFAKN46Z.js.map → chunk-JRXJTPES.js.map} +0 -0
@@ -371,14 +371,15 @@ var _chunk2YQONY6Gcjs = require('../chunk-2YQONY6G.cjs');
371
371
  var _chunkD6FH2YAXcjs = require('../chunk-D6FH2YAX.cjs');
372
372
 
373
373
 
374
- var _chunkTK53AB4Qcjs = require('../chunk-TK53AB4Q.cjs');
374
+ var _chunkFHYDQOPCcjs = require('../chunk-FHYDQOPC.cjs');
375
375
 
376
376
 
377
377
 
378
378
 
379
379
 
380
380
 
381
- var _chunkIOXKXQNWcjs = require('../chunk-IOXKXQNW.cjs');
381
+
382
+ var _chunkCN4PJHUGcjs = require('../chunk-CN4PJHUG.cjs');
382
383
  require('../chunk-RIWPYSKU.cjs');
383
384
 
384
385
 
@@ -2796,7 +2797,7 @@ function checkImageEffectPlace(d, place) {
2796
2797
  const allowed = IMAGE_EFFECT_PLACES[place];
2797
2798
  if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
2798
2799
  const instead = place === "filter" && d.uses.some((u) => IMAGE_EFFECT_PLACES.layer.includes(u)) ? "; add it as an effect layer with add_effect_layer instead" : place === "layer" && d.uses.includes("filter") ? "; apply it to a layer as a smart filter with apply_effect instead" : "";
2799
- throw new (0, _chunkIOXKXQNWcjs.EffectUnsupportedError)(
2800
+ throw new (0, _chunkCN4PJHUGcjs.EffectUnsupportedError)(
2800
2801
  `"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect, and ${place === "filter" ? "a smart filter takes filter effects" : "an effect layer takes generator, overlay or title effects"}${instead}.`,
2801
2802
  d.id
2802
2803
  );
@@ -2820,9 +2821,9 @@ function effectPixelsToSurface(p, depth) {
2820
2821
  const d = new Uint16Array(f.length);
2821
2822
  const code = (v) => v > 0 ? v < 1 ? Math.round(v * 65535) : 65535 : 0;
2822
2823
  for (let i = 0; i < f.length; i += 4) {
2823
- d[i] = code(_chunkIOXKXQNWcjs.linearToSrgb.call(void 0, f[i]));
2824
- d[i + 1] = code(_chunkIOXKXQNWcjs.linearToSrgb.call(void 0, f[i + 1]));
2825
- d[i + 2] = code(_chunkIOXKXQNWcjs.linearToSrgb.call(void 0, f[i + 2]));
2824
+ d[i] = code(_chunkCN4PJHUGcjs.linearToSrgb.call(void 0, f[i]));
2825
+ d[i + 1] = code(_chunkCN4PJHUGcjs.linearToSrgb.call(void 0, f[i + 1]));
2826
+ d[i + 2] = code(_chunkCN4PJHUGcjs.linearToSrgb.call(void 0, f[i + 2]));
2826
2827
  d[i + 3] = code(f[i + 3]);
2827
2828
  }
2828
2829
  return _chunkJ5BA3BQ6cjs.surfaceFromDeepPixels.call(void 0, { width: p.width, height: p.height, data: d }, 4);
@@ -2832,15 +2833,16 @@ var ImageEffectsEngine = (_class4 = class {
2832
2833
  __init26() {this.cache = /* @__PURE__ */ new Map()}
2833
2834
  __init27() {this.pending = /* @__PURE__ */ new Map()}
2834
2835
  __init28() {this.failures = /* @__PURE__ */ new Map()}
2835
- __init29() {this.renderers = /* @__PURE__ */ new Map()}
2836
- __init30() {this.descriptions = /* @__PURE__ */ new Map()}
2837
- __init31() {this.listeners = /* @__PURE__ */ new Set()}
2838
2836
 
2839
- __init32() {this.generation = 0}
2837
+ __init29() {this.descriptions = /* @__PURE__ */ new Map()}
2838
+ __init30() {this.listeners = /* @__PURE__ */ new Set()}
2839
+
2840
+ __init31() {this.generation = 0}
2840
2841
 
2841
- constructor(options = {}) {;_class4.prototype.__init26.call(this);_class4.prototype.__init27.call(this);_class4.prototype.__init28.call(this);_class4.prototype.__init29.call(this);_class4.prototype.__init30.call(this);_class4.prototype.__init31.call(this);_class4.prototype.__init32.call(this);
2842
- this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkIOXKXQNWcjs.EffectsSlot)()));
2842
+ constructor(options = {}) {;_class4.prototype.__init26.call(this);_class4.prototype.__init27.call(this);_class4.prototype.__init28.call(this);_class4.prototype.__init29.call(this);_class4.prototype.__init30.call(this);_class4.prototype.__init31.call(this);
2843
+ this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkCN4PJHUGcjs.EffectsSlot)()));
2843
2844
  this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 24));
2845
+ this.pool = new (0, _chunkCN4PJHUGcjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
2844
2846
  this.detach = this.slot.subscribe(() => {
2845
2847
  this.reset();
2846
2848
  this.notify();
@@ -2898,7 +2900,7 @@ var ImageEffectsEngine = (_class4 = class {
2898
2900
  const provider = this.slot.require();
2899
2901
  const depth = _nullishCoalesce(size.depth, () => ( 8));
2900
2902
  const out = await this.render(provider, effect, size.width, size.height, depth, { time: _nullishCoalesce(size.time, () => ( 0)), values });
2901
- return out.width === size.width && out.height === size.height ? out : _chunkIOXKXQNWcjs.createEffectPixels.call(void 0, size.width, size.height);
2903
+ return out.width === size.width && out.height === size.height ? out : _chunkCN4PJHUGcjs.createEffectPixels.call(void 0, size.width, size.height);
2902
2904
  }
2903
2905
  /** Why the result for `key` failed, if it did. */
2904
2906
  failure(key) {
@@ -2923,18 +2925,7 @@ var ImageEffectsEngine = (_class4 = class {
2923
2925
  return d;
2924
2926
  }
2925
2927
  render(provider, id, width, height, depth, request) {
2926
- const k = `${id}@${width}x${height}x${depth}`;
2927
- let r = this.renderers.get(k);
2928
- if (!r) {
2929
- const renderer = Promise.resolve().then(() => provider.createRenderer(id, { width, height, depth }));
2930
- renderer.catch(() => this.renderers.delete(k));
2931
- r = { renderer, queue: Promise.resolve() };
2932
- this.renderers.set(k, r);
2933
- }
2934
- const entry = r;
2935
- const next = entry.queue.then(() => entry.renderer).then((renderer) => renderer.render(request));
2936
- entry.queue = next.catch(() => void 0);
2937
- return next;
2928
+ return this.pool.render(provider, id, { width, height, depth }, request);
2938
2929
  }
2939
2930
  /** Forgets every result and failure and disposes the renderers. */
2940
2931
  reset() {
@@ -2943,9 +2934,7 @@ var ImageEffectsEngine = (_class4 = class {
2943
2934
  this.pending.clear();
2944
2935
  this.failures.clear();
2945
2936
  this.descriptions.clear();
2946
- for (const r of this.renderers.values()) r.renderer.then((x) => x.dispose(), () => {
2947
- });
2948
- this.renderers.clear();
2937
+ this.pool.clear();
2949
2938
  }
2950
2939
  subscribe(listener) {
2951
2940
  this.listeners.add(listener);
@@ -3042,7 +3031,7 @@ function liftMask(mask, sel, o) {
3042
3031
  return { lifted: _chunkJ5BA3BQ6cjs.surfaceFromPixels.call(void 0, { width: area.width, height: area.height, data: lifted }, 4, area.x, area.y), rest: _chunkJ5BA3BQ6cjs.writeRegion.call(void 0, mask, area, rest) };
3043
3032
  }
3044
3033
  var FreeTransformSession = (_class5 = class {
3045
- constructor(host, init = {}) {;_class5.prototype.__init33.call(this);_class5.prototype.__init34.call(this);_class5.prototype.__init35.call(this);_class5.prototype.__init36.call(this);_class5.prototype.__init37.call(this);_class5.prototype.__init38.call(this);_class5.prototype.__init39.call(this);_class5.prototype.__init40.call(this);_class5.prototype.__init41.call(this);_class5.prototype.__init42.call(this);_class5.prototype.__init43.call(this);
3034
+ constructor(host, init = {}) {;_class5.prototype.__init32.call(this);_class5.prototype.__init33.call(this);_class5.prototype.__init34.call(this);_class5.prototype.__init35.call(this);_class5.prototype.__init36.call(this);_class5.prototype.__init37.call(this);_class5.prototype.__init38.call(this);_class5.prototype.__init39.call(this);_class5.prototype.__init40.call(this);_class5.prototype.__init41.call(this);_class5.prototype.__init42.call(this);
3046
3035
  this.host = host;
3047
3036
  if (init.interpolation !== void 0 && !_chunkMZXQTKUMcjs.isInterpolation.call(void 0, init.interpolation)) fail(`Unknown interpolation "${String(init.interpolation)}"; use nearest, bilinear or bicubic.`);
3048
3037
  this.interp = _nullishCoalesce(init.interpolation, () => ( "bicubic"));
@@ -3209,7 +3198,7 @@ var FreeTransformSession = (_class5 = class {
3209
3198
  /** The layer being transformed (`null` for `selection-outline`). */
3210
3199
 
3211
3200
  /** The new layer of a `selection-copy`. */
3212
- __init33() {this.copyId = null}
3201
+ __init32() {this.copyId = null}
3213
3202
  /** The frame (document pixels). */
3214
3203
 
3215
3204
  /** What moves. */
@@ -3221,27 +3210,27 @@ var FreeTransformSession = (_class5 = class {
3221
3210
  */
3222
3211
 
3223
3212
  /** True when the layer is a smart object (the transform sets its placement). */
3224
- __init34() {this.smartObject = false}
3213
+ __init33() {this.smartObject = false}
3225
3214
  /** True when the layer is a shape layer (the transform maps its paths and renders them again). */
3226
- __init35() {this.shapeLayer = false}
3227
- __init36() {this.shape = null}
3215
+ __init34() {this.shapeLayer = false}
3216
+ __init35() {this.shape = null}
3228
3217
  /** True when the layer is a type layer (the transform sets its text matrix; affine only). */
3229
- __init37() {this.typeLayer = false}
3230
- __init38() {this.typeTarget = null}
3218
+ __init36() {this.typeLayer = false}
3219
+ __init37() {this.typeTarget = null}
3231
3220
 
3232
- __init39() {this.smart = null}
3233
- __init40() {this.smartReduced = /* @__PURE__ */ new Map()}
3221
+ __init38() {this.smart = null}
3222
+ __init39() {this.smartReduced = /* @__PURE__ */ new Map()}
3234
3223
 
3235
- __init41() {this.smartMasksMoved = false}
3224
+ __init40() {this.smartMasksMoved = false}
3236
3225
 
3237
- __init42() {this.parts = []}
3226
+ __init41() {this.parts = []}
3238
3227
 
3239
3228
 
3240
3229
 
3241
3230
 
3242
3231
  /** The stack this session last showed: anything else means the document changed under it. */
3243
3232
 
3244
- __init43() {this.closed = false}
3233
+ __init42() {this.closed = false}
3245
3234
  /** The current geometry. */
3246
3235
  get geometry() {
3247
3236
  return this.geometryValue;
@@ -3672,7 +3661,7 @@ function defaultTile(s) {
3672
3661
  return d;
3673
3662
  }
3674
3663
  var PaintStrokeSession = (_class6 = class {
3675
- constructor(controller, target, stroke, apply, depth = null) {;_class6.prototype.__init44.call(this);_class6.prototype.__init45.call(this);_class6.prototype.__init46.call(this);_class6.prototype.__init47.call(this);_class6.prototype.__init48.call(this);_class6.prototype.__init49.call(this);_class6.prototype.__init50.call(this);_class6.prototype.__init51.call(this);_class6.prototype.__init52.call(this);_class6.prototype.__init53.call(this);_class6.prototype.__init54.call(this);
3664
+ constructor(controller, target, stroke, apply, depth = null) {;_class6.prototype.__init43.call(this);_class6.prototype.__init44.call(this);_class6.prototype.__init45.call(this);_class6.prototype.__init46.call(this);_class6.prototype.__init47.call(this);_class6.prototype.__init48.call(this);_class6.prototype.__init49.call(this);_class6.prototype.__init50.call(this);_class6.prototype.__init51.call(this);_class6.prototype.__init52.call(this);_class6.prototype.__init53.call(this);
3676
3665
  this.controller = controller;
3677
3666
  this.target = target;
3678
3667
  this.apply = apply;
@@ -3709,28 +3698,28 @@ var PaintStrokeSession = (_class6 = class {
3709
3698
 
3710
3699
 
3711
3700
 
3712
- __init44() {this.touched = /* @__PURE__ */ new Set()}
3701
+ __init43() {this.touched = /* @__PURE__ */ new Set()}
3713
3702
 
3714
3703
 
3715
- __init45() {this.mixerInit = null}
3716
- __init46() {this.retouch = null}
3704
+ __init44() {this.mixerInit = null}
3705
+ __init45() {this.retouch = null}
3717
3706
  /** Writes a mask's RGBA view back (sequential retouching on a mask). */
3718
- __init47() {this.flushView = null}
3719
- __init48() {this.started = false}
3707
+ __init46() {this.flushView = null}
3708
+ __init47() {this.started = false}
3720
3709
  /** Mixer tiles written since the last update: they get new tile objects so the compositor sees them change. */
3721
- __init49() {this.fresh = /* @__PURE__ */ new Set()}
3722
- __init50() {this.last = null}
3723
- __init51() {this.closed = false}
3710
+ __init48() {this.fresh = /* @__PURE__ */ new Set()}
3711
+ __init49() {this.last = null}
3712
+ __init50() {this.closed = false}
3724
3713
  /** Brush and eraser strokes on a 16- or 32-bit document: the deep samples of each touched tile. */
3725
3714
 
3726
- __init52() {this.liveDeep = /* @__PURE__ */ new Map()}
3715
+ __init51() {this.liveDeep = /* @__PURE__ */ new Map()}
3727
3716
  /**
3728
3717
  * Mixer Brush, Smudge and Sponge on a 16- or 32-bit layer: they read and write float working
3729
3718
  * tiles on the 8-bit 0..255 sRGB-encoded scale, which keep the fractions bytes would round away.
3730
3719
  */
3731
3720
 
3732
- __init53() {this.work = /* @__PURE__ */ new Map()}
3733
- __init54() {this.workRead = /* @__PURE__ */ new Map()}
3721
+ __init52() {this.work = /* @__PURE__ */ new Map()}
3722
+ __init53() {this.workRead = /* @__PURE__ */ new Map()}
3734
3723
  /** The pre-stroke tile as a float working tile (cached; `null`: transparent). */
3735
3724
  readWork(key) {
3736
3725
  if (!this.workRead.has(key)) this.workRead.set(key, workTileOf(this.base.tiles.get(key)));
@@ -4055,31 +4044,31 @@ var DEVELOP_KEYS = ["brightness", "contrast", "saturation", "exposure", "tempera
4055
4044
  var ImageEditorController = (_class7 = class {
4056
4045
 
4057
4046
 
4058
- __init55() {this.imageElement = null}
4059
- __init56() {this.listeners = /* @__PURE__ */ new Set()}
4060
- __init57() {this.histogramListeners = /* @__PURE__ */ new Set()}
4047
+ __init54() {this.imageElement = null}
4048
+ __init55() {this.listeners = /* @__PURE__ */ new Set()}
4049
+ __init56() {this.histogramListeners = /* @__PURE__ */ new Set()}
4061
4050
 
4062
4051
  // History stacks
4063
- __init58() {this.undoStack = []}
4064
- __init59() {this.redoStack = []}
4052
+ __init57() {this.undoStack = []}
4053
+ __init58() {this.redoStack = []}
4065
4054
 
4066
4055
 
4067
- __init60() {this.isApplyingHistory = false}
4056
+ __init59() {this.isApplyingHistory = false}
4068
4057
 
4069
4058
  /** Pixels the selection tools sample (host-provided or read back from the source). */
4070
- __init61() {this.samplePixels = null}
4071
- __init62() {this.samplePixelsOverride = false}
4059
+ __init60() {this.samplePixels = null}
4060
+ __init61() {this.samplePixelsOverride = false}
4072
4061
  /** Decoded source pixels (the Background's surface), by the buffer or element they came from. */
4073
- __init63() {this.sourceSurfaces = /* @__PURE__ */ new WeakMap()}
4074
- __init64() {this.viewKey = []}
4062
+ __init62() {this.sourceSurfaces = /* @__PURE__ */ new WeakMap()}
4063
+ __init63() {this.viewKey = []}
4075
4064
  /** For `compositePixels` and mask evaluation (the renderer keeps its own for the viewport). */
4076
- __init65() {this.compositor = new (0, _chunkPEHYWUVVcjs.LayerCompositor)()}
4065
+ __init64() {this.compositor = new (0, _chunkPEHYWUVVcjs.LayerCompositor)()}
4077
4066
  /** The effects provider slot (see `setEffectsProvider`). */
4078
- __init66() {this.effects = new (0, _chunkIOXKXQNWcjs.EffectsSlot)()}
4067
+ __init65() {this.effects = new (0, _chunkCN4PJHUGcjs.EffectsSlot)()}
4079
4068
  /** Renders provider effects: effect smart filter results and effect layers. */
4080
- __init67() {this.effectsEngine = new ImageEffectsEngine({ slot: this.effects })}
4081
- __init68() {this.effectRefresh = "none"}
4082
- constructor(options = {}) {;_class7.prototype.__init55.call(this);_class7.prototype.__init56.call(this);_class7.prototype.__init57.call(this);_class7.prototype.__init58.call(this);_class7.prototype.__init59.call(this);_class7.prototype.__init60.call(this);_class7.prototype.__init61.call(this);_class7.prototype.__init62.call(this);_class7.prototype.__init63.call(this);_class7.prototype.__init64.call(this);_class7.prototype.__init65.call(this);_class7.prototype.__init66.call(this);_class7.prototype.__init67.call(this);_class7.prototype.__init68.call(this);_class7.prototype.__init69.call(this);_class7.prototype.__init70.call(this);_class7.prototype.__init71.call(this);_class7.prototype.__init72.call(this);_class7.prototype.__init73.call(this);_class7.prototype.__init74.call(this);_class7.prototype.__init75.call(this);_class7.prototype.__init76.call(this);_class7.prototype.__init77.call(this);_class7.prototype.__init78.call(this);_class7.prototype.__init79.call(this);_class7.prototype.__init80.call(this);
4069
+ __init66() {this.effectsEngine = new ImageEffectsEngine({ slot: this.effects })}
4070
+ __init67() {this.effectRefresh = "none"}
4071
+ constructor(options = {}) {;_class7.prototype.__init54.call(this);_class7.prototype.__init55.call(this);_class7.prototype.__init56.call(this);_class7.prototype.__init57.call(this);_class7.prototype.__init58.call(this);_class7.prototype.__init59.call(this);_class7.prototype.__init60.call(this);_class7.prototype.__init61.call(this);_class7.prototype.__init62.call(this);_class7.prototype.__init63.call(this);_class7.prototype.__init64.call(this);_class7.prototype.__init65.call(this);_class7.prototype.__init66.call(this);_class7.prototype.__init67.call(this);_class7.prototype.__init68.call(this);_class7.prototype.__init69.call(this);_class7.prototype.__init70.call(this);_class7.prototype.__init71.call(this);_class7.prototype.__init72.call(this);_class7.prototype.__init73.call(this);_class7.prototype.__init74.call(this);_class7.prototype.__init75.call(this);_class7.prototype.__init76.call(this);_class7.prototype.__init77.call(this);_class7.prototype.__init78.call(this);_class7.prototype.__init79.call(this);
4083
4072
  this.effects.subscribe(() => this.queueEffectRefresh("all"));
4084
4073
  this.effectsEngine.subscribe(() => this.queueEffectRefresh("incomplete"));
4085
4074
  if (options.effects) this.effects.set(options.effects);
@@ -4207,7 +4196,7 @@ var ImageEditorController = (_class7 = class {
4207
4196
  * Where layer pixels changed since the last viewport render, when only strokes changed them
4208
4197
  * (the renderer then recomposites just those rectangles); `'all'` after any other change.
4209
4198
  */
4210
- __init69() {this.pendingDirty = "all"}
4199
+ __init68() {this.pendingDirty = "all"}
4211
4200
  notify(strokeRects) {
4212
4201
  if (strokeRects && this.pendingDirty !== "all") this.pendingDirty.push(...strokeRects);
4213
4202
  else if (!strokeRects) this.pendingDirty = "all";
@@ -4300,7 +4289,7 @@ var ImageEditorController = (_class7 = class {
4300
4289
  */
4301
4290
  async applyEffectFilter(layerId, effect, options = {}) {
4302
4291
  const d = await this.describeEffect(effect, "filter");
4303
- const values = _chunkIOXKXQNWcjs.resolveEffectValues.call(void 0, d, options.values);
4292
+ const values = _chunkCN4PJHUGcjs.resolveEffectValues.call(void 0, d, options.values);
4304
4293
  const found = _chunkMZXQTKUMcjs.findLayer.call(void 0, this.state.layers, layerId);
4305
4294
  if (!found) throw new (0, _chunkPEHYWUVVcjs.LayerOperationError)(`There is no layer "${layerId}"; call list_layers for the layer ids.`);
4306
4295
  let layers = this.state.layers;
@@ -4338,7 +4327,7 @@ var ImageEditorController = (_class7 = class {
4338
4327
  else if (k in d.controls.properties) base[k] = d.defaults[k];
4339
4328
  else throw new (0, _chunkPEHYWUVVcjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
4340
4329
  }
4341
- update.values = { ...base, ..._chunkIOXKXQNWcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
4330
+ update.values = { ...base, ..._chunkCN4PJHUGcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
4342
4331
  }
4343
4332
  for (const k of ["enabled", "blend", "opacity"]) if (changes[k] !== void 0) update[k] = changes[k];
4344
4333
  let res = _chunkPEHYWUVVcjs.updateSmartFilter.call(void 0, this.state.layers, layerId, filterId, update, this.canvasSize);
@@ -4353,7 +4342,7 @@ var ImageEditorController = (_class7 = class {
4353
4342
  */
4354
4343
  async addEffectLayer(effect, options = {}) {
4355
4344
  const d = await this.describeEffect(effect, "layer");
4356
- const values = _chunkIOXKXQNWcjs.resolveEffectValues.call(void 0, d, options.values);
4345
+ const values = _chunkCN4PJHUGcjs.resolveEffectValues.call(void 0, d, options.values);
4357
4346
  const { width, height } = this.naturalSize;
4358
4347
  const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time: options.time });
4359
4348
  const blend = _chunkPEHYWUVVcjs.parseBlend.call(void 0, options.blend);
@@ -4396,7 +4385,7 @@ var ImageEditorController = (_class7 = class {
4396
4385
  else if (k in d.controls.properties) base[k] = d.defaults[k];
4397
4386
  else throw new (0, _chunkPEHYWUVVcjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
4398
4387
  }
4399
- const values = { ...base, ..._chunkIOXKXQNWcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
4388
+ const values = { ...base, ..._chunkCN4PJHUGcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
4400
4389
  const time = _nullishCoalesce(_nullishCoalesce(changes.time, () => ( g.time)), () => ( 0));
4401
4390
  const { width, height } = this.naturalSize;
4402
4391
  const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time });
@@ -4417,7 +4406,7 @@ var ImageEditorController = (_class7 = class {
4417
4406
  })
4418
4407
  );
4419
4408
  }
4420
- __init70() {this.displayFor = null}
4409
+ __init69() {this.displayFor = null}
4421
4410
  /** Keeps the renderer's display transform in step with the document profile, mode and Proof Setup. */
4422
4411
  syncDisplay() {
4423
4412
  const s = this.state;
@@ -4679,7 +4668,7 @@ var ImageEditorController = (_class7 = class {
4679
4668
  if (!b) return null;
4680
4669
  return { x: b.x + layer.offset.x, y: b.y + layer.offset.y, width: b.width, height: b.height, data: _chunkJ5BA3BQ6cjs.readRegion.call(void 0, surface, b) };
4681
4670
  }
4682
- __init71() {this.boundsCache = /* @__PURE__ */ new WeakMap()}
4671
+ __init70() {this.boundsCache = /* @__PURE__ */ new WeakMap()}
4683
4672
  /**
4684
4673
  * Document bounds of a layer's non-transparent pixels (pixel layers; the Background's source
4685
4674
  * included), or `null` for an empty or non-pixel layer.
@@ -4733,8 +4722,8 @@ var ImageEditorController = (_class7 = class {
4733
4722
  pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _149 => _149.state, 'access', _150 => _150.patterns, 'optionalAccess', _151 => _151.find, 'call', _152 => _152((p) => p.id === id)]), () => ( null))
4734
4723
  };
4735
4724
  }
4736
- __init72() {this.sourceIds = /* @__PURE__ */ new WeakMap()}
4737
- __init73() {this.nextSourceId = 1}
4725
+ __init71() {this.sourceIds = /* @__PURE__ */ new WeakMap()}
4726
+ __init72() {this.nextSourceId = 1}
4738
4727
  /** Changes whenever the Background's source pixels can have changed. */
4739
4728
  sourceVersion() {
4740
4729
  const key = this.samplePixelsOverride ? this.samplePixels : _nullishCoalesce(this.imageElement, () => ( this.samplePixels));
@@ -4783,7 +4772,7 @@ var ImageEditorController = (_class7 = class {
4783
4772
  }
4784
4773
  return fits ? fromPixels(px2) : null;
4785
4774
  }
4786
- __init74() {this.opaqueCache = /* @__PURE__ */ new WeakMap()}
4775
+ __init73() {this.opaqueCache = /* @__PURE__ */ new WeakMap()}
4787
4776
  /** Whether every source pixel is opaque (some legacy renders depend on it). */
4788
4777
  sourceIsOpaque() {
4789
4778
  const s = this.sourceSurface();
@@ -5165,7 +5154,7 @@ var ImageEditorController = (_class7 = class {
5165
5154
  return copy.id;
5166
5155
  }
5167
5156
  // --- Free Transform ---
5168
- __init75() {this.openTransform = null}
5157
+ __init74() {this.openTransform = null}
5169
5158
  /** The Free Transform in progress (see `beginFreeTransform`), or `null`. */
5170
5159
  getFreeTransform() {
5171
5160
  if (this.openTransform && !this.openTransform.isOpen) this.openTransform = null;
@@ -5591,7 +5580,7 @@ var ImageEditorController = (_class7 = class {
5591
5580
  return left;
5592
5581
  }
5593
5582
  // --- Smart object contents (Edit Contents) ---
5594
- __init76() {this.contentsStack = []}
5583
+ __init75() {this.contentsStack = []}
5595
5584
  /** The smart objects whose contents are open (outermost first); empty when the document itself is shown. */
5596
5585
  getEditingContents() {
5597
5586
  return this.contentsStack.map((e) => ({ layerId: e.layerId, name: e.name }));
@@ -5740,7 +5729,7 @@ var ImageEditorController = (_class7 = class {
5740
5729
  this.commitLayers(_chunkPEHYWUVVcjs.setLayerEffects.call(void 0, this.state.layers, id, effects), void 0, commitToHistory);
5741
5730
  return this.getLayerEffects(id);
5742
5731
  }
5743
- __init77() {this.patternIds = /* @__PURE__ */ new WeakMap()}
5732
+ __init76() {this.patternIds = /* @__PURE__ */ new WeakMap()}
5744
5733
  /** Changes whenever the document's pattern list is replaced (the compositor then drops its caches). */
5745
5734
  patternsVersion() {
5746
5735
  const list = this.state.patterns;
@@ -5902,7 +5891,7 @@ var ImageEditorController = (_class7 = class {
5902
5891
  });
5903
5892
  return bg.id;
5904
5893
  }
5905
- __init78() {this.thumbCache = /* @__PURE__ */ new WeakMap()}
5894
+ __init77() {this.thumbCache = /* @__PURE__ */ new WeakMap()}
5906
5895
  /**
5907
5896
  * A small RGBA preview of a pixel layer over the canvas (or of its mask with `mask: true`),
5908
5897
  * longest side `maxSide` px, point-sampled; `null` for layers without pixels.
@@ -6963,7 +6952,7 @@ var ImageEditorController = (_class7 = class {
6963
6952
  this.notify();
6964
6953
  }
6965
6954
  // --- Rendering & Export ---
6966
- __init79() {this.blankSource = null}
6955
+ __init78() {this.blankSource = null}
6967
6956
  /**
6968
6957
  * What the renderer draws from: the source image, or, for a document without one (an opened
6969
6958
  * PSD, a v3 document loaded on its own), a transparent canvas of the document size, since every
@@ -8134,7 +8123,7 @@ var ImageEditorController = (_class7 = class {
8134
8123
  this.notify();
8135
8124
  }
8136
8125
  /** Problems found by the last `loadJSON` / `initialState` of a v3 document (unreadable layers or assets). */
8137
- __init80() {this.lastLoadProblems = []}
8126
+ __init79() {this.lastLoadProblems = []}
8138
8127
  applyStored(raw) {
8139
8128
  const s = this.state;
8140
8129
  const data = migrateSerializedImageEditorState(raw);
@@ -10687,14 +10676,14 @@ function handlePaintShortcut(controller, e) {
10687
10676
  return false;
10688
10677
  }
10689
10678
  var PaintGesture = (_class8 = class {
10690
- constructor(controller) {;_class8.prototype.__init81.call(this);_class8.prototype.__init82.call(this);_class8.prototype.__init83.call(this);
10679
+ constructor(controller) {;_class8.prototype.__init80.call(this);_class8.prototype.__init81.call(this);_class8.prototype.__init82.call(this);
10691
10680
  this.controller = controller;
10692
10681
  }
10693
10682
 
10694
- __init81() {this.stroke = null}
10695
- __init82() {this.move = null}
10683
+ __init80() {this.stroke = null}
10684
+ __init81() {this.move = null}
10696
10685
  /** The last refusal (e.g. "layer is locked"), for the editor to show. */
10697
- __init83() {this.error = null}
10686
+ __init82() {this.error = null}
10698
10687
  get active() {
10699
10688
  return Boolean(this.stroke || this.move);
10700
10689
  }
@@ -12952,18 +12941,18 @@ var round22 = (v) => Math.round(v * 100) / 100;
12952
12941
 
12953
12942
  // src/image-editor/selection/gesture.ts
12954
12943
  var SelectionGesture = (_class9 = class {
12955
- constructor(controller, getOptions) {;_class9.prototype.__init84.call(this);_class9.prototype.__init85.call(this);_class9.prototype.__init86.call(this);_class9.prototype.__init87.call(this);_class9.prototype.__init88.call(this);
12944
+ constructor(controller, getOptions) {;_class9.prototype.__init83.call(this);_class9.prototype.__init84.call(this);_class9.prototype.__init85.call(this);_class9.prototype.__init86.call(this);_class9.prototype.__init87.call(this);
12956
12945
  this.controller = controller;
12957
12946
  this.getOptions = getOptions;
12958
12947
  }
12959
12948
 
12960
12949
 
12961
- __init84() {this.start = null}
12962
- __init85() {this.points = []}
12963
- __init86() {this.current = null}
12964
- __init87() {this.modifiers = {}}
12950
+ __init83() {this.start = null}
12951
+ __init84() {this.points = []}
12952
+ __init85() {this.current = null}
12953
+ __init86() {this.modifiers = {}}
12965
12954
  /** The last error (e.g. pixels unavailable for the wand), for the UI to show. */
12966
- __init88() {this.error = null}
12955
+ __init87() {this.error = null}
12967
12956
  get active() {
12968
12957
  return this.start !== null;
12969
12958
  }
@@ -13249,15 +13238,15 @@ function liveShapeForDrag(o, a, b, mods = {}) {
13249
13238
  return null;
13250
13239
  }
13251
13240
  var ShapeDrawGesture = (_class10 = class {
13252
- constructor(controller, options) {;_class10.prototype.__init89.call(this);_class10.prototype.__init90.call(this);_class10.prototype.__init91.call(this);
13241
+ constructor(controller, options) {;_class10.prototype.__init88.call(this);_class10.prototype.__init89.call(this);_class10.prototype.__init90.call(this);
13253
13242
  this.controller = controller;
13254
13243
  this.options = options;
13255
13244
  }
13256
13245
 
13257
13246
 
13258
- __init89() {this.start = null}
13259
- __init90() {this.layerId = null}
13260
- __init91() {this.error = null}
13247
+ __init88() {this.start = null}
13248
+ __init89() {this.layerId = null}
13249
+ __init90() {this.error = null}
13261
13250
  get active() {
13262
13251
  return this.start !== null;
13263
13252
  }
@@ -13318,7 +13307,7 @@ function applyShapeOptions(controller, layerId, change) {
13318
13307
  if (Object.keys(shape).length) controller.setShapeComponent(layerId, 0, { shape });
13319
13308
  }
13320
13309
  var TextEditSession = (_class11 = class {
13321
- constructor(controller, layerId, index) {;_class11.prototype.__init92.call(this);_class11.prototype.__init93.call(this);_class11.prototype.__init94.call(this);
13310
+ constructor(controller, layerId, index) {;_class11.prototype.__init91.call(this);_class11.prototype.__init92.call(this);_class11.prototype.__init93.call(this);
13322
13311
  this.controller = controller;
13323
13312
  this.layerId = layerId;
13324
13313
  const n = this.text.length;
@@ -13328,9 +13317,9 @@ var TextEditSession = (_class11 = class {
13328
13317
 
13329
13318
 
13330
13319
 
13331
- __init92() {this.changed = false}
13332
- __init93() {this.listeners = /* @__PURE__ */ new Set()}
13333
- __init94() {this.error = null}
13320
+ __init91() {this.changed = false}
13321
+ __init92() {this.listeners = /* @__PURE__ */ new Set()}
13322
+ __init93() {this.error = null}
13334
13323
  get layer() {
13335
13324
  const l = _optionalChain([_chunkMZXQTKUMcjs.findLayer.call(void 0, this.controller.getLayers(), this.layerId), 'optionalAccess', _392 => _392.layer]);
13336
13325
  if (!l || l.type !== "type") throw new Error("The type layer being edited is gone.");
@@ -13595,15 +13584,15 @@ function invert(m) {
13595
13584
  return [d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det];
13596
13585
  }
13597
13586
  var TypeToolGesture = (_class12 = class {
13598
- constructor(controller, options) {;_class12.prototype.__init95.call(this);_class12.prototype.__init96.call(this);_class12.prototype.__init97.call(this);
13587
+ constructor(controller, options) {;_class12.prototype.__init94.call(this);_class12.prototype.__init95.call(this);_class12.prototype.__init96.call(this);
13599
13588
  this.controller = controller;
13600
13589
  this.options = options;
13601
13590
  }
13602
13591
 
13603
13592
 
13604
- __init95() {this.session = null}
13605
- __init96() {this.dragStart = null}
13606
- __init97() {this.error = null}
13593
+ __init94() {this.session = null}
13594
+ __init95() {this.dragStart = null}
13595
+ __init96() {this.error = null}
13607
13596
  down(p, mods = {}) {
13608
13597
  this.error = null;
13609
13598
  const hit = typeLayerAt(this.controller, p);
@@ -14211,30 +14200,30 @@ function insidePolygon(poly, p) {
14211
14200
  return inside;
14212
14201
  }
14213
14202
  var FreeTransformTool = (_class13 = class {
14214
- constructor(controller, options = {}) {;_class13.prototype.__init98.call(this);_class13.prototype.__init99.call(this);_class13.prototype.__init100.call(this);_class13.prototype.__init101.call(this);_class13.prototype.__init102.call(this);_class13.prototype.__init103.call(this);_class13.prototype.__init104.call(this);_class13.prototype.__init105.call(this);_class13.prototype.__init106.call(this);_class13.prototype.__init107.call(this);_class13.prototype.__init108.call(this);_class13.prototype.__init109.call(this);_class13.prototype.__init110.call(this);_class13.prototype.__init111.call(this);
14203
+ constructor(controller, options = {}) {;_class13.prototype.__init97.call(this);_class13.prototype.__init98.call(this);_class13.prototype.__init99.call(this);_class13.prototype.__init100.call(this);_class13.prototype.__init101.call(this);_class13.prototype.__init102.call(this);_class13.prototype.__init103.call(this);_class13.prototype.__init104.call(this);_class13.prototype.__init105.call(this);_class13.prototype.__init106.call(this);_class13.prototype.__init107.call(this);_class13.prototype.__init108.call(this);_class13.prototype.__init109.call(this);_class13.prototype.__init110.call(this);
14215
14204
  this.controller = controller;
14216
14205
  this.options = options;
14217
14206
  }
14218
14207
 
14219
14208
 
14220
- __init98() {this.sessionRef = null}
14221
- __init99() {this.modeValue = "scale"}
14209
+ __init97() {this.sessionRef = null}
14210
+ __init98() {this.modeValue = "scale"}
14222
14211
  /** The reference point in the untransformed frame's space (follows the transform). */
14223
- __init100() {this.refBox = { x: 0, y: 0 }}
14224
- __init101() {this.corners = null}
14225
- __init102() {this.drag = null}
14212
+ __init99() {this.refBox = { x: 0, y: 0 }}
14213
+ __init100() {this.corners = null}
14214
+ __init101() {this.drag = null}
14226
14215
  /** The warp mesh in the frame's own space (null: no warp). */
14227
- __init103() {this.mesh = null}
14228
- __init104() {this.warpSettings = { style: "custom", bend: 50, horizontal: 0, vertical: 0, orientation: "horizontal", columns: 1, rows: 1 }}
14229
- __init105() {this.pending = false}
14230
- __init106() {this.viewScale = 1}
14216
+ __init102() {this.mesh = null}
14217
+ __init103() {this.warpSettings = { style: "custom", bend: 50, horizontal: 0, vertical: 0, orientation: "horizontal", columns: 1, rows: 1 }}
14218
+ __init104() {this.pending = false}
14219
+ __init105() {this.viewScale = 1}
14231
14220
 
14232
14221
  /** Values typed into the options bar since the last drag (V skew is not recovered from the shape). */
14233
- __init107() {this.typed = {}}
14222
+ __init106() {this.typed = {}}
14234
14223
  /** Width and height scale together when typed (the chain icon). */
14235
- __init108() {this.proportional = true}
14236
- __init109() {this.error = null}
14237
- __init110() {this.lastResult = null}
14224
+ __init107() {this.proportional = true}
14225
+ __init108() {this.error = null}
14226
+ __init109() {this.lastResult = null}
14238
14227
  get active() {
14239
14228
  return Boolean(_optionalChain([this, 'access', _462 => _462.sessionRef, 'optionalAccess', _463 => _463.isOpen]));
14240
14229
  }
@@ -14247,7 +14236,7 @@ var FreeTransformTool = (_class13 = class {
14247
14236
  get interpolation() {
14248
14237
  return _nullishCoalesce(_optionalChain([this, 'access', _464 => _464.sessionRef, 'optionalAccess', _465 => _465.interpolation]), () => ( "bicubic"));
14249
14238
  }
14250
- __init111() {this.listeners = /* @__PURE__ */ new Set()}
14239
+ __init110() {this.listeners = /* @__PURE__ */ new Set()}
14251
14240
  /** Calls `listener` whenever the overlay, readout, mode or error changes. Returns the unsubscribe. */
14252
14241
  subscribe(listener) {
14253
14242
  this.listeners.add(listener);
@@ -14722,7 +14711,7 @@ function createImageEffectsToolProvider(controller, options = {}) {
14722
14711
  return { target, effect: _nullishCoalesce(effects.find((e) => e.id === instance), () => ( effects[effects.length - 1])), effects, ...extra };
14723
14712
  };
14724
14713
  const plainValues = (v) => v;
14725
- return _chunkTK53AB4Qcjs.createEffectToolProvider.call(void 0, {
14714
+ return _chunkFHYDQOPCcjs.createEffectToolProvider.call(void 0, {
14726
14715
  id: _nullishCoalesce(options.id, () => ( "image-effects")),
14727
14716
  namespace: options.namespace,
14728
14717
  target: { noun: "layer", id: "A layer id from list_layers." },