@pixerate/editor 0.206.0 → 0.208.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/animation-editor/index.cjs +60 -59
  2. package/dist/animation-editor/index.js +6 -5
  3. package/dist/{brushstrokeRender-7LXCU7PD.js → brushstrokeRender-C3UU6GVC.js} +5 -4
  4. package/dist/{brushstrokeRender-VO4ZTWVA.cjs → brushstrokeRender-EAJNE6WP.cjs} +12 -11
  5. package/dist/canvas/index.cjs +8 -8
  6. package/dist/canvas/index.js +1 -1
  7. package/dist/{chunk-2N2QPO3H.js → chunk-2PBZBRP5.js} +9 -7
  8. package/dist/{chunk-7NW46N7I.cjs → chunk-3EHPLDFQ.cjs} +54 -52
  9. package/dist/{chunk-H367YTXI.js → chunk-42TWUPNJ.js} +13 -387
  10. package/dist/chunk-474IQG74.cjs +384 -0
  11. package/dist/{chunk-MLC7HUHO.js → chunk-BGOCAUXH.js} +1 -1
  12. package/dist/chunk-DWYQPL2A.js +2010 -0
  13. package/dist/{chunk-YXKLVD56.js → chunk-F7YA3MMC.js} +2 -2
  14. package/dist/{chunk-ZZGPYNS2.js → chunk-G4E6RUPC.js} +1 -1
  15. package/dist/chunk-HVVR5PZW.js +384 -0
  16. package/dist/{chunk-FR2Q2LVF.cjs → chunk-I7G3RSUJ.cjs} +35 -35
  17. package/dist/chunk-K6PXS6DO.cjs +102 -0
  18. package/dist/{chunk-ZIDUPSP4.js → chunk-KFIOEOCQ.js} +24 -761
  19. package/dist/{chunk-V7GWZIZK.cjs → chunk-KWNMBMKG.cjs} +23 -21
  20. package/dist/chunk-L3G23N5Y.js +763 -0
  21. package/dist/{chunk-GHCXLQ47.js → chunk-NDMXB4PR.js} +2 -2
  22. package/dist/{chunk-CWM3CUUX.cjs → chunk-OLNIPTB3.cjs} +39 -413
  23. package/dist/{chunk-EBDCRTZI.cjs → chunk-PQ3H2AAN.cjs} +92 -90
  24. package/dist/{chunk-BRKVNXDZ.cjs → chunk-QAUIZPYI.cjs} +7 -7
  25. package/dist/{chunk-UYXL6ZWQ.cjs → chunk-QE7D7TZR.cjs} +494 -1231
  26. package/dist/chunk-QYLWG22N.cjs +763 -0
  27. package/dist/{chunk-YQ5C5BVK.cjs → chunk-ROVK6AXX.cjs} +60 -60
  28. package/dist/{chunk-HGTDMKNE.cjs → chunk-UOGKSVRQ.cjs} +126 -221
  29. package/dist/{chunk-EL5PAHNP.js → chunk-USQCKRZG.js} +6 -4
  30. package/dist/{chunk-36OKQDCF.js → chunk-WJ2RBZMM.js} +5 -3
  31. package/dist/chunk-X4LUGTQX.cjs +2010 -0
  32. package/dist/{chunk-NQMP3CWF.js → chunk-YBJXCQTR.js} +15 -110
  33. package/dist/chunk-ZIF4UJJ6.js +102 -0
  34. package/dist/{chunk-WTW7QRTS.cjs → chunk-ZMHPQ6HP.cjs} +1 -1
  35. package/dist/image-editor/controller.d.cts +28 -3
  36. package/dist/image-editor/controller.d.ts +28 -3
  37. package/dist/image-editor/index.cjs +2150 -3380
  38. package/dist/image-editor/index.js +675 -1905
  39. package/dist/image-editor/selection/index.d.cts +2 -0
  40. package/dist/image-editor/selection/index.d.ts +2 -0
  41. package/dist/image-editor/selection/refine-edits.d.cts +13 -4
  42. package/dist/image-editor/selection/refine-edits.d.ts +13 -4
  43. package/dist/image-editor/selection/segment/focus.d.cts +2 -0
  44. package/dist/image-editor/selection/segment/focus.d.ts +2 -0
  45. package/dist/image-editor/selection/segment/grabcut.d.cts +4 -2
  46. package/dist/image-editor/selection/segment/grabcut.d.ts +4 -2
  47. package/dist/image-editor/selection/segment/sky.d.cts +2 -0
  48. package/dist/image-editor/selection/segment/sky.d.ts +2 -0
  49. package/dist/image-editor/selection/segment/subject.d.cts +2 -1
  50. package/dist/image-editor/selection/segment/subject.d.ts +2 -1
  51. package/dist/image-editor/selection/segment/work.d.cts +5 -0
  52. package/dist/image-editor/selection/segment/work.d.ts +5 -0
  53. package/dist/image-editor/selection/select-and-mask.d.cts +136 -0
  54. package/dist/image-editor/selection/select-and-mask.d.ts +136 -0
  55. package/dist/image-editor/selection/worker.d.cts +126 -0
  56. package/dist/image-editor/selection/worker.d.ts +126 -0
  57. package/dist/image-editor/selection-worker.cjs +14 -0
  58. package/dist/image-editor/selection-worker.d.cts +12 -0
  59. package/dist/image-editor/selection-worker.d.ts +12 -0
  60. package/dist/image-editor/selection-worker.js +14 -0
  61. package/dist/image-editor/types.d.cts +8 -0
  62. package/dist/image-editor/types.d.ts +8 -0
  63. package/dist/paint/index.cjs +6 -5
  64. package/dist/paint/index.js +5 -4
  65. package/dist/paint-editor/index.cjs +394 -390
  66. package/dist/paint-editor/index.js +18 -14
  67. package/dist/raster/index.cjs +22 -18
  68. package/dist/raster/index.js +29 -25
  69. package/dist/vector/index.cjs +986 -985
  70. package/dist/vector/index.js +6 -5
  71. package/package.json +11 -1
  72. package/skills/pixerate-image-editor/SKILL.md +1 -1
  73. package/skills/pixerate-image-selection-masking/SKILL.md +4 -2
@@ -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; var _class3;
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;
2
2
 
3
3
  var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
4
4
 
@@ -7,6 +7,7 @@ var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
7
7
 
8
8
 
9
9
 
10
+ var _chunkQYLWG22Ncjs = require('./chunk-QYLWG22N.cjs');
10
11
 
11
12
 
12
13
 
@@ -37,7 +38,12 @@ var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
37
38
 
38
39
 
39
40
 
40
- var _chunkHGTDMKNEcjs = require('./chunk-HGTDMKNE.cjs');
41
+
42
+
43
+
44
+
45
+
46
+ var _chunkUOGKSVRQcjs = require('./chunk-UOGKSVRQ.cjs');
41
47
 
42
48
 
43
49
 
@@ -50,12 +56,13 @@ var _chunkHGTDMKNEcjs = require('./chunk-HGTDMKNE.cjs');
50
56
  var _chunkQT26RHKKcjs = require('./chunk-QT26RHKK.cjs');
51
57
 
52
58
 
59
+ var _chunkK6PXS6DOcjs = require('./chunk-K6PXS6DO.cjs');
53
60
 
54
61
 
55
62
 
56
- var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
57
63
 
58
64
 
65
+ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
59
66
 
60
67
 
61
68
 
@@ -90,16 +97,16 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
90
97
 
91
98
 
92
99
 
93
- var _chunkBRKVNXDZcjs = require('./chunk-BRKVNXDZ.cjs');
94
100
 
95
101
 
102
+ var _chunkQAUIZPYIcjs = require('./chunk-QAUIZPYI.cjs');
96
103
 
97
104
 
98
105
 
99
106
 
100
- var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
101
107
 
102
108
 
109
+ var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
103
110
 
104
111
 
105
112
 
@@ -116,6 +123,7 @@ var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
116
123
 
117
124
 
118
125
 
126
+ var _chunkOLNIPTB3cjs = require('./chunk-OLNIPTB3.cjs');
119
127
 
120
128
 
121
129
 
@@ -128,7 +136,7 @@ var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
128
136
 
129
137
 
130
138
 
131
- var _chunkCWM3CUUXcjs = require('./chunk-CWM3CUUX.cjs');
139
+ var _chunk474IQG74cjs = require('./chunk-474IQG74.cjs');
132
140
 
133
141
 
134
142
 
@@ -711,730 +719,20 @@ function hitTestAnnotation(imgPt, ann, padding = 10) {
711
719
  return imgPt.x >= b.x - padding && imgPt.x <= b.x + b.width + padding && imgPt.y >= b.y - padding && imgPt.y <= b.y + b.height + padding;
712
720
  }
713
721
 
714
- // src/image-editor/selection/mask.ts
715
- var SELECTION_MODES = ["replace", "add", "subtract", "intersect"];
716
- function isSelectionMode(value) {
717
- return typeof value === "string" && SELECTION_MODES.includes(value);
718
- }
719
- function parseSelectionMode(value) {
720
- return isSelectionMode(value) ? value : "replace";
721
- }
722
- var MAX_SIDE = 1 << 15;
723
- function checkSize(width, height) {
724
- if (!Number.isInteger(width) || !Number.isInteger(height) || width < 1 || height < 1 || width > MAX_SIDE || height > MAX_SIDE) {
725
- throw new Error(`Invalid selection size ${width}\xD7${height}`);
726
- }
727
- }
728
- function computeSelectionBounds(width, height, data) {
729
- let x0 = width;
730
- let x1 = -1;
731
- let y0 = -1;
732
- let y1 = -1;
733
- for (let y = 0; y < height; y++) {
734
- const row = y * width;
735
- let first = -1;
736
- for (let x = 0; x < width; x++) {
737
- if (data[row + x] !== 0) {
738
- first = x;
739
- break;
740
- }
741
- }
742
- if (first < 0) continue;
743
- let last = first;
744
- for (let x = width - 1; x > first; x--) {
745
- if (data[row + x] !== 0) {
746
- last = x;
747
- break;
748
- }
749
- }
750
- if (y0 < 0) y0 = y;
751
- y1 = y;
752
- if (first < x0) x0 = first;
753
- if (last > x1) x1 = last;
754
- }
755
- if (y0 < 0) return null;
756
- return { x: x0, y: y0, width: x1 - x0 + 1, height: y1 - y0 + 1 };
757
- }
758
- var TILE_PIXELS = _chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE;
759
- var MATERIALIZED_LIMIT = 4;
760
- var materialized = /* @__PURE__ */ new Map();
761
- var lastRead = null;
762
- var lastData = null;
763
- var TiledSelectionMask = (_class = class {
764
- constructor(width, height, surface, bounds, data) {;_class.prototype.__init.call(this);
765
- this.width = width;
766
- this.height = height;
767
- this.surface = surface;
768
- this.cachedBounds = bounds;
769
- if (data) this.remember(data);
770
- }
771
-
772
-
773
-
774
-
775
- __init() {this.weak = null}
776
- get bounds() {
777
- if (this.cachedBounds === void 0) this.cachedBounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, this.surface);
778
- return this.cachedBounds;
779
- }
780
- get data() {
781
- if (lastRead === this) return lastData;
782
- let d = materialized.get(this);
783
- if (d) {
784
- materialized.delete(this);
785
- materialized.set(this, d);
786
- lastRead = this;
787
- lastData = d;
788
- return d;
789
- }
790
- d = _optionalChain([this, 'access', _2 => _2.weak, 'optionalAccess', _3 => _3.deref, 'call', _4 => _4()]);
791
- if (!d) {
792
- const all = _chunkCWM3CUUXcjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height });
793
- d = new Uint8Array(all.buffer, all.byteOffset, all.length);
794
- }
795
- this.remember(d);
796
- return d;
797
- }
798
- remember(d) {
799
- lastRead = this;
800
- lastData = d;
801
- this.weak = typeof WeakRef === "function" ? new WeakRef(d) : null;
802
- materialized.set(this, d);
803
- while (materialized.size > MATERIALIZED_LIMIT) materialized.delete(materialized.keys().next().value);
804
- }
805
- }, _class);
806
- function tileGrid(width, height) {
807
- return { cols: Math.ceil(width / _chunkCWM3CUUXcjs.TILE), rows: Math.ceil(height / _chunkCWM3CUUXcjs.TILE) };
808
- }
809
- function insideTile(tx, ty, width, height) {
810
- return (tx + 1) * _chunkCWM3CUUXcjs.TILE <= width && (ty + 1) * _chunkCWM3CUUXcjs.TILE <= height;
811
- }
812
- function surfaceFromCoverage(width, height, data) {
813
- const tiles = /* @__PURE__ */ new Map();
814
- const { cols, rows } = tileGrid(width, height);
815
- for (let ty = 0; ty < rows; ty++) {
816
- for (let tx = 0; tx < cols; tx++) {
817
- const ox = tx * _chunkCWM3CUUXcjs.TILE;
818
- const oy = ty * _chunkCWM3CUUXcjs.TILE;
819
- const w = Math.min(_chunkCWM3CUUXcjs.TILE, width - ox);
820
- const h = Math.min(_chunkCWM3CUUXcjs.TILE, height - oy);
821
- let lo = 255;
822
- let hi = 0;
823
- for (let y = 0; y < h && !(hi > 0 && lo < hi); y++) {
824
- const row = (oy + y) * width + ox;
825
- for (let x = 0; x < w; x++) {
826
- const v = data[row + x];
827
- if (v < lo) lo = v;
828
- if (v > hi) hi = v;
829
- }
830
- }
831
- if (hi === 0) continue;
832
- if (lo === hi && w === _chunkCWM3CUUXcjs.TILE && h === _chunkCWM3CUUXcjs.TILE) {
833
- tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), _chunkCWM3CUUXcjs.uniformTile.call(void 0, 1, hi));
834
- continue;
835
- }
836
- const t = new Uint8ClampedArray(TILE_PIXELS);
837
- for (let y = 0; y < h; y++) {
838
- const row = (oy + y) * width + ox;
839
- for (let x = 0; x < w; x++) t[y * _chunkCWM3CUUXcjs.TILE + x] = data[row + x];
840
- }
841
- tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), { data: t, uniform: null });
842
- }
843
- }
844
- return new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0);
845
- }
846
- function clipTile(tile, w, h) {
847
- const d = tile.data;
848
- let outside = false;
849
- for (let y = 0; y < _chunkCWM3CUUXcjs.TILE && !outside; y++) {
850
- for (let x = y < h ? w : 0; x < _chunkCWM3CUUXcjs.TILE; x++) {
851
- if (d[y * _chunkCWM3CUUXcjs.TILE + x] !== 0) {
852
- outside = true;
853
- break;
854
- }
855
- }
856
- }
857
- if (!outside) return tile;
858
- const t = new Uint8ClampedArray(TILE_PIXELS);
859
- for (let y = 0; y < h; y++) t.set(d.subarray(y * _chunkCWM3CUUXcjs.TILE, y * _chunkCWM3CUUXcjs.TILE + w), y * _chunkCWM3CUUXcjs.TILE);
860
- return _chunkCWM3CUUXcjs.finishTile.call(void 0, t, 1, 0);
861
- }
862
- function selectionFromTiles(width, height, surface) {
863
- checkSize(width, height);
864
- if (surface.channels !== 1) throw new Error("A selection needs a 1-channel surface");
865
- if (surface.defaultValue !== 0) {
866
- const all = _chunkCWM3CUUXcjs.readRegion.call(void 0, surface, { x: 0, y: 0, width, height });
867
- return createSelectionMask(width, height, new Uint8Array(all.buffer, all.byteOffset, all.length));
868
- }
869
- const { cols, rows } = tileGrid(width, height);
870
- let tiles = null;
871
- for (const [key, tile] of surface.tiles) {
872
- const { tx, ty } = _chunkCWM3CUUXcjs.tileCoord.call(void 0, key);
873
- let next = tile;
874
- if (tx < 0 || ty < 0 || tx >= cols || ty >= rows) next = null;
875
- 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));
876
- if (next === tile) continue;
877
- tiles ??= new Map(surface.tiles);
878
- if (next) tiles.set(key, next);
879
- else tiles.delete(key);
880
- }
881
- return new TiledSelectionMask(width, height, tiles ? new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0) : surface);
882
- }
883
- function createSelectionMask(width, height, data) {
884
- checkSize(width, height);
885
- if (!data) return new TiledSelectionMask(width, height, new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, /* @__PURE__ */ new Map(), 0), null);
886
- if (data.length !== width * height) throw new Error("Selection data does not match its size");
887
- return new TiledSelectionMask(width, height, surfaceFromCoverage(width, height, data), void 0, data);
888
- }
889
- function selectionFromRegion(width, height, rect, data) {
890
- checkSize(width, height);
891
- 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");
892
- return new TiledSelectionMask(width, height, _chunkCWM3CUUXcjs.writeRegion.call(void 0, new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, /* @__PURE__ */ new Map(), 0), rect, data));
893
- }
894
- function fullSelection(width, height) {
895
- checkSize(width, height);
896
- const tiles = /* @__PURE__ */ new Map();
897
- const { cols, rows } = tileGrid(width, height);
898
- for (let ty = 0; ty < rows; ty++) {
899
- for (let tx = 0; tx < cols; tx++) {
900
- if (insideTile(tx, ty, width, height)) {
901
- tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), _chunkCWM3CUUXcjs.uniformTile.call(void 0, 1, 255));
902
- continue;
903
- }
904
- const t = new Uint8ClampedArray(TILE_PIXELS);
905
- const w = Math.min(_chunkCWM3CUUXcjs.TILE, width - tx * _chunkCWM3CUUXcjs.TILE);
906
- for (let y = 0; y < Math.min(_chunkCWM3CUUXcjs.TILE, height - ty * _chunkCWM3CUUXcjs.TILE); y++) t.fill(255, y * _chunkCWM3CUUXcjs.TILE, y * _chunkCWM3CUUXcjs.TILE + w);
907
- tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), { data: t, uniform: null });
908
- }
909
- }
910
- return new TiledSelectionMask(width, height, new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0), { x: 0, y: 0, width, height });
911
- }
912
- function isSelectionEmpty(mask) {
913
- return !mask || mask.bounds === null;
914
- }
915
- function selectionValueAt(mask, x, y) {
916
- const xi = Math.floor(x);
917
- const yi = Math.floor(y);
918
- if (xi < 0 || yi < 0 || xi >= mask.width || yi >= mask.height) return 0;
919
- return _chunkCWM3CUUXcjs.readPixel.call(void 0, mask.surface, xi, yi)[0] / 255;
920
- }
921
- function coverageToByte(v) {
922
- if (!(v > 0)) return 0;
923
- if (v >= 1) return 255;
924
- return Math.floor(v * 255 + 0.5);
925
- }
926
- function selectionFromCoverage(width, height, coverage) {
927
- const n = width * height;
928
- const out = new Uint8Array(n);
929
- for (let i = 0; i < n; i++) out[i] = coverageToByte(coverage[i]);
930
- return createSelectionMask(width, height, out);
931
- }
932
- function selectionToCoverage(mask) {
933
- const out = new Float32Array(mask.data.length);
934
- for (let i = 0; i < out.length; i++) out[i] = mask.data[i] / 255;
935
- return out;
936
- }
937
- function selectionArea(mask) {
938
- if (!mask || !mask.bounds) return 0;
939
- let sum = 0;
940
- for (const tile of mask.surface.tiles.values()) {
941
- if (tile.uniform !== null) {
942
- sum += tile.uniform * TILE_PIXELS;
943
- continue;
944
- }
945
- const d = tile.data;
946
- for (let i = 0; i < d.length; i++) sum += d[i];
947
- }
948
- return sum / 255;
949
- }
950
- function combineSelections(prev, next, mode) {
951
- let result;
952
- if (mode === "replace" || !prev && mode === "add") {
953
- result = next;
954
- } else if (!prev) {
955
- return null;
956
- } else {
957
- if (prev.width !== next.width || prev.height !== next.height) throw new Error("Selections differ in size");
958
- result = new TiledSelectionMask(prev.width, prev.height, combineSurfaces(prev.surface, next.surface, mode));
959
- }
960
- return result.bounds ? result : null;
961
- }
962
- var FULL = 255;
963
- function combineTile(a, b, mode) {
964
- if (mode === "add") {
965
- if (!b || _optionalChain([a, 'optionalAccess', _5 => _5.uniform]) === FULL) return a;
966
- if (!a || b.uniform === FULL) return b;
967
- } else if (mode === "subtract") {
968
- if (!a || !b) return a;
969
- if (b.uniform === FULL) return void 0;
970
- } else {
971
- if (!a || !b) return void 0;
972
- if (a.uniform === FULL) return b;
973
- if (b.uniform === FULL) return a;
974
- }
975
- const x = a.data;
976
- const y = b.data;
977
- const out = new Uint8ClampedArray(TILE_PIXELS);
978
- if (mode === "add") for (let i = 0; i < out.length; i++) out[i] = x[i] > y[i] ? x[i] : y[i];
979
- else if (mode === "subtract") for (let i = 0; i < out.length; i++) out[i] = x[i] > y[i] ? x[i] - y[i] : 0;
980
- else for (let i = 0; i < out.length; i++) out[i] = x[i] < y[i] ? x[i] : y[i];
981
- return _nullishCoalesce(_chunkCWM3CUUXcjs.finishTile.call(void 0, out, 1, 0), () => ( void 0));
982
- }
983
- function combineSurfaces(a, b, mode) {
984
- const tiles = /* @__PURE__ */ new Map();
985
- for (const key of /* @__PURE__ */ new Set([...a.tiles.keys(), ...b.tiles.keys()])) {
986
- const tile = combineTile(a.tiles.get(key), b.tiles.get(key), mode);
987
- if (tile) tiles.set(key, tile);
988
- }
989
- return new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0);
990
- }
991
- function invertSelection(mask) {
992
- const { width, height } = mask;
993
- const tiles = /* @__PURE__ */ new Map();
994
- const { cols, rows } = tileGrid(width, height);
995
- for (let ty = 0; ty < rows; ty++) {
996
- for (let tx = 0; tx < cols; tx++) {
997
- const src = mask.surface.getTile(tx, ty);
998
- const key = _chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty);
999
- if (insideTile(tx, ty, width, height)) {
1000
- if (!src) tiles.set(key, _chunkCWM3CUUXcjs.uniformTile.call(void 0, 1, FULL));
1001
- else if (src.uniform !== null) {
1002
- if (src.uniform !== FULL) tiles.set(key, _chunkCWM3CUUXcjs.uniformTile.call(void 0, 1, FULL - src.uniform));
1003
- } else {
1004
- const out2 = new Uint8ClampedArray(TILE_PIXELS);
1005
- for (let i = 0; i < out2.length; i++) out2[i] = FULL - src.data[i];
1006
- const t2 = _chunkCWM3CUUXcjs.finishTile.call(void 0, out2, 1, 0);
1007
- if (t2) tiles.set(key, t2);
1008
- }
1009
- continue;
1010
- }
1011
- const w = Math.min(_chunkCWM3CUUXcjs.TILE, width - tx * _chunkCWM3CUUXcjs.TILE);
1012
- const h = Math.min(_chunkCWM3CUUXcjs.TILE, height - ty * _chunkCWM3CUUXcjs.TILE);
1013
- const out = new Uint8ClampedArray(TILE_PIXELS);
1014
- 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);
1015
- const t = _chunkCWM3CUUXcjs.finishTile.call(void 0, out, 1, 0);
1016
- if (t) tiles.set(key, t);
1017
- }
1018
- }
1019
- return new TiledSelectionMask(width, height, new (0, _chunkCWM3CUUXcjs.TiledSurface)(1, tiles, 0));
1020
- }
1021
- function resizeSelection(mask, width, height) {
1022
- if (mask.width === width && mask.height === height) return mask;
1023
- checkSize(width, height);
1024
- const out = new Uint8Array(width * height);
1025
- const sx = mask.width / width;
1026
- const sy = mask.height / height;
1027
- const src = mask.data;
1028
- const mw = mask.width;
1029
- for (let y = 0; y < height; y++) {
1030
- const fy = Math.min(mask.height - 1, Math.max(0, (y + 0.5) * sy - 0.5));
1031
- const y0 = Math.floor(fy);
1032
- const y1 = Math.min(mask.height - 1, y0 + 1);
1033
- const ty = fy - y0;
1034
- for (let x = 0; x < width; x++) {
1035
- const fx = Math.min(mw - 1, Math.max(0, (x + 0.5) * sx - 0.5));
1036
- const x0 = Math.floor(fx);
1037
- const x1 = Math.min(mw - 1, x0 + 1);
1038
- const tx = fx - x0;
1039
- const top = src[y0 * mw + x0] * (1 - tx) + src[y0 * mw + x1] * tx;
1040
- const bot = src[y1 * mw + x0] * (1 - tx) + src[y1 * mw + x1] * tx;
1041
- out[y * width + x] = Math.round(top * (1 - ty) + bot * ty);
1042
- }
1043
- }
1044
- return createSelectionMask(width, height, out);
1045
- }
1046
- function selectionFromPixels(pixels, options = {}) {
1047
- const { width, height, data } = pixels;
1048
- checkSize(width, height);
1049
- if (data.length < width * height * 4) throw new Error("Pixel data is shorter than width \xD7 height \xD7 4");
1050
- const channel = _nullishCoalesce(options.channel, () => ( "luminance"));
1051
- const out = new Uint8Array(width * height);
1052
- const threshold = options.threshold;
1053
- for (let i = 0, p = 0; i < out.length; i++, p += 4) {
1054
- let v;
1055
- switch (channel) {
1056
- case "alpha":
1057
- v = data[p + 3];
1058
- break;
1059
- case "red":
1060
- v = data[p];
1061
- break;
1062
- case "green":
1063
- v = data[p + 1];
1064
- break;
1065
- case "blue":
1066
- v = data[p + 2];
1067
- break;
1068
- default:
1069
- v = Math.round((0.2126 * data[p] + 0.7152 * data[p + 1] + 0.0722 * data[p + 2]) * data[p + 3] / 255);
1070
- }
1071
- if (options.invert) v = 255 - v;
1072
- if (threshold !== void 0) v = v >= threshold ? 255 : 0;
1073
- out[i] = v;
1074
- }
1075
- return createSelectionMask(width, height, out);
1076
- }
1077
- function selectionToPixels(mask, as = "gray") {
1078
- const out = new Uint8ClampedArray(mask.data.length * 4);
1079
- for (let i = 0, p = 0; i < mask.data.length; i++, p += 4) {
1080
- const v = mask.data[i];
1081
- if (as === "gray") {
1082
- out[p] = out[p + 1] = out[p + 2] = v;
1083
- out[p + 3] = 255;
1084
- } else {
1085
- out[p] = out[p + 1] = out[p + 2] = 255;
1086
- out[p + 3] = v;
1087
- }
1088
- }
1089
- return { width: mask.width, height: mask.height, data: out };
1090
- }
1091
- var B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1092
- var B64_INDEX = (() => {
1093
- const t = new Int16Array(128).fill(-1);
1094
- for (let i = 0; i < B64.length; i++) t[B64.charCodeAt(i)] = i;
1095
- return t;
1096
- })();
1097
- function toBase64(bytes, length) {
1098
- const parts = [];
1099
- let chunk = "";
1100
- for (let i = 0; i < length; i += 3) {
1101
- const a = bytes[i];
1102
- const b = i + 1 < length ? bytes[i + 1] : 0;
1103
- const c = i + 2 < length ? bytes[i + 2] : 0;
1104
- chunk += B64[a >> 2] + B64[(a & 3) << 4 | b >> 4];
1105
- chunk += i + 1 < length ? B64[(b & 15) << 2 | c >> 6] : "=";
1106
- chunk += i + 2 < length ? B64[c & 63] : "=";
1107
- if (chunk.length >= 8192) {
1108
- parts.push(chunk);
1109
- chunk = "";
1110
- }
1111
- }
1112
- parts.push(chunk);
1113
- return parts.join("");
1114
- }
1115
- function fromBase64(text3) {
1116
- if (text3.length % 4 !== 0) throw new Error("Invalid base64 length");
1117
- let pad = 0;
1118
- if (text3.endsWith("==")) pad = 2;
1119
- else if (text3.endsWith("=")) pad = 1;
1120
- const out = new Uint8Array(text3.length / 4 * 3 - pad);
1121
- let o = 0;
1122
- const digit = (i, k) => {
1123
- const ch = text3.charCodeAt(i + k);
1124
- if (ch === 61 && i + 4 === text3.length && k >= 4 - pad) return 0;
1125
- const idx = ch < 128 ? B64_INDEX[ch] : -1;
1126
- if (idx < 0) throw new Error("Invalid base64 character");
1127
- return idx;
1128
- };
1129
- for (let i = 0; i < text3.length; i += 4) {
1130
- const n = digit(i, 0) << 18 | digit(i, 1) << 12 | digit(i, 2) << 6 | digit(i, 3);
1131
- if (o < out.length) out[o++] = n >> 16 & 255;
1132
- if (o < out.length) out[o++] = n >> 8 & 255;
1133
- if (o < out.length) out[o++] = n & 255;
1134
- }
1135
- return out;
1136
- }
1137
- function encodeSelectionRle(data) {
1138
- let buf = new Uint8Array(64);
1139
- let len = 0;
1140
- const push = (b) => {
1141
- if (len === buf.length) {
1142
- const next = new Uint8Array(buf.length * 2);
1143
- next.set(buf);
1144
- buf = next;
1145
- }
1146
- buf[len++] = b;
1147
- };
1148
- let i = 0;
1149
- while (i < data.length) {
1150
- const v = data[i];
1151
- let j = i + 1;
1152
- while (j < data.length && data[j] === v) j++;
1153
- push(v);
1154
- let run = j - i;
1155
- while (run >= 128) {
1156
- push(run & 127 | 128);
1157
- run = Math.floor(run / 128);
1158
- }
1159
- push(run);
1160
- i = j;
1161
- }
1162
- return "r1:" + toBase64(buf, len);
1163
- }
1164
- function decodeSelectionRle(rle, length) {
1165
- if (typeof rle !== "string" || !rle.startsWith("r1:")) throw new Error("Unknown selection encoding");
1166
- const bytes = fromBase64(rle.slice(3));
1167
- const out = new Uint8Array(length);
1168
- let o = 0;
1169
- let i = 0;
1170
- while (i < bytes.length) {
1171
- const v = bytes[i++];
1172
- let run = 0;
1173
- let scale = 1;
1174
- for (; ; ) {
1175
- if (i >= bytes.length) throw new Error("Truncated selection run");
1176
- const b = bytes[i++];
1177
- run += (b & 127) * scale;
1178
- if (b < 128) break;
1179
- scale *= 128;
1180
- if (scale > 2 ** 35) throw new Error("Selection run too long");
1181
- }
1182
- if (run === 0 || o + run > length) throw new Error("Selection runs do not match its size");
1183
- if (v !== 0) out.fill(v, o, o + run);
1184
- o += run;
1185
- }
1186
- if (o !== length) throw new Error("Selection runs do not match its size");
1187
- return out;
1188
- }
1189
- function serializeSelection(mask) {
1190
- return { width: mask.width, height: mask.height, rle: encodeSelectionRle(mask.data) };
1191
- }
1192
- function deserializeSelection(value) {
1193
- if (!value || typeof value !== "object") throw new Error("selection must be an object");
1194
- const v = value;
1195
- const width = v.width;
1196
- const height = v.height;
1197
- checkSize(width, height);
1198
- return createSelectionMask(width, height, decodeSelectionRle(v.rle, width * height));
1199
- }
1200
- function hashMaskContent(content) {
1201
- let h = 2166136261;
1202
- if (typeof content === "string") {
1203
- for (let i = 0; i < content.length; i++) {
1204
- h ^= content.charCodeAt(i);
1205
- h = Math.imul(h, 16777619);
1206
- }
1207
- } else {
1208
- for (let i = 0; i < content.length; i++) {
1209
- h ^= content[i];
1210
- h = Math.imul(h, 16777619);
1211
- }
1212
- }
1213
- return `${(h >>> 0).toString(16)}:${content.length}`;
1214
- }
1215
-
1216
- // src/image-editor/selection/modify.ts
1217
- var EMPTY_DISTANCE = 1e10;
1218
- function distanceTransform(inside, width, height) {
1219
- const n = width * height;
1220
- const out = new Float32Array(n);
1221
- let any = false;
1222
- let all = true;
1223
- for (let i = 0; i < n; i++) {
1224
- if (inside[i]) any = true;
1225
- else all = false;
1226
- }
1227
- if (!any) return out.fill(EMPTY_DISTANCE);
1228
- if (all) return out;
1229
- const NONE = 4294967295;
1230
- const vertical = new Uint32Array(n).fill(NONE);
1231
- for (let x = 0; x < width; x++) {
1232
- let nearest = -1;
1233
- for (let y = 0; y < height; y++) {
1234
- const i = y * width + x;
1235
- if (inside[i]) nearest = y;
1236
- if (nearest >= 0) vertical[i] = y - nearest;
1237
- }
1238
- nearest = -1;
1239
- for (let y = height - 1; y >= 0; y--) {
1240
- const i = y * width + x;
1241
- if (vertical[i] === 0) nearest = y;
1242
- if (nearest >= 0) vertical[i] = Math.min(vertical[i], nearest - y);
1243
- }
1244
- }
1245
- const sites = new Int32Array(width);
1246
- const starts = new Float64Array(width);
1247
- for (let y = 0; y < height; y++) {
1248
- const row = y * width;
1249
- let count = 0;
1250
- for (let q2 = 0; q2 < width; q2++) {
1251
- const dq = vertical[row + q2];
1252
- if (dq === NONE) continue;
1253
- const fq = dq * dq;
1254
- let start = -Infinity;
1255
- while (count > 0) {
1256
- const p = sites[count - 1];
1257
- const dp = vertical[row + p];
1258
- start = (fq - dp * dp) / (2 * (q2 - p)) + (q2 + p) * 0.5;
1259
- if (start > starts[count - 1]) break;
1260
- count--;
1261
- }
1262
- if (count === 0) start = -Infinity;
1263
- sites[count] = q2;
1264
- starts[count] = start;
1265
- count++;
1266
- }
1267
- if (count === 0) {
1268
- out.fill(EMPTY_DISTANCE, row, row + width);
1269
- continue;
1270
- }
1271
- let k = 0;
1272
- for (let x = 0; x < width; x++) {
1273
- while (k + 1 < count && starts[k + 1] < x) k++;
1274
- const site = sites[k];
1275
- const dx = x - site;
1276
- const dv = vertical[row + site];
1277
- out[row + x] = Math.sqrt(dx * dx + dv * dv);
1278
- }
1279
- }
1280
- return out;
1281
- }
1282
- function thresholdInside(m, threshold = 0.5) {
1283
- const out = new Uint8Array(m.length);
1284
- for (let i = 0; i < m.length; i++) out[i] = m[i] >= threshold ? 1 : 0;
1285
- return out;
1286
- }
1287
- function expandCoverage(m, w, h, r) {
1288
- const d = distanceTransform(thresholdInside(m), w, h);
1289
- const out = new Float32Array(m.length);
1290
- for (let i = 0; i < out.length; i++) out[i] = Math.max(m[i], Math.min(1, Math.max(0, r + 1 - d[i])));
1291
- return out;
1292
- }
1293
- function contractCoverage(m, w, h, r) {
1294
- const inv = new Float32Array(m.length);
1295
- for (let i = 0; i < inv.length; i++) inv[i] = 1 - m[i];
1296
- const e = expandCoverage(inv, w, h, r);
1297
- for (let i = 0; i < e.length; i++) e[i] = 1 - e[i];
1298
- return e;
1299
- }
1300
- function borderCoverage(m, w, h, r) {
1301
- const inside = thresholdInside(m);
1302
- const outside = new Uint8Array(inside.length);
1303
- for (let i = 0; i < inside.length; i++) outside[i] = inside[i] ? 0 : 1;
1304
- const out = new Float32Array(m.length);
1305
- if (!(r > 0)) return out;
1306
- const toInside = distanceTransform(inside, w, h);
1307
- const toOutside = distanceTransform(outside, w, h);
1308
- for (let i = 0; i < out.length; i++) {
1309
- const d = inside[i] ? toOutside[i] : toInside[i];
1310
- out[i] = Math.min(1, Math.max(0, 1 - (d - 1) / r));
1311
- }
1312
- return out;
1313
- }
1314
- function boxLineReplicate(src, srcOff, stride, len, r, dst) {
1315
- const at = (i) => src[srcOff + Math.min(len - 1, Math.max(0, i)) * stride];
1316
- let sum = 0;
1317
- for (let i = -r; i <= r; i++) sum += at(i);
1318
- const k = 2 * r + 1;
1319
- for (let i = 0; i < len; i++) {
1320
- dst[i] = sum / k;
1321
- sum += at(i + r + 1) - at(i - r);
1322
- }
1323
- }
1324
- function smoothCoverage(m, w, h, r) {
1325
- const rr = Number.isFinite(r) ? Math.max(0, Math.round(r)) : 0;
1326
- const src = Float32Array.from(m);
1327
- const tmp = new Float32Array(src.length);
1328
- const line = new Float32Array(Math.max(w, h));
1329
- if (rr > 0) {
1330
- for (let y = 0; y < h; y++) {
1331
- boxLineReplicate(src, y * w, 1, w, rr, line);
1332
- tmp.set(line.subarray(0, w), y * w);
1333
- }
1334
- for (let x = 0; x < w; x++) {
1335
- boxLineReplicate(tmp, x, w, h, rr, line);
1336
- for (let y = 0; y < h; y++) src[y * w + x] = line[y];
1337
- }
1338
- }
1339
- for (let i = 0; i < src.length; i++) src[i] = src[i] >= 0.5 ? 1 : 0;
1340
- return src;
1341
- }
1342
- function featherCoverage(m, w, h, radius) {
1343
- const out = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, m, w, h, Number.isFinite(radius) ? Math.max(0, radius) : 0, "zero");
1344
- for (let i = 0; i < out.length; i++) if (Math.abs(out[i]) < 1e-7) out[i] = 0;
1345
- return out;
1346
- }
1347
- function runningExtreme(src, off, stride, len, r, max, g, hb, dst) {
1348
- const k = 2 * r + 1;
1349
- const pick = max ? (a, b) => a > b ? a : b : (a, b) => a < b ? a : b;
1350
- const fill = max ? -Infinity : Infinity;
1351
- const plen = len + 2 * r;
1352
- const at = (i) => i < r || i >= r + len ? fill : src[off + (i - r) * stride];
1353
- for (let start = 0; start < plen; start += k) {
1354
- const end = Math.min(plen, start + k);
1355
- g[start] = at(start);
1356
- for (let i = start + 1; i < end; i++) g[i] = pick(g[i - 1], at(i));
1357
- hb[end - 1] = at(end - 1);
1358
- for (let i = end - 2; i >= start; i--) hb[i] = pick(hb[i + 1], at(i));
1359
- }
1360
- for (let i = 0; i < len; i++) {
1361
- const a = hb[i];
1362
- const b = g[i + 2 * r];
1363
- dst[i] = pick(a, b);
1364
- }
1365
- }
1366
- function greyMorphology(src, w, h, r, grow) {
1367
- const out = Float32Array.from(src);
1368
- if (r <= 0) return out;
1369
- const n = Math.max(w, h);
1370
- const g = new Float32Array(n + 2 * r);
1371
- const hb = new Float32Array(n + 2 * r);
1372
- const line = new Float32Array(n);
1373
- for (let y = 0; y < h; y++) {
1374
- runningExtreme(out, y * w, 1, w, r, grow, g, hb, line);
1375
- out.set(line.subarray(0, w), y * w);
1376
- }
1377
- for (let x = 0; x < w; x++) {
1378
- runningExtreme(out, x, w, h, r, grow, g, hb, line);
1379
- for (let y = 0; y < h; y++) out[y * w + x] = line[y];
1380
- }
1381
- return out;
1382
- }
1383
- function shiftCoverage(src, w, h, amount) {
1384
- const mag = Math.abs(amount);
1385
- if (!Number.isFinite(mag) || mag < 1e-4) return Float32Array.from(src);
1386
- const grow = amount > 0;
1387
- const whole = Math.floor(mag);
1388
- const frac = mag - whole;
1389
- if (frac < 1e-4) return greyMorphology(src, w, h, whole, grow);
1390
- const lo = whole === 0 ? Float32Array.from(src) : greyMorphology(src, w, h, whole, grow);
1391
- const hi = greyMorphology(src, w, h, whole + 1, grow);
1392
- for (let i = 0; i < lo.length; i++) lo[i] += (hi[i] - lo[i]) * frac;
1393
- return lo;
1394
- }
1395
- var SELECTION_MODIFY_OPS = ["expand", "contract", "feather", "border", "smooth", "grow", "shrink"];
1396
- function wrap(mask, coverage) {
1397
- const out = new Uint8Array(coverage.length);
1398
- for (let i = 0; i < out.length; i++) out[i] = coverageToByte(coverage[i]);
1399
- return createSelectionMask(mask.width, mask.height, out);
1400
- }
1401
- function modifySelection(mask, op, radius) {
1402
- const r = Number.isFinite(radius) ? Math.max(0, radius) : 0;
1403
- if (r === 0 && op !== "border") return mask;
1404
- const m = selectionToCoverage(mask);
1405
- const { width: w, height: h } = mask;
1406
- switch (op) {
1407
- case "expand":
1408
- case "grow":
1409
- return wrap(mask, expandCoverage(m, w, h, r));
1410
- case "contract":
1411
- case "shrink":
1412
- return wrap(mask, contractCoverage(m, w, h, r));
1413
- case "feather":
1414
- return wrap(mask, featherCoverage(m, w, h, r));
1415
- case "border":
1416
- return wrap(mask, borderCoverage(m, w, h, r));
1417
- case "smooth":
1418
- return wrap(mask, smoothCoverage(m, w, h, r));
1419
- default:
1420
- throw new Error(`Unknown selection modification "${op}"`);
1421
- }
1422
- }
1423
-
1424
722
  // src/image-editor/selection/layer-mask.ts
