@pixerate/editor 0.186.0 → 0.188.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.
@@ -1,4 +1,4 @@
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;
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;
2
2
 
3
3
  var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
4
4
 
@@ -118,6 +118,10 @@ var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
118
118
 
119
119
 
120
120
 
121
+
122
+
123
+
124
+
121
125
 
122
126
 
123
127
 
@@ -750,15 +754,159 @@ function computeSelectionBounds(width, height, data) {
750
754
  if (y0 < 0) return null;
751
755
  return { x: x0, y: y0, width: x1 - x0 + 1, height: y1 - y0 + 1 };
752
756
  }
757
+ var TILE_PIXELS = _chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE;
758
+ var MATERIALIZED_LIMIT = 4;
759
+ var materialized = /* @__PURE__ */ new Map();
760
+ var lastRead = null;
761
+ var lastData = null;
762
+ var TiledSelectionMask = (_class = class {
763
+ constructor(width, height, surface, bounds, data) {;_class.prototype.__init.call(this);
764
+ this.width = width;
765
+ this.height = height;
766
+ this.surface = surface;
767
+ this.cachedBounds = bounds;
768
+ if (data) this.remember(data);
769
+ }
770
+
771
+
772
+
773
+
774
+ __init() {this.weak = null}
775
+ get bounds() {
776
+ if (this.cachedBounds === void 0) this.cachedBounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, this.surface);
777
+ return this.cachedBounds;
778
+ }
779
+ get data() {
780
+ if (lastRead === this) return lastData;
781
+ let d = materialized.get(this);
782
+ if (d) {
783
+ materialized.delete(this);
784
+ materialized.set(this, d);
785
+ lastRead = this;
786
+ lastData = d;
787
+ return d;
788
+ }
789
+ d = _optionalChain([this, 'access', _2 => _2.weak, 'optionalAccess', _3 => _3.deref, 'call', _4 => _4()]);
790
+ if (!d) {
791
+ const all = _chunkCWM3CUUXcjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height });
792
+ d = new Uint8Array(all.buffer, all.byteOffset, all.length);
793
+ }
794
+ this.remember(d);
795
+ return d;
796
+ }
797
+ remember(d) {
798
+ lastRead = this;
799
+ lastData = d;
800
+ this.weak = typeof WeakRef === "function" ? new WeakRef(d) : null;
801
+ materialized.set(this, d);
802
+ while (materialized.size > MATERIALIZED_LIMIT) materialized.delete(materialized.keys().next().value);
803
+ }
804
+ }, _class);
805
+ function tileGrid(width, height) {
806
+ return { cols: Math.ceil(width / _chunkCWM3CUUXcjs.TILE), rows: Math.ceil(height / _chunkCWM3CUUXcjs.TILE) };
807
+ }
808
+ function insideTile(tx, ty, width, height) {
809
+ return (tx + 1) * _chunkCWM3CUUXcjs.TILE <= width && (ty + 1) * _chunkCWM3CUUXcjs.TILE <= height;
810
+ }
811
+ function surfaceFromCoverage(width, height, data) {
812
+ const tiles = /* @__PURE__ */ new Map();
813
+ const { cols, rows } = tileGrid(width, height);
814
+ for (let ty = 0; ty < rows; ty++) {
815
+ for (let tx = 0; tx < cols; tx++) {
816
+ const ox = tx * _chunkCWM3CUUXcjs.TILE;
817
+ const oy = ty * _chunkCWM3CUUXcjs.TILE;
818
+ const w = Math.min(_chunkCWM3CUUXcjs.TILE, width - ox);
819
+ const h = Math.min(_chunkCWM3CUUXcjs.TILE, height - oy);
820
+ let lo = 255;
821
+ let hi = 0;
822
+ for (let y = 0; y < h && !(hi > 0 && lo < hi); y++) {
823
+ const row = (oy + y) * width + ox;
824
+ for (let x = 0; x < w; x++) {
825
+ const v = data[row + x];
826
+ if (v < lo) lo = v;
827
+ if (v > hi) hi = v;
828
+ }
829
+ }
830
+ if (hi === 0) continue;
831
+ if (lo === hi && w === _chunkCWM3CUUXcjs.TILE && h === _chunkCWM3CUUXcjs.TILE) {
832
+ tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), _chunkCWM3CUUXcjs.uniformTile.call(void 0, 1, hi));
833
+ continue;
834
+ }
835
+ const t = new Uint8ClampedArray(TILE_PIXELS);
836
+ for (let y = 0; y < h; y++) {
837
+ const row = (oy + y) * width + ox;
838
+ for (let x = 0; x < w; x++) t[y * _chunkCWM3CUUXcjs.TILE + x] = data[row + x];
839
+ }
840
+ tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), { data: t, uniform: null });
841
+ }
842
+ }
843
+ return new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0);
844
+ }
845
+ function clipTile(tile, w, h) {
846
+ const d = tile.data;
847
+ let outside = false;
848
+ for (let y = 0; y < _chunkCWM3CUUXcjs.TILE && !outside; y++) {
849
+ for (let x = y < h ? w : 0; x < _chunkCWM3CUUXcjs.TILE; x++) {
850
+ if (d[y * _chunkCWM3CUUXcjs.TILE + x] !== 0) {
851
+ outside = true;
852
+ break;
853
+ }
854
+ }
855
+ }
856
+ if (!outside) return tile;
857
+ const t = new Uint8ClampedArray(TILE_PIXELS);
858
+ for (let y = 0; y < h; y++) t.set(d.subarray(y * _chunkCWM3CUUXcjs.TILE, y * _chunkCWM3CUUXcjs.TILE + w), y * _chunkCWM3CUUXcjs.TILE);
859
+ return _chunkCWM3CUUXcjs.finishTile.call(void 0, t, 1, 0);
860
+ }
861
+ function selectionFromTiles(width, height, surface) {
862
+ checkSize(width, height);
863
+ if (surface.channels !== 1) throw new Error("A selection needs a 1-channel surface");
864
+ if (surface.defaultValue !== 0) {
865
+ const all = _chunkCWM3CUUXcjs.readRegion.call(void 0, surface, { x: 0, y: 0, width, height });
866
+ return createSelectionMask(width, height, new Uint8Array(all.buffer, all.byteOffset, all.length));
867
+ }
868
+ const { cols, rows } = tileGrid(width, height);
869
+ let tiles = null;
870
+ for (const [key, tile] of surface.tiles) {
871
+ const { tx, ty } = _chunkCWM3CUUXcjs.tileCoord.call(void 0, key);
872
+ let next = tile;
873
+ if (tx < 0 || ty < 0 || tx >= cols || ty >= rows) next = null;
874
+ else if (!insideTile(tx, ty, width, height)) next = clipTile(tile, Math.min(_chunkCWM3CUUXcjs.TILE, width - tx * _chunkCWM3CUUXcjs.TILE), Math.min(_chunkCWM3CUUXcjs.TILE, height - ty * _chunkCWM3CUUXcjs.TILE));
875
+ if (next === tile) continue;
876
+ tiles ??= new Map(surface.tiles);
877
+ if (next) tiles.set(key, next);
878
+ else tiles.delete(key);
879
+ }
880
+ return new TiledSelectionMask(width, height, tiles ? new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0) : surface);
881
+ }
753
882
  function createSelectionMask(width, height, data) {
754
883
  checkSize(width, height);
755
- const bytes = _nullishCoalesce(data, () => ( new Uint8Array(width * height)));
756
- if (bytes.length !== width * height) throw new Error("Selection data does not match its size");
757
- return { width, height, data: bytes, bounds: data ? computeSelectionBounds(width, height, bytes) : null };
884
+ if (!data) return new TiledSelectionMask(width, height, new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, /* @__PURE__ */ new Map(), 0), null);
885
+ if (data.length !== width * height) throw new Error("Selection data does not match its size");
886
+ return new TiledSelectionMask(width, height, surfaceFromCoverage(width, height, data), void 0, data);
887
+ }
888
+ function selectionFromRegion(width, height, rect, data) {
889
+ checkSize(width, height);
890
+ if (rect.x < 0 || rect.y < 0 || rect.x + rect.width > width || rect.y + rect.height > height) throw new Error("The region lies outside the selection");
891
+ return new TiledSelectionMask(width, height, _chunkCWM3CUUXcjs.writeRegion.call(void 0, new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, /* @__PURE__ */ new Map(), 0), rect, data));
758
892
  }
759
893
  function fullSelection(width, height) {
760
894
  checkSize(width, height);
761
- return { width, height, data: new Uint8Array(width * height).fill(255), bounds: { x: 0, y: 0, width, height } };
895
+ const tiles = /* @__PURE__ */ new Map();
896
+ const { cols, rows } = tileGrid(width, height);
897
+ for (let ty = 0; ty < rows; ty++) {
898
+ for (let tx = 0; tx < cols; tx++) {
899
+ if (insideTile(tx, ty, width, height)) {
900
+ tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), _chunkCWM3CUUXcjs.uniformTile.call(void 0, 1, 255));
901
+ continue;
902
+ }
903
+ const t = new Uint8ClampedArray(TILE_PIXELS);
904
+ const w = Math.min(_chunkCWM3CUUXcjs.TILE, width - tx * _chunkCWM3CUUXcjs.TILE);
905
+ for (let y = 0; y < Math.min(_chunkCWM3CUUXcjs.TILE, height - ty * _chunkCWM3CUUXcjs.TILE); y++) t.fill(255, y * _chunkCWM3CUUXcjs.TILE, y * _chunkCWM3CUUXcjs.TILE + w);
906
+ tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), { data: t, uniform: null });
907
+ }
908
+ }
909
+ return new TiledSelectionMask(width, height, new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0), { x: 0, y: 0, width, height });
762
910
  }
763
911
  function isSelectionEmpty(mask) {
764
912
  return !mask || mask.bounds === null;
@@ -767,7 +915,7 @@ function selectionValueAt(mask, x, y) {
767
915
  const xi = Math.floor(x);
768
916
  const yi = Math.floor(y);
769
917
  if (xi < 0 || yi < 0 || xi >= mask.width || yi >= mask.height) return 0;
770
- return mask.data[yi * mask.width + xi] / 255;
918
+ return _chunkCWM3CUUXcjs.readPixel.call(void 0, mask.surface, xi, yi)[0] / 255;
771
919
  }
772
920
  function coverageToByte(v) {
773
921
  if (!(v > 0)) return 0;
@@ -788,10 +936,13 @@ function selectionToCoverage(mask) {
788
936
  function selectionArea(mask) {
789
937
  if (!mask || !mask.bounds) return 0;
790
938
  let sum = 0;
791
- const { x, y, width, height } = mask.bounds;
792
- for (let yy = y; yy < y + height; yy++) {
793
- const row = yy * mask.width;
794
- for (let xx = x; xx < x + width; xx++) sum += mask.data[row + xx];
939
+ for (const tile of mask.surface.tiles.values()) {
940
+ if (tile.uniform !== null) {
941
+ sum += tile.uniform * TILE_PIXELS;
942
+ continue;
943
+ }
944
+ const d = tile.data;
945
+ for (let i = 0; i < d.length; i++) sum += d[i];
795
946
  }
796
947
  return sum / 255;
797
948
  }
@@ -803,20 +954,68 @@ function combineSelections(prev, next, mode) {
803
954
  return null;
804
955
  } else {
805
956
  if (prev.width !== next.width || prev.height !== next.height) throw new Error("Selections differ in size");
806
- const a = prev.data;
807
- const b = next.data;
808
- const out = new Uint8Array(a.length);
809
- if (mode === "add") for (let i = 0; i < a.length; i++) out[i] = a[i] > b[i] ? a[i] : b[i];
810
- else if (mode === "subtract") for (let i = 0; i < a.length; i++) out[i] = a[i] > b[i] ? a[i] - b[i] : 0;
811
- else for (let i = 0; i < a.length; i++) out[i] = a[i] < b[i] ? a[i] : b[i];
812
- result = createSelectionMask(prev.width, prev.height, out);
957
+ result = new TiledSelectionMask(prev.width, prev.height, combineSurfaces(prev.surface, next.surface, mode));
813
958
  }
814
959
  return result.bounds ? result : null;
815
960
  }
961
+ var FULL = 255;
962
+ function combineTile(a, b, mode) {
963
+ if (mode === "add") {
964
+ if (!b || _optionalChain([a, 'optionalAccess', _5 => _5.uniform]) === FULL) return a;
965
+ if (!a || b.uniform === FULL) return b;
966
+ } else if (mode === "subtract") {
967
+ if (!a || !b) return a;
968
+ if (b.uniform === FULL) return void 0;
969
+ } else {
970
+ if (!a || !b) return void 0;
971
+ if (a.uniform === FULL) return b;
972
+ if (b.uniform === FULL) return a;
973
+ }
974
+ const x = a.data;
975
+ const y = b.data;
976
+ const out = new Uint8ClampedArray(TILE_PIXELS);
977
+ if (mode === "add") for (let i = 0; i < out.length; i++) out[i] = x[i] > y[i] ? x[i] : y[i];
978
+ else if (mode === "subtract") for (let i = 0; i < out.length; i++) out[i] = x[i] > y[i] ? x[i] - y[i] : 0;
979
+ else for (let i = 0; i < out.length; i++) out[i] = x[i] < y[i] ? x[i] : y[i];
980
+ return _nullishCoalesce(_chunkCWM3CUUXcjs.finishTile.call(void 0, out, 1, 0), () => ( void 0));
981
+ }
982
+ function combineSurfaces(a, b, mode) {
983
+ const tiles = /* @__PURE__ */ new Map();
984
+ for (const key of /* @__PURE__ */ new Set([...a.tiles.keys(), ...b.tiles.keys()])) {
985
+ const tile = combineTile(a.tiles.get(key), b.tiles.get(key), mode);
986
+ if (tile) tiles.set(key, tile);
987
+ }
988
+ return new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0);
989
+ }
816
990
  function invertSelection(mask) {
817
- const out = new Uint8Array(mask.data.length);
818
- for (let i = 0; i < out.length; i++) out[i] = 255 - mask.data[i];
819
- return createSelectionMask(mask.width, mask.height, out);
991
+ const { width, height } = mask;
992
+ const tiles = /* @__PURE__ */ new Map();
993
+ const { cols, rows } = tileGrid(width, height);
994
+ for (let ty = 0; ty < rows; ty++) {
995
+ for (let tx = 0; tx < cols; tx++) {
996
+ const src = mask.surface.getTile(tx, ty);
997
+ const key = _chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty);
998
+ if (insideTile(tx, ty, width, height)) {
999
+ if (!src) tiles.set(key, _chunkCWM3CUUXcjs.uniformTile.call(void 0, 1, FULL));
1000
+ else if (src.uniform !== null) {
1001
+ if (src.uniform !== FULL) tiles.set(key, _chunkCWM3CUUXcjs.uniformTile.call(void 0, 1, FULL - src.uniform));
1002
+ } else {
1003
+ const out2 = new Uint8ClampedArray(TILE_PIXELS);
1004
+ for (let i = 0; i < out2.length; i++) out2[i] = FULL - src.data[i];
1005
+ const t2 = _chunkCWM3CUUXcjs.finishTile.call(void 0, out2, 1, 0);
1006
+ if (t2) tiles.set(key, t2);
1007
+ }
1008
+ continue;
1009
+ }
1010
+ const w = Math.min(_chunkCWM3CUUXcjs.TILE, width - tx * _chunkCWM3CUUXcjs.TILE);
1011
+ const h = Math.min(_chunkCWM3CUUXcjs.TILE, height - ty * _chunkCWM3CUUXcjs.TILE);
1012
+ const out = new Uint8ClampedArray(TILE_PIXELS);
1013
+ for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) out[y * _chunkCWM3CUUXcjs.TILE + x] = FULL - (src ? src.data[y * _chunkCWM3CUUXcjs.TILE + x] : 0);
1014
+ const t = _chunkCWM3CUUXcjs.finishTile.call(void 0, out, 1, 0);
1015
+ if (t) tiles.set(key, t);
1016
+ }
1017
+ }
1018
+ return new TiledSelectionMask(width, height, new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0));
820
1019
  }
