@pixerate/editor 0.109.0 → 0.110.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.
- package/dist/blending-DXl06NSx.d.ts +486 -0
- package/dist/blending-aOE6Y3UE.d.cts +486 -0
- package/dist/chunk-7VOHOPLW.cjs +1136 -0
- package/dist/chunk-7VOHOPLW.cjs.map +1 -0
- package/dist/{chunk-RE77QYUF.js → chunk-DMRSJBJF.js} +3 -3
- package/dist/chunk-FTBZPI77.cjs +1 -0
- package/dist/chunk-FTBZPI77.cjs.map +1 -0
- package/dist/{chunk-WMBIJCHA.js → chunk-HNS7UHCM.js} +5 -1
- package/dist/{chunk-WMBIJCHA.js.map → chunk-HNS7UHCM.js.map} +1 -1
- package/dist/{chunk-CFMWALBM.js → chunk-LQEEDHOP.js} +2 -2
- package/dist/{chunk-D37BX2ZA.cjs → chunk-MGL4U5WA.cjs} +199 -199
- package/dist/{chunk-D37BX2ZA.cjs.map → chunk-MGL4U5WA.cjs.map} +1 -1
- package/dist/{chunk-AZTZRLDI.cjs → chunk-POGBUYWE.cjs} +92 -92
- package/dist/{chunk-AZTZRLDI.cjs.map → chunk-POGBUYWE.cjs.map} +1 -1
- package/dist/chunk-VKK5VS2T.js +1 -0
- package/dist/{chunk-SZ6KMZNM.cjs → chunk-XIOMMGPD.cjs} +6 -2
- package/dist/chunk-XIOMMGPD.cjs.map +1 -0
- package/dist/{chunk-3PHA3UKI.js → chunk-Z4BC6M74.js} +523 -121
- package/dist/chunk-Z4BC6M74.js.map +1 -0
- package/dist/{export-BLPLaE6Z.d.ts → export-CO2ryu3I.d.ts} +3 -3
- package/dist/{export-DSUc4fQD.d.cts → export-DRiLzP_j.d.cts} +3 -3
- package/dist/image-editor/index.cjs +722 -696
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +9 -9
- package/dist/image-editor/index.d.ts +9 -9
- package/dist/image-editor/index.js +31 -5
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +28 -4
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +3 -89
- package/dist/paint/index.d.ts +3 -89
- package/dist/paint/index.js +27 -3
- package/dist/paint-editor/index.cjs +1052 -286
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +301 -22
- package/dist/paint-editor/index.d.ts +301 -22
- package/dist/paint-editor/index.js +848 -82
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +5 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +2 -2
- package/dist/raster/index.d.ts +2 -2
- package/dist/raster/index.js +4 -2
- package/dist/{render-C-fO_mes.d.cts → render-BEriFuqK.d.cts} +1 -1
- package/dist/{render-OLIMk_v0.d.ts → render-tjzKaik-.d.ts} +1 -1
- package/dist/{surface-CkKOHGPm.d.cts → surface-C8RRg_Bh.d.cts} +109 -1
- package/dist/{surface-CkKOHGPm.d.ts → surface-C8RRg_Bh.d.ts} +109 -1
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +49 -13
- package/dist/chunk-3PHA3UKI.js.map +0 -1
- package/dist/chunk-6BU5WU4R.cjs +0 -1
- package/dist/chunk-6BU5WU4R.cjs.map +0 -1
- package/dist/chunk-HUFQD4CB.cjs +0 -734
- package/dist/chunk-HUFQD4CB.cjs.map +0 -1
- package/dist/chunk-SZ6KMZNM.cjs.map +0 -1
- package/dist/chunk-XYBJKUAU.js +0 -1
- package/dist/mixer-5ziHU8OS.d.cts +0 -282
- package/dist/mixer-DNqiYXYQ.d.ts +0 -282
- /package/dist/{chunk-RE77QYUF.js.map → chunk-DMRSJBJF.js.map} +0 -0
- /package/dist/{chunk-CFMWALBM.js.map → chunk-LQEEDHOP.js.map} +0 -0
- /package/dist/{chunk-XYBJKUAU.js.map → chunk-VKK5VS2T.js.map} +0 -0
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunkPOGBUYWEcjs = require('./chunk-POGBUYWE.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
@@ -68,7 +68,7 @@ var _chunkMUUXNRU4cjs = require('./chunk-MUUXNRU4.cjs');
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
var
|
|
71
|
+
var _chunkXIOMMGPDcjs = require('./chunk-XIOMMGPD.cjs');
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
|
|
@@ -1111,7 +1111,7 @@ function smoothCoverage(m, w, h, r) {
|
|
|
1111
1111
|
return src;
|
|
1112
1112
|
}
|
|
1113
1113
|
function featherCoverage(m, w, h, radius) {
|
|
1114
|
-
const out =
|
|
1114
|
+
const out = _chunkPOGBUYWEcjs.gaussianBlur.call(void 0, m, w, h, Number.isFinite(radius) ? Math.max(0, radius) : 0, "zero");
|
|
1115
1115
|
for (let i = 0; i < out.length; i++) if (Math.abs(out[i]) < 1e-7) out[i] = 0;
|
|
1116
1116
|
return out;
|
|
1117
1117
|
}
|
|
@@ -1259,7 +1259,7 @@ function layerMaskCoverage(mask) {
|
|
|
1259
1259
|
let v = new Float32Array(sel.data.length);
|
|
1260
1260
|
for (let i = 0; i < v.length; i++) v[i] = sel.data[i] / 255;
|
|
1261
1261
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
1262
|
-
if (feather > 0) v =
|
|
1262
|
+
if (feather > 0) v = _chunkPOGBUYWEcjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
|
|
1263
1263
|
const density = _nullishCoalesce(mask.density, () => ( 1));
|
|
1264
1264
|
if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
|
|
1265
1265
|
return v;
|
|
@@ -1480,7 +1480,7 @@ function normalizeAdjustmentLayer(raw) {
|
|
|
1480
1480
|
kind: r.kind,
|
|
1481
1481
|
enabled: r.enabled !== false,
|
|
1482
1482
|
opacity: clampTo(r.opacity, 0, 1, 1),
|
|
1483
|
-
blend:
|
|
1483
|
+
blend: _chunkXIOMMGPDcjs.normalizeBlendMode.call(void 0, r.blend),
|
|
1484
1484
|
params: normParams(r.kind, r.params)
|
|
1485
1485
|
};
|
|
1486
1486
|
if (typeof r.name === "string" && r.name) layer.name = r.name;
|
|
@@ -1502,7 +1502,7 @@ function normalizeAdjustmentLayers(raw) {
|
|
|
1502
1502
|
return out;
|
|
1503
1503
|
}
|
|
1504
1504
|
function curveLutFromLevels(points) {
|
|
1505
|
-
return
|
|
1505
|
+
return _chunkPOGBUYWEcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
|
|
1506
1506
|
}
|
|
1507
1507
|
var toUnitLevels = (c) => ({
|
|
1508
1508
|
inBlack: c.inBlack / 255,
|
|
@@ -1825,7 +1825,7 @@ function compileAdjustmentLayer(layer) {
|
|
|
1825
1825
|
return (c) => {
|
|
1826
1826
|
const g = blackWhiteGray(c, weights);
|
|
1827
1827
|
if (tint) {
|
|
1828
|
-
const t =
|
|
1828
|
+
const t = _chunkXIOMMGPDcjs.setLum.call(void 0, tint, g);
|
|
1829
1829
|
c[0] = clamp01(t[0]);
|
|
1830
1830
|
c[1] = clamp01(t[1]);
|
|
1831
1831
|
c[2] = clamp01(t[2]);
|
|
@@ -1844,7 +1844,7 @@ function compileAdjustmentLayer(layer) {
|
|
|
1844
1844
|
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])));
|
|
1845
1845
|
if (preserve) {
|
|
1846
1846
|
const target = 0.3 * c[0] + 0.59 * c[1] + 0.11 * c[2];
|
|
1847
|
-
f =
|
|
1847
|
+
f = _chunkXIOMMGPDcjs.setLum.call(void 0, f, target);
|
|
1848
1848
|
}
|
|
1849
1849
|
c[0] = clamp01(f[0]);
|
|
1850
1850
|
c[1] = clamp01(f[1]);
|
|
@@ -1911,10 +1911,10 @@ function applyLayer(c, layer, op, coverage = 1) {
|
|
|
1911
1911
|
const cb0 = c[0], cb1 = c[1], cb2 = c[2];
|
|
1912
1912
|
op(c);
|
|
1913
1913
|
if (blend === "pigment") {
|
|
1914
|
-
|
|
1914
|
+
_chunkXIOMMGPDcjs.mixPigmentRgb.call(void 0, [clamp01(cb0), clamp01(cb1), clamp01(cb2)], [clamp01(c[0]), clamp01(c[1]), clamp01(c[2])], alpha, c);
|
|
1915
1915
|
return;
|
|
1916
1916
|
}
|
|
1917
|
-
const b = blend === "normal" ? c :
|
|
1917
|
+
const b = blend === "normal" ? c : _chunkXIOMMGPDcjs.blendRgb.call(void 0, blend, [cb0, cb1, cb2], c);
|
|
1918
1918
|
c[0] = (1 - alpha) * cb0 + alpha * b[0];
|
|
1919
1919
|
c[1] = (1 - alpha) * cb1 + alpha * b[1];
|
|
1920
1920
|
c[2] = (1 - alpha) * cb2 + alpha * b[2];
|
|
@@ -2229,7 +2229,7 @@ function newLayerId(prefix = "layer") {
|
|
|
2229
2229
|
return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
|
|
2230
2230
|
}
|
|
2231
2231
|
function pixelLayers(layers) {
|
|
2232
|
-
return
|
|
2232
|
+
return _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
2233
2233
|
}
|
|
2234
2234
|
function developFilter(layer) {
|
|
2235
2235
|
return _optionalChain([layer, 'access', _8 => _8.filters, 'optionalAccess', _9 => _9.find, 'call', _10 => _10((f) => f.kind === "develop")]);
|
|
@@ -2260,10 +2260,10 @@ function isRenderedLayer(layer) {
|
|
|
2260
2260
|
return layer.type === "smart" || layer.type === "shape";
|
|
2261
2261
|
}
|
|
2262
2262
|
function shapeLayers(layers) {
|
|
2263
|
-
return
|
|
2263
|
+
return _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
|
|
2264
2264
|
}
|
|
2265
2265
|
function smartObjectLayers(layers) {
|
|
2266
|
-
return
|
|
2266
|
+
return _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
|
|
2267
2267
|
}
|
|
2268
2268
|
|
|
2269
2269
|
// src/image-editor/layers/compositor.ts
|
|
@@ -2369,7 +2369,7 @@ var PHOTO_PROFILE = {
|
|
|
2369
2369
|
return v;
|
|
2370
2370
|
}
|
|
2371
2371
|
};
|
|
2372
|
-
var LayerCompositor = class extends
|
|
2372
|
+
var LayerCompositor = class extends _chunkPOGBUYWEcjs.RasterCompositor {
|
|
2373
2373
|
constructor(options = {}) {
|
|
2374
2374
|
super(PHOTO_PROFILE, options);
|
|
2375
2375
|
}
|
|
@@ -2915,47 +2915,47 @@ var fail = (message) => {
|
|
|
2915
2915
|
throw new LayerOperationError(message);
|
|
2916
2916
|
};
|
|
2917
2917
|
function requireLayer(layers, id) {
|
|
2918
|
-
const loc =
|
|
2918
|
+
const loc = _chunkPOGBUYWEcjs.findLayer.call(void 0, layers, id);
|
|
2919
2919
|
if (!loc) {
|
|
2920
|
-
const ids =
|
|
2920
|
+
const ids = _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
|
|
2921
2921
|
fail(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
|
|
2922
2922
|
}
|
|
2923
2923
|
return loc;
|
|
2924
2924
|
}
|
|
2925
2925
|
function requireUnlocked(layer, what, action) {
|
|
2926
|
-
if (
|
|
2927
|
-
if (what !== "all" &&
|
|
2926
|
+
if (_chunkPOGBUYWEcjs.isLayerLocked.call(void 0, layer, "all")) fail(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
|
|
2927
|
+
if (what !== "all" && _chunkPOGBUYWEcjs.isLayerLocked.call(void 0, layer, what)) fail(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
|
|
2928
2928
|
}
|
|
2929
2929
|
function placeLayer(layers, layer, placement = {}, defaultIndex) {
|
|
2930
2930
|
const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
|
|
2931
2931
|
if (given > 1) fail("Give only one of aboveId, belowId and parentId.");
|
|
2932
2932
|
if (placement.aboveId || placement.belowId) {
|
|
2933
2933
|
const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
|
|
2934
|
-
return
|
|
2934
|
+
return _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _19 => _19.parent, 'optionalAccess', _20 => _20.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
|
|
2935
2935
|
}
|
|
2936
2936
|
if (placement.parentId) {
|
|
2937
2937
|
const ref = requireLayer(layers, placement.parentId);
|
|
2938
2938
|
if (ref.layer.type !== "group") fail(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
|
|
2939
|
-
return
|
|
2939
|
+
return _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
|
|
2940
2940
|
}
|
|
2941
|
-
return
|
|
2941
|
+
return _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
|
|
2942
2942
|
}
|
|
2943
2943
|
function removeLayer(layers, id) {
|
|
2944
2944
|
const loc = requireLayer(layers, id);
|
|
2945
2945
|
requireUnlocked(loc.layer, "all", "delete it");
|
|
2946
|
-
return
|
|
2946
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
2947
2947
|
}
|
|
2948
2948
|
function moveLayer(layers, id, placement) {
|
|
2949
2949
|
const loc = requireLayer(layers, id);
|
|
2950
2950
|
requireUnlocked(loc.layer, "all", "move it");
|
|
2951
2951
|
const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
|
|
2952
2952
|
if (target === id) fail("A layer cannot be placed relative to itself.");
|
|
2953
|
-
if (target && loc.layer.type === "group" &&
|
|
2953
|
+
if (target && loc.layer.type === "group" && _chunkPOGBUYWEcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
|
|
2954
2954
|
fail(`Group "${id}" cannot be moved into its own child "${target}".`);
|
|
2955
2955
|
}
|
|
2956
2956
|
if (target) requireLayer(layers, target);
|
|
2957
2957
|
if (!target && placement.index === void 0) fail("Give aboveId, belowId, parentId or index.");
|
|
2958
|
-
const without =
|
|
2958
|
+
const without = _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
2959
2959
|
return placeLayer(without, loc.layer, placement);
|
|
2960
2960
|
}
|
|
2961
2961
|
function withNewIds(layer) {
|
|
@@ -2974,7 +2974,7 @@ function duplicateLayer(layers, id, name) {
|
|
|
2974
2974
|
const copy = withNewIds(loc.layer);
|
|
2975
2975
|
copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
|
|
2976
2976
|
delete copy.locks;
|
|
2977
|
-
return { layers:
|
|
2977
|
+
return { layers: _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _23 => _23.parent, 'optionalAccess', _24 => _24.id]), () => ( null)), loc.index + 1), id: copy.id };
|
|
2978
2978
|
}
|
|
2979
2979
|
function setLayerProperties(layers, id, props) {
|
|
2980
2980
|
const loc = requireLayer(layers, id);
|
|
@@ -3001,7 +3001,7 @@ function setLayerProperties(layers, id, props) {
|
|
|
3001
3001
|
if (props.blend !== void 0) {
|
|
3002
3002
|
if (props.blend === "pass-through") {
|
|
3003
3003
|
if (layer.type !== "group") fail("pass-through is only for groups.");
|
|
3004
|
-
} else if (!
|
|
3004
|
+
} else if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, props.blend)) fail(`Unknown blend mode "${props.blend}".`);
|
|
3005
3005
|
next.blend = props.blend;
|
|
3006
3006
|
}
|
|
3007
3007
|
if (props.clipped !== void 0) {
|
|
@@ -3021,7 +3021,7 @@ function setLayerProperties(layers, id, props) {
|
|
|
3021
3021
|
if (props.collapsed) g.collapsed = true;
|
|
3022
3022
|
else delete g.collapsed;
|
|
3023
3023
|
}
|
|
3024
|
-
return
|
|
3024
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3025
3025
|
}
|
|
3026
3026
|
function groupLayers(layers, ids, name = "Group") {
|
|
3027
3027
|
if (!ids.length) fail("Give at least one layer id to group.");
|
|
@@ -3050,17 +3050,17 @@ function groupLayers(layers, ids, name = "Group") {
|
|
|
3050
3050
|
group.children[0] = c;
|
|
3051
3051
|
}
|
|
3052
3052
|
let out = layers;
|
|
3053
|
-
for (const l of ordered) out =
|
|
3054
|
-
return { layers:
|
|
3053
|
+
for (const l of ordered) out = _chunkPOGBUYWEcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
3054
|
+
return { layers: _chunkPOGBUYWEcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
|
|
3055
3055
|
}
|
|
3056
3056
|
function ungroupLayer(layers, id) {
|
|
3057
3057
|
const loc = requireLayer(layers, id);
|
|
3058
3058
|
if (loc.layer.type !== "group") fail(`Layer "${id}" is not a group.`);
|
|
3059
3059
|
requireUnlocked(loc.layer, "all", "ungroup it");
|
|
3060
3060
|
const group = loc.layer;
|
|
3061
|
-
let out =
|
|
3061
|
+
let out = _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3062
3062
|
group.children.forEach((c, i) => {
|
|
3063
|
-
out =
|
|
3063
|
+
out = _chunkPOGBUYWEcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _33 => _33.parent, 'optionalAccess', _34 => _34.id]), () => ( null)), loc.index + i);
|
|
3064
3064
|
});
|
|
3065
3065
|
return { layers: out, ids: group.children.map((c) => c.id) };
|
|
3066
3066
|
}
|
|
@@ -3073,14 +3073,14 @@ function offsetLayer(layers, id, offset) {
|
|
|
3073
3073
|
const next = { ...layer, offset: { x: Math.round(offset.x), y: Math.round(offset.y) } };
|
|
3074
3074
|
const mask = layer.mask;
|
|
3075
3075
|
if (mask && mask.linked === false && !mask.source) {
|
|
3076
|
-
next.mask = { ...mask, surface:
|
|
3076
|
+
next.mask = { ...mask, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
|
|
3077
3077
|
}
|
|
3078
|
-
return
|
|
3078
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3079
3079
|
}
|
|
3080
3080
|
function setLayerMask(layers, id, mask) {
|
|
3081
3081
|
const loc = requireLayer(layers, id);
|
|
3082
3082
|
requireUnlocked(loc.layer, "all", "change its mask");
|
|
3083
|
-
return
|
|
3083
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, (l) => {
|
|
3084
3084
|
const next = { ...l };
|
|
3085
3085
|
if (mask) next.mask = mask;
|
|
3086
3086
|
else delete next.mask;
|
|
@@ -3119,7 +3119,7 @@ function requirePixelLayer(layers, id) {
|
|
|
3119
3119
|
function addLayerFilter(layers, id, filter) {
|
|
3120
3120
|
const layer = requirePixelLayer(layers, id);
|
|
3121
3121
|
if (_optionalChain([layer, 'access', _35 => _35.filters, 'optionalAccess', _36 => _36.some, 'call', _37 => _37((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
|
|
3122
|
-
return
|
|
3122
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
|
|
3123
3123
|
}
|
|
3124
3124
|
function updateLayerFilter(layers, id, filterId, changes) {
|
|
3125
3125
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -3130,7 +3130,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
|
|
|
3130
3130
|
const merged = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
|
|
3131
3131
|
const filters = [...layer.filters];
|
|
3132
3132
|
filters[i] = merged;
|
|
3133
|
-
return
|
|
3133
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
|
|
3134
3134
|
}
|
|
3135
3135
|
function removeLayerFilter(layers, id, filterId) {
|
|
3136
3136
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -3139,7 +3139,7 @@ function removeLayerFilter(layers, id, filterId) {
|
|
|
3139
3139
|
const next = { ...layer };
|
|
3140
3140
|
if (filters.length) next.filters = filters;
|
|
3141
3141
|
else delete next.filters;
|
|
3142
|
-
return
|
|
3142
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3143
3143
|
}
|
|
3144
3144
|
function requireEffectLayer(layers, id, action) {
|
|
3145
3145
|
const layer = requireLayer(layers, id).layer;
|
|
@@ -3154,7 +3154,7 @@ function guard(fn) {
|
|
|
3154
3154
|
try {
|
|
3155
3155
|
return fn();
|
|
3156
3156
|
} catch (e) {
|
|
3157
|
-
if (e instanceof
|
|
3157
|
+
if (e instanceof _chunkPOGBUYWEcjs.LayerEffectError) fail(e.message);
|
|
3158
3158
|
throw e;
|
|
3159
3159
|
}
|
|
3160
3160
|
}
|
|
@@ -3162,20 +3162,20 @@ function setLayerEffects(layers, id, effects) {
|
|
|
3162
3162
|
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
3163
3163
|
const next = { ...layer };
|
|
3164
3164
|
if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
|
|
3165
|
-
guard(() =>
|
|
3165
|
+
guard(() => _chunkPOGBUYWEcjs.validateLayerEffects.call(void 0, effects));
|
|
3166
3166
|
next.effects = effects;
|
|
3167
3167
|
} else delete next.effects;
|
|
3168
|
-
return
|
|
3168
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3169
3169
|
}
|
|
3170
3170
|
function addLayerEffect(layers, id, kind, params = {}, index) {
|
|
3171
|
-
if (!
|
|
3171
|
+
if (!_chunkPOGBUYWEcjs.isLayerEffectKind.call(void 0, kind)) fail(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkPOGBUYWEcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
3172
3172
|
const layer = requireEffectLayer(layers, id, "add effects");
|
|
3173
3173
|
const current = layerEffectsOf(layer);
|
|
3174
3174
|
const ids = new Set(current.items.map((e) => e.id));
|
|
3175
|
-
let effectId =
|
|
3176
|
-
while (ids.has(effectId)) effectId =
|
|
3175
|
+
let effectId = _chunkPOGBUYWEcjs.newEffectId.call(void 0, );
|
|
3176
|
+
while (ids.has(effectId)) effectId = _chunkPOGBUYWEcjs.newEffectId.call(void 0, );
|
|
3177
3177
|
const { id: _ignored, kind: _kind, ...rest } = params;
|
|
3178
|
-
const effect = guard(() =>
|
|
3178
|
+
const effect = guard(() => _chunkPOGBUYWEcjs.mergeLayerEffect.call(void 0, _chunkPOGBUYWEcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
|
|
3179
3179
|
const items = [...current.items];
|
|
3180
3180
|
const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
|
|
3181
3181
|
items.splice(at, 0, effect);
|
|
@@ -3192,7 +3192,7 @@ function updateLayerEffect(layers, id, effectId, changes) {
|
|
|
3192
3192
|
const i = requireEffect(layer, effectId);
|
|
3193
3193
|
const current = layer.effects;
|
|
3194
3194
|
const items = [...current.items];
|
|
3195
|
-
items[i] = guard(() =>
|
|
3195
|
+
items[i] = guard(() => _chunkPOGBUYWEcjs.mergeLayerEffect.call(void 0, items[i], changes));
|
|
3196
3196
|
return setLayerEffects(layers, id, { ...current, items });
|
|
3197
3197
|
}
|
|
3198
3198
|
function removeLayerEffect(layers, id, effectId) {
|
|
@@ -3215,7 +3215,7 @@ function setLayerEffectsEnabled(layers, id, enabled, scale) {
|
|
|
3215
3215
|
function parseBlend(value, allowPassThrough = false) {
|
|
3216
3216
|
if (value === void 0) return void 0;
|
|
3217
3217
|
if (value === "pass-through" && allowPassThrough) return value;
|
|
3218
|
-
if (!
|
|
3218
|
+
if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, value)) fail(`Unknown blend mode "${String(value)}".`);
|
|
3219
3219
|
return value;
|
|
3220
3220
|
}
|
|
3221
3221
|
function unionRect(a, b) {
|
|
@@ -3227,7 +3227,7 @@ function unionRect(a, b) {
|
|
|
3227
3227
|
}
|
|
3228
3228
|
|
|
3229
3229
|
// src/image-editor/layers/shape.ts
|
|
3230
|
-
var SHAPE_RENDER_MARGIN =
|
|
3230
|
+
var SHAPE_RENDER_MARGIN = _chunkPOGBUYWEcjs.MAX_EFFECT_REACH;
|
|
3231
3231
|
var DEFAULT_MITER_LIMIT = 100;
|
|
3232
3232
|
var fail2 = (message) => {
|
|
3233
3233
|
throw new LayerOperationError(message);
|
|
@@ -3436,11 +3436,11 @@ function fillCoverage(geo, rect, rule) {
|
|
|
3436
3436
|
function paintContext(env) {
|
|
3437
3437
|
const tiles = /* @__PURE__ */ new Map();
|
|
3438
3438
|
return {
|
|
3439
|
-
light:
|
|
3439
|
+
light: _chunkPOGBUYWEcjs.DEFAULT_GLOBAL_LIGHT,
|
|
3440
3440
|
pattern: (id) => {
|
|
3441
3441
|
if (tiles.has(id)) return tiles.get(id);
|
|
3442
|
-
const p = _nullishCoalesce(_optionalChain([env, 'access', _42 => _42.pattern, 'optionalCall', _43 => _43(id)]), () => (
|
|
3443
|
-
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0,
|
|
3442
|
+
const p = _nullishCoalesce(_optionalChain([env, 'access', _42 => _42.pattern, 'optionalCall', _43 => _43(id)]), () => ( _chunkPOGBUYWEcjs.builtinPattern.call(void 0, id)));
|
|
3443
|
+
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkPOGBUYWEcjs.PatternTile)(p) : null;
|
|
3444
3444
|
tiles.set(id, t);
|
|
3445
3445
|
return t;
|
|
3446
3446
|
}
|
|
@@ -3471,9 +3471,9 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
|
|
|
3471
3471
|
if (!fCov && !sCov) return null;
|
|
3472
3472
|
const canvas = { x: 0, y: 0, width: env.width, height: env.height };
|
|
3473
3473
|
const anchor = { x: geo.frame.x, y: geo.frame.y };
|
|
3474
|
-
const fc = fCov ?
|
|
3474
|
+
const fc = fCov ? _chunkPOGBUYWEcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
3475
3475
|
const fo = _nullishCoalesce(_optionalChain([layer, 'access', _44 => _44.fill, 'optionalAccess', _45 => _45.opacity]), () => ( 1));
|
|
3476
|
-
const sc = sCov ?
|
|
3476
|
+
const sc = sCov ? _chunkPOGBUYWEcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
3477
3477
|
const so = _nullishCoalesce(_optionalChain([layer, 'access', _46 => _46.stroke, 'optionalAccess', _47 => _47.paint, 'access', _48 => _48.opacity]), () => ( 1));
|
|
3478
3478
|
const out = new Uint8ClampedArray(n * 4);
|
|
3479
3479
|
let any = false;
|
|
@@ -3512,20 +3512,20 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
|
|
|
3512
3512
|
}
|
|
3513
3513
|
function renderShape(layer, env, options = {}) {
|
|
3514
3514
|
const geo = shapeGeometry(layer);
|
|
3515
|
-
if (!geo.bounds) return
|
|
3515
|
+
if (!geo.bounds) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
|
|
3516
3516
|
let region = intersect(geo.bounds, shapeRenderClip(env));
|
|
3517
3517
|
if (region && options.clip) region = intersect(region, options.clip);
|
|
3518
|
-
if (!region) return
|
|
3518
|
+
if (!region) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
|
|
3519
3519
|
const ctx = paintContext(env);
|
|
3520
3520
|
const tiles = /* @__PURE__ */ new Map();
|
|
3521
|
-
for (const { tx, ty } of
|
|
3522
|
-
const rect = { x: tx *
|
|
3521
|
+
for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, region)) {
|
|
3522
|
+
const rect = { x: tx * _chunkXIOMMGPDcjs.TILE, y: ty * _chunkXIOMMGPDcjs.TILE, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE };
|
|
3523
3523
|
const px = renderShapeRect(layer, rect, env, ctx);
|
|
3524
3524
|
if (!px) continue;
|
|
3525
|
-
const tile =
|
|
3526
|
-
if (tile) tiles.set(
|
|
3525
|
+
const tile = _chunkXIOMMGPDcjs.finishTile.call(void 0, px, 4, 0);
|
|
3526
|
+
if (tile) tiles.set(_chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty), tile);
|
|
3527
3527
|
}
|
|
3528
|
-
return new (0,
|
|
3528
|
+
return new (0, _chunkXIOMMGPDcjs.TiledSurface)(4, tiles, 0);
|
|
3529
3529
|
}
|
|
3530
3530
|
function rerenderShape(layer, env) {
|
|
3531
3531
|
return { ...layer, surface: renderShape(layer, env) };
|
|
@@ -3566,9 +3566,9 @@ function normalizeShapePaint(v, path = "paint") {
|
|
|
3566
3566
|
offset: _nullishCoalesce(g.offset, () => ( { x: 0, y: 0 }))
|
|
3567
3567
|
};
|
|
3568
3568
|
try {
|
|
3569
|
-
|
|
3569
|
+
_chunkPOGBUYWEcjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
|
|
3570
3570
|
} catch (e) {
|
|
3571
|
-
if (e instanceof
|
|
3571
|
+
if (e instanceof _chunkPOGBUYWEcjs.LayerEffectError) fail2(e.message);
|
|
3572
3572
|
throw e;
|
|
3573
3573
|
}
|
|
3574
3574
|
if (gradient.stops.length < 1) fail2(`${path}.gradient.stops needs at least one { position, color }.`);
|
|
@@ -3749,7 +3749,7 @@ function createShapeLayer(init, env, id = newLayerId()) {
|
|
|
3749
3749
|
components: init.components,
|
|
3750
3750
|
fill: init.fill === void 0 ? null : init.fill,
|
|
3751
3751
|
stroke: _nullishCoalesce(init.stroke, () => ( null)),
|
|
3752
|
-
surface:
|
|
3752
|
+
surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
|
|
3753
3753
|
offset: { x: 0, y: 0 }
|
|
3754
3754
|
};
|
|
3755
3755
|
if (init.fillRule && init.fillRule !== "nonzero") layer.fillRule = init.fillRule;
|
|
@@ -3779,7 +3779,7 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
3779
3779
|
if (!("annotation" in patch)) delete next.annotation;
|
|
3780
3780
|
if (!next.components.length) fail2("A shape needs at least one component; delete the layer instead.");
|
|
3781
3781
|
const rendered = rerenderShape(next, env);
|
|
3782
|
-
return { layers:
|
|
3782
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
3783
3783
|
}
|
|
3784
3784
|
function transformShapeComponents(components, f, affine) {
|
|
3785
3785
|
return components.map((c) => {
|
|
@@ -3810,7 +3810,7 @@ function shapeAsPixelLayer(layer) {
|
|
|
3810
3810
|
}
|
|
3811
3811
|
function annotationPaint(color, opacity) {
|
|
3812
3812
|
const c = parseCssColor(color);
|
|
3813
|
-
if (!c || !
|
|
3813
|
+
if (!c || !_chunkPOGBUYWEcjs.parseEffectColor.call(void 0, c.hex)) return void 0;
|
|
3814
3814
|
const a = c.alpha * opacity;
|
|
3815
3815
|
return a !== 1 ? { type: "color", color: c.hex, opacity: a } : { type: "color", color: c.hex };
|
|
3816
3816
|
}
|
|
@@ -3874,7 +3874,7 @@ function shapeFromAnnotation(a) {
|
|
|
3874
3874
|
}
|
|
3875
3875
|
function annotationBlend(a, layerBlend) {
|
|
3876
3876
|
if (layerBlend !== "normal") return layerBlend;
|
|
3877
|
-
return a.blend &&
|
|
3877
|
+
return a.blend && _chunkXIOMMGPDcjs.isBlendMode.call(void 0, a.blend) ? a.blend : "normal";
|
|
3878
3878
|
}
|
|
3879
3879
|
function annotationOfShape(layer) {
|
|
3880
3880
|
const a = layer.annotation;
|
|
@@ -3923,7 +3923,7 @@ function rasterMaskFromLegacy(mask, width, height) {
|
|
|
3923
3923
|
const sel = decodeLayerMask(mask);
|
|
3924
3924
|
if (!sel) return null;
|
|
3925
3925
|
const sized = sel.width === width && sel.height === height ? sel : resizeSelection(sel, width, height);
|
|
3926
|
-
const surface =
|
|
3926
|
+
const surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data: sized.data }, 1, 0, 0, 0);
|
|
3927
3927
|
legacyMaskMemo.set(surface, { width: mask.width, height: mask.height, rle: mask.rle });
|
|
3928
3928
|
const out = { surface, defaultValue: 0 };
|
|
3929
3929
|
if (mask.density !== void 0 && mask.density !== 1) out.density = mask.density;
|
|
@@ -3942,7 +3942,7 @@ function hasResampledLegacyMask(layers, width, height) {
|
|
|
3942
3942
|
function legacyMaskOf(mask, width, height) {
|
|
3943
3943
|
let memo = legacyMaskMemo.get(mask.surface);
|
|
3944
3944
|
if (!memo) {
|
|
3945
|
-
const data =
|
|
3945
|
+
const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width, height });
|
|
3946
3946
|
memo = { width, height, rle: encodeSelectionRle(new Uint8Array(data.buffer, data.byteOffset, data.length)) };
|
|
3947
3947
|
legacyMaskMemo.set(mask.surface, memo);
|
|
3948
3948
|
}
|
|
@@ -4037,7 +4037,7 @@ function backgroundLayer(filters = [], mask) {
|
|
|
4037
4037
|
visible: true,
|
|
4038
4038
|
opacity: 1,
|
|
4039
4039
|
blend: "normal",
|
|
4040
|
-
surface:
|
|
4040
|
+
surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
|
|
4041
4041
|
offset: { x: 0, y: 0 },
|
|
4042
4042
|
source: "document",
|
|
4043
4043
|
filters
|
|
@@ -4047,7 +4047,7 @@ function backgroundLayer(filters = [], mask) {
|
|
|
4047
4047
|
}
|
|
4048
4048
|
function depthRasterMask(source) {
|
|
4049
4049
|
const out = {
|
|
4050
|
-
surface:
|
|
4050
|
+
surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 1, 255),
|
|
4051
4051
|
defaultValue: 255,
|
|
4052
4052
|
source: { ...source, depthRange: [...source.depthRange] }
|
|
4053
4053
|
};
|
|
@@ -4341,7 +4341,7 @@ function geometryHomography(geometry) {
|
|
|
4341
4341
|
var fail3 = (message) => {
|
|
4342
4342
|
throw new LayerOperationError(message);
|
|
4343
4343
|
};
|
|
4344
|
-
var SMART_RENDER_MARGIN =
|
|
4344
|
+
var SMART_RENDER_MARGIN = _chunkPOGBUYWEcjs.MAX_EFFECT_REACH;
|
|
4345
4345
|
function newContentsId() {
|
|
4346
4346
|
return newLayerId("so");
|
|
4347
4347
|
}
|
|
@@ -4374,10 +4374,10 @@ function contentsSurface(contents) {
|
|
|
4374
4374
|
let s = contentsPixels.get(contents);
|
|
4375
4375
|
if (s) return s;
|
|
4376
4376
|
if (contents.kind === "raster") {
|
|
4377
|
-
s = _nullishCoalesce(contents.raster, () => (
|
|
4377
|
+
s = _nullishCoalesce(contents.raster, () => ( _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4)));
|
|
4378
4378
|
} else {
|
|
4379
4379
|
const doc = contents.document;
|
|
4380
|
-
if (!doc) return
|
|
4380
|
+
if (!doc) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
|
|
4381
4381
|
const W = contents.width;
|
|
4382
4382
|
const H = contents.height;
|
|
4383
4383
|
const data = new LayerCompositor().composite(doc.layers, { x: 0, y: 0, width: W, height: H }, {
|
|
@@ -4386,14 +4386,14 @@ function contentsSurface(contents) {
|
|
|
4386
4386
|
globalLight: doc.globalLight,
|
|
4387
4387
|
pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _68 => _68.patterns, 'optionalAccess', _69 => _69.find, 'call', _70 => _70((p) => p.id === id)]), () => ( null))
|
|
4388
4388
|
});
|
|
4389
|
-
s =
|
|
4389
|
+
s = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: W, height: H, data }, 4, 0, 0);
|
|
4390
4390
|
}
|
|
4391
4391
|
contentsPixels.set(contents, s);
|
|
4392
4392
|
return s;
|
|
4393
4393
|
}
|
|
4394
4394
|
function rasterContents(pixels, name, id = newContentsId()) {
|
|
4395
4395
|
if (!(pixels.width > 0 && pixels.height > 0) || pixels.data.length < pixels.width * pixels.height * 4) fail3("Contents pixels must be RGBA with width \xD7 height \xD7 4 bytes.");
|
|
4396
|
-
return { id, name, width: pixels.width, height: pixels.height, kind: "raster", raster:
|
|
4396
|
+
return { id, name, width: pixels.width, height: pixels.height, kind: "raster", raster: _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, pixels, 4, 0, 0) };
|
|
4397
4397
|
}
|
|
4398
4398
|
function documentContents(document, width, height, name, id = newContentsId()) {
|
|
4399
4399
|
if (!(Number.isInteger(width) && Number.isInteger(height) && width > 0 && height > 0)) fail3("Contents width and height must be positive whole numbers.");
|
|
@@ -4437,7 +4437,7 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4437
4437
|
let out;
|
|
4438
4438
|
const move = integerMove(layer);
|
|
4439
4439
|
if (move && !options.clip) {
|
|
4440
|
-
out =
|
|
4440
|
+
out = _chunkXIOMMGPDcjs.translateSurface.call(void 0, src, move.x, move.y);
|
|
4441
4441
|
} else {
|
|
4442
4442
|
const g = placementGeometry(layer);
|
|
4443
4443
|
const interpolation = preview ? placement.interpolation === "nearest" ? "nearest" : "bilinear" : _nullishCoalesce(placement.interpolation, () => ( "bicubic"));
|
|
@@ -4448,7 +4448,7 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4448
4448
|
k = step;
|
|
4449
4449
|
let r = _optionalChain([options, 'access', _75 => _75.reduced, 'optionalAccess', _76 => _76.get, 'call', _77 => _77(k)]);
|
|
4450
4450
|
if (!r) {
|
|
4451
|
-
r =
|
|
4451
|
+
r = _chunkPOGBUYWEcjs.reduceSurface.call(void 0, src, k);
|
|
4452
4452
|
_optionalChain([options, 'access', _78 => _78.reduced, 'optionalAccess', _79 => _79.set, 'call', _80 => _80(k, r)]);
|
|
4453
4453
|
}
|
|
4454
4454
|
source = r;
|
|
@@ -4458,15 +4458,15 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4458
4458
|
if (hasWarp(g)) {
|
|
4459
4459
|
const f = transformMap(g);
|
|
4460
4460
|
if (!f) fail3("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
|
|
4461
|
-
out =
|
|
4461
|
+
out = _chunkPOGBUYWEcjs.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 });
|
|
4462
4462
|
} else {
|
|
4463
4463
|
const h = transformHomography(g);
|
|
4464
4464
|
if (!h) fail3("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
|
|
4465
4465
|
const hk = _chunkMUUXNRU4cjs.multiplyHomographies.call(void 0, [k, 0, 0, 0, k, 0, 0, 0, 1], h);
|
|
4466
|
-
out =
|
|
4466
|
+
out = _chunkPOGBUYWEcjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
|
|
4467
4467
|
}
|
|
4468
4468
|
} catch (e) {
|
|
4469
|
-
if (e instanceof
|
|
4469
|
+
if (e instanceof _chunkPOGBUYWEcjs.TransformTooLargeError) fail3(e.message);
|
|
4470
4470
|
throw e;
|
|
4471
4471
|
}
|
|
4472
4472
|
}
|
|
@@ -4489,7 +4489,7 @@ function filterMaskCoverage(mask, canvas) {
|
|
|
4489
4489
|
if (!mask || mask.enabled === false || mask.source) return null;
|
|
4490
4490
|
const W = canvas.width;
|
|
4491
4491
|
const H = canvas.height;
|
|
4492
|
-
const bytes =
|
|
4492
|
+
const bytes = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width: W, height: H });
|
|
4493
4493
|
let v = new Float32Array(W * H);
|
|
4494
4494
|
let all = true;
|
|
4495
4495
|
for (let i = 0; i < v.length; i++) {
|
|
@@ -4498,7 +4498,7 @@ function filterMaskCoverage(mask, canvas) {
|
|
|
4498
4498
|
}
|
|
4499
4499
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
4500
4500
|
if (all && !(feather > 0)) return null;
|
|
4501
|
-
if (feather > 0) v =
|
|
4501
|
+
if (feather > 0) v = _chunkPOGBUYWEcjs.gaussianBlur.call(void 0, v, W, H, feather, "clamp");
|
|
4502
4502
|
const density = _nullishCoalesce(mask.density, () => ( 1));
|
|
4503
4503
|
if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
|
|
4504
4504
|
return v;
|
|
@@ -4511,7 +4511,7 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4511
4511
|
const key = JSON.stringify([W, H, active.map((f) => ({ ...f, id: void 0 }))]);
|
|
4512
4512
|
let entry = filteredCache.get(placed);
|
|
4513
4513
|
if (!entry || entry.key !== key) {
|
|
4514
|
-
const base =
|
|
4514
|
+
const base = _chunkXIOMMGPDcjs.readRegion.call(void 0, placed, { x: 0, y: 0, width: W, height: H });
|
|
4515
4515
|
let acc = new Uint8ClampedArray(base);
|
|
4516
4516
|
for (const f of active) {
|
|
4517
4517
|
const out = new Uint8ClampedArray(acc);
|
|
@@ -4520,7 +4520,7 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4520
4520
|
if (f.opacity >= 1) acc = out;
|
|
4521
4521
|
else lerpInto(acc, out, f.opacity, null);
|
|
4522
4522
|
} else {
|
|
4523
|
-
|
|
4523
|
+
_chunkPOGBUYWEcjs.blendTile.call(void 0, acc, out, f.blend, f.opacity, null);
|
|
4524
4524
|
}
|
|
4525
4525
|
}
|
|
4526
4526
|
entry = { key, base, filtered: acc };
|
|
@@ -4532,7 +4532,7 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4532
4532
|
result = new Uint8ClampedArray(entry.base);
|
|
4533
4533
|
lerpInto(result, entry.filtered, 1, cov);
|
|
4534
4534
|
}
|
|
4535
|
-
return
|
|
4535
|
+
return _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: W, height: H, data: result }, 4, 0, 0);
|
|
4536
4536
|
}
|
|
4537
4537
|
function lerpInto(dst, src, k, coverage) {
|
|
4538
4538
|
for (let i = 0, p = 0; i < dst.length; i += 4, p++) {
|
|
@@ -4567,7 +4567,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4567
4567
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4568
4568
|
}
|
|
4569
4569
|
if (raw.interpolation !== void 0) {
|
|
4570
|
-
if (!
|
|
4570
|
+
if (!_chunkPOGBUYWEcjs.isInterpolation.call(void 0, raw.interpolation)) fail3(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
|
|
4571
4571
|
if (raw.interpolation !== "bicubic") out.interpolation = raw.interpolation;
|
|
4572
4572
|
}
|
|
4573
4573
|
const g = { box: { x: 0, y: 0, width: contents.width, height: contents.height }, corners: out.corners, warp: _nullishCoalesce(out.warp, () => ( null)) };
|
|
@@ -4587,7 +4587,7 @@ function followMask(mask, before, after) {
|
|
|
4587
4587
|
const inv = _chunkMUUXNRU4cjs.invertHomography.call(void 0, h0);
|
|
4588
4588
|
if (!inv) return mask;
|
|
4589
4589
|
const delta = _chunkMUUXNRU4cjs.multiplyHomographies.call(void 0, inv, h1);
|
|
4590
|
-
const surface =
|
|
4590
|
+
const surface = _chunkPOGBUYWEcjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
|
|
4591
4591
|
return { ...mask, surface };
|
|
4592
4592
|
}
|
|
4593
4593
|
function setSmartPlacement(layers, id, placement, canvas) {
|
|
@@ -4608,7 +4608,7 @@ function setSmartPlacement(layers, id, placement, canvas) {
|
|
|
4608
4608
|
next.smartFilters = { ...next.smartFilters, mask: m };
|
|
4609
4609
|
}
|
|
4610
4610
|
next = rerender(next, canvas, "be transformed");
|
|
4611
|
-
return { layers:
|
|
4611
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
|
|
4612
4612
|
}
|
|
4613
4613
|
function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
4614
4614
|
const layer = requireSmartObject(layers, id);
|
|
@@ -4618,26 +4618,26 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
|
4618
4618
|
if (!mx && !my) return layers;
|
|
4619
4619
|
const corners = layer.placement.corners.map((p) => ({ x: p.x + mx, y: p.y + my }));
|
|
4620
4620
|
let next = { ...layer, placement: { ...layer.placement, corners } };
|
|
4621
|
-
const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface:
|
|
4621
|
+
const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, m2.surface, mx, my) } : m2;
|
|
4622
4622
|
if (layer.mask) next.mask = moveMask(layer.mask);
|
|
4623
4623
|
if (_optionalChain([layer, 'access', _85 => _85.smartFilters, 'optionalAccess', _86 => _86.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
|
|
4624
4624
|
const spatial = activeSmartFilters(layer.smartFilters).some((f) => f.kind === "blur");
|
|
4625
|
-
const b =
|
|
4625
|
+
const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, layer.surface);
|
|
4626
4626
|
const m = SMART_RENDER_MARGIN;
|
|
4627
4627
|
const cut = b && (b.x <= -m || b.y <= -m || b.x + b.width >= canvas.width + m || b.y + b.height >= canvas.height + m);
|
|
4628
4628
|
if (!spatial && !cut && !(_optionalChain([next, 'access', _87 => _87.smartFilters, 'optionalAccess', _88 => _88.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
|
|
4629
|
-
next = { ...next, surface:
|
|
4629
|
+
next = { ...next, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, layer.surface, mx, my) };
|
|
4630
4630
|
} else {
|
|
4631
4631
|
next = rerender(next, canvas, "move");
|
|
4632
4632
|
}
|
|
4633
|
-
return
|
|
4633
|
+
return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
4634
4634
|
}
|
|
4635
4635
|
function translateLayer(layer, dx, dy) {
|
|
4636
4636
|
if (!dx && !dy) return layer;
|
|
4637
4637
|
const moveMask = (m) => {
|
|
4638
4638
|
if (!m) return m;
|
|
4639
4639
|
if (m.source) fail3(`Layer "${layer.name || layer.id}" has a depth mask, which cannot move into a smart object; bake or remove it first.`);
|
|
4640
|
-
return { ...m, surface:
|
|
4640
|
+
return { ...m, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, m.surface, dx, dy) };
|
|
4641
4641
|
};
|
|
4642
4642
|
switch (layer.type) {
|
|
4643
4643
|
case "pixel":
|
|
@@ -4646,7 +4646,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
4646
4646
|
const next = {
|
|
4647
4647
|
...layer,
|
|
4648
4648
|
placement: { ...layer.placement, corners: layer.placement.corners.map((p) => ({ x: p.x + dx, y: p.y + dy })) },
|
|
4649
|
-
surface:
|
|
4649
|
+
surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
4650
4650
|
mask: moveMask(layer.mask)
|
|
4651
4651
|
};
|
|
4652
4652
|
if (!next.mask) delete next.mask;
|
|
@@ -4667,7 +4667,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
4667
4667
|
const next = {
|
|
4668
4668
|
...layer,
|
|
4669
4669
|
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkW3GXSUSQcjs.translateMatrix.call(void 0, dx, dy)),
|
|
4670
|
-
surface:
|
|
4670
|
+
surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
4671
4671
|
mask: moveMask(layer.mask)
|
|
4672
4672
|
};
|
|
4673
4673
|
if (!next.mask) delete next.mask;
|
|
@@ -4685,7 +4685,7 @@ function layerExtent(layer, surfaceOf, canvas) {
|
|
|
4685
4685
|
const s = layer.type === "pixel" ? surfaceOf(layer) : layer.surface;
|
|
4686
4686
|
if (s.defaultValue !== 0) b = full;
|
|
4687
4687
|
else {
|
|
4688
|
-
const c =
|
|
4688
|
+
const c = _chunkXIOMMGPDcjs.contentBounds.call(void 0, s);
|
|
4689
4689
|
b = c ? { x: c.x + layer.offset.x, y: c.y + layer.offset.y, width: c.width, height: c.height } : null;
|
|
4690
4690
|
}
|
|
4691
4691
|
} else if (layer.type === "group") {
|
|
@@ -4693,7 +4693,7 @@ function layerExtent(layer, surfaceOf, canvas) {
|
|
|
4693
4693
|
} else {
|
|
4694
4694
|
b = full;
|
|
4695
4695
|
}
|
|
4696
|
-
const m =
|
|
4696
|
+
const m = _chunkPOGBUYWEcjs.effectsMargin.call(void 0, layer.effects);
|
|
4697
4697
|
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) };
|
|
4698
4698
|
return b;
|
|
4699
4699
|
}
|
|
@@ -4721,7 +4721,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4721
4721
|
if (single && single.type === "pixel") {
|
|
4722
4722
|
const surface = options.surfaceOf(single);
|
|
4723
4723
|
if (surface.defaultValue !== 0) fail3(`Layer "${single.name || single.id}" has no transparent area to crop to; it cannot be converted.`);
|
|
4724
|
-
const b =
|
|
4724
|
+
const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, surface);
|
|
4725
4725
|
if (!b) fail3(`Layer "${single.name || single.id}" has no pixels to convert; paint something first.`);
|
|
4726
4726
|
const contents = {
|
|
4727
4727
|
id: newContentsId(),
|
|
@@ -4729,7 +4729,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4729
4729
|
width: b.width,
|
|
4730
4730
|
height: b.height,
|
|
4731
4731
|
kind: "raster",
|
|
4732
|
-
raster:
|
|
4732
|
+
raster: _chunkXIOMMGPDcjs.translateSurface.call(void 0, surface, -b.x, -b.y)
|
|
4733
4733
|
};
|
|
4734
4734
|
smart = {
|
|
4735
4735
|
type: "smart",
|
|
@@ -4740,14 +4740,14 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4740
4740
|
blend: single.blend,
|
|
4741
4741
|
contents,
|
|
4742
4742
|
placement: placementAt(contents, b.x + single.offset.x, b.y + single.offset.y),
|
|
4743
|
-
surface:
|
|
4743
|
+
surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
|
|
4744
4744
|
offset: { x: 0, y: 0 }
|
|
4745
4745
|
};
|
|
4746
4746
|
if (single.clipped) smart.clipped = true;
|
|
4747
4747
|
if (single.fillOpacity !== void 0) smart.fillOpacity = single.fillOpacity;
|
|
4748
4748
|
if (single.effects) smart.effects = single.effects;
|
|
4749
4749
|
if (single.mask) {
|
|
4750
|
-
smart.mask = single.mask.source ? single.mask : { ...single.mask, surface:
|
|
4750
|
+
smart.mask = single.mask.source ? single.mask : { ...single.mask, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, single.mask.surface, single.offset.x, single.offset.y) };
|
|
4751
4751
|
}
|
|
4752
4752
|
const filters = asSmartFilters(single.filters);
|
|
4753
4753
|
if (filters) smart.smartFilters = filters;
|
|
@@ -4762,7 +4762,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4762
4762
|
delete resolved.source;
|
|
4763
4763
|
layer = resolved;
|
|
4764
4764
|
}
|
|
4765
|
-
if (
|
|
4765
|
+
if (_chunkPOGBUYWEcjs.flattenLayers.call(void 0, [layer]).some((x) => x.type === "pixel" && x.source === "document")) fail3(`Layer "${layer.name || layer.id}" holds the document image inside a group; convert the Background on its own.`);
|
|
4766
4766
|
return translateLayer(layer, -b.x, -b.y);
|
|
4767
4767
|
});
|
|
4768
4768
|
if (nested[0].clipped) {
|
|
@@ -4781,7 +4781,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4781
4781
|
blend: "normal",
|
|
4782
4782
|
contents,
|
|
4783
4783
|
placement: placementAt(contents, b.x, b.y),
|
|
4784
|
-
surface:
|
|
4784
|
+
surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
|
|
4785
4785
|
offset: { x: 0, y: 0 }
|
|
4786
4786
|
};
|
|
4787
4787
|
}
|
|
@@ -4789,8 +4789,8 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4789
4789
|
smart = { ...smart, surface: renderSmartObject(smart, canvas) };
|
|
4790
4790
|
const below = ordered.filter((l) => l.index < top.index).length;
|
|
4791
4791
|
let out = layers;
|
|
4792
|
-
for (const l of ordered) out =
|
|
4793
|
-
return { layers:
|
|
4792
|
+
for (const l of ordered) out = _chunkPOGBUYWEcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
4793
|
+
return { layers: _chunkPOGBUYWEcjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
|
|
4794
4794
|
}
|
|
4795
4795
|
function rasterizeSmartObject(layers, id) {
|
|
4796
4796
|
const layer = requireSmartObject(layers, id);
|
|
@@ -4810,7 +4810,7 @@ function rasterizeSmartObject(layers, id) {
|
|
|
4810
4810
|
if (layer.locks) out.locks = layer.locks;
|
|
4811
4811
|
if (layer.effects) out.effects = layer.effects;
|
|
4812
4812
|
if (layer.fillOpacity !== void 0) out.fillOpacity = layer.fillOpacity;
|
|
4813
|
-
return { layers:
|
|
4813
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
|
|
4814
4814
|
}
|
|
4815
4815
|
function copySmartObject(layers, id, linked, name) {
|
|
4816
4816
|
const loc = requireLayer(layers, id);
|
|
@@ -4820,19 +4820,19 @@ function copySmartObject(layers, id, linked, name) {
|
|
|
4820
4820
|
delete copy.psd;
|
|
4821
4821
|
if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
|
|
4822
4822
|
if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
|
|
4823
|
-
return { layers:
|
|
4823
|
+
return { layers: _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _105 => _105.parent, 'optionalAccess', _106 => _106.id]), () => ( null)), loc.index + 1), layer: copy };
|
|
4824
4824
|
}
|
|
4825
4825
|
function instancesOf(layers, contentsId) {
|
|
4826
|
-
return
|
|
4826
|
+
return _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
|
|
4827
4827
|
}
|
|
4828
4828
|
function replaceContents(layers, contentsId, contents, canvas) {
|
|
4829
4829
|
const ids = instancesOf(layers, contentsId);
|
|
4830
4830
|
if (!ids.length) fail3(`No smart object uses contents "${contentsId}".`);
|
|
4831
|
-
for (const id of ids) requireUnlocked(
|
|
4831
|
+
for (const id of ids) requireUnlocked(_chunkPOGBUYWEcjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
|
|
4832
4832
|
const next = { ...contents, id: contentsId };
|
|
4833
4833
|
let out = layers;
|
|
4834
4834
|
for (const id of ids) {
|
|
4835
|
-
out =
|
|
4835
|
+
out = _chunkPOGBUYWEcjs.mapLayer.call(void 0, out, id, (l) => {
|
|
4836
4836
|
const layer = l;
|
|
4837
4837
|
return rerender({ ...layer, contents: next, placement: refitPlacement(layer, next) }, canvas, "take the new contents");
|
|
4838
4838
|
});
|
|
@@ -4863,7 +4863,7 @@ function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
|
4863
4863
|
if (raw.kind === "psd") fail3("Photoshop filters can only come from a PSD; add develop or blur.");
|
|
4864
4864
|
const base = normalizeFilter(raw, id);
|
|
4865
4865
|
const blend = _nullishCoalesce(raw.blend, () => ( "normal"));
|
|
4866
|
-
if (!
|
|
4866
|
+
if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail3(`Unknown blend mode "${String(blend)}" for a smart filter.`);
|
|
4867
4867
|
const opacity = _nullishCoalesce(raw.opacity, () => ( 1));
|
|
4868
4868
|
if (!(typeof opacity === "number" && opacity >= 0 && opacity <= 1)) fail3("opacity must be a number from 0 to 1.");
|
|
4869
4869
|
return { ...base, blend, opacity };
|
|
@@ -4895,7 +4895,7 @@ function addSmartFilter(layers, id, filter, canvas, index) {
|
|
|
4895
4895
|
const at = index === void 0 ? filters.length : Math.max(0, Math.min(filters.length, Math.floor(index)));
|
|
4896
4896
|
filters.splice(at, 0, filter);
|
|
4897
4897
|
const next = withStack(layer, { ...stack, filters }, canvas);
|
|
4898
|
-
return { layers:
|
|
4898
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
|
|
4899
4899
|
}
|
|
4900
4900
|
function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
4901
4901
|
const layer = editableSmart(layers, id);
|
|
@@ -4907,7 +4907,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
|
4907
4907
|
const extra = Object.keys(changes).filter((k) => !["enabled", "blend", "opacity", "kind"].includes(k));
|
|
4908
4908
|
if (extra.length) fail3(`"${current.name}" is a Photoshop filter we keep but do not model; only enabled, blend and opacity change. Unknown: ${extra.join(", ")}.`);
|
|
4909
4909
|
const blend = _nullishCoalesce(changes.blend, () => ( current.blend));
|
|
4910
|
-
if (!
|
|
4910
|
+
if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail3(`Unknown blend mode "${String(blend)}" for a smart filter.`);
|
|
4911
4911
|
const opacity = _nullishCoalesce(changes.opacity, () => ( current.opacity));
|
|
4912
4912
|
if (!(typeof opacity === "number" && opacity >= 0 && opacity <= 1)) fail3("opacity must be a number from 0 to 1.");
|
|
4913
4913
|
merged = { ...current, enabled: changes.enabled === void 0 ? current.enabled : Boolean(changes.enabled), blend, opacity };
|
|
@@ -4917,7 +4917,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
|
4917
4917
|
const filters = [...layer.smartFilters.filters];
|
|
4918
4918
|
filters[i] = merged;
|
|
4919
4919
|
const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
|
|
4920
|
-
return { layers:
|
|
4920
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged };
|
|
4921
4921
|
}
|
|
4922
4922
|
function removeSmartFilter(layers, id, filterId, canvas) {
|
|
4923
4923
|
const layer = editableSmart(layers, id);
|
|
@@ -4925,7 +4925,7 @@ function removeSmartFilter(layers, id, filterId, canvas) {
|
|
|
4925
4925
|
const stack = layer.smartFilters;
|
|
4926
4926
|
const filters = stack.filters.filter((f) => f.id !== filterId);
|
|
4927
4927
|
const next = withStack(layer, filters.length ? { ...stack, filters } : stack.enabled ? void 0 : { enabled: false, filters }, canvas);
|
|
4928
|
-
return { layers:
|
|
4928
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
4929
4929
|
}
|
|
4930
4930
|
function moveSmartFilter(layers, id, filterId, index, canvas) {
|
|
4931
4931
|
const layer = editableSmart(layers, id);
|
|
@@ -4936,12 +4936,12 @@ function moveSmartFilter(layers, id, filterId, index, canvas) {
|
|
|
4936
4936
|
const [f] = filters.splice(i, 1);
|
|
4937
4937
|
filters.splice(index, 0, f);
|
|
4938
4938
|
const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
|
|
4939
|
-
return { layers:
|
|
4939
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
4940
4940
|
}
|
|
4941
4941
|
function setSmartFiltersEnabled(layers, id, enabled, canvas) {
|
|
4942
4942
|
const layer = editableSmart(layers, id);
|
|
4943
4943
|
const next = withStack(layer, { ...stackOf(layer), enabled: Boolean(enabled) }, canvas);
|
|
4944
|
-
return { layers:
|
|
4944
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
4945
4945
|
}
|
|
4946
4946
|
function setSmartFilterMask(layers, id, mask, canvas) {
|
|
4947
4947
|
const layer = editableSmart(layers, id);
|
|
@@ -4950,7 +4950,7 @@ function setSmartFilterMask(layers, id, mask, canvas) {
|
|
|
4950
4950
|
if (mask) stack.mask = mask;
|
|
4951
4951
|
else delete stack.mask;
|
|
4952
4952
|
const next = withStack(layer, stack, canvas);
|
|
4953
|
-
return { layers:
|
|
4953
|
+
return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
4954
4954
|
}
|
|
4955
4955
|
function withFilterMaskSurface(layer, surface, canvas) {
|
|
4956
4956
|
const stack = stackOf(layer);
|
|
@@ -4964,7 +4964,7 @@ function placementBounds(layer) {
|
|
|
4964
4964
|
// src/image-editor/layers/serialize.ts
|
|
4965
4965
|
var LAYERED_SCHEMA_VERSION = 3;
|
|
4966
4966
|
function serializePatterns(patterns) {
|
|
4967
|
-
return patterns.map((p) => ({ id: p.id, name: p.name, png:
|
|
4967
|
+
return patterns.map((p) => ({ id: p.id, name: p.name, png: _chunkPOGBUYWEcjs.pngDataUrl.call(void 0, p.width, p.height, p.data) }));
|
|
4968
4968
|
}
|
|
4969
4969
|
function deserializePatterns(raw, problems = []) {
|
|
4970
4970
|
if (!Array.isArray(raw)) return [];
|
|
@@ -4983,11 +4983,11 @@ function deserializePatterns(raw, problems = []) {
|
|
|
4983
4983
|
var encodedCache = /* @__PURE__ */ new WeakMap();
|
|
4984
4984
|
function encodeSurface(surface) {
|
|
4985
4985
|
if (encodedCache.has(surface)) return encodedCache.get(surface);
|
|
4986
|
-
const b =
|
|
4986
|
+
const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, surface);
|
|
4987
4987
|
let out = null;
|
|
4988
4988
|
if (b) {
|
|
4989
|
-
const data =
|
|
4990
|
-
out = { url:
|
|
4989
|
+
const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, surface, b);
|
|
4990
|
+
out = { url: _chunkPOGBUYWEcjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
|
|
4991
4991
|
}
|
|
4992
4992
|
encodedCache.set(surface, out);
|
|
4993
4993
|
return out;
|
|
@@ -5009,7 +5009,7 @@ function baseFields(layer, ctx) {
|
|
|
5009
5009
|
function serializeEffects(effects) {
|
|
5010
5010
|
const out = { enabled: effects.enabled, items: JSON.parse(JSON.stringify(effects.items)) };
|
|
5011
5011
|
if (effects.scale !== void 0 && effects.scale !== 1) out.scale = effects.scale;
|
|
5012
|
-
if (effects.psd) out.psd = { key: effects.psd.key, data:
|
|
5012
|
+
if (effects.psd) out.psd = { key: effects.psd.key, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, effects.psd.data) };
|
|
5013
5013
|
return out;
|
|
5014
5014
|
}
|
|
5015
5015
|
function deserializeEffects(raw) {
|
|
@@ -5019,12 +5019,12 @@ function deserializeEffects(raw) {
|
|
|
5019
5019
|
const p = r.psd;
|
|
5020
5020
|
if (p && typeof p.key === "string" && typeof p.data === "string") {
|
|
5021
5021
|
try {
|
|
5022
|
-
psd = { key: p.key, data:
|
|
5022
|
+
psd = { key: p.key, data: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, p.data) };
|
|
5023
5023
|
} catch (e6) {
|
|
5024
5024
|
psd = void 0;
|
|
5025
5025
|
}
|
|
5026
5026
|
}
|
|
5027
|
-
return
|
|
5027
|
+
return _chunkPOGBUYWEcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
|
|
5028
5028
|
}
|
|
5029
5029
|
function serializeMask(mask, hint, ctx) {
|
|
5030
5030
|
const out = { defaultValue: mask.defaultValue };
|
|
@@ -5088,7 +5088,7 @@ function serializeShape(layer, base) {
|
|
|
5088
5088
|
if (layer.fillRule === "evenodd") out.fillRule = "evenodd";
|
|
5089
5089
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5090
5090
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5091
|
-
if (_optionalChain([layer, 'access', _112 => _112.psd, 'optionalAccess', _113 => _113.blocks, 'optionalAccess', _114 => _114.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data:
|
|
5091
|
+
if (_optionalChain([layer, 'access', _112 => _112.psd, 'optionalAccess', _113 => _113.blocks, 'optionalAccess', _114 => _114.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, b.data) })) };
|
|
5092
5092
|
return out;
|
|
5093
5093
|
}
|
|
5094
5094
|
function readShape(r, base, ctx) {
|
|
@@ -5120,7 +5120,7 @@ function readShape(r, base, ctx) {
|
|
|
5120
5120
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) out.fillOpacity = num(r.fillOpacity, 0, 1, 1);
|
|
5121
5121
|
if (a && shapeFromAnnotation(a)) out.annotation = a;
|
|
5122
5122
|
if (r.psd && Array.isArray(r.psd.blocks)) {
|
|
5123
|
-
const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data:
|
|
5123
|
+
const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, b.data) }));
|
|
5124
5124
|
if (blocks.length) out.psd = { blocks };
|
|
5125
5125
|
}
|
|
5126
5126
|
return out;
|
|
@@ -5132,7 +5132,7 @@ function readShape(r, base, ctx) {
|
|
|
5132
5132
|
function serializeSmartFilters(stack, layerId, ctx) {
|
|
5133
5133
|
const out = {
|
|
5134
5134
|
enabled: stack.enabled,
|
|
5135
|
-
filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data:
|
|
5135
|
+
filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, f.data) } : JSON.parse(JSON.stringify(f)))
|
|
5136
5136
|
};
|
|
5137
5137
|
if (stack.mask) out.mask = serializeMask(stack.mask, `${layerId}-filter-mask`, ctx);
|
|
5138
5138
|
return out;
|
|
@@ -5158,7 +5158,7 @@ function serializeSmartObject(layer, base, ctx) {
|
|
|
5158
5158
|
}
|
|
5159
5159
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5160
5160
|
if (layer.psd) {
|
|
5161
|
-
out.psd = { key: layer.psd.key, data:
|
|
5161
|
+
out.psd = { key: layer.psd.key, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, layer.psd.data) };
|
|
5162
5162
|
if (layer.psd.placed) out.psd.placed = layer.psd.placed;
|
|
5163
5163
|
}
|
|
5164
5164
|
return out;
|
|
@@ -5169,8 +5169,8 @@ function serializeContents(c, ctx) {
|
|
|
5169
5169
|
const enc = encodeSurface(c.raster);
|
|
5170
5170
|
if (enc) {
|
|
5171
5171
|
if (enc.x !== 0 || enc.y !== 0) {
|
|
5172
|
-
const data =
|
|
5173
|
-
out.asset = ctx.addAsset(
|
|
5172
|
+
const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, c.raster, { x: 0, y: 0, width: c.width, height: c.height });
|
|
5173
|
+
out.asset = ctx.addAsset(_chunkPOGBUYWEcjs.pngDataUrl.call(void 0, c.width, c.height, data, 4), `contents-${c.id}`);
|
|
5174
5174
|
} else out.asset = ctx.addAsset(enc.url, `contents-${c.id}`);
|
|
5175
5175
|
}
|
|
5176
5176
|
}
|
|
@@ -5179,7 +5179,7 @@ function serializeContents(c, ctx) {
|
|
|
5179
5179
|
if (c.document.globalLight) out.globalLight = { ...c.document.globalLight };
|
|
5180
5180
|
if (_optionalChain([c, 'access', _119 => _119.document, 'access', _120 => _120.patterns, 'optionalAccess', _121 => _121.length])) out.patterns = serializePatterns(c.document.patterns);
|
|
5181
5181
|
}
|
|
5182
|
-
if (c.file) out.file = { type: c.file.type, data:
|
|
5182
|
+
if (c.file) out.file = { type: c.file.type, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, c.file.bytes) };
|
|
5183
5183
|
if (c.linked) out.linked = { path: c.linked.path };
|
|
5184
5184
|
return out;
|
|
5185
5185
|
}
|
|
@@ -5215,7 +5215,7 @@ async function serializeLayersExternal(layers, store) {
|
|
|
5215
5215
|
for (const [id, url] of Object.entries(inline.assets)) {
|
|
5216
5216
|
let ref = refs.get(url);
|
|
5217
5217
|
if (!ref) {
|
|
5218
|
-
const parsed =
|
|
5218
|
+
const parsed = _chunkPOGBUYWEcjs.parseDataUrl.call(void 0, url);
|
|
5219
5219
|
const png = decodePngHeader(parsed.bytes);
|
|
5220
5220
|
ref = await store.put(new Blob([parsed.bytes], { type: "image/png" }), { id, width: png.width, height: png.height });
|
|
5221
5221
|
if (typeof ref !== "string" || !ref) throw new Error(`The asset store returned no reference for "${id}".`);
|
|
@@ -5243,7 +5243,7 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
5243
5243
|
try {
|
|
5244
5244
|
const blob = await store.get(ref);
|
|
5245
5245
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
5246
|
-
out[id] = `data:image/png;base64,${
|
|
5246
|
+
out[id] = `data:image/png;base64,${_chunkPOGBUYWEcjs.bytesToBase64.call(void 0, bytes)}`;
|
|
5247
5247
|
} catch (err) {
|
|
5248
5248
|
problems.push(`Asset "${id}" (${ref}) could not be fetched: ${err.message}`);
|
|
5249
5249
|
}
|
|
@@ -5251,9 +5251,9 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
5251
5251
|
return out;
|
|
5252
5252
|
}
|
|
5253
5253
|
function decodePngDataUrl(url, channels) {
|
|
5254
|
-
const parsed =
|
|
5254
|
+
const parsed = _chunkPOGBUYWEcjs.parseDataUrl.call(void 0, url);
|
|
5255
5255
|
if (!parsed) throw new Error("Asset is not a data URL.");
|
|
5256
|
-
const png =
|
|
5256
|
+
const png = _chunkPOGBUYWEcjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
|
|
5257
5257
|
if (png.channels === channels) return png;
|
|
5258
5258
|
if (channels === 1) {
|
|
5259
5259
|
const out2 = new Uint8ClampedArray(png.width * png.height);
|
|
@@ -5271,18 +5271,18 @@ function decodePngDataUrl(url, channels) {
|
|
|
5271
5271
|
}
|
|
5272
5272
|
var num = (v, lo, hi, fallback) => typeof v === "number" && Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : fallback;
|
|
5273
5273
|
function readSurface(ref, x, y, channels, defaultValue, ctx, what) {
|
|
5274
|
-
if (typeof ref !== "string" || !ref) return
|
|
5274
|
+
if (typeof ref !== "string" || !ref) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, channels, defaultValue);
|
|
5275
5275
|
const url = ctx.assets[ref];
|
|
5276
5276
|
if (typeof url !== "string") {
|
|
5277
5277
|
ctx.problems.push(`${what}: asset "${ref}" is missing`);
|
|
5278
|
-
return
|
|
5278
|
+
return _chunkXIOMMGPDcjs.emptySurface.call(void 0, channels, defaultValue);
|
|
5279
5279
|
}
|
|
5280
5280
|
try {
|
|
5281
5281
|
const px = (_nullishCoalesce(ctx.decodeAsset, () => ( decodePngDataUrl)))(url, channels);
|
|
5282
|
-
return
|
|
5282
|
+
return _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, px, channels, Math.round(num(x, -1e7, 1e7, 0)), Math.round(num(y, -1e7, 1e7, 0)), defaultValue);
|
|
5283
5283
|
} catch (err) {
|
|
5284
5284
|
ctx.problems.push(`${what}: asset "${ref}" could not be decoded (${err.message})`);
|
|
5285
|
-
return
|
|
5285
|
+
return _chunkXIOMMGPDcjs.emptySurface.call(void 0, channels, defaultValue);
|
|
5286
5286
|
}
|
|
5287
5287
|
}
|
|
5288
5288
|
function readMask(raw, ctx, what) {
|
|
@@ -5290,7 +5290,7 @@ function readMask(raw, ctx, what) {
|
|
|
5290
5290
|
const r = raw;
|
|
5291
5291
|
const defaultValue = r.defaultValue === 255 ? 255 : 0;
|
|
5292
5292
|
const mask = {
|
|
5293
|
-
surface: r.source ?
|
|
5293
|
+
surface: r.source ? _chunkXIOMMGPDcjs.emptySurface.call(void 0, 1, 255) : readSurface(r.asset, r.x, r.y, 1, defaultValue, ctx, `${what} mask`),
|
|
5294
5294
|
defaultValue: r.source ? 255 : defaultValue
|
|
5295
5295
|
};
|
|
5296
5296
|
if (typeof r.density === "number" && r.density !== 1) mask.density = num(r.density, 0, 1, 1);
|
|
@@ -5338,7 +5338,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5338
5338
|
name: typeof r.name === "string" ? r.name : "",
|
|
5339
5339
|
visible: r.visible !== false,
|
|
5340
5340
|
opacity: num(r.opacity, 0, 1, 1),
|
|
5341
|
-
blend:
|
|
5341
|
+
blend: _chunkXIOMMGPDcjs.normalizeBlendMode.call(void 0, r.blend)
|
|
5342
5342
|
};
|
|
5343
5343
|
if (r.clipped === true) base.clipped = true;
|
|
5344
5344
|
const mask = readMask(r.mask, ctx, `Layer "${base.name || id}"`);
|
|
@@ -5355,7 +5355,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5355
5355
|
const layer = {
|
|
5356
5356
|
...base,
|
|
5357
5357
|
type: "pixel",
|
|
5358
|
-
surface: r.source === "document" ?
|
|
5358
|
+
surface: r.source === "document" ? _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
|
|
5359
5359
|
offset: { x: Math.round(num(_optionalChain([r, 'access', _122 => _122.offset, 'optionalAccess', _123 => _123.x]), -1e7, 1e7, 0)), y: Math.round(num(_optionalChain([r, 'access', _124 => _124.offset, 'optionalAccess', _125 => _125.y]), -1e7, 1e7, 0)) }
|
|
5360
5360
|
};
|
|
5361
5361
|
if (r.source === "document") layer.source = "document";
|
|
@@ -5374,7 +5374,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5374
5374
|
}
|
|
5375
5375
|
case "group": {
|
|
5376
5376
|
const children = Array.isArray(r.children) ? r.children.map((c) => deserializeLayer(c, ctx)).filter(Boolean) : [];
|
|
5377
|
-
const blend = r.blend === "pass-through" ? "pass-through" :
|
|
5377
|
+
const blend = r.blend === "pass-through" ? "pass-through" : _chunkXIOMMGPDcjs.isBlendMode.call(void 0, r.blend) ? r.blend : "pass-through";
|
|
5378
5378
|
const group = { ...base, type: "group", blend, children };
|
|
5379
5379
|
if (r.collapsed === true) group.collapsed = true;
|
|
5380
5380
|
return group;
|
|
@@ -5424,7 +5424,7 @@ function readContents(id, ctx) {
|
|
|
5424
5424
|
const c = { id, name: typeof raw.name === "string" ? raw.name : "Contents", width, height, kind: raw.kind === "document" ? "document" : "raster" };
|
|
5425
5425
|
if (raw.file && typeof raw.file.type === "string" && typeof raw.file.data === "string") {
|
|
5426
5426
|
try {
|
|
5427
|
-
c.file = { type: raw.file.type, bytes:
|
|
5427
|
+
c.file = { type: raw.file.type, bytes: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, raw.file.data) };
|
|
5428
5428
|
} catch (e7) {
|
|
5429
5429
|
ctx.problems.push(`Smart object contents "${c.name}": the embedded file could not be read`);
|
|
5430
5430
|
}
|
|
@@ -5432,7 +5432,7 @@ function readContents(id, ctx) {
|
|
|
5432
5432
|
if (raw.linked && typeof raw.linked.path === "string") c.linked = { path: raw.linked.path };
|
|
5433
5433
|
if (c.kind === "raster") {
|
|
5434
5434
|
if (typeof raw.asset === "string") c.raster = readSurface(raw.asset, 0, 0, 4, 0, ctx, `Smart object contents "${c.name}"`);
|
|
5435
|
-
else if (!c.file) c.raster =
|
|
5435
|
+
else if (!c.file) c.raster = _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
|
|
5436
5436
|
} else {
|
|
5437
5437
|
const outer = ctx.canvas;
|
|
5438
5438
|
ctx.canvas = { width, height };
|
|
@@ -5455,11 +5455,11 @@ function readSmartFilters(raw, ctx, what) {
|
|
|
5455
5455
|
let k = 0;
|
|
5456
5456
|
for (const f of list2) {
|
|
5457
5457
|
if (!f || typeof f !== "object") continue;
|
|
5458
|
-
const blend =
|
|
5458
|
+
const blend = _chunkXIOMMGPDcjs.isBlendMode.call(void 0, f.blend) && f.blend !== "pigment" ? f.blend : "normal";
|
|
5459
5459
|
const opacity = num(f.opacity, 0, 1, 1);
|
|
5460
5460
|
if (f.kind === "psd") {
|
|
5461
5461
|
try {
|
|
5462
|
-
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:
|
|
5462
|
+
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: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, String(_nullishCoalesce(f.data, () => ( "")))), blend, opacity });
|
|
5463
5463
|
} catch (e8) {
|
|
5464
5464
|
ctx.problems.push(`${what}: a Photoshop smart filter could not be read`);
|
|
5465
5465
|
}
|
|
@@ -5485,19 +5485,19 @@ function readSmartObject(r, base, ctx) {
|
|
|
5485
5485
|
try {
|
|
5486
5486
|
const raw = { corners: p.corners };
|
|
5487
5487
|
if (p.warp && _chunkW3GXSUSQcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
5488
|
-
if (
|
|
5488
|
+
if (_chunkPOGBUYWEcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
5489
5489
|
placement = normalizePlacement(raw, contents);
|
|
5490
5490
|
} catch (e) {
|
|
5491
5491
|
ctx.problems.push(`${what}: its placement is invalid (${e instanceof Error ? e.message : String(e)}); it was placed at the top left`);
|
|
5492
5492
|
placement = { corners: [{ x: 0, y: 0 }, { x: contents.width, y: 0 }, { x: contents.width, y: contents.height }, { x: 0, y: contents.height }] };
|
|
5493
5493
|
}
|
|
5494
|
-
const layer = { ...base, type: "smart", contents, placement, surface:
|
|
5494
|
+
const layer = { ...base, type: "smart", contents, placement, surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
|
|
5495
5495
|
const filters = readSmartFilters(r.smartFilters, ctx, what);
|
|
5496
5496
|
if (filters) layer.smartFilters = filters;
|
|
5497
5497
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num(r.fillOpacity, 0, 1, 1);
|
|
5498
5498
|
if (r.psd && typeof r.psd.key === "string" && typeof r.psd.data === "string") {
|
|
5499
5499
|
try {
|
|
5500
|
-
layer.psd = { key: r.psd.key, data:
|
|
5500
|
+
layer.psd = { key: r.psd.key, data: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, r.psd.data) };
|
|
5501
5501
|
if (typeof r.psd.placed === "string") layer.psd.placed = r.psd.placed;
|
|
5502
5502
|
} catch (e9) {
|
|
5503
5503
|
}
|
|
@@ -5821,9 +5821,9 @@ function packbitsDecodeInto(src, expected, out, at) {
|
|
|
5821
5821
|
function inflateChecked(data, expected) {
|
|
5822
5822
|
let out;
|
|
5823
5823
|
try {
|
|
5824
|
-
out =
|
|
5824
|
+
out = _chunkPOGBUYWEcjs.inflate.call(void 0, data, { maxOutput: expected + (1 << 20), sizeHint: expected, verify: false });
|
|
5825
5825
|
} catch (e) {
|
|
5826
|
-
throw new PsdError(`ZIP channel data: ${e instanceof
|
|
5826
|
+
throw new PsdError(`ZIP channel data: ${e instanceof _chunkPOGBUYWEcjs.ZlibError || e instanceof Error ? e.message : String(e)}`);
|
|
5827
5827
|
}
|
|
5828
5828
|
if (out.length < expected) throw new PsdError(`ZIP stream produced ${out.length} of ${expected} bytes.`);
|
|
5829
5829
|
return out.length === expected ? out : out.subarray(0, expected);
|
|
@@ -6717,11 +6717,11 @@ function filterMaskFromItem(item) {
|
|
|
6717
6717
|
const height = rect.bottom - rect.top;
|
|
6718
6718
|
if (!(width > 0 && height > 0) || width * height > 1 << 28) return null;
|
|
6719
6719
|
const bytes = decodePlanes(plane.compression, plane.data, { planes: 1, width, height, depth: 8, psb: true });
|
|
6720
|
-
const surface =
|
|
6720
|
+
const surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data: bytes }, 1, rect.left, rect.top, 255);
|
|
6721
6721
|
return { surface, defaultValue: 255 };
|
|
6722
6722
|
}
|
|
6723
6723
|
function filterMaskItem(placed, mask, area) {
|
|
6724
|
-
const painted =
|
|
6724
|
+
const painted = _chunkXIOMMGPDcjs.contentBounds.call(void 0, mask.surface);
|
|
6725
6725
|
let b = _nullishCoalesce(painted, () => ( { x: 0, y: 0, width: 1, height: 1 }));
|
|
6726
6726
|
if (mask.defaultValue !== 255 && area) {
|
|
6727
6727
|
const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _134 => _134.x]), () => ( area.x)));
|
|
@@ -6731,7 +6731,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
6731
6731
|
b = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
|
|
6732
6732
|
}
|
|
6733
6733
|
const rect = { top: b.y, left: b.x, bottom: b.y + b.height, right: b.x + b.width };
|
|
6734
|
-
const values =
|
|
6734
|
+
const values = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, b);
|
|
6735
6735
|
const plane = new Uint8Array(values.buffer, values.byteOffset, values.length);
|
|
6736
6736
|
return {
|
|
6737
6737
|
id: placed,
|
|
@@ -7863,11 +7863,11 @@ function safeSize(ctx, rect, name) {
|
|
|
7863
7863
|
}
|
|
7864
7864
|
function recordPixels(ctx, rec, name) {
|
|
7865
7865
|
const { width, height } = safeSize(ctx, rec.rect, name);
|
|
7866
|
-
if (!width || !height || ctx.skipPixels) return
|
|
7866
|
+
if (!width || !height || ctx.skipPixels) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
|
|
7867
7867
|
const ids = [...Array.from({ length: ctx.colorCount }, (_, i) => i), CHANNEL_ALPHA];
|
|
7868
7868
|
const planes = ids.map((id) => rec.channels.some((c) => c.id === id) ? _nullishCoalesce(decodeOr(ctx, rec, id, name), () => ( null)) : void 0);
|
|
7869
|
-
if (planes.some((p) => p === null)) return
|
|
7870
|
-
if (planes.every((p) => p === void 0)) return
|
|
7869
|
+
if (planes.some((p) => p === null)) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
|
|
7870
|
+
if (planes.every((p) => p === void 0)) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
|
|
7871
7871
|
const data = toRgba8({
|
|
7872
7872
|
width,
|
|
7873
7873
|
height,
|
|
@@ -7877,7 +7877,7 @@ function recordPixels(ctx, rec, name) {
|
|
|
7877
7877
|
alpha: planes[ctx.colorCount],
|
|
7878
7878
|
palette: ctx.palette
|
|
7879
7879
|
});
|
|
7880
|
-
return
|
|
7880
|
+
return _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, rec.rect.left, rec.rect.top);
|
|
7881
7881
|
}
|
|
7882
7882
|
function recordMask(ctx, rec, name) {
|
|
7883
7883
|
const m = rec.mask;
|
|
@@ -7888,11 +7888,11 @@ function recordMask(ctx, rec, name) {
|
|
|
7888
7888
|
const rect = useReal ? m.real.rect : m.rect;
|
|
7889
7889
|
const def = (useReal ? m.real.background : m.defaultColor) >= 128 ? 255 : 0;
|
|
7890
7890
|
const flags = useReal ? m.real.flags : m.flags;
|
|
7891
|
-
let surface =
|
|
7891
|
+
let surface = _chunkXIOMMGPDcjs.emptySurface.call(void 0, 1, def);
|
|
7892
7892
|
const { width, height } = safeSize(ctx, rect, name);
|
|
7893
7893
|
if (width && height && !ctx.skipPixels) {
|
|
7894
7894
|
const plane = decodeOr(ctx, rec, id, name);
|
|
7895
|
-
if (plane) surface =
|
|
7895
|
+
if (plane) surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data: toMask8(plane, width, height, ctx.file.header.depth) }, 1, rect.left, rect.top, def);
|
|
7896
7896
|
}
|
|
7897
7897
|
const mask = { surface, defaultValue: def };
|
|
7898
7898
|
if (m.userDensity !== void 0 && m.userDensity < 255) mask.density = percent(m.userDensity);
|
|
@@ -7952,7 +7952,7 @@ function recordEffects(ctx, rec, name, notes, group) {
|
|
|
7952
7952
|
}
|
|
7953
7953
|
for (const e of parsed.effects.items) {
|
|
7954
7954
|
for (const id of patternIds(e)) {
|
|
7955
|
-
if (ctx.patterns.has(id) ||
|
|
7955
|
+
if (ctx.patterns.has(id) || _chunkPOGBUYWEcjs.builtinPattern.call(void 0, id)) continue;
|
|
7956
7956
|
ctx.warn.add("A pattern effect uses a pattern the file does not contain, and paints nothing", name);
|
|
7957
7957
|
notes.push(`pattern "${id}" is not in the file`);
|
|
7958
7958
|
}
|
|
@@ -8031,7 +8031,7 @@ function importNode(ctx, node, depth) {
|
|
|
8031
8031
|
if (!file || file.kind !== "liFD") notes.push("linked contents come in as the stored pixels");
|
|
8032
8032
|
entry.type = "smart";
|
|
8033
8033
|
entry.status = notes.length ? "approximated" : "mapped";
|
|
8034
|
-
return { type: "pixel", id: ctx.newId(name), ...props, surface:
|
|
8034
|
+
return { type: "pixel", id: ctx.newId(name), ...props, surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
|
|
8035
8035
|
}
|
|
8036
8036
|
}
|
|
8037
8037
|
if (kind === "smart-object" && !ctx.skipPixels) {
|
|
@@ -8081,8 +8081,8 @@ function contentsFor(ctx, placed, name, notes) {
|
|
|
8081
8081
|
document: { layers: nested.layers, globalLight: nested.globalLight, patterns: nested.patterns.length ? nested.patterns : void 0 }
|
|
8082
8082
|
};
|
|
8083
8083
|
} else if (t.ext === "png") {
|
|
8084
|
-
const png =
|
|
8085
|
-
out = { ...base, kind: "raster", width: png.width, height: png.height, raster:
|
|
8084
|
+
const png = _chunkPOGBUYWEcjs.decodePng.call(void 0, file.bytes);
|
|
8085
|
+
out = { ...base, kind: "raster", width: png.width, height: png.height, raster: _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, png, 4, 0, 0) };
|
|
8086
8086
|
} else {
|
|
8087
8087
|
const size = _nullishCoalesce(placed.size, () => ( { width: 0, height: 0 }));
|
|
8088
8088
|
if (!(size.width > 0 && size.height > 0)) throw new PsdError("the contents have no stored size");
|
|
@@ -8137,7 +8137,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
8137
8137
|
width,
|
|
8138
8138
|
height,
|
|
8139
8139
|
kind: "raster",
|
|
8140
|
-
raster:
|
|
8140
|
+
raster: _chunkXIOMMGPDcjs.translateSurface.call(void 0, surface, -rec.rect.left, -rec.rect.top)
|
|
8141
8141
|
};
|
|
8142
8142
|
if (file && file.kind !== "liFD") {
|
|
8143
8143
|
contents.linked = { path: _nullishCoalesce(file.path, () => ( file.name)) };
|
|
@@ -8211,7 +8211,7 @@ function mergedLayer(ctx) {
|
|
|
8211
8211
|
visible: true,
|
|
8212
8212
|
opacity: 1,
|
|
8213
8213
|
blend: "normal",
|
|
8214
|
-
surface:
|
|
8214
|
+
surface: _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4),
|
|
8215
8215
|
offset: { x: 0, y: 0 }
|
|
8216
8216
|
};
|
|
8217
8217
|
}
|
|
@@ -8388,34 +8388,34 @@ function blendOf(d, key, fallback, notes) {
|
|
|
8388
8388
|
function colorOf(d, fallback = "#000000") {
|
|
8389
8389
|
if (!d) return fallback;
|
|
8390
8390
|
const g = (k) => descNumber(d, k);
|
|
8391
|
-
if (g("redFloat") !== void 0) return
|
|
8391
|
+
if (g("redFloat") !== void 0) return _chunkPOGBUYWEcjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
|
|
8392
8392
|
switch (d.classId) {
|
|
8393
8393
|
case "HSBC": {
|
|
8394
8394
|
const rgb = decodePsdColor(1, [(_nullishCoalesce(g("H "), () => ( 0))) / 360 * 65535, (_nullishCoalesce(g("Strt"), () => ( 0))) / 100 * 65535, (_nullishCoalesce(g("Brgh"), () => ( 0))) / 100 * 65535]);
|
|
8395
|
-
return rgb ?
|
|
8395
|
+
return rgb ? _chunkPOGBUYWEcjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
8396
8396
|
}
|
|
8397
8397
|
case "CMYC": {
|
|
8398
8398
|
const inv = (k) => (1 - (_nullishCoalesce(g(k), () => ( 0))) / 100) * 65535;
|
|
8399
8399
|
const rgb = decodePsdColor(2, [inv("Cyn "), inv("Mgnt"), inv("Ylw "), inv("Blck")]);
|
|
8400
|
-
return rgb ?
|
|
8400
|
+
return rgb ? _chunkPOGBUYWEcjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
8401
8401
|
}
|
|
8402
8402
|
case "LbCl": {
|
|
8403
8403
|
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]);
|
|
8404
|
-
return rgb ?
|
|
8404
|
+
return rgb ? _chunkPOGBUYWEcjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
8405
8405
|
}
|
|
8406
8406
|
case "Grsc": {
|
|
8407
8407
|
const v = 1 - (_nullishCoalesce(g("Gry "), () => ( 0))) / 100;
|
|
8408
|
-
return
|
|
8408
|
+
return _chunkPOGBUYWEcjs.effectColorHex.call(void 0, [v, v, v]);
|
|
8409
8409
|
}
|
|
8410
8410
|
}
|
|
8411
8411
|
const r = g("Rd ");
|
|
8412
8412
|
const gr = g("Grn ");
|
|
8413
8413
|
const b = g("Bl ");
|
|
8414
8414
|
if (r === void 0 || gr === void 0 || b === void 0) return fallback;
|
|
8415
|
-
return
|
|
8415
|
+
return _chunkPOGBUYWEcjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
|
|
8416
8416
|
}
|
|
8417
8417
|
function colorDesc(hex) {
|
|
8418
|
-
const [r, g, b] = _nullishCoalesce(
|
|
8418
|
+
const [r, g, b] = _nullishCoalesce(_chunkPOGBUYWEcjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
|
|
8419
8419
|
return descriptor("RGBC", [
|
|
8420
8420
|
["Rd ", dbl2(r * 255)],
|
|
8421
8421
|
["Grn ", dbl2(g * 255)],
|
|
@@ -8498,9 +8498,9 @@ function gradientOf(d, notes) {
|
|
|
8498
8498
|
raw.forEach((s, i) => {
|
|
8499
8499
|
if (i > 0 && Math.abs(s.mid - 0.5) > 1e-3) {
|
|
8500
8500
|
const a = raw[i - 1];
|
|
8501
|
-
const ca =
|
|
8502
|
-
const cb =
|
|
8503
|
-
stops.push({ position: a.position + (s.position - a.position) * s.mid, color:
|
|
8501
|
+
const ca = _chunkPOGBUYWEcjs.parseEffectColor.call(void 0, a.color);
|
|
8502
|
+
const cb = _chunkPOGBUYWEcjs.parseEffectColor.call(void 0, s.color);
|
|
8503
|
+
stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkPOGBUYWEcjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
|
|
8504
8504
|
notes.add("gradient midpoints are drawn as straight segments");
|
|
8505
8505
|
}
|
|
8506
8506
|
stops.push({ position: s.position, color: s.color });
|
|
@@ -8612,8 +8612,8 @@ var KINDS = [
|
|
|
8612
8612
|
["FrFX", "frameFXMulti", "stroke"]
|
|
8613
8613
|
];
|
|
8614
8614
|
function common(d, kind, notes) {
|
|
8615
|
-
const def =
|
|
8616
|
-
return { id:
|
|
8615
|
+
const def = _chunkPOGBUYWEcjs.defaultLayerEffect.call(void 0, kind, "x");
|
|
8616
|
+
return { id: _chunkPOGBUYWEcjs.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) };
|
|
8617
8617
|
}
|
|
8618
8618
|
function readOne(kind, d, notes) {
|
|
8619
8619
|
const size = (key, fallback) => clamp3(num2(d, key, fallback), 0, 250);
|
|
@@ -8656,7 +8656,7 @@ function readOne(kind, d, notes) {
|
|
|
8656
8656
|
case "bevel-emboss": {
|
|
8657
8657
|
const styles = { OtrB: "outer-bevel", InrB: "inner-bevel", Embs: "emboss", PlEb: "pillow-emboss", strokeEmboss: "stroke-emboss" };
|
|
8658
8658
|
const out = {
|
|
8659
|
-
id:
|
|
8659
|
+
id: _chunkPOGBUYWEcjs.newEffectId.call(void 0, ),
|
|
8660
8660
|
enabled: descBool(d, "enab") !== false,
|
|
8661
8661
|
kind,
|
|
8662
8662
|
style: _nullishCoalesce(styles[_nullishCoalesce(enumOf2(d, "bvlS"), () => ( ""))], () => ( "inner-bevel")),
|
|
@@ -8867,10 +8867,10 @@ function writeLfx2(effects) {
|
|
|
8867
8867
|
["Scl ", unit2("#Prc", 100)],
|
|
8868
8868
|
["masterFXSwitch", boolV2(effects.enabled)]
|
|
8869
8869
|
];
|
|
8870
|
-
const scale =
|
|
8870
|
+
const scale = _chunkPOGBUYWEcjs.effectsScale.call(void 0, effects);
|
|
8871
8871
|
let dropped = 0;
|
|
8872
8872
|
for (const [single, multi, kind] of KINDS) {
|
|
8873
|
-
const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(
|
|
8873
|
+
const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkPOGBUYWEcjs.scaleLayerEffect.call(void 0, e, scale)));
|
|
8874
8874
|
if (!of.length) continue;
|
|
8875
8875
|
if (of.length === 1) items.push([single, obj2(of[0])]);
|
|
8876
8876
|
else if (multi) items.push([multi, { type: "VlLs", items: of.map(obj2) }]);
|
|
@@ -8902,7 +8902,7 @@ function parseLrfx(data) {
|
|
|
8902
8902
|
const colorAt = (rd) => {
|
|
8903
8903
|
rd.u16();
|
|
8904
8904
|
const c = [rd.u16(), rd.u16(), rd.u16(), rd.u16()];
|
|
8905
|
-
return
|
|
8905
|
+
return _chunkPOGBUYWEcjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
|
|
8906
8906
|
};
|
|
8907
8907
|
const blendAt = (rd) => {
|
|
8908
8908
|
rd.skip(4);
|
|
@@ -8921,7 +8921,7 @@ function parseLrfx(data) {
|
|
|
8921
8921
|
const enabled = b.u8() !== 0;
|
|
8922
8922
|
const useGlobalLight = b.u8() !== 0;
|
|
8923
8923
|
const opacity = b.u8() / 255;
|
|
8924
|
-
const base = { id:
|
|
8924
|
+
const base = { id: _chunkPOGBUYWEcjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
|
|
8925
8925
|
items.push(key === "dsdw" ? { ...base, kind: "drop-shadow", spread: 0, knocksOut: true } : { ...base, kind: "inner-shadow", choke: 0 });
|
|
8926
8926
|
} else if (key === "oglw" || key === "iglw") {
|
|
8927
8927
|
b.u32();
|
|
@@ -8931,7 +8931,7 @@ function parseLrfx(data) {
|
|
|
8931
8931
|
const blend = blendAt(b);
|
|
8932
8932
|
const enabled = b.u8() !== 0;
|
|
8933
8933
|
const opacity = b.u8() / 255;
|
|
8934
|
-
const base = { id:
|
|
8934
|
+
const base = { id: _chunkPOGBUYWEcjs.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 };
|
|
8935
8935
|
items.push(key === "oglw" ? { ...base, kind: "outer-glow", spread: 0 } : { ...base, kind: "inner-glow", choke: 0, source: "edge" });
|
|
8936
8936
|
} else if (key === "sofi") {
|
|
8937
8937
|
b.u32();
|
|
@@ -8939,7 +8939,7 @@ function parseLrfx(data) {
|
|
|
8939
8939
|
const color = colorAt(b);
|
|
8940
8940
|
const opacity = b.u8() / 255;
|
|
8941
8941
|
const enabled = b.u8() !== 0;
|
|
8942
|
-
items.push({ id:
|
|
8942
|
+
items.push({ id: _chunkPOGBUYWEcjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
|
|
8943
8943
|
} else if (key === "bevl") notes.add("legacy bevels are not read");
|
|
8944
8944
|
}
|
|
8945
8945
|
return { effects: { enabled: true, items }, notes: [...notes] };
|
|
@@ -8989,14 +8989,14 @@ function rleChannel(id, plane, width, height, psb) {
|
|
|
8989
8989
|
var emptyChannel = (id) => ({ id, compression: 0, data: new Uint8Array(0) });
|
|
8990
8990
|
function maskChannel(mask, ox, oy, psb) {
|
|
8991
8991
|
if (mask.source) throw new PsdError("A parametric mask must be baked before export.");
|
|
8992
|
-
const bounds =
|
|
8992
|
+
const bounds = _chunkXIOMMGPDcjs.contentBounds.call(void 0, mask.surface);
|
|
8993
8993
|
const def = mask.defaultValue;
|
|
8994
8994
|
const flags = (mask.enabled === false ? MASK_FLAG_DISABLED : 0) | (mask.linked === false ? MASK_FLAG_UNLINKED : 0);
|
|
8995
8995
|
const m = { rect: EMPTY_RECT, defaultColor: def, flags };
|
|
8996
8996
|
if ((_nullishCoalesce(mask.density, () => ( 1))) < 1) m.userDensity = Math.round(Math.max(0, _nullishCoalesce(mask.density, () => ( 1))) * 255);
|
|
8997
8997
|
if ((_nullishCoalesce(mask.feather, () => ( 0))) > 0) m.userFeather = mask.feather;
|
|
8998
8998
|
if (!bounds) return { channel: emptyChannel(CHANNEL_USER_MASK), mask: m };
|
|
8999
|
-
const plane =
|
|
8999
|
+
const plane = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, bounds);
|
|
9000
9000
|
m.rect = toRect({ ...bounds, x: bounds.x + ox, y: bounds.y + oy });
|
|
9001
9001
|
return { channel: rleChannel(CHANNEL_USER_MASK, new Uint8Array(plane.buffer, plane.byteOffset, plane.length), bounds.width, bounds.height, psb), mask: m };
|
|
9002
9002
|
}
|
|
@@ -9023,7 +9023,7 @@ function prepareNestedLayers(layers) {
|
|
|
9023
9023
|
delete plain.effects;
|
|
9024
9024
|
delete plain.fillOpacity;
|
|
9025
9025
|
const data = new LayerCompositor().composite([plain], r, { width: r.x + r.width, height: r.y + r.height });
|
|
9026
|
-
p.surface =
|
|
9026
|
+
p.surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: r.width, height: r.height, data }, 4, r.x - l.offset.x, r.y - l.offset.y);
|
|
9027
9027
|
}
|
|
9028
9028
|
}
|
|
9029
9029
|
delete p.filters;
|
|
@@ -9042,11 +9042,11 @@ function smartContentsFile(c) {
|
|
|
9042
9042
|
const base = c.name.replace(/\.\w+$/, "") || "Contents";
|
|
9043
9043
|
if (c.file) return { name: c.name, bytes: c.file.bytes };
|
|
9044
9044
|
if (c.kind === "raster") {
|
|
9045
|
-
const data =
|
|
9046
|
-
return { name: `${base}.png`, bytes:
|
|
9045
|
+
const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
|
|
9046
|
+
return { name: `${base}.png`, bytes: _chunkPOGBUYWEcjs.encodePng.call(void 0, c.width, c.height, data) };
|
|
9047
9047
|
}
|
|
9048
9048
|
const doc = c.document;
|
|
9049
|
-
const merged =
|
|
9049
|
+
const merged = _chunkXIOMMGPDcjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
|
|
9050
9050
|
const res = exportPsd({ width: c.width, height: c.height, layers: prepareNestedLayers(doc.layers), merged, patterns: doc.patterns, globalLight: doc.globalLight });
|
|
9051
9051
|
return { name: `${base}.${res.psb ? "psb" : "psd"}`, bytes: res.bytes };
|
|
9052
9052
|
}
|
|
@@ -9094,7 +9094,7 @@ function exportPsd(input) {
|
|
|
9094
9094
|
const key = layer.type === "group" ? "lfxs" : "lfx2";
|
|
9095
9095
|
if (fx.psd) {
|
|
9096
9096
|
const original = parseLfx2(fx.psd.data);
|
|
9097
|
-
if (original ?
|
|
9097
|
+
if (original ? _chunkPOGBUYWEcjs.effectsFingerprint.call(void 0, original.effects) === _chunkPOGBUYWEcjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
|
|
9098
9098
|
}
|
|
9099
9099
|
if (!fx.items.length && fx.enabled && (_nullishCoalesce(fx.scale, () => ( 1))) === 1) return null;
|
|
9100
9100
|
const { data, dropped } = writeLfx2(fx);
|
|
@@ -9174,10 +9174,10 @@ function exportPsd(input) {
|
|
|
9174
9174
|
extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
|
|
9175
9175
|
}
|
|
9176
9176
|
const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
|
|
9177
|
-
const bounds =
|
|
9177
|
+
const bounds = _chunkXIOMMGPDcjs.contentBounds.call(void 0, layer.surface);
|
|
9178
9178
|
if (bounds) {
|
|
9179
9179
|
const n2 = bounds.width * bounds.height;
|
|
9180
|
-
const [r2, g2, b2, a2] = rgbaToPlanes(
|
|
9180
|
+
const [r2, g2, b2, a2] = rgbaToPlanes(_chunkXIOMMGPDcjs.readRegion.call(void 0, layer.surface, bounds), n2);
|
|
9181
9181
|
rec.rect = toRect({ ...bounds, x: bounds.x + layer.offset.x, y: bounds.y + layer.offset.y });
|
|
9182
9182
|
rec.channels = [
|
|
9183
9183
|
rleChannel(CHANNEL_ALPHA, a2, bounds.width, bounds.height, psb),
|
|
@@ -9225,10 +9225,10 @@ function exportPsd(input) {
|
|
|
9225
9225
|
const fm = _optionalChain([layer, 'access', _184 => _184.smartFilters, 'optionalAccess', _185 => _185.mask]);
|
|
9226
9226
|
if (fm && !fm.source) filterItems.push(filterMaskItem(placedId, fm, { x: 0, y: 0, width, height }));
|
|
9227
9227
|
const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
|
|
9228
|
-
const bounds =
|
|
9228
|
+
const bounds = _chunkXIOMMGPDcjs.contentBounds.call(void 0, layer.surface);
|
|
9229
9229
|
if (bounds) {
|
|
9230
9230
|
const n2 = bounds.width * bounds.height;
|
|
9231
|
-
const [r2, g2, b2, a2] = rgbaToPlanes(
|
|
9231
|
+
const [r2, g2, b2, a2] = rgbaToPlanes(_chunkXIOMMGPDcjs.readRegion.call(void 0, layer.surface, bounds), n2);
|
|
9232
9232
|
rec.rect = toRect(bounds);
|
|
9233
9233
|
rec.channels = [
|
|
9234
9234
|
rleChannel(CHANNEL_ALPHA, a2, bounds.width, bounds.height, psb),
|
|
@@ -9290,7 +9290,7 @@ function exportPsd(input) {
|
|
|
9290
9290
|
const byId = new Map((_nullishCoalesce(input.patterns, () => ( []))).map((p) => [p.id, p]));
|
|
9291
9291
|
const embed = [];
|
|
9292
9292
|
for (const id of patternIds2) {
|
|
9293
|
-
const p = _nullishCoalesce(byId.get(id), () => (
|
|
9293
|
+
const p = _nullishCoalesce(byId.get(id), () => ( _chunkPOGBUYWEcjs.builtinPattern.call(void 0, id)));
|
|
9294
9294
|
if (p) embed.push(p);
|
|
9295
9295
|
else note(`Pattern "${id}" is not in the document and was not embedded`, id);
|
|
9296
9296
|
}
|
|
@@ -9654,4 +9654,4 @@ function exportPsd(input) {
|
|
|
9654
9654
|
|
|
9655
9655
|
|
|
9656
9656
|
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.createSelectionMask = createSelectionMask; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.LayerCompositor = LayerCompositor; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.parseCssColor = parseCssColor; exports.LayerOperationError = LayerOperationError; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.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.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.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.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; 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.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;
|
|
9657
|
-
//# sourceMappingURL=chunk-
|
|
9657
|
+
//# sourceMappingURL=chunk-MGL4U5WA.cjs.map
|