1425
723
  function layerMaskSelection(layer, width, height) {
1426
724
  if (!layer.mask || layer.mask.source) return null;
1427
725
  const ox = layer.type === "pixel" ? layer.offset.x : 0;
1428
726
  const oy = layer.type === "pixel" ? layer.offset.y : 0;
1429
- const data = _chunkCWM3CUUXcjs.readRegion.call(void 0, layer.mask.surface, { x: -ox, y: -oy, width, height });
1430
- return createSelectionMask(width, height, new Uint8Array(data.buffer, data.byteOffset, data.length));
727
+ const data = _chunk474IQG74cjs.readRegion.call(void 0, layer.mask.surface, { x: -ox, y: -oy, width, height });
728
+ return _chunkQYLWG22Ncjs.createSelectionMask.call(void 0, width, height, new Uint8Array(data.buffer, data.byteOffset, data.length));
1431
729
  }
1432
- var MAX_SIDE2 = 1 << 15;
730
+ var MAX_SIDE = 1 << 15;
1433
731
  function normalizeLayerMask(raw) {
1434
732
  if (!raw || typeof raw !== "object") return null;
1435
733
  const r = raw;
1436
734
  const { width, height, rle } = r;
1437
- if (typeof width !== "number" || typeof height !== "number" || !Number.isInteger(width) || !Number.isInteger(height) || width < 1 || height < 1 || width > MAX_SIDE2 || height > MAX_SIDE2 || typeof rle !== "string" || !rle.startsWith("r1:")) {
735
+ if (typeof width !== "number" || typeof height !== "number" || !Number.isInteger(width) || !Number.isInteger(height) || width < 1 || height < 1 || width > MAX_SIDE || height > MAX_SIDE || typeof rle !== "string" || !rle.startsWith("r1:")) {
1438
736
  return null;
1439
737
  }
1440
738
  const out = { width, height, rle };
@@ -1450,7 +748,7 @@ function normalizeLayerMask(raw) {
1450
748
  return out;
1451
749
  }
1452
750
  function layerMaskFromSelection(selection, props = {}) {
1453
- return normalizeLayerMask({ width: selection.width, height: selection.height, rle: encodeSelectionRle(selection.data), ...props });
751
+ return normalizeLayerMask({ width: selection.width, height: selection.height, rle: _chunkQYLWG22Ncjs.encodeSelectionRle.call(void 0, selection.data), ...props });
1454
752
  }
1455
753
  function updateLayerMaskProps(mask, props) {
1456
754
  return normalizeLayerMask({
@@ -1479,7 +777,7 @@ function decodeLayerMask(mask) {
1479
777
  const key = `${mask.width}x${mask.height}:${mask.rle}`;
1480
778
  return lru(decoded, key, () => {
1481
779
  try {
1482
- return createSelectionMask(mask.width, mask.height, decodeSelectionRle(mask.rle, mask.width * mask.height));
780
+ return _chunkQYLWG22Ncjs.createSelectionMask.call(void 0, mask.width, mask.height, _chunkQYLWG22Ncjs.decodeSelectionRle.call(void 0, mask.rle, mask.width * mask.height));
1483
781
  } catch (e2) {
1484
782
  return null;
1485
783
  }
@@ -1487,7 +785,7 @@ function decodeLayerMask(mask) {
1487
785
  }
1488
786
  function layerMaskKey(mask) {
1489
787
  if (!mask) return "";
1490
- return `${mask.width}x${mask.height}:${hashMaskContent(mask.rle)}:${_nullishCoalesce(mask.density, () => ( 1))}:${_nullishCoalesce(mask.feather, () => ( 0))}:${mask.enabled !== false}`;
788
+ return `${mask.width}x${mask.height}:${_chunkQYLWG22Ncjs.hashMaskContent.call(void 0, mask.rle)}:${_nullishCoalesce(mask.density, () => ( 1))}:${_nullishCoalesce(mask.feather, () => ( 0))}:${mask.enabled !== false}`;
1491
789
  }
1492
790
  function layerMaskCoverage(mask) {
1493
791
  if (mask.enabled === false) return null;
@@ -1497,7 +795,7 @@ function layerMaskCoverage(mask) {
1497
795
  let v = new Float32Array(sel.data.length);
1498
796
  for (let i = 0; i < v.length; i++) v[i] = sel.data[i] / 255;
1499
797
  const feather = _nullishCoalesce(mask.feather, () => ( 0));
1500
- if (feather > 0) v = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
798
+ if (feather > 0) v = _chunkK6PXS6DOcjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
1501
799
  const density = _nullishCoalesce(mask.density, () => ( 1));
1502
800
  if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
1503
801
  return v;
@@ -1539,7 +837,7 @@ function projectMaskCoverage(coverage, maskWidth, maskHeight, naturalWidth, natu
1539
837
  return out;
1540
838
  }
1541
839
  function buildLayerMaskPlanes(layers, naturalWidth, naturalHeight, projection, targetWidth, targetHeight) {
1542
- if (!_optionalChain([layers, 'optionalAccess', _6 => _6.some, 'call', _7 => _7((l) => l.mask && l.mask.enabled !== false)])) return void 0;
840
+ if (!_optionalChain([layers, 'optionalAccess', _2 => _2.some, 'call', _3 => _3((l) => l.mask && l.mask.enabled !== false)])) return void 0;
1543
841
  const planes = /* @__PURE__ */ new Map();
1544
842
  for (const layer of layers) {
1545
843
  if (!layer.mask) continue;
@@ -1718,7 +1016,7 @@ function normalizeAdjustmentLayer(raw) {
1718
1016
  kind: r.kind,
1719
1017
  enabled: r.enabled !== false,
1720
1018
  opacity: clampTo(r.opacity, 0, 1, 1),
1721
- blend: _chunkCWM3CUUXcjs.normalizeBlendMode.call(void 0, r.blend),
1019
+ blend: _chunkOLNIPTB3cjs.normalizeBlendMode.call(void 0, r.blend),
1722
1020
  params: normParams(r.kind, r.params)
1723
1021
  };
1724
1022
  if (typeof r.name === "string" && r.name) layer.name = r.name;
@@ -1740,7 +1038,7 @@ function normalizeAdjustmentLayers(raw) {
1740
1038
  return out;
1741
1039
  }
1742
1040
  function curveLutFromLevels(points) {
1743
- return _chunkHGTDMKNEcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
1041
+ return _chunkUOGKSVRQcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
1744
1042
  }
1745
1043
  var toUnitLevels = (c) => ({
1746
1044
  inBlack: c.inBlack / 255,
@@ -2064,7 +1362,7 @@ function compileAdjustmentLayer(layer, options = {}) {
2064
1362
  return (c) => {
2065
1363
  const g = blackWhiteGray(c, weights);
2066
1364
  if (tint) {
2067
- const t = _chunkCWM3CUUXcjs.setLum.call(void 0, tint, g);
1365
+ const t = _chunkOLNIPTB3cjs.setLum.call(void 0, tint, g);
2068
1366
  c[0] = clamp01(t[0]);
2069
1367
  c[1] = clamp01(t[1]);
2070
1368
  c[2] = clamp01(t[2]);
@@ -2083,7 +1381,7 @@ function compileAdjustmentLayer(layer, options = {}) {
2083
1381
  let f = [0, 1, 2].map((r) => linearToSrgb(Math.max(0, m[r][0] * l[0] + m[r][1] * l[1] + m[r][2] * l[2])));
2084
1382
  if (preserve) {
2085
1383
  const target = 0.3 * c[0] + 0.59 * c[1] + 0.11 * c[2];
2086
- f = _chunkCWM3CUUXcjs.setLum.call(void 0, f, target);
1384
+ f = _chunkOLNIPTB3cjs.setLum.call(void 0, f, target);
2087
1385
  }
2088
1386
  c[0] = clamp01(f[0]);
2089
1387
  c[1] = clamp01(f[1]);
@@ -2130,7 +1428,7 @@ function compiledFor(layer, deep = false) {
2130
1428
  return op;
2131
1429
  }
2132
1430
  function activeAdjustmentLayers(layers) {
2133
- if (!_optionalChain([layers, 'optionalAccess', _8 => _8.length])) return [];
1431
+ if (!_optionalChain([layers, 'optionalAccess', _4 => _4.length])) return [];
2134
1432
  return layers.filter((l) => l.enabled !== false && (_nullishCoalesce(l.opacity, () => ( 1))) > 0 && compiledFor(l) !== null);
2135
1433
  }
2136
1434
  function evaluateAdjustmentLayers(color, layers) {
@@ -2150,10 +1448,10 @@ function applyLayer(c, layer, op, coverage = 1) {
2150
1448
  const cb0 = c[0], cb1 = c[1], cb2 = c[2];
2151
1449
  op(c);
2152
1450
  if (blend === "pigment") {
2153
- _chunkCWM3CUUXcjs.mixPigmentRgb.call(void 0, [clamp01(cb0), clamp01(cb1), clamp01(cb2)], [clamp01(c[0]), clamp01(c[1]), clamp01(c[2])], alpha, c);
1451
+ _chunkOLNIPTB3cjs.mixPigmentRgb.call(void 0, [clamp01(cb0), clamp01(cb1), clamp01(cb2)], [clamp01(c[0]), clamp01(c[1]), clamp01(c[2])], alpha, c);
2154
1452
  return;
2155
1453
  }
2156
- const b = blend === "normal" ? c : _chunkCWM3CUUXcjs.blendRgb.call(void 0, blend, [cb0, cb1, cb2], c);
1454
+ const b = blend === "normal" ? c : _chunkOLNIPTB3cjs.blendRgb.call(void 0, blend, [cb0, cb1, cb2], c);
2157
1455
  c[0] = (1 - alpha) * cb0 + alpha * b[0];
2158
1456
  c[1] = (1 - alpha) * cb1 + alpha * b[1];
2159
1457
  c[2] = (1 - alpha) * cb2 + alpha * b[2];
@@ -2162,7 +1460,7 @@ function applyAdjustmentLayers(imageData, layers, masks) {
2162
1460
  const active = activeAdjustmentLayers(layers);
2163
1461
  if (!active.length) return;
2164
1462
  const ops = active.map((l) => compiledFor(l));
2165
- const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _9 => _9.get, 'call', _10 => _10(l.id)]));
1463
+ const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _5 => _5.get, 'call', _6 => _6(l.id)]));
2166
1464
  const data = imageData.data;
2167
1465
  const len = data.length;
2168
1466
  const c = [0, 0, 0];
@@ -2189,7 +1487,7 @@ function applyAdjustmentLayersFloat(data, layers, masks) {
2189
1487
  const active = activeAdjustmentLayers(layers);
2190
1488
  if (!active.length) return;
2191
1489
  const ops = active.map((l) => compiledFor(l, true));
2192
- const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _11 => _11.get, 'call', _12 => _12(l.id)]));
1490
+ const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _7 => _7.get, 'call', _8 => _8(l.id)]));
2193
1491
  const c = [0, 0, 0];
2194
1492
  for (let i = 0; i < data.length; i += 4) {
2195
1493
  if (!(data[i + 3] > 0)) continue;
@@ -2209,7 +1507,7 @@ function applyAdjustmentLayersFloat(data, layers, masks) {
2209
1507
  }
2210
1508
  }
2211
1509
  function adjustmentLayersKey(layers) {
2212
- if (!_optionalChain([layers, 'optionalAccess', _13 => _13.length])) return "";
1510
+ if (!_optionalChain([layers, 'optionalAccess', _9 => _9.length])) return "";
2213
1511
  return JSON.stringify(
2214
1512
  layers.map((l) => {
2215
1513
  const key = [l.kind, l.enabled !== false, _nullishCoalesce(l.opacity, () => ( 1)), _nullishCoalesce(l.blend, () => ( "normal")), l.params];
@@ -2936,13 +2234,13 @@ function newLayerId(prefix = "layer") {
2936
2234
  return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
2937
2235
  }
2938
2236
  function pixelLayers(layers) {
2939
- return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
2237
+ return _chunkUOGKSVRQcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
2940
2238
  }
2941
2239
  function developFilter(layer) {
2942
- return _optionalChain([layer, 'access', _14 => _14.filters, 'optionalAccess', _15 => _15.find, 'call', _16 => _16((f) => f.kind === "develop")]);
2240
+ return _optionalChain([layer, 'access', _10 => _10.filters, 'optionalAccess', _11 => _11.find, 'call', _12 => _12((f) => f.kind === "develop")]);
2943
2241
  }
2944
2242
  function blurFilter(layer) {
2945
- return _optionalChain([layer, 'access', _17 => _17.filters, 'optionalAccess', _18 => _18.find, 'call', _19 => _19((f) => f.kind === "blur")]);
2243
+ return _optionalChain([layer, 'access', _13 => _13.filters, 'optionalAccess', _14 => _14.find, 'call', _15 => _15((f) => f.kind === "blur")]);
2946
2244
  }
2947
2245
  function isActiveFilter(f) {
2948
2246
  if (!f.enabled) return false;
@@ -2967,14 +2265,14 @@ function isRenderedLayer(layer) {
2967
2265
  return layer.type === "smart" || layer.type === "shape" || layer.type === "type";
2968
2266
  }
2969
2267
  function shapeLayers(layers) {
2970
- return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
2268
+ return _chunkUOGKSVRQcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
2971
2269
  }
2972
2270
  function smartObjectLayers(layers) {
2973
- return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
2271
+ return _chunkUOGKSVRQcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
2974
2272
  }
2975
2273
 
2976
2274
  // src/image-editor/layers/shape.ts
2977
- var SHAPE_RENDER_MARGIN = _chunkHGTDMKNEcjs.MAX_EFFECT_REACH;
2275
+ var SHAPE_RENDER_MARGIN = _chunkUOGKSVRQcjs.MAX_EFFECT_REACH;
2978
2276
  var DEFAULT_MITER_LIMIT = 100;
2979
2277
  var fail = (message) => {
2980
2278
  throw new LayerOperationError(message);
@@ -3014,7 +2312,7 @@ function mapAnchor(a, f) {
3014
2312
  return out;
3015
2313
  }
3016
2314
  function mapSubpaths(subpaths, f) {
3017
- return _chunkBRKVNXDZcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
2315
+ return _chunkQAUIZPYIcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
3018
2316
  }
3019
2317
  function liveShapeSubpaths(live) {
3020
2318
  let out;
@@ -3022,19 +2320,19 @@ function liveShapeSubpaths(live) {
3022
2320
  case "rect": {
3023
2321
  const x = Math.min(live.x, live.x + live.width);
3024
2322
  const y = Math.min(live.y, live.y + live.height);
3025
- const sp = _chunkBRKVNXDZcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
2323
+ const sp = _chunkQAUIZPYIcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
3026
2324
  const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
3027
- out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkBRKVNXDZcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
2325
+ out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkQAUIZPYIcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
3028
2326
  break;
3029
2327
  }
3030
2328
  case "ellipse":
3031
- out = [_chunkBRKVNXDZcjs.ellipseSubpath.call(void 0, normBox(live))];
2329
+ out = [_chunkQAUIZPYIcjs.ellipseSubpath.call(void 0, normBox(live))];
3032
2330
  break;
3033
2331
  case "polygon":
3034
- out = [_chunkBRKVNXDZcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
2332
+ out = [_chunkQAUIZPYIcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
3035
2333
  break;
3036
2334
  case "star":
3037
- out = [_chunkBRKVNXDZcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
2335
+ out = [_chunkQAUIZPYIcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
3038
2336
  break;
3039
2337
  case "line": {
3040
2338
  const a = { x: live.x1, y: live.y1 };
@@ -3057,7 +2355,7 @@ function liveShapeSubpaths(live) {
3057
2355
  }
3058
2356
  }
3059
2357
  const m = live.transform;
3060
- return m && !_chunkBRKVNXDZcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, p)) : out;
2358
+ return m && !_chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, p)) : out;
3061
2359
  }
3062
2360
  function normBox(b) {
3063
2361
  return { x: Math.min(b.x, b.x + b.width), y: Math.min(b.y, b.y + b.height), width: Math.abs(b.width), height: Math.abs(b.height) };
@@ -3069,7 +2367,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
3069
2367
  function componentPath(c) {
3070
2368
  let p = pathCache.get(c.subpaths);
3071
2369
  if (!p) {
3072
- p = _chunkBRKVNXDZcjs.subpathsToBezier.call(void 0, c.subpaths);
2370
+ p = _chunkQAUIZPYIcjs.subpathsToBezier.call(void 0, c.subpaths);
3073
2371
  pathCache.set(c.subpaths, p);
3074
2372
  }
3075
2373
  return p;
@@ -3117,7 +2415,7 @@ function closedOutline(path) {
3117
2415
  function strokeArea(path, stroke, double) {
3118
2416
  const w = stroke.width * (double ? 2 : 1);
3119
2417
  if (!(w > 0) || !path.length) return [];
3120
- const dashes = _optionalChain([stroke, 'access', _20 => _20.dashes, 'optionalAccess', _21 => _21.length]) && stroke.dashes.some((d) => d > 0) ? stroke.dashes.map((d) => d * stroke.width) : void 0;
2418
+ const dashes = _optionalChain([stroke, 'access', _16 => _16.dashes, 'optionalAccess', _17 => _17.length]) && stroke.dashes.some((d) => d > 0) ? stroke.dashes.map((d) => d * stroke.width) : void 0;
3121
2419
  const options = {
3122
2420
  width: w,
3123
2421
  cap: _nullishCoalesce(stroke.cap, () => ( "butt")),
@@ -3194,11 +2492,11 @@ function componentsCoverage(components, rect, rule = "nonzero", inverted = false
3194
2492
  function paintContext(env) {
3195
2493
  const tiles = /* @__PURE__ */ new Map();
3196
2494
  return {
3197
- light: _chunkHGTDMKNEcjs.DEFAULT_GLOBAL_LIGHT,
2495
+ light: _chunkUOGKSVRQcjs.DEFAULT_GLOBAL_LIGHT,
3198
2496
  pattern: (id) => {
3199
2497
  if (tiles.has(id)) return tiles.get(id);
3200
- const p = _nullishCoalesce(_optionalChain([env, 'access', _22 => _22.pattern, 'optionalCall', _23 => _23(id)]), () => ( _chunkHGTDMKNEcjs.builtinPattern.call(void 0, id)));
3201
- const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkHGTDMKNEcjs.PatternTile)(p) : null;
2498
+ const p = _nullishCoalesce(_optionalChain([env, 'access', _18 => _18.pattern, 'optionalCall', _19 => _19(id)]), () => ( _chunkUOGKSVRQcjs.builtinPattern.call(void 0, id)));
2499
+ const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkUOGKSVRQcjs.PatternTile)(p) : null;
3202
2500
  tiles.set(id, t);
3203
2501
  return t;
3204
2502
  }
@@ -3229,10 +2527,10 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
3229
2527
  if (!fCov && !sCov) return null;
3230
2528
  const canvas = { x: 0, y: 0, width: env.width, height: env.height };
3231
2529
  const anchor = { x: geo.frame.x, y: geo.frame.y };
3232
- const fc = fCov ? _chunkHGTDMKNEcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
3233
- const fo = _nullishCoalesce(_optionalChain([layer, 'access', _24 => _24.fill, 'optionalAccess', _25 => _25.opacity]), () => ( 1));
3234
- const sc = sCov ? _chunkHGTDMKNEcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
3235
- const so = _nullishCoalesce(_optionalChain([layer, 'access', _26 => _26.stroke, 'optionalAccess', _27 => _27.paint, 'access', _28 => _28.opacity]), () => ( 1));
2530
+ const fc = fCov ? _chunkUOGKSVRQcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
2531
+ const fo = _nullishCoalesce(_optionalChain([layer, 'access', _20 => _20.fill, 'optionalAccess', _21 => _21.opacity]), () => ( 1));
2532
+ const sc = sCov ? _chunkUOGKSVRQcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
2533
+ const so = _nullishCoalesce(_optionalChain([layer, 'access', _22 => _22.stroke, 'optionalAccess', _23 => _23.paint, 'access', _24 => _24.opacity]), () => ( 1));
3236
2534
  const out = new Uint8ClampedArray(n * 4);
3237
2535
  let any = false;
3238
2536
  for (let i = 0; i < n; i++) {
@@ -3270,20 +2568,20 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
3270
2568
  }
3271
2569
  function renderShape(layer, env, options = {}) {
3272
2570
  const geo = shapeGeometry(layer);
3273
- if (!geo.bounds) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4);
2571
+ if (!geo.bounds) return _chunk474IQG74cjs.emptySurface.call(void 0, 4);
3274
2572
  let region = intersect(geo.bounds, shapeRenderClip(env));
3275
2573
  if (region && options.clip) region = intersect(region, options.clip);
3276
- if (!region) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4);
2574
+ if (!region) return _chunk474IQG74cjs.emptySurface.call(void 0, 4);
3277
2575
  const ctx = paintContext(env);
3278
2576
  const tiles = /* @__PURE__ */ new Map();
3279
- for (const { tx, ty } of _chunkCWM3CUUXcjs.tilesInRect.call(void 0, region)) {
3280
- const rect = { x: tx * _chunkCWM3CUUXcjs.TILE, y: ty * _chunkCWM3CUUXcjs.TILE, width: _chunkCWM3CUUXcjs.TILE, height: _chunkCWM3CUUXcjs.TILE };
2577
+ for (const { tx, ty } of _chunk474IQG74cjs.tilesInRect.call(void 0, region)) {
2578
+ const rect = { x: tx * _chunk474IQG74cjs.TILE, y: ty * _chunk474IQG74cjs.TILE, width: _chunk474IQG74cjs.TILE, height: _chunk474IQG74cjs.TILE };
3281
2579
  const px2 = renderShapeRect(layer, rect, env, ctx);
3282
2580
  if (!px2) continue;
3283
- const tile = _chunkCWM3CUUXcjs.finishTile.call(void 0, px2, 4, 0);
3284
- if (tile) tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), tile);
2581
+ const tile = _chunk474IQG74cjs.finishTile.call(void 0, px2, 4, 0);
2582
+ if (tile) tiles.set(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty), tile);
3285
2583
  }
3286
- return new (0, _chunkCWM3CUUXcjs.TiledSurface)(4, tiles, 0);
2584
+ return new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, 0);
3287
2585
  }
3288
2586
  function rerenderShape(layer, env) {
3289
2587
  return { ...layer, surface: renderShape(layer, env) };
@@ -3314,7 +2612,7 @@ function normalizeShapePaint(v, path = "paint") {
3314
2612
  const g = o.gradient;
3315
2613
  if (!g || typeof g !== "object") return fail(`${path}.gradient is required: { stops: [{ position, color }], style, angle, \u2026 }.`);
3316
2614
  const gradient = {
3317
- stops: Array.isArray(g.stops) ? g.stops.map((s) => ({ position: s.position, color: _nullishCoalesce(_optionalChain([_chunkA2IS7EHEcjs.parseCssColor.call(void 0, s.color), 'optionalAccess', _29 => _29.hex]), () => ( s.color)) })) : [],
2615
+ stops: Array.isArray(g.stops) ? g.stops.map((s) => ({ position: s.position, color: _nullishCoalesce(_optionalChain([_chunkA2IS7EHEcjs.parseCssColor.call(void 0, s.color), 'optionalAccess', _25 => _25.hex]), () => ( s.color)) })) : [],
3318
2616
  ...g.opacityStops ? { opacityStops: g.opacityStops } : {},
3319
2617
  style: _nullishCoalesce(g.style, () => ( "linear")),
3320
2618
  angle: _nullishCoalesce(g.angle, () => ( 90)),
@@ -3324,9 +2622,9 @@ function normalizeShapePaint(v, path = "paint") {
3324
2622
  offset: _nullishCoalesce(g.offset, () => ( { x: 0, y: 0 }))
3325
2623
  };
3326
2624
  try {
3327
- _chunkHGTDMKNEcjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
2625
+ _chunkUOGKSVRQcjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
3328
2626
  } catch (e) {
3329
- if (e instanceof _chunkHGTDMKNEcjs.LayerEffectError) fail(e.message);
2627
+ if (e instanceof _chunkUOGKSVRQcjs.LayerEffectError) fail(e.message);
3330
2628
  throw e;
3331
2629
  }
3332
2630
  if (gradient.stops.length < 1) fail(`${path}.gradient.stops needs at least one { position, color }.`);
@@ -3340,7 +2638,7 @@ function normalizeShapePaint(v, path = "paint") {
3340
2638
  if (o.link !== void 0) p.link = Boolean(o.link);
3341
2639
  if (o.phase !== void 0) {
3342
2640
  const ph = o.phase;
3343
- p.phase = { x: requireNum(_optionalChain([ph, 'optionalAccess', _30 => _30.x]), `${path}.phase.x`), y: requireNum(_optionalChain([ph, 'optionalAccess', _31 => _31.y]), `${path}.phase.y`) };
2641
+ p.phase = { x: requireNum(_optionalChain([ph, 'optionalAccess', _26 => _26.x]), `${path}.phase.x`), y: requireNum(_optionalChain([ph, 'optionalAccess', _27 => _27.y]), `${path}.phase.y`) };
3344
2642
  }
3345
2643
  return withOpacity(p);
3346
2644
  }
@@ -3353,7 +2651,7 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3353
2651
  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`);
3354
2652
  const out = { width, paint };
3355
2653
  const pick = (k, allowed) => {
3356
- const value = o[k] === void 0 ? _optionalChain([base, 'optionalAccess', _32 => _32[k]]) : o[k];
2654
+ const value = o[k] === void 0 ? _optionalChain([base, 'optionalAccess', _28 => _28[k]]) : o[k];
3357
2655
  if (value === void 0) return;
3358
2656
  if (!allowed.includes(value)) fail(`${path}.${k} must be one of ${allowed.join(", ")}, got ${JSON.stringify(value)}.`);
3359
2657
  if (value !== (k === "align" ? "center" : k === "cap" ? "butt" : "miter")) out[k] = value;
@@ -3361,9 +2659,9 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3361
2659
  pick("align", ["inside", "center", "outside"]);
3362
2660
  pick("cap", ["butt", "round", "square"]);
3363
2661
  pick("join", ["miter", "round", "bevel"]);
3364
- const miter = o.miterLimit === void 0 ? _optionalChain([base, 'optionalAccess', _33 => _33.miterLimit]) : requireNum(o.miterLimit, `${path}.miterLimit`, 1, 500);
2662
+ const miter = o.miterLimit === void 0 ? _optionalChain([base, 'optionalAccess', _29 => _29.miterLimit]) : requireNum(o.miterLimit, `${path}.miterLimit`, 1, 500);
3365
2663
  if (miter !== void 0 && miter !== DEFAULT_MITER_LIMIT) out.miterLimit = miter;
3366
- const dashes = o.dashes === void 0 ? _optionalChain([base, 'optionalAccess', _34 => _34.dashes]) : o.dashes;
2664
+ const dashes = o.dashes === void 0 ? _optionalChain([base, 'optionalAccess', _30 => _30.dashes]) : o.dashes;
3367
2665
  if (dashes !== void 0 && dashes !== null) {
3368
2666
  if (!Array.isArray(dashes) || dashes.length > 32 || !dashes.every((d) => isNum(d) && d >= 0 && d <= 1e4)) fail(`${path}.dashes must be at most 32 lengths 0..10000 (multiples of the width).`);
3369
2667
  if (dashes.length) {
@@ -3371,7 +2669,7 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3371
2669
  out.dashes = [...dashes];
3372
2670
  }
3373
2671
  }
3374
- const offset = o.dashOffset === void 0 ? _optionalChain([base, 'optionalAccess', _35 => _35.dashOffset]) : requireNum(o.dashOffset, `${path}.dashOffset`, -1e6, 1e6);
2672
+ const offset = o.dashOffset === void 0 ? _optionalChain([base, 'optionalAccess', _31 => _31.dashOffset]) : requireNum(o.dashOffset, `${path}.dashOffset`, -1e6, 1e6);
3375
2673
  if (offset) out.dashOffset = offset;
3376
2674
  return out;
3377
2675
  }
@@ -3396,7 +2694,7 @@ function matrixArg(v, path) {
3396
2694
  if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail(`${path} must be six numbers [a, b, c, d, e, f].`);
3397
2695
  const m = v;
3398
2696
  if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail(`${path} is singular.`);
3399
- return _chunkBRKVNXDZcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
2697
+ return _chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
3400
2698
  }
3401
2699
  function normalizeLiveShape(v, path = "shape") {
3402
2700
  if (!v || typeof v !== "object") return fail(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
@@ -3457,7 +2755,7 @@ function normalizeSubpaths(v, path = "subpaths") {
3457
2755
  if (typeof v === "string") {
3458
2756
  let subs;
3459
2757
  try {
3460
- subs = _chunkBRKVNXDZcjs.bezierToSubpaths.call(void 0, v);
2758
+ subs = _chunkQAUIZPYIcjs.bezierToSubpaths.call(void 0, v);
3461
2759
  } catch (e5) {
3462
2760
  return fail(`${path}: could not read the SVG path data.`);
3463
2761
  }
@@ -3507,7 +2805,7 @@ function createShapeLayer(init, env, id = newLayerId()) {
3507
2805
  components: init.components,
3508
2806
  fill: init.fill === void 0 ? null : init.fill,
3509
2807
  stroke: _nullishCoalesce(init.stroke, () => ( null)),
3510
- surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
2808
+ surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
3511
2809
  offset: { x: 0, y: 0 }
3512
2810
  };
3513
2811
  if (init.fillRule && init.fillRule !== "nonzero") layer.fillRule = init.fillRule;
@@ -3515,7 +2813,7 @@ function createShapeLayer(init, env, id = newLayerId()) {
3515
2813
  return rerenderShape(layer, env);
3516
2814
  }
3517
2815
  function defaultShapeName(c) {
3518
- switch (_optionalChain([c, 'optionalAccess', _36 => _36.live, 'optionalAccess', _37 => _37.kind])) {
2816
+ switch (_optionalChain([c, 'optionalAccess', _32 => _32.live, 'optionalAccess', _33 => _33.kind])) {
3519
2817
  case "rect":
3520
2818
  return "Rectangle";
3521
2819
  case "ellipse":
@@ -3538,20 +2836,20 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
3538
2836
  if (!("annotation" in patch)) delete next.annotation;
3539
2837
  if (!next.components.length) fail("A shape needs at least one component; delete the layer instead.");
3540
2838
  const rendered = rerenderShape(next, env);
3541
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
2839
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
3542
2840
  }
3543
2841
  function transformShapeComponents(components, f, affine) {
3544
2842
  return components.map((c) => {
3545
2843
  if (affine && c.live) {
3546
- const live = { ...c.live, transform: _chunkBRKVNXDZcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkBRKVNXDZcjs.IDENTITY_MATRIX)), affine) };
3547
- if (_chunkBRKVNXDZcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
2844
+ const live = { ...c.live, transform: _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkQAUIZPYIcjs.IDENTITY_MATRIX)), affine) };
2845
+ if (_chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
3548
2846
  return { op: c.op, subpaths: liveShapeSubpaths(live), live };
3549
2847
  }
3550
2848
  return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
3551
2849
  });
3552
2850
  }
3553
2851
  function offsetShape(layer, dx, dy, env) {
3554
- const m = _chunkBRKVNXDZcjs.translateMatrix.call(void 0, dx, dy);
2852
+ const m = _chunkQAUIZPYIcjs.translateMatrix.call(void 0, dx, dy);
3555
2853
  const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
3556
2854
  delete next.annotation;
3557
2855
  return rerenderShape(next, env);
@@ -3559,7 +2857,7 @@ function offsetShape(layer, dx, dy, env) {
3559
2857
  function mergeShapeComponents(components, fillRule = "nonzero") {
3560
2858
  if (components.length < 2) return [...components];
3561
2859
  const path = shapeOutline(components, fillRule);
3562
- const subpaths = _chunkBRKVNXDZcjs.bezierToSubpaths.call(void 0, path);
2860
+ const subpaths = _chunkQAUIZPYIcjs.bezierToSubpaths.call(void 0, path);
3563
2861
  if (!subpaths.length) fail("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
3564
2862
  return [{ op: "combine", subpaths }];
3565
2863
  }
@@ -3569,14 +2867,14 @@ function shapeAsPixelLayer(layer) {
3569
2867
  }
3570
2868
  function annotationPaint(color, opacity) {
3571
2869
  const c = _chunkA2IS7EHEcjs.parseCssColor.call(void 0, color);
3572
- if (!c || !_chunkHGTDMKNEcjs.parseEffectColor.call(void 0, c.hex)) return void 0;
2870
+ if (!c || !_chunkUOGKSVRQcjs.parseEffectColor.call(void 0, c.hex)) return void 0;
3573
2871
  const a = c.alpha * opacity;
3574
2872
  return a !== 1 ? { type: "color", color: c.hex, opacity: a } : { type: "color", color: c.hex };
3575
2873
  }
3576
2874
  function shapeFromAnnotation(a) {
3577
2875
  const opacity = _nullishCoalesce(a.opacity, () => ( 1));
3578
2876
  const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
3579
- const rotation = a.rotation ? _chunkBRKVNXDZcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
2877
+ const rotation = a.rotation ? _chunkQAUIZPYIcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
3580
2878
  const t = rotation ? { transform: rotation } : {};
3581
2879
  const live = (l) => liveComponent(l);
3582
2880
  switch (a.type) {
@@ -3619,7 +2917,7 @@ function shapeFromAnnotation(a) {
3619
2917
  case "pen": {
3620
2918
  const paint = annotationPaint(a.strokeColor, opacity);
3621
2919
  if (!paint) return null;
3622
- const pts = rotation ? a.points.map((p) => _chunkBRKVNXDZcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
2920
+ const pts = rotation ? a.points.map((p) => _chunkQAUIZPYIcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
3623
2921
  const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
3624
2922
  return {
3625
2923
  components: [{ op: "combine", subpaths }],
@@ -3633,7 +2931,7 @@ function shapeFromAnnotation(a) {
3633
2931
  }
3634
2932
  function annotationBlend(a, layerBlend) {
3635
2933
  if (layerBlend !== "normal") return layerBlend;
3636
- return a.blend && _chunkCWM3CUUXcjs.isBlendMode.call(void 0, a.blend) ? a.blend : "normal";
2934
+ return a.blend && _chunkOLNIPTB3cjs.isBlendMode.call(void 0, a.blend) ? a.blend : "normal";
3637
2935
  }
3638
2936
  function annotationOfShape(layer) {
3639
2937
  const a = layer.annotation;
@@ -3652,7 +2950,7 @@ function isActiveVectorMask(vm) {
3652
2950
  }
3653
2951
  function vectorMaskCoverage(vm, width, height) {
3654
2952
  let v = componentsCoverage(vm.components, { x: 0, y: 0, width, height }, _nullishCoalesce(vm.fillRule, () => ( "nonzero")), vm.inverted === true);
3655
- if ((_nullishCoalesce(vm.feather, () => ( 0))) > 0) v = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, v, width, height, vm.feather, "clamp");
2953
+ if ((_nullishCoalesce(vm.feather, () => ( 0))) > 0) v = _chunkK6PXS6DOcjs.gaussianBlur.call(void 0, v, width, height, vm.feather, "clamp");
3656
2954
  const density = _nullishCoalesce(vm.density, () => ( 1));
3657
2955
  if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
3658
2956
  return v;
@@ -3661,10 +2959,10 @@ function outsideValue(vm) {
3661
2959
  return 1 - (_nullishCoalesce(vm.density, () => ( 1))) * (1 - (vm.inverted ? 1 : 0));
3662
2960
  }
3663
2961
  function rasterCoverage(mask, ox, oy, width, height) {
3664
- const bytes = _chunkCWM3CUUXcjs.readRegion.call(void 0, mask.surface, { x: -ox, y: -oy, width, height });
2962
+ const bytes = _chunk474IQG74cjs.readRegion.call(void 0, mask.surface, { x: -ox, y: -oy, width, height });
3665
2963
  let v = new Float32Array(width * height);
3666
2964
  for (let i = 0; i < v.length; i++) v[i] = bytes[i] / 255;
3667
- if ((_nullishCoalesce(mask.feather, () => ( 0))) > 0) v = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, v, width, height, mask.feather, "clamp");
2965
+ if ((_nullishCoalesce(mask.feather, () => ( 0))) > 0) v = _chunkK6PXS6DOcjs.gaussianBlur.call(void 0, v, width, height, mask.feather, "clamp");
3668
2966
  const density = _nullishCoalesce(mask.density, () => ( 1));
3669
2967
  if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
3670
2968
  return v;
@@ -3673,7 +2971,7 @@ var layerOffset = (layer) => layer.type === "pixel" ? layer.offset : { x: 0, y:
3673
2971
  function effectiveLayerMask(layer, width, height) {
3674
2972
  const vm = layer.vectorMask;
3675
2973
  const raster = layer.mask;
3676
- if (!isActiveVectorMask(vm) || _optionalChain([raster, 'optionalAccess', _38 => _38.source]) || width < 1 || height < 1) return raster;
2974
+ if (!isActiveVectorMask(vm) || _optionalChain([raster, 'optionalAccess', _34 => _34.source]) || width < 1 || height < 1) return raster;
3677
2975
  const { x: ox, y: oy } = layerOffset(layer);
3678
2976
  const v = vectorMaskCoverage(vm, width, height);
3679
2977
  let outside = outsideValue(vm);
@@ -3685,7 +2983,7 @@ function effectiveLayerMask(layer, width, height) {
3685
2983
  const bytes = new Uint8ClampedArray(v.length);
3686
2984
  for (let i = 0; i < v.length; i++) bytes[i] = Math.round(v[i] * 255);
3687
2985
  const defaultValue = outside >= 0.5 ? 255 : 0;
3688
- return { surface: _chunkCWM3CUUXcjs.writeRegion.call(void 0, _chunkCWM3CUUXcjs.emptySurface.call(void 0, 1, defaultValue), { x: -ox, y: -oy, width, height }, bytes), defaultValue };
2986
+ return { surface: _chunk474IQG74cjs.writeRegion.call(void 0, _chunk474IQG74cjs.emptySurface.call(void 0, 1, defaultValue), { x: -ox, y: -oy, width, height }, bytes), defaultValue };
3689
2987
  }
3690
2988
  var resolved = /* @__PURE__ */ new WeakMap();
3691
2989
  function hasVectorMask(layers) {
@@ -3704,7 +3002,7 @@ function resolveLayer(layer, width, height) {
3704
3002
  if (layer.type === "group" && hasVectorMask(layer.children)) {
3705
3003
  const key2 = `${width}x${height}`;
3706
3004
  const hit2 = resolved.get(layer);
3707
- if (_optionalChain([hit2, 'optionalAccess', _39 => _39.key]) === key2) return hit2.layer;
3005
+ if (_optionalChain([hit2, 'optionalAccess', _35 => _35.key]) === key2) return hit2.layer;
3708
3006
  next = { ...layer, children: layer.children.map((c) => resolveLayer(c, width, height)) };
3709
3007
  if (!isActiveVectorMask(layer.vectorMask)) {
3710
3008
  resolved.set(layer, { key: key2, layer: next });
@@ -3714,7 +3012,7 @@ function resolveLayer(layer, width, height) {
3714
3012
  if (!isActiveVectorMask(layer.vectorMask)) return layer;
3715
3013
  const key = `${width}x${height}:v`;
3716
3014
  const hit = resolved.get(layer);
3717
- if (_optionalChain([hit, 'optionalAccess', _40 => _40.key]) === key) return hit.layer;
3015
+ if (_optionalChain([hit, 'optionalAccess', _36 => _36.key]) === key) return hit.layer;
3718
3016
  const mask = effectiveLayerMask(layer, width, height);
3719
3017
  const out = { ...next, mask };
3720
3018
  delete out.vectorMask;
@@ -3759,7 +3057,7 @@ var thumbCache = /* @__PURE__ */ new WeakMap();
3759
3057
  function vectorMaskThumbnail(vm, width, height, maxSide = 64) {
3760
3058
  const key = `${width}x${height}:${maxSide}`;
3761
3059
  const hit = thumbCache.get(vm);
3762
- if (_optionalChain([hit, 'optionalAccess', _41 => _41.key]) === key) return hit.pixels;
3060
+ if (_optionalChain([hit, 'optionalAccess', _37 => _37.key]) === key) return hit.pixels;
3763
3061
  const k = Math.min(1, maxSide / Math.max(1, width, height));
3764
3062
  const tw = Math.max(1, Math.round(width * k));
3765
3063
  const th = Math.max(1, Math.round(height * k));
@@ -3790,18 +3088,18 @@ function userErrorMessage(err) {
3790
3088
  return err instanceof Error ? err.message : String(err);
3791
3089
  }
3792
3090
  function isPaintableLayer(layer) {
3793
- return layer.type === "pixel" && layer.visible && !_chunkHGTDMKNEcjs.isLayerLocked.call(void 0, layer, "pixels");
3091
+ return layer.type === "pixel" && layer.visible && !_chunkUOGKSVRQcjs.isLayerLocked.call(void 0, layer, "pixels");
3794
3092
  }
3795
3093
  function defaultActiveLayerId(layers) {
3796
- const pixels = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
3094
+ const pixels = _chunkUOGKSVRQcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
3797
3095
  for (let i = pixels.length - 1; i >= 0; i--) if (isPaintableLayer(pixels[i])) return pixels[i].id;
3798
- return _nullishCoalesce(_optionalChain([pixels, 'access', _42 => _42[pixels.length - 1], 'optionalAccess', _43 => _43.id]), () => ( null));
3096
+ return _nullishCoalesce(_optionalChain([pixels, 'access', _38 => _38[pixels.length - 1], 'optionalAccess', _39 => _39.id]), () => ( null));
3799
3097
  }
3800
3098
  function activeLayerAfterRemoval(prev, next, removedId) {
3801
- const before = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, prev);
3099
+ const before = _chunkUOGKSVRQcjs.flattenLayers.call(void 0, prev);
3802
3100
  const at = before.findIndex((l) => l.id === removedId);
3803
3101
  for (let i = at - 1; i >= 0; i--) {
3804
- const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, next, before[i].id);
3102
+ const loc = _chunkUOGKSVRQcjs.findLayer.call(void 0, next, before[i].id);
3805
3103
  if (loc && isPaintableLayer(loc.layer)) return loc.layer.id;
3806
3104
  }
3807
3105
  return defaultActiveLayerId(next);
@@ -3810,47 +3108,47 @@ var fail2 = (message) => {
3810
3108
  throw new LayerOperationError(message);
3811
3109
  };
3812
3110
  function requireLayer(layers, id) {
3813
- const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, layers, id);
3111
+ const loc = _chunkUOGKSVRQcjs.findLayer.call(void 0, layers, id);
3814
3112
  if (!loc) {
3815
- const ids = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
3113
+ const ids = _chunkUOGKSVRQcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
3816
3114
  fail2(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
3817
3115
  }
3818
3116
  return loc;
3819
3117
  }
3820
3118
  function requireUnlocked(layer, what, action) {
3821
- if (_chunkHGTDMKNEcjs.isLayerLocked.call(void 0, layer, "all")) fail2(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
3822
- if (what !== "all" && _chunkHGTDMKNEcjs.isLayerLocked.call(void 0, layer, what)) fail2(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
3119
+ if (_chunkUOGKSVRQcjs.isLayerLocked.call(void 0, layer, "all")) fail2(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
3120
+ if (what !== "all" && _chunkUOGKSVRQcjs.isLayerLocked.call(void 0, layer, what)) fail2(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
3823
3121
  }
3824
3122
  function placeLayer(layers, layer, placement = {}, defaultIndex) {
3825
3123
  const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
3826
3124
  if (given > 1) fail2("Give only one of aboveId, belowId and parentId.");
3827
3125
  if (placement.aboveId || placement.belowId) {
3828
3126
  const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
3829
- return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _44 => _44.parent, 'optionalAccess', _45 => _45.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
3127
+ return _chunkUOGKSVRQcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _40 => _40.parent, 'optionalAccess', _41 => _41.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
3830
3128
  }
3831
3129
  if (placement.parentId) {
3832
3130
  const ref = requireLayer(layers, placement.parentId);
3833
3131
  if (ref.layer.type !== "group") fail2(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
3834
- return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
3132
+ return _chunkUOGKSVRQcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
3835
3133
  }
3836
- return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
3134
+ return _chunkUOGKSVRQcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
3837
3135
  }
3838
3136
  function removeLayer(layers, id) {
3839
3137
  const loc = requireLayer(layers, id);
3840
3138
  requireUnlocked(loc.layer, "all", "delete it");
3841
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => null);
3139
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => null);
3842
3140
  }
3843
3141
  function moveLayer(layers, id, placement) {
3844
3142
  const loc = requireLayer(layers, id);
3845
3143
  requireUnlocked(loc.layer, "all", "move it");
3846
3144
  const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
3847
3145
  if (target === id) fail2("A layer cannot be placed relative to itself.");
3848
- if (target && loc.layer.type === "group" && _chunkHGTDMKNEcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
3146
+ if (target && loc.layer.type === "group" && _chunkUOGKSVRQcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
3849
3147
  fail2(`Group "${id}" cannot be moved into its own child "${target}".`);
3850
3148
  }
3851
3149
  if (target) requireLayer(layers, target);
3852
3150
  if (!target && placement.index === void 0) fail2("Give aboveId, belowId, parentId or index.");
3853
- const without = _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => null);
3151
+ const without = _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => null);
3854
3152
  return placeLayer(without, loc.layer, placement);
3855
3153
  }
3856
3154
  function withNewIds(layer) {
@@ -3858,7 +3156,7 @@ function withNewIds(layer) {
3858
3156
  if (next.type === "group") next.children = next.children.map(withNewIds);
3859
3157
  if (next.type === "annotation") next.annotation = { ...next.annotation, id: next.id };
3860
3158
  if (next.type === "shape" || next.type === "type") delete next.annotation;
3861
- if (next.type === "smart" && _optionalChain([next, 'access', _46 => _46.psd, 'optionalAccess', _47 => _47.placed])) {
3159
+ if (next.type === "smart" && _optionalChain([next, 'access', _42 => _42.psd, 'optionalAccess', _43 => _43.placed])) {
3862
3160
  next.psd = { ...next.psd };
3863
3161
  delete next.psd.placed;
3864
3162
  }
@@ -3869,7 +3167,7 @@ function duplicateLayer(layers, id, name) {
3869
3167
  const copy = withNewIds(loc.layer);
3870
3168
  copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
3871
3169
  delete copy.locks;
3872
- return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _48 => _48.parent, 'optionalAccess', _49 => _49.id]), () => ( null)), loc.index + 1), id: copy.id };
3170
+ return { layers: _chunkUOGKSVRQcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _44 => _44.parent, 'optionalAccess', _45 => _45.id]), () => ( null)), loc.index + 1), id: copy.id };
3873
3171
  }
3874
3172
  function setLayerProperties(layers, id, props) {
3875
3173
  const loc = requireLayer(layers, id);
@@ -3896,7 +3194,7 @@ function setLayerProperties(layers, id, props) {
3896
3194
  if (props.blend !== void 0) {
3897
3195
  if (props.blend === "pass-through") {
3898
3196
  if (layer.type !== "group") fail2("pass-through is only for groups.");
3899
- } else if (!_chunkCWM3CUUXcjs.isBlendMode.call(void 0, props.blend)) fail2(`Unknown blend mode "${props.blend}".`);
3197
+ } else if (!_chunkOLNIPTB3cjs.isBlendMode.call(void 0, props.blend)) fail2(`Unknown blend mode "${props.blend}".`);
3900
3198
  next.blend = props.blend;
3901
3199
  }
3902
3200
  if (props.clipped !== void 0) {
@@ -3916,13 +3214,13 @@ function setLayerProperties(layers, id, props) {
3916
3214
  if (props.collapsed) g.collapsed = true;
3917
3215
  else delete g.collapsed;
3918
3216
  }
3919
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next);
3217
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next);
3920
3218
  }
3921
3219
  function groupLayers(layers, ids, name = "Group") {
3922
3220
  if (!ids.length) fail2("Give at least one layer id to group.");
3923
3221
  const locs = ids.map((id) => requireLayer(layers, id));
3924
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _50 => _50[0], 'access', _51 => _51.parent, 'optionalAccess', _52 => _52.id]), () => ( null));
3925
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _53 => _53.parent, 'optionalAccess', _54 => _54.id]), () => ( null))) !== parent)) fail2("Layers to group must share one parent; move them next to each other first.");
3222
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _46 => _46[0], 'access', _47 => _47.parent, 'optionalAccess', _48 => _48.id]), () => ( null));
3223
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _49 => _49.parent, 'optionalAccess', _50 => _50.id]), () => ( null))) !== parent)) fail2("Layers to group must share one parent; move them next to each other first.");
3926
3224
  for (const l of locs) requireUnlocked(l.layer, "all", "group it");
3927
3225
  const ordered = [...new Set(locs)].sort((a, b) => a.index - b.index);
3928
3226
  const top = ordered[ordered.length - 1].index;
@@ -3939,23 +3237,23 @@ function groupLayers(layers, ids, name = "Group") {
3939
3237
  return c;
3940
3238
  })
3941
3239
  };
3942
- if (_optionalChain([group, 'access', _55 => _55.children, 'access', _56 => _56[0], 'optionalAccess', _57 => _57.clipped])) {
3240
+ if (_optionalChain([group, 'access', _51 => _51.children, 'access', _52 => _52[0], 'optionalAccess', _53 => _53.clipped])) {
3943
3241
  const c = { ...group.children[0] };
3944
3242
  delete c.clipped;
3945
3243
  group.children[0] = c;
3946
3244
  }
3947
3245
  let out = layers;
3948
- for (const l of ordered) out = _chunkHGTDMKNEcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
3949
- return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
3246
+ for (const l of ordered) out = _chunkUOGKSVRQcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
3247
+ return { layers: _chunkUOGKSVRQcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
3950
3248
  }
3951
3249
  function ungroupLayer(layers, id) {
3952
3250
  const loc = requireLayer(layers, id);
3953
3251
  if (loc.layer.type !== "group") fail2(`Layer "${id}" is not a group.`);
3954
3252
  requireUnlocked(loc.layer, "all", "ungroup it");
3955
3253
  const group = loc.layer;
3956
- let out = _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => null);
3254
+ let out = _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => null);
3957
3255
  group.children.forEach((c, i) => {
3958
- out = _chunkHGTDMKNEcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _58 => _58.parent, 'optionalAccess', _59 => _59.id]), () => ( null)), loc.index + i);
3256
+ out = _chunkUOGKSVRQcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _54 => _54.parent, 'optionalAccess', _55 => _55.id]), () => ( null)), loc.index + i);
3959
3257
  });
3960
3258
  return { layers: out, ids: group.children.map((c) => c.id) };
3961
3259
  }
@@ -3968,14 +3266,14 @@ function offsetLayer(layers, id, offset) {
3968
3266
  const next = { ...layer, offset: { x: Math.round(offset.x), y: Math.round(offset.y) } };
3969
3267
  const mask = layer.mask;
3970
3268
  if (mask && mask.linked === false && !mask.source) {
3971
- next.mask = { ...mask, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
3269
+ next.mask = { ...mask, surface: _chunk474IQG74cjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
3972
3270
  }
3973
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => followLayerMove(next, next.offset.x - layer.offset.x, next.offset.y - layer.offset.y));
3271
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => followLayerMove(next, next.offset.x - layer.offset.x, next.offset.y - layer.offset.y));
3974
3272
  }
3975
3273
  function setLayerMask(layers, id, mask) {
3976
3274
  const loc = requireLayer(layers, id);
3977
3275
  requireUnlocked(loc.layer, "all", "change its mask");
3978
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, (l) => {
3276
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, (l) => {
3979
3277
  const next = { ...l };
3980
3278
  if (mask) next.mask = mask;
3981
3279
  else delete next.mask;
@@ -4013,8 +3311,8 @@ function requirePixelLayer(layers, id) {
4013
3311
  }
4014
3312
  function addLayerFilter(layers, id, filter) {
4015
3313
  const layer = requirePixelLayer(layers, id);
4016
- if (_optionalChain([layer, 'access', _60 => _60.filters, 'optionalAccess', _61 => _61.some, 'call', _62 => _62((f) => f.kind === filter.kind)])) fail2(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
4017
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
3314
+ if (_optionalChain([layer, 'access', _56 => _56.filters, 'optionalAccess', _57 => _57.some, 'call', _58 => _58((f) => f.kind === filter.kind)])) fail2(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
3315
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
4018
3316
  }
4019
3317
  function updateLayerFilter(layers, id, filterId, changes) {
4020
3318
  const layer = requirePixelLayer(layers, id);
@@ -4025,7 +3323,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
4025
3323
  const merged2 = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
4026
3324
  const filters = [...layer.filters];
4027
3325
  filters[i] = merged2;
4028
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
3326
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
4029
3327
  }
4030
3328
  function removeLayerFilter(layers, id, filterId) {
4031
3329
  const layer = requirePixelLayer(layers, id);
@@ -4034,7 +3332,7 @@ function removeLayerFilter(layers, id, filterId) {
4034
3332
  const next = { ...layer };
4035
3333
  if (filters.length) next.filters = filters;
4036
3334
  else delete next.filters;
4037
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next);
3335
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next);
4038
3336
  }
4039
3337
  function requireEffectLayer(layers, id, action) {
4040
3338
  const layer = requireLayer(layers, id).layer;
@@ -4049,7 +3347,7 @@ function guard(fn) {
4049
3347
  try {
4050
3348
  return fn();
4051
3349
  } catch (e) {
4052
- if (e instanceof _chunkHGTDMKNEcjs.LayerEffectError) fail2(e.message);
3350
+ if (e instanceof _chunkUOGKSVRQcjs.LayerEffectError) fail2(e.message);
4053
3351
  throw e;
4054
3352
  }
4055
3353
  }
@@ -4057,27 +3355,27 @@ function setLayerEffects(layers, id, effects) {
4057
3355
  const layer = requireEffectLayer(layers, id, "change its effects");
4058
3356
  const next = { ...layer };
4059
3357
  if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
4060
- guard(() => _chunkHGTDMKNEcjs.validateLayerEffects.call(void 0, effects));
3358
+ guard(() => _chunkUOGKSVRQcjs.validateLayerEffects.call(void 0, effects));
4061
3359
  next.effects = effects;
4062
3360
  } else delete next.effects;
4063
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next);
3361
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next);
4064
3362
  }
4065
3363
  function addLayerEffect(layers, id, kind, params = {}, index) {
4066
- if (!_chunkHGTDMKNEcjs.isLayerEffectKind.call(void 0, kind)) fail2(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkHGTDMKNEcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
3364
+ if (!_chunkUOGKSVRQcjs.isLayerEffectKind.call(void 0, kind)) fail2(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkUOGKSVRQcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
4067
3365
  const layer = requireEffectLayer(layers, id, "add effects");
4068
3366
  const current = layerEffectsOf(layer);
4069
3367
  const ids = new Set(current.items.map((e) => e.id));
4070
- let effectId = _chunkHGTDMKNEcjs.newEffectId.call(void 0, );
4071
- while (ids.has(effectId)) effectId = _chunkHGTDMKNEcjs.newEffectId.call(void 0, );
3368
+ let effectId = _chunkUOGKSVRQcjs.newEffectId.call(void 0, );
3369
+ while (ids.has(effectId)) effectId = _chunkUOGKSVRQcjs.newEffectId.call(void 0, );
4072
3370
  const { id: _ignored, kind: _kind, ...rest } = params;
4073
- const effect = guard(() => _chunkHGTDMKNEcjs.mergeLayerEffect.call(void 0, _chunkHGTDMKNEcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
3371
+ const effect = guard(() => _chunkUOGKSVRQcjs.mergeLayerEffect.call(void 0, _chunkUOGKSVRQcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
4074
3372
  const items = [...current.items];
4075
3373
  const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
4076
3374
  items.splice(at, 0, effect);
4077
3375
  return { layers: setLayerEffects(layers, id, { ...current, items }), effect };
4078
3376
  }
4079
3377
  function requireEffect(layer, effectId) {
4080
- const items = _nullishCoalesce(_optionalChain([layer, 'access', _63 => _63.effects, 'optionalAccess', _64 => _64.items]), () => ( []));
3378
+ const items = _nullishCoalesce(_optionalChain([layer, 'access', _59 => _59.effects, 'optionalAccess', _60 => _60.items]), () => ( []));
4081
3379
  const i = items.findIndex((e) => e.id === effectId);
4082
3380
  if (i === -1) fail2(`Layer "${layer.name || layer.id}" has no effect "${effectId}". Effects: ${items.map((e) => `${e.id} (${e.kind})`).join(", ") || "none"}; call list_layer_effects.`);
4083
3381
  return i;
@@ -4087,7 +3385,7 @@ function updateLayerEffect(layers, id, effectId, changes) {
4087
3385
  const i = requireEffect(layer, effectId);
4088
3386
  const current = layer.effects;
4089
3387
  const items = [...current.items];
4090
- items[i] = guard(() => _chunkHGTDMKNEcjs.mergeLayerEffect.call(void 0, items[i], changes));
3388
+ items[i] = guard(() => _chunkUOGKSVRQcjs.mergeLayerEffect.call(void 0, items[i], changes));
4091
3389
  return setLayerEffects(layers, id, { ...current, items });
4092
3390
  }
4093
3391
  function removeLayerEffect(layers, id, effectId) {
@@ -4110,7 +3408,7 @@ function setLayerEffectsEnabled(layers, id, enabled, scale) {
4110
3408
  function parseBlend(value, allowPassThrough = false) {
4111
3409
  if (value === void 0) return void 0;
4112
3410
  if (value === "pass-through" && allowPassThrough) return value;
4113
- if (!_chunkCWM3CUUXcjs.isBlendMode.call(void 0, value)) fail2(`Unknown blend mode "${String(value)}".`);
3411
+ if (!_chunkOLNIPTB3cjs.isBlendMode.call(void 0, value)) fail2(`Unknown blend mode "${String(value)}".`);
4114
3412
  return value;
4115
3413
  }
4116
3414
  function unionRect(a, b) {
@@ -4200,7 +3498,7 @@ function filterReach(filters) {
4200
3498
  var filterSpecCache = /* @__PURE__ */ new WeakMap();
4201
3499
  function pixelFilterSpec(layer) {
4202
3500
  const list2 = layer.filters;
4203
- if (!_optionalChain([list2, 'optionalAccess', _65 => _65.length])) return null;
3501
+ if (!_optionalChain([list2, 'optionalAccess', _61 => _61.length])) return null;
4204
3502
  if (filterSpecCache.has(list2)) return filterSpecCache.get(list2);
4205
3503
  const filters = list2.filter(isActiveFilter);
4206
3504
  let spec = null;
@@ -4221,7 +3519,7 @@ var PHOTO_PROFILE = {
4221
3519
  const views = layers.map(adjustmentNodeAsLayer);
4222
3520
  applyAdjustmentLayers({ data: acc }, views, masks);
4223
3521
  },
4224
- contentTile: (l, r, sources) => l.type === "annotation" ? _nullishCoalesce(_optionalChain([sources, 'access', _66 => _66.rasterizeAnnotation, 'optionalCall', _67 => _67(l.annotation, r)]), () => ( null)) : null,
3522
+ contentTile: (l, r, sources) => l.type === "annotation" ? _nullishCoalesce(_optionalChain([sources, 'access', _62 => _62.rasterizeAnnotation, 'optionalCall', _63 => _63(l.annotation, r)]), () => ( null)) : null,
4225
3523
  /** Annotation layers draw with their annotation's blend mode unless the layer sets one. */
4226
3524
  contentBlend: (l) => l.type === "annotation" && l.blend === "normal" && l.annotation.blend ? l.annotation.blend : l.blend,
4227
3525
  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,
@@ -4233,14 +3531,14 @@ var PHOTO_PROFILE = {
4233
3531
  isPixelLike: (l) => l.type === "smart" || l.type === "shape" || l.type === "type",
4234
3532
  maskSourcePlane: (source, W, H, sources) => {
4235
3533
  const opts = source;
4236
- const depth = _nullishCoalesce(_optionalChain([sources, 'access', _68 => _68.depthMap, 'optionalCall', _69 => _69(opts)]), () => ( null));
3534
+ const depth = _nullishCoalesce(_optionalChain([sources, 'access', _64 => _64.depthMap, 'optionalCall', _65 => _65(opts)]), () => ( null));
4237
3535
  if (!depth || depth.width !== W || depth.height !== H) return null;
4238
3536
  const v = new Float32Array(W * H);
4239
3537
  for (let i = 0; i < v.length; i++) v[i] = depthMaskAlpha(depth.data[i * 4], opts) / 255;
4240
3538
  return v;
4241
3539
  }
4242
3540
  };
4243
- var LayerCompositor = class extends _chunkHGTDMKNEcjs.RasterCompositor {
3541
+ var LayerCompositor = class extends _chunkUOGKSVRQcjs.RasterCompositor {
4244
3542
  constructor(options = {}) {
4245
3543
  super(PHOTO_PROFILE, options);
4246
3544
  }
@@ -4256,7 +3554,7 @@ var LayerCompositor = class extends _chunkHGTDMKNEcjs.RasterCompositor {
4256
3554
  }
4257
3555
  };
4258
3556
  function compositeDeep(layers, rect, sources, depth) {
4259
- const deep = new (0, _chunkHGTDMKNEcjs.DeepCompositor)(new LayerCompositor(), PHOTO_PROFILE, {
3557
+ const deep = new (0, _chunkUOGKSVRQcjs.DeepCompositor)(new LayerCompositor(), PHOTO_PROFILE, {
4260
3558
  applyFilterRunDeep: (run, acc, _r, masks) => applyAdjustmentLayersFloat(acc, run.map(adjustmentNodeAsLayer), masks),
4261
3559
  pixelFiltersDeep: (l) => {
4262
3560
  if (l.type !== "pixel") return null;
@@ -4272,9 +3570,9 @@ function compositeDeep(layers, rect, sources, depth) {
4272
3570
  var fail3 = (message) => {
4273
3571
  throw new LayerOperationError(message);
4274
3572
  };
4275
- var TEXT_RENDER_MARGIN = _chunkHGTDMKNEcjs.MAX_EFFECT_REACH;
3573
+ var TEXT_RENDER_MARGIN = _chunkUOGKSVRQcjs.MAX_EFFECT_REACH;
4276
3574
  function textMatrix(layer) {
4277
- return _nullishCoalesce(layer.transform, () => ( _chunkBRKVNXDZcjs.IDENTITY_MATRIX));
3575
+ return _nullishCoalesce(layer.transform, () => ( _chunkQAUIZPYIcjs.IDENTITY_MATRIX));
4278
3576
  }
4279
3577
  function rectCorners(r) {
4280
3578
  return [
@@ -4285,7 +3583,7 @@ function rectCorners(r) {
4285
3583
  ];
4286
3584
  }
4287
3585
  function docRect(r, m) {
4288
- const pts = rectCorners(r).map((p) => _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, p));
3586
+ const pts = rectCorners(r).map((p) => _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, p));
4289
3587
  const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
4290
3588
  const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
4291
3589
  const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
@@ -4305,7 +3603,7 @@ function inkBounds(layout) {
4305
3603
  for (const f of l.fragments) {
4306
3604
  const pad = f.style.fontSize * (l.matrix ? 1 : 0.5);
4307
3605
  const w = f.carets[f.carets.length - 1];
4308
- const r = _chunkBRKVNXDZcjs.transformTextRect.call(void 0, l.matrix, { x: f.x - pad, y: l.baseline - l.ascent - pad + Math.min(0, f.y - l.baseline), width: w + 2 * pad, height: l.ascent + l.descent + 2 * pad + Math.abs(f.y - l.baseline) });
3606
+ const r = _chunkQAUIZPYIcjs.transformTextRect.call(void 0, l.matrix, { x: f.x - pad, y: l.baseline - l.ascent - pad + Math.min(0, f.y - l.baseline), width: w + 2 * pad, height: l.ascent + l.descent + 2 * pad + Math.abs(f.y - l.baseline) });
4309
3607
  if (!b) b = r;
4310
3608
  else {
4311
3609
  const x0 = Math.min(b.x, r.x);
@@ -4318,29 +3616,29 @@ function inkBounds(layout) {
4318
3616
  }
4319
3617
  function textOutlines(layer, shaper) {
4320
3618
  if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
4321
- const layout = _chunkBRKVNXDZcjs.layoutText.call(void 0, layer, shaper);
3619
+ const layout = _chunkQAUIZPYIcjs.layoutText.call(void 0, layer, shaper);
4322
3620
  const m = textMatrix(layer);
4323
3621
  const out = [];
4324
3622
  for (const l of layout.lines) {
4325
3623
  for (const f of l.fragments) {
4326
- let path = _chunkBRKVNXDZcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
4327
- for (const r of _chunkBRKVNXDZcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkBRKVNXDZcjs.textRectPath.call(void 0, r)];
4328
- out.push({ fragment: f, path: _chunkBRKVNXDZcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
3624
+ let path = _chunkQAUIZPYIcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
3625
+ for (const r of _chunkQAUIZPYIcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkQAUIZPYIcjs.textRectPath.call(void 0, r)];
3626
+ out.push({ fragment: f, path: _chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
4329
3627
  }
4330
3628
  }
4331
3629
  return out;
4332
3630
  }
4333
3631
  var rgbOf = (hex) => {
4334
3632
  const c = _chunkA2IS7EHEcjs.parseCssColor.call(void 0, hex);
4335
- const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _70 => _70.hex]), () => ( "#000000"))).slice(1);
3633
+ const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _66 => _66.hex]), () => ( "#000000"))).slice(1);
4336
3634
  return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
4337
3635
  };
4338
3636
  function renderOutlines(layer, shaper, region) {
4339
3637
  const parts = textOutlines(layer, shaper).map(({ fragment, path }) => ({ style: fragment.style, flat: flattenPath(path) }));
4340
3638
  const tiles = /* @__PURE__ */ new Map();
4341
- for (const { tx, ty } of _chunkCWM3CUUXcjs.tilesInRect.call(void 0, region)) {
4342
- const rect = { x: tx * _chunkCWM3CUUXcjs.TILE, y: ty * _chunkCWM3CUUXcjs.TILE, width: _chunkCWM3CUUXcjs.TILE, height: _chunkCWM3CUUXcjs.TILE };
4343
- const n = _chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE;
3639
+ for (const { tx, ty } of _chunk474IQG74cjs.tilesInRect.call(void 0, region)) {
3640
+ const rect = { x: tx * _chunk474IQG74cjs.TILE, y: ty * _chunk474IQG74cjs.TILE, width: _chunk474IQG74cjs.TILE, height: _chunk474IQG74cjs.TILE };
3641
+ const n = _chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE;
4344
3642
  const acc = new Float32Array(n * 4);
4345
3643
  let any = false;
4346
3644
  for (const p of parts) {
@@ -4371,17 +3669,17 @@ function renderOutlines(layer, shaper, region) {
4371
3669
  px2[i + 2] = Math.round(acc[i + 2]);
4372
3670
  px2[i + 3] = a;
4373
3671
  }
4374
- const tile = _chunkCWM3CUUXcjs.finishTile.call(void 0, px2, 4, 0);
4375
- if (tile) tiles.set(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty), tile);
3672
+ const tile = _chunk474IQG74cjs.finishTile.call(void 0, px2, 4, 0);
3673
+ if (tile) tiles.set(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty), tile);
4376
3674
  }
4377
- return new (0, _chunkCWM3CUUXcjs.TiledSurface)(4, tiles, 0);
3675
+ return new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, 0);
4378
3676
  }
4379
3677
  function renderOnCanvas(layer, shaper, region, env) {
4380
3678
  if (!env.createCanvas) return null;
4381
3679
  const canvas = env.createCanvas(region.width, region.height);
4382
3680
  const ctx = canvas.getContext("2d");
4383
3681
  if (!ctx || typeof ctx.getImageData !== "function") return null;
4384
- const layout = _chunkBRKVNXDZcjs.layoutText.call(void 0, layer, shaper);
3682
+ const layout = _chunkQAUIZPYIcjs.layoutText.call(void 0, layer, shaper);
4385
3683
  const m = textMatrix(layer);
4386
3684
  ctx.setTransform(1, 0, 0, 1, 0, 0);
4387
3685
  ctx.clearRect(0, 0, region.width, region.height);
@@ -4391,23 +3689,23 @@ function renderOnCanvas(layer, shaper, region, env) {
4391
3689
  const [r, g, b] = rgbOf(f.style.color);
4392
3690
  ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
4393
3691
  ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
4394
- _chunkBRKVNXDZcjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
4395
- for (const d of _chunkBRKVNXDZcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
3692
+ _chunkQAUIZPYIcjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
3693
+ for (const d of _chunkQAUIZPYIcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
4396
3694
  }
4397
3695
  }
4398
3696
  ctx.globalAlpha = 1;
4399
3697
  ctx.setTransform(1, 0, 0, 1, 0, 0);
4400
3698
  const data = ctx.getImageData(0, 0, region.width, region.height).data;
4401
- return _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width: region.width, height: region.height, data: new Uint8ClampedArray(data) }, 4, region.x, region.y);
3699
+ return _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width: region.width, height: region.height, data: new Uint8ClampedArray(data) }, 4, region.x, region.y);
4402
3700
  }
4403
3701
  function renderText(layer, env) {
4404
3702
  const shaper = env.shaper;
4405
3703
  if (!shaper || !shaper.outline && !shaper.draw) return null;
4406
- const layout = _chunkBRKVNXDZcjs.layoutText.call(void 0, layer, shaper);
3704
+ const layout = _chunkQAUIZPYIcjs.layoutText.call(void 0, layer, shaper);
4407
3705
  const ink = inkBounds(layout);
4408
3706
  const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
4409
3707
  const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
4410
- if (!region) return { surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4), missingFonts: layout.missingFonts };
3708
+ if (!region) return { surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4), missingFonts: layout.missingFonts };
4411
3709
  if (shaper.outline) return { surface: renderOutlines(layer, shaper, region), missingFonts: layout.missingFonts };
4412
3710
  const surface = renderOnCanvas(layer, shaper, region, env);
4413
3711
  return surface ? { surface, missingFonts: layout.missingFonts } : null;
@@ -4504,7 +3802,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
4504
3802
  continue;
4505
3803
  }
4506
3804
  const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
4507
- if (k === "autoLeading" && value === _chunkBRKVNXDZcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
3805
+ if (k === "autoLeading" && value === _chunkQAUIZPYIcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
4508
3806
  else o[k] = value;
4509
3807
  } else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
4510
3808
  }
@@ -4545,15 +3843,15 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
4545
3843
  opacity: 1,
4546
3844
  blend: "normal",
4547
3845
  text: text3,
4548
- runs: _chunkBRKVNXDZcjs.fitRuns.call(void 0, init.runs, text3.length, _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE),
4549
- paragraphs: _chunkBRKVNXDZcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
3846
+ runs: _chunkQAUIZPYIcjs.fitRuns.call(void 0, init.runs, text3.length, _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE),
3847
+ paragraphs: _chunkQAUIZPYIcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
4550
3848
  frame: init.frame,
4551
3849
  ...init.orientation === "vertical" ? { orientation: "vertical" } : {},
4552
- surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
3850
+ surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
4553
3851
  offset: { x: 0, y: 0 }
4554
3852
  };
4555
- if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _71 => _71.runs, 'access', _72 => _72[0], 'optionalAccess', _73 => _73.style]), () => ( _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE)) }];
4556
- if (init.transform && !_chunkBRKVNXDZcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
3853
+ if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _67 => _67.runs, 'access', _68 => _68[0], 'optionalAccess', _69 => _69.style]), () => ( _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)) }];
3854
+ if (init.transform && !_chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
4557
3855
  if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
4558
3856
  return rerenderText(layer, env);
4559
3857
  }
@@ -4564,24 +3862,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
4564
3862
  const next = { ...current, ...patch };
4565
3863
  if (!("annotation" in patch)) delete next.annotation;
4566
3864
  if (next.orientation !== "vertical") delete next.orientation;
4567
- if ("text" in patch || "runs" in patch) next.runs = _chunkBRKVNXDZcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _74 => _74.runs, 'access', _75 => _75[0], 'optionalAccess', _76 => _76.style]), () => ( _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE)));
4568
- if (!next.runs.length) next.runs = [{ length: 0, style: _chunkBRKVNXDZcjs.styleAt.call(void 0, current.runs, 0, _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE) }];
4569
- if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkBRKVNXDZcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
3865
+ if ("text" in patch || "runs" in patch) next.runs = _chunkQAUIZPYIcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _70 => _70.runs, 'access', _71 => _71[0], 'optionalAccess', _72 => _72.style]), () => ( _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)));
3866
+ if (!next.runs.length) next.runs = [{ length: 0, style: _chunkQAUIZPYIcjs.styleAt.call(void 0, current.runs, 0, _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE) }];
3867
+ if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkQAUIZPYIcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
4570
3868
  const rendered = rerenderText(next, env);
4571
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
3869
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
4572
3870
  }
4573
3871
  function replaceTextRange(layer, start, end, insert) {
4574
3872
  const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
4575
- const style = _chunkBRKVNXDZcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE);
4576
- const runs = _chunkBRKVNXDZcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
4577
- const pstyle = _chunkBRKVNXDZcjs.styleAt.call(void 0, layer.paragraphs, start, {});
4578
- const paragraphs = _chunkBRKVNXDZcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
4579
- return { text: text3, runs, paragraphs: _chunkBRKVNXDZcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
3873
+ const style = _chunkQAUIZPYIcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE);
3874
+ const runs = _chunkQAUIZPYIcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
3875
+ const pstyle = _chunkQAUIZPYIcjs.styleAt.call(void 0, layer.paragraphs, start, {});
3876
+ const paragraphs = _chunkQAUIZPYIcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
3877
+ return { text: text3, runs, paragraphs: _chunkQAUIZPYIcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
4580
3878
  }
4581
3879
  function transformTypeLayer(layer, m) {
4582
- const t = _chunkBRKVNXDZcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
3880
+ const t = _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
4583
3881
  const next = { ...layer };
4584
- if (_chunkBRKVNXDZcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
3882
+ if (_chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
4585
3883
  else next.transform = t;
4586
3884
  delete next.annotation;
4587
3885
  return next;
@@ -4589,7 +3887,7 @@ function transformTypeLayer(layer, m) {
4589
3887
  function typeFrame(layer, shaper) {
4590
3888
  if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
4591
3889
  if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
4592
- const b = _chunkBRKVNXDZcjs.layoutText.call(void 0, layer, shaper).bounds;
3890
+ const b = _chunkQAUIZPYIcjs.layoutText.call(void 0, layer, shaper).bounds;
4593
3891
  return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
4594
3892
  }
4595
3893
  function typeAsPixelLayer(layer) {
@@ -4597,7 +3895,7 @@ function typeAsPixelLayer(layer) {
4597
3895
  return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
4598
3896
  }
4599
3897
  function toTextSpace(layer, p) {
4600
- return _chunkBRKVNXDZcjs.applyMatrix.call(void 0, _chunkBRKVNXDZcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
3898
+ return _chunkQAUIZPYIcjs.applyMatrix.call(void 0, _chunkQAUIZPYIcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
4601
3899
  }
4602
3900
  function typeFromAnnotation(a) {
4603
3901
  if (a.type !== "text") return null;
@@ -4611,7 +3909,7 @@ function typeFromAnnotation(a) {
4611
3909
  if (op !== 1) style.opacity = op;
4612
3910
  const text3 = t.text.replace(/\r?\n|\r/g, " ");
4613
3911
  const translate = [1, 0, 0, 1, t.x, t.y];
4614
- const transform = t.rotation ? _chunkBRKVNXDZcjs.multiplyMatrices.call(void 0, translate, _chunkBRKVNXDZcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
3912
+ const transform = t.rotation ? _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, translate, _chunkQAUIZPYIcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
4615
3913
  return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
4616
3914
  }
4617
3915
  function annotationOfType(layer) {
@@ -4659,8 +3957,8 @@ var legacyMaskMemo = /* @__PURE__ */ new WeakMap();
4659
3957
  function rasterMaskFromLegacy(mask, width, height) {
4660
3958
  const sel = decodeLayerMask(mask);
4661
3959
  if (!sel) return null;
4662
- const sized = sel.width === width && sel.height === height ? sel : resizeSelection(sel, width, height);
4663
- const surface = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width, height, data: sized.data }, 1, 0, 0, 0);
3960
+ const sized = sel.width === width && sel.height === height ? sel : _chunkQYLWG22Ncjs.resizeSelection.call(void 0, sel, width, height);
3961
+ const surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width, height, data: sized.data }, 1, 0, 0, 0);
4664
3962
  legacyMaskMemo.set(surface, { width: mask.width, height: mask.height, rle: mask.rle });
4665
3963
  const out = { surface, defaultValue: 0 };
4666
3964
  if (mask.density !== void 0 && mask.density !== 1) out.density = mask.density;
@@ -4679,8 +3977,8 @@ function hasResampledLegacyMask(layers, width, height) {
4679
3977
  function legacyMaskOf(mask, width, height) {
4680
3978
  let memo = legacyMaskMemo.get(mask.surface);
4681
3979
  if (!memo) {
4682
- const data = _chunkCWM3CUUXcjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width, height });
4683
- memo = { width, height, rle: encodeSelectionRle(new Uint8Array(data.buffer, data.byteOffset, data.length)) };
3980
+ const data = _chunk474IQG74cjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width, height });
3981
+ memo = { width, height, rle: _chunkQYLWG22Ncjs.encodeSelectionRle.call(void 0, new Uint8Array(data.buffer, data.byteOffset, data.length)) };
4684
3982
  legacyMaskMemo.set(mask.surface, memo);
4685
3983
  }
4686
3984
  return normalizeLayerMask({ ...memo, density: mask.density, feather: mask.feather, enabled: mask.enabled });
@@ -4781,7 +4079,7 @@ function backgroundLayer(filters = [], mask) {
4781
4079
  visible: true,
4782
4080
  opacity: 1,
4783
4081
  blend: "normal",
4784
- surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
4082
+ surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
4785
4083
  offset: { x: 0, y: 0 },
4786
4084
  source: "document",
4787
4085
  filters
@@ -4791,7 +4089,7 @@ function backgroundLayer(filters = [], mask) {
4791
4089
  }
4792
4090
  function depthRasterMask(source) {
4793
4091
  const out = {
4794
- surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 1, 255),
4092
+ surface: _chunk474IQG74cjs.emptySurface.call(void 0, 1, 255),
4795
4093
  defaultValue: 255,
4796
4094
  source: { ...source, depthRange: [...source.depthRange] }
4797
4095
  };
@@ -4851,7 +4149,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
4851
4149
  const { layers } = stack;
4852
4150
  const target = developTarget(layers, activeLayerId);
4853
4151
  const develop = target ? developFilter(target) : void 0;
4854
- const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call', _77 => _77(target), 'optionalAccess', _78 => _78.radius]) : void 0))), () => ( 0));
4152
+ const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call', _73 => _73(target), 'optionalAccess', _74 => _74.radius]) : void 0))), () => ( 0));
4855
4153
  const adjustments = {
4856
4154
  ...DEFAULT_ADJUSTMENTS_VALUES,
4857
4155
  ...develop ? {
@@ -4880,7 +4178,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
4880
4178
  };
4881
4179
  walk(layers);
4882
4180
  if (adjNodes.length) adjustments.layers = adjNodes.map((n) => legacyAdjustmentLayer(n, width, height));
4883
- const depthSource = _optionalChain([target, 'optionalAccess', _79 => _79.mask, 'optionalAccess', _80 => _80.source]);
4181
+ const depthSource = _optionalChain([target, 'optionalAccess', _75 => _75.mask, 'optionalAccess', _76 => _76.source]);
4884
4182
  const depthMask = depthSource ? { ...depthSource, depthRange: [...depthSource.depthRange] } : { ...DEFAULT_DEPTH_MASK_VALUES, depthRange: [...DEFAULT_DEPTH_MASK_VALUES.depthRange] };
4885
4183
  return { adjustments, depthMask, annotations, exact: isLegacyShape(stack) };
4886
4184
  }
@@ -4905,7 +4203,7 @@ function isLegacyShape(stack) {
4905
4203
  let adjustments = 0;
4906
4204
  for (; i < layers.length && layers[i].type === "adjustment"; i++) {
4907
4205
  const l = layers[i];
4908
- if (l.clipped || l.locks || _optionalChain([l, 'access', _81 => _81.mask, 'optionalAccess', _82 => _82.source]) || l.effects) return false;
4206
+ if (l.clipped || l.locks || _optionalChain([l, 'access', _77 => _77.mask, 'optionalAccess', _78 => _78.source]) || l.effects) return false;
4909
4207
  adjustments++;
4910
4208
  }
4911
4209
  for (; i < layers.length; i++) {
@@ -4945,7 +4243,7 @@ function identityTransform(box2) {
4945
4243
  }
4946
4244
  function cornersFromMatrix(box2, m) {
4947
4245
  const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
4948
- return [_chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, q2[0]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, q2[1]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, q2[2]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, q2[3])];
4246
+ return [_chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, q2[0]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, q2[1]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, q2[2]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, q2[3])];
4949
4247
  }
4950
4248
  function matrixFromCorners(box2, corners, eps = 1e-6) {
4951
4249
  const [tl, tr, br, bl] = corners;
@@ -4962,7 +4260,7 @@ function transformHomography(geometry) {
4962
4260
  function hasWarp(geometry) {
4963
4261
  const w = geometry.warp;
4964
4262
  if (!w) return false;
4965
- const id = _chunkBRKVNXDZcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
4263
+ const id = _chunkQAUIZPYIcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
4966
4264
  if (id.points.length !== w.points.length || id.us.some((u, i) => Math.abs(u - w.us[i]) > 1e-12) || id.vs.some((v, i) => Math.abs(v - w.vs[i]) > 1e-12)) return true;
4967
4265
  return w.points.some((p, i) => Math.abs(p.x - id.points[i].x) > 1e-6 || Math.abs(p.y - id.points[i].y) > 1e-6);
4968
4266
  }
@@ -4977,7 +4275,7 @@ function transformMap(geometry) {
4977
4275
  const { box: box2 } = geometry;
4978
4276
  const warp = hasWarp(geometry) ? geometry.warp : null;
4979
4277
  if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
4980
- return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkBRKVNXDZcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
4278
+ return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkQAUIZPYIcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
4981
4279
  }
4982
4280
  function transformedPoint(geometry, fx, fy) {
4983
4281
  const f = transformMap(geometry);
@@ -5021,8 +4319,8 @@ function matrixFromParams(box2, params) {
5021
4319
  const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
5022
4320
  const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
5023
4321
  const ref = referencePoint(box2, params.reference);
5024
- const linear = _chunkBRKVNXDZcjs.multiplyMatrices.call(void 0, _chunkBRKVNXDZcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkBRKVNXDZcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
5025
- return _chunkBRKVNXDZcjs.multiplyMatrices.call(void 0, _chunkBRKVNXDZcjs.matrixAbout.call(void 0, linear, ref), _chunkBRKVNXDZcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
4322
+ const linear = _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkQAUIZPYIcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
4323
+ return _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.matrixAbout.call(void 0, linear, ref), _chunkQAUIZPYIcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
5026
4324
  }
5027
4325
  function describeTransform(geometry, reference = "center") {
5028
4326
  const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
@@ -5039,7 +4337,7 @@ function describeTransform(geometry, reference = "center") {
5039
4337
  const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
5040
4338
  const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
5041
4339
  const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
5042
- const at = _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, ref);
4340
+ const at = _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, ref);
5043
4341
  const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
5044
4342
  return {
5045
4343
  affine: true,
@@ -5057,24 +4355,24 @@ function applyParams(geometry, params) {
5057
4355
  const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
5058
4356
  const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
5059
4357
  const c = geometry.corners;
5060
- return [_chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, c[0]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, c[1]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, c[2]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, c[3])];
4358
+ return [_chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, c[0]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, c[1]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, c[2]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, c[3])];
5061
4359
  }
5062
4360
  function flipCorners(geometry, axis) {
5063
4361
  const c = anchorPoint(geometry, "center");
5064
4362
  const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
5065
4363
  const q2 = geometry.corners;
5066
- return [_chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, q2[0]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, q2[1]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, q2[2]), _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, q2[3])];
4364
+ return [_chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, q2[0]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, q2[1]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, q2[2]), _chunkQAUIZPYIcjs.applyMatrix.call(void 0, m, q2[3])];
5067
4365
  }
5068
4366
  function boxPointOf(geometry, p) {
5069
4367
  const m = matrixFromCorners(geometry.box, geometry.corners);
5070
- if (m) return _chunkBRKVNXDZcjs.applyMatrix.call(void 0, _chunkBRKVNXDZcjs.invertMatrix.call(void 0, m), p);
4368
+ if (m) return _chunkQAUIZPYIcjs.applyMatrix.call(void 0, _chunkQAUIZPYIcjs.invertMatrix.call(void 0, m), p);
5071
4369
  return null;
5072
4370
  }
5073
4371
  function presetWarp(box2, preset) {
5074
- return _chunkBRKVNXDZcjs.warpPresetMesh.call(void 0, preset, box2);
4372
+ return _chunkQAUIZPYIcjs.warpPresetMesh.call(void 0, preset, box2);
5075
4373
  }
5076
4374
  function isValidWarp(mesh) {
5077
- return _chunkBRKVNXDZcjs.isValidWarpMesh.call(void 0, mesh);
4375
+ return _chunkQAUIZPYIcjs.isValidWarpMesh.call(void 0, mesh);
5078
4376
  }
5079
4377
  function geometryHomography(geometry) {
5080
4378
  const m = matrixFromCorners(geometry.box, geometry.corners);
@@ -5085,7 +4383,7 @@ function geometryHomography(geometry) {
5085
4383
  var fail4 = (message) => {
5086
4384
  throw new LayerOperationError(message);
5087
4385
  };
5088
- var SMART_RENDER_MARGIN = _chunkHGTDMKNEcjs.MAX_EFFECT_REACH;
4386
+ var SMART_RENDER_MARGIN = _chunkUOGKSVRQcjs.MAX_EFFECT_REACH;
5089
4387
  var incompleteSurfaces = /* @__PURE__ */ new WeakSet();
5090
4388
  var isSmartSurfaceIncomplete = (surface) => incompleteSurfaces.has(surface);
5091
4389
  var surfaceIds = /* @__PURE__ */ new WeakMap();
@@ -5112,7 +4410,7 @@ function isContentsDecoded(contents) {
5112
4410
  }
5113
4411
  function requireDecoded(layer, action) {
5114
4412
  if (isContentsDecoded(layer.contents)) return;
5115
- const what = _optionalChain([layer, 'access', _83 => _83.contents, 'access', _84 => _84.file, 'optionalAccess', _85 => _85.type]) ? `a ${layer.contents.file.type.toUpperCase()} file` : "a file";
4413
+ 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";
5116
4414
  fail4(
5117
4415
  `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.`
5118
4416
  );
@@ -5127,26 +4425,26 @@ function contentsSurface(contents) {
5127
4425
  let s = contentsPixels.get(contents);
5128
4426
  if (s) return s;
5129
4427
  if (contents.kind === "raster") {
5130
- s = _nullishCoalesce(contents.raster, () => ( _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4)));
4428
+ s = _nullishCoalesce(contents.raster, () => ( _chunk474IQG74cjs.emptySurface.call(void 0, 4)));
5131
4429
  } else {
5132
4430
  const doc = contents.document;
5133
- if (!doc) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4);
4431
+ if (!doc) return _chunk474IQG74cjs.emptySurface.call(void 0, 4);
5134
4432
  const W = contents.width;
5135
4433
  const H = contents.height;
5136
4434
  const data = new LayerCompositor().composite(doc.layers, { x: 0, y: 0, width: W, height: H }, {
5137
4435
  width: W,
5138
4436
  height: H,
5139
4437
  globalLight: doc.globalLight,
5140
- pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _86 => _86.patterns, 'optionalAccess', _87 => _87.find, 'call', _88 => _88((p) => p.id === id)]), () => ( null))
4438
+ pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _82 => _82.patterns, 'optionalAccess', _83 => _83.find, 'call', _84 => _84((p) => p.id === id)]), () => ( null))
5141
4439
  });
5142
- s = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width: W, height: H, data }, 4, 0, 0);
4440
+ s = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width: W, height: H, data }, 4, 0, 0);
5143
4441
  }
5144
4442
  contentsPixels.set(contents, s);
5145
4443
  return s;
5146
4444
  }
5147
4445
  function rasterContents(pixels, name, id = newContentsId()) {
5148
4446
  if (!(pixels.width > 0 && pixels.height > 0) || pixels.data.length < pixels.width * pixels.height * 4) fail4("Contents pixels must be RGBA with width \xD7 height \xD7 4 bytes.");
5149
- return { id, name, width: pixels.width, height: pixels.height, kind: "raster", raster: _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, pixels, 4, 0, 0) };
4447
+ return { id, name, width: pixels.width, height: pixels.height, kind: "raster", raster: _chunk474IQG74cjs.surfaceFromPixels.call(void 0, pixels, 4, 0, 0) };
5150
4448
  }
5151
4449
  function documentContents(document, width, height, name, id = newContentsId()) {
5152
4450
  if (!(Number.isInteger(width) && Number.isInteger(height) && width > 0 && height > 0)) fail4("Contents width and height must be positive whole numbers.");
@@ -5172,7 +4470,7 @@ function placeContents(layer, canvas, options = {}) {
5172
4470
  const preview = Boolean(options.step && options.step > 1) || Boolean(options.clip);
5173
4471
  const key = placementKey(placement, canvas);
5174
4472
  if (!preview) {
5175
- const hit = _optionalChain([placedCache, 'access', _89 => _89.get, 'call', _90 => _90(contents), 'optionalAccess', _91 => _91.get, 'call', _92 => _92(key)]);
4473
+ const hit = _optionalChain([placedCache, 'access', _85 => _85.get, 'call', _86 => _86(contents), 'optionalAccess', _87 => _87.get, 'call', _88 => _88(key)]);
5176
4474
  if (hit) return hit;
5177
4475
  }
5178
4476
  const src = contentsSurface(contents);
@@ -5190,7 +4488,7 @@ function placeContents(layer, canvas, options = {}) {
5190
4488
  let out;
5191
4489
  const move = integerMove(layer);
5192
4490
  if (move && !options.clip) {
5193
- out = _chunkCWM3CUUXcjs.translateSurface.call(void 0, src, move.x, move.y);
4491
+ out = _chunk474IQG74cjs.translateSurface.call(void 0, src, move.x, move.y);
5194
4492
  } else {
5195
4493
  const g = placementGeometry(layer);
5196
4494
  const interpolation = preview ? placement.interpolation === "nearest" ? "nearest" : "bilinear" : _nullishCoalesce(placement.interpolation, () => ( "bicubic"));
@@ -5199,10 +4497,10 @@ function placeContents(layer, canvas, options = {}) {
5199
4497
  let k = 1;
5200
4498
  if (step > 1) {
5201
4499
  k = step;
5202
- let r = _optionalChain([options, 'access', _93 => _93.reduced, 'optionalAccess', _94 => _94.get, 'call', _95 => _95(k)]);
4500
+ let r = _optionalChain([options, 'access', _89 => _89.reduced, 'optionalAccess', _90 => _90.get, 'call', _91 => _91(k)]);
5203
4501
  if (!r) {
5204
- r = _chunkHGTDMKNEcjs.reduceSurface.call(void 0, src, k);
5205
- _optionalChain([options, 'access', _96 => _96.reduced, 'optionalAccess', _97 => _97.set, 'call', _98 => _98(k, r)]);
4502
+ r = _chunkUOGKSVRQcjs.reduceSurface.call(void 0, src, k);
4503
+ _optionalChain([options, 'access', _92 => _92.reduced, 'optionalAccess', _93 => _93.set, 'call', _94 => _94(k, r)]);
5206
4504
  }
5207
4505
  source = r;
5208
4506
  }
@@ -5211,15 +4509,15 @@ function placeContents(layer, canvas, options = {}) {
5211
4509
  if (hasWarp(g)) {
5212
4510
  const f = transformMap(g);
5213
4511
  if (!f) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
5214
- out = _chunkHGTDMKNEcjs.warpSurface.call(void 0, source, (p) => f({ x: p.x * k, y: p.y * k }), { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
4512
+ out = _chunkUOGKSVRQcjs.warpSurface.call(void 0, source, (p) => f({ x: p.x * k, y: p.y * k }), { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
5215
4513
  } else {
5216
4514
  const h = transformHomography(g);
5217
4515
  if (!h) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
5218
4516
  const hk = _chunkQT26RHKKcjs.multiplyHomographies.call(void 0, [k, 0, 0, 0, k, 0, 0, 0, 1], h);
5219
- out = _chunkHGTDMKNEcjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
4517
+ out = _chunkUOGKSVRQcjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
5220
4518
  }
5221
4519
  } catch (e) {
5222
- if (e instanceof _chunkHGTDMKNEcjs.TransformTooLargeError) fail4(e.message);
4520
+ if (e instanceof _chunkUOGKSVRQcjs.TransformTooLargeError) fail4(e.message);
5223
4521
  throw e;
5224
4522
  }
5225
4523
  }
@@ -5235,22 +4533,22 @@ function placeContents(layer, canvas, options = {}) {
5235
4533
  return out;
5236
4534
  }
5237
4535
  function activeSmartFilters(stack) {
5238
- if (!_optionalChain([stack, 'optionalAccess', _99 => _99.enabled])) return [];
4536
+ if (!_optionalChain([stack, 'optionalAccess', _95 => _95.enabled])) return [];
5239
4537
  return stack.filters.filter((f) => f.kind !== "psd" && f.kind !== "effect" && isActiveFilter(f) && f.opacity > 0);
5240
4538
  }
5241
4539
  function activeEffectSmartFilters(stack) {
5242
- if (!_optionalChain([stack, 'optionalAccess', _100 => _100.enabled])) return [];
4540
+ if (!_optionalChain([stack, 'optionalAccess', _96 => _96.enabled])) return [];
5243
4541
  return stack.filters.filter((f) => f.kind === "effect" && f.enabled && f.opacity > 0);
5244
4542
  }
5245
4543
  function runnableSmartFilters(stack) {
5246
- if (!_optionalChain([stack, 'optionalAccess', _101 => _101.enabled])) return [];
4544
+ if (!_optionalChain([stack, 'optionalAccess', _97 => _97.enabled])) return [];
5247
4545
  return stack.filters.filter((f) => f.opacity > 0 && (f.kind === "effect" ? f.enabled : f.kind !== "psd" && isActiveFilter(f)));
5248
4546
  }
5249
4547
  function filterMaskCoverage(mask, canvas) {
5250
4548
  if (!mask || mask.enabled === false || mask.source) return null;
5251
4549
  const W = canvas.width;
5252
4550
  const H = canvas.height;
5253
- const bytes = _chunkCWM3CUUXcjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width: W, height: H });
4551
+ const bytes = _chunk474IQG74cjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width: W, height: H });
5254
4552
  let v = new Float32Array(W * H);
5255
4553
  let all = true;
5256
4554
  for (let i = 0; i < v.length; i++) {
@@ -5259,7 +4557,7 @@ function filterMaskCoverage(mask, canvas) {
5259
4557
  }
5260
4558
  const feather = _nullishCoalesce(mask.feather, () => ( 0));
5261
4559
  if (all && !(feather > 0)) return null;
5262
- if (feather > 0) v = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, v, W, H, feather, "clamp");
4560
+ if (feather > 0) v = _chunkK6PXS6DOcjs.gaussianBlur.call(void 0, v, W, H, feather, "clamp");
5263
4561
  const density = _nullishCoalesce(mask.density, () => ( 1));
5264
4562
  if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
5265
4563
  return v;
@@ -5269,21 +4567,21 @@ function applySmartFilters(placed, stack, canvas) {
5269
4567
  if (!active.length || !(canvas.width > 0 && canvas.height > 0)) return placed;
5270
4568
  const W = canvas.width;
5271
4569
  const H = canvas.height;
5272
- const token = active.some((f) => f.kind === "effect") ? _nullishCoalesce(_optionalChain([canvas, 'access', _102 => _102.effects, 'optionalAccess', _103 => _103.token]), () => ( -1)) : 0;
4570
+ const token = active.some((f) => f.kind === "effect") ? _nullishCoalesce(_optionalChain([canvas, 'access', _98 => _98.effects, 'optionalAccess', _99 => _99.token]), () => ( -1)) : 0;
5273
4571
  const key = JSON.stringify([W, H, token, active.map((f) => ({ ...f, id: void 0 }))]);
5274
4572
  let entry = filteredCache.get(placed);
5275
4573
  let incomplete = false;
5276
4574
  if (!entry || entry.key !== key) {
5277
- const base = _chunkCWM3CUUXcjs.readRegion.call(void 0, placed, { x: 0, y: 0, width: W, height: H });
4575
+ const base = _chunk474IQG74cjs.readRegion.call(void 0, placed, { x: 0, y: 0, width: W, height: H });
5278
4576
  let acc = new Uint8ClampedArray(base);
5279
4577
  for (const [i, f] of active.entries()) {
5280
4578
  let out2;
5281
4579
  if (f.kind === "effect") {
5282
4580
  if (incomplete) continue;
5283
4581
  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 }))]);
5284
- const r = _optionalChain([canvas, 'access', _104 => _104.effects, 'optionalAccess', _105 => _105.resolve, 'call', _106 => _106(f, acc, W, H, inputKey)]);
5285
- if (!_optionalChain([r, 'optionalAccess', _107 => _107.result])) {
5286
- if (_optionalChain([r, 'optionalAccess', _108 => _108.pending])) incomplete = true;
4582
+ const r = _optionalChain([canvas, 'access', _100 => _100.effects, 'optionalAccess', _101 => _101.resolve, 'call', _102 => _102(f, acc, W, H, inputKey)]);
4583
+ if (!_optionalChain([r, 'optionalAccess', _103 => _103.result])) {
4584
+ if (_optionalChain([r, 'optionalAccess', _104 => _104.pending])) incomplete = true;
5287
4585
  continue;
5288
4586
  }
5289
4587
  out2 = new Uint8ClampedArray(r.result);
@@ -5295,7 +4593,7 @@ function applySmartFilters(placed, stack, canvas) {
5295
4593
  if (f.opacity >= 1) acc = out2;
5296
4594
  else lerpInto(acc, out2, f.opacity, null);
5297
4595
  } else {
5298
- _chunkHGTDMKNEcjs.blendTile.call(void 0, acc, out2, f.blend, f.opacity, null);
4596
+ _chunkUOGKSVRQcjs.blendTile.call(void 0, acc, out2, f.blend, f.opacity, null);
5299
4597
  }
5300
4598
  }
5301
4599
  entry = { key, base, filtered: acc };
@@ -5307,7 +4605,7 @@ function applySmartFilters(placed, stack, canvas) {
5307
4605
  result = new Uint8ClampedArray(entry.base);
5308
4606
  lerpInto(result, entry.filtered, 1, cov);
5309
4607
  }
5310
- const out = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width: W, height: H, data: result }, 4, 0, 0);
4608
+ const out = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width: W, height: H, data: result }, 4, 0, 0);
5311
4609
  if (incomplete) incompleteSurfaces.add(out);
5312
4610
  return out;
5313
4611
  }
@@ -5334,17 +4632,17 @@ function rerender(layer, canvas, action = "change") {
5334
4632
  return { ...layer, surface: renderSmartObject(layer, canvas) };
5335
4633
  }
5336
4634
  function normalizePlacement(raw, contents) {
5337
- const c = _optionalChain([raw, 'optionalAccess', _109 => _109.corners]);
4635
+ const c = _optionalChain([raw, 'optionalAccess', _105 => _105.corners]);
5338
4636
  if (!Array.isArray(c) || c.length !== 4 || !c.every((p) => p && Number.isFinite(p.x) && Number.isFinite(p.y))) {
5339
4637
  fail4("corners must be four finite points [top-left, top-right, bottom-right, bottom-left] in document pixels.");
5340
4638
  }
5341
4639
  const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
5342
4640
  if (raw.warp) {
5343
- if (!_chunkBRKVNXDZcjs.isValidWarpMesh.call(void 0, raw.warp)) fail4("warp must be a mesh with us and vs (knots from 0 to 1, increasing) and (3\xB7columns + 1) \xD7 (3\xB7rows + 1) finite points in contents pixels.");
4641
+ if (!_chunkQAUIZPYIcjs.isValidWarpMesh.call(void 0, raw.warp)) fail4("warp must be a mesh with us and vs (knots from 0 to 1, increasing) and (3\xB7columns + 1) \xD7 (3\xB7rows + 1) finite points in contents pixels.");
5344
4642
  out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
5345
4643
  }
5346
4644
  if (raw.interpolation !== void 0) {
5347
- if (!_chunkHGTDMKNEcjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
4645
+ if (!_chunkUOGKSVRQcjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
5348
4646
  if (raw.interpolation !== "bicubic") out.interpolation = raw.interpolation;
5349
4647
  }
5350
4648
  const g = { box: { x: 0, y: 0, width: contents.width, height: contents.height }, corners: out.corners, warp: _nullishCoalesce(out.warp, () => ( null)) };
@@ -5364,7 +4662,7 @@ function followMask(mask, before, after) {
5364
4662
  const inv = _chunkQT26RHKKcjs.invertHomography.call(void 0, h0);
5365
4663
  if (!inv) return mask;
5366
4664
  const delta = _chunkQT26RHKKcjs.multiplyHomographies.call(void 0, inv, h1);
5367
- const surface = _chunkHGTDMKNEcjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
4665
+ const surface = _chunkUOGKSVRQcjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
5368
4666
  return { ...mask, surface };
5369
4667
  }
5370
4668
  function setSmartPlacement(layers, id, placement, canvas) {
@@ -5379,13 +4677,13 @@ function setSmartPlacement(layers, id, placement, canvas) {
5379
4677
  masksMoved ||= m !== layer.mask;
5380
4678
  next.mask = m;
5381
4679
  }
5382
- if (_optionalChain([next, 'access', _110 => _110.smartFilters, 'optionalAccess', _111 => _111.mask])) {
4680
+ if (_optionalChain([next, 'access', _106 => _106.smartFilters, 'optionalAccess', _107 => _107.mask])) {
5383
4681
  const m = followMask(next.smartFilters.mask, layer, next);
5384
4682
  masksMoved ||= m !== next.smartFilters.mask;
5385
4683
  next.smartFilters = { ...next.smartFilters, mask: m };
5386
4684
  }
5387
4685
  next = rerender(next, canvas, "be transformed");
5388
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
4686
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
5389
4687
  }
5390
4688
  function offsetSmartObject(layers, id, dx, dy, canvas) {
5391
4689
  const layer = requireSmartObject(layers, id);
@@ -5395,27 +4693,27 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
5395
4693
  if (!mx && !my) return layers;
5396
4694
  const corners = layer.placement.corners.map((p) => ({ x: p.x + mx, y: p.y + my }));
5397
4695
  let next = { ...layer, placement: { ...layer.placement, corners } };
5398
- const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, m2.surface, mx, my) } : m2;
4696
+ const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface: _chunk474IQG74cjs.translateSurface.call(void 0, m2.surface, mx, my) } : m2;
5399
4697
  if (layer.mask) next.mask = moveMask(layer.mask);
5400
- if (_optionalChain([layer, 'access', _112 => _112.smartFilters, 'optionalAccess', _113 => _113.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
4698
+ if (_optionalChain([layer, 'access', _108 => _108.smartFilters, 'optionalAccess', _109 => _109.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5401
4699
  next = followLayerMove(next, mx, my);
5402
4700
  const spatial = activeSmartFilters(layer.smartFilters).some((f) => f.kind === "blur") || activeEffectSmartFilters(layer.smartFilters).length > 0;
5403
- const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
4701
+ const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
5404
4702
  const m = SMART_RENDER_MARGIN;
5405
4703
  const cut = b && (b.x <= -m || b.y <= -m || b.x + b.width >= canvas.width + m || b.y + b.height >= canvas.height + m);
5406
- if (!spatial && !cut && !(_optionalChain([next, 'access', _114 => _114.smartFilters, 'optionalAccess', _115 => _115.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
5407
- next = { ...next, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, mx, my) };
4704
+ if (!spatial && !cut && !(_optionalChain([next, 'access', _110 => _110.smartFilters, 'optionalAccess', _111 => _111.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
4705
+ next = { ...next, surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, mx, my) };
5408
4706
  } else {
5409
4707
  next = rerender(next, canvas, "move");
5410
4708
  }
5411
- return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next);
4709
+ return _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next);
5412
4710
  }
5413
4711
  function translateLayer(layer, dx, dy) {
5414
4712
  if (!dx && !dy) return layer;
5415
4713
  const moveMask = (m) => {
5416
4714
  if (!m) return m;
5417
4715
  if (m.source) fail4(`Layer "${layer.name || layer.id}" has a depth mask, which cannot move into a smart object; bake or remove it first.`);
5418
- return { ...m, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, m.surface, dx, dy) };
4716
+ return { ...m, surface: _chunk474IQG74cjs.translateSurface.call(void 0, m.surface, dx, dy) };
5419
4717
  };
5420
4718
  switch (layer.type) {
5421
4719
  case "pixel":
@@ -5424,11 +4722,11 @@ function translateLayer(layer, dx, dy) {
5424
4722
  const next = {
5425
4723
  ...layer,
5426
4724
  placement: { ...layer.placement, corners: layer.placement.corners.map((p) => ({ x: p.x + dx, y: p.y + dy })) },
5427
- surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, dx, dy),
4725
+ surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
5428
4726
  mask: moveMask(layer.mask)
5429
4727
  };
5430
4728
  if (!next.mask) delete next.mask;
5431
- if (_optionalChain([layer, 'access', _116 => _116.smartFilters, 'optionalAccess', _117 => _117.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
4729
+ if (_optionalChain([layer, 'access', _112 => _112.smartFilters, 'optionalAccess', _113 => _113.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5432
4730
  return next;
5433
4731
  }
5434
4732
  case "group": {
@@ -5444,8 +4742,8 @@ function translateLayer(layer, dx, dy) {
5444
4742
  case "shape": {
5445
4743
  const next = {
5446
4744
  ...layer,
5447
- components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkBRKVNXDZcjs.translateMatrix.call(void 0, dx, dy)),
5448
- surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, dx, dy),
4745
+ components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkQAUIZPYIcjs.translateMatrix.call(void 0, dx, dy)),
4746
+ surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
5449
4747
  mask: moveMask(layer.mask)
5450
4748
  };
5451
4749
  if (!next.mask) delete next.mask;
@@ -5453,7 +4751,7 @@ function translateLayer(layer, dx, dy) {
5453
4751
  return next;
5454
4752
  }
5455
4753
  case "type": {
5456
- const next = { ...transformTypeLayer(layer, _chunkBRKVNXDZcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
4754
+ const next = { ...transformTypeLayer(layer, _chunkQAUIZPYIcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
5457
4755
  if (!next.mask) delete next.mask;
5458
4756
  return next;
5459
4757
  }
@@ -5468,7 +4766,7 @@ function layerExtent(layer, surfaceOf, canvas) {
5468
4766
  const s = layer.type === "pixel" ? surfaceOf(layer) : layer.surface;
5469
4767
  if (s.defaultValue !== 0) b = full;
5470
4768
  else {
5471
- const c = _chunkCWM3CUUXcjs.contentBounds.call(void 0, s);
4769
+ const c = _chunk474IQG74cjs.contentBounds.call(void 0, s);
5472
4770
  b = c ? { x: c.x + layer.offset.x, y: c.y + layer.offset.y, width: c.width, height: c.height } : null;
5473
4771
  }
5474
4772
  } else if (layer.type === "group") {
@@ -5476,7 +4774,7 @@ function layerExtent(layer, surfaceOf, canvas) {
5476
4774
  } else {
5477
4775
  b = full;
5478
4776
  }
5479
- const m = _chunkHGTDMKNEcjs.effectsMargin.call(void 0, layer.effects);
4777
+ const m = _chunkUOGKSVRQcjs.effectsMargin.call(void 0, layer.effects);
5480
4778
  if (b && m > 0) b = { x: b.x - Math.ceil(m), y: b.y - Math.ceil(m), width: b.width + 2 * Math.ceil(m), height: b.height + 2 * Math.ceil(m) };
5481
4779
  return b;
5482
4780
  }
@@ -5488,14 +4786,14 @@ function union(a, b) {
5488
4786
  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 };
5489
4787
  }
5490
4788
  function asSmartFilters(filters) {
5491
- if (!_optionalChain([filters, 'optionalAccess', _118 => _118.length])) return void 0;
4789
+ if (!_optionalChain([filters, 'optionalAccess', _114 => _114.length])) return void 0;
5492
4790
  return { enabled: true, filters: filters.map((f) => ({ ...f, blend: "normal", opacity: 1 })) };
5493
4791
  }
5494
4792
  function convertToSmartObject(layers, ids, canvas, options) {
5495
4793
  if (!ids.length) fail4("Give at least one layer id to convert.");
5496
4794
  const locs = [...new Set(ids)].map((id) => requireLayer(layers, id));
5497
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _119 => _119[0], 'access', _120 => _120.parent, 'optionalAccess', _121 => _121.id]), () => ( null));
5498
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _122 => _122.parent, 'optionalAccess', _123 => _123.id]), () => ( null))) !== parent)) fail4("Layers to convert must share one parent; move them next to each other first.");
4795
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _115 => _115[0], 'access', _116 => _116.parent, 'optionalAccess', _117 => _117.id]), () => ( null));
4796
+ 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.");
5499
4797
  for (const l of locs) requireUnlocked(l.layer, "all", "convert it");
5500
4798
  const ordered = locs.sort((a, b) => a.index - b.index);
5501
4799
  const top = ordered[ordered.length - 1];
@@ -5504,7 +4802,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5504
4802
  if (single && single.type === "pixel") {
5505
4803
  const surface = options.surfaceOf(single);
5506
4804
  if (surface.defaultValue !== 0) fail4(`Layer "${single.name || single.id}" has no transparent area to crop to; it cannot be converted.`);
5507
- const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, surface);
4805
+ const b = _chunk474IQG74cjs.contentBounds.call(void 0, surface);
5508
4806
  if (!b) fail4(`Layer "${single.name || single.id}" has no pixels to convert; paint something first.`);
5509
4807
  const contents = {
5510
4808
  id: newContentsId(),
@@ -5512,7 +4810,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5512
4810
  width: b.width,
5513
4811
  height: b.height,
5514
4812
  kind: "raster",
5515
- raster: _chunkCWM3CUUXcjs.translateSurface.call(void 0, surface, -b.x, -b.y)
4813
+ raster: _chunk474IQG74cjs.translateSurface.call(void 0, surface, -b.x, -b.y)
5516
4814
  };
5517
4815
  smart = {
5518
4816
  type: "smart",
@@ -5523,14 +4821,14 @@ function convertToSmartObject(layers, ids, canvas, options) {
5523
4821
  blend: single.blend,
5524
4822
  contents,
5525
4823
  placement: placementAt(contents, b.x + single.offset.x, b.y + single.offset.y),
5526
- surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
4824
+ surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
5527
4825
  offset: { x: 0, y: 0 }
5528
4826
  };
5529
4827
  if (single.clipped) smart.clipped = true;
5530
4828
  if (single.fillOpacity !== void 0) smart.fillOpacity = single.fillOpacity;
5531
4829
  if (single.effects) smart.effects = single.effects;
5532
4830
  if (single.mask) {
5533
- smart.mask = single.mask.source ? single.mask : { ...single.mask, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, single.mask.surface, single.offset.x, single.offset.y) };
4831
+ smart.mask = single.mask.source ? single.mask : { ...single.mask, surface: _chunk474IQG74cjs.translateSurface.call(void 0, single.mask.surface, single.offset.x, single.offset.y) };
5534
4832
  }
5535
4833
  const filters = asSmartFilters(single.filters);
5536
4834
  if (filters) smart.smartFilters = filters;
@@ -5545,7 +4843,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5545
4843
  delete resolved2.source;
5546
4844
  layer = resolved2;
5547
4845
  }
5548
- if (_chunkHGTDMKNEcjs.flattenLayers.call(void 0, [layer]).some((x) => x.type === "pixel" && x.source === "document")) fail4(`Layer "${layer.name || layer.id}" holds the document image inside a group; convert the Background on its own.`);
4846
+ if (_chunkUOGKSVRQcjs.flattenLayers.call(void 0, [layer]).some((x) => x.type === "pixel" && x.source === "document")) fail4(`Layer "${layer.name || layer.id}" holds the document image inside a group; convert the Background on its own.`);
5549
4847
  return translateLayer(layer, -b.x, -b.y);
5550
4848
  });
5551
4849
  if (nested[0].clipped) {
@@ -5553,7 +4851,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5553
4851
  delete first.clipped;
5554
4852
  nested[0] = first;
5555
4853
  }
5556
- const name = _optionalChain([options, 'access', _124 => _124.name, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()]) || top.layer.name || "Smart Object";
4854
+ const name = _optionalChain([options, 'access', _120 => _120.name, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()]) || top.layer.name || "Smart Object";
5557
4855
  const contents = documentContents({ layers: nested }, b.width, b.height, `${name}.psb`);
5558
4856
  smart = {
5559
4857
  type: "smart",
@@ -5564,16 +4862,16 @@ function convertToSmartObject(layers, ids, canvas, options) {
5564
4862
  blend: "normal",
5565
4863
  contents,
5566
4864
  placement: placementAt(contents, b.x, b.y),
5567
- surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
4865
+ surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
5568
4866
  offset: { x: 0, y: 0 }
5569
4867
  };
5570
4868
  }
5571
- if (_optionalChain([options, 'access', _127 => _127.name, 'optionalAccess', _128 => _128.trim, 'call', _129 => _129()])) smart.name = options.name.trim();
4869
+ if (_optionalChain([options, 'access', _123 => _123.name, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()])) smart.name = options.name.trim();
5572
4870
  smart = { ...smart, surface: renderSmartObject(smart, canvas) };
5573
4871
  const below = ordered.filter((l) => l.index < top.index).length;
5574
4872
  let out = layers;
5575
- for (const l of ordered) out = _chunkHGTDMKNEcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
5576
- return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
4873
+ for (const l of ordered) out = _chunkUOGKSVRQcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
4874
+ return { layers: _chunkUOGKSVRQcjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
5577
4875
  }
5578
4876
  function rasterizeSmartObject(layers, id) {
5579
4877
  const layer = requireSmartObject(layers, id);
@@ -5593,29 +4891,29 @@ function rasterizeSmartObject(layers, id) {
5593
4891
  if (layer.locks) out.locks = layer.locks;
5594
4892
  if (layer.effects) out.effects = layer.effects;
5595
4893
  if (layer.fillOpacity !== void 0) out.fillOpacity = layer.fillOpacity;
5596
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
4894
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
5597
4895
  }
5598
4896
  function copySmartObject(layers, id, linked, name) {
5599
4897
  const loc = requireLayer(layers, id);
5600
4898
  const layer = requireSmartObject(layers, id);
5601
- const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess', _130 => _130.trim, 'call', _131 => _131()]) || `${layer.name || "Smart Object"} copy` };
4899
+ const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess', _126 => _126.trim, 'call', _127 => _127()]) || `${layer.name || "Smart Object"} copy` };
5602
4900
  delete copy.locks;
5603
4901
  delete copy.psd;
5604
4902
  if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
5605
4903
  if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
5606
- return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _132 => _132.parent, 'optionalAccess', _133 => _133.id]), () => ( null)), loc.index + 1), layer: copy };
4904
+ return { layers: _chunkUOGKSVRQcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _128 => _128.parent, 'optionalAccess', _129 => _129.id]), () => ( null)), loc.index + 1), layer: copy };
5607
4905
  }
5608
4906
  function instancesOf(layers, contentsId) {
5609
- return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
4907
+ return _chunkUOGKSVRQcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
5610
4908
  }
5611
4909
  function replaceContents(layers, contentsId, contents, canvas) {
5612
4910
  const ids = instancesOf(layers, contentsId);
5613
4911
  if (!ids.length) fail4(`No smart object uses contents "${contentsId}".`);
5614
- for (const id of ids) requireUnlocked(_chunkHGTDMKNEcjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
4912
+ for (const id of ids) requireUnlocked(_chunkUOGKSVRQcjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
5615
4913
  const next = { ...contents, id: contentsId };
5616
4914
  let out = layers;
5617
4915
  for (const id of ids) {
5618
- out = _chunkHGTDMKNEcjs.mapLayer.call(void 0, out, id, (l) => {
4916
+ out = _chunkUOGKSVRQcjs.mapLayer.call(void 0, out, id, (l) => {
5619
4917
  const layer = l;
5620
4918
  return rerender({ ...layer, contents: next, placement: refitPlacement(layer, next) }, canvas, "take the new contents");
5621
4919
  });
@@ -5639,14 +4937,14 @@ function refitPlacement(layer, contents) {
5639
4937
  });
5640
4938
  const out = { corners: pts };
5641
4939
  if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
5642
- if (layer.placement.warp) out.warp = _chunkBRKVNXDZcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
4940
+ if (layer.placement.warp) out.warp = _chunkQAUIZPYIcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
5643
4941
  return out;
5644
4942
  }
5645
4943
  function normalizeSmartFilter(raw, id = newLayerId("flt")) {
5646
4944
  if (raw.kind === "psd") fail4("Photoshop filters can only come from a PSD; add develop or blur.");
5647
4945
  const base = raw.kind === "effect" ? normalizeEffectSmartFilter(raw, id) : normalizeFilter(raw, id);
5648
4946
  const blend = _nullishCoalesce(raw.blend, () => ( "normal"));
5649
- if (!_chunkCWM3CUUXcjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
4947
+ if (!_chunkOLNIPTB3cjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
5650
4948
  const opacity = _nullishCoalesce(raw.opacity, () => ( 1));
5651
4949
  if (!(typeof opacity === "number" && opacity >= 0 && opacity <= 1)) fail4("opacity must be a number from 0 to 1.");
5652
4950
  return { ...base, blend, opacity };
@@ -5675,7 +4973,7 @@ function stackOf(layer) {
5675
4973
  return _nullishCoalesce(layer.smartFilters, () => ( { enabled: true, filters: [] }));
5676
4974
  }
5677
4975
  function requireFilter(layer, filterId) {
5678
- const list2 = _nullishCoalesce(_optionalChain([layer, 'access', _134 => _134.smartFilters, 'optionalAccess', _135 => _135.filters]), () => ( []));
4976
+ const list2 = _nullishCoalesce(_optionalChain([layer, 'access', _130 => _130.smartFilters, 'optionalAccess', _131 => _131.filters]), () => ( []));
5679
4977
  const i = list2.findIndex((f) => f.id === filterId);
5680
4978
  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.`);
5681
4979
  return i;
@@ -5692,7 +4990,7 @@ function addSmartFilter(layers, id, filter, canvas, index) {
5692
4990
  const at = index === void 0 ? filters.length : Math.max(0, Math.min(filters.length, Math.floor(index)));
5693
4991
  filters.splice(at, 0, filter);
5694
4992
  const next = withStack(layer, { ...stack, filters }, canvas);
5695
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
4993
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
5696
4994
  }
5697
4995
  function updateSmartFilter(layers, id, filterId, changes, canvas) {
5698
4996
  const layer = editableSmart(layers, id);
@@ -5704,7 +5002,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
5704
5002
  const extra = Object.keys(changes).filter((k) => !["enabled", "blend", "opacity", "kind"].includes(k));
5705
5003
  if (extra.length) fail4(`"${current.name}" is a Photoshop filter we keep but do not model; only enabled, blend and opacity change. Unknown: ${extra.join(", ")}.`);
5706
5004
  const blend = _nullishCoalesce(changes.blend, () => ( current.blend));
5707
- if (!_chunkCWM3CUUXcjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
5005
+ if (!_chunkOLNIPTB3cjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
5708
5006
  const opacity = _nullishCoalesce(changes.opacity, () => ( current.opacity));
5709
5007
  if (!(typeof opacity === "number" && opacity >= 0 && opacity <= 1)) fail4("opacity must be a number from 0 to 1.");
5710
5008
  merged2 = { ...current, enabled: changes.enabled === void 0 ? current.enabled : Boolean(changes.enabled), blend, opacity };
@@ -5714,7 +5012,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
5714
5012
  const filters = [...layer.smartFilters.filters];
5715
5013
  filters[i] = merged2;
5716
5014
  const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
5717
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
5015
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
5718
5016
  }
5719
5017
  function removeSmartFilter(layers, id, filterId, canvas) {
5720
5018
  const layer = editableSmart(layers, id);
@@ -5722,7 +5020,7 @@ function removeSmartFilter(layers, id, filterId, canvas) {
5722
5020
  const stack = layer.smartFilters;
5723
5021
  const filters = stack.filters.filter((f) => f.id !== filterId);
5724
5022
  const next = withStack(layer, filters.length ? { ...stack, filters } : stack.enabled ? void 0 : { enabled: false, filters }, canvas);
5725
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5023
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5726
5024
  }
5727
5025
  function moveSmartFilter(layers, id, filterId, index, canvas) {
5728
5026
  const layer = editableSmart(layers, id);
@@ -5733,21 +5031,21 @@ function moveSmartFilter(layers, id, filterId, index, canvas) {
5733
5031
  const [f] = filters.splice(i, 1);
5734
5032
  filters.splice(index, 0, f);
5735
5033
  const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
5736
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5034
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5737
5035
  }
5738
5036
  function setSmartFiltersEnabled(layers, id, enabled, canvas) {
5739
5037
  const layer = editableSmart(layers, id);
5740
5038
  const next = withStack(layer, { ...stackOf(layer), enabled: Boolean(enabled) }, canvas);
5741
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5039
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5742
5040
  }
5743
5041
  function setSmartFilterMask(layers, id, mask, canvas) {
5744
5042
  const layer = editableSmart(layers, id);
5745
- if (_optionalChain([mask, 'optionalAccess', _136 => _136.source])) fail4("A smart filter mask is painted, not generated; use a raster mask.");
5043
+ if (_optionalChain([mask, 'optionalAccess', _132 => _132.source])) fail4("A smart filter mask is painted, not generated; use a raster mask.");
5746
5044
  const stack = { ...stackOf(layer) };
5747
5045
  if (mask) stack.mask = mask;
5748
5046
  else delete stack.mask;
5749
5047
  const next = withStack(layer, stack, canvas);
5750
- return { layers: _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5048
+ return { layers: _chunkUOGKSVRQcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5751
5049
  }
5752
5050
  function withFilterMaskSurface(layer, surface, canvas) {
5753
5051
  const stack = stackOf(layer);
@@ -5761,7 +5059,7 @@ function placementBounds(layer) {
5761
5059
  // src/image-editor/layers/serialize.ts
5762
5060
  var LAYERED_SCHEMA_VERSION = 3;
5763
5061
  function serializePatterns(patterns) {
5764
- return patterns.map((p) => ({ id: p.id, name: p.name, png: _chunkCWM3CUUXcjs.pngDataUrl.call(void 0, p.width, p.height, p.data) }));
5062
+ return patterns.map((p) => ({ id: p.id, name: p.name, png: _chunkOLNIPTB3cjs.pngDataUrl.call(void 0, p.width, p.height, p.data) }));
5765
5063
  }
5766
5064
  function deserializePatterns(raw, problems = []) {
5767
5065
  if (!Array.isArray(raw)) return [];
@@ -5780,11 +5078,11 @@ function deserializePatterns(raw, problems = []) {
5780
5078
  var encodedCache = /* @__PURE__ */ new WeakMap();
5781
5079
  function encodeSurface(surface) {
5782
5080
  if (encodedCache.has(surface)) return encodedCache.get(surface);
5783
- const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, surface);
5081
+ const b = _chunk474IQG74cjs.contentBounds.call(void 0, surface);
5784
5082
  let out = null;
5785
5083
  if (b) {
5786
- const data = _chunkCWM3CUUXcjs.readRegion.call(void 0, surface, b);
5787
- out = { url: _chunkCWM3CUUXcjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
5084
+ const data = _chunk474IQG74cjs.readRegion.call(void 0, surface, b);
5085
+ out = { url: _chunkOLNIPTB3cjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
5788
5086
  }
5789
5087
  encodedCache.set(surface, out);
5790
5088
  return out;
@@ -5793,15 +5091,15 @@ var deepCache = /* @__PURE__ */ new WeakMap();
5793
5091
  function encodeDeepSurface(surface) {
5794
5092
  if (deepCache.has(surface)) return deepCache.get(surface);
5795
5093
  let out = null;
5796
- const depth = _chunkCWM3CUUXcjs.surfaceDepth.call(void 0, surface);
5797
- const b = depth === 8 ? null : _chunkCWM3CUUXcjs.contentBounds.call(void 0, surface);
5094
+ const depth = _chunkOLNIPTB3cjs.surfaceDepth.call(void 0, surface);
5095
+ const b = depth === 8 ? null : _chunk474IQG74cjs.contentBounds.call(void 0, surface);
5798
5096
  if (depth !== 8 && b) {
5799
- const samples = _chunkCWM3CUUXcjs.readDeepRegion.call(void 0, surface, b, depth);
5097
+ const samples = _chunkOLNIPTB3cjs.readDeepRegion.call(void 0, surface, b, depth);
5800
5098
  const bytes = new Uint8Array(samples.byteLength);
5801
5099
  const view = new DataView(bytes.buffer);
5802
5100
  if (samples instanceof Uint16Array) for (let i = 0; i < samples.length; i++) view.setUint16(2 * i, samples[i], true);
5803
5101
  else for (let i = 0; i < samples.length; i++) view.setFloat32(4 * i, samples[i], true);
5804
- out = { depth, x: b.x, y: b.y, width: b.width, height: b.height, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, _chunkXFM3OCHUcjs.deflate.call(void 0, bytes)) };
5102
+ out = { depth, x: b.x, y: b.y, width: b.width, height: b.height, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, _chunkXFM3OCHUcjs.deflate.call(void 0, bytes)) };
5805
5103
  }
5806
5104
  deepCache.set(surface, out);
5807
5105
  return out;
@@ -5813,13 +5111,13 @@ function decodeDeepSurface(surface, raw, problems, label) {
5813
5111
  if (d.depth !== 16 && d.depth !== 32 || !(d.width > 0 && d.height > 0) || !Number.isInteger(d.x) || !Number.isInteger(d.y) || typeof d.data !== "string") throw new Error("malformed");
5814
5112
  const n = d.width * d.height * surface.channels;
5815
5113
  const size = d.depth === 16 ? 2 : 4;
5816
- const bytes = _chunkXFM3OCHUcjs.inflate.call(void 0, _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, d.data), { maxOutput: n * size });
5114
+ const bytes = _chunkXFM3OCHUcjs.inflate.call(void 0, _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, d.data), { maxOutput: n * size });
5817
5115
  if (bytes.length !== n * size) throw new Error("wrong length");
5818
5116
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
5819
5117
  const samples = d.depth === 16 ? new Uint16Array(n) : new Float32Array(n);
5820
5118
  if (samples instanceof Uint16Array) for (let i = 0; i < n; i++) samples[i] = view.getUint16(2 * i, true);
5821
5119
  else for (let i = 0; i < n; i++) samples[i] = view.getFloat32(4 * i, true);
5822
- return _chunkCWM3CUUXcjs.writeDeepRegion.call(void 0, surface, { x: d.x, y: d.y, width: d.width, height: d.height }, samples);
5120
+ return _chunkOLNIPTB3cjs.writeDeepRegion.call(void 0, surface, { x: d.x, y: d.y, width: d.width, height: d.height }, samples);
5823
5121
  } catch (e6) {
5824
5122
  problems.push(`${label}: its ${d.depth}-bit samples could not be read, so it was opened at 8 bits`);
5825
5123
  return surface;
@@ -5843,7 +5141,7 @@ function baseFields(layer, ctx) {
5843
5141
  function serializeEffects(effects) {
5844
5142
  const out = { enabled: effects.enabled, items: JSON.parse(JSON.stringify(effects.items)) };
5845
5143
  if (effects.scale !== void 0 && effects.scale !== 1) out.scale = effects.scale;
5846
- if (effects.psd) out.psd = { key: effects.psd.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, effects.psd.data) };
5144
+ if (effects.psd) out.psd = { key: effects.psd.key, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, effects.psd.data) };
5847
5145
  return out;
5848
5146
  }
5849
5147
  function deserializeEffects(raw) {
@@ -5853,12 +5151,12 @@ function deserializeEffects(raw) {
5853
5151
  const p = r.psd;
5854
5152
  if (p && typeof p.key === "string" && typeof p.data === "string") {
5855
5153
  try {
5856
- psd = { key: p.key, data: _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, p.data) };
5154
+ psd = { key: p.key, data: _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, p.data) };
5857
5155
  } catch (e7) {
5858
5156
  psd = void 0;
5859
5157
  }
5860
5158
  }
5861
- return _chunkHGTDMKNEcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
5159
+ return _chunkUOGKSVRQcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
5862
5160
  }
5863
5161
  function serializeVectorMask(vm) {
5864
5162
  const out = { components: JSON.parse(JSON.stringify(vm.components)) };
@@ -5874,12 +5172,12 @@ function readVectorMask(r) {
5874
5172
  if (!Array.isArray(r.components)) throw new Error("its components are missing");
5875
5173
  const components = r.components.map((raw, i) => {
5876
5174
  const c = raw;
5877
- const op = requireOperation(_optionalChain([c, 'optionalAccess', _137 => _137.op]), `components[${i}].op`);
5878
- if (_optionalChain([c, 'optionalAccess', _138 => _138.live])) {
5175
+ const op = requireOperation(_optionalChain([c, 'optionalAccess', _133 => _133.op]), `components[${i}].op`);
5176
+ if (_optionalChain([c, 'optionalAccess', _134 => _134.live])) {
5879
5177
  const live = normalizeLiveShape(c.live, `components[${i}].live`);
5880
5178
  return { op, subpaths: liveShapeSubpaths(live), live };
5881
5179
  }
5882
- return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _139 => _139.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _140 => _140.subpaths]), `components[${i}].subpaths`) };
5180
+ return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _135 => _135.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _136 => _136.subpaths]), `components[${i}].subpaths`) };
5883
5181
  });
5884
5182
  const vm = { components };
5885
5183
  if (r.fillRule === "evenodd") vm.fillRule = "evenodd";
@@ -5925,7 +5223,7 @@ function serializeLayer(layer, ctx) {
5925
5223
  }
5926
5224
  }
5927
5225
  if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
5928
- if (_optionalChain([layer, 'access', _141 => _141.filters, 'optionalAccess', _142 => _142.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
5226
+ if (_optionalChain([layer, 'access', _137 => _137.filters, 'optionalAccess', _138 => _138.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
5929
5227
  if (layer.generator) out.generator = JSON.parse(JSON.stringify(layer.generator));
5930
5228
  if (layer.source !== "document") {
5931
5229
  const deep = encodeDeepSurface(layer.surface);
@@ -5969,12 +5267,12 @@ function serializeType(layer, base, ctx) {
5969
5267
  out.x = enc.x;
5970
5268
  out.y = enc.y;
5971
5269
  }
5972
- if (_optionalChain([layer, 'access', _143 => _143.missingFonts, 'optionalAccess', _144 => _144.length])) out.missingFonts = [...layer.missingFonts];
5270
+ if (_optionalChain([layer, 'access', _139 => _139.missingFonts, 'optionalAccess', _140 => _140.length])) out.missingFonts = [...layer.missingFonts];
5973
5271
  if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
5974
- if (_optionalChain([layer, 'access', _145 => _145.psd, 'optionalAccess', _146 => _146.tySh]) || _optionalChain([layer, 'access', _147 => _147.psd, 'optionalAccess', _148 => _148.blocks, 'optionalAccess', _149 => _149.length])) {
5272
+ if (_optionalChain([layer, 'access', _141 => _141.psd, 'optionalAccess', _142 => _142.tySh]) || _optionalChain([layer, 'access', _143 => _143.psd, 'optionalAccess', _144 => _144.blocks, 'optionalAccess', _145 => _145.length])) {
5975
5273
  out.psd = {};
5976
- if (layer.psd.tySh) out.psd.tySh = _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, layer.psd.tySh);
5977
- if (_optionalChain([layer, 'access', _150 => _150.psd, 'access', _151 => _151.blocks, 'optionalAccess', _152 => _152.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, b.data) }));
5274
+ if (layer.psd.tySh) out.psd.tySh = _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, layer.psd.tySh);
5275
+ if (_optionalChain([layer, 'access', _146 => _146.psd, 'access', _147 => _147.blocks, 'optionalAccess', _148 => _148.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, b.data) }));
5978
5276
  if (layer.psd.signature) out.psd.signature = layer.psd.signature;
5979
5277
  }
5980
5278
  return out;
@@ -5984,27 +5282,27 @@ function readType(r, base, ctx) {
5984
5282
  try {
5985
5283
  const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
5986
5284
  const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
5987
- length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _153 => _153.length]), 0, 1e9, 0))),
5988
- style: patchTextStyle(_chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _154 => _154.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
5285
+ length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _149 => _149.length]), 0, 1e9, 0))),
5286
+ style: patchTextStyle(_chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _150 => _150.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
5989
5287
  }));
5990
5288
  const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
5991
- length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _155 => _155.length]), 0, 1e9, 0))),
5992
- style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess', _156 => _156.style]) && typeof p.style === "object" ? p.style : {}, `paragraphs[${i}].style`)
5289
+ length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _151 => _151.length]), 0, 1e9, 0))),
5290
+ style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess', _152 => _152.style]) && typeof p.style === "object" ? p.style : {}, `paragraphs[${i}].style`)
5993
5291
  }));
5994
5292
  const f = r.frame;
5995
- const frame = _optionalChain([f, 'optionalAccess', _157 => _157.kind]) === "box" ? { kind: "box", width: num2(f.width, 1, 1e6, 100), height: num2(f.height, 1, 1e6, 100) } : _optionalChain([f, 'optionalAccess', _158 => _158.origin]) === "top" ? { kind: "point", origin: "top" } : { kind: "point" };
5293
+ const frame = _optionalChain([f, 'optionalAccess', _153 => _153.kind]) === "box" ? { kind: "box", width: num2(f.width, 1, 1e6, 100), height: num2(f.height, 1, 1e6, 100) } : _optionalChain([f, 'optionalAccess', _154 => _154.origin]) === "top" ? { kind: "point", origin: "top" } : { kind: "point" };
5996
5294
  const m = Array.isArray(r.transform) && r.transform.length === 6 && r.transform.every((v) => typeof v === "number" && Number.isFinite(v)) ? r.transform : void 0;
5997
5295
  const layer = {
5998
5296
  ...base,
5999
5297
  type: "type",
6000
5298
  text: text3,
6001
- runs: _chunkBRKVNXDZcjs.fitRuns.call(void 0, runs, text3.length, _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE),
6002
- paragraphs: _chunkBRKVNXDZcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
5299
+ runs: _chunkQAUIZPYIcjs.fitRuns.call(void 0, runs, text3.length, _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE),
5300
+ paragraphs: _chunkQAUIZPYIcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
6003
5301
  frame,
6004
- surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
5302
+ surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
6005
5303
  offset: { x: 0, y: 0 }
6006
5304
  };
6007
- if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _159 => _159[0], 'optionalAccess', _160 => _160.style]), () => ( _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE)) }];
5305
+ if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _155 => _155[0], 'optionalAccess', _156 => _156.style]), () => ( _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)) }];
6008
5306
  if (m) layer.transform = m;