821
1020
  function resizeSelection(mask, width, height) {
822
1021
  if (mask.width === width && mask.height === height) return mask;
@@ -1332,7 +1531,7 @@ function projectMaskCoverage(coverage, maskWidth, maskHeight, naturalWidth, natu
1332
1531
  return out;
1333
1532
  }
1334
1533
  function buildLayerMaskPlanes(layers, naturalWidth, naturalHeight, projection, targetWidth, targetHeight) {
1335
- if (!_optionalChain([layers, 'optionalAccess', _2 => _2.some, 'call', _3 => _3((l) => l.mask && l.mask.enabled !== false)])) return void 0;
1534
+ if (!_optionalChain([layers, 'optionalAccess', _6 => _6.some, 'call', _7 => _7((l) => l.mask && l.mask.enabled !== false)])) return void 0;
1336
1535
  const planes = /* @__PURE__ */ new Map();
1337
1536
  for (const layer of layers) {
1338
1537
  if (!layer.mask) continue;
@@ -1923,7 +2122,7 @@ function compiledFor(layer, deep = false) {
1923
2122
  return op;
1924
2123
  }
1925
2124
  function activeAdjustmentLayers(layers) {
1926
- if (!_optionalChain([layers, 'optionalAccess', _4 => _4.length])) return [];
2125
+ if (!_optionalChain([layers, 'optionalAccess', _8 => _8.length])) return [];
1927
2126
  return layers.filter((l) => l.enabled !== false && (_nullishCoalesce(l.opacity, () => ( 1))) > 0 && compiledFor(l) !== null);
1928
2127
  }
1929
2128
  function evaluateAdjustmentLayers(color, layers) {
@@ -1955,7 +2154,7 @@ function applyAdjustmentLayers(imageData, layers, masks) {
1955
2154
  const active = activeAdjustmentLayers(layers);
1956
2155
  if (!active.length) return;
1957
2156
  const ops = active.map((l) => compiledFor(l));
1958
- const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _5 => _5.get, 'call', _6 => _6(l.id)]));
2157
+ const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _9 => _9.get, 'call', _10 => _10(l.id)]));
1959
2158
  const data = imageData.data;
1960
2159
  const len = data.length;
1961
2160
  const c = [0, 0, 0];
@@ -1982,7 +2181,7 @@ function applyAdjustmentLayersFloat(data, layers, masks) {
1982
2181
  const active = activeAdjustmentLayers(layers);
1983
2182
  if (!active.length) return;
1984
2183
  const ops = active.map((l) => compiledFor(l, true));
1985
- const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _7 => _7.get, 'call', _8 => _8(l.id)]));
2184
+ const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _11 => _11.get, 'call', _12 => _12(l.id)]));
1986
2185
  const c = [0, 0, 0];
1987
2186
  for (let i = 0; i < data.length; i += 4) {
1988
2187
  if (!(data[i + 3] > 0)) continue;
@@ -2002,7 +2201,7 @@ function applyAdjustmentLayersFloat(data, layers, masks) {
2002
2201
  }
2003
2202
  }
2004
2203
  function adjustmentLayersKey(layers) {
2005
- if (!_optionalChain([layers, 'optionalAccess', _9 => _9.length])) return "";
2204
+ if (!_optionalChain([layers, 'optionalAccess', _13 => _13.length])) return "";
2006
2205
  return JSON.stringify(
2007
2206
  layers.map((l) => {
2008
2207
  const key = [l.kind, l.enabled !== false, _nullishCoalesce(l.opacity, () => ( 1)), _nullishCoalesce(l.blend, () => ( "normal")), l.params];
@@ -2398,10 +2597,10 @@ function pixelLayers(layers) {
2398
2597
  return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
2399
2598
  }
2400
2599
  function developFilter(layer) {
2401
- return _optionalChain([layer, 'access', _10 => _10.filters, 'optionalAccess', _11 => _11.find, 'call', _12 => _12((f) => f.kind === "develop")]);
2600
+ return _optionalChain([layer, 'access', _14 => _14.filters, 'optionalAccess', _15 => _15.find, 'call', _16 => _16((f) => f.kind === "develop")]);
2402
2601
  }
2403
2602
  function blurFilter(layer) {
2404
- return _optionalChain([layer, 'access', _13 => _13.filters, 'optionalAccess', _14 => _14.find, 'call', _15 => _15((f) => f.kind === "blur")]);
2603
+ return _optionalChain([layer, 'access', _17 => _17.filters, 'optionalAccess', _18 => _18.find, 'call', _19 => _19((f) => f.kind === "blur")]);
2405
2604
  }
2406
2605
  function isActiveFilter(f) {
2407
2606
  if (!f.enabled) return false;
@@ -2511,7 +2710,7 @@ function filterReach(filters) {
2511
2710
  var filterSpecCache = /* @__PURE__ */ new WeakMap();
2512
2711
  function pixelFilterSpec(layer) {
2513
2712
  const list2 = layer.filters;
2514
- if (!_optionalChain([list2, 'optionalAccess', _16 => _16.length])) return null;
2713
+ if (!_optionalChain([list2, 'optionalAccess', _20 => _20.length])) return null;
2515
2714
  if (filterSpecCache.has(list2)) return filterSpecCache.get(list2);
2516
2715
  const filters = list2.filter(isActiveFilter);
2517
2716
  let spec = null;
@@ -2532,7 +2731,7 @@ var PHOTO_PROFILE = {
2532
2731
  const views = layers.map(adjustmentNodeAsLayer);
2533
2732
  applyAdjustmentLayers({ data: acc }, views, masks);
2534
2733
  },
2535
- contentTile: (l, r, sources) => l.type === "annotation" ? _nullishCoalesce(_optionalChain([sources, 'access', _17 => _17.rasterizeAnnotation, 'optionalCall', _18 => _18(l.annotation, r)]), () => ( null)) : null,
2734
+ contentTile: (l, r, sources) => l.type === "annotation" ? _nullishCoalesce(_optionalChain([sources, 'access', _21 => _21.rasterizeAnnotation, 'optionalCall', _22 => _22(l.annotation, r)]), () => ( null)) : null,
2536
2735
  /** Annotation layers draw with their annotation's blend mode unless the layer sets one. */
2537
2736
  contentBlend: (l) => l.type === "annotation" && l.blend === "normal" && l.annotation.blend ? l.annotation.blend : l.blend,
2538
2737
  layerKey: (l) => l.type === "pixel" ? [_nullishCoalesce(l.filters, () => ( null)), _nullishCoalesce(l.source, () => ( null))] : l.type === "adjustment" ? [l.kind, l.params] : l.type === "annotation" ? l.annotation : void 0,
@@ -2544,7 +2743,7 @@ var PHOTO_PROFILE = {
2544
2743
  isPixelLike: (l) => l.type === "smart" || l.type === "shape" || l.type === "type",
2545
2744
  maskSourcePlane: (source, W, H, sources) => {
2546
2745
  const opts = source;
2547
- const depth = _nullishCoalesce(_optionalChain([sources, 'access', _19 => _19.depthMap, 'optionalCall', _20 => _20(opts)]), () => ( null));
2746
+ const depth = _nullishCoalesce(_optionalChain([sources, 'access', _23 => _23.depthMap, 'optionalCall', _24 => _24(opts)]), () => ( null));
2548
2747
  if (!depth || depth.width !== W || depth.height !== H) return null;
2549
2748
  const v = new Float32Array(W * H);
2550
2749
  for (let i = 0; i < v.length; i++) v[i] = depthMaskAlpha(depth.data[i * 4], opts) / 255;
@@ -2921,7 +3120,7 @@ function isPaintableLayer(layer) {
2921
3120
  function defaultActiveLayerId(layers) {
2922
3121
  const pixels = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
2923
3122
  for (let i = pixels.length - 1; i >= 0; i--) if (isPaintableLayer(pixels[i])) return pixels[i].id;
2924
- return _nullishCoalesce(_optionalChain([pixels, 'access', _21 => _21[pixels.length - 1], 'optionalAccess', _22 => _22.id]), () => ( null));
3123
+ return _nullishCoalesce(_optionalChain([pixels, 'access', _25 => _25[pixels.length - 1], 'optionalAccess', _26 => _26.id]), () => ( null));
2925
3124
  }
2926
3125
  function activeLayerAfterRemoval(prev, next, removedId) {
2927
3126
  const before = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, prev);
@@ -2952,7 +3151,7 @@ function placeLayer(layers, layer, placement = {}, defaultIndex) {
2952
3151
  if (given > 1) fail("Give only one of aboveId, belowId and parentId.");
2953
3152
  if (placement.aboveId || placement.belowId) {
2954
3153
  const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
2955
- return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _23 => _23.parent, 'optionalAccess', _24 => _24.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
3154
+ return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _27 => _27.parent, 'optionalAccess', _28 => _28.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
2956
3155
  }
2957
3156
  if (placement.parentId) {
2958
3157
  const ref = requireLayer(layers, placement.parentId);
@@ -2984,7 +3183,7 @@ function withNewIds(layer) {
2984
3183
  if (next.type === "group") next.children = next.children.map(withNewIds);
2985
3184
  if (next.type === "annotation") next.annotation = { ...next.annotation, id: next.id };
2986
3185
  if (next.type === "shape" || next.type === "type") delete next.annotation;
2987
- if (next.type === "smart" && _optionalChain([next, 'access', _25 => _25.psd, 'optionalAccess', _26 => _26.placed])) {
3186
+ if (next.type === "smart" && _optionalChain([next, 'access', _29 => _29.psd, 'optionalAccess', _30 => _30.placed])) {
2988
3187
  next.psd = { ...next.psd };
2989
3188
  delete next.psd.placed;
2990
3189
  }
@@ -2995,7 +3194,7 @@ function duplicateLayer(layers, id, name) {
2995
3194
  const copy = withNewIds(loc.layer);
2996
3195
  copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
2997
3196
  delete copy.locks;
2998
- return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _27 => _27.parent, 'optionalAccess', _28 => _28.id]), () => ( null)), loc.index + 1), id: copy.id };
3197
+ return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _31 => _31.parent, 'optionalAccess', _32 => _32.id]), () => ( null)), loc.index + 1), id: copy.id };
2999
3198
  }
3000
3199
  function setLayerProperties(layers, id, props) {
3001
3200
  const loc = requireLayer(layers, id);
@@ -3047,8 +3246,8 @@ function setLayerProperties(layers, id, props) {
3047
3246
  function groupLayers(layers, ids, name = "Group") {
3048
3247
  if (!ids.length) fail("Give at least one layer id to group.");
3049
3248
  const locs = ids.map((id) => requireLayer(layers, id));
3050
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _29 => _29[0], 'access', _30 => _30.parent, 'optionalAccess', _31 => _31.id]), () => ( null));
3051
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _32 => _32.parent, 'optionalAccess', _33 => _33.id]), () => ( null))) !== parent)) fail("Layers to group must share one parent; move them next to each other first.");
3249
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _33 => _33[0], 'access', _34 => _34.parent, 'optionalAccess', _35 => _35.id]), () => ( null));
3250
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _36 => _36.parent, 'optionalAccess', _37 => _37.id]), () => ( null))) !== parent)) fail("Layers to group must share one parent; move them next to each other first.");
3052
3251
  for (const l of locs) requireUnlocked(l.layer, "all", "group it");
3053
3252
  const ordered = [...new Set(locs)].sort((a, b) => a.index - b.index);
3054
3253
  const top = ordered[ordered.length - 1].index;
@@ -3065,7 +3264,7 @@ function groupLayers(layers, ids, name = "Group") {
3065
3264
  return c;
3066
3265
  })
3067
3266
  };
3068
- if (_optionalChain([group, 'access', _34 => _34.children, 'access', _35 => _35[0], 'optionalAccess', _36 => _36.clipped])) {
3267
+ if (_optionalChain([group, 'access', _38 => _38.children, 'access', _39 => _39[0], 'optionalAccess', _40 => _40.clipped])) {
3069
3268
  const c = { ...group.children[0] };
3070
3269
  delete c.clipped;
3071
3270
  group.children[0] = c;
@@ -3081,7 +3280,7 @@ function ungroupLayer(layers, id) {
3081
3280
  const group = loc.layer;
3082
3281
  let out = _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => null);
3083
3282
  group.children.forEach((c, i) => {
3084
- out = _chunkHGTDMKNEcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _37 => _37.parent, 'optionalAccess', _38 => _38.id]), () => ( null)), loc.index + i);
3283
+ out = _chunkHGTDMKNEcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _41 => _41.parent, 'optionalAccess', _42 => _42.id]), () => ( null)), loc.index + i);
3085
3284
  });
3086
3285
  return { layers: out, ids: group.children.map((c) => c.id) };
3087
3286
  }
@@ -3139,7 +3338,7 @@ function requirePixelLayer(layers, id) {
3139
3338
  }