6009
5307
  if (r.orientation === "vertical") layer.orientation = "vertical";
6010
5308
  if (r.antiAlias === false) layer.antiAlias = false;
@@ -6013,13 +5311,13 @@ function readType(r, base, ctx) {
6013
5311
  if (r.annotation && typeof r.annotation === "object" && r.annotation.type === "text") layer.annotation = JSON.parse(JSON.stringify({ ...r.annotation, id: _nullishCoalesce(r.annotation.id, () => ( base.id)) }));
6014
5312
  if (r.psd && typeof r.psd === "object") {
6015
5313
  const psd = {};
6016
- if (typeof r.psd.tySh === "string") psd.tySh = _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, r.psd.tySh);
6017
- 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) }));
5314
+ if (typeof r.psd.tySh === "string") psd.tySh = _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, r.psd.tySh);
5315
+ 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: _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, b.data) }));
6018
5316
  if (typeof r.psd.signature === "string") psd.signature = r.psd.signature;
6019
- if (psd.tySh || _optionalChain([psd, 'access', _161 => _161.blocks, 'optionalAccess', _162 => _162.length])) layer.psd = psd;
5317
+ if (psd.tySh || _optionalChain([psd, 'access', _157 => _157.blocks, 'optionalAccess', _158 => _158.length])) layer.psd = psd;
6020
5318
  }
6021
5319
  if (typeof r.asset === "string") return { ...layer, surface: readSurface(r.asset, r.x, r.y, 4, 0, ctx, label), rendering: "stored" };
6022
- const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _163 => _163.text, 'optionalAccess', _164 => _164.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _165 => _165.text, 'optionalAccess', _166 => _166.createCanvas]) };
5320
+ const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _159 => _159.text, 'optionalAccess', _160 => _160.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _161 => _161.text, 'optionalAccess', _162 => _162.createCanvas]) };
6023
5321
  try {
6024
5322
  return rerenderText(layer, env);
6025
5323
  } catch (e8) {
@@ -6042,7 +5340,7 @@ function serializeShape(layer, base) {
6042
5340
  if (layer.inverted) out.inverted = true;
6043
5341
  if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
6044
5342
  if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
6045
- if (_optionalChain([layer, 'access', _167 => _167.psd, 'optionalAccess', _168 => _168.blocks, 'optionalAccess', _169 => _169.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 } : {} };
5343
+ if (_optionalChain([layer, 'access', _163 => _163.psd, 'optionalAccess', _164 => _164.blocks, 'optionalAccess', _165 => _165.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
6046
5344
  return out;
6047
5345
  }
6048
5346
  function readShape(r, base, ctx) {
@@ -6056,12 +5354,12 @@ function readShape(r, base, ctx) {
6056
5354
  if (!data) {
6057
5355
  if (!Array.isArray(r.components) || !r.components.length) throw new Error("it has no components");
6058
5356
  const components = r.components.map((c, i) => {
6059
- const op = requireOperation(_optionalChain([c, 'optionalAccess', _170 => _170.op]), `components[${i}].op`);
6060
- if (_optionalChain([c, 'optionalAccess', _171 => _171.live])) {
5357
+ const op = requireOperation(_optionalChain([c, 'optionalAccess', _166 => _166.op]), `components[${i}].op`);
5358
+ if (_optionalChain([c, 'optionalAccess', _167 => _167.live])) {
6061
5359
  const live = normalizeLiveShape(c.live, `components[${i}].live`);
6062
5360
  return { op, subpaths: liveShapeSubpaths(live), live };
6063
5361
  }
6064
- return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _172 => _172.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _173 => _173.subpaths]), `components[${i}].subpaths`) };
5362
+ return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _168 => _168.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _169 => _169.subpaths]), `components[${i}].subpaths`) };
6065
5363
  });
6066
5364
  data = {
6067
5365
  components,
@@ -6074,7 +5372,7 @@ function readShape(r, base, ctx) {
6074
5372
  if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) out.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
6075
5373
  if (a && shapeFromAnnotation(a)) out.annotation = a;
6076
5374
  if (r.psd && Array.isArray(r.psd.blocks)) {
6077
- const 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) }));
5375
+ const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, b.data) }));
6078
5376
  if (blocks.length) out.psd = { blocks };