3140
3339
  function addLayerFilter(layers, id, filter) {
3141
3340
  const layer = requirePixelLayer(layers, id);
3142
- if (_optionalChain([layer, 'access', _39 => _39.filters, 'optionalAccess', _40 => _40.some, 'call', _41 => _41((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
3341
+ if (_optionalChain([layer, 'access', _43 => _43.filters, 'optionalAccess', _44 => _44.some, 'call', _45 => _45((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
3143
3342
  return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
3144
3343
  }
3145
3344
  function updateLayerFilter(layers, id, filterId, changes) {
@@ -3203,7 +3402,7 @@ function addLayerEffect(layers, id, kind, params = {}, index) {
3203
3402
  return { layers: setLayerEffects(layers, id, { ...current, items }), effect };
3204
3403
  }
3205
3404
  function requireEffect(layer, effectId) {
3206
- const items = _nullishCoalesce(_optionalChain([layer, 'access', _42 => _42.effects, 'optionalAccess', _43 => _43.items]), () => ( []));
3405
+ const items = _nullishCoalesce(_optionalChain([layer, 'access', _46 => _46.effects, 'optionalAccess', _47 => _47.items]), () => ( []));
3207
3406
  const i = items.findIndex((e) => e.id === effectId);
3208
3407
  if (i === -1) fail(`Layer "${layer.name || layer.id}" has no effect "${effectId}". Effects: ${items.map((e) => `${e.id} (${e.kind})`).join(", ") || "none"}; call list_layer_effects.`);
3209
3408
  return i;
@@ -3391,7 +3590,7 @@ function closedOutline(path) {
3391
3590
  function strokeArea(path, stroke, double) {
3392
3591
  const w = stroke.width * (double ? 2 : 1);
3393
3592
  if (!(w > 0) || !path.length) return [];
3394
- const dashes = _optionalChain([stroke, 'access', _44 => _44.dashes, 'optionalAccess', _45 => _45.length]) && stroke.dashes.some((d) => d > 0) ? stroke.dashes.map((d) => d * stroke.width) : void 0;
3593
+ const dashes = _optionalChain([stroke, 'access', _48 => _48.dashes, 'optionalAccess', _49 => _49.length]) && stroke.dashes.some((d) => d > 0) ? stroke.dashes.map((d) => d * stroke.width) : void 0;
3395
3594
  const options = {
3396
3595
  width: w,
3397
3596
  cap: _nullishCoalesce(stroke.cap, () => ( "butt")),
@@ -3467,7 +3666,7 @@ function paintContext(env) {
3467
3666
  light: _chunkHGTDMKNEcjs.DEFAULT_GLOBAL_LIGHT,
3468
3667
  pattern: (id) => {
3469
3668
  if (tiles.has(id)) return tiles.get(id);
3470
- const p = _nullishCoalesce(_optionalChain([env, 'access', _46 => _46.pattern, 'optionalCall', _47 => _47(id)]), () => ( _chunkHGTDMKNEcjs.builtinPattern.call(void 0, id)));
3669
+ const p = _nullishCoalesce(_optionalChain([env, 'access', _50 => _50.pattern, 'optionalCall', _51 => _51(id)]), () => ( _chunkHGTDMKNEcjs.builtinPattern.call(void 0, id)));
3471
3670
  const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkHGTDMKNEcjs.PatternTile)(p) : null;
3472
3671
  tiles.set(id, t);
3473
3672
  return t;
@@ -3500,9 +3699,9 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
3500
3699
  const canvas = { x: 0, y: 0, width: env.width, height: env.height };
3501
3700
  const anchor = { x: geo.frame.x, y: geo.frame.y };
3502
3701
  const fc = fCov ? _chunkHGTDMKNEcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
3503
- const fo = _nullishCoalesce(_optionalChain([layer, 'access', _48 => _48.fill, 'optionalAccess', _49 => _49.opacity]), () => ( 1));
3702
+ const fo = _nullishCoalesce(_optionalChain([layer, 'access', _52 => _52.fill, 'optionalAccess', _53 => _53.opacity]), () => ( 1));
3504
3703
  const sc = sCov ? _chunkHGTDMKNEcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
3505
- const so = _nullishCoalesce(_optionalChain([layer, 'access', _50 => _50.stroke, 'optionalAccess', _51 => _51.paint, 'access', _52 => _52.opacity]), () => ( 1));
3704
+ const so = _nullishCoalesce(_optionalChain([layer, 'access', _54 => _54.stroke, 'optionalAccess', _55 => _55.paint, 'access', _56 => _56.opacity]), () => ( 1));
3506
3705
  const out = new Uint8ClampedArray(n * 4);
3507
3706
  let any = false;
3508
3707
  for (let i = 0; i < n; i++) {
@@ -3584,7 +3783,7 @@ function normalizeShapePaint(v, path = "paint") {
3584
3783
  const g = o.gradient;
3585
3784
  if (!g || typeof g !== "object") return fail2(`${path}.gradient is required: { stops: [{ position, color }], style, angle, \u2026 }.`);
3586
3785
  const gradient = {
3587
- stops: Array.isArray(g.stops) ? g.stops.map((s) => ({ position: s.position, color: _nullishCoalesce(_optionalChain([_chunkA2IS7EHEcjs.parseCssColor.call(void 0, s.color), 'optionalAccess', _53 => _53.hex]), () => ( s.color)) })) : [],
3786
+ stops: Array.isArray(g.stops) ? g.stops.map((s) => ({ position: s.position, color: _nullishCoalesce(_optionalChain([_chunkA2IS7EHEcjs.parseCssColor.call(void 0, s.color), 'optionalAccess', _57 => _57.hex]), () => ( s.color)) })) : [],
3588
3787
  ...g.opacityStops ? { opacityStops: g.opacityStops } : {},
3589
3788
  style: _nullishCoalesce(g.style, () => ( "linear")),
3590
3789
  angle: _nullishCoalesce(g.angle, () => ( 90)),
@@ -3610,7 +3809,7 @@ function normalizeShapePaint(v, path = "paint") {
3610
3809
  if (o.link !== void 0) p.link = Boolean(o.link);
3611
3810
  if (o.phase !== void 0) {
3612
3811
  const ph = o.phase;
3613
- p.phase = { x: requireNum(_optionalChain([ph, 'optionalAccess', _54 => _54.x]), `${path}.phase.x`), y: requireNum(_optionalChain([ph, 'optionalAccess', _55 => _55.y]), `${path}.phase.y`) };
3812
+ p.phase = { x: requireNum(_optionalChain([ph, 'optionalAccess', _58 => _58.x]), `${path}.phase.x`), y: requireNum(_optionalChain([ph, 'optionalAccess', _59 => _59.y]), `${path}.phase.y`) };
3614
3813
  }
3615
3814
  return withOpacity(p);
3616
3815
  }
@@ -3623,7 +3822,7 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3623
3822
  const paint = o.paint === void 0 && base ? base.paint : o.paint === void 0 && o.color !== void 0 ? normalizeShapePaint(o.color, `${path}.color`) : normalizeShapePaint(o.paint, `${path}.paint`);
3624
3823
  const out = { width, paint };
3625
3824
  const pick = (k, allowed) => {
3626
- const value = o[k] === void 0 ? _optionalChain([base, 'optionalAccess', _56 => _56[k]]) : o[k];
3825
+ const value = o[k] === void 0 ? _optionalChain([base, 'optionalAccess', _60 => _60[k]]) : o[k];
3627
3826
  if (value === void 0) return;
3628
3827
  if (!allowed.includes(value)) fail2(`${path}.${k} must be one of ${allowed.join(", ")}, got ${JSON.stringify(value)}.`);
3629
3828
  if (value !== (k === "align" ? "center" : k === "cap" ? "butt" : "miter")) out[k] = value;
@@ -3631,9 +3830,9 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3631
3830
  pick("align", ["inside", "center", "outside"]);
3632
3831
  pick("cap", ["butt", "round", "square"]);
3633
3832
  pick("join", ["miter", "round", "bevel"]);
3634
- const miter = o.miterLimit === void 0 ? _optionalChain([base, 'optionalAccess', _57 => _57.miterLimit]) : requireNum(o.miterLimit, `${path}.miterLimit`, 1, 500);
3833
+ const miter = o.miterLimit === void 0 ? _optionalChain([base, 'optionalAccess', _61 => _61.miterLimit]) : requireNum(o.miterLimit, `${path}.miterLimit`, 1, 500);
3635
3834
  if (miter !== void 0 && miter !== DEFAULT_MITER_LIMIT) out.miterLimit = miter;
3636
- const dashes = o.dashes === void 0 ? _optionalChain([base, 'optionalAccess', _58 => _58.dashes]) : o.dashes;
3835
+ const dashes = o.dashes === void 0 ? _optionalChain([base, 'optionalAccess', _62 => _62.dashes]) : o.dashes;
3637
3836
  if (dashes !== void 0 && dashes !== null) {
3638
3837
  if (!Array.isArray(dashes) || dashes.length > 32 || !dashes.every((d) => isNum(d) && d >= 0 && d <= 1e4)) fail2(`${path}.dashes must be at most 32 lengths 0..10000 (multiples of the width).`);
3639
3838
  if (dashes.length) {
@@ -3641,7 +3840,7 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3641
3840
  out.dashes = [...dashes];
3642
3841
  }
3643
3842
  }
3644
- const offset = o.dashOffset === void 0 ? _optionalChain([base, 'optionalAccess', _59 => _59.dashOffset]) : requireNum(o.dashOffset, `${path}.dashOffset`, -1e6, 1e6);
3843
+ const offset = o.dashOffset === void 0 ? _optionalChain([base, 'optionalAccess', _63 => _63.dashOffset]) : requireNum(o.dashOffset, `${path}.dashOffset`, -1e6, 1e6);
3645
3844
  if (offset) out.dashOffset = offset;
3646
3845
  return out;
3647
3846
  }
@@ -3785,7 +3984,7 @@ function createShapeLayer(init, env, id = newLayerId()) {
3785
3984
  return rerenderShape(layer, env);
3786
3985
  }
3787
3986
  function defaultShapeName(c) {
3788
- switch (_optionalChain([c, 'optionalAccess', _60 => _60.live, 'optionalAccess', _61 => _61.kind])) {
3987
+ switch (_optionalChain([c, 'optionalAccess', _64 => _64.live, 'optionalAccess', _65 => _65.kind])) {
3789
3988
  case "rect":
3790
3989
  return "Rectangle";
3791
3990
  case "ellipse":
@@ -3980,7 +4179,7 @@ function textOutlines(layer, shaper) {
3980
4179
  }
3981
4180
  var rgbOf = (hex) => {
3982
4181
  const c = _chunkA2IS7EHEcjs.parseCssColor.call(void 0, hex);
3983
- const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _62 => _62.hex]), () => ( "#000000"))).slice(1);
4182
+ const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _66 => _66.hex]), () => ( "#000000"))).slice(1);
3984
4183
  return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
3985
4184
  };
3986
4185
  function renderOutlines(layer, shaper, region) {
@@ -4196,7 +4395,7 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
4196
4395
  surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
4197
4396
  offset: { x: 0, y: 0 }
4198
4397
  };
4199
- if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _63 => _63.runs, 'access', _64 => _64[0], 'optionalAccess', _65 => _65.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)) }];
4398
+ if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _67 => _67.runs, 'access', _68 => _68[0], 'optionalAccess', _69 => _69.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)) }];
4200
4399
  if (init.transform && !_chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
4201
4400
  if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
4202
4401
  return rerenderText(layer, env);
@@ -4207,7 +4406,7 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
4207
4406
  const patch = change(current);
4208
4407
  const next = { ...current, ...patch };
4209
4408
  if (!("annotation" in patch)) delete next.annotation;
4210
- if ("text" in patch || "runs" in patch) next.runs = _chunkEGZM52EOcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _66 => _66.runs, 'access', _67 => _67[0], 'optionalAccess', _68 => _68.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)));
4409
+ if ("text" in patch || "runs" in patch) next.runs = _chunkEGZM52EOcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _70 => _70.runs, 'access', _71 => _71[0], 'optionalAccess', _72 => _72.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)));
4211
4410
  if (!next.runs.length) next.runs = [{ length: 0, style: _chunkEGZM52EOcjs.styleAt.call(void 0, current.runs, 0, _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE) }];
4212
4411
  if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkEGZM52EOcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
4213
4412
  const rendered = rerenderText(next, env);
@@ -4494,7 +4693,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
4494
4693
  const { layers } = stack;
4495
4694
  const target = developTarget(layers, activeLayerId);
4496
4695
  const develop = target ? developFilter(target) : void 0;
4497
- const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call', _69 => _69(target), 'optionalAccess', _70 => _70.radius]) : void 0))), () => ( 0));
4696
+ const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call', _73 => _73(target), 'optionalAccess', _74 => _74.radius]) : void 0))), () => ( 0));
4498
4697
  const adjustments = {
4499
4698
  ...DEFAULT_ADJUSTMENTS_VALUES,
4500
4699
  ...develop ? {
@@ -4523,7 +4722,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
4523
4722
  };
4524
4723
  walk(layers);
4525
4724
  if (adjNodes.length) adjustments.layers = adjNodes.map((n) => legacyAdjustmentLayer(n, width, height));
4526
- const depthSource = _optionalChain([target, 'optionalAccess', _71 => _71.mask, 'optionalAccess', _72 => _72.source]);
4725
+ const depthSource = _optionalChain([target, 'optionalAccess', _75 => _75.mask, 'optionalAccess', _76 => _76.source]);
4527
4726
  const depthMask = depthSource ? { ...depthSource, depthRange: [...depthSource.depthRange] } : { ...DEFAULT_DEPTH_MASK_VALUES, depthRange: [...DEFAULT_DEPTH_MASK_VALUES.depthRange] };
4528
4727
  return { adjustments, depthMask, annotations, exact: isLegacyShape(stack) };
4529
4728
  }
@@ -4548,7 +4747,7 @@ function isLegacyShape(stack) {
4548
4747
  let adjustments = 0;
4549
4748
  for (; i < layers.length && layers[i].type === "adjustment"; i++) {
4550
4749
  const l = layers[i];
4551
- if (l.clipped || l.locks || _optionalChain([l, 'access', _73 => _73.mask, 'optionalAccess', _74 => _74.source]) || l.effects) return false;
4750
+ if (l.clipped || l.locks || _optionalChain([l, 'access', _77 => _77.mask, 'optionalAccess', _78 => _78.source]) || l.effects) return false;
4552
4751
  adjustments++;
4553
4752
  }
4554
4753
  for (; i < layers.length; i++) {
@@ -4755,7 +4954,7 @@ function isContentsDecoded(contents) {
4755
4954
  }
4756
4955
  function requireDecoded(layer, action) {
4757
4956
  if (isContentsDecoded(layer.contents)) return;
4758
- const what = _optionalChain([layer, 'access', _75 => _75.contents, 'access', _76 => _76.file, 'optionalAccess', _77 => _77.type]) ? `a ${layer.contents.file.type.toUpperCase()} file` : "a file";
4957
+ const what = _optionalChain([layer, 'access', _79 => _79.contents, 'access', _80 => _80.file, 'optionalAccess', _81 => _81.type]) ? `a ${layer.contents.file.type.toUpperCase()} file` : "a file";
4759
4958
  fail4(
4760
4959
  `The contents of smart object "${layer.name || layer.id}" are ${what} that could not be decoded here, so it cannot ${action}. Run prepareSmartObjects() in a browser first, or rasterize it.`
4761
4960
  );
@@ -4780,7 +4979,7 @@ function contentsSurface(contents) {
4780
4979
  width: W,
4781
4980
  height: H,
4782
4981
  globalLight: doc.globalLight,
4783
- pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _78 => _78.patterns, 'optionalAccess', _79 => _79.find, 'call', _80 => _80((p) => p.id === id)]), () => ( null))
4982
+ pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _82 => _82.patterns, 'optionalAccess', _83 => _83.find, 'call', _84 => _84((p) => p.id === id)]), () => ( null))
4784
4983
  });
4785
4984
  s = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width: W, height: H, data }, 4, 0, 0);
4786
4985
  }
@@ -4815,7 +5014,7 @@ function placeContents(layer, canvas, options = {}) {
4815
5014
  const preview = Boolean(options.step && options.step > 1) || Boolean(options.clip);
4816
5015
  const key = placementKey(placement, canvas);
4817
5016
  if (!preview) {
4818
- const hit = _optionalChain([placedCache, 'access', _81 => _81.get, 'call', _82 => _82(contents), 'optionalAccess', _83 => _83.get, 'call', _84 => _84(key)]);
5017
+ const hit = _optionalChain([placedCache, 'access', _85 => _85.get, 'call', _86 => _86(contents), 'optionalAccess', _87 => _87.get, 'call', _88 => _88(key)]);
4819
5018
  if (hit) return hit;
4820
5019
  }
4821
5020
  const src = contentsSurface(contents);
@@ -4842,10 +5041,10 @@ function placeContents(layer, canvas, options = {}) {
4842
5041
  let k = 1;
4843
5042
  if (step > 1) {
4844
5043
  k = step;
4845
- let r = _optionalChain([options, 'access', _85 => _85.reduced, 'optionalAccess', _86 => _86.get, 'call', _87 => _87(k)]);
5044
+ let r = _optionalChain([options, 'access', _89 => _89.reduced, 'optionalAccess', _90 => _90.get, 'call', _91 => _91(k)]);
4846
5045
  if (!r) {
4847
5046
  r = _chunkHGTDMKNEcjs.reduceSurface.call(void 0, src, k);
4848
- _optionalChain([options, 'access', _88 => _88.reduced, 'optionalAccess', _89 => _89.set, 'call', _90 => _90(k, r)]);
5047
+ _optionalChain([options, 'access', _92 => _92.reduced, 'optionalAccess', _93 => _93.set, 'call', _94 => _94(k, r)]);
4849
5048
  }
4850
5049
  source = r;
4851
5050
  }
@@ -4878,15 +5077,15 @@ function placeContents(layer, canvas, options = {}) {
4878
5077
  return out;
4879
5078
  }
4880
5079
  function activeSmartFilters(stack) {
4881
- if (!_optionalChain([stack, 'optionalAccess', _91 => _91.enabled])) return [];
5080
+ if (!_optionalChain([stack, 'optionalAccess', _95 => _95.enabled])) return [];
4882
5081
  return stack.filters.filter((f) => f.kind !== "psd" && f.kind !== "effect" && isActiveFilter(f) && f.opacity > 0);
4883
5082
  }
4884
5083
  function activeEffectSmartFilters(stack) {
4885
- if (!_optionalChain([stack, 'optionalAccess', _92 => _92.enabled])) return [];
5084
+ if (!_optionalChain([stack, 'optionalAccess', _96 => _96.enabled])) return [];
4886
5085
  return stack.filters.filter((f) => f.kind === "effect" && f.enabled && f.opacity > 0);
4887
5086
  }
4888
5087
  function runnableSmartFilters(stack) {
4889
- if (!_optionalChain([stack, 'optionalAccess', _93 => _93.enabled])) return [];
5088
+ if (!_optionalChain([stack, 'optionalAccess', _97 => _97.enabled])) return [];
4890
5089
  return stack.filters.filter((f) => f.opacity > 0 && (f.kind === "effect" ? f.enabled : f.kind !== "psd" && isActiveFilter(f)));
4891
5090
  }
4892
5091
  function filterMaskCoverage(mask, canvas) {
@@ -4912,7 +5111,7 @@ function applySmartFilters(placed, stack, canvas) {
4912
5111
  if (!active.length || !(canvas.width > 0 && canvas.height > 0)) return placed;
4913
5112
  const W = canvas.width;
4914
5113
  const H = canvas.height;
4915
- const token = active.some((f) => f.kind === "effect") ? _nullishCoalesce(_optionalChain([canvas, 'access', _94 => _94.effects, 'optionalAccess', _95 => _95.token]), () => ( -1)) : 0;
5114
+ const token = active.some((f) => f.kind === "effect") ? _nullishCoalesce(_optionalChain([canvas, 'access', _98 => _98.effects, 'optionalAccess', _99 => _99.token]), () => ( -1)) : 0;
4916
5115
  const key = JSON.stringify([W, H, token, active.map((f) => ({ ...f, id: void 0 }))]);
4917
5116
  let entry = filteredCache.get(placed);
4918
5117
  let incomplete = false;
@@ -4924,9 +5123,9 @@ function applySmartFilters(placed, stack, canvas) {
4924
5123
  if (f.kind === "effect") {
4925
5124
  if (incomplete) continue;
4926
5125
  const inputKey = JSON.stringify([surfaceId(placed), W, H, active.slice(0, i + 1).map((x) => ({ ...x, id: void 0, blend: x === f ? void 0 : x.blend, opacity: x === f ? void 0 : x.opacity }))]);
4927
- const r = _optionalChain([canvas, 'access', _96 => _96.effects, 'optionalAccess', _97 => _97.resolve, 'call', _98 => _98(f, acc, W, H, inputKey)]);
4928
- if (!_optionalChain([r, 'optionalAccess', _99 => _99.result])) {
4929
- if (_optionalChain([r, 'optionalAccess', _100 => _100.pending])) incomplete = true;
5126
+ const r = _optionalChain([canvas, 'access', _100 => _100.effects, 'optionalAccess', _101 => _101.resolve, 'call', _102 => _102(f, acc, W, H, inputKey)]);
5127
+ if (!_optionalChain([r, 'optionalAccess', _103 => _103.result])) {
5128
+ if (_optionalChain([r, 'optionalAccess', _104 => _104.pending])) incomplete = true;
4930
5129
  continue;
4931
5130
  }
4932
5131
  out2 = new Uint8ClampedArray(r.result);
@@ -4977,7 +5176,7 @@ function rerender(layer, canvas, action = "change") {
4977
5176
  return { ...layer, surface: renderSmartObject(layer, canvas) };
4978
5177
  }
4979
5178
  function normalizePlacement(raw, contents) {
4980
- const c = _optionalChain([raw, 'optionalAccess', _101 => _101.corners]);
5179
+ const c = _optionalChain([raw, 'optionalAccess', _105 => _105.corners]);
4981
5180
  if (!Array.isArray(c) || c.length !== 4 || !c.every((p) => p && Number.isFinite(p.x) && Number.isFinite(p.y))) {
4982
5181
  fail4("corners must be four finite points [top-left, top-right, bottom-right, bottom-left] in document pixels.");
4983
5182
  }
@@ -5022,7 +5221,7 @@ function setSmartPlacement(layers, id, placement, canvas) {
5022
5221
  masksMoved ||= m !== layer.mask;
5023
5222
  next.mask = m;
5024
5223
  }
5025
- if (_optionalChain([next, 'access', _102 => _102.smartFilters, 'optionalAccess', _103 => _103.mask])) {
5224
+ if (_optionalChain([next, 'access', _106 => _106.smartFilters, 'optionalAccess', _107 => _107.mask])) {
5026
5225
  const m = followMask(next.smartFilters.mask, layer, next);
5027
5226
  masksMoved ||= m !== next.smartFilters.mask;
5028
5227
  next.smartFilters = { ...next.smartFilters, mask: m };
@@ -5040,12 +5239,12 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
5040
5239
  let next = { ...layer, placement: { ...layer.placement, corners } };
5041
5240
  const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, m2.surface, mx, my) } : m2;
5042
5241
  if (layer.mask) next.mask = moveMask(layer.mask);
5043
- if (_optionalChain([layer, 'access', _104 => _104.smartFilters, 'optionalAccess', _105 => _105.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5242
+ if (_optionalChain([layer, 'access', _108 => _108.smartFilters, 'optionalAccess', _109 => _109.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5044
5243
  const spatial = activeSmartFilters(layer.smartFilters).some((f) => f.kind === "blur") || activeEffectSmartFilters(layer.smartFilters).length > 0;
5045
5244
  const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
5046
5245
  const m = SMART_RENDER_MARGIN;
5047
5246
  const cut = b && (b.x <= -m || b.y <= -m || b.x + b.width >= canvas.width + m || b.y + b.height >= canvas.height + m);
5048
- if (!spatial && !cut && !(_optionalChain([next, 'access', _106 => _106.smartFilters, 'optionalAccess', _107 => _107.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
5247
+ if (!spatial && !cut && !(_optionalChain([next, 'access', _110 => _110.smartFilters, 'optionalAccess', _111 => _111.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
5049
5248
  next = { ...next, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, mx, my) };
5050
5249
  } else {
5051
5250
  next = rerender(next, canvas, "move");
@@ -5070,7 +5269,7 @@ function translateLayer(layer, dx, dy) {
5070
5269
  mask: moveMask(layer.mask)
5071
5270
  };
5072
5271
  if (!next.mask) delete next.mask;
5073
- if (_optionalChain([layer, 'access', _108 => _108.smartFilters, 'optionalAccess', _109 => _109.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5272
+ if (_optionalChain([layer, 'access', _112 => _112.smartFilters, 'optionalAccess', _113 => _113.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5074
5273
  return next;
5075
5274
  }
5076
5275
  case "group": {
@@ -5130,14 +5329,14 @@ function union(a, b) {
5130
5329
  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 };
5131
5330
  }
5132
5331
  function asSmartFilters(filters) {
5133
- if (!_optionalChain([filters, 'optionalAccess', _110 => _110.length])) return void 0;
5332
+ if (!_optionalChain([filters, 'optionalAccess', _114 => _114.length])) return void 0;
5134
5333
  return { enabled: true, filters: filters.map((f) => ({ ...f, blend: "normal", opacity: 1 })) };
5135
5334
  }
5136
5335
  function convertToSmartObject(layers, ids, canvas, options) {
5137
5336
  if (!ids.length) fail4("Give at least one layer id to convert.");
5138
5337
  const locs = [...new Set(ids)].map((id) => requireLayer(layers, id));
5139
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _111 => _111[0], 'access', _112 => _112.parent, 'optionalAccess', _113 => _113.id]), () => ( null));
5140
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _114 => _114.parent, 'optionalAccess', _115 => _115.id]), () => ( null))) !== parent)) fail4("Layers to convert must share one parent; move them next to each other first.");
5338
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _115 => _115[0], 'access', _116 => _116.parent, 'optionalAccess', _117 => _117.id]), () => ( null));
5339
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _118 => _118.parent, 'optionalAccess', _119 => _119.id]), () => ( null))) !== parent)) fail4("Layers to convert must share one parent; move them next to each other first.");
5141
5340
  for (const l of locs) requireUnlocked(l.layer, "all", "convert it");
5142
5341
  const ordered = locs.sort((a, b) => a.index - b.index);
5143
5342
  const top = ordered[ordered.length - 1];
@@ -5195,7 +5394,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5195
5394
  delete first.clipped;
5196
5395
  nested[0] = first;
5197
5396
  }
5198
- const name = _optionalChain([options, 'access', _116 => _116.name, 'optionalAccess', _117 => _117.trim, 'call', _118 => _118()]) || top.layer.name || "Smart Object";
5397
+ const name = _optionalChain([options, 'access', _120 => _120.name, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()]) || top.layer.name || "Smart Object";
5199
5398
  const contents = documentContents({ layers: nested }, b.width, b.height, `${name}.psb`);
5200
5399
  smart = {
5201
5400
  type: "smart",
@@ -5210,7 +5409,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5210
5409
  offset: { x: 0, y: 0 }
5211
5410
  };
5212
5411
  }
5213
- if (_optionalChain([options, 'access', _119 => _119.name, 'optionalAccess', _120 => _120.trim, 'call', _121 => _121()])) smart.name = options.name.trim();
5412
+ if (_optionalChain([options, 'access', _123 => _123.name, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()])) smart.name = options.name.trim();
5214
5413
  smart = { ...smart, surface: renderSmartObject(smart, canvas) };
5215
5414
  const below = ordered.filter((l) => l.index < top.index).length;
5216
5415
  let out = layers;
@@ -5240,12 +5439,12 @@ function rasterizeSmartObject(layers, id) {
5240
5439
  function copySmartObject(layers, id, linked, name) {
5241
5440
  const loc = requireLayer(layers, id);
5242
5441
  const layer = requireSmartObject(layers, id);
5243
- const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()]) || `${layer.name || "Smart Object"} copy` };
5442
+ const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess', _126 => _126.trim, 'call', _127 => _127()]) || `${layer.name || "Smart Object"} copy` };
5244
5443
  delete copy.locks;
5245
5444
  delete copy.psd;
5246
5445
  if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
5247
5446
  if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
5248
- return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _124 => _124.parent, 'optionalAccess', _125 => _125.id]), () => ( null)), loc.index + 1), layer: copy };
5447
+ return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _128 => _128.parent, 'optionalAccess', _129 => _129.id]), () => ( null)), loc.index + 1), layer: copy };
5249
5448
  }