6079
5377
  if (out.psd && typeof r.psd.signature === "string") out.psd.signature = r.psd.signature;
6080
5378
  }
@@ -6087,7 +5385,7 @@ function readShape(r, base, ctx) {
6087
5385
  function serializeSmartFilters(stack, layerId, ctx) {
6088
5386
  const out = {
6089
5387
  enabled: stack.enabled,
6090
- filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, f.data) } : JSON.parse(JSON.stringify(f)))
5388
+ filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, f.data) } : JSON.parse(JSON.stringify(f)))
6091
5389
  };
6092
5390
  if (stack.mask) out.mask = serializeMask(stack.mask, `${layerId}-filter-mask`, ctx);
6093
5391
  return out;
@@ -6113,7 +5411,7 @@ function serializeSmartObject(layer, base, ctx) {
6113
5411
  }
6114
5412
  if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
6115
5413
  if (layer.psd) {
6116
- out.psd = { key: layer.psd.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, layer.psd.data) };
5414
+ out.psd = { key: layer.psd.key, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, layer.psd.data) };
6117
5415
  if (layer.psd.placed) out.psd.placed = layer.psd.placed;
6118
5416
  }
6119
5417
  return out;
@@ -6124,17 +5422,17 @@ function serializeContents(c, ctx) {
6124
5422
  const enc = encodeSurface(c.raster);
6125
5423
  if (enc) {
6126
5424
  if (enc.x !== 0 || enc.y !== 0) {
6127
- const data = _chunkCWM3CUUXcjs.readRegion.call(void 0, c.raster, { x: 0, y: 0, width: c.width, height: c.height });
6128
- out.asset = ctx.addAsset(_chunkCWM3CUUXcjs.pngDataUrl.call(void 0, c.width, c.height, data, 4), `contents-${c.id}`);
5425
+ const data = _chunk474IQG74cjs.readRegion.call(void 0, c.raster, { x: 0, y: 0, width: c.width, height: c.height });
5426
+ out.asset = ctx.addAsset(_chunkOLNIPTB3cjs.pngDataUrl.call(void 0, c.width, c.height, data, 4), `contents-${c.id}`);
6129
5427
  } else out.asset = ctx.addAsset(enc.url, `contents-${c.id}`);
6130
5428
  }
6131
5429
  }
6132
5430
  if (c.kind === "document" && c.document) {
6133
5431
  out.layers = c.document.layers.map((l) => serializeLayer(l, ctx));
6134
5432
  if (c.document.globalLight) out.globalLight = { ...c.document.globalLight };
6135
- if (_optionalChain([c, 'access', _174 => _174.document, 'access', _175 => _175.patterns, 'optionalAccess', _176 => _176.length])) out.patterns = serializePatterns(c.document.patterns);
5433
+ if (_optionalChain([c, 'access', _170 => _170.document, 'access', _171 => _171.patterns, 'optionalAccess', _172 => _172.length])) out.patterns = serializePatterns(c.document.patterns);
6136
5434
  }
6137
- if (c.file) out.file = { type: c.file.type, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, c.file.bytes) };
5435
+ if (c.file) out.file = { type: c.file.type, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, c.file.bytes) };
6138
5436
  if (c.linked) out.linked = { path: c.linked.path };
6139
5437
  return out;
6140
5438
  }
@@ -6170,7 +5468,7 @@ async function serializeLayersExternal(layers, store) {
6170
5468
  for (const [id, url] of Object.entries(inline.assets)) {
6171
5469
  let ref = refs.get(url);
6172
5470
  if (!ref) {
6173
- const parsed = _chunkCWM3CUUXcjs.parseDataUrl.call(void 0, url);
5471
+ const parsed = _chunkOLNIPTB3cjs.parseDataUrl.call(void 0, url);
6174
5472
  const png = decodePngHeader(parsed.bytes);
6175
5473
  ref = await store.put(new Blob([parsed.bytes], { type: "image/png" }), { id, width: png.width, height: png.height });
6176
5474
  if (typeof ref !== "string" || !ref) throw new Error(`The asset store returned no reference for "${id}".`);
@@ -6198,7 +5496,7 @@ async function resolveExternalAssets(assets, store, problems) {
6198
5496
  try {
6199
5497
  const blob = await store.get(ref);
6200
5498
  const bytes = new Uint8Array(await blob.arrayBuffer());
6201
- out[id] = `data:image/png;base64,${_chunkCWM3CUUXcjs.bytesToBase64.call(void 0, bytes)}`;
5499
+ out[id] = `data:image/png;base64,${_chunkOLNIPTB3cjs.bytesToBase64.call(void 0, bytes)}`;
6202
5500
  } catch (err) {
6203
5501
  problems.push(`Asset "${id}" (${ref}) could not be fetched: ${err.message}`);
6204
5502
  }
@@ -6206,9 +5504,9 @@ async function resolveExternalAssets(assets, store, problems) {
6206
5504
  return out;
6207
5505
  }
6208
5506
  function decodePngDataUrl(url, channels) {
6209
- const parsed = _chunkCWM3CUUXcjs.parseDataUrl.call(void 0, url);
5507
+ const parsed = _chunkOLNIPTB3cjs.parseDataUrl.call(void 0, url);
6210
5508
  if (!parsed) throw new Error("Asset is not a data URL.");
6211
- const png = _chunkCWM3CUUXcjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
5509
+ const png = _chunkOLNIPTB3cjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
6212
5510
  if (png.channels === channels) return png;
6213
5511
  if (channels === 1) {
6214
5512
  const out2 = new Uint8ClampedArray(png.width * png.height);
@@ -6226,18 +5524,18 @@ function decodePngDataUrl(url, channels) {
6226
5524
  }
6227
5525
  var num2 = (v, lo, hi, fallback) => typeof v === "number" && Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : fallback;
6228
5526
  function readSurface(ref, x, y, channels, defaultValue, ctx, what) {
6229
- if (typeof ref !== "string" || !ref) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, channels, defaultValue);
5527
+ if (typeof ref !== "string" || !ref) return _chunk474IQG74cjs.emptySurface.call(void 0, channels, defaultValue);
6230
5528
  const url = ctx.assets[ref];
6231
5529
  if (typeof url !== "string") {
6232
5530
  ctx.problems.push(`${what}: asset "${ref}" is missing`);
6233
- return _chunkCWM3CUUXcjs.emptySurface.call(void 0, channels, defaultValue);
5531
+ return _chunk474IQG74cjs.emptySurface.call(void 0, channels, defaultValue);
6234
5532
  }
6235
5533
  try {
6236
5534
  const px2 = (_nullishCoalesce(ctx.decodeAsset, () => ( decodePngDataUrl)))(url, channels);
6237
- return _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, px2, channels, Math.round(num2(x, -1e7, 1e7, 0)), Math.round(num2(y, -1e7, 1e7, 0)), defaultValue);
5535
+ return _chunk474IQG74cjs.surfaceFromPixels.call(void 0, px2, channels, Math.round(num2(x, -1e7, 1e7, 0)), Math.round(num2(y, -1e7, 1e7, 0)), defaultValue);
6238
5536
  } catch (err) {
6239
5537
  ctx.problems.push(`${what}: asset "${ref}" could not be decoded (${err.message})`);
6240
- return _chunkCWM3CUUXcjs.emptySurface.call(void 0, channels, defaultValue);
5538
+ return _chunk474IQG74cjs.emptySurface.call(void 0, channels, defaultValue);
6241
5539
  }
6242
5540
  }
6243
5541
  function readMask(raw, ctx, what) {
@@ -6245,7 +5543,7 @@ function readMask(raw, ctx, what) {
6245
5543
  const r = raw;
6246
5544
  const defaultValue = r.defaultValue === 255 ? 255 : 0;
6247
5545
  const mask = {
6248
- surface: r.source ? _chunkCWM3CUUXcjs.emptySurface.call(void 0, 1, 255) : readSurface(r.asset, r.x, r.y, 1, defaultValue, ctx, `${what} mask`),
5546
+ surface: r.source ? _chunk474IQG74cjs.emptySurface.call(void 0, 1, 255) : readSurface(r.asset, r.x, r.y, 1, defaultValue, ctx, `${what} mask`),
6249
5547
  defaultValue: r.source ? 255 : defaultValue
6250
5548
  };
6251
5549
  if (typeof r.density === "number" && r.density !== 1) mask.density = num2(r.density, 0, 1, 1);
@@ -6294,7 +5592,7 @@ function deserializeLayer(raw, ctx) {
6294
5592
  name: typeof r.name === "string" ? r.name : "",
6295
5593
  visible: r.visible !== false,
6296
5594
  opacity: num2(r.opacity, 0, 1, 1),
6297
- blend: _chunkCWM3CUUXcjs.normalizeBlendMode.call(void 0, r.blend)
5595
+ blend: _chunkOLNIPTB3cjs.normalizeBlendMode.call(void 0, r.blend)
6298
5596
  };
6299
5597
  if (r.clipped === true) base.clipped = true;
6300
5598
  const mask = readMask(r.mask, ctx, `Layer "${base.name || id}"`);
@@ -6318,8 +5616,8 @@ function deserializeLayer(raw, ctx) {
6318
5616
  const layer = {
6319
5617
  ...base,
6320
5618
  type: "pixel",
6321
- surface: r.source === "document" ? _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
6322
- offset: { x: Math.round(num2(_optionalChain([r, 'access', _177 => _177.offset, 'optionalAccess', _178 => _178.x]), -1e7, 1e7, 0)), y: Math.round(num2(_optionalChain([r, 'access', _179 => _179.offset, 'optionalAccess', _180 => _180.y]), -1e7, 1e7, 0)) }
5619
+ surface: r.source === "document" ? _chunk474IQG74cjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
5620
+ offset: { x: Math.round(num2(_optionalChain([r, 'access', _173 => _173.offset, 'optionalAccess', _174 => _174.x]), -1e7, 1e7, 0)), y: Math.round(num2(_optionalChain([r, 'access', _175 => _175.offset, 'optionalAccess', _176 => _176.y]), -1e7, 1e7, 0)) }
6323
5621
  };
6324
5622
  if (r.source === "document") layer.source = "document";
6325
5623
  else if (r.deep) layer.surface = decodeDeepSurface(layer.surface, r.deep, ctx.problems, `Layer "${base.name || id}"`);
@@ -6328,7 +5626,7 @@ function deserializeLayer(raw, ctx) {
6328
5626
  if (filters) layer.filters = filters;
6329
5627
  const generator = readEffectRef(r.generator);
6330
5628
  if (generator) {
6331
- const duration = _optionalChain([r, 'access', _181 => _181.generator, 'access', _182 => _182.animate, 'optionalAccess', _183 => _183.duration]);
5629
+ const duration = _optionalChain([r, 'access', _177 => _177.generator, 'access', _178 => _178.animate, 'optionalAccess', _179 => _179.duration]);
6332
5630
  layer.generator = {
6333
5631
  ...generator,
6334
5632
  ...typeof r.generator.time === "number" && r.generator.time > 0 ? { time: r.generator.time } : {},
@@ -6347,7 +5645,7 @@ function deserializeLayer(raw, ctx) {
6347
5645
  }
6348
5646
  case "group": {
6349
5647
  const children = Array.isArray(r.children) ? r.children.map((c) => deserializeLayer(c, ctx)).filter(Boolean) : [];
6350
- const blend = r.blend === "pass-through" ? "pass-through" : _chunkCWM3CUUXcjs.isBlendMode.call(void 0, r.blend) ? r.blend : "pass-through";
5648
+ const blend = r.blend === "pass-through" ? "pass-through" : _chunkOLNIPTB3cjs.isBlendMode.call(void 0, r.blend) ? r.blend : "pass-through";
6351
5649
  const group = { ...base, type: "group", blend, children };
6352
5650
  if (r.collapsed === true) group.collapsed = true;
6353
5651
  return group;
@@ -6359,7 +5657,7 @@ function deserializeLayer(raw, ctx) {
6359
5657
  return null;
6360
5658
  }
6361
5659
  const annotation = JSON.parse(JSON.stringify({ ...a, id: typeof a.id === "string" ? a.id : id }));
6362
- const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _184 => _184.text, 'optionalAccess', _185 => _185.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _186 => _186.text, 'optionalAccess', _187 => _187.createCanvas]) });
5660
+ const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _180 => _180.text, 'optionalAccess', _181 => _181.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _182 => _182.text, 'optionalAccess', _183 => _183.createCanvas]) });
6363
5661
  if (migrated.type === "shape" || migrated.type === "type") {
6364
5662
  const blend = base.blend === "normal" ? migrated.blend : base.blend;
6365
5663
  return { ...migrated, ...base, blend, id, name: base.name };
@@ -6399,7 +5697,7 @@ function readContents(id, ctx) {
6399
5697
  const c = { id, name: typeof raw.name === "string" ? raw.name : "Contents", width, height, kind: raw.kind === "document" ? "document" : "raster" };
6400
5698
  if (raw.file && typeof raw.file.type === "string" && typeof raw.file.data === "string") {
6401
5699
  try {
6402
- c.file = { type: raw.file.type, bytes: _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, raw.file.data) };
5700
+ c.file = { type: raw.file.type, bytes: _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, raw.file.data) };
6403
5701
  } catch (e9) {
6404
5702
  ctx.problems.push(`Smart object contents "${c.name}": the embedded file could not be read`);
6405
5703
  }
@@ -6407,7 +5705,7 @@ function readContents(id, ctx) {
6407
5705
  if (raw.linked && typeof raw.linked.path === "string") c.linked = { path: raw.linked.path };
6408
5706
  if (c.kind === "raster") {
6409
5707
  if (typeof raw.asset === "string") c.raster = readSurface(raw.asset, 0, 0, 4, 0, ctx, `Smart object contents "${c.name}"`);
6410
- else if (!c.file) c.raster = _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4);
5708
+ else if (!c.file) c.raster = _chunk474IQG74cjs.emptySurface.call(void 0, 4);
6411
5709
  } else {
6412
5710
  const outer = ctx.canvas;
6413
5711
  ctx.canvas = { width, height };
@@ -6439,11 +5737,11 @@ function readSmartFilters(raw, ctx, what) {
6439
5737
  let k = 0;
6440
5738
  for (const f of list2) {
6441
5739
  if (!f || typeof f !== "object") continue;
6442
- const blend = _chunkCWM3CUUXcjs.isBlendMode.call(void 0, f.blend) && f.blend !== "pigment" ? f.blend : "normal";
5740
+ const blend = _chunkOLNIPTB3cjs.isBlendMode.call(void 0, f.blend) && f.blend !== "pigment" ? f.blend : "normal";
6443
5741
  const opacity = num2(f.opacity, 0, 1, 1);
6444
5742
  if (f.kind === "psd") {
6445
5743
  try {
6446
- filters.push({ id: typeof f.id === "string" ? f.id : newLayerId("flt"), kind: "psd", enabled: f.enabled !== false, name: typeof f.name === "string" ? f.name : "Filter", data: _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, String(_nullishCoalesce(f.data, () => ( "")))), blend, opacity });
5744
+ filters.push({ id: typeof f.id === "string" ? f.id : newLayerId("flt"), kind: "psd", enabled: f.enabled !== false, name: typeof f.name === "string" ? f.name : "Filter", data: _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, String(_nullishCoalesce(f.data, () => ( "")))), blend, opacity });
6447
5745
  } catch (e10) {
6448
5746
  ctx.problems.push(`${what}: a Photoshop smart filter could not be read`);
6449
5747
  }
@@ -6472,20 +5770,20 @@ function readSmartObject(r, base, ctx) {
6472
5770
  let placement;
6473
5771
  try {
6474
5772
  const raw = { corners: p.corners };
6475
- if (p.warp && _chunkBRKVNXDZcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
6476
- if (_chunkHGTDMKNEcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
5773
+ if (p.warp && _chunkQAUIZPYIcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
5774
+ if (_chunkUOGKSVRQcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
6477
5775
  placement = normalizePlacement(raw, contents);
6478
5776
  } catch (e) {
6479
5777
  ctx.problems.push(`${what}: its placement is invalid (${e instanceof Error ? e.message : String(e)}); it was placed at the top left`);
6480
5778
  placement = { corners: [{ x: 0, y: 0 }, { x: contents.width, y: 0 }, { x: contents.width, y: contents.height }, { x: 0, y: contents.height }] };
6481
5779
  }
6482
- const layer = { ...base, type: "smart", contents, placement, surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
5780
+ const layer = { ...base, type: "smart", contents, placement, surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
6483
5781
  const filters = readSmartFilters(r.smartFilters, ctx, what);
6484
5782
  if (filters) layer.smartFilters = filters;
6485
5783
  if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
6486
5784
  if (r.psd && typeof r.psd.key === "string" && typeof r.psd.data === "string") {
6487
5785
  try {
6488
- layer.psd = { key: r.psd.key, data: _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, r.psd.data) };
5786
+ layer.psd = { key: r.psd.key, data: _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, r.psd.data) };
6489
5787
  if (typeof r.psd.placed === "string") layer.psd.placed = r.psd.placed;
6490
5788
  } catch (e11) {
6491
5789
  }
@@ -6639,9 +5937,9 @@ var PsdReader = class _PsdReader {
6639
5937
  return s.replace(/\u0000+$/, "");
6640
5938
  }
6641
5939
  };
6642
- var PsdWriter = (_class2 = class {constructor() { _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
6643
- __init2() {this.buf = new Uint8Array(1 << 16)}
6644
- __init3() {this.length = 0}
5940
+ var PsdWriter = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
5941
+ __init() {this.buf = new Uint8Array(1 << 16)}
5942
+ __init2() {this.length = 0}
6645
5943
  ensure(n) {
6646
5944
  if (this.length + n <= this.buf.length) return;
6647
5945
  let size = this.buf.length * 2;
@@ -6726,7 +6024,7 @@ var PsdWriter = (_class2 = class {constructor() { _class2.prototype.__init2.call
6726
6024
  result() {
6727
6025
  return this.buf.slice(0, this.length);
6728
6026
  }
6729
- }, _class2);
6027
+ }, _class);
6730
6028
  function decodeLegacyName(b) {
6731
6029
  try {
6732
6030
  return new TextDecoder("utf-8", { fatal: true }).decode(b);
@@ -6937,7 +6235,7 @@ function descriptor(classId, items = []) {
6937
6235
  return { name: "", classId, items };
6938
6236
  }
6939
6237
  function descGet(d, key) {
6940
- return _optionalChain([d, 'access', _188 => _188.items, 'access', _189 => _189.find, 'call', _190 => _190(([k]) => k === key), 'optionalAccess', _191 => _191[1]]);
6238
+ return _optionalChain([d, 'access', _184 => _184.items, 'access', _185 => _185.find, 'call', _186 => _186(([k]) => k === key), 'optionalAccess', _187 => _187[1]]);
6941
6239
  }
6942
6240
  function descNumber(d, key) {
6943
6241
  const v = descGet(d, key);
@@ -6947,7 +6245,7 @@ function descNumber(d, key) {
6947
6245
  }
6948
6246
  function descBool(d, key) {
6949
6247
  const v = descGet(d, key);
6950
- return _optionalChain([v, 'optionalAccess', _192 => _192.type]) === "bool" ? v.value : void 0;
6248
+ return _optionalChain([v, 'optionalAccess', _188 => _188.type]) === "bool" ? v.value : void 0;
6951
6249
  }
6952
6250
  function descObject(d, key) {
6953
6251
  const v = descGet(d, key);
@@ -7643,7 +6941,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
7643
6941
  const fr = (p) => ({ x: p.x / w, y: p.y / h });
7644
6942
  const subpaths = [];
7645
6943
  components.forEach((c, ci) => {
7646
- _chunkBRKVNXDZcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
6944
+ _chunkQAUIZPYIcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
7647
6945
  if (!sp.anchors.length) return;
7648
6946
  subpaths.push({
7649
6947
  closed: sp.closed,
@@ -7662,7 +6960,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
7662
6960
 
7663
6961
  // src/image-editor/psd/channels.ts
7664
6962
  var hexToRgb2 = (hex) => {
7665
- const v = parseInt(_nullishCoalesce(_optionalChain([/^#?([0-9a-f]{6})$/i, 'access', _193 => _193.exec, 'call', _194 => _194(hex), 'optionalAccess', _195 => _195[1]]), () => ( "ff0000")), 16);
6963
+ const v = parseInt(_nullishCoalesce(_optionalChain([/^#?([0-9a-f]{6})$/i, 'access', _189 => _189.exec, 'call', _190 => _190(hex), 'optionalAccess', _191 => _191[1]]), () => ( "ff0000")), 16);
7666
6964
  return [v >> 16 & 255, v >> 8 & 255, v & 255];
7667
6965
  };
7668
6966
  var rgbToHex = (r, g, b) => `#${[r, g, b].map((c) => c.toString(16).padStart(2, "0")).join("")}`;
@@ -7736,16 +7034,16 @@ function readAlphaChannels(planes, header, first, resource2, warn) {
7736
7034
  if (start + size > planes.length) break;
7737
7035
  const d = display[i];
7738
7036
  const name = names[i] || `Alpha ${i + 1}`;
7739
- if (_optionalChain([d, 'optionalAccess', _196 => _196.kind]) === 2) {
7037
+ if (_optionalChain([d, 'optionalAccess', _192 => _192.kind]) === 2) {
7740
7038
  warn(`Spot colour channel "${name}" is not supported and was left out.`);
7741
7039
  continue;
7742
7040
  }
7743
7041
  out.push({
7744
7042
  name,
7745
7043
  data: planeTo8(planes.subarray(start, start + size), n, header.depth),
7746
- color: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _197 => _197.color]), () => ( "#ff0000")),
7747
- opacity: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _198 => _198.opacity]), () => ( 0.5)),
7748
- indicates: _optionalChain([d, 'optionalAccess', _199 => _199.kind]) === 0 ? "selected" : "masked"
7044
+ color: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _193 => _193.color]), () => ( "#ff0000")),
7045
+ opacity: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _194 => _194.opacity]), () => ( 0.5)),
7046
+ indicates: _optionalChain([d, 'optionalAccess', _195 => _195.kind]) === 0 ? "selected" : "masked"
7749
7047
  });
7750
7048
  }
7751
7049
  return out;
@@ -7761,7 +7059,7 @@ var enumV = (typeId, value) => ({ type: "enum", typeId, value });
7761
7059
  var obj = (d) => ({ type: "Objc", value: d });
7762
7060
  var enumOf = (d, key) => {
7763
7061
  const v = descGet(d, key);
7764
- return _optionalChain([v, 'optionalAccess', _200 => _200.type]) === "enum" ? v.value : void 0;
7062
+ return _optionalChain([v, 'optionalAccess', _196 => _196.type]) === "enum" ? v.value : void 0;
7765
7063
  };
7766
7064
  function read(data) {
7767
7065
  try {
@@ -7843,7 +7141,7 @@ function strokeFromVstk(data, dpi, notes) {
7843
7141
  const miter = descNumber(d, "strokeStyleMiterLimit");
7844
7142
  if (miter !== void 0 && miter !== 100) stroke.miterLimit = Math.max(1, Math.min(500, miter));
7845
7143
  const dashes = descGet(d, "strokeStyleLineDashSet");
7846
- if (_optionalChain([dashes, 'optionalAccess', _201 => _201.type]) === "VlLs") {
7144
+ if (_optionalChain([dashes, 'optionalAccess', _197 => _197.type]) === "VlLs") {
7847
7145
  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);
7848
7146
  if (list2.length && list2.some((v) => v > 0)) stroke.dashes = list2;
7849
7147
  }
@@ -7995,7 +7293,7 @@ function vogkBytes(components, dpi) {
7995
7293
  ["keyOriginLineArrowEnd", boolV(Boolean(live.endArrow))],
7996
7294
  ["keyOriginLineArrWdth", dbl(head ? head.width / w * 100 : 0)],
7997
7295
  ["keyOriginLineArrLngth", dbl(head ? head.length / w * 100 : 0)],
7998
- ["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess', _202 => _202.concavity]) ? head.concavity * 100 : 0)]
7296
+ ["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess', _198 => _198.concavity]) ? head.concavity * 100 : 0)]
7999
7297
  ];
8000
7298
  }
8001
7299
  const m = live.transform;
@@ -8028,7 +7326,7 @@ function shapeSignature(layer) {
8028
7326
  return JSON.stringify([layer.components, layer.fill, layer.stroke, _nullishCoalesce(layer.fillRule, () => ( "nonzero")), Boolean(layer.inverted)]);
8029
7327
  }
8030
7328
  function shapeFromBlocks(blocks, width, height, dpi, notes) {
8031
- const block = (k) => _optionalChain([blocks, 'access', _203 => _203.find, 'call', _204 => _204((b) => b.key === k), 'optionalAccess', _205 => _205.data]);
7329
+ const block = (k) => _optionalChain([blocks, 'access', _199 => _199.find, 'call', _200 => _200((b) => b.key === k), 'optionalAccess', _201 => _201.data]);
8032
7330
  const vector = _nullishCoalesce(block("vsms"), () => ( block("vmsk")));
8033
7331
  const path = vector ? componentsFromVectorBlock(vector, width, height) : null;
8034
7332
  if (!path) return null;
@@ -8083,18 +7381,18 @@ function sameExtent(sub, c) {
8083
7381
  return a.every((v, i) => Math.abs(v - b[i]) < 1);
8084
7382
  }
8085
7383
  function shapeBlocks(layer, width, height, dpi, notes) {
8086
- const kept = _optionalChain([layer, 'access', _206 => _206.psd, 'optionalAccess', _207 => _207.blocks]);
8087
- if (_optionalChain([kept, 'optionalAccess', _208 => _208.length]) && _optionalChain([layer, 'access', _209 => _209.psd, 'optionalAccess', _210 => _210.signature]) === shapeSignature(layer)) return kept.map((b) => ({ key: b.key, data: b.data }));
7384
+ const kept = _optionalChain([layer, 'access', _202 => _202.psd, 'optionalAccess', _203 => _203.blocks]);
7385
+ if (_optionalChain([kept, 'optionalAccess', _204 => _204.length]) && _optionalChain([layer, 'access', _205 => _205.psd, 'optionalAccess', _206 => _206.signature]) === shapeSignature(layer)) return kept.map((b) => ({ key: b.key, data: b.data }));
8088
7386
  const out = [];
8089
7387
  out.push({ key: "vsms", data: vectorBlockForComponents(layer.components, Boolean(layer.inverted), width, height) });
8090
7388
  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)");
8091
7389
  const fill = _nullishCoalesce(layer.fill, () => ( { type: "color", color: "#000000" }));
8092
- if (_optionalChain([layer, 'access', _211 => _211.fill, 'optionalAccess', _212 => _212.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)");
7390
+ if (_optionalChain([layer, 'access', _207 => _207.fill, 'optionalAccess', _208 => _208.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)");
8093
7391
  out.push({ key: "vscg", data: vscgBytes(fill) });
8094
7392
  if (layer.stroke || !layer.fill) out.push({ key: "vstk", data: vstkBytes(layer.stroke, Boolean(layer.fill), dpi) });
8095
7393
  const vogk = vogkBytes(layer.components, dpi);
8096
7394
  if (vogk) out.push({ key: "vogk", data: vogk });
8097
- if (layer.components.some((c) => _optionalChain([c, 'access', _213 => _213.live, 'optionalAccess', _214 => _214.kind]) === "line" && (c.live.startArrow && c.live.endArrow && JSON.stringify(c.live.startArrow) !== JSON.stringify(c.live.endArrow) || false))) {
7395
+ if (layer.components.some((c) => _optionalChain([c, 'access', _209 => _209.live, 'optionalAccess', _210 => _210.kind]) === "line" && (c.live.startArrow && c.live.endArrow && JSON.stringify(c.live.startArrow) !== JSON.stringify(c.live.endArrow) || false))) {
8098
7396
  notes.add("Lines with different start and end arrowheads were written with one arrowhead size (Photoshop has one)");
8099
7397
  }
8100
7398
  return out;
@@ -8303,7 +7601,7 @@ var E = {
8303
7601
  bool: (value) => ({ t: "bool", value })
8304
7602
  };
8305
7603
  function eGet(v, key) {
8306
- return _optionalChain([v, 'optionalAccess', _215 => _215.t]) === "dict" ? _optionalChain([v, 'access', _216 => _216.items, 'access', _217 => _217.find, 'call', _218 => _218(([k]) => k === key), 'optionalAccess', _219 => _219[1]]) : void 0;
7604
+ return _optionalChain([v, 'optionalAccess', _211 => _211.t]) === "dict" ? _optionalChain([v, 'access', _212 => _212.items, 'access', _213 => _213.find, 'call', _214 => _214(([k]) => k === key), 'optionalAccess', _215 => _215[1]]) : void 0;
8307
7605
  }
8308
7606
  function ePath(v, keys) {
8309
7607
  return keys.reduce((at, k) => eGet(at, k), v);
@@ -8321,7 +7619,7 @@ function eStr(v) {
8321
7619
  return v && (v.t === "string" || v.t === "name") ? v.value : void 0;
8322
7620
  }
8323
7621
  function eArray(v) {
8324
- return _optionalChain([v, 'optionalAccess', _220 => _220.t]) === "array" ? v.items : [];
7622
+ return _optionalChain([v, 'optionalAccess', _216 => _216.t]) === "array" ? v.items : [];
8325
7623
  }
8326
7624
  function eSet(d, key, value) {
8327
7625
  if (d.t !== "dict") return;
@@ -8423,7 +7721,7 @@ function fontFromPostScript(ps) {
8423
7721
  }
8424
7722
  family += suffix;
8425
7723
  const s = style.toLowerCase();
8426
- const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access', _221 => _221.find, 'call', _222 => _222(([re]) => re.test(s)), 'optionalAccess', _223 => _223[1]]), () => ( 400));
7724
+ const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access', _217 => _217.find, 'call', _218 => _218(([re]) => re.test(s)), 'optionalAccess', _219 => _219[1]]), () => ( 400));
8427
7725
  return { family: family || ps, weight, italic: /italic|oblique|it$/.test(s) };
8428
7726
  }
8429
7727
  var STYLE_NAMES = [
@@ -8448,7 +7746,7 @@ var hex2 = (v) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).pad
8448
7746
  function merged(levels) {
8449
7747
  const items = [];
8450
7748
  for (const l of levels) {
8451
- if (_optionalChain([l, 'optionalAccess', _224 => _224.t]) !== "dict") continue;
7749
+ if (_optionalChain([l, 'optionalAccess', _220 => _220.t]) !== "dict") continue;
8452
7750
  for (const [k, v] of l.items) if (!items.some(([o]) => o === k)) items.push([k, v]);
8453
7751
  }
8454
7752
  return E.dict(items);
@@ -8456,7 +7754,7 @@ function merged(levels) {
8456
7754
  function charStyle(d, fonts, notes, vertical = false) {
8457
7755
  const n = (k) => eNum(eGet(d, k));
8458
7756
  const flag = (k) => eBool(eGet(d, k));
8459
- const s = { ..._chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE };
7757
+ const s = { ..._chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE };
8460
7758
  const fi = n("Font");
8461
7759
  const ps = fi !== void 0 ? fonts[fi] : void 0;
8462
7760
  if (ps) {
@@ -8521,10 +7819,10 @@ function typeFromTySh(data, notes) {
8521
7819
  const t = parseTySh(data);
8522
7820
  if (!t) return null;
8523
7821
  const txtV = descGet(t.text, "Txt ");
8524
- const txt = _optionalChain([txtV, 'optionalAccess', _225 => _225.type]) === "TEXT" ? txtV.value.replace(/\0+$/, "") : void 0;
7822
+ const txt = _optionalChain([txtV, 'optionalAccess', _221 => _221.type]) === "TEXT" ? txtV.value.replace(/\0+$/, "") : void 0;
8525
7823
  const ed = descGet(t.text, "EngineData");
8526
7824
  let engine = null;
8527
- if (_optionalChain([ed, 'optionalAccess', _226 => _226.type]) === "tdta") {
7825
+ if (_optionalChain([ed, 'optionalAccess', _222 => _222.type]) === "tdta") {
8528
7826
  try {
8529
7827
  engine = parseEngineData(ed.data);
8530
7828
  } catch (e18) {
@@ -8532,16 +7830,16 @@ function typeFromTySh(data, notes) {
8532
7830
  }
8533
7831
  }
8534
7832
  const anti = descGet(t.text, "AntA");
8535
- const antiAlias = !(_optionalChain([anti, 'optionalAccess', _227 => _227.type]) === "enum" && (anti.value === "Anno" || anti.value === "antiAliasNone"));
7833
+ const antiAlias = !(_optionalChain([anti, 'optionalAccess', _223 => _223.type]) === "enum" && (anti.value === "Anno" || anti.value === "antiAliasNone"));
8536
7834
  const ornt = descGet(t.text, "Ornt");
8537
- const vertical = _optionalChain([ornt, 'optionalAccess', _228 => _228.type]) === "enum" && ornt.value === "Vrtc";
7835
+ const vertical = _optionalChain([ornt, 'optionalAccess', _224 => _224.type]) === "enum" && ornt.value === "Vrtc";
8538
7836
  if (t.warp) {
8539
7837
  const style = descGet(t.warp, "warpStyle");
8540
- if (_optionalChain([style, 'optionalAccess', _229 => _229.type]) === "enum" && style.value !== "warpNone") notes.add("warped text is drawn without its warp when edited");
7838
+ if (_optionalChain([style, 'optionalAccess', _225 => _225.type]) === "enum" && style.value !== "warpNone") notes.add("warped text is drawn without its warp when edited");
8541
7839
  }
8542
7840
  const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
8543
7841
  const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
8544
- let runs = [{ length: text3.length, style: { ..._chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE } }];
7842
+ let runs = [{ length: text3.length, style: { ..._chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE } }];
8545
7843
  let paragraphs = [{ length: text3.length, style: {} }];
8546
7844
  let frame = { kind: "point" };
8547
7845
  let transform = t.transform;
@@ -8586,7 +7884,7 @@ function typeFromTySh(data, notes) {
8586
7884
  let at = 0;
8587
7885
  runs = ssheets.map((sheet, i) => {
8588
7886
  const own = named(styleSet, sheet);
8589
- const paraDefault = _optionalChain([paraBases, 'access', _230 => _230[paraAt(at)], 'optionalAccess', _231 => _231.charDefault]);
7887
+ const paraDefault = _optionalChain([paraBases, 'access', _226 => _226[paraAt(at)], 'optionalAccess', _227 => _227.charDefault]);
8590
7888
  at += _nullishCoalesce(slens[i], () => ( 0));
8591
7889
  const d = merged([eGet(sheet, "StyleSheetData"), eGet(own, "StyleSheetData"), eGet(paraDefault, "StyleSheetData"), eGet(normalStyle, "StyleSheetData")]);
8592
7890
  return { length: _nullishCoalesce(slens[i], () => ( 0)), style: charStyle(d, fonts, notes, vertical) };
@@ -8597,14 +7895,14 @@ function typeFromTySh(data, notes) {
8597
7895
  const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
8598
7896
  if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
8599
7897
  frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
8600
- transform = _chunkBRKVNXDZcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
7898
+ transform = _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
8601
7899
  }
8602
7900
  }
8603
7901
  }
8604
7902
  return {
8605
7903
  text: text3,
8606
- runs: _chunkBRKVNXDZcjs.fitRuns.call(void 0, runs, text3.length, _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE),
8607
- paragraphs: _chunkBRKVNXDZcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
7904
+ runs: _chunkQAUIZPYIcjs.fitRuns.call(void 0, runs, text3.length, _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE),
7905
+ paragraphs: _chunkQAUIZPYIcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
8608
7906
  frame,
8609
7907
  orientation: vertical ? "vertical" : "horizontal",
8610
7908
  transform,
@@ -8667,8 +7965,8 @@ var fontEntry = (name) => E.dict([
8667
7965
  ["Synthetic", E.int(0)]
8668
7966
  ]);
8669
7967
  function buildEngineData(layer, template) {
8670
- const e = _optionalChain([template, 'optionalAccess', _232 => _232.t]) === "dict" ? eClone(template) : E.dict([["EngineDict", E.dict()], ["ResourceDict", E.dict()]]);
8671
- if (_optionalChain([eGet, 'call', _233 => _233(e, "EngineDict"), 'optionalAccess', _234 => _234.t]) !== "dict") eSet(e, "EngineDict", E.dict());
7968
+ const e = _optionalChain([template, 'optionalAccess', _228 => _228.t]) === "dict" ? eClone(template) : E.dict([["EngineDict", E.dict()], ["ResourceDict", E.dict()]]);
7969
+ if (_optionalChain([eGet, 'call', _229 => _229(e, "EngineDict"), 'optionalAccess', _230 => _230.t]) !== "dict") eSet(e, "EngineDict", E.dict());
8672
7970
  const dict = eGet(e, "EngineDict");
8673
7971
  const text3 = layer.text.replace(/\n/g, "\r");
8674
7972
  const edText = `${text3}\r`;
@@ -8680,7 +7978,7 @@ function buildEngineData(layer, template) {
8680
7978
  fonts.push(ps);
8681
7979
  return fonts.length - 1;
8682
7980
  };
8683
- const runs = _chunkBRKVNXDZcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE);
7981
+ const runs = _chunkQAUIZPYIcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE);
8684
7982
  const vertical = layer.orientation === "vertical";
8685
7983
  const sruns = [];
8686
7984
  const slens = [];
@@ -8689,10 +7987,10 @@ function buildEngineData(layer, template) {
8689
7987
  slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
8690
7988
  });
8691
7989
  if (!runs.length) {
8692
- sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE)))]])]]));
7990
+ sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)))]])]]));
8693
7991
  slens.push(E.int(1));
8694
7992
  }
8695
- const paras = _chunkBRKVNXDZcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
7993
+ const paras = _chunkQAUIZPYIcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
8696
7994
  const pruns = [];
8697
7995
  const plens = [];
8698
7996
  paras.forEach((p, i) => {
@@ -8748,7 +8046,7 @@ function buildEngineData(layer, template) {
8748
8046
  eSet(e, key, rd);
8749
8047
  }
8750
8048
  eSet(rd, "FontSet", fontSet);
8751
- if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _235 => _235[0], 'optionalAccess', _236 => _236.style]), () => ( _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
8049
+ if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _231 => _231[0], 'optionalAccess', _232 => _232.style]), () => ( _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
8752
8050
  if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
8753
8051
  if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
8754
8052
  if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
@@ -8757,24 +8055,24 @@ function buildEngineData(layer, template) {
8757
8055
  }
8758
8056
  function inkBounds2(layer) {
8759
8057
  if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
8760
- const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
8058
+ const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
8761
8059
  if (!b) return [0, 0, 0, 0];
8762
- const inv = _chunkBRKVNXDZcjs.invertMatrix.call(void 0, textMatrix(layer));
8060
+ const inv = _chunkQAUIZPYIcjs.invertMatrix.call(void 0, textMatrix(layer));
8763
8061
  const pts = [
8764
8062
  { x: b.x, y: b.y },
8765
8063
  { x: b.x + b.width, y: b.y },
8766
8064
  { x: b.x + b.width, y: b.y + b.height },
8767
8065
  { x: b.x, y: b.y + b.height }
8768
- ].map((p) => _chunkBRKVNXDZcjs.applyMatrix.call(void 0, inv, p));
8066
+ ].map((p) => _chunkQAUIZPYIcjs.applyMatrix.call(void 0, inv, p));
8769
8067
  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))];
8770
8068
  }
8771
8069
  function tyShForLayer(layer) {
8772
- const raw = _optionalChain([layer, 'access', _237 => _237.psd, 'optionalAccess', _238 => _238.tySh]);
8773
- if (raw && _optionalChain([layer, 'access', _239 => _239.psd, 'optionalAccess', _240 => _240.signature]) === typeSignature(layer)) return raw;
8070
+ const raw = _optionalChain([layer, 'access', _233 => _233.psd, 'optionalAccess', _234 => _234.tySh]);
8071
+ if (raw && _optionalChain([layer, 'access', _235 => _235.psd, 'optionalAccess', _236 => _236.signature]) === typeSignature(layer)) return raw;
8774
8072
  const old = raw ? parseTySh(raw) : null;
8775
8073
  const oldEd = old ? descGet(old.text, "EngineData") : void 0;
8776
8074
  let template = null;
8777
- if (_optionalChain([oldEd, 'optionalAccess', _241 => _241.type]) === "tdta") {
8075
+ if (_optionalChain([oldEd, 'optionalAccess', _237 => _237.type]) === "tdta") {
8778
8076
  try {
8779
8077
  template = parseEngineData(oldEd.data);
8780
8078
  } catch (e19) {
@@ -8806,8 +8104,8 @@ function tyShForLayer(layer) {
8806
8104
  set("boundingBox", rect("boundingBox"));
8807
8105
  if (!descGet(text3, "TextIndex")) set("TextIndex", { type: "long", value: 0 });
8808
8106
  set("EngineData", { type: "tdta", data: writeEngineData(engine) });
8809
- const warpStyle = _optionalChain([old, 'optionalAccess', _242 => _242.warp]) ? descGet(old.warp, "warpStyle") : void 0;
8810
- const warp = _optionalChain([old, 'optionalAccess', _243 => _243.warp]) && _optionalChain([warpStyle, 'optionalAccess', _244 => _244.type]) === "enum" && warpStyle.value === "warpNone" ? old.warp : null;
8107
+ const warpStyle = _optionalChain([old, 'optionalAccess', _238 => _238.warp]) ? descGet(old.warp, "warpStyle") : void 0;
8108
+ const warp = _optionalChain([old, 'optionalAccess', _239 => _239.warp]) && _optionalChain([warpStyle, 'optionalAccess', _240 => _240.type]) === "enum" && warpStyle.value === "warpNone" ? old.warp : null;
8811
8109
  return writeTySh({ transform: textMatrix(layer), text: text3, warp, tail: new Uint8Array(16) });
8812
8110
  }
8813
8111
 
@@ -8821,15 +8119,15 @@ var textV = (value) => ({ type: "TEXT", value });
8821
8119
  var obj2 = (d) => ({ type: "Objc", value: d });
8822
8120
  var text = (d, key) => {
8823
8121
  const v = descGet(d, key);
8824
- return _optionalChain([v, 'optionalAccess', _245 => _245.type]) === "TEXT" ? v.value : void 0;
8122
+ return _optionalChain([v, 'optionalAccess', _241 => _241.type]) === "TEXT" ? v.value : void 0;
8825
8123
  };
8826
8124
  var enumOf2 = (d, key) => {
8827
8125
  const v = descGet(d, key);
8828
- return _optionalChain([v, 'optionalAccess', _246 => _246.type]) === "enum" ? v.value : void 0;
8126
+ return _optionalChain([v, 'optionalAccess', _242 => _242.type]) === "enum" ? v.value : void 0;
8829
8127
  };
8830
8128
  var numbers = (d, key) => {
8831
8129
  const v = descGet(d, key);
8832
- if (_optionalChain([v, 'optionalAccess', _247 => _247.type]) !== "VlLs") return null;
8130
+ if (_optionalChain([v, 'optionalAccess', _243 => _243.type]) !== "VlLs") return null;
8833
8131
  const out = [];
8834
8132
  for (const it of v.items) {
8835
8133
  if (it.type === "doub" || it.type === "UntF" || it.type === "long") out.push(it.value);
@@ -9017,21 +8315,21 @@ function filterMaskFromItem(item) {
9017
8315
  const height = rect.bottom - rect.top;
9018
8316
  if (!(width > 0 && height > 0) || width * height > 1 << 28) return null;
9019
8317
  const bytes = decodePlanes(plane.compression, plane.data, { planes: 1, width, height, depth: 8, psb: true });
9020
- const surface = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width, height, data: bytes }, 1, rect.left, rect.top, 255);
8318
+ const surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width, height, data: bytes }, 1, rect.left, rect.top, 255);
9021
8319
  return { surface, defaultValue: 255 };
9022
8320
  }
9023
8321
  function filterMaskItem(placed, mask, area) {
9024
- const painted = _chunkCWM3CUUXcjs.contentBounds.call(void 0, mask.surface);
8322
+ const painted = _chunk474IQG74cjs.contentBounds.call(void 0, mask.surface);
9025
8323
  let b = _nullishCoalesce(painted, () => ( { x: 0, y: 0, width: 1, height: 1 }));
9026
8324
  if (mask.defaultValue !== 255 && area) {
9027
- const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _248 => _248.x]), () => ( area.x)));
9028
- const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _249 => _249.y]), () => ( area.y)));
8325
+ const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _244 => _244.x]), () => ( area.x)));
8326
+ const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _245 => _245.y]), () => ( area.y)));
9029
8327
  const x1 = Math.max(area.x + area.width, painted ? painted.x + painted.width : 0);
9030
8328
  const y1 = Math.max(area.y + area.height, painted ? painted.y + painted.height : 0);
9031
8329
  b = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
9032
8330
  }