5250
5449
  function instancesOf(layers, contentsId) {
5251
5450
  return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
@@ -5317,7 +5516,7 @@ function stackOf(layer) {
5317
5516
  return _nullishCoalesce(layer.smartFilters, () => ( { enabled: true, filters: [] }));
5318
5517
  }
5319
5518
  function requireFilter(layer, filterId) {
5320
- const list2 = _nullishCoalesce(_optionalChain([layer, 'access', _126 => _126.smartFilters, 'optionalAccess', _127 => _127.filters]), () => ( []));
5519
+ const list2 = _nullishCoalesce(_optionalChain([layer, 'access', _130 => _130.smartFilters, 'optionalAccess', _131 => _131.filters]), () => ( []));
5321
5520
  const i = list2.findIndex((f) => f.id === filterId);
5322
5521
  if (i === -1) fail4(`Smart object "${layer.name || layer.id}" has no smart filter "${filterId}". Filters: ${list2.map((f) => `${f.id} (${f.kind})`).join(", ") || "none"}; call get_smart_object.`);
5323
5522
  return i;
@@ -5384,7 +5583,7 @@ function setSmartFiltersEnabled(layers, id, enabled, canvas) {
5384
5583
  }
5385
5584
  function setSmartFilterMask(layers, id, mask, canvas) {
5386
5585
  const layer = editableSmart(layers, id);
5387
- if (_optionalChain([mask, 'optionalAccess', _128 => _128.source])) fail4("A smart filter mask is painted, not generated; use a raster mask.");
5586
+ if (_optionalChain([mask, 'optionalAccess', _132 => _132.source])) fail4("A smart filter mask is painted, not generated; use a raster mask.");
5388
5587
  const stack = { ...stackOf(layer) };
5389
5588
  if (mask) stack.mask = mask;
5390
5589
  else delete stack.mask;
@@ -5536,7 +5735,7 @@ function serializeLayer(layer, ctx) {
5536
5735
  }
5537
5736
  }
5538
5737
  if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
5539
- if (_optionalChain([layer, 'access', _129 => _129.filters, 'optionalAccess', _130 => _130.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
5738
+ if (_optionalChain([layer, 'access', _133 => _133.filters, 'optionalAccess', _134 => _134.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
5540
5739
  if (layer.generator) out.generator = JSON.parse(JSON.stringify(layer.generator));
5541
5740
  if (layer.source !== "document") {
5542
5741
  const deep = encodeDeepSurface(layer.surface);
@@ -5579,12 +5778,12 @@ function serializeType(layer, base, ctx) {
5579
5778
  out.x = enc.x;
5580
5779
  out.y = enc.y;
5581
5780
  }
5582
- if (_optionalChain([layer, 'access', _131 => _131.missingFonts, 'optionalAccess', _132 => _132.length])) out.missingFonts = [...layer.missingFonts];
5781
+ if (_optionalChain([layer, 'access', _135 => _135.missingFonts, 'optionalAccess', _136 => _136.length])) out.missingFonts = [...layer.missingFonts];
5583
5782
  if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
5584
- if (_optionalChain([layer, 'access', _133 => _133.psd, 'optionalAccess', _134 => _134.tySh]) || _optionalChain([layer, 'access', _135 => _135.psd, 'optionalAccess', _136 => _136.blocks, 'optionalAccess', _137 => _137.length])) {
5783
+ if (_optionalChain([layer, 'access', _137 => _137.psd, 'optionalAccess', _138 => _138.tySh]) || _optionalChain([layer, 'access', _139 => _139.psd, 'optionalAccess', _140 => _140.blocks, 'optionalAccess', _141 => _141.length])) {
5585
5784
  out.psd = {};
5586
5785
  if (layer.psd.tySh) out.psd.tySh = _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, layer.psd.tySh);
5587
- if (_optionalChain([layer, 'access', _138 => _138.psd, 'access', _139 => _139.blocks, 'optionalAccess', _140 => _140.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, b.data) }));
5786
+ if (_optionalChain([layer, 'access', _142 => _142.psd, 'access', _143 => _143.blocks, 'optionalAccess', _144 => _144.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, b.data) }));
5588
5787
  if (layer.psd.signature) out.psd.signature = layer.psd.signature;
5589
5788
  }
5590
5789
  return out;
@@ -5594,15 +5793,15 @@ function readType(r, base, ctx) {
5594
5793
  try {
5595
5794
  const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
5596
5795
  const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
5597
- length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _141 => _141.length]), 0, 1e9, 0))),
5598
- style: patchTextStyle(_chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _142 => _142.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
5796
+ length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _145 => _145.length]), 0, 1e9, 0))),
5797
+ style: patchTextStyle(_chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _146 => _146.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
5599
5798
  }));
5600
5799
  const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
5601
- length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _143 => _143.length]), 0, 1e9, 0))),
5602
- style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess', _144 => _144.style]) && typeof p.style === "object" ? p.style : {}, `paragraphs[${i}].style`)
5800
+ length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _147 => _147.length]), 0, 1e9, 0))),
5801
+ style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess', _148 => _148.style]) && typeof p.style === "object" ? p.style : {}, `paragraphs[${i}].style`)
5603
5802
  }));
5604
5803
  const f = r.frame;
5605
- const frame = _optionalChain([f, 'optionalAccess', _145 => _145.kind]) === "box" ? { kind: "box", width: num2(f.width, 1, 1e6, 100), height: num2(f.height, 1, 1e6, 100) } : _optionalChain([f, 'optionalAccess', _146 => _146.origin]) === "top" ? { kind: "point", origin: "top" } : { kind: "point" };
5804
+ const frame = _optionalChain([f, 'optionalAccess', _149 => _149.kind]) === "box" ? { kind: "box", width: num2(f.width, 1, 1e6, 100), height: num2(f.height, 1, 1e6, 100) } : _optionalChain([f, 'optionalAccess', _150 => _150.origin]) === "top" ? { kind: "point", origin: "top" } : { kind: "point" };
5606
5805
  const m = Array.isArray(r.transform) && r.transform.length === 6 && r.transform.every((v) => typeof v === "number" && Number.isFinite(v)) ? r.transform : void 0;
5607
5806
  const layer = {
5608
5807
  ...base,
@@ -5614,7 +5813,7 @@ function readType(r, base, ctx) {
5614
5813
  surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
5615
5814
  offset: { x: 0, y: 0 }
5616
5815
  };
5617
- if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _147 => _147[0], 'optionalAccess', _148 => _148.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)) }];
5816
+ if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _151 => _151[0], 'optionalAccess', _152 => _152.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)) }];
5618
5817
  if (m) layer.transform = m;
5619
5818
  if (r.antiAlias === false) layer.antiAlias = false;
5620
5819
  if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
@@ -5625,10 +5824,10 @@ function readType(r, base, ctx) {
5625
5824
  if (typeof r.psd.tySh === "string") psd.tySh = _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, r.psd.tySh);
5626
5825
  if (Array.isArray(r.psd.blocks)) psd.blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, b.data) }));
5627
5826
  if (typeof r.psd.signature === "string") psd.signature = r.psd.signature;
5628
- if (psd.tySh || _optionalChain([psd, 'access', _149 => _149.blocks, 'optionalAccess', _150 => _150.length])) layer.psd = psd;
5827
+ if (psd.tySh || _optionalChain([psd, 'access', _153 => _153.blocks, 'optionalAccess', _154 => _154.length])) layer.psd = psd;
5629
5828
  }
5630
5829
  if (typeof r.asset === "string") return { ...layer, surface: readSurface(r.asset, r.x, r.y, 4, 0, ctx, label), rendering: "stored" };
5631
- const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _151 => _151.text, 'optionalAccess', _152 => _152.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _153 => _153.text, 'optionalAccess', _154 => _154.createCanvas]) };
5830
+ const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _155 => _155.text, 'optionalAccess', _156 => _156.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _157 => _157.text, 'optionalAccess', _158 => _158.createCanvas]) };
5632
5831
  try {
5633
5832
  return rerenderText(layer, env);
5634
5833
  } catch (e8) {
@@ -5651,7 +5850,7 @@ function serializeShape(layer, base) {
5651
5850
  if (layer.inverted) out.inverted = true;
5652
5851
  if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
5653
5852
  if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
5654
- if (_optionalChain([layer, 'access', _155 => _155.psd, 'optionalAccess', _156 => _156.blocks, 'optionalAccess', _157 => _157.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
5853
+ if (_optionalChain([layer, 'access', _159 => _159.psd, 'optionalAccess', _160 => _160.blocks, 'optionalAccess', _161 => _161.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
5655
5854
  return out;
5656
5855
  }
5657
5856
  function readShape(r, base, ctx) {
@@ -5665,12 +5864,12 @@ function readShape(r, base, ctx) {
5665
5864
  if (!data) {
5666
5865
  if (!Array.isArray(r.components) || !r.components.length) throw new Error("it has no components");
5667
5866
  const components = r.components.map((c, i) => {
5668
- const op = requireOperation(_optionalChain([c, 'optionalAccess', _158 => _158.op]), `components[${i}].op`);
5669
- if (_optionalChain([c, 'optionalAccess', _159 => _159.live])) {
5867
+ const op = requireOperation(_optionalChain([c, 'optionalAccess', _162 => _162.op]), `components[${i}].op`);
5868
+ if (_optionalChain([c, 'optionalAccess', _163 => _163.live])) {
5670
5869
  const live = normalizeLiveShape(c.live, `components[${i}].live`);
5671
5870
  return { op, subpaths: liveShapeSubpaths(live), live };
5672
5871
  }
5673
- return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _160 => _160.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _161 => _161.subpaths]), `components[${i}].subpaths`) };
5872
+ return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _164 => _164.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _165 => _165.subpaths]), `components[${i}].subpaths`) };
5674
5873
  });
5675
5874
  data = {
5676
5875
  components,
@@ -5741,7 +5940,7 @@ function serializeContents(c, ctx) {
5741
5940
  if (c.kind === "document" && c.document) {
5742
5941
  out.layers = c.document.layers.map((l) => serializeLayer(l, ctx));
5743
5942
  if (c.document.globalLight) out.globalLight = { ...c.document.globalLight };
5744
- if (_optionalChain([c, 'access', _162 => _162.document, 'access', _163 => _163.patterns, 'optionalAccess', _164 => _164.length])) out.patterns = serializePatterns(c.document.patterns);
5943
+ if (_optionalChain([c, 'access', _166 => _166.document, 'access', _167 => _167.patterns, 'optionalAccess', _168 => _168.length])) out.patterns = serializePatterns(c.document.patterns);
5745
5944
  }
5746
5945
  if (c.file) out.file = { type: c.file.type, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, c.file.bytes) };
5747
5946
  if (c.linked) out.linked = { path: c.linked.path };
@@ -5921,7 +6120,7 @@ function deserializeLayer(raw, ctx) {
5921
6120
  ...base,
5922
6121
  type: "pixel",
5923
6122
  surface: r.source === "document" ? _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
5924
- offset: { x: Math.round(num2(_optionalChain([r, 'access', _165 => _165.offset, 'optionalAccess', _166 => _166.x]), -1e7, 1e7, 0)), y: Math.round(num2(_optionalChain([r, 'access', _167 => _167.offset, 'optionalAccess', _168 => _168.y]), -1e7, 1e7, 0)) }
6123
+ offset: { x: Math.round(num2(_optionalChain([r, 'access', _169 => _169.offset, 'optionalAccess', _170 => _170.x]), -1e7, 1e7, 0)), y: Math.round(num2(_optionalChain([r, 'access', _171 => _171.offset, 'optionalAccess', _172 => _172.y]), -1e7, 1e7, 0)) }
5925
6124
  };
5926
6125
  if (r.source === "document") layer.source = "document";
5927
6126
  else if (r.deep) layer.surface = decodeDeepSurface(layer.surface, r.deep, ctx.problems, `Layer "${base.name || id}"`);
@@ -5930,7 +6129,7 @@ function deserializeLayer(raw, ctx) {
5930
6129
  if (filters) layer.filters = filters;
5931
6130
  const generator = readEffectRef(r.generator);
5932
6131
  if (generator) {
5933
- const duration = _optionalChain([r, 'access', _169 => _169.generator, 'access', _170 => _170.animate, 'optionalAccess', _171 => _171.duration]);
6132
+ const duration = _optionalChain([r, 'access', _173 => _173.generator, 'access', _174 => _174.animate, 'optionalAccess', _175 => _175.duration]);
5934
6133
  layer.generator = {
5935
6134
  ...generator,
5936
6135
  ...typeof r.generator.time === "number" && r.generator.time > 0 ? { time: r.generator.time } : {},
@@ -5961,7 +6160,7 @@ function deserializeLayer(raw, ctx) {
5961
6160
  return null;
5962
6161
  }
5963
6162
  const annotation = JSON.parse(JSON.stringify({ ...a, id: typeof a.id === "string" ? a.id : id }));
5964
- const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _172 => _172.text, 'optionalAccess', _173 => _173.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _174 => _174.text, 'optionalAccess', _175 => _175.createCanvas]) });
6163
+ const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _176 => _176.text, 'optionalAccess', _177 => _177.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _178 => _178.text, 'optionalAccess', _179 => _179.createCanvas]) });
5965
6164
  if (migrated.type === "shape" || migrated.type === "type") {
5966
6165
  const blend = base.blend === "normal" ? migrated.blend : base.blend;
5967
6166
  return { ...migrated, ...base, blend, id, name: base.name };
@@ -6241,9 +6440,9 @@ var PsdReader = class _PsdReader {
6241
6440
  return s.replace(/\u0000+$/, "");
6242
6441
  }
6243
6442
  };