9033
8331
  const rect = { top: b.y, left: b.x, bottom: b.y + b.height, right: b.x + b.width };
9034
- const values = _chunkCWM3CUUXcjs.readRegion.call(void 0, mask.surface, b);
8332
+ const values = _chunk474IQG74cjs.readRegion.call(void 0, mask.surface, b);
9035
8333
  const plane = new Uint8Array(values.buffer, values.byteOffset, values.length);
9036
8334
  return {
9037
8335
  id: placed,
@@ -9045,8 +8343,8 @@ function filterMaskItem(placed, mask, area) {
9045
8343
  }
9046
8344
  var warpStyleOf = (name) => {
9047
8345
  if (!name.startsWith("warp")) return null;
9048
- const s = _optionalChain([name, 'access', _250 => _250[4], 'optionalAccess', _251 => _251.toLowerCase, 'call', _252 => _252()]) + name.slice(5);
9049
- return _chunkBRKVNXDZcjs.WARP_STYLES.includes(s) ? s : null;
8346
+ const s = _optionalChain([name, 'access', _246 => _246[4], 'optionalAccess', _247 => _247.toLowerCase, 'call', _248 => _248()]) + name.slice(5);
8347
+ return _chunkQAUIZPYIcjs.WARP_STYLES.includes(s) ? s : null;
9050
8348
  };
9051
8349
  function warpFromDescriptor(w, contents) {
9052
8350
  const full = { x: 0, y: 0, width: contents.width, height: contents.height };
@@ -9067,7 +8365,7 @@ function warpFromDescriptor(w, contents) {
9067
8365
  if (!arr || arr.type !== "ObAr") return void 0;
9068
8366
  const xs = descGet(arr.body, "Hrzn");
9069
8367
  const ys = descGet(arr.body, "Vrtc");
9070
- if (_optionalChain([xs, 'optionalAccess', _253 => _253.type]) !== "UnFl" || _optionalChain([ys, 'optionalAccess', _254 => _254.type]) !== "UnFl" || xs.values.length !== 16 || ys.values.length !== 16) return void 0;
8368
+ if (_optionalChain([xs, 'optionalAccess', _249 => _249.type]) !== "UnFl" || _optionalChain([ys, 'optionalAccess', _250 => _250.type]) !== "UnFl" || xs.values.length !== 16 || ys.values.length !== 16) return void 0;
9071
8369
  mesh = { us: [0, 1], vs: [0, 1], points: xs.values.map((x, i) => ({ x, y: ys.values[i] })) };
9072
8370
  const px2 = mesh.points.map((p) => p.x);
9073
8371
  const py = mesh.points.map((p) => p.y);
@@ -9076,7 +8374,7 @@ function warpFromDescriptor(w, contents) {
9076
8374
  } else {
9077
8375
  const style = warpStyleOf(styleName);
9078
8376
  if (!style) return void 0;
9079
- mesh = _chunkBRKVNXDZcjs.warpPresetMesh.call(void 0,
8377
+ mesh = _chunkQAUIZPYIcjs.warpPresetMesh.call(void 0,
9080
8378
  {
9081
8379
  style,
9082
8380
  bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
@@ -9091,7 +8389,7 @@ function warpFromDescriptor(w, contents) {
9091
8389
  const same = Math.abs(bounds.x) < 1e-6 && Math.abs(bounds.y) < 1e-6 && Math.abs(bounds.width - contents.width) < 1e-6 && Math.abs(bounds.height - contents.height) < 1e-6;
9092
8390
  if (!same) {
9093
8391
  const m = mesh;
9094
- mesh = _chunkBRKVNXDZcjs.fitWarpMesh.call(void 0, (s, t) => _chunkBRKVNXDZcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
8392
+ mesh = _chunkQAUIZPYIcjs.fitWarpMesh.call(void 0, (s, t) => _chunkQAUIZPYIcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
9095
8393
  }
9096
8394
  return { mesh, frame };
9097
8395
  }
@@ -9234,13 +8532,13 @@ function blendOptions(f) {
9234
8532
  function smartFiltersFromPsd(fx, newId, notes) {
9235
8533
  const filters = [];
9236
8534
  const list2 = descGet(fx, "filterFXList");
9237
- for (const v of _optionalChain([list2, 'optionalAccess', _255 => _255.type]) === "VlLs" ? list2.items : []) {
8535
+ for (const v of _optionalChain([list2, 'optionalAccess', _251 => _251.type]) === "VlLs" ? list2.items : []) {
9238
8536
  if (v.type !== "Objc" && v.type !== "GlbO") continue;
9239
8537
  const item = v.value;
9240
8538
  const { blend, opacity } = blendOptionsOf(item);
9241
8539
  const enabled = descBool(item, "enab") !== false;
9242
8540
  const fltr = descObject(item, "Fltr");
9243
- const radius = _optionalChain([fltr, 'optionalAccess', _256 => _256.classId]) === BOX_BLUR.classId ? descNumber(fltr, "Rds ") : void 0;
8541
+ const radius = _optionalChain([fltr, 'optionalAccess', _252 => _252.classId]) === BOX_BLUR.classId ? descNumber(fltr, "Rds ") : void 0;
9244
8542
  if (radius !== void 0 && radius >= 0 && radius <= 50) {
9245
8543
  filters.push({ id: newId(), kind: "blur", enabled, radius, blend, opacity });
9246
8544
  continue;
@@ -9593,7 +8891,7 @@ function readPsd(bytes) {
9593
8891
  return { header, colorModeData, resources, layers, mergedAlpha, globalBlocks, imageCompression, imageData: r.rest() };
9594
8892
  }
9595
8893
  function layerBlock(rec, key) {
9596
- return _optionalChain([rec, 'access', _257 => _257.blocks, 'access', _258 => _258.find, 'call', _259 => _259((b) => b.key === key), 'optionalAccess', _260 => _260.data]);
8894
+ return _optionalChain([rec, 'access', _253 => _253.blocks, 'access', _254 => _254.find, 'call', _255 => _255((b) => b.key === key), 'optionalAccess', _256 => _256.data]);
9597
8895
  }
9598
8896
  function layerName(rec) {
9599
8897
  const luni = layerBlock(rec, "luni");
@@ -9624,7 +8922,7 @@ function u8Block(rec, key) {
9624
8922
  function layerTree(file) {
9625
8923
  const stack = [[]];
9626
8924
  file.layers.forEach((rec, index) => {
9627
- const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _261 => _261(rec), 'optionalAccess', _262 => _262.kind]), () => ( SECTION_OTHER));
8925
+ const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _257 => _257(rec), 'optionalAccess', _258 => _258.kind]), () => ( SECTION_OTHER));
9628
8926
  if (kind === SECTION_DIVIDER) {
9629
8927
  stack.push([]);
9630
8928
  } else if (kind === SECTION_OPEN || kind === SECTION_CLOSED) {
@@ -9642,7 +8940,7 @@ function layerTree(file) {
9642
8940
  }
9643
8941
  function channelRect(rec, id) {
9644
8942
  if (id === CHANNEL_USER_MASK && rec.mask) return rec.mask.rect;
9645
- if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _263 => _263.mask, 'access', _264 => _264.real, 'optionalAccess', _265 => _265.rect]), () => ( rec.mask.rect));
8943
+ if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _259 => _259.mask, 'access', _260 => _260.real, 'optionalAccess', _261 => _261.rect]), () => ( rec.mask.rect));
9646
8944
  return rec.rect;
9647
8945
  }
9648
8946
  function decodeLayerChannel(file, rec, id) {
@@ -9660,7 +8958,7 @@ function decodeMergedImage(file) {
9660
8958
  return decodePlanes(file.imageCompression, file.imageData, { planes: channels, width, height, depth, psb });
9661
8959
  }
9662
8960
  function resource(file, id) {
9663
- return _optionalChain([file, 'access', _266 => _266.resources, 'access', _267 => _267.find, 'call', _268 => _268((r) => r.id === id), 'optionalAccess', _269 => _269.data]);
8961
+ return _optionalChain([file, 'access', _262 => _262.resources, 'access', _263 => _263.find, 'call', _264 => _264((r) => r.id === id), 'optionalAccess', _265 => _265.data]);
9664
8962
  }
9665
8963
  function resolution(file) {
9666
8964
  const d = resource(file, 1005);
@@ -10263,9 +9561,9 @@ var SMART_KEYS = ["SoLd", "SoLE", "PlLd"];
10263
9561
  var VECTOR_KEYS = ["vmsk", "vsms"];
10264
9562
  var MAX_CONTENTS_DEPTH = 6;
10265
9563
  var percent = (v) => Math.round(v / 255 * 100) / 100;
10266
- var Warnings = (_class3 = class {constructor() { _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this); }
10267
- __init4() {this.groups = /* @__PURE__ */ new Map()}
10268
- __init5() {this.extra = []}
9564
+ var Warnings = (_class2 = class {constructor() { _class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this); }
9565
+ __init3() {this.groups = /* @__PURE__ */ new Map()}
9566
+ __init4() {this.extra = []}
10269
9567
  add(message, layer) {
10270
9568
  const list2 = _nullishCoalesce(this.groups.get(message), () => ( []));
10271
9569
  if (!list2.includes(layer)) list2.push(layer);
@@ -10280,7 +9578,7 @@ var Warnings = (_class3 = class {constructor() { _class3.prototype.__init4.call(
10280
9578
  }
10281
9579
  return out;
10282
9580
  }
10283
- }, _class3);
9581
+ }, _class2);
10284
9582
  function psdKind(rec) {
10285
9583
  if (rec.blocks.some((b) => TYPE_KEYS.includes(b.key))) return "type";
10286
9584
  if (rec.blocks.some((b) => SMART_KEYS.includes(b.key))) return "smart-object";
@@ -10320,11 +9618,11 @@ function safeSize(ctx, rect, name) {
10320
9618
  }
10321
9619
  function recordPixels(ctx, rec, name) {
10322
9620
  const { width, height } = safeSize(ctx, rec.rect, name);
10323
- if (!width || !height || ctx.skipPixels) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4);
9621
+ if (!width || !height || ctx.skipPixels) return _chunk474IQG74cjs.emptySurface.call(void 0, 4);
10324
9622
  const ids = [...Array.from({ length: ctx.colorCount }, (_, i) => i), CHANNEL_ALPHA];
10325
9623
  const planes = ids.map((id) => rec.channels.some((c) => c.id === id) ? _nullishCoalesce(decodeOr(ctx, rec, id, name), () => ( null)) : void 0);
10326
- if (planes.some((p) => p === null)) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4);
10327
- if (planes.every((p) => p === void 0)) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4);
9624
+ if (planes.some((p) => p === null)) return _chunk474IQG74cjs.emptySurface.call(void 0, 4);
9625
+ if (planes.every((p) => p === void 0)) return _chunk474IQG74cjs.emptySurface.call(void 0, 4);
10328
9626
  const set = {
10329
9627
  width,
10330
9628
  height,
@@ -10337,8 +9635,8 @@ function recordPixels(ctx, rec, name) {
10337
9635
  cmykToRgb16: ctx.cmykToRgb16
10338
9636
  };
10339
9637
  const deep = set.cmykToRgb && !set.cmykToRgb16 ? null : toRgbaDeep(set);
10340
- if (deep) return _chunkCWM3CUUXcjs.surfaceFromDeepPixels.call(void 0, { width, height, data: deep }, 4, rec.rect.left, rec.rect.top);
10341
- return _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width, height, data: toRgba8(set) }, 4, rec.rect.left, rec.rect.top);
9638
+ if (deep) return _chunkOLNIPTB3cjs.surfaceFromDeepPixels.call(void 0, { width, height, data: deep }, 4, rec.rect.left, rec.rect.top);
9639
+ return _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width, height, data: toRgba8(set) }, 4, rec.rect.left, rec.rect.top);
10342
9640
  }
10343
9641
  function recordMask(ctx, rec, name) {
10344
9642
  const m = rec.mask;
@@ -10349,13 +9647,13 @@ function recordMask(ctx, rec, name) {
10349
9647
  const rect = useReal ? m.real.rect : m.rect;
10350
9648
  const def = (useReal ? m.real.background : m.defaultColor) >= 128 ? 255 : 0;
10351
9649
  const flags = useReal ? m.real.flags : m.flags;
10352
- let surface = _chunkCWM3CUUXcjs.emptySurface.call(void 0, 1, def);
9650
+ let surface = _chunk474IQG74cjs.emptySurface.call(void 0, 1, def);
10353
9651
  const { width, height } = safeSize(ctx, rect, name);
10354
9652
  if (width && height && !ctx.skipPixels) {
10355
9653
  const plane = decodeOr(ctx, rec, id, name);
10356
9654
  const depth = ctx.file.header.depth;
10357
- if (plane && (depth === 16 || depth === 32)) surface = _chunkCWM3CUUXcjs.surfaceFromDeepPixels.call(void 0, { width, height, data: toMaskDeep(plane, width, height, depth) }, 1, rect.left, rect.top, def);
10358
- else if (plane) surface = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width, height, data: toMask8(plane, width, height, depth) }, 1, rect.left, rect.top, def);
9655
+ if (plane && (depth === 16 || depth === 32)) surface = _chunkOLNIPTB3cjs.surfaceFromDeepPixels.call(void 0, { width, height, data: toMaskDeep(plane, width, height, depth) }, 1, rect.left, rect.top, def);
9656
+ else if (plane) surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width, height, data: toMask8(plane, width, height, depth) }, 1, rect.left, rect.top, def);
10359
9657
  }
10360
9658
  const mask = { surface, defaultValue: def };
10361
9659
  if (m.userDensity !== void 0 && m.userDensity < 255) mask.density = percent(m.userDensity);
@@ -10396,8 +9694,8 @@ function baseProps(ctx, rec, name, notes) {
10396
9694
  if (read2.flags & VMSK_NOT_LINKED) vm.linked = false;
10397
9695
  if (read2.flags & VMSK_DISABLED) vm.enabled = false;
10398
9696
  const m = rec.mask;
10399
- if (_optionalChain([m, 'optionalAccess', _270 => _270.vectorDensity]) !== void 0 && m.vectorDensity < 255) vm.density = percent(m.vectorDensity);
10400
- if (_optionalChain([m, 'optionalAccess', _271 => _271.vectorFeather]) !== void 0 && m.vectorFeather > 0) vm.feather = Math.min(1e3, m.vectorFeather);
9697
+ if (_optionalChain([m, 'optionalAccess', _266 => _266.vectorDensity]) !== void 0 && m.vectorDensity < 255) vm.density = percent(m.vectorDensity);
9698
+ if (_optionalChain([m, 'optionalAccess', _267 => _267.vectorFeather]) !== void 0 && m.vectorFeather > 0) vm.feather = Math.min(1e3, m.vectorFeather);
10401
9699
  props.vectorMask = vm;
10402
9700
  } else {
10403
9701
  ctx.warn.add("A vector mask could not be read and was ignored", name);
@@ -10428,7 +9726,7 @@ function recordEffects(ctx, rec, name, notes, group) {
10428
9726
  }
10429
9727
  for (const e of parsed.effects.items) {
10430
9728
  for (const id of patternIds(e)) {
10431
- if (ctx.patterns.has(id) || _chunkHGTDMKNEcjs.builtinPattern.call(void 0, id)) continue;
9729
+ if (ctx.patterns.has(id) || _chunkUOGKSVRQcjs.builtinPattern.call(void 0, id)) continue;
10432
9730
  ctx.warn.add("A pattern effect uses a pattern the file does not contain, and paints nothing", name);
10433
9731
  notes.push(`pattern "${id}" is not in the file`);
10434
9732
  }
@@ -10457,7 +9755,7 @@ function importNode(ctx, node, depth) {
10457
9755
  if (node.children) {
10458
9756
  const props2 = baseProps(ctx, rec, name, notes);
10459
9757
  const divider = sectionDivider(rec);
10460
- const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _272 => _272.blendKey]), () => ( rec.blendKey));
9758
+ const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _268 => _268.blendKey]), () => ( rec.blendKey));
10461
9759
  const groupBlend = key === "pass" ? "pass-through" : _nullishCoalesce(PSD_BLEND_KEYS[key], () => ( "normal"));
10462
9760
  const children = [];
10463
9761
  for (const child of node.children) {
@@ -10467,7 +9765,7 @@ function importNode(ctx, node, depth) {
10467
9765
  const group = { type: "group", id: ctx.newId(name), ...props2, blend: groupBlend, children };
10468
9766
  const effects2 = recordEffects(ctx, rec, name, notes, true);
10469
9767
  if (effects2) group.effects = effects2;
10470
- if (_optionalChain([divider, 'optionalAccess', _273 => _273.kind]) === SECTION_CLOSED) group.collapsed = true;
9768
+ if (_optionalChain([divider, 'optionalAccess', _269 => _269.kind]) === SECTION_CLOSED) group.collapsed = true;
10471
9769
  const mask2 = recordMask(ctx, rec, name);
10472
9770
  if (mask2) group.mask = mask2;
10473
9771
  entry.type = "group";
@@ -10507,7 +9805,7 @@ function importNode(ctx, node, depth) {
10507
9805
  if (!file || file.kind !== "liFD") notes.push("linked contents come in as the stored pixels");
10508
9806
  entry.type = "smart";
10509
9807
  entry.status = notes.length ? "approximated" : "mapped";
10510
- return { type: "pixel", id: ctx.newId(name), ...props, surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
9808
+ return { type: "pixel", id: ctx.newId(name), ...props, surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
10511
9809
  }
10512
9810
  }
10513
9811
  if (kind === "smart-object" && !ctx.skipPixels) {
@@ -10570,7 +9868,7 @@ function importShape(ctx, rec, name, notes, props) {
10570
9868
  components: data.components,
10571
9869
  fill: data.fill,
10572
9870
  stroke: data.stroke,
10573
- surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
9871
+ surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
10574
9872
  offset: { x: 0, y: 0 }
10575
9873
  };
10576
9874
  if (data.inverted) layer.inverted = true;
@@ -10639,8 +9937,8 @@ function contentsFor(ctx, placed, name, notes) {
10639
9937
  document: { layers: nested.layers, globalLight: nested.globalLight, patterns: nested.patterns.length ? nested.patterns : void 0 }
10640
9938
  };
10641
9939
  } else if (t.ext === "png") {
10642
- const png = _chunkCWM3CUUXcjs.decodePng.call(void 0, file.bytes);
10643
- out = { ...base, kind: "raster", width: png.width, height: png.height, raster: _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, png, 4, 0, 0) };
9940
+ const png = _chunkOLNIPTB3cjs.decodePng.call(void 0, file.bytes);
9941
+ out = { ...base, kind: "raster", width: png.width, height: png.height, raster: _chunk474IQG74cjs.surfaceFromPixels.call(void 0, png, 4, 0, 0) };
10644
9942
  } else {
10645
9943
  const size = _nullishCoalesce(placed.size, () => ( { width: 0, height: 0 }));
10646
9944
  if (!(size.width > 0 && size.height > 0)) throw new PsdError("the contents have no stored size");
@@ -10681,7 +9979,7 @@ function importSmart(ctx, rec, name, notes, props) {
10681
9979
  if (placement && (size.width !== contents.width || size.height !== contents.height)) {
10682
9980
  const kx = contents.width / size.width;
10683
9981
  const ky = contents.height / size.height;
10684
- if (placement.warp) placement = { ...placement, warp: _chunkBRKVNXDZcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
9982
+ if (placement.warp) placement = { ...placement, warp: _chunkQAUIZPYIcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
10685
9983
  }
10686
9984
  }
10687
9985
  if (!contents || !placement) {
@@ -10691,11 +9989,11 @@ function importSmart(ctx, rec, name, notes, props) {
10691
9989
  const file = ctx.linked.get(placed.idnt);
10692
9990
  contents = {
10693
9991
  id: placed.idnt || ctx.newId(`${name}-contents`),
10694
- name: _optionalChain([file, 'optionalAccess', _274 => _274.name]) || `${name}.png`,
9992
+ name: _optionalChain([file, 'optionalAccess', _270 => _270.name]) || `${name}.png`,
10695
9993
  width,
10696
9994
  height,
10697
9995
  kind: "raster",
10698
- raster: _chunkCWM3CUUXcjs.translateSurface.call(void 0, surface, -rec.rect.left, -rec.rect.top)
9996
+ raster: _chunk474IQG74cjs.translateSurface.call(void 0, surface, -rec.rect.left, -rec.rect.top)
10699
9997
  };
10700
9998
  if (file && file.kind !== "liFD") {
10701
9999
  contents.linked = { path: _nullishCoalesce(file.path, () => ( file.name)) };
@@ -10765,11 +10063,11 @@ function mergedLayer(ctx) {
10765
10063
  };
10766
10064
  const deep = hasAlpha || set.cmykToRgb && !set.cmykToRgb16 ? null : toRgbaDeep(set);
10767
10065
  let surface;
10768
- if (deep) surface = _chunkCWM3CUUXcjs.surfaceFromDeepPixels.call(void 0, { width, height, data: deep }, 4);
10066
+ if (deep) surface = _chunkOLNIPTB3cjs.surfaceFromDeepPixels.call(void 0, { width, height, data: deep }, 4);
10769
10067
  else {
10770
10068
  const data = toRgba8(set);
10771
10069
  if (hasAlpha) unmatteWhite(data);
10772
- surface = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4);
10070
+ surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width, height, data }, 4);
10773
10071
  }
10774
10072
  return {
10775
10073
  type: "pixel",
@@ -10848,7 +10146,7 @@ function psdToLayers(file, options = {}) {
10848
10146
  if (mode !== "rgb" && header.depth > 8 && header.colorMode !== MODE_INDEXED && header.colorMode !== MODE_BITMAP) {
10849
10147
  warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to ${header.depth}-bit RGB.`);
10850
10148
  } else if (mode !== "rgb" || header.depth !== 8 && header.depth !== 16 && header.depth !== 32) {
10851
- const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess', _275 => _275.name]), () => ( "its profile"))}` : "";
10149
+ const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess', _271 => _271.name]), () => ( "its profile"))}` : "";
10852
10150
  warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to 8-bit RGB${how}.`);
10853
10151
  }
10854
10152
  let layers = [];
@@ -10965,15 +10263,15 @@ var pct = (d, key, fallback) => num3(d, key, fallback * 100) / 100;
10965
10263
  var bool = (d, key) => descBool(d, key) === true;
10966
10264
  var enumOf3 = (d, key) => {
10967
10265
  const v = descGet(d, key);
10968
- return _optionalChain([v, 'optionalAccess', _276 => _276.type]) === "enum" ? v.value : void 0;
10266
+ return _optionalChain([v, 'optionalAccess', _272 => _272.type]) === "enum" ? v.value : void 0;
10969
10267
  };
10970
10268
  var text2 = (d, key) => {
10971
10269
  const v = d ? descGet(d, key) : void 0;
10972
- return _optionalChain([v, 'optionalAccess', _277 => _277.type]) === "TEXT" ? v.value : "";
10270
+ return _optionalChain([v, 'optionalAccess', _273 => _273.type]) === "TEXT" ? v.value : "";
10973
10271
  };
10974
10272
  var list = (d, key) => {
10975
10273
  const v = descGet(d, key);
10976
- if (_optionalChain([v, 'optionalAccess', _278 => _278.type]) !== "VlLs") return [];
10274
+ if (_optionalChain([v, 'optionalAccess', _274 => _274.type]) !== "VlLs") return [];
10977
10275
  return v.items.flatMap((it) => it.type === "Objc" || it.type === "GlbO" ? [it.value] : []);
10978
10276
  };
10979
10277
  var clamp3 = (v, lo, hi) => Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : lo;
@@ -10995,34 +10293,34 @@ function blendOf(d, key, fallback, notes) {
10995
10293
  function colorOf(d, fallback = "#000000") {
10996
10294
  if (!d) return fallback;
10997
10295
  const g = (k) => descNumber(d, k);
10998
- if (g("redFloat") !== void 0) return _chunkHGTDMKNEcjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
10296
+ if (g("redFloat") !== void 0) return _chunkUOGKSVRQcjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
10999
10297
  switch (d.classId) {
11000
10298
  case "HSBC": {
11001
10299
  const rgb = decodePsdColor(1, [(_nullishCoalesce(g("H "), () => ( 0))) / 360 * 65535, (_nullishCoalesce(g("Strt"), () => ( 0))) / 100 * 65535, (_nullishCoalesce(g("Brgh"), () => ( 0))) / 100 * 65535]);
11002
- return rgb ? _chunkHGTDMKNEcjs.effectColorHex.call(void 0, rgb) : fallback;
10300
+ return rgb ? _chunkUOGKSVRQcjs.effectColorHex.call(void 0, rgb) : fallback;
11003
10301
  }
11004
10302
  case "CMYC": {
11005
10303
  const inv = (k) => (1 - (_nullishCoalesce(g(k), () => ( 0))) / 100) * 65535;
11006
10304
  const rgb = decodePsdColor(2, [inv("Cyn "), inv("Mgnt"), inv("Ylw "), inv("Blck")]);
11007
- return rgb ? _chunkHGTDMKNEcjs.effectColorHex.call(void 0, rgb) : fallback;
10305
+ return rgb ? _chunkUOGKSVRQcjs.effectColorHex.call(void 0, rgb) : fallback;
11008
10306
  }
11009
10307
  case "LbCl": {
11010
10308
  const rgb = decodePsdColor(7, [(_nullishCoalesce(g("Lmnc"), () => ( 0))) * 100, Math.round((_nullishCoalesce(g("A "), () => ( 0))) * 100) & 65535, Math.round((_nullishCoalesce(g("B "), () => ( 0))) * 100) & 65535]);
11011
- return rgb ? _chunkHGTDMKNEcjs.effectColorHex.call(void 0, rgb) : fallback;
10309
+ return rgb ? _chunkUOGKSVRQcjs.effectColorHex.call(void 0, rgb) : fallback;
11012
10310
  }
11013
10311
  case "Grsc": {
11014
10312
  const v = 1 - (_nullishCoalesce(g("Gry "), () => ( 0))) / 100;
11015
- return _chunkHGTDMKNEcjs.effectColorHex.call(void 0, [v, v, v]);
10313
+ return _chunkUOGKSVRQcjs.effectColorHex.call(void 0, [v, v, v]);
11016
10314
  }
11017
10315
  }
11018
10316
  const r = g("Rd ");
11019
10317
  const gr = g("Grn ");
11020
10318
  const b = g("Bl ");
11021
10319
  if (r === void 0 || gr === void 0 || b === void 0) return fallback;
11022
- return _chunkHGTDMKNEcjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
10320
+ return _chunkUOGKSVRQcjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
11023
10321
  }
11024
10322
  function colorDesc(hex) {
11025
- const [r, g, b] = _nullishCoalesce(_chunkHGTDMKNEcjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
10323
+ const [r, g, b] = _nullishCoalesce(_chunkUOGKSVRQcjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
11026
10324
  return descriptor("RGBC", [
11027
10325
  ["Rd ", dbl3(r * 255)],
11028
10326
  ["Grn ", dbl3(g * 255)],
@@ -11043,8 +10341,8 @@ function contourOf(d, key) {
11043
10341
  return { name, points };
11044
10342
  }
11045
10343
  function contourDesc(c) {
11046
- const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _279 => _279.name]), () => ( "Linear"));
11047
- const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _280 => _280.points]), () => ( [
10344
+ const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _275 => _275.name]), () => ( "Linear"));
10345
+ const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _276 => _276.points]), () => ( [
11048
10346
  { input: 0, output: 0 },
11049
10347
  { input: 1, output: 1 }
11050
10348
  ]));
@@ -11079,7 +10377,7 @@ function gradientOf(d, notes) {
11079
10377
  { position: 0, color: "#000000" },
11080
10378
  { position: 1, color: "#ffffff" }
11081
10379
  ],
11082
- style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _281 => _281.find, 'call', _282 => _282(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _283 => _283[0]]), () => ( "linear")),
10380
+ style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _277 => _277.find, 'call', _278 => _278(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _279 => _279[0]]), () => ( "linear")),
11083
10381
  angle: clamp3(num3(d, "Angl", 90), -360, 360),
11084
10382
  scale: clamp3(pct(d, "Scl ", 1), 0.1, 1.5),
11085
10383
  reverse: bool(d, "Rvrs"),
@@ -11105,9 +10403,9 @@ function gradientOf(d, notes) {
11105
10403
  raw.forEach((s, i) => {
11106
10404
  if (i > 0 && Math.abs(s.mid - 0.5) > 1e-3) {
11107
10405
  const a = raw[i - 1];
11108
- const ca = _chunkHGTDMKNEcjs.parseEffectColor.call(void 0, a.color);
11109
- const cb = _chunkHGTDMKNEcjs.parseEffectColor.call(void 0, s.color);
11110
- stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkHGTDMKNEcjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
10406
+ const ca = _chunkUOGKSVRQcjs.parseEffectColor.call(void 0, a.color);
10407
+ const cb = _chunkUOGKSVRQcjs.parseEffectColor.call(void 0, s.color);
10408
+ stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkUOGKSVRQcjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
11111
10409
  notes.add("gradient midpoints are drawn as straight segments");
11112
10410
  }
11113
10411
  stops.push({ position: s.position, color: s.color });
@@ -11133,7 +10431,7 @@ function gradientItems(g) {
11133
10431
  )
11134
10432
  )
11135
10433
  };
11136
- const op = _optionalChain([g, 'access', _284 => _284.opacityStops, 'optionalAccess', _285 => _285.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
10434
+ const op = _optionalChain([g, 'access', _280 => _280.opacityStops, 'optionalAccess', _281 => _281.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
11137
10435
  const trns = {
11138
10436
  type: "VlLs",
11139
10437
  items: op.map(
@@ -11219,8 +10517,8 @@ var KINDS = [
11219
10517
  ["FrFX", "frameFXMulti", "stroke"]
11220
10518
  ];
11221
10519
  function common(d, kind, notes) {
11222
- const def = _chunkHGTDMKNEcjs.defaultLayerEffect.call(void 0, kind, "x");
11223
- return { id: _chunkHGTDMKNEcjs.newEffectId.call(void 0, ), enabled: descBool(d, "enab") !== false, blend: blendOf(d, "Md ", def.blend, notes), opacity: clamp3(pct(d, "Opct", def.opacity), 0, 1) };
10520
+ const def = _chunkUOGKSVRQcjs.defaultLayerEffect.call(void 0, kind, "x");
10521
+ return { id: _chunkUOGKSVRQcjs.newEffectId.call(void 0, ), enabled: descBool(d, "enab") !== false, blend: blendOf(d, "Md ", def.blend, notes), opacity: clamp3(pct(d, "Opct", def.opacity), 0, 1) };
11224
10522
  }
11225
10523
  function readOne(kind, d, notes) {
11226
10524
  const size = (key, fallback) => clamp3(num3(d, key, fallback), 0, 250);
@@ -11263,7 +10561,7 @@ function readOne(kind, d, notes) {
11263
10561
  case "bevel-emboss": {
11264
10562
  const styles = { OtrB: "outer-bevel", InrB: "inner-bevel", Embs: "emboss", PlEb: "pillow-emboss", strokeEmboss: "stroke-emboss" };
11265
10563
  const out = {
11266
- id: _chunkHGTDMKNEcjs.newEffectId.call(void 0, ),
10564
+ id: _chunkUOGKSVRQcjs.newEffectId.call(void 0, ),
11267
10565
  enabled: descBool(d, "enab") !== false,
11268
10566
  kind,
11269
10567
  style: _nullishCoalesce(styles[_nullishCoalesce(enumOf3(d, "bvlS"), () => ( ""))], () => ( "inner-bevel")),
@@ -11474,10 +10772,10 @@ function writeLfx2(effects) {
11474
10772
  ["Scl ", unit3("#Prc", 100)],
11475
10773
  ["masterFXSwitch", boolV3(effects.enabled)]
11476
10774
  ];
11477
- const scale = _chunkHGTDMKNEcjs.effectsScale.call(void 0, effects);
10775
+ const scale = _chunkUOGKSVRQcjs.effectsScale.call(void 0, effects);
11478
10776
  let dropped = 0;
11479
10777
  for (const [single, multi, kind] of KINDS) {
11480
- const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkHGTDMKNEcjs.scaleLayerEffect.call(void 0, e, scale)));
10778
+ const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkUOGKSVRQcjs.scaleLayerEffect.call(void 0, e, scale)));
11481
10779
  if (!of.length) continue;
11482
10780
  if (of.length === 1) items.push([single, obj3(of[0])]);
11483
10781
  else if (multi) items.push([multi, { type: "VlLs", items: of.map(obj3) }]);
@@ -11509,7 +10807,7 @@ function parseLrfx(data) {
11509
10807
  const colorAt = (rd) => {
11510
10808
  rd.u16();
11511
10809
  const c = [rd.u16(), rd.u16(), rd.u16(), rd.u16()];
11512
- return _chunkHGTDMKNEcjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
10810
+ return _chunkUOGKSVRQcjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
11513
10811
  };
11514
10812
  const blendAt = (rd) => {
11515
10813
  rd.skip(4);
@@ -11528,7 +10826,7 @@ function parseLrfx(data) {
11528
10826
  const enabled = b.u8() !== 0;
11529
10827
  const useGlobalLight = b.u8() !== 0;
11530
10828
  const opacity = b.u8() / 255;
11531
- const base = { id: _chunkHGTDMKNEcjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
10829
+ const base = { id: _chunkUOGKSVRQcjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
11532
10830
  items.push(key === "dsdw" ? { ...base, kind: "drop-shadow", spread: 0, knocksOut: true } : { ...base, kind: "inner-shadow", choke: 0 });
11533
10831
  } else if (key === "oglw" || key === "iglw") {
11534
10832
  b.u32();
@@ -11538,7 +10836,7 @@ function parseLrfx(data) {
11538
10836
  const blend = blendAt(b);
11539
10837
  const enabled = b.u8() !== 0;
11540
10838
  const opacity = b.u8() / 255;
11541
- const base = { id: _chunkHGTDMKNEcjs.newEffectId.call(void 0, ), enabled, blend, opacity, fill: { type: "color", color }, technique: "softer", size: clamp3(blur, 0, 250), antiAlias: false, range: 0.5, jitter: 0, noise: 0 };
10839
+ const base = { id: _chunkUOGKSVRQcjs.newEffectId.call(void 0, ), enabled, blend, opacity, fill: { type: "color", color }, technique: "softer", size: clamp3(blur, 0, 250), antiAlias: false, range: 0.5, jitter: 0, noise: 0 };
11542
10840
  items.push(key === "oglw" ? { ...base, kind: "outer-glow", spread: 0 } : { ...base, kind: "inner-glow", choke: 0, source: "edge" });
11543
10841
  } else if (key === "sofi") {
11544
10842
  b.u32();
@@ -11546,7 +10844,7 @@ function parseLrfx(data) {
11546
10844
  const color = colorAt(b);
11547
10845
  const opacity = b.u8() / 255;
11548
10846
  const enabled = b.u8() !== 0;
11549
- items.push({ id: _chunkHGTDMKNEcjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
10847
+ items.push({ id: _chunkUOGKSVRQcjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
11550
10848
  } else if (key === "bevl") notes.add("legacy bevels are not read");
11551
10849
  }
11552
10850
  return { effects: { enabled: true, items }, notes: [...notes] };
@@ -11597,13 +10895,13 @@ function rleChannel(id, plane, width, height, psb, depth = 8) {
11597
10895
  }
11598
10896
  function surfacePlanes(surface, bounds, depth) {
11599
10897
  const n = bounds.width * bounds.height;
11600
- if (depth === 8) return rgbaToPlanes(_chunkCWM3CUUXcjs.readRegion.call(void 0, surface, bounds), n);
11601
- return deepToPlanes(_chunkCWM3CUUXcjs.readDeepRegion.call(void 0, surface, bounds, depth), n);
10898
+ if (depth === 8) return rgbaToPlanes(_chunk474IQG74cjs.readRegion.call(void 0, surface, bounds), n);
10899
+ return deepToPlanes(_chunkOLNIPTB3cjs.readDeepRegion.call(void 0, surface, bounds, depth), n);
11602
10900
  }
11603
10901
  var emptyChannel = (id) => ({ id, compression: 0, data: new Uint8Array(0) });
11604
10902
  function maskChannel(mask, ox, oy, psb, depth = 8) {
11605
10903
  if (mask.source) throw new PsdError("A parametric mask must be baked before export.");
11606
- const bounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, mask.surface);
10904
+ const bounds = _chunk474IQG74cjs.contentBounds.call(void 0, mask.surface);
11607
10905
  const def = mask.defaultValue;
11608
10906
  const flags = (mask.enabled === false ? MASK_FLAG_DISABLED : 0) | (mask.linked === false ? MASK_FLAG_UNLINKED : 0);
11609
10907
  const m = { rect: EMPTY_RECT, defaultColor: def, flags };
@@ -11612,9 +10910,9 @@ function maskChannel(mask, ox, oy, psb, depth = 8) {
11612
10910
  if (!bounds) return { channel: emptyChannel(CHANNEL_USER_MASK), mask: m };
11613
10911
  m.rect = toRect({ ...bounds, x: bounds.x + ox, y: bounds.y + oy });
11614
10912
  let bytes;
11615
- if (depth !== 8 && _chunkCWM3CUUXcjs.surfaceDepth.call(void 0, mask.surface) !== 8) bytes = deepMaskPlane(_chunkCWM3CUUXcjs.readDeepRegion.call(void 0, mask.surface, bounds, depth));
10913
+ if (depth !== 8 && _chunkOLNIPTB3cjs.surfaceDepth.call(void 0, mask.surface) !== 8) bytes = deepMaskPlane(_chunkOLNIPTB3cjs.readDeepRegion.call(void 0, mask.surface, bounds, depth));
11616
10914
  else {
11617
- const plane = _chunkCWM3CUUXcjs.readRegion.call(void 0, mask.surface, bounds);
10915
+ const plane = _chunk474IQG74cjs.readRegion.call(void 0, mask.surface, bounds);
11618
10916
  bytes = planeAtDepth(new Uint8Array(plane.buffer, plane.byteOffset, plane.length), depth);
11619
10917
  }
11620
10918
  return { channel: rleChannel(CHANNEL_USER_MASK, bytes, bounds.width, bounds.height, psb, depth), mask: m };
@@ -11630,9 +10928,9 @@ function prepareNestedLayers(layers) {
11630
10928
  if (l.type === "annotation") continue;
11631
10929
  let next = l;
11632
10930
  if (l.type === "group") next = { ...l, children: prepareNestedLayers(l.children) };
11633
- else if (l.type === "pixel" && (_optionalChain([l, 'access', _286 => _286.filters, 'optionalAccess', _287 => _287.length]) || l.source === "document")) {
10931
+ else if (l.type === "pixel" && (_optionalChain([l, 'access', _282 => _282.filters, 'optionalAccess', _283 => _283.length]) || l.source === "document")) {
11634
10932
  const p = { ...l };
11635
- if (_optionalChain([l, 'access', _288 => _288.filters, 'optionalAccess', _289 => _289.some, 'call', _290 => _290(isActiveFilter)])) {
10933
+ if (_optionalChain([l, 'access', _284 => _284.filters, 'optionalAccess', _285 => _285.some, 'call', _286 => _286(isActiveFilter)])) {
11636
10934
  const b = l.surface.bounds;
11637
10935
  if (b) {
11638
10936
  const r = { x: b.x + l.offset.x - 64, y: b.y + l.offset.y - 64, width: b.width + 128, height: b.height + 128 };
@@ -11642,14 +10940,14 @@ function prepareNestedLayers(layers) {
11642
10940
  delete plain.effects;
11643
10941
  delete plain.fillOpacity;
11644
10942
  const data = new LayerCompositor().composite([plain], r, { width: r.x + r.width, height: r.y + r.height });
11645
- p.surface = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width: r.width, height: r.height, data }, 4, r.x - l.offset.x, r.y - l.offset.y);
10943
+ p.surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width: r.width, height: r.height, data }, 4, r.x - l.offset.x, r.y - l.offset.y);
11646
10944
  }
11647
10945
  }
11648
10946
  delete p.filters;
11649
10947
  delete p.source;
11650
10948
  next = p;
11651
10949
  }
11652
- if (_optionalChain([next, 'access', _291 => _291.mask, 'optionalAccess', _292 => _292.source])) {
10950
+ if (_optionalChain([next, 'access', _287 => _287.mask, 'optionalAccess', _288 => _288.source])) {
11653
10951
  next = { ...next };
11654
10952
  delete next.mask;
11655
10953
  }
@@ -11661,11 +10959,11 @@ function smartContentsFile(c) {
11661
10959
  const base = c.name.replace(/\.\w+$/, "") || "Contents";
11662
10960
  if (c.file) return { name: c.name, bytes: c.file.bytes };
11663
10961
  if (c.kind === "raster") {
11664
- const data = _chunkCWM3CUUXcjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
11665
- return { name: `${base}.png`, bytes: _chunkCWM3CUUXcjs.encodePng.call(void 0, c.width, c.height, data) };
10962
+ const data = _chunk474IQG74cjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
10963
+ return { name: `${base}.png`, bytes: _chunkOLNIPTB3cjs.encodePng.call(void 0, c.width, c.height, data) };
11666
10964
  }
11667
10965
  const doc = c.document;
11668
- const merged2 = _chunkCWM3CUUXcjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
10966
+ const merged2 = _chunk474IQG74cjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
11669
10967
  const res = exportPsd({ width: c.width, height: c.height, layers: prepareNestedLayers(doc.layers), merged: merged2, patterns: doc.patterns, globalLight: doc.globalLight });
11670
10968
  return { name: `${base}.${res.psb ? "psb" : "psd"}`, bytes: res.bytes };
11671
10969
  }
@@ -11712,13 +11010,13 @@ function exportPsd(input) {
11712
11010
  const surfaceChannels = (surface, bounds) => {
11713
11011
  if (mode !== "rgb" && depth === 16) {
11714
11012
  const n2 = bounds.width * bounds.height;
11715
- const s = _chunkCWM3CUUXcjs.readDeepRegion.call(void 0, surface, bounds, 16);
11013
+ const s = _chunkOLNIPTB3cjs.readDeepRegion.call(void 0, surface, bounds, 16);
11716
11014
  const alpha = new Uint16Array(n2);
11717
11015
  for (let i = 0; i < n2; i++) alpha[i] = s[i * 4 + 3];
11718
11016
  const planes2 = [alpha, ...input.colorPlanes16(s, n2)];
11719
11017
  return [CHANNEL_ALPHA, ...colorIds].map((id, i) => rleChannel(id, deepMaskPlane(planes2[i]), bounds.width, bounds.height, psb, 16));
11720
11018
  }
11721
- if (mode !== "rgb") return pixelChannels(_chunkCWM3CUUXcjs.readRegion.call(void 0, surface, bounds), bounds.width, bounds.height);
11019
+ if (mode !== "rgb") return pixelChannels(_chunk474IQG74cjs.readRegion.call(void 0, surface, bounds), bounds.width, bounds.height);
11722
11020
  const [r, g, b, a2] = surfacePlanes(surface, bounds, depth);
11723
11021
  return [CHANNEL_ALPHA, 0, 1, 2].map((id, i) => rleChannel(id, [a2, r, g, b][i], bounds.width, bounds.height, psb, depth));
11724
11022
  };
@@ -11738,7 +11036,7 @@ function exportPsd(input) {
11738
11036
  const key = layer.type === "group" ? "lfxs" : "lfx2";
11739
11037
  if (fx.psd) {
11740
11038
  const original = parseLfx2(fx.psd.data);
11741
- if (original ? _chunkHGTDMKNEcjs.effectsFingerprint.call(void 0, original.effects) === _chunkHGTDMKNEcjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
11039
+ if (original ? _chunkUOGKSVRQcjs.effectsFingerprint.call(void 0, original.effects) === _chunkUOGKSVRQcjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
11742
11040
  }
11743
11041
  if (!fx.items.length && fx.enabled && (_nullishCoalesce(fx.scale, () => ( 1))) === 1) return null;
11744
11042
  const { data, dropped } = writeLfx2(fx);
@@ -11762,7 +11060,7 @@ function exportPsd(input) {
11762
11060
  return {
11763
11061
  opacity: Math.round(Math.min(1, Math.max(0, layer.opacity)) * 255),
11764
11062
  clipping: layer.clipped ? 1 : 0,
11765
- flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _293 => _293.locks, 'optionalAccess', _294 => _294.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
11063
+ flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _289 => _289.locks, 'optionalAccess', _290 => _290.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
11766
11064
  legacyName: name,
11767
11065
  blocks
11768
11066
  };
@@ -11819,13 +11117,13 @@ function exportPsd(input) {
11819
11117
  }
11820
11118
  case "pixel": {
11821
11119
  if (layer.source === "document") throw new PsdError(`Layer "${layer.name}" reads the document image; resolve its pixels before export.`);
11822
- if (_optionalChain([layer, 'access', _295 => _295.filters, 'optionalAccess', _296 => _296.some, 'call', _297 => _297(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
11120
+ if (_optionalChain([layer, 'access', _291 => _291.filters, 'optionalAccess', _292 => _292.some, 'call', _293 => _293(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
11823
11121
  const extra = [];
11824
11122
  if (layer.fillOpacity !== void 0 && layer.fillOpacity < 1) {
11825
11123
  extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
11826
11124
  }
11827
11125
  const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
11828
- const bounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
11126
+ const bounds = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
11829
11127
  if (bounds) {
11830
11128
  rec.rect = toRect({ ...bounds, x: bounds.x + layer.offset.x, y: bounds.y + layer.offset.y });
11831
11129
  rec.channels = surfaceChannels(layer.surface, bounds);
@@ -11851,7 +11149,7 @@ function exportPsd(input) {
11851
11149
  if (c.linked) note("Linked smart objects were embedded (their preview is written as the contents)", layer.name);
11852
11150
  linkedFiles.set(idnt, smartContentsFile(c));
11853
11151
  }
11854
- let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _298 => _298.psd, 'optionalAccess', _299 => _299.placed]), () => ( psdUuid(`${layer.id}:placed`)));
11152
+ let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _294 => _294.psd, 'optionalAccess', _295 => _295.placed]), () => ( psdUuid(`${layer.id}:placed`)));
11855
11153
  if (placedIds.has(placedId)) placedId = psdUuid(`${layer.id}:placed:${placedIds.size}`);
11856
11154
  placedIds.add(placedId);
11857
11155
  if (placedUnchanged(layer, idnt, placedId)) {
@@ -11861,15 +11159,15 @@ function exportPsd(input) {
11861
11159
  const filterFX = layer.smartFilters ? filterFXDescriptor(layer.smartFilters, dropped) : void 0;
11862
11160
  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);
11863
11161
  const raw = layer.psd && layer.psd.key !== "PlLd" ? parsePlaced(layer.psd.key, layer.psd.data) : null;
11864
- const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _300 => _300.descriptor]) };
11162
+ const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _296 => _296.descriptor]) };
11865
11163
  const wnotes = [];
11866
11164
  extra.push({ key: "PlLd", data: plldBytes(spec) }, { key: "SoLd", data: soldBytes(spec, wnotes) });
11867
11165
  for (const n2 of wnotes) note(`A smart object: ${n2}`, layer.name);
11868
11166
  }
11869
- const fm = _optionalChain([layer, 'access', _301 => _301.smartFilters, 'optionalAccess', _302 => _302.mask]);
11167
+ const fm = _optionalChain([layer, 'access', _297 => _297.smartFilters, 'optionalAccess', _298 => _298.mask]);
11870
11168
  if (fm && !fm.source) filterItems.push(filterMaskItem(placedId, fm, { x: 0, y: 0, width, height }));
11871
11169
  const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
11872
- const bounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
11170
+ const bounds = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
11873
11171
  if (bounds) {
11874
11172
  rec.rect = toRect(bounds);
11875
11173
  rec.channels = surfaceChannels(layer.surface, bounds);
@@ -11894,13 +11192,13 @@ function exportPsd(input) {
11894
11192
  const losses = /* @__PURE__ */ new Set();
11895
11193
  for (const b of shapeBlocks(layer, width, height, _nullishCoalesce(input.resolution, () => ( 72)), losses)) extra.push({ key: b.key, data: padEven(b.data) });
11896
11194
  for (const n2 of losses) note(n2, layer.name);
11897
- if (_optionalChain([layer, 'access', _303 => _303.fill, 'optionalAccess', _304 => _304.type]) === "pattern") patternIds2.add(layer.fill.patternId);
11898
- if (_optionalChain([layer, 'access', _305 => _305.stroke, 'optionalAccess', _306 => _306.paint, 'access', _307 => _307.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
11195
+ if (_optionalChain([layer, 'access', _299 => _299.fill, 'optionalAccess', _300 => _300.type]) === "pattern") patternIds2.add(layer.fill.patternId);
11196
+ if (_optionalChain([layer, 'access', _301 => _301.stroke, 'optionalAccess', _302 => _302.paint, 'access', _303 => _303.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
11899
11197
  } else {
11900
11198
  extra.push({ key: "TySh", data: padEven(tyShForLayer(layer)) });
11901
11199
  }
11902
11200
  const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
11903
- const bounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
11201
+ const bounds = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
11904
11202
  if (bounds) {
11905
11203
  rec.rect = toRect(bounds);
11906
11204
  rec.channels = surfaceChannels(layer.surface, bounds);
@@ -11963,7 +11261,7 @@ function exportPsd(input) {
11963
11261
  { id: 1005, name: "", data: rw.result() },
11964
11262
  { id: 1057, name: "", data: version.result() }
11965
11263
  ];
11966
- if (_optionalChain([input, 'access', _308 => _308.iccProfile, 'optionalAccess', _309 => _309.length])) resources.push({ id: 1039, name: "", data: input.iccProfile });
11264
+ if (_optionalChain([input, 'access', _304 => _304.iccProfile, 'optionalAccess', _305 => _305.length])) resources.push({ id: 1039, name: "", data: input.iccProfile });
11967
11265
  resources.push(...alphaChannelResources(_nullishCoalesce(input.alphaChannels, () => ( []))));
11968
11266
  if (input.globalLight) {
11969
11267
  const i32 = (v) => {
@@ -11978,7 +11276,7 @@ function exportPsd(input) {
11978
11276
  const byId = new Map((_nullishCoalesce(input.patterns, () => ( []))).map((p) => [p.id, p]));
11979
11277
  const embed = [];
11980
11278
  for (const id of patternIds2) {
11981
- const p = _nullishCoalesce(byId.get(id), () => ( _chunkHGTDMKNEcjs.builtinPattern.call(void 0, id)));
11279
+ const p = _nullishCoalesce(byId.get(id), () => ( _chunkUOGKSVRQcjs.builtinPattern.call(void 0, id)));
11982
11280
  if (p) embed.push(p);
11983
11281
  else note(`Pattern "${id}" is not in the document and was not embedded`, id);
11984
11282
  }
@@ -12360,39 +11658,4 @@ function exportPsd(input) {
12360
11658
 
12361
11659
 
12362
11660
 
12363
-
12364
-
12365
-
12366
-
12367
-
12368
-
12369
-
12370
-
12371
-
12372
-
12373
-
12374
-
12375
-
12376
-
12377
-
12378
-
12379
-
12380
-
12381
-
12382
-
12383
-
12384
-
12385
-
12386
-
12387
-
12388
-
12389
-
12390
-
12391
-
12392
-
12393
-
12394
-
12395
-
12396
-
12397
-
12398
- 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.layerMaskSelection = layerMaskSelection; 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.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.TEXT_ORIENTATIONS = TEXT_ORIENTATIONS; 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.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.componentsCoverage = componentsCoverage; 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.isActiveVectorMask = isActiveVectorMask; exports.vectorMaskCoverage = vectorMaskCoverage; exports.effectiveLayerMask = effectiveLayerMask; exports.resolveVectorMasks = resolveVectorMasks; exports.offsetVectorMask = offsetVectorMask; exports.transformVectorMask = transformVectorMask; exports.followLayerMove = followLayerMove; exports.vectorMaskBounds = vectorMaskBounds; exports.vectorMaskThumbnail = vectorMaskThumbnail; 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.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.textOrientation = textOrientation; 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;
11661
+ 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.layerMaskSelection = layerMaskSelection; 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.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.TEXT_ORIENTATIONS = TEXT_ORIENTATIONS; 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.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.componentsCoverage = componentsCoverage; 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.isActiveVectorMask = isActiveVectorMask; exports.vectorMaskCoverage = vectorMaskCoverage; exports.effectiveLayerMask = effectiveLayerMask; exports.resolveVectorMasks = resolveVectorMasks; exports.offsetVectorMask = offsetVectorMask; exports.transformVectorMask = transformVectorMask; exports.followLayerMove = followLayerMove; exports.vectorMaskBounds = vectorMaskBounds; exports.vectorMaskThumbnail = vectorMaskThumbnail; 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.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.textOrientation = textOrientation; 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;