6244
- var PsdWriter = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
6245
- __init() {this.buf = new Uint8Array(1 << 16)}
6246
- __init2() {this.length = 0}
6443
+ var PsdWriter = (_class2 = class {constructor() { _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
6444
+ __init2() {this.buf = new Uint8Array(1 << 16)}
6445
+ __init3() {this.length = 0}
6247
6446
  ensure(n) {
6248
6447
  if (this.length + n <= this.buf.length) return;
6249
6448
  let size = this.buf.length * 2;
@@ -6328,7 +6527,7 @@ var PsdWriter = (_class = class {constructor() { _class.prototype.__init.call(th
6328
6527
  result() {
6329
6528
  return this.buf.slice(0, this.length);
6330
6529
  }
6331
- }, _class);
6530
+ }, _class2);
6332
6531
  function decodeLegacyName(b) {
6333
6532
  try {
6334
6533
  return new TextDecoder("utf-8", { fatal: true }).decode(b);
@@ -6539,7 +6738,7 @@ function descriptor(classId, items = []) {
6539
6738
  return { name: "", classId, items };
6540
6739
  }
6541
6740
  function descGet(d, key) {
6542
- return _optionalChain([d, 'access', _176 => _176.items, 'access', _177 => _177.find, 'call', _178 => _178(([k]) => k === key), 'optionalAccess', _179 => _179[1]]);
6741
+ return _optionalChain([d, 'access', _180 => _180.items, 'access', _181 => _181.find, 'call', _182 => _182(([k]) => k === key), 'optionalAccess', _183 => _183[1]]);
6543
6742
  }
6544
6743
  function descNumber(d, key) {
6545
6744
  const v = descGet(d, key);
@@ -6549,7 +6748,7 @@ function descNumber(d, key) {
6549
6748
  }
6550
6749
  function descBool(d, key) {
6551
6750
  const v = descGet(d, key);
6552
- return _optionalChain([v, 'optionalAccess', _180 => _180.type]) === "bool" ? v.value : void 0;
6751
+ return _optionalChain([v, 'optionalAccess', _184 => _184.type]) === "bool" ? v.value : void 0;
6553
6752
  }
6554
6753
  function descObject(d, key) {
6555
6754
  const v = descGet(d, key);
@@ -7133,7 +7332,7 @@ function writeAdjustmentBlock(kind, params) {
7133
7332
 
7134
7333
  // src/image-editor/psd/channels.ts
7135
7334
  var hexToRgb2 = (hex) => {
7136
- const v = parseInt(_nullishCoalesce(_optionalChain([/^#?([0-9a-f]{6})$/i, 'access', _181 => _181.exec, 'call', _182 => _182(hex), 'optionalAccess', _183 => _183[1]]), () => ( "ff0000")), 16);
7335
+ const v = parseInt(_nullishCoalesce(_optionalChain([/^#?([0-9a-f]{6})$/i, 'access', _185 => _185.exec, 'call', _186 => _186(hex), 'optionalAccess', _187 => _187[1]]), () => ( "ff0000")), 16);
7137
7336
  return [v >> 16 & 255, v >> 8 & 255, v & 255];
7138
7337
  };
7139
7338
  var rgbToHex = (r, g, b) => `#${[r, g, b].map((c) => c.toString(16).padStart(2, "0")).join("")}`;
@@ -7207,16 +7406,16 @@ function readAlphaChannels(planes, header, first, resource2, warn) {
7207
7406
  if (start + size > planes.length) break;
7208
7407
  const d = display[i];
7209
7408
  const name = names[i] || `Alpha ${i + 1}`;
7210
- if (_optionalChain([d, 'optionalAccess', _184 => _184.kind]) === 2) {
7409
+ if (_optionalChain([d, 'optionalAccess', _188 => _188.kind]) === 2) {
7211
7410
  warn(`Spot colour channel "${name}" is not supported and was left out.`);
7212
7411
  continue;
7213
7412
  }
7214
7413
  out.push({
7215
7414
  name,
7216
7415
  data: planeTo8(planes.subarray(start, start + size), n, header.depth),
7217
- color: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _185 => _185.color]), () => ( "#ff0000")),
7218
- opacity: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _186 => _186.opacity]), () => ( 0.5)),
7219
- indicates: _optionalChain([d, 'optionalAccess', _187 => _187.kind]) === 0 ? "selected" : "masked"
7416
+ color: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _189 => _189.color]), () => ( "#ff0000")),
7417
+ opacity: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _190 => _190.opacity]), () => ( 0.5)),
7418
+ indicates: _optionalChain([d, 'optionalAccess', _191 => _191.kind]) === 0 ? "selected" : "masked"
7220
7419
  });
7221
7420
  }
7222
7421
  return out;
@@ -7361,7 +7560,7 @@ var enumV = (typeId, value) => ({ type: "enum", typeId, value });
7361
7560
  var obj = (d) => ({ type: "Objc", value: d });
7362
7561
  var enumOf = (d, key) => {
7363
7562
  const v = descGet(d, key);
7364
- return _optionalChain([v, 'optionalAccess', _188 => _188.type]) === "enum" ? v.value : void 0;
7563
+ return _optionalChain([v, 'optionalAccess', _192 => _192.type]) === "enum" ? v.value : void 0;
7365
7564
  };
7366
7565
  function read(data) {
7367
7566
  try {
@@ -7443,7 +7642,7 @@ function strokeFromVstk(data, dpi, notes) {
7443
7642
  const miter = descNumber(d, "strokeStyleMiterLimit");
7444
7643
  if (miter !== void 0 && miter !== 100) stroke.miterLimit = Math.max(1, Math.min(500, miter));
7445
7644
  const dashes = descGet(d, "strokeStyleLineDashSet");
7446
- if (_optionalChain([dashes, 'optionalAccess', _189 => _189.type]) === "VlLs") {
7645
+ if (_optionalChain([dashes, 'optionalAccess', _193 => _193.type]) === "VlLs") {
7447
7646
  const list2 = dashes.items.map((v) => v.type === "UntF" || v.type === "doub" || v.type === "long" ? v.value : NaN).filter((v) => Number.isFinite(v) && v >= 0);
7448
7647
  if (list2.length && list2.some((v) => v > 0)) stroke.dashes = list2;
7449
7648
  }
@@ -7595,7 +7794,7 @@ function vogkBytes(components, dpi) {
7595
7794
  ["keyOriginLineArrowEnd", boolV(Boolean(live.endArrow))],
7596
7795
  ["keyOriginLineArrWdth", dbl(head ? head.width / w * 100 : 0)],
7597
7796
  ["keyOriginLineArrLngth", dbl(head ? head.length / w * 100 : 0)],
7598
- ["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess', _190 => _190.concavity]) ? head.concavity * 100 : 0)]
7797
+ ["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess', _194 => _194.concavity]) ? head.concavity * 100 : 0)]
7599
7798
  ];
7600
7799
  }
7601
7800
  const m = live.transform;
@@ -7628,7 +7827,7 @@ function shapeSignature(layer) {
7628
7827
  return JSON.stringify([layer.components, layer.fill, layer.stroke, _nullishCoalesce(layer.fillRule, () => ( "nonzero")), Boolean(layer.inverted)]);
7629
7828
  }
7630
7829
  function shapeFromBlocks(blocks, width, height, dpi, notes) {
7631
- const block = (k) => _optionalChain([blocks, 'access', _191 => _191.find, 'call', _192 => _192((b) => b.key === k), 'optionalAccess', _193 => _193.data]);
7830
+ const block = (k) => _optionalChain([blocks, 'access', _195 => _195.find, 'call', _196 => _196((b) => b.key === k), 'optionalAccess', _197 => _197.data]);
7632
7831
  const vector = _nullishCoalesce(block("vsms"), () => ( block("vmsk")));
7633
7832
  const path = vector ? componentsFromVectorBlock(vector, width, height) : null;
7634
7833
  if (!path) return null;
@@ -7683,18 +7882,18 @@ function sameExtent(sub, c) {
7683
7882
  return a.every((v, i) => Math.abs(v - b[i]) < 1);
7684
7883
  }
7685
7884
  function shapeBlocks(layer, width, height, dpi, notes) {
7686
- const kept = _optionalChain([layer, 'access', _194 => _194.psd, 'optionalAccess', _195 => _195.blocks]);
7687
- if (_optionalChain([kept, 'optionalAccess', _196 => _196.length]) && _optionalChain([layer, 'access', _197 => _197.psd, 'optionalAccess', _198 => _198.signature]) === shapeSignature(layer)) return kept.map((b) => ({ key: b.key, data: b.data }));
7885
+ const kept = _optionalChain([layer, 'access', _198 => _198.psd, 'optionalAccess', _199 => _199.blocks]);
7886
+ if (_optionalChain([kept, 'optionalAccess', _200 => _200.length]) && _optionalChain([layer, 'access', _201 => _201.psd, 'optionalAccess', _202 => _202.signature]) === shapeSignature(layer)) return kept.map((b) => ({ key: b.key, data: b.data }));
7688
7887
  const out = [];
7689
7888
  out.push({ key: "vsms", data: vectorBlockForComponents(layer.components, Boolean(layer.inverted), width, height) });
7690
7889
  if (layer.fillRule === "evenodd" && layer.components.some((c) => c.subpaths.length > 1)) notes.add("Even-odd fill rules were written as nonzero (Photoshop fills shapes nonzero)");
7691
7890
  const fill = _nullishCoalesce(layer.fill, () => ( { type: "color", color: "#000000" }));
7692
- if (_optionalChain([layer, 'access', _199 => _199.fill, 'optionalAccess', _200 => _200.opacity]) !== void 0 && layer.fill.opacity < 1) notes.add("Shape fill opacity has no PSD equivalent and was written as 100 % (use the layer fill opacity)");
7891
+ if (_optionalChain([layer, 'access', _203 => _203.fill, 'optionalAccess', _204 => _204.opacity]) !== void 0 && layer.fill.opacity < 1) notes.add("Shape fill opacity has no PSD equivalent and was written as 100 % (use the layer fill opacity)");
7693
7892
  out.push({ key: "vscg", data: vscgBytes(fill) });
7694
7893
  if (layer.stroke || !layer.fill) out.push({ key: "vstk", data: vstkBytes(layer.stroke, Boolean(layer.fill), dpi) });
7695
7894
  const vogk = vogkBytes(layer.components, dpi);
7696
7895
  if (vogk) out.push({ key: "vogk", data: vogk });
7697
- if (layer.components.some((c) => _optionalChain([c, 'access', _201 => _201.live, 'optionalAccess', _202 => _202.kind]) === "line" && (c.live.startArrow && c.live.endArrow && JSON.stringify(c.live.startArrow) !== JSON.stringify(c.live.endArrow) || false))) {
7896
+ if (layer.components.some((c) => _optionalChain([c, 'access', _205 => _205.live, 'optionalAccess', _206 => _206.kind]) === "line" && (c.live.startArrow && c.live.endArrow && JSON.stringify(c.live.startArrow) !== JSON.stringify(c.live.endArrow) || false))) {
7698
7897
  notes.add("Lines with different start and end arrowheads were written with one arrowhead size (Photoshop has one)");
7699
7898
  }
7700
7899
  return out;
@@ -7903,7 +8102,7 @@ var E = {
7903
8102
  bool: (value) => ({ t: "bool", value })
7904
8103
  };
7905
8104
  function eGet(v, key) {
7906
- return _optionalChain([v, 'optionalAccess', _203 => _203.t]) === "dict" ? _optionalChain([v, 'access', _204 => _204.items, 'access', _205 => _205.find, 'call', _206 => _206(([k]) => k === key), 'optionalAccess', _207 => _207[1]]) : void 0;
8105
+ return _optionalChain([v, 'optionalAccess', _207 => _207.t]) === "dict" ? _optionalChain([v, 'access', _208 => _208.items, 'access', _209 => _209.find, 'call', _210 => _210(([k]) => k === key), 'optionalAccess', _211 => _211[1]]) : void 0;
7907
8106
  }
7908
8107
  function ePath(v, keys) {
7909
8108
  return keys.reduce((at, k) => eGet(at, k), v);
@@ -7921,7 +8120,7 @@ function eStr(v) {
7921
8120
  return v && (v.t === "string" || v.t === "name") ? v.value : void 0;
7922
8121
  }
7923
8122
  function eArray(v) {
7924
- return _optionalChain([v, 'optionalAccess', _208 => _208.t]) === "array" ? v.items : [];
8123
+ return _optionalChain([v, 'optionalAccess', _212 => _212.t]) === "array" ? v.items : [];
7925
8124
  }
7926
8125
  function eSet(d, key, value) {
7927
8126
  if (d.t !== "dict") return;
@@ -8023,7 +8222,7 @@ function fontFromPostScript(ps) {
8023
8222
  }
8024
8223
  family += suffix;
8025
8224
  const s = style.toLowerCase();
8026
- const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access', _209 => _209.find, 'call', _210 => _210(([re]) => re.test(s)), 'optionalAccess', _211 => _211[1]]), () => ( 400));
8225
+ const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access', _213 => _213.find, 'call', _214 => _214(([re]) => re.test(s)), 'optionalAccess', _215 => _215[1]]), () => ( 400));
8027
8226
  return { family: family || ps, weight, italic: /italic|oblique|it$/.test(s) };
8028
8227
  }
8029
8228
  var STYLE_NAMES = [
@@ -8048,7 +8247,7 @@ var hex2 = (v) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).pad
8048
8247
  function merged(levels) {
8049
8248
  const items = [];
8050
8249
  for (const l of levels) {
8051
- if (_optionalChain([l, 'optionalAccess', _212 => _212.t]) !== "dict") continue;
8250
+ if (_optionalChain([l, 'optionalAccess', _216 => _216.t]) !== "dict") continue;
8052
8251
  for (const [k, v] of l.items) if (!items.some(([o]) => o === k)) items.push([k, v]);
8053
8252
  }
8054
8253
  return E.dict(items);
@@ -8119,10 +8318,10 @@ function typeFromTySh(data, notes) {
8119
8318
  const t = parseTySh(data);
8120
8319
  if (!t) return null;
8121
8320
  const txtV = descGet(t.text, "Txt ");
8122
- const txt = _optionalChain([txtV, 'optionalAccess', _213 => _213.type]) === "TEXT" ? txtV.value.replace(/\0+$/, "") : void 0;
8321
+ const txt = _optionalChain([txtV, 'optionalAccess', _217 => _217.type]) === "TEXT" ? txtV.value.replace(/\0+$/, "") : void 0;
8123
8322
  const ed = descGet(t.text, "EngineData");
8124
8323
  let engine = null;
8125
- if (_optionalChain([ed, 'optionalAccess', _214 => _214.type]) === "tdta") {
8324
+ if (_optionalChain([ed, 'optionalAccess', _218 => _218.type]) === "tdta") {
8126
8325
  try {
8127
8326
  engine = parseEngineData(ed.data);
8128
8327
  } catch (e18) {
@@ -8130,12 +8329,12 @@ function typeFromTySh(data, notes) {
8130
8329
  }
8131
8330
  }
8132
8331
  const anti = descGet(t.text, "AntA");
8133
- const antiAlias = !(_optionalChain([anti, 'optionalAccess', _215 => _215.type]) === "enum" && (anti.value === "Anno" || anti.value === "antiAliasNone"));
8332
+ const antiAlias = !(_optionalChain([anti, 'optionalAccess', _219 => _219.type]) === "enum" && (anti.value === "Anno" || anti.value === "antiAliasNone"));
8134
8333
  const ornt = descGet(t.text, "Ornt");
8135
- if (_optionalChain([ornt, 'optionalAccess', _216 => _216.type]) === "enum" && ornt.value === "Vrtc") notes.add("vertical type is laid out horizontally");
8334
+ if (_optionalChain([ornt, 'optionalAccess', _220 => _220.type]) === "enum" && ornt.value === "Vrtc") notes.add("vertical type is laid out horizontally");
8136
8335
  if (t.warp) {
8137
8336
  const style = descGet(t.warp, "warpStyle");
8138
- if (_optionalChain([style, 'optionalAccess', _217 => _217.type]) === "enum" && style.value !== "warpNone") notes.add("warped text is drawn without its warp when edited");
8337
+ if (_optionalChain([style, 'optionalAccess', _221 => _221.type]) === "enum" && style.value !== "warpNone") notes.add("warped text is drawn without its warp when edited");
8139
8338
  }
8140
8339
  const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
8141
8340
  const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
@@ -8184,7 +8383,7 @@ function typeFromTySh(data, notes) {
8184
8383
  let at = 0;
8185
8384
  runs = ssheets.map((sheet, i) => {
8186
8385
  const own = named(styleSet, sheet);
8187
- const paraDefault = _optionalChain([paraBases, 'access', _218 => _218[paraAt(at)], 'optionalAccess', _219 => _219.charDefault]);
8386
+ const paraDefault = _optionalChain([paraBases, 'access', _222 => _222[paraAt(at)], 'optionalAccess', _223 => _223.charDefault]);
8188
8387
  at += _nullishCoalesce(slens[i], () => ( 0));
8189
8388
  const d = merged([eGet(sheet, "StyleSheetData"), eGet(own, "StyleSheetData"), eGet(paraDefault, "StyleSheetData"), eGet(normalStyle, "StyleSheetData")]);
8190
8389
  return { length: _nullishCoalesce(slens[i], () => ( 0)), style: charStyle(d, fonts, notes) };
@@ -8263,8 +8462,8 @@ var fontEntry = (name) => E.dict([
8263
8462
  ["Synthetic", E.int(0)]
8264
8463
  ]);
8265
8464
  function buildEngineData(layer, template) {
8266
- const e = _optionalChain([template, 'optionalAccess', _220 => _220.t]) === "dict" ? eClone(template) : E.dict([["EngineDict", E.dict()], ["ResourceDict", E.dict()]]);
8267
- if (_optionalChain([eGet, 'call', _221 => _221(e, "EngineDict"), 'optionalAccess', _222 => _222.t]) !== "dict") eSet(e, "EngineDict", E.dict());
8465
+ const e = _optionalChain([template, 'optionalAccess', _224 => _224.t]) === "dict" ? eClone(template) : E.dict([["EngineDict", E.dict()], ["ResourceDict", E.dict()]]);
8466
+ if (_optionalChain([eGet, 'call', _225 => _225(e, "EngineDict"), 'optionalAccess', _226 => _226.t]) !== "dict") eSet(e, "EngineDict", E.dict());
8268
8467
  const dict = eGet(e, "EngineDict");
8269
8468
  const text3 = layer.text.replace(/\n/g, "\r");
8270
8469
  const edText = `${text3}\r`;
@@ -8343,7 +8542,7 @@ function buildEngineData(layer, template) {
8343
8542
  eSet(e, key, rd);
8344
8543
  }
8345
8544
  eSet(rd, "FontSet", fontSet);
8346
- if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _223 => _223[0], 'optionalAccess', _224 => _224.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
8545
+ if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _227 => _227[0], 'optionalAccess', _228 => _228.style]), () => ( _chunkEGZM52EOcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
8347
8546
  if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
8348
8547
  if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
8349
8548
  if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
@@ -8364,12 +8563,12 @@ function inkBounds2(layer) {
8364
8563
  return [Math.min(...pts.map((p) => p.x)), Math.min(...pts.map((p) => p.y)), Math.max(...pts.map((p) => p.x)), Math.max(...pts.map((p) => p.y))];
8365
8564
  }
8366
8565
  function tyShForLayer(layer) {
8367
- const raw = _optionalChain([layer, 'access', _225 => _225.psd, 'optionalAccess', _226 => _226.tySh]);
8368
- if (raw && _optionalChain([layer, 'access', _227 => _227.psd, 'optionalAccess', _228 => _228.signature]) === typeSignature(layer)) return raw;
8566
+ const raw = _optionalChain([layer, 'access', _229 => _229.psd, 'optionalAccess', _230 => _230.tySh]);
8567
+ if (raw && _optionalChain([layer, 'access', _231 => _231.psd, 'optionalAccess', _232 => _232.signature]) === typeSignature(layer)) return raw;
8369
8568
  const old = raw ? parseTySh(raw) : null;
8370
8569
  const oldEd = old ? descGet(old.text, "EngineData") : void 0;
8371
8570
  let template = null;
8372
- if (_optionalChain([oldEd, 'optionalAccess', _229 => _229.type]) === "tdta") {
8571
+ if (_optionalChain([oldEd, 'optionalAccess', _233 => _233.type]) === "tdta") {
8373
8572
  try {
8374
8573
  template = parseEngineData(oldEd.data);
8375
8574
  } catch (e19) {
@@ -8401,8 +8600,8 @@ function tyShForLayer(layer) {
8401
8600
  set("boundingBox", rect("boundingBox"));
8402
8601
  if (!descGet(text3, "TextIndex")) set("TextIndex", { type: "long", value: 0 });
8403
8602
  set("EngineData", { type: "tdta", data: writeEngineData(engine) });
8404
- const warpStyle = _optionalChain([old, 'optionalAccess', _230 => _230.warp]) ? descGet(old.warp, "warpStyle") : void 0;
8405
- const warp = _optionalChain([old, 'optionalAccess', _231 => _231.warp]) && _optionalChain([warpStyle, 'optionalAccess', _232 => _232.type]) === "enum" && warpStyle.value === "warpNone" ? old.warp : null;
8603
+ const warpStyle = _optionalChain([old, 'optionalAccess', _234 => _234.warp]) ? descGet(old.warp, "warpStyle") : void 0;
8604
+ const warp = _optionalChain([old, 'optionalAccess', _235 => _235.warp]) && _optionalChain([warpStyle, 'optionalAccess', _236 => _236.type]) === "enum" && warpStyle.value === "warpNone" ? old.warp : null;
8406
8605
  return writeTySh({ transform: textMatrix(layer), text: text3, warp, tail: new Uint8Array(16) });
8407
8606
  }
8408
8607
 
@@ -8416,15 +8615,15 @@ var textV = (value) => ({ type: "TEXT", value });
8416
8615
  var obj2 = (d) => ({ type: "Objc", value: d });
8417
8616
  var text = (d, key) => {
8418
8617
  const v = descGet(d, key);
8419
- return _optionalChain([v, 'optionalAccess', _233 => _233.type]) === "TEXT" ? v.value : void 0;
8618
+ return _optionalChain([v, 'optionalAccess', _237 => _237.type]) === "TEXT" ? v.value : void 0;
8420
8619
  };
8421
8620
  var enumOf2 = (d, key) => {
8422
8621
  const v = descGet(d, key);
8423
- return _optionalChain([v, 'optionalAccess', _234 => _234.type]) === "enum" ? v.value : void 0;
8622
+ return _optionalChain([v, 'optionalAccess', _238 => _238.type]) === "enum" ? v.value : void 0;
8424
8623
  };
8425
8624
  var numbers = (d, key) => {
8426
8625
  const v = descGet(d, key);
8427
- if (_optionalChain([v, 'optionalAccess', _235 => _235.type]) !== "VlLs") return null;
8626
+ if (_optionalChain([v, 'optionalAccess', _239 => _239.type]) !== "VlLs") return null;
8428
8627
  const out = [];
8429
8628
  for (const it of v.items) {
8430
8629
  if (it.type === "doub" || it.type === "UntF" || it.type === "long") out.push(it.value);
@@ -8619,8 +8818,8 @@ function filterMaskItem(placed, mask, area) {
8619
8818
  const painted = _chunkCWM3CUUXcjs.contentBounds.call(void 0, mask.surface);
8620
8819
  let b = _nullishCoalesce(painted, () => ( { x: 0, y: 0, width: 1, height: 1 }));
8621
8820
  if (mask.defaultValue !== 255 && area) {
8622
- const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _236 => _236.x]), () => ( area.x)));
8623
- const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _237 => _237.y]), () => ( area.y)));
8821
+ const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _240 => _240.x]), () => ( area.x)));
8822
+ const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _241 => _241.y]), () => ( area.y)));
8624
8823
  const x1 = Math.max(area.x + area.width, painted ? painted.x + painted.width : 0);
8625
8824
  const y1 = Math.max(area.y + area.height, painted ? painted.y + painted.height : 0);
8626
8825
  b = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
@@ -8640,7 +8839,7 @@ function filterMaskItem(placed, mask, area) {
8640
8839
  }
8641
8840
  var warpStyleOf = (name) => {
8642
8841
  if (!name.startsWith("warp")) return null;
8643
- const s = _optionalChain([name, 'access', _238 => _238[4], 'optionalAccess', _239 => _239.toLowerCase, 'call', _240 => _240()]) + name.slice(5);
8842
+ const s = _optionalChain([name, 'access', _242 => _242[4], 'optionalAccess', _243 => _243.toLowerCase, 'call', _244 => _244()]) + name.slice(5);
8644
8843
  return _chunkEGZM52EOcjs.WARP_STYLES.includes(s) ? s : null;
8645
8844
  };
8646
8845
  function warpFromDescriptor(w, contents) {
@@ -8662,7 +8861,7 @@ function warpFromDescriptor(w, contents) {
8662
8861
  if (!arr || arr.type !== "ObAr") return void 0;
8663
8862
  const xs = descGet(arr.body, "Hrzn");
8664
8863
  const ys = descGet(arr.body, "Vrtc");
8665
- if (_optionalChain([xs, 'optionalAccess', _241 => _241.type]) !== "UnFl" || _optionalChain([ys, 'optionalAccess', _242 => _242.type]) !== "UnFl" || xs.values.length !== 16 || ys.values.length !== 16) return void 0;
8864
+ if (_optionalChain([xs, 'optionalAccess', _245 => _245.type]) !== "UnFl" || _optionalChain([ys, 'optionalAccess', _246 => _246.type]) !== "UnFl" || xs.values.length !== 16 || ys.values.length !== 16) return void 0;
8666
8865
  mesh = { us: [0, 1], vs: [0, 1], points: xs.values.map((x, i) => ({ x, y: ys.values[i] })) };
8667
8866
  const px2 = mesh.points.map((p) => p.x);
8668
8867
  const py = mesh.points.map((p) => p.y);
@@ -8829,13 +9028,13 @@ function blendOptions(f) {
8829
9028
  function smartFiltersFromPsd(fx, newId, notes) {
8830
9029
  const filters = [];
8831
9030
  const list2 = descGet(fx, "filterFXList");
8832
- for (const v of _optionalChain([list2, 'optionalAccess', _243 => _243.type]) === "VlLs" ? list2.items : []) {
9031
+ for (const v of _optionalChain([list2, 'optionalAccess', _247 => _247.type]) === "VlLs" ? list2.items : []) {
8833
9032
  if (v.type !== "Objc" && v.type !== "GlbO") continue;
8834
9033
  const item = v.value;
8835
9034
  const { blend, opacity } = blendOptionsOf(item);
8836
9035
  const enabled = descBool(item, "enab") !== false;
8837
9036
  const fltr = descObject(item, "Fltr");
8838
- const radius = _optionalChain([fltr, 'optionalAccess', _244 => _244.classId]) === BOX_BLUR.classId ? descNumber(fltr, "Rds ") : void 0;
9037
+ const radius = _optionalChain([fltr, 'optionalAccess', _248 => _248.classId]) === BOX_BLUR.classId ? descNumber(fltr, "Rds ") : void 0;
8839
9038
  if (radius !== void 0 && radius >= 0 && radius <= 50) {
8840
9039
  filters.push({ id: newId(), kind: "blur", enabled, radius, blend, opacity });
8841
9040
  continue;
@@ -9188,7 +9387,7 @@ function readPsd(bytes) {
9188
9387
  return { header, colorModeData, resources, layers, mergedAlpha, globalBlocks, imageCompression, imageData: r.rest() };
9189
9388
  }
9190
9389
  function layerBlock(rec, key) {
9191
- return _optionalChain([rec, 'access', _245 => _245.blocks, 'access', _246 => _246.find, 'call', _247 => _247((b) => b.key === key), 'optionalAccess', _248 => _248.data]);
9390
+ return _optionalChain([rec, 'access', _249 => _249.blocks, 'access', _250 => _250.find, 'call', _251 => _251((b) => b.key === key), 'optionalAccess', _252 => _252.data]);
9192
9391
  }
9193
9392
  function layerName(rec) {
9194
9393
  const luni = layerBlock(rec, "luni");
@@ -9219,7 +9418,7 @@ function u8Block(rec, key) {
9219
9418
  function layerTree(file) {
9220
9419
  const stack = [[]];
9221
9420
  file.layers.forEach((rec, index) => {
9222
- const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _249 => _249(rec), 'optionalAccess', _250 => _250.kind]), () => ( SECTION_OTHER));
9421
+ const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _253 => _253(rec), 'optionalAccess', _254 => _254.kind]), () => ( SECTION_OTHER));
9223
9422
  if (kind === SECTION_DIVIDER) {
9224
9423
  stack.push([]);
9225
9424
  } else if (kind === SECTION_OPEN || kind === SECTION_CLOSED) {
@@ -9237,7 +9436,7 @@ function layerTree(file) {
9237
9436
  }
9238
9437
  function channelRect(rec, id) {
9239
9438
  if (id === CHANNEL_USER_MASK && rec.mask) return rec.mask.rect;
9240
- if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _251 => _251.mask, 'access', _252 => _252.real, 'optionalAccess', _253 => _253.rect]), () => ( rec.mask.rect));
9439
+ if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _255 => _255.mask, 'access', _256 => _256.real, 'optionalAccess', _257 => _257.rect]), () => ( rec.mask.rect));
9241
9440
  return rec.rect;
9242
9441
  }
9243
9442
  function decodeLayerChannel(file, rec, id) {
@@ -9255,7 +9454,7 @@ function decodeMergedImage(file) {
9255
9454
  return decodePlanes(file.imageCompression, file.imageData, { planes: channels, width, height, depth, psb });
9256
9455
  }
9257
9456
  function resource(file, id) {
9258
- return _optionalChain([file, 'access', _254 => _254.resources, 'access', _255 => _255.find, 'call', _256 => _256((r) => r.id === id), 'optionalAccess', _257 => _257.data]);
9457
+ return _optionalChain([file, 'access', _258 => _258.resources, 'access', _259 => _259.find, 'call', _260 => _260((r) => r.id === id), 'optionalAccess', _261 => _261.data]);
9259
9458
  }
9260
9459
  function resolution(file) {
9261
9460
  const d = resource(file, 1005);
@@ -9858,9 +10057,9 @@ var SMART_KEYS = ["SoLd", "SoLE", "PlLd"];
9858
10057
  var VECTOR_KEYS = ["vmsk", "vsms"];
9859
10058
  var MAX_CONTENTS_DEPTH = 6;
9860
10059
  var percent = (v) => Math.round(v / 255 * 100) / 100;
9861
- var Warnings = (_class2 = class {constructor() { _class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this); }
9862
- __init3() {this.groups = /* @__PURE__ */ new Map()}
9863
- __init4() {this.extra = []}
10060
+ var Warnings = (_class3 = class {constructor() { _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this); }
10061
+ __init4() {this.groups = /* @__PURE__ */ new Map()}
10062
+ __init5() {this.extra = []}
9864
10063
  add(message, layer) {
9865
10064
  const list2 = _nullishCoalesce(this.groups.get(message), () => ( []));
9866
10065
  if (!list2.includes(layer)) list2.push(layer);
@@ -9875,7 +10074,7 @@ var Warnings = (_class2 = class {constructor() { _class2.prototype.__init3.call(
9875
10074
  }
9876
10075
  return out;
9877
10076
  }
9878
- }, _class2);
10077
+ }, _class3);
9879
10078
  function psdKind(rec) {
9880
10079
  if (rec.blocks.some((b) => TYPE_KEYS.includes(b.key))) return "type";
9881
10080
  if (rec.blocks.some((b) => SMART_KEYS.includes(b.key))) return "smart-object";
@@ -10039,7 +10238,7 @@ function importNode(ctx, node, depth) {
10039
10238
  if (node.children) {
10040
10239
  const props2 = baseProps(ctx, rec, name, notes);
10041
10240
  const divider = sectionDivider(rec);
10042
- const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _258 => _258.blendKey]), () => ( rec.blendKey));
10241
+ const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _262 => _262.blendKey]), () => ( rec.blendKey));
10043
10242
  const groupBlend = key === "pass" ? "pass-through" : _nullishCoalesce(PSD_BLEND_KEYS[key], () => ( "normal"));
10044
10243
  const children = [];
10045
10244
  for (const child of node.children) {
@@ -10049,7 +10248,7 @@ function importNode(ctx, node, depth) {
10049
10248
  const group = { type: "group", id: ctx.newId(name), ...props2, blend: groupBlend, children };
10050
10249
  const effects2 = recordEffects(ctx, rec, name, notes, true);
10051
10250
  if (effects2) group.effects = effects2;
10052
- if (_optionalChain([divider, 'optionalAccess', _259 => _259.kind]) === SECTION_CLOSED) group.collapsed = true;
10251
+ if (_optionalChain([divider, 'optionalAccess', _263 => _263.kind]) === SECTION_CLOSED) group.collapsed = true;
10053
10252
  const mask2 = recordMask(ctx, rec, name);
10054
10253
  if (mask2) group.mask = mask2;
10055
10254
  entry.type = "group";
@@ -10272,7 +10471,7 @@ function importSmart(ctx, rec, name, notes, props) {
10272
10471
  const file = ctx.linked.get(placed.idnt);
10273
10472
  contents = {
10274
10473
  id: placed.idnt || ctx.newId(`${name}-contents`),
10275
- name: _optionalChain([file, 'optionalAccess', _260 => _260.name]) || `${name}.png`,
10474
+ name: _optionalChain([file, 'optionalAccess', _264 => _264.name]) || `${name}.png`,
10276
10475
  width,
10277
10476
  height,
10278
10477
  kind: "raster",
@@ -10429,7 +10628,7 @@ function psdToLayers(file, options = {}) {
10429
10628
  if (mode !== "rgb" && header.depth > 8 && header.colorMode !== MODE_INDEXED && header.colorMode !== MODE_BITMAP) {
10430
10629
  warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to ${header.depth}-bit RGB.`);
10431
10630
  } else if (mode !== "rgb" || header.depth !== 8 && header.depth !== 16 && header.depth !== 32) {
10432
- const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess', _261 => _261.name]), () => ( "its profile"))}` : "";
10631
+ const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess', _265 => _265.name]), () => ( "its profile"))}` : "";
10433
10632
  warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to 8-bit RGB${how}.`);
10434
10633
  }
10435
10634
  let layers = [];
@@ -10546,15 +10745,15 @@ var pct = (d, key, fallback) => num3(d, key, fallback * 100) / 100;
10546
10745
  var bool = (d, key) => descBool(d, key) === true;
10547
10746
  var enumOf3 = (d, key) => {
10548
10747
  const v = descGet(d, key);
10549
- return _optionalChain([v, 'optionalAccess', _262 => _262.type]) === "enum" ? v.value : void 0;
10748
+ return _optionalChain([v, 'optionalAccess', _266 => _266.type]) === "enum" ? v.value : void 0;
10550
10749
  };
10551
10750
  var text2 = (d, key) => {
10552
10751
  const v = d ? descGet(d, key) : void 0;
10553
- return _optionalChain([v, 'optionalAccess', _263 => _263.type]) === "TEXT" ? v.value : "";
10752
+ return _optionalChain([v, 'optionalAccess', _267 => _267.type]) === "TEXT" ? v.value : "";
10554
10753
  };
10555
10754
  var list = (d, key) => {
10556
10755
  const v = descGet(d, key);
10557
- if (_optionalChain([v, 'optionalAccess', _264 => _264.type]) !== "VlLs") return [];
10756
+ if (_optionalChain([v, 'optionalAccess', _268 => _268.type]) !== "VlLs") return [];
10558
10757
  return v.items.flatMap((it) => it.type === "Objc" || it.type === "GlbO" ? [it.value] : []);
10559
10758
  };
10560
10759
  var clamp3 = (v, lo, hi) => Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : lo;
@@ -10624,8 +10823,8 @@ function contourOf(d, key) {
10624
10823
  return { name, points };
10625
10824
  }
10626
10825
  function contourDesc(c) {
10627
- const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _265 => _265.name]), () => ( "Linear"));
10628
- const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _266 => _266.points]), () => ( [
10826
+ const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _269 => _269.name]), () => ( "Linear"));
10827
+ const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _270 => _270.points]), () => ( [
10629
10828
  { input: 0, output: 0 },
10630
10829
  { input: 1, output: 1 }
10631
10830
  ]));
@@ -10660,7 +10859,7 @@ function gradientOf(d, notes) {
10660
10859
  { position: 0, color: "#000000" },
10661
10860
  { position: 1, color: "#ffffff" }
10662
10861
  ],
10663
- style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _267 => _267.find, 'call', _268 => _268(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _269 => _269[0]]), () => ( "linear")),
10862
+ style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _271 => _271.find, 'call', _272 => _272(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _273 => _273[0]]), () => ( "linear")),
10664
10863
  angle: clamp3(num3(d, "Angl", 90), -360, 360),
10665
10864
  scale: clamp3(pct(d, "Scl ", 1), 0.1, 1.5),
10666
10865
  reverse: bool(d, "Rvrs"),
@@ -10714,7 +10913,7 @@ function gradientItems(g) {
10714
10913
  )
10715
10914
  )
10716
10915
  };
10717
- const op = _optionalChain([g, 'access', _270 => _270.opacityStops, 'optionalAccess', _271 => _271.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
10916
+ const op = _optionalChain([g, 'access', _274 => _274.opacityStops, 'optionalAccess', _275 => _275.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
10718
10917
  const trns = {
10719
10918
  type: "VlLs",
10720
10919
  items: op.map(
@@ -11211,9 +11410,9 @@ function prepareNestedLayers(layers) {
11211
11410
  if (l.type === "annotation") continue;
11212
11411
  let next = l;
11213
11412
  if (l.type === "group") next = { ...l, children: prepareNestedLayers(l.children) };
11214
- else if (l.type === "pixel" && (_optionalChain([l, 'access', _272 => _272.filters, 'optionalAccess', _273 => _273.length]) || l.source === "document")) {
11413
+ else if (l.type === "pixel" && (_optionalChain([l, 'access', _276 => _276.filters, 'optionalAccess', _277 => _277.length]) || l.source === "document")) {
11215
11414
  const p = { ...l };
11216
- if (_optionalChain([l, 'access', _274 => _274.filters, 'optionalAccess', _275 => _275.some, 'call', _276 => _276(isActiveFilter)])) {
11415
+ if (_optionalChain([l, 'access', _278 => _278.filters, 'optionalAccess', _279 => _279.some, 'call', _280 => _280(isActiveFilter)])) {
11217
11416
  const b = l.surface.bounds;
11218
11417
  if (b) {
11219
11418
  const r = { x: b.x + l.offset.x - 64, y: b.y + l.offset.y - 64, width: b.width + 128, height: b.height + 128 };
@@ -11230,7 +11429,7 @@ function prepareNestedLayers(layers) {
11230
11429
  delete p.source;
11231
11430
  next = p;
11232
11431
  }
11233
- if (_optionalChain([next, 'access', _277 => _277.mask, 'optionalAccess', _278 => _278.source])) {
11432
+ if (_optionalChain([next, 'access', _281 => _281.mask, 'optionalAccess', _282 => _282.source])) {
11234
11433
  next = { ...next };
11235
11434
  delete next.mask;
11236
11435
  }
@@ -11336,7 +11535,7 @@ function exportPsd(input) {
11336
11535
  return {
11337
11536
  opacity: Math.round(Math.min(1, Math.max(0, layer.opacity)) * 255),
11338
11537
  clipping: layer.clipped ? 1 : 0,
11339
- flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _279 => _279.locks, 'optionalAccess', _280 => _280.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
11538
+ flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _283 => _283.locks, 'optionalAccess', _284 => _284.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
11340
11539
  legacyName: name,
11341
11540
  blocks
11342
11541
  };
@@ -11393,7 +11592,7 @@ function exportPsd(input) {
11393
11592
  }
11394
11593
  case "pixel": {
11395
11594
  if (layer.source === "document") throw new PsdError(`Layer "${layer.name}" reads the document image; resolve its pixels before export.`);
11396
- if (_optionalChain([layer, 'access', _281 => _281.filters, 'optionalAccess', _282 => _282.some, 'call', _283 => _283(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
11595
+ if (_optionalChain([layer, 'access', _285 => _285.filters, 'optionalAccess', _286 => _286.some, 'call', _287 => _287(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
11397
11596
  const extra = [];
11398
11597
  if (layer.fillOpacity !== void 0 && layer.fillOpacity < 1) {
11399
11598
  extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
@@ -11425,7 +11624,7 @@ function exportPsd(input) {
11425
11624
  if (c.linked) note("Linked smart objects were embedded (their preview is written as the contents)", layer.name);
11426
11625
  linkedFiles.set(idnt, smartContentsFile(c));
11427
11626
  }
11428
- let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _284 => _284.psd, 'optionalAccess', _285 => _285.placed]), () => ( psdUuid(`${layer.id}:placed`)));
11627
+ let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _288 => _288.psd, 'optionalAccess', _289 => _289.placed]), () => ( psdUuid(`${layer.id}:placed`)));
11429
11628
  if (placedIds.has(placedId)) placedId = psdUuid(`${layer.id}:placed:${placedIds.size}`);
11430
11629
  placedIds.add(placedId);
11431
11630
  if (placedUnchanged(layer, idnt, placedId)) {
@@ -11435,12 +11634,12 @@ function exportPsd(input) {
11435
11634
  const filterFX = layer.smartFilters ? filterFXDescriptor(layer.smartFilters, dropped) : void 0;
11436
11635
  if (dropped.length) note("Develop smart filters have no Photoshop filter and were left out of the filter list (the layer\u2019s pixels still show them)", layer.name);
11437
11636
  const raw = layer.psd && layer.psd.key !== "PlLd" ? parsePlaced(layer.psd.key, layer.psd.data) : null;
11438
- const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _286 => _286.descriptor]) };
11637
+ const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _290 => _290.descriptor]) };
11439
11638
  const wnotes = [];
11440
11639
  extra.push({ key: "PlLd", data: plldBytes(spec) }, { key: "SoLd", data: soldBytes(spec, wnotes) });
11441
11640
  for (const n2 of wnotes) note(`A smart object: ${n2}`, layer.name);
11442
11641
  }
11443
- const fm = _optionalChain([layer, 'access', _287 => _287.smartFilters, 'optionalAccess', _288 => _288.mask]);
11642
+ const fm = _optionalChain([layer, 'access', _291 => _291.smartFilters, 'optionalAccess', _292 => _292.mask]);
11444
11643
  if (fm && !fm.source) filterItems.push(filterMaskItem(placedId, fm, { x: 0, y: 0, width, height }));
11445
11644
  const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
11446
11645
  const bounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
@@ -11468,8 +11667,8 @@ function exportPsd(input) {
11468
11667
  const losses = /* @__PURE__ */ new Set();
11469
11668
  for (const b of shapeBlocks(layer, width, height, _nullishCoalesce(input.resolution, () => ( 72)), losses)) extra.push({ key: b.key, data: padEven(b.data) });
11470
11669
  for (const n2 of losses) note(n2, layer.name);
11471
- if (_optionalChain([layer, 'access', _289 => _289.fill, 'optionalAccess', _290 => _290.type]) === "pattern") patternIds2.add(layer.fill.patternId);
11472
- if (_optionalChain([layer, 'access', _291 => _291.stroke, 'optionalAccess', _292 => _292.paint, 'access', _293 => _293.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
11670
+ if (_optionalChain([layer, 'access', _293 => _293.fill, 'optionalAccess', _294 => _294.type]) === "pattern") patternIds2.add(layer.fill.patternId);
11671
+ if (_optionalChain([layer, 'access', _295 => _295.stroke, 'optionalAccess', _296 => _296.paint, 'access', _297 => _297.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
11473
11672
  } else {
11474
11673
  extra.push({ key: "TySh", data: padEven(tyShForLayer(layer)) });
11475
11674
  }
@@ -11537,7 +11736,7 @@ function exportPsd(input) {
11537
11736
  { id: 1005, name: "", data: rw.result() },
11538
11737
  { id: 1057, name: "", data: version.result() }
11539
11738
  ];
11540
- if (_optionalChain([input, 'access', _294 => _294.iccProfile, 'optionalAccess', _295 => _295.length])) resources.push({ id: 1039, name: "", data: input.iccProfile });
11739
+ if (_optionalChain([input, 'access', _298 => _298.iccProfile, 'optionalAccess', _299 => _299.length])) resources.push({ id: 1039, name: "", data: input.iccProfile });
11541
11740
  resources.push(...alphaChannelResources(_nullishCoalesce(input.alphaChannels, () => ( []))));
11542
11741
  if (input.globalLight) {
11543
11742
  const i32 = (v) => {
@@ -11954,4 +12153,6 @@ function exportPsd(input) {
11954
12153
 
11955
12154
 
11956
12155
 
11957
- exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.createSelectionMask = createSelectionMask; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.MAX_EFFECT_ANIMATION_MS = MAX_EFFECT_ANIMATION_MS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.ANCHOR_FRACTION = ANCHOR_FRACTION; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.translateLayer = translateLayer; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
12156
+
12157
+
12158
+ exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.selectionFromTiles = selectionFromTiles; exports.createSelectionMask = createSelectionMask; exports.selectionFromRegion = selectionFromRegion; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.MAX_EFFECT_ANIMATION_MS = MAX_EFFECT_ANIMATION_MS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.ANCHOR_FRACTION = ANCHOR_FRACTION; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.translateLayer = translateLayer; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;