@pixerate/editor 0.246.0 → 0.249.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/README.md +1 -0
- package/dist/animation-editor/index.cjs +64 -61
- package/dist/animation-editor/index.js +8 -5
- package/dist/{brushstrokeRender-ZDHMXJAE.cjs → brushstrokeRender-GCKK7V2I.cjs} +14 -11
- package/dist/{brushstrokeRender-AKUI3SEJ.js → brushstrokeRender-T3JZST44.js} +7 -4
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-UVPD55UZ.cjs → chunk-2SMMZDMG.cjs} +35 -35
- package/dist/chunk-2VJAVXLI.js +192 -0
- package/dist/{chunk-OLNIPTB3.cjs → chunk-2VX55NFM.cjs} +1 -320
- package/dist/chunk-3K6HWEXZ.cjs +92 -0
- package/dist/{chunk-UOOK7HTX.js → chunk-3PPJRMIG.js} +1 -1
- package/dist/chunk-4D6KP5BV.js +92 -0
- package/dist/chunk-5RH3VXAK.js +269 -0
- package/dist/{chunk-LDPLEZ5T.js → chunk-6BIDVPED.js} +1 -1
- package/dist/{chunk-2ONK3ERD.cjs → chunk-75K3W4D6.cjs} +20 -20
- package/dist/chunk-BOHDJJ2O.cjs +192 -0
- package/dist/{chunk-2PBZBRP5.js → chunk-D5KGAO4Z.js} +10 -92
- package/dist/{chunk-DQWPMGH2.js → chunk-DOIU7VJG.js} +1 -1
- package/dist/{chunk-HB4ICNNA.cjs → chunk-DPYAO5U6.cjs} +42 -42
- package/dist/chunk-EJLRBS5Q.js +301 -0
- package/dist/{chunk-Q2UYUWAZ.cjs → chunk-H4AOUUBE.cjs} +679 -164
- package/dist/{chunk-PQ3H2AAN.cjs → chunk-I7NJPHWV.cjs} +122 -204
- package/dist/{chunk-FK5LTDOO.cjs → chunk-IOFVM3L3.cjs} +7 -7
- package/dist/{chunk-42TWUPNJ.js → chunk-IRSTHLQQ.js} +1 -320
- package/dist/{chunk-VDAWA546.js → chunk-J7T5QZ45.js} +614 -99
- package/dist/{chunk-VMROIWLL.cjs → chunk-KBYB7OWB.cjs} +3 -3
- package/dist/{chunk-5MFDD7SP.cjs → chunk-KYX7NZ5V.cjs} +1 -1
- package/dist/chunk-LJRCU3BJ.cjs +301 -0
- package/dist/{chunk-XTWXBQD4.cjs → chunk-LP2MCSBE.cjs} +593 -236
- package/dist/{chunk-A23PSOBB.js → chunk-O75V4ZS3.js} +1 -1
- package/dist/chunk-OTTT5N3K.js +322 -0
- package/dist/{chunk-N6WUB3Y5.js → chunk-PZP2SZIZ.js} +2 -2
- package/dist/{chunk-4PMCMWQS.js → chunk-UBRJOIR5.js} +367 -10
- package/dist/chunk-W5M3J7PV.cjs +322 -0
- package/dist/{chunk-4P6H35HU.js → chunk-WA44NKPF.js} +2 -2
- package/dist/{chunk-CEPKXLBS.cjs → chunk-WLJZZHUZ.cjs} +23 -23
- package/dist/{chunk-P3NIPIKS.js → chunk-WQCNC4DK.js} +1 -1
- package/dist/chunk-ZEYMKDYS.cjs +269 -0
- package/dist/image-editor/effect-tools.d.cts +37 -4
- package/dist/image-editor/effect-tools.d.ts +37 -4
- package/dist/image-editor/index.cjs +1340 -1828
- package/dist/image-editor/index.d.cts +1 -1
- package/dist/image-editor/index.d.ts +1 -1
- package/dist/image-editor/index.js +298 -786
- package/dist/paint/index.cjs +8 -5
- package/dist/paint/index.js +13 -10
- package/dist/paint-editor/controller.d.cts +71 -2
- package/dist/paint-editor/controller.d.ts +71 -2
- package/dist/paint-editor/index.cjs +901 -589
- package/dist/paint-editor/index.d.cts +3 -0
- package/dist/paint-editor/index.d.ts +3 -0
- package/dist/paint-editor/index.js +365 -53
- package/dist/paint-editor/procedural.d.cts +82 -5
- package/dist/paint-editor/procedural.d.ts +82 -5
- package/dist/paint-editor/sticker-art.d.cts +55 -0
- package/dist/paint-editor/sticker-art.d.ts +55 -0
- package/dist/paint-editor/stickers.d.cts +30 -17
- package/dist/paint-editor/stickers.d.ts +30 -17
- package/dist/paint-editor/stroke.d.cts +4 -0
- package/dist/paint-editor/stroke.d.ts +4 -0
- package/dist/paint-editor/tools.d.cts +1 -1
- package/dist/paint-editor/tools.d.ts +1 -1
- package/dist/paint-editor/ui.d.cts +25 -4
- package/dist/paint-editor/ui.d.ts +25 -4
- package/dist/{image-editor/layers/effects-ui.d.cts → raster/effects/ui.d.cts} +32 -5
- package/dist/{image-editor/layers/effects-ui.d.ts → raster/effects/ui.d.ts} +32 -5
- package/dist/raster/index.cjs +17 -3
- package/dist/raster/index.d.cts +1 -0
- package/dist/raster/index.d.ts +1 -0
- package/dist/raster/index.js +23 -9
- package/dist/stickers/browser.d.cts +48 -0
- package/dist/stickers/browser.d.ts +48 -0
- package/dist/stickers/combine.d.cts +10 -0
- package/dist/stickers/combine.d.ts +10 -0
- package/dist/stickers/conformance.d.cts +18 -0
- package/dist/stickers/conformance.d.ts +18 -0
- package/dist/stickers/editor.d.cts +14 -0
- package/dist/stickers/editor.d.ts +14 -0
- package/dist/stickers/errors.d.cts +6 -0
- package/dist/stickers/errors.d.ts +6 -0
- package/dist/stickers/fake.d.cts +16 -0
- package/dist/stickers/fake.d.ts +16 -0
- package/dist/stickers/helpers.d.cts +51 -0
- package/dist/stickers/helpers.d.ts +51 -0
- package/dist/stickers/index.cjs +331 -0
- package/dist/stickers/index.d.cts +16 -0
- package/dist/stickers/index.d.ts +16 -0
- package/dist/stickers/index.js +331 -0
- package/dist/stickers/stamps.d.cts +13 -0
- package/dist/stickers/stamps.d.ts +13 -0
- package/dist/stickers/tools.d.cts +25 -0
- package/dist/stickers/tools.d.ts +25 -0
- package/dist/stickers/types.d.cts +123 -0
- package/dist/stickers/types.d.ts +123 -0
- package/dist/vector/index.cjs +978 -975
- package/dist/vector/index.js +9 -6
- package/package.json +11 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +26 -32
- package/skills/pixerate-paint-editor/references/gradient-paint.md +23 -0
- package/skills/pixerate-paint-editor/references/layer-effects.md +28 -0
- package/skills/pixerate-paint-editor/references/light-paint.md +10 -2
- package/skills/pixerate-paint-editor/references/particle-brushes.md +66 -0
- package/skills/pixerate-stickers/SKILL.md +45 -0
|
@@ -46,7 +46,9 @@ var _chunkSS53NNZOcjs = require('./chunk-SS53NNZO.cjs');
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
var _chunkDPYAO5U6cjs = require('./chunk-DPYAO5U6.cjs');
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
|
|
@@ -104,7 +106,7 @@ var _chunkBROJYMWUcjs = require('./chunk-BROJYMWU.cjs');
|
|
|
104
106
|
|
|
105
107
|
|
|
106
108
|
|
|
107
|
-
var
|
|
109
|
+
var _chunkIOFVM3L3cjs = require('./chunk-IOFVM3L3.cjs');
|
|
108
110
|
|
|
109
111
|
|
|
110
112
|
|
|
@@ -124,12 +126,15 @@ var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
|
|
|
124
126
|
|
|
125
127
|
|
|
126
128
|
|
|
129
|
+
var _chunk2VX55NFMcjs = require('./chunk-2VX55NFM.cjs');
|
|
130
|
+
|
|
131
|
+
|
|
127
132
|
|
|
128
133
|
|
|
129
134
|
|
|
130
135
|
|
|
131
136
|
|
|
132
|
-
var
|
|
137
|
+
var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
|
|
133
138
|
|
|
134
139
|
|
|
135
140
|
|
|
@@ -1027,7 +1032,7 @@ function normalizeAdjustmentLayer(raw) {
|
|
|
1027
1032
|
kind: r.kind,
|
|
1028
1033
|
enabled: r.enabled !== false,
|
|
1029
1034
|
opacity: clampTo(r.opacity, 0, 1, 1),
|
|
1030
|
-
blend:
|
|
1035
|
+
blend: _chunk2VX55NFMcjs.normalizeBlendMode.call(void 0, r.blend),
|
|
1031
1036
|
params: normParams(r.kind, r.params)
|
|
1032
1037
|
};
|
|
1033
1038
|
if (typeof r.name === "string" && r.name) layer.name = r.name;
|
|
@@ -1049,7 +1054,7 @@ function normalizeAdjustmentLayers(raw) {
|
|
|
1049
1054
|
return out;
|
|
1050
1055
|
}
|
|
1051
1056
|
function curveLutFromLevels(points) {
|
|
1052
|
-
return
|
|
1057
|
+
return _chunkDPYAO5U6cjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
|
|
1053
1058
|
}
|
|
1054
1059
|
var toUnitLevels = (c) => ({
|
|
1055
1060
|
inBlack: c.inBlack / 255,
|
|
@@ -1373,7 +1378,7 @@ function compileAdjustmentLayer(layer, options = {}) {
|
|
|
1373
1378
|
return (c) => {
|
|
1374
1379
|
const g = blackWhiteGray(c, weights);
|
|
1375
1380
|
if (tint) {
|
|
1376
|
-
const t =
|
|
1381
|
+
const t = _chunk2VX55NFMcjs.setLum.call(void 0, tint, g);
|
|
1377
1382
|
c[0] = clamp01(t[0]);
|
|
1378
1383
|
c[1] = clamp01(t[1]);
|
|
1379
1384
|
c[2] = clamp01(t[2]);
|
|
@@ -1392,7 +1397,7 @@ function compileAdjustmentLayer(layer, options = {}) {
|
|
|
1392
1397
|
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])));
|
|
1393
1398
|
if (preserve) {
|
|
1394
1399
|
const target = 0.3 * c[0] + 0.59 * c[1] + 0.11 * c[2];
|
|
1395
|
-
f =
|
|
1400
|
+
f = _chunk2VX55NFMcjs.setLum.call(void 0, f, target);
|
|
1396
1401
|
}
|
|
1397
1402
|
c[0] = clamp01(f[0]);
|
|
1398
1403
|
c[1] = clamp01(f[1]);
|
|
@@ -1459,10 +1464,10 @@ function applyLayer(c, layer, op, coverage = 1) {
|
|
|
1459
1464
|
const cb0 = c[0], cb1 = c[1], cb2 = c[2];
|
|
1460
1465
|
op(c);
|
|
1461
1466
|
if (blend === "pigment") {
|
|
1462
|
-
|
|
1467
|
+
_chunk2VX55NFMcjs.mixPigmentRgb.call(void 0, [clamp01(cb0), clamp01(cb1), clamp01(cb2)], [clamp01(c[0]), clamp01(c[1]), clamp01(c[2])], alpha, c);
|
|
1463
1468
|
return;
|
|
1464
1469
|
}
|
|
1465
|
-
const b = blend === "normal" ? c :
|
|
1470
|
+
const b = blend === "normal" ? c : _chunk2VX55NFMcjs.blendRgb.call(void 0, blend, [cb0, cb1, cb2], c);
|
|
1466
1471
|
c[0] = (1 - alpha) * cb0 + alpha * b[0];
|
|
1467
1472
|
c[1] = (1 - alpha) * cb1 + alpha * b[1];
|
|
1468
1473
|
c[2] = (1 - alpha) * cb2 + alpha * b[2];
|
|
@@ -2245,7 +2250,7 @@ function newLayerId(prefix = "layer") {
|
|
|
2245
2250
|
return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
|
|
2246
2251
|
}
|
|
2247
2252
|
function pixelLayers(layers) {
|
|
2248
|
-
return
|
|
2253
|
+
return _chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
2249
2254
|
}
|
|
2250
2255
|
function developFilter(layer) {
|
|
2251
2256
|
return _optionalChain([layer, 'access', _10 => _10.filters, 'optionalAccess', _11 => _11.find, 'call', _12 => _12((f) => f.kind === "develop")]);
|
|
@@ -2276,14 +2281,14 @@ function isRenderedLayer(layer) {
|
|
|
2276
2281
|
return layer.type === "smart" || layer.type === "shape" || layer.type === "type";
|
|
2277
2282
|
}
|
|
2278
2283
|
function shapeLayers(layers) {
|
|
2279
|
-
return
|
|
2284
|
+
return _chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
|
|
2280
2285
|
}
|
|
2281
2286
|
function smartObjectLayers(layers) {
|
|
2282
|
-
return
|
|
2287
|
+
return _chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
|
|
2283
2288
|
}
|
|
2284
2289
|
|
|
2285
2290
|
// src/image-editor/layers/shape.ts
|
|
2286
|
-
var SHAPE_RENDER_MARGIN =
|
|
2291
|
+
var SHAPE_RENDER_MARGIN = _chunkDPYAO5U6cjs.MAX_EFFECT_REACH;
|
|
2287
2292
|
var DEFAULT_MITER_LIMIT = 100;
|
|
2288
2293
|
var fail = (message) => {
|
|
2289
2294
|
throw new LayerOperationError(message);
|
|
@@ -2323,7 +2328,7 @@ function mapAnchor(a, f) {
|
|
|
2323
2328
|
return out;
|
|
2324
2329
|
}
|
|
2325
2330
|
function mapSubpaths(subpaths, f) {
|
|
2326
|
-
return
|
|
2331
|
+
return _chunkIOFVM3L3cjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
|
|
2327
2332
|
}
|
|
2328
2333
|
function liveShapeSubpaths(live) {
|
|
2329
2334
|
let out;
|
|
@@ -2331,19 +2336,19 @@ function liveShapeSubpaths(live) {
|
|
|
2331
2336
|
case "rect": {
|
|
2332
2337
|
const x = Math.min(live.x, live.x + live.width);
|
|
2333
2338
|
const y = Math.min(live.y, live.y + live.height);
|
|
2334
|
-
const sp =
|
|
2339
|
+
const sp = _chunkIOFVM3L3cjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
|
|
2335
2340
|
const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
|
|
2336
|
-
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ?
|
|
2341
|
+
out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkIOFVM3L3cjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
|
|
2337
2342
|
break;
|
|
2338
2343
|
}
|
|
2339
2344
|
case "ellipse":
|
|
2340
|
-
out = [
|
|
2345
|
+
out = [_chunkIOFVM3L3cjs.ellipseSubpath.call(void 0, normBox(live))];
|
|
2341
2346
|
break;
|
|
2342
2347
|
case "polygon":
|
|
2343
|
-
out = [
|
|
2348
|
+
out = [_chunkIOFVM3L3cjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
|
|
2344
2349
|
break;
|
|
2345
2350
|
case "star":
|
|
2346
|
-
out = [
|
|
2351
|
+
out = [_chunkIOFVM3L3cjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
|
|
2347
2352
|
break;
|
|
2348
2353
|
case "line": {
|
|
2349
2354
|
const a = { x: live.x1, y: live.y1 };
|
|
@@ -2366,7 +2371,7 @@ function liveShapeSubpaths(live) {
|
|
|
2366
2371
|
}
|
|
2367
2372
|
}
|
|
2368
2373
|
const m = live.transform;
|
|
2369
|
-
return m && !
|
|
2374
|
+
return m && !_chunkIOFVM3L3cjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, p)) : out;
|
|
2370
2375
|
}
|
|
2371
2376
|
function normBox(b) {
|
|
2372
2377
|
return { x: Math.min(b.x, b.x + b.width), y: Math.min(b.y, b.y + b.height), width: Math.abs(b.width), height: Math.abs(b.height) };
|
|
@@ -2378,7 +2383,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
|
|
|
2378
2383
|
function componentPath(c) {
|
|
2379
2384
|
let p = pathCache.get(c.subpaths);
|
|
2380
2385
|
if (!p) {
|
|
2381
|
-
p =
|
|
2386
|
+
p = _chunkIOFVM3L3cjs.subpathsToBezier.call(void 0, c.subpaths);
|
|
2382
2387
|
pathCache.set(c.subpaths, p);
|
|
2383
2388
|
}
|
|
2384
2389
|
return p;
|
|
@@ -2503,11 +2508,11 @@ function componentsCoverage(components, rect, rule = "nonzero", inverted = false
|
|
|
2503
2508
|
function paintContext(env) {
|
|
2504
2509
|
const tiles = /* @__PURE__ */ new Map();
|
|
2505
2510
|
return {
|
|
2506
|
-
light:
|
|
2511
|
+
light: _chunkDPYAO5U6cjs.DEFAULT_GLOBAL_LIGHT,
|
|
2507
2512
|
pattern: (id) => {
|
|
2508
2513
|
if (tiles.has(id)) return tiles.get(id);
|
|
2509
|
-
const p = _nullishCoalesce(_optionalChain([env, 'access', _18 => _18.pattern, 'optionalCall', _19 => _19(id)]), () => (
|
|
2510
|
-
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0,
|
|
2514
|
+
const p = _nullishCoalesce(_optionalChain([env, 'access', _18 => _18.pattern, 'optionalCall', _19 => _19(id)]), () => ( _chunkDPYAO5U6cjs.builtinPattern.call(void 0, id)));
|
|
2515
|
+
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkDPYAO5U6cjs.PatternTile)(p) : null;
|
|
2511
2516
|
tiles.set(id, t);
|
|
2512
2517
|
return t;
|
|
2513
2518
|
}
|
|
@@ -2538,9 +2543,9 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
|
|
|
2538
2543
|
if (!fCov && !sCov) return null;
|
|
2539
2544
|
const canvas = { x: 0, y: 0, width: env.width, height: env.height };
|
|
2540
2545
|
const anchor = { x: geo.frame.x, y: geo.frame.y };
|
|
2541
|
-
const fc = fCov ?
|
|
2546
|
+
const fc = fCov ? _chunkDPYAO5U6cjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
2542
2547
|
const fo = _nullishCoalesce(_optionalChain([layer, 'access', _20 => _20.fill, 'optionalAccess', _21 => _21.opacity]), () => ( 1));
|
|
2543
|
-
const sc = sCov ?
|
|
2548
|
+
const sc = sCov ? _chunkDPYAO5U6cjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
2544
2549
|
const so = _nullishCoalesce(_optionalChain([layer, 'access', _22 => _22.stroke, 'optionalAccess', _23 => _23.paint, 'access', _24 => _24.opacity]), () => ( 1));
|
|
2545
2550
|
const out = new Uint8ClampedArray(n * 4);
|
|
2546
2551
|
let any = false;
|
|
@@ -2633,9 +2638,9 @@ function normalizeShapePaint(v, path = "paint") {
|
|
|
2633
2638
|
offset: _nullishCoalesce(g.offset, () => ( { x: 0, y: 0 }))
|
|
2634
2639
|
};
|
|
2635
2640
|
try {
|
|
2636
|
-
|
|
2641
|
+
_chunkDPYAO5U6cjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
|
|
2637
2642
|
} catch (e) {
|
|
2638
|
-
if (e instanceof
|
|
2643
|
+
if (e instanceof _chunkDPYAO5U6cjs.LayerEffectError) fail(e.message);
|
|
2639
2644
|
throw e;
|
|
2640
2645
|
}
|
|
2641
2646
|
if (gradient.stops.length < 1) fail(`${path}.gradient.stops needs at least one { position, color }.`);
|
|
@@ -2705,7 +2710,7 @@ function matrixArg(v, path) {
|
|
|
2705
2710
|
if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail(`${path} must be six numbers [a, b, c, d, e, f].`);
|
|
2706
2711
|
const m = v;
|
|
2707
2712
|
if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail(`${path} is singular.`);
|
|
2708
|
-
return
|
|
2713
|
+
return _chunkIOFVM3L3cjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
|
|
2709
2714
|
}
|
|
2710
2715
|
function normalizeLiveShape(v, path = "shape") {
|
|
2711
2716
|
if (!v || typeof v !== "object") return fail(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
|
|
@@ -2766,7 +2771,7 @@ function normalizeSubpaths(v, path = "subpaths") {
|
|
|
2766
2771
|
if (typeof v === "string") {
|
|
2767
2772
|
let subs;
|
|
2768
2773
|
try {
|
|
2769
|
-
subs =
|
|
2774
|
+
subs = _chunkIOFVM3L3cjs.bezierToSubpaths.call(void 0, v);
|
|
2770
2775
|
} catch (e5) {
|
|
2771
2776
|
return fail(`${path}: could not read the SVG path data.`);
|
|
2772
2777
|
}
|
|
@@ -2847,20 +2852,20 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
2847
2852
|
if (!("annotation" in patch)) delete next.annotation;
|
|
2848
2853
|
if (!next.components.length) fail("A shape needs at least one component; delete the layer instead.");
|
|
2849
2854
|
const rendered = rerenderShape(next, env);
|
|
2850
|
-
return { layers:
|
|
2855
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
2851
2856
|
}
|
|
2852
2857
|
function transformShapeComponents(components, f, affine) {
|
|
2853
2858
|
return components.map((c) => {
|
|
2854
2859
|
if (affine && c.live) {
|
|
2855
|
-
const live = { ...c.live, transform:
|
|
2856
|
-
if (
|
|
2860
|
+
const live = { ...c.live, transform: _chunkIOFVM3L3cjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkIOFVM3L3cjs.IDENTITY_MATRIX)), affine) };
|
|
2861
|
+
if (_chunkIOFVM3L3cjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
|
|
2857
2862
|
return { op: c.op, subpaths: liveShapeSubpaths(live), live };
|
|
2858
2863
|
}
|
|
2859
2864
|
return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
|
|
2860
2865
|
});
|
|
2861
2866
|
}
|
|
2862
2867
|
function offsetShape(layer, dx, dy, env) {
|
|
2863
|
-
const m =
|
|
2868
|
+
const m = _chunkIOFVM3L3cjs.translateMatrix.call(void 0, dx, dy);
|
|
2864
2869
|
const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
|
|
2865
2870
|
delete next.annotation;
|
|
2866
2871
|
return rerenderShape(next, env);
|
|
@@ -2868,7 +2873,7 @@ function offsetShape(layer, dx, dy, env) {
|
|
|
2868
2873
|
function mergeShapeComponents(components, fillRule = "nonzero") {
|
|
2869
2874
|
if (components.length < 2) return [...components];
|
|
2870
2875
|
const path = shapeOutline(components, fillRule);
|
|
2871
|
-
const subpaths =
|
|
2876
|
+
const subpaths = _chunkIOFVM3L3cjs.bezierToSubpaths.call(void 0, path);
|
|
2872
2877
|
if (!subpaths.length) fail("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
|
|
2873
2878
|
return [{ op: "combine", subpaths }];
|
|
2874
2879
|
}
|
|
@@ -2878,14 +2883,14 @@ function shapeAsPixelLayer(layer) {
|
|
|
2878
2883
|
}
|
|
2879
2884
|
function annotationPaint(color, opacity) {
|
|
2880
2885
|
const c = _chunkA2IS7EHEcjs.parseCssColor.call(void 0, color);
|
|
2881
|
-
if (!c || !
|
|
2886
|
+
if (!c || !_chunkDPYAO5U6cjs.parseEffectColor.call(void 0, c.hex)) return void 0;
|
|
2882
2887
|
const a = c.alpha * opacity;
|
|
2883
2888
|
return a !== 1 ? { type: "color", color: c.hex, opacity: a } : { type: "color", color: c.hex };
|
|
2884
2889
|
}
|
|
2885
2890
|
function shapeFromAnnotation(a) {
|
|
2886
2891
|
const opacity = _nullishCoalesce(a.opacity, () => ( 1));
|
|
2887
2892
|
const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
|
|
2888
|
-
const rotation = a.rotation ?
|
|
2893
|
+
const rotation = a.rotation ? _chunkIOFVM3L3cjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
|
|
2889
2894
|
const t = rotation ? { transform: rotation } : {};
|
|
2890
2895
|
const live = (l) => liveComponent(l);
|
|
2891
2896
|
switch (a.type) {
|
|
@@ -2928,7 +2933,7 @@ function shapeFromAnnotation(a) {
|
|
|
2928
2933
|
case "pen": {
|
|
2929
2934
|
const paint = annotationPaint(a.strokeColor, opacity);
|
|
2930
2935
|
if (!paint) return null;
|
|
2931
|
-
const pts = rotation ? a.points.map((p) =>
|
|
2936
|
+
const pts = rotation ? a.points.map((p) => _chunkIOFVM3L3cjs.applyMatrix.call(void 0, rotation, p)) : a.points;
|
|
2932
2937
|
const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
|
|
2933
2938
|
return {
|
|
2934
2939
|
components: [{ op: "combine", subpaths }],
|
|
@@ -2942,7 +2947,7 @@ function shapeFromAnnotation(a) {
|
|
|
2942
2947
|
}
|
|
2943
2948
|
function annotationBlend(a, layerBlend) {
|
|
2944
2949
|
if (layerBlend !== "normal") return layerBlend;
|
|
2945
|
-
return a.blend &&
|
|
2950
|
+
return a.blend && _chunk2VX55NFMcjs.isBlendMode.call(void 0, a.blend) ? a.blend : "normal";
|
|
2946
2951
|
}
|
|
2947
2952
|
function annotationOfShape(layer) {
|
|
2948
2953
|
const a = layer.annotation;
|
|
@@ -2961,7 +2966,7 @@ var JOIN_SIGMA = 2;
|
|
|
2961
2966
|
function vectorMaskSegments(components) {
|
|
2962
2967
|
const out = [];
|
|
2963
2968
|
components.forEach((c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2964
|
-
for (let k = 0; k <
|
|
2969
|
+
for (let k = 0; k < _chunkIOFVM3L3cjs.subpathSegmentCount.call(void 0, sp); k++) out.push({ component: ci, subpath: si, segment: k });
|
|
2965
2970
|
}));
|
|
2966
2971
|
return out;
|
|
2967
2972
|
}
|
|
@@ -2969,7 +2974,7 @@ function validVectorMaskEdges(edges, components) {
|
|
|
2969
2974
|
if (!_optionalChain([edges, 'optionalAccess', _34 => _34.length])) return [];
|
|
2970
2975
|
return edges.filter((e) => {
|
|
2971
2976
|
const sp = _optionalChain([components, 'access', _35 => _35[e.component], 'optionalAccess', _36 => _36.subpaths, 'access', _37 => _37[e.subpath]]);
|
|
2972
|
-
return Boolean(sp) && e.segment >= 0 && e.segment <
|
|
2977
|
+
return Boolean(sp) && e.segment >= 0 && e.segment < _chunkIOFVM3L3cjs.subpathSegmentCount.call(void 0, sp);
|
|
2973
2978
|
});
|
|
2974
2979
|
}
|
|
2975
2980
|
function reach(e) {
|
|
@@ -2992,8 +2997,8 @@ function hybridVectorMaskCoverage(vm, hard, width, height, guide) {
|
|
|
2992
2997
|
const seedClass = [];
|
|
2993
2998
|
vm.components.forEach(
|
|
2994
2999
|
(c, ci) => c.subpaths.forEach((sp, si) => {
|
|
2995
|
-
for (let k = 0; k <
|
|
2996
|
-
const seg =
|
|
3000
|
+
for (let k = 0; k < _chunkIOFVM3L3cjs.subpathSegmentCount.call(void 0, sp); k++) {
|
|
3001
|
+
const seg = _chunkIOFVM3L3cjs.subpathSegment.call(void 0, sp, k);
|
|
2997
3002
|
let len = 0;
|
|
2998
3003
|
for (let i = 1; i < seg.length; i++) len += Math.hypot(seg[i][0] - seg[i - 1][0], seg[i][1] - seg[i - 1][1]);
|
|
2999
3004
|
const steps = Math.max(2, Math.ceil(len * 2));
|
|
@@ -3317,18 +3322,18 @@ function userErrorMessage(err) {
|
|
|
3317
3322
|
return err instanceof Error ? err.message : String(err);
|
|
3318
3323
|
}
|
|
3319
3324
|
function isPaintableLayer(layer) {
|
|
3320
|
-
return layer.type === "pixel" && layer.visible && !
|
|
3325
|
+
return layer.type === "pixel" && layer.visible && !_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, layer, "pixels");
|
|
3321
3326
|
}
|
|
3322
3327
|
function defaultActiveLayerId(layers) {
|
|
3323
|
-
const pixels =
|
|
3328
|
+
const pixels = _chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
3324
3329
|
for (let i = pixels.length - 1; i >= 0; i--) if (isPaintableLayer(pixels[i])) return pixels[i].id;
|
|
3325
3330
|
return _nullishCoalesce(_optionalChain([pixels, 'access', _47 => _47[pixels.length - 1], 'optionalAccess', _48 => _48.id]), () => ( null));
|
|
3326
3331
|
}
|
|
3327
3332
|
function activeLayerAfterRemoval(prev, next, removedId) {
|
|
3328
|
-
const before =
|
|
3333
|
+
const before = _chunkDPYAO5U6cjs.flattenLayers.call(void 0, prev);
|
|
3329
3334
|
const at = before.findIndex((l) => l.id === removedId);
|
|
3330
3335
|
for (let i = at - 1; i >= 0; i--) {
|
|
3331
|
-
const loc =
|
|
3336
|
+
const loc = _chunkDPYAO5U6cjs.findLayer.call(void 0, next, before[i].id);
|
|
3332
3337
|
if (loc && isPaintableLayer(loc.layer)) return loc.layer.id;
|
|
3333
3338
|
}
|
|
3334
3339
|
return defaultActiveLayerId(next);
|
|
@@ -3337,47 +3342,47 @@ var fail2 = (message) => {
|
|
|
3337
3342
|
throw new LayerOperationError(message);
|
|
3338
3343
|
};
|
|
3339
3344
|
function requireLayer(layers, id) {
|
|
3340
|
-
const loc =
|
|
3345
|
+
const loc = _chunkDPYAO5U6cjs.findLayer.call(void 0, layers, id);
|
|
3341
3346
|
if (!loc) {
|
|
3342
|
-
const ids =
|
|
3347
|
+
const ids = _chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers).map((l) => l.id);
|
|
3343
3348
|
fail2(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
|
|
3344
3349
|
}
|
|
3345
3350
|
return loc;
|
|
3346
3351
|
}
|
|
3347
3352
|
function requireUnlocked(layer, what, action) {
|
|
3348
|
-
if (
|
|
3349
|
-
if (what !== "all" &&
|
|
3353
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, layer, "all")) fail2(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
|
|
3354
|
+
if (what !== "all" && _chunkDPYAO5U6cjs.isLayerLocked.call(void 0, layer, what)) fail2(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
|
|
3350
3355
|
}
|
|
3351
3356
|
function placeLayer(layers, layer, placement = {}, defaultIndex) {
|
|
3352
3357
|
const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
|
|
3353
3358
|
if (given > 1) fail2("Give only one of aboveId, belowId and parentId.");
|
|
3354
3359
|
if (placement.aboveId || placement.belowId) {
|
|
3355
3360
|
const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
|
|
3356
|
-
return
|
|
3361
|
+
return _chunkDPYAO5U6cjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _49 => _49.parent, 'optionalAccess', _50 => _50.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
|
|
3357
3362
|
}
|
|
3358
3363
|
if (placement.parentId) {
|
|
3359
3364
|
const ref = requireLayer(layers, placement.parentId);
|
|
3360
3365
|
if (ref.layer.type !== "group") fail2(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
|
|
3361
|
-
return
|
|
3366
|
+
return _chunkDPYAO5U6cjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
|
|
3362
3367
|
}
|
|
3363
|
-
return
|
|
3368
|
+
return _chunkDPYAO5U6cjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
|
|
3364
3369
|
}
|
|
3365
3370
|
function removeLayer(layers, id) {
|
|
3366
3371
|
const loc = requireLayer(layers, id);
|
|
3367
3372
|
requireUnlocked(loc.layer, "all", "delete it");
|
|
3368
|
-
return
|
|
3373
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3369
3374
|
}
|
|
3370
3375
|
function moveLayer(layers, id, placement) {
|
|
3371
3376
|
const loc = requireLayer(layers, id);
|
|
3372
3377
|
requireUnlocked(loc.layer, "all", "move it");
|
|
3373
3378
|
const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
|
|
3374
3379
|
if (target === id) fail2("A layer cannot be placed relative to itself.");
|
|
3375
|
-
if (target && loc.layer.type === "group" &&
|
|
3380
|
+
if (target && loc.layer.type === "group" && _chunkDPYAO5U6cjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
|
|
3376
3381
|
fail2(`Group "${id}" cannot be moved into its own child "${target}".`);
|
|
3377
3382
|
}
|
|
3378
3383
|
if (target) requireLayer(layers, target);
|
|
3379
3384
|
if (!target && placement.index === void 0) fail2("Give aboveId, belowId, parentId or index.");
|
|
3380
|
-
const without =
|
|
3385
|
+
const without = _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3381
3386
|
return placeLayer(without, loc.layer, placement);
|
|
3382
3387
|
}
|
|
3383
3388
|
function withNewIds(layer) {
|
|
@@ -3396,7 +3401,7 @@ function duplicateLayer(layers, id, name) {
|
|
|
3396
3401
|
const copy = withNewIds(loc.layer);
|
|
3397
3402
|
copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
|
|
3398
3403
|
delete copy.locks;
|
|
3399
|
-
return { layers:
|
|
3404
|
+
return { layers: _chunkDPYAO5U6cjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _53 => _53.parent, 'optionalAccess', _54 => _54.id]), () => ( null)), loc.index + 1), id: copy.id };
|
|
3400
3405
|
}
|
|
3401
3406
|
function setLayerProperties(layers, id, props) {
|
|
3402
3407
|
const loc = requireLayer(layers, id);
|
|
@@ -3423,7 +3428,7 @@ function setLayerProperties(layers, id, props) {
|
|
|
3423
3428
|
if (props.blend !== void 0) {
|
|
3424
3429
|
if (props.blend === "pass-through") {
|
|
3425
3430
|
if (layer.type !== "group") fail2("pass-through is only for groups.");
|
|
3426
|
-
} else if (!
|
|
3431
|
+
} else if (!_chunk2VX55NFMcjs.isBlendMode.call(void 0, props.blend)) fail2(`Unknown blend mode "${props.blend}".`);
|
|
3427
3432
|
next.blend = props.blend;
|
|
3428
3433
|
}
|
|
3429
3434
|
if (props.clipped !== void 0) {
|
|
@@ -3443,7 +3448,7 @@ function setLayerProperties(layers, id, props) {
|
|
|
3443
3448
|
if (props.collapsed) g.collapsed = true;
|
|
3444
3449
|
else delete g.collapsed;
|
|
3445
3450
|
}
|
|
3446
|
-
return
|
|
3451
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3447
3452
|
}
|
|
3448
3453
|
function groupLayers(layers, ids, name = "Group") {
|
|
3449
3454
|
if (!ids.length) fail2("Give at least one layer id to group.");
|
|
@@ -3472,17 +3477,17 @@ function groupLayers(layers, ids, name = "Group") {
|
|
|
3472
3477
|
group.children[0] = c;
|
|
3473
3478
|
}
|
|
3474
3479
|
let out = layers;
|
|
3475
|
-
for (const l of ordered) out =
|
|
3476
|
-
return { layers:
|
|
3480
|
+
for (const l of ordered) out = _chunkDPYAO5U6cjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
3481
|
+
return { layers: _chunkDPYAO5U6cjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
|
|
3477
3482
|
}
|
|
3478
3483
|
function ungroupLayer(layers, id) {
|
|
3479
3484
|
const loc = requireLayer(layers, id);
|
|
3480
3485
|
if (loc.layer.type !== "group") fail2(`Layer "${id}" is not a group.`);
|
|
3481
3486
|
requireUnlocked(loc.layer, "all", "ungroup it");
|
|
3482
3487
|
const group = loc.layer;
|
|
3483
|
-
let out =
|
|
3488
|
+
let out = _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3484
3489
|
group.children.forEach((c, i) => {
|
|
3485
|
-
out =
|
|
3490
|
+
out = _chunkDPYAO5U6cjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _63 => _63.parent, 'optionalAccess', _64 => _64.id]), () => ( null)), loc.index + i);
|
|
3486
3491
|
});
|
|
3487
3492
|
return { layers: out, ids: group.children.map((c) => c.id) };
|
|
3488
3493
|
}
|
|
@@ -3497,12 +3502,12 @@ function offsetLayer(layers, id, offset) {
|
|
|
3497
3502
|
if (mask && mask.linked === false && !mask.source) {
|
|
3498
3503
|
next.mask = { ...mask, surface: _chunk474IQG74cjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
|
|
3499
3504
|
}
|
|
3500
|
-
return
|
|
3505
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => followLayerMove(next, next.offset.x - layer.offset.x, next.offset.y - layer.offset.y));
|
|
3501
3506
|
}
|
|
3502
3507
|
function setLayerMask(layers, id, mask) {
|
|
3503
3508
|
const loc = requireLayer(layers, id);
|
|
3504
3509
|
requireUnlocked(loc.layer, "all", "change its mask");
|
|
3505
|
-
return
|
|
3510
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, (l) => {
|
|
3506
3511
|
const next = { ...l };
|
|
3507
3512
|
if (mask) next.mask = mask;
|
|
3508
3513
|
else delete next.mask;
|
|
@@ -3541,7 +3546,7 @@ function requirePixelLayer(layers, id) {
|
|
|
3541
3546
|
function addLayerFilter(layers, id, filter) {
|
|
3542
3547
|
const layer = requirePixelLayer(layers, id);
|
|
3543
3548
|
if (_optionalChain([layer, 'access', _65 => _65.filters, 'optionalAccess', _66 => _66.some, 'call', _67 => _67((f) => f.kind === filter.kind)])) fail2(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
|
|
3544
|
-
return
|
|
3549
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
|
|
3545
3550
|
}
|
|
3546
3551
|
function updateLayerFilter(layers, id, filterId, changes) {
|
|
3547
3552
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -3552,7 +3557,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
|
|
|
3552
3557
|
const merged2 = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
|
|
3553
3558
|
const filters = [...layer.filters];
|
|
3554
3559
|
filters[i] = merged2;
|
|
3555
|
-
return
|
|
3560
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
|
|
3556
3561
|
}
|
|
3557
3562
|
function removeLayerFilter(layers, id, filterId) {
|
|
3558
3563
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -3561,7 +3566,7 @@ function removeLayerFilter(layers, id, filterId) {
|
|
|
3561
3566
|
const next = { ...layer };
|
|
3562
3567
|
if (filters.length) next.filters = filters;
|
|
3563
3568
|
else delete next.filters;
|
|
3564
|
-
return
|
|
3569
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3565
3570
|
}
|
|
3566
3571
|
function requireEffectLayer(layers, id, action) {
|
|
3567
3572
|
const layer = requireLayer(layers, id).layer;
|
|
@@ -3576,7 +3581,7 @@ function guard(fn) {
|
|
|
3576
3581
|
try {
|
|
3577
3582
|
return fn();
|
|
3578
3583
|
} catch (e) {
|
|
3579
|
-
if (e instanceof
|
|
3584
|
+
if (e instanceof _chunkDPYAO5U6cjs.LayerEffectError) fail2(e.message);
|
|
3580
3585
|
throw e;
|
|
3581
3586
|
}
|
|
3582
3587
|
}
|
|
@@ -3584,20 +3589,20 @@ function setLayerEffects(layers, id, effects) {
|
|
|
3584
3589
|
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
3585
3590
|
const next = { ...layer };
|
|
3586
3591
|
if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
|
|
3587
|
-
guard(() =>
|
|
3592
|
+
guard(() => _chunkDPYAO5U6cjs.validateLayerEffects.call(void 0, effects));
|
|
3588
3593
|
next.effects = effects;
|
|
3589
3594
|
} else delete next.effects;
|
|
3590
|
-
return
|
|
3595
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3591
3596
|
}
|
|
3592
3597
|
function addLayerEffect(layers, id, kind, params = {}, index) {
|
|
3593
|
-
if (!
|
|
3598
|
+
if (!_chunkDPYAO5U6cjs.isLayerEffectKind.call(void 0, kind)) fail2(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkDPYAO5U6cjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
3594
3599
|
const layer = requireEffectLayer(layers, id, "add effects");
|
|
3595
3600
|
const current = layerEffectsOf(layer);
|
|
3596
3601
|
const ids = new Set(current.items.map((e) => e.id));
|
|
3597
|
-
let effectId =
|
|
3598
|
-
while (ids.has(effectId)) effectId =
|
|
3602
|
+
let effectId = _chunkDPYAO5U6cjs.newEffectId.call(void 0, );
|
|
3603
|
+
while (ids.has(effectId)) effectId = _chunkDPYAO5U6cjs.newEffectId.call(void 0, );
|
|
3599
3604
|
const { id: _ignored, kind: _kind, ...rest } = params;
|
|
3600
|
-
const effect = guard(() =>
|
|
3605
|
+
const effect = guard(() => _chunkDPYAO5U6cjs.mergeLayerEffect.call(void 0, _chunkDPYAO5U6cjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
|
|
3601
3606
|
const items = [...current.items];
|
|
3602
3607
|
const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
|
|
3603
3608
|
items.splice(at, 0, effect);
|
|
@@ -3614,7 +3619,7 @@ function updateLayerEffect(layers, id, effectId, changes) {
|
|
|
3614
3619
|
const i = requireEffect(layer, effectId);
|
|
3615
3620
|
const current = layer.effects;
|
|
3616
3621
|
const items = [...current.items];
|
|
3617
|
-
items[i] = guard(() =>
|
|
3622
|
+
items[i] = guard(() => _chunkDPYAO5U6cjs.mergeLayerEffect.call(void 0, items[i], changes));
|
|
3618
3623
|
return setLayerEffects(layers, id, { ...current, items });
|
|
3619
3624
|
}
|
|
3620
3625
|
function removeLayerEffect(layers, id, effectId) {
|
|
@@ -3637,7 +3642,7 @@ function setLayerEffectsEnabled(layers, id, enabled, scale) {
|
|
|
3637
3642
|
function parseBlend(value, allowPassThrough = false) {
|
|
3638
3643
|
if (value === void 0) return void 0;
|
|
3639
3644
|
if (value === "pass-through" && allowPassThrough) return value;
|
|
3640
|
-
if (!
|
|
3645
|
+
if (!_chunk2VX55NFMcjs.isBlendMode.call(void 0, value)) fail2(`Unknown blend mode "${String(value)}".`);
|
|
3641
3646
|
return value;
|
|
3642
3647
|
}
|
|
3643
3648
|
function unionRect(a, b) {
|
|
@@ -3859,7 +3864,7 @@ var PHOTO_PROFILE = {
|
|
|
3859
3864
|
return v;
|
|
3860
3865
|
}
|
|
3861
3866
|
};
|
|
3862
|
-
var LayerCompositor = class extends
|
|
3867
|
+
var LayerCompositor = class extends _chunkDPYAO5U6cjs.RasterCompositor {
|
|
3863
3868
|
constructor(options = {}) {
|
|
3864
3869
|
super(PHOTO_PROFILE, options);
|
|
3865
3870
|
}
|
|
@@ -3875,7 +3880,7 @@ var LayerCompositor = class extends _chunkHB4ICNNAcjs.RasterCompositor {
|
|
|
3875
3880
|
}
|
|
3876
3881
|
};
|
|
3877
3882
|
function compositeDeep(layers, rect, sources, depth) {
|
|
3878
|
-
const deep = new (0,
|
|
3883
|
+
const deep = new (0, _chunkDPYAO5U6cjs.DeepCompositor)(new LayerCompositor(), PHOTO_PROFILE, {
|
|
3879
3884
|
applyFilterRunDeep: (run, acc, _r, masks) => applyAdjustmentLayersFloat(acc, run.map(adjustmentNodeAsLayer), masks),
|
|
3880
3885
|
pixelFiltersDeep: (l) => {
|
|
3881
3886
|
if (l.type !== "pixel" || hasEdgeUnmix(l.edge)) return null;
|
|
@@ -3891,9 +3896,9 @@ function compositeDeep(layers, rect, sources, depth) {
|
|
|
3891
3896
|
var fail3 = (message) => {
|
|
3892
3897
|
throw new LayerOperationError(message);
|
|
3893
3898
|
};
|
|
3894
|
-
var TEXT_RENDER_MARGIN =
|
|
3899
|
+
var TEXT_RENDER_MARGIN = _chunkDPYAO5U6cjs.MAX_EFFECT_REACH;
|
|
3895
3900
|
function textMatrix(layer) {
|
|
3896
|
-
return _nullishCoalesce(layer.transform, () => (
|
|
3901
|
+
return _nullishCoalesce(layer.transform, () => ( _chunkIOFVM3L3cjs.IDENTITY_MATRIX));
|
|
3897
3902
|
}
|
|
3898
3903
|
function rectCorners(r) {
|
|
3899
3904
|
return [
|
|
@@ -3904,7 +3909,7 @@ function rectCorners(r) {
|
|
|
3904
3909
|
];
|
|
3905
3910
|
}
|
|
3906
3911
|
function docRect(r, m) {
|
|
3907
|
-
const pts = rectCorners(r).map((p) =>
|
|
3912
|
+
const pts = rectCorners(r).map((p) => _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, p));
|
|
3908
3913
|
const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
|
|
3909
3914
|
const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
|
|
3910
3915
|
const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
|
|
@@ -3924,7 +3929,7 @@ function inkBounds(layout) {
|
|
|
3924
3929
|
for (const f of l.fragments) {
|
|
3925
3930
|
const pad = f.style.fontSize * (l.matrix ? 1 : 0.5);
|
|
3926
3931
|
const w = f.carets[f.carets.length - 1];
|
|
3927
|
-
const r =
|
|
3932
|
+
const r = _chunkIOFVM3L3cjs.transformTextRect.call(void 0, l.matrix, { x: f.x - pad, y: l.baseline - l.ascent - pad + Math.min(0, f.y - l.baseline), width: w + 2 * pad, height: l.ascent + l.descent + 2 * pad + Math.abs(f.y - l.baseline) });
|
|
3928
3933
|
if (!b) b = r;
|
|
3929
3934
|
else {
|
|
3930
3935
|
const x0 = Math.min(b.x, r.x);
|
|
@@ -3937,14 +3942,14 @@ function inkBounds(layout) {
|
|
|
3937
3942
|
}
|
|
3938
3943
|
function textOutlines(layer, shaper) {
|
|
3939
3944
|
if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
|
|
3940
|
-
const layout =
|
|
3945
|
+
const layout = _chunkIOFVM3L3cjs.layoutText.call(void 0, layer, shaper);
|
|
3941
3946
|
const m = textMatrix(layer);
|
|
3942
3947
|
const out = [];
|
|
3943
3948
|
for (const l of layout.lines) {
|
|
3944
3949
|
for (const f of l.fragments) {
|
|
3945
|
-
let path =
|
|
3946
|
-
for (const r of
|
|
3947
|
-
out.push({ fragment: f, path:
|
|
3950
|
+
let path = _chunkIOFVM3L3cjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
|
|
3951
|
+
for (const r of _chunkIOFVM3L3cjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkIOFVM3L3cjs.textRectPath.call(void 0, r)];
|
|
3952
|
+
out.push({ fragment: f, path: _chunkIOFVM3L3cjs.isIdentityMatrix.call(void 0, m) ? path : _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, path, m) });
|
|
3948
3953
|
}
|
|
3949
3954
|
}
|
|
3950
3955
|
return out;
|
|
@@ -4000,7 +4005,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4000
4005
|
const canvas = env.createCanvas(region.width, region.height);
|
|
4001
4006
|
const ctx = canvas.getContext("2d");
|
|
4002
4007
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
4003
|
-
const layout =
|
|
4008
|
+
const layout = _chunkIOFVM3L3cjs.layoutText.call(void 0, layer, shaper);
|
|
4004
4009
|
const m = textMatrix(layer);
|
|
4005
4010
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
4006
4011
|
ctx.clearRect(0, 0, region.width, region.height);
|
|
@@ -4010,8 +4015,8 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4010
4015
|
const [r, g, b] = rgbOf(f.style.color);
|
|
4011
4016
|
ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
|
|
4012
4017
|
ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
|
|
4013
|
-
|
|
4014
|
-
for (const d of
|
|
4018
|
+
_chunkIOFVM3L3cjs.drawTextFragment.call(void 0, ctx, shaper, layer.text, f);
|
|
4019
|
+
for (const d of _chunkIOFVM3L3cjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
|
|
4015
4020
|
}
|
|
4016
4021
|
}
|
|
4017
4022
|
ctx.globalAlpha = 1;
|
|
@@ -4022,7 +4027,7 @@ function renderOnCanvas(layer, shaper, region, env) {
|
|
|
4022
4027
|
function renderText(layer, env) {
|
|
4023
4028
|
const shaper = env.shaper;
|
|
4024
4029
|
if (!shaper || !shaper.outline && !shaper.draw) return null;
|
|
4025
|
-
const layout =
|
|
4030
|
+
const layout = _chunkIOFVM3L3cjs.layoutText.call(void 0, layer, shaper);
|
|
4026
4031
|
const ink = inkBounds(layout);
|
|
4027
4032
|
const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
|
|
4028
4033
|
const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
|
|
@@ -4123,7 +4128,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
|
|
|
4123
4128
|
continue;
|
|
4124
4129
|
}
|
|
4125
4130
|
const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
|
|
4126
|
-
if (k === "autoLeading" && value ===
|
|
4131
|
+
if (k === "autoLeading" && value === _chunkIOFVM3L3cjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
|
|
4127
4132
|
else o[k] = value;
|
|
4128
4133
|
} else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
|
|
4129
4134
|
}
|
|
@@ -4164,15 +4169,15 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
4164
4169
|
opacity: 1,
|
|
4165
4170
|
blend: "normal",
|
|
4166
4171
|
text: text3,
|
|
4167
|
-
runs:
|
|
4168
|
-
paragraphs:
|
|
4172
|
+
runs: _chunkIOFVM3L3cjs.fitRuns.call(void 0, init.runs, text3.length, _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE),
|
|
4173
|
+
paragraphs: _chunkIOFVM3L3cjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
|
|
4169
4174
|
frame: init.frame,
|
|
4170
4175
|
...init.orientation === "vertical" ? { orientation: "vertical" } : {},
|
|
4171
4176
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
4172
4177
|
offset: { x: 0, y: 0 }
|
|
4173
4178
|
};
|
|
4174
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => (
|
|
4175
|
-
if (init.transform && !
|
|
4179
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _79 => _79.runs, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.style]), () => ( _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE)) }];
|
|
4180
|
+
if (init.transform && !_chunkIOFVM3L3cjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
4176
4181
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
4177
4182
|
return rerenderText(layer, env);
|
|
4178
4183
|
}
|
|
@@ -4183,24 +4188,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4183
4188
|
const next = { ...current, ...patch };
|
|
4184
4189
|
if (!("annotation" in patch)) delete next.annotation;
|
|
4185
4190
|
if (next.orientation !== "vertical") delete next.orientation;
|
|
4186
|
-
if ("text" in patch || "runs" in patch) next.runs =
|
|
4187
|
-
if (!next.runs.length) next.runs = [{ length: 0, style:
|
|
4188
|
-
if ("text" in patch || "paragraphs" in patch) next.paragraphs =
|
|
4191
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkIOFVM3L3cjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _82 => _82.runs, 'access', _83 => _83[0], 'optionalAccess', _84 => _84.style]), () => ( _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE)));
|
|
4192
|
+
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkIOFVM3L3cjs.styleAt.call(void 0, current.runs, 0, _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE) }];
|
|
4193
|
+
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkIOFVM3L3cjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4189
4194
|
const rendered = rerenderText(next, env);
|
|
4190
|
-
return { layers:
|
|
4195
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
4191
4196
|
}
|
|
4192
4197
|
function replaceTextRange(layer, start, end, insert) {
|
|
4193
4198
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
4194
|
-
const style =
|
|
4195
|
-
const runs =
|
|
4196
|
-
const pstyle =
|
|
4197
|
-
const paragraphs =
|
|
4198
|
-
return { text: text3, runs, paragraphs:
|
|
4199
|
+
const style = _chunkIOFVM3L3cjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE);
|
|
4200
|
+
const runs = _chunkIOFVM3L3cjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
|
|
4201
|
+
const pstyle = _chunkIOFVM3L3cjs.styleAt.call(void 0, layer.paragraphs, start, {});
|
|
4202
|
+
const paragraphs = _chunkIOFVM3L3cjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
|
|
4203
|
+
return { text: text3, runs, paragraphs: _chunkIOFVM3L3cjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
|
|
4199
4204
|
}
|
|
4200
4205
|
function transformTypeLayer(layer, m) {
|
|
4201
|
-
const t =
|
|
4206
|
+
const t = _chunkIOFVM3L3cjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
|
|
4202
4207
|
const next = { ...layer };
|
|
4203
|
-
if (
|
|
4208
|
+
if (_chunkIOFVM3L3cjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
|
|
4204
4209
|
else next.transform = t;
|
|
4205
4210
|
delete next.annotation;
|
|
4206
4211
|
return next;
|
|
@@ -4208,7 +4213,7 @@ function transformTypeLayer(layer, m) {
|
|
|
4208
4213
|
function typeFrame(layer, shaper) {
|
|
4209
4214
|
if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
|
|
4210
4215
|
if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
|
|
4211
|
-
const b =
|
|
4216
|
+
const b = _chunkIOFVM3L3cjs.layoutText.call(void 0, layer, shaper).bounds;
|
|
4212
4217
|
return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
|
|
4213
4218
|
}
|
|
4214
4219
|
function typeAsPixelLayer(layer) {
|
|
@@ -4216,7 +4221,7 @@ function typeAsPixelLayer(layer) {
|
|
|
4216
4221
|
return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
|
|
4217
4222
|
}
|
|
4218
4223
|
function toTextSpace(layer, p) {
|
|
4219
|
-
return
|
|
4224
|
+
return _chunkIOFVM3L3cjs.applyMatrix.call(void 0, _chunkIOFVM3L3cjs.invertMatrix.call(void 0, textMatrix(layer)), p);
|
|
4220
4225
|
}
|
|
4221
4226
|
function typeFromAnnotation(a) {
|
|
4222
4227
|
if (a.type !== "text") return null;
|
|
@@ -4230,7 +4235,7 @@ function typeFromAnnotation(a) {
|
|
|
4230
4235
|
if (op !== 1) style.opacity = op;
|
|
4231
4236
|
const text3 = t.text.replace(/\r?\n|\r/g, " ");
|
|
4232
4237
|
const translate = [1, 0, 0, 1, t.x, t.y];
|
|
4233
|
-
const transform = t.rotation ?
|
|
4238
|
+
const transform = t.rotation ? _chunkIOFVM3L3cjs.multiplyMatrices.call(void 0, translate, _chunkIOFVM3L3cjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
|
|
4234
4239
|
return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
|
|
4235
4240
|
}
|
|
4236
4241
|
function annotationOfType(layer) {
|
|
@@ -4564,7 +4569,7 @@ function identityTransform(box2) {
|
|
|
4564
4569
|
}
|
|
4565
4570
|
function cornersFromMatrix(box2, m) {
|
|
4566
4571
|
const q2 = _chunkQT26RHKKcjs.boxQuad.call(void 0, box2);
|
|
4567
|
-
return [
|
|
4572
|
+
return [_chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, q2[0]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, q2[1]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, q2[2]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4568
4573
|
}
|
|
4569
4574
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4570
4575
|
const [tl, tr, br, bl] = corners;
|
|
@@ -4581,7 +4586,7 @@ function transformHomography(geometry) {
|
|
|
4581
4586
|
function hasWarp(geometry) {
|
|
4582
4587
|
const w = geometry.warp;
|
|
4583
4588
|
if (!w) return false;
|
|
4584
|
-
const id =
|
|
4589
|
+
const id = _chunkIOFVM3L3cjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
|
|
4585
4590
|
if (id.points.length !== w.points.length || id.us.some((u, i) => Math.abs(u - w.us[i]) > 1e-12) || id.vs.some((v, i) => Math.abs(v - w.vs[i]) > 1e-12)) return true;
|
|
4586
4591
|
return w.points.some((p, i) => Math.abs(p.x - id.points[i].x) > 1e-6 || Math.abs(p.y - id.points[i].y) > 1e-6);
|
|
4587
4592
|
}
|
|
@@ -4596,7 +4601,7 @@ function transformMap(geometry) {
|
|
|
4596
4601
|
const { box: box2 } = geometry;
|
|
4597
4602
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4598
4603
|
if (!warp) return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, p);
|
|
4599
|
-
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h,
|
|
4604
|
+
return (p) => _chunkQT26RHKKcjs.applyHomography.call(void 0, h, _chunkIOFVM3L3cjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4600
4605
|
}
|
|
4601
4606
|
function transformedPoint(geometry, fx, fy) {
|
|
4602
4607
|
const f = transformMap(geometry);
|
|
@@ -4640,8 +4645,8 @@ function matrixFromParams(box2, params) {
|
|
|
4640
4645
|
const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
|
|
4641
4646
|
const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
|
|
4642
4647
|
const ref = referencePoint(box2, params.reference);
|
|
4643
|
-
const linear =
|
|
4644
|
-
return
|
|
4648
|
+
const linear = _chunkIOFVM3L3cjs.multiplyMatrices.call(void 0, _chunkIOFVM3L3cjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkIOFVM3L3cjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
|
|
4649
|
+
return _chunkIOFVM3L3cjs.multiplyMatrices.call(void 0, _chunkIOFVM3L3cjs.matrixAbout.call(void 0, linear, ref), _chunkIOFVM3L3cjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
|
|
4645
4650
|
}
|
|
4646
4651
|
function describeTransform(geometry, reference = "center") {
|
|
4647
4652
|
const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4658,7 +4663,7 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4658
4663
|
const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
|
|
4659
4664
|
const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
|
|
4660
4665
|
const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
|
|
4661
|
-
const at =
|
|
4666
|
+
const at = _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, ref);
|
|
4662
4667
|
const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
|
|
4663
4668
|
return {
|
|
4664
4669
|
affine: true,
|
|
@@ -4676,24 +4681,24 @@ function applyParams(geometry, params) {
|
|
|
4676
4681
|
const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
|
|
4677
4682
|
const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
|
|
4678
4683
|
const c = geometry.corners;
|
|
4679
|
-
return [
|
|
4684
|
+
return [_chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, c[0]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, c[1]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, c[2]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, c[3])];
|
|
4680
4685
|
}
|
|
4681
4686
|
function flipCorners(geometry, axis) {
|
|
4682
4687
|
const c = anchorPoint(geometry, "center");
|
|
4683
4688
|
const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
|
|
4684
4689
|
const q2 = geometry.corners;
|
|
4685
|
-
return [
|
|
4690
|
+
return [_chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, q2[0]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, q2[1]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, q2[2]), _chunkIOFVM3L3cjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4686
4691
|
}
|
|
4687
4692
|
function boxPointOf(geometry, p) {
|
|
4688
4693
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4689
|
-
if (m) return
|
|
4694
|
+
if (m) return _chunkIOFVM3L3cjs.applyMatrix.call(void 0, _chunkIOFVM3L3cjs.invertMatrix.call(void 0, m), p);
|
|
4690
4695
|
return null;
|
|
4691
4696
|
}
|
|
4692
4697
|
function presetWarp(box2, preset) {
|
|
4693
|
-
return
|
|
4698
|
+
return _chunkIOFVM3L3cjs.warpPresetMesh.call(void 0, preset, box2);
|
|
4694
4699
|
}
|
|
4695
4700
|
function isValidWarp(mesh) {
|
|
4696
|
-
return
|
|
4701
|
+
return _chunkIOFVM3L3cjs.isValidWarpMesh.call(void 0, mesh);
|
|
4697
4702
|
}
|
|
4698
4703
|
function geometryHomography(geometry) {
|
|
4699
4704
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
@@ -4704,7 +4709,7 @@ function geometryHomography(geometry) {
|
|
|
4704
4709
|
var fail4 = (message) => {
|
|
4705
4710
|
throw new LayerOperationError(message);
|
|
4706
4711
|
};
|
|
4707
|
-
var SMART_RENDER_MARGIN =
|
|
4712
|
+
var SMART_RENDER_MARGIN = _chunkDPYAO5U6cjs.MAX_EFFECT_REACH;
|
|
4708
4713
|
var incompleteSurfaces = /* @__PURE__ */ new WeakSet();
|
|
4709
4714
|
var isSmartSurfaceIncomplete = (surface) => incompleteSurfaces.has(surface);
|
|
4710
4715
|
var surfaceIds = /* @__PURE__ */ new WeakMap();
|
|
@@ -4820,7 +4825,7 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4820
4825
|
k = step;
|
|
4821
4826
|
let r = _optionalChain([options, 'access', _101 => _101.reduced, 'optionalAccess', _102 => _102.get, 'call', _103 => _103(k)]);
|
|
4822
4827
|
if (!r) {
|
|
4823
|
-
r =
|
|
4828
|
+
r = _chunkDPYAO5U6cjs.reduceSurface.call(void 0, src, k);
|
|
4824
4829
|
_optionalChain([options, 'access', _104 => _104.reduced, 'optionalAccess', _105 => _105.set, 'call', _106 => _106(k, r)]);
|
|
4825
4830
|
}
|
|
4826
4831
|
source = r;
|
|
@@ -4830,15 +4835,15 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4830
4835
|
if (hasWarp(g)) {
|
|
4831
4836
|
const f = transformMap(g);
|
|
4832
4837
|
if (!f) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
|
|
4833
|
-
out =
|
|
4838
|
+
out = _chunkDPYAO5U6cjs.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 });
|
|
4834
4839
|
} else {
|
|
4835
4840
|
const h = transformHomography(g);
|
|
4836
4841
|
if (!h) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
|
|
4837
4842
|
const hk = _chunkQT26RHKKcjs.multiplyHomographies.call(void 0, [k, 0, 0, 0, k, 0, 0, 0, 1], h);
|
|
4838
|
-
out =
|
|
4843
|
+
out = _chunkDPYAO5U6cjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
|
|
4839
4844
|
}
|
|
4840
4845
|
} catch (e) {
|
|
4841
|
-
if (e instanceof
|
|
4846
|
+
if (e instanceof _chunkDPYAO5U6cjs.TransformTooLargeError) fail4(e.message);
|
|
4842
4847
|
throw e;
|
|
4843
4848
|
}
|
|
4844
4849
|
}
|
|
@@ -4915,7 +4920,7 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4915
4920
|
if (f.opacity >= 1) acc = out2;
|
|
4916
4921
|
else lerpInto(acc, out2, f.opacity, null);
|
|
4917
4922
|
} else {
|
|
4918
|
-
|
|
4923
|
+
_chunkDPYAO5U6cjs.blendTile.call(void 0, acc, out2, f.blend, f.opacity, null);
|
|
4919
4924
|
}
|
|
4920
4925
|
}
|
|
4921
4926
|
entry = { key, base, filtered: acc };
|
|
@@ -4972,11 +4977,11 @@ function normalizePlacement(raw, contents) {
|
|
|
4972
4977
|
}
|
|
4973
4978
|
const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
|
|
4974
4979
|
if (raw.warp) {
|
|
4975
|
-
if (!
|
|
4980
|
+
if (!_chunkIOFVM3L3cjs.isValidWarpMesh.call(void 0, raw.warp)) fail4("warp must be a mesh with us and vs (knots from 0 to 1, increasing) and (3\xB7columns + 1) \xD7 (3\xB7rows + 1) finite points in contents pixels.");
|
|
4976
4981
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4977
4982
|
}
|
|
4978
4983
|
if (raw.interpolation !== void 0) {
|
|
4979
|
-
if (!
|
|
4984
|
+
if (!_chunkDPYAO5U6cjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
|
|
4980
4985
|
if (raw.interpolation !== "bicubic") out.interpolation = raw.interpolation;
|
|
4981
4986
|
}
|
|
4982
4987
|
const g = { box: { x: 0, y: 0, width: contents.width, height: contents.height }, corners: out.corners, warp: _nullishCoalesce(out.warp, () => ( null)) };
|
|
@@ -4996,7 +5001,7 @@ function followMask(mask, before, after) {
|
|
|
4996
5001
|
const inv = _chunkQT26RHKKcjs.invertHomography.call(void 0, h0);
|
|
4997
5002
|
if (!inv) return mask;
|
|
4998
5003
|
const delta = _chunkQT26RHKKcjs.multiplyHomographies.call(void 0, inv, h1);
|
|
4999
|
-
const surface =
|
|
5004
|
+
const surface = _chunkDPYAO5U6cjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
|
|
5000
5005
|
return { ...mask, surface };
|
|
5001
5006
|
}
|
|
5002
5007
|
function setSmartPlacement(layers, id, placement, canvas) {
|
|
@@ -5017,7 +5022,7 @@ function setSmartPlacement(layers, id, placement, canvas) {
|
|
|
5017
5022
|
next.smartFilters = { ...next.smartFilters, mask: m };
|
|
5018
5023
|
}
|
|
5019
5024
|
next = rerender(next, canvas, "be transformed");
|
|
5020
|
-
return { layers:
|
|
5025
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
|
|
5021
5026
|
}
|
|
5022
5027
|
function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
5023
5028
|
const layer = requireSmartObject(layers, id);
|
|
@@ -5040,7 +5045,7 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
|
5040
5045
|
} else {
|
|
5041
5046
|
next = rerender(next, canvas, "move");
|
|
5042
5047
|
}
|
|
5043
|
-
return
|
|
5048
|
+
return _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next);
|
|
5044
5049
|
}
|
|
5045
5050
|
function translateLayer(layer, dx, dy) {
|
|
5046
5051
|
if (!dx && !dy) return layer;
|
|
@@ -5076,7 +5081,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5076
5081
|
case "shape": {
|
|
5077
5082
|
const next = {
|
|
5078
5083
|
...layer,
|
|
5079
|
-
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }),
|
|
5084
|
+
components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkIOFVM3L3cjs.translateMatrix.call(void 0, dx, dy)),
|
|
5080
5085
|
surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy),
|
|
5081
5086
|
mask: moveMask(layer.mask)
|
|
5082
5087
|
};
|
|
@@ -5085,7 +5090,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5085
5090
|
return next;
|
|
5086
5091
|
}
|
|
5087
5092
|
case "type": {
|
|
5088
|
-
const next = { ...transformTypeLayer(layer,
|
|
5093
|
+
const next = { ...transformTypeLayer(layer, _chunkIOFVM3L3cjs.translateMatrix.call(void 0, dx, dy)), surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
|
|
5089
5094
|
if (!next.mask) delete next.mask;
|
|
5090
5095
|
return next;
|
|
5091
5096
|
}
|
|
@@ -5108,7 +5113,7 @@ function layerExtent(layer, surfaceOf, canvas) {
|
|
|
5108
5113
|
} else {
|
|
5109
5114
|
b = full;
|
|
5110
5115
|
}
|
|
5111
|
-
const m =
|
|
5116
|
+
const m = _chunkDPYAO5U6cjs.effectsMargin.call(void 0, layer.effects);
|
|
5112
5117
|
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) };
|
|
5113
5118
|
return b;
|
|
5114
5119
|
}
|
|
@@ -5177,7 +5182,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
5177
5182
|
delete resolved2.source;
|
|
5178
5183
|
layer = resolved2;
|
|
5179
5184
|
}
|
|
5180
|
-
if (
|
|
5185
|
+
if (_chunkDPYAO5U6cjs.flattenLayers.call(void 0, [layer]).some((x) => x.type === "pixel" && x.source === "document")) fail4(`Layer "${layer.name || layer.id}" holds the document image inside a group; convert the Background on its own.`);
|
|
5181
5186
|
return translateLayer(layer, -b.x, -b.y);
|
|
5182
5187
|
});
|
|
5183
5188
|
if (nested[0].clipped) {
|
|
@@ -5204,8 +5209,8 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
5204
5209
|
smart = { ...smart, surface: renderSmartObject(smart, canvas) };
|
|
5205
5210
|
const below = ordered.filter((l) => l.index < top.index).length;
|
|
5206
5211
|
let out = layers;
|
|
5207
|
-
for (const l of ordered) out =
|
|
5208
|
-
return { layers:
|
|
5212
|
+
for (const l of ordered) out = _chunkDPYAO5U6cjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
5213
|
+
return { layers: _chunkDPYAO5U6cjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
|
|
5209
5214
|
}
|
|
5210
5215
|
function rasterizeSmartObject(layers, id) {
|
|
5211
5216
|
const layer = requireSmartObject(layers, id);
|
|
@@ -5225,7 +5230,7 @@ function rasterizeSmartObject(layers, id) {
|
|
|
5225
5230
|
if (layer.locks) out.locks = layer.locks;
|
|
5226
5231
|
if (layer.effects) out.effects = layer.effects;
|
|
5227
5232
|
if (layer.fillOpacity !== void 0) out.fillOpacity = layer.fillOpacity;
|
|
5228
|
-
return { layers:
|
|
5233
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
|
|
5229
5234
|
}
|
|
5230
5235
|
function copySmartObject(layers, id, linked, name) {
|
|
5231
5236
|
const loc = requireLayer(layers, id);
|
|
@@ -5235,19 +5240,19 @@ function copySmartObject(layers, id, linked, name) {
|
|
|
5235
5240
|
delete copy.psd;
|
|
5236
5241
|
if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
|
|
5237
5242
|
if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
|
|
5238
|
-
return { layers:
|
|
5243
|
+
return { layers: _chunkDPYAO5U6cjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _140 => _140.parent, 'optionalAccess', _141 => _141.id]), () => ( null)), loc.index + 1), layer: copy };
|
|
5239
5244
|
}
|
|
5240
5245
|
function instancesOf(layers, contentsId) {
|
|
5241
|
-
return
|
|
5246
|
+
return _chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
|
|
5242
5247
|
}
|
|
5243
5248
|
function replaceContents(layers, contentsId, contents, canvas) {
|
|
5244
5249
|
const ids = instancesOf(layers, contentsId);
|
|
5245
5250
|
if (!ids.length) fail4(`No smart object uses contents "${contentsId}".`);
|
|
5246
|
-
for (const id of ids) requireUnlocked(
|
|
5251
|
+
for (const id of ids) requireUnlocked(_chunkDPYAO5U6cjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
|
|
5247
5252
|
const next = { ...contents, id: contentsId };
|
|
5248
5253
|
let out = layers;
|
|
5249
5254
|
for (const id of ids) {
|
|
5250
|
-
out =
|
|
5255
|
+
out = _chunkDPYAO5U6cjs.mapLayer.call(void 0, out, id, (l) => {
|
|
5251
5256
|
const layer = l;
|
|
5252
5257
|
return rerender({ ...layer, contents: next, placement: refitPlacement(layer, next) }, canvas, "take the new contents");
|
|
5253
5258
|
});
|
|
@@ -5271,14 +5276,14 @@ function refitPlacement(layer, contents) {
|
|
|
5271
5276
|
});
|
|
5272
5277
|
const out = { corners: pts };
|
|
5273
5278
|
if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
|
|
5274
|
-
if (layer.placement.warp) out.warp =
|
|
5279
|
+
if (layer.placement.warp) out.warp = _chunkIOFVM3L3cjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
|
|
5275
5280
|
return out;
|
|
5276
5281
|
}
|
|
5277
5282
|
function normalizeSmartFilter(raw, id = newLayerId("flt")) {
|
|
5278
5283
|
if (raw.kind === "psd") fail4("Photoshop filters can only come from a PSD; add develop or blur.");
|
|
5279
5284
|
const base = raw.kind === "effect" ? normalizeEffectSmartFilter(raw, id) : normalizeFilter(raw, id);
|
|
5280
5285
|
const blend = _nullishCoalesce(raw.blend, () => ( "normal"));
|
|
5281
|
-
if (!
|
|
5286
|
+
if (!_chunk2VX55NFMcjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
|
|
5282
5287
|
const opacity = _nullishCoalesce(raw.opacity, () => ( 1));
|
|
5283
5288
|
if (!(typeof opacity === "number" && opacity >= 0 && opacity <= 1)) fail4("opacity must be a number from 0 to 1.");
|
|
5284
5289
|
return { ...base, blend, opacity };
|
|
@@ -5326,7 +5331,7 @@ function addSmartFilter(layers, id, filter, canvas, index) {
|
|
|
5326
5331
|
const at = index === void 0 ? filters.length : Math.max(0, Math.min(filters.length, Math.floor(index)));
|
|
5327
5332
|
filters.splice(at, 0, filter);
|
|
5328
5333
|
const next = withStack(layer, { ...stack, filters }, canvas);
|
|
5329
|
-
return { layers:
|
|
5334
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
|
|
5330
5335
|
}
|
|
5331
5336
|
function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
5332
5337
|
const layer = editableSmart(layers, id);
|
|
@@ -5338,7 +5343,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
|
5338
5343
|
const extra = Object.keys(changes).filter((k) => !["enabled", "blend", "opacity", "kind"].includes(k));
|
|
5339
5344
|
if (extra.length) fail4(`"${current.name}" is a Photoshop filter we keep but do not model; only enabled, blend and opacity change. Unknown: ${extra.join(", ")}.`);
|
|
5340
5345
|
const blend = _nullishCoalesce(changes.blend, () => ( current.blend));
|
|
5341
|
-
if (!
|
|
5346
|
+
if (!_chunk2VX55NFMcjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
|
|
5342
5347
|
const opacity = _nullishCoalesce(changes.opacity, () => ( current.opacity));
|
|
5343
5348
|
if (!(typeof opacity === "number" && opacity >= 0 && opacity <= 1)) fail4("opacity must be a number from 0 to 1.");
|
|
5344
5349
|
merged2 = { ...current, enabled: changes.enabled === void 0 ? current.enabled : Boolean(changes.enabled), blend, opacity };
|
|
@@ -5348,7 +5353,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
|
5348
5353
|
const filters = [...layer.smartFilters.filters];
|
|
5349
5354
|
filters[i] = merged2;
|
|
5350
5355
|
const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
|
|
5351
|
-
return { layers:
|
|
5356
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
|
|
5352
5357
|
}
|
|
5353
5358
|
function removeSmartFilter(layers, id, filterId, canvas) {
|
|
5354
5359
|
const layer = editableSmart(layers, id);
|
|
@@ -5356,7 +5361,7 @@ function removeSmartFilter(layers, id, filterId, canvas) {
|
|
|
5356
5361
|
const stack = layer.smartFilters;
|
|
5357
5362
|
const filters = stack.filters.filter((f) => f.id !== filterId);
|
|
5358
5363
|
const next = withStack(layer, filters.length ? { ...stack, filters } : stack.enabled ? void 0 : { enabled: false, filters }, canvas);
|
|
5359
|
-
return { layers:
|
|
5364
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5360
5365
|
}
|
|
5361
5366
|
function moveSmartFilter(layers, id, filterId, index, canvas) {
|
|
5362
5367
|
const layer = editableSmart(layers, id);
|
|
@@ -5367,12 +5372,12 @@ function moveSmartFilter(layers, id, filterId, index, canvas) {
|
|
|
5367
5372
|
const [f] = filters.splice(i, 1);
|
|
5368
5373
|
filters.splice(index, 0, f);
|
|
5369
5374
|
const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
|
|
5370
|
-
return { layers:
|
|
5375
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5371
5376
|
}
|
|
5372
5377
|
function setSmartFiltersEnabled(layers, id, enabled, canvas) {
|
|
5373
5378
|
const layer = editableSmart(layers, id);
|
|
5374
5379
|
const next = withStack(layer, { ...stackOf(layer), enabled: Boolean(enabled) }, canvas);
|
|
5375
|
-
return { layers:
|
|
5380
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5376
5381
|
}
|
|
5377
5382
|
function setSmartFilterMask(layers, id, mask, canvas) {
|
|
5378
5383
|
const layer = editableSmart(layers, id);
|
|
@@ -5381,7 +5386,7 @@ function setSmartFilterMask(layers, id, mask, canvas) {
|
|
|
5381
5386
|
if (mask) stack.mask = mask;
|
|
5382
5387
|
else delete stack.mask;
|
|
5383
5388
|
const next = withStack(layer, stack, canvas);
|
|
5384
|
-
return { layers:
|
|
5389
|
+
return { layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5385
5390
|
}
|
|
5386
5391
|
function withFilterMaskSurface(layer, surface, canvas) {
|
|
5387
5392
|
const stack = stackOf(layer);
|
|
@@ -5395,7 +5400,7 @@ function placementBounds(layer) {
|
|
|
5395
5400
|
// src/image-editor/layers/serialize.ts
|
|
5396
5401
|
var LAYERED_SCHEMA_VERSION = 3;
|
|
5397
5402
|
function serializePatterns(patterns) {
|
|
5398
|
-
return patterns.map((p) => ({ id: p.id, name: p.name, png:
|
|
5403
|
+
return patterns.map((p) => ({ id: p.id, name: p.name, png: _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, p.width, p.height, p.data) }));
|
|
5399
5404
|
}
|
|
5400
5405
|
function deserializePatterns(raw, problems = []) {
|
|
5401
5406
|
if (!Array.isArray(raw)) return [];
|
|
@@ -5418,7 +5423,7 @@ function encodeSurface(surface) {
|
|
|
5418
5423
|
let out = null;
|
|
5419
5424
|
if (b) {
|
|
5420
5425
|
const data = _chunk474IQG74cjs.readRegion.call(void 0, surface, b);
|
|
5421
|
-
out = { url:
|
|
5426
|
+
out = { url: _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
|
|
5422
5427
|
}
|
|
5423
5428
|
encodedCache.set(surface, out);
|
|
5424
5429
|
return out;
|
|
@@ -5427,15 +5432,15 @@ var deepCache = /* @__PURE__ */ new WeakMap();
|
|
|
5427
5432
|
function encodeDeepSurface(surface) {
|
|
5428
5433
|
if (deepCache.has(surface)) return deepCache.get(surface);
|
|
5429
5434
|
let out = null;
|
|
5430
|
-
const depth =
|
|
5435
|
+
const depth = _chunk2VX55NFMcjs.surfaceDepth.call(void 0, surface);
|
|
5431
5436
|
const b = depth === 8 ? null : _chunk474IQG74cjs.contentBounds.call(void 0, surface);
|
|
5432
5437
|
if (depth !== 8 && b) {
|
|
5433
|
-
const samples =
|
|
5438
|
+
const samples = _chunk2VX55NFMcjs.readDeepRegion.call(void 0, surface, b, depth);
|
|
5434
5439
|
const bytes = new Uint8Array(samples.byteLength);
|
|
5435
5440
|
const view = new DataView(bytes.buffer);
|
|
5436
5441
|
if (samples instanceof Uint16Array) for (let i = 0; i < samples.length; i++) view.setUint16(2 * i, samples[i], true);
|
|
5437
5442
|
else for (let i = 0; i < samples.length; i++) view.setFloat32(4 * i, samples[i], true);
|
|
5438
|
-
out = { depth, x: b.x, y: b.y, width: b.width, height: b.height, data:
|
|
5443
|
+
out = { depth, x: b.x, y: b.y, width: b.width, height: b.height, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, _chunkXFM3OCHUcjs.deflate.call(void 0, bytes)) };
|
|
5439
5444
|
}
|
|
5440
5445
|
deepCache.set(surface, out);
|
|
5441
5446
|
return out;
|
|
@@ -5447,13 +5452,13 @@ function decodeDeepSurface(surface, raw, problems, label) {
|
|
|
5447
5452
|
if (d.depth !== 16 && d.depth !== 32 || !(d.width > 0 && d.height > 0) || !Number.isInteger(d.x) || !Number.isInteger(d.y) || typeof d.data !== "string") throw new Error("malformed");
|
|
5448
5453
|
const n = d.width * d.height * surface.channels;
|
|
5449
5454
|
const size = d.depth === 16 ? 2 : 4;
|
|
5450
|
-
const bytes = _chunkXFM3OCHUcjs.inflate.call(void 0,
|
|
5455
|
+
const bytes = _chunkXFM3OCHUcjs.inflate.call(void 0, _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, d.data), { maxOutput: n * size });
|
|
5451
5456
|
if (bytes.length !== n * size) throw new Error("wrong length");
|
|
5452
5457
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
5453
5458
|
const samples = d.depth === 16 ? new Uint16Array(n) : new Float32Array(n);
|
|
5454
5459
|
if (samples instanceof Uint16Array) for (let i = 0; i < n; i++) samples[i] = view.getUint16(2 * i, true);
|
|
5455
5460
|
else for (let i = 0; i < n; i++) samples[i] = view.getFloat32(4 * i, true);
|
|
5456
|
-
return
|
|
5461
|
+
return _chunk2VX55NFMcjs.writeDeepRegion.call(void 0, surface, { x: d.x, y: d.y, width: d.width, height: d.height }, samples);
|
|
5457
5462
|
} catch (e6) {
|
|
5458
5463
|
problems.push(`${label}: its ${d.depth}-bit samples could not be read, so it was opened at 8 bits`);
|
|
5459
5464
|
return surface;
|
|
@@ -5490,7 +5495,7 @@ function readEdgeColor(raw) {
|
|
|
5490
5495
|
function serializeEffects(effects) {
|
|
5491
5496
|
const out = { enabled: effects.enabled, items: JSON.parse(JSON.stringify(effects.items)) };
|
|
5492
5497
|
if (effects.scale !== void 0 && effects.scale !== 1) out.scale = effects.scale;
|
|
5493
|
-
if (effects.psd) out.psd = { key: effects.psd.key, data:
|
|
5498
|
+
if (effects.psd) out.psd = { key: effects.psd.key, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, effects.psd.data) };
|
|
5494
5499
|
return out;
|
|
5495
5500
|
}
|
|
5496
5501
|
function deserializeEffects(raw) {
|
|
@@ -5500,12 +5505,12 @@ function deserializeEffects(raw) {
|
|
|
5500
5505
|
const p = r.psd;
|
|
5501
5506
|
if (p && typeof p.key === "string" && typeof p.data === "string") {
|
|
5502
5507
|
try {
|
|
5503
|
-
psd = { key: p.key, data:
|
|
5508
|
+
psd = { key: p.key, data: _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, p.data) };
|
|
5504
5509
|
} catch (e7) {
|
|
5505
5510
|
psd = void 0;
|
|
5506
5511
|
}
|
|
5507
5512
|
}
|
|
5508
|
-
return
|
|
5513
|
+
return _chunkDPYAO5U6cjs.normalizeLayerEffects.call(void 0, { ...r, psd });
|
|
5509
5514
|
}
|
|
5510
5515
|
function serializeVectorMask(vm) {
|
|
5511
5516
|
const out = { components: JSON.parse(JSON.stringify(vm.components)) };
|
|
@@ -5636,8 +5641,8 @@ function serializeType(layer, base, ctx) {
|
|
|
5636
5641
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5637
5642
|
if (_optionalChain([layer, 'access', _158 => _158.psd, 'optionalAccess', _159 => _159.tySh]) || _optionalChain([layer, 'access', _160 => _160.psd, 'optionalAccess', _161 => _161.blocks, 'optionalAccess', _162 => _162.length])) {
|
|
5638
5643
|
out.psd = {};
|
|
5639
|
-
if (layer.psd.tySh) out.psd.tySh =
|
|
5640
|
-
if (_optionalChain([layer, 'access', _163 => _163.psd, 'access', _164 => _164.blocks, 'optionalAccess', _165 => _165.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data:
|
|
5644
|
+
if (layer.psd.tySh) out.psd.tySh = _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, layer.psd.tySh);
|
|
5645
|
+
if (_optionalChain([layer, 'access', _163 => _163.psd, 'access', _164 => _164.blocks, 'optionalAccess', _165 => _165.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, b.data) }));
|
|
5641
5646
|
if (layer.psd.signature) out.psd.signature = layer.psd.signature;
|
|
5642
5647
|
}
|
|
5643
5648
|
return out;
|
|
@@ -5648,7 +5653,7 @@ function readType(r, base, ctx) {
|
|
|
5648
5653
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5649
5654
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5650
5655
|
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _166 => _166.length]), 0, 1e9, 0))),
|
|
5651
|
-
style: patchTextStyle(
|
|
5656
|
+
style: patchTextStyle(_chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _167 => _167.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5652
5657
|
}));
|
|
5653
5658
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5654
5659
|
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _168 => _168.length]), 0, 1e9, 0))),
|
|
@@ -5661,13 +5666,13 @@ function readType(r, base, ctx) {
|
|
|
5661
5666
|
...base,
|
|
5662
5667
|
type: "type",
|
|
5663
5668
|
text: text3,
|
|
5664
|
-
runs:
|
|
5665
|
-
paragraphs:
|
|
5669
|
+
runs: _chunkIOFVM3L3cjs.fitRuns.call(void 0, runs, text3.length, _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE),
|
|
5670
|
+
paragraphs: _chunkIOFVM3L3cjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
|
|
5666
5671
|
frame,
|
|
5667
5672
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
5668
5673
|
offset: { x: 0, y: 0 }
|
|
5669
5674
|
};
|
|
5670
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => (
|
|
5675
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _172 => _172[0], 'optionalAccess', _173 => _173.style]), () => ( _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE)) }];
|
|
5671
5676
|
if (m) layer.transform = m;
|
|
5672
5677
|
if (r.orientation === "vertical") layer.orientation = "vertical";
|
|
5673
5678
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
@@ -5676,8 +5681,8 @@ function readType(r, base, ctx) {
|
|
|
5676
5681
|
if (r.annotation && typeof r.annotation === "object" && r.annotation.type === "text") layer.annotation = JSON.parse(JSON.stringify({ ...r.annotation, id: _nullishCoalesce(r.annotation.id, () => ( base.id)) }));
|
|
5677
5682
|
if (r.psd && typeof r.psd === "object") {
|
|
5678
5683
|
const psd = {};
|
|
5679
|
-
if (typeof r.psd.tySh === "string") psd.tySh =
|
|
5680
|
-
if (Array.isArray(r.psd.blocks)) psd.blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data:
|
|
5684
|
+
if (typeof r.psd.tySh === "string") psd.tySh = _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, r.psd.tySh);
|
|
5685
|
+
if (Array.isArray(r.psd.blocks)) psd.blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, b.data) }));
|
|
5681
5686
|
if (typeof r.psd.signature === "string") psd.signature = r.psd.signature;
|
|
5682
5687
|
if (psd.tySh || _optionalChain([psd, 'access', _174 => _174.blocks, 'optionalAccess', _175 => _175.length])) layer.psd = psd;
|
|
5683
5688
|
}
|
|
@@ -5705,7 +5710,7 @@ function serializeShape(layer, base) {
|
|
|
5705
5710
|
if (layer.inverted) out.inverted = true;
|
|
5706
5711
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5707
5712
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5708
|
-
if (_optionalChain([layer, 'access', _180 => _180.psd, 'optionalAccess', _181 => _181.blocks, 'optionalAccess', _182 => _182.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data:
|
|
5713
|
+
if (_optionalChain([layer, 'access', _180 => _180.psd, 'optionalAccess', _181 => _181.blocks, 'optionalAccess', _182 => _182.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
|
|
5709
5714
|
return out;
|
|
5710
5715
|
}
|
|
5711
5716
|
function readShape(r, base, ctx) {
|
|
@@ -5737,7 +5742,7 @@ function readShape(r, base, ctx) {
|
|
|
5737
5742
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) out.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
|
|
5738
5743
|
if (a && shapeFromAnnotation(a)) out.annotation = a;
|
|
5739
5744
|
if (r.psd && Array.isArray(r.psd.blocks)) {
|
|
5740
|
-
const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data:
|
|
5745
|
+
const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, b.data) }));
|
|
5741
5746
|
if (blocks.length) out.psd = { blocks };
|
|
5742
5747
|
if (out.psd && typeof r.psd.signature === "string") out.psd.signature = r.psd.signature;
|
|
5743
5748
|
}
|
|
@@ -5750,7 +5755,7 @@ function readShape(r, base, ctx) {
|
|
|
5750
5755
|
function serializeSmartFilters(stack, layerId, ctx) {
|
|
5751
5756
|
const out = {
|
|
5752
5757
|
enabled: stack.enabled,
|
|
5753
|
-
filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data:
|
|
5758
|
+
filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, f.data) } : JSON.parse(JSON.stringify(f)))
|
|
5754
5759
|
};
|
|
5755
5760
|
if (stack.mask) out.mask = serializeMask(stack.mask, `${layerId}-filter-mask`, ctx);
|
|
5756
5761
|
return out;
|
|
@@ -5776,7 +5781,7 @@ function serializeSmartObject(layer, base, ctx) {
|
|
|
5776
5781
|
}
|
|
5777
5782
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5778
5783
|
if (layer.psd) {
|
|
5779
|
-
out.psd = { key: layer.psd.key, data:
|
|
5784
|
+
out.psd = { key: layer.psd.key, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, layer.psd.data) };
|
|
5780
5785
|
if (layer.psd.placed) out.psd.placed = layer.psd.placed;
|
|
5781
5786
|
}
|
|
5782
5787
|
return out;
|
|
@@ -5788,7 +5793,7 @@ function serializeContents(c, ctx) {
|
|
|
5788
5793
|
if (enc) {
|
|
5789
5794
|
if (enc.x !== 0 || enc.y !== 0) {
|
|
5790
5795
|
const data = _chunk474IQG74cjs.readRegion.call(void 0, c.raster, { x: 0, y: 0, width: c.width, height: c.height });
|
|
5791
|
-
out.asset = ctx.addAsset(
|
|
5796
|
+
out.asset = ctx.addAsset(_chunkW5M3J7PVcjs.pngDataUrl.call(void 0, c.width, c.height, data, 4), `contents-${c.id}`);
|
|
5792
5797
|
} else out.asset = ctx.addAsset(enc.url, `contents-${c.id}`);
|
|
5793
5798
|
}
|
|
5794
5799
|
}
|
|
@@ -5797,7 +5802,7 @@ function serializeContents(c, ctx) {
|
|
|
5797
5802
|
if (c.document.globalLight) out.globalLight = { ...c.document.globalLight };
|
|
5798
5803
|
if (_optionalChain([c, 'access', _187 => _187.document, 'access', _188 => _188.patterns, 'optionalAccess', _189 => _189.length])) out.patterns = serializePatterns(c.document.patterns);
|
|
5799
5804
|
}
|
|
5800
|
-
if (c.file) out.file = { type: c.file.type, data:
|
|
5805
|
+
if (c.file) out.file = { type: c.file.type, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, c.file.bytes) };
|
|
5801
5806
|
if (c.linked) out.linked = { path: c.linked.path };
|
|
5802
5807
|
return out;
|
|
5803
5808
|
}
|
|
@@ -5833,7 +5838,7 @@ async function serializeLayersExternal(layers, store) {
|
|
|
5833
5838
|
for (const [id, url] of Object.entries(inline.assets)) {
|
|
5834
5839
|
let ref = refs.get(url);
|
|
5835
5840
|
if (!ref) {
|
|
5836
|
-
const parsed =
|
|
5841
|
+
const parsed = _chunkW5M3J7PVcjs.parseDataUrl.call(void 0, url);
|
|
5837
5842
|
const png = decodePngHeader(parsed.bytes);
|
|
5838
5843
|
ref = await store.put(new Blob([parsed.bytes], { type: "image/png" }), { id, width: png.width, height: png.height });
|
|
5839
5844
|
if (typeof ref !== "string" || !ref) throw new Error(`The asset store returned no reference for "${id}".`);
|
|
@@ -5861,7 +5866,7 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
5861
5866
|
try {
|
|
5862
5867
|
const blob = await store.get(ref);
|
|
5863
5868
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
5864
|
-
out[id] = `data:image/png;base64,${
|
|
5869
|
+
out[id] = `data:image/png;base64,${_chunkW5M3J7PVcjs.bytesToBase64.call(void 0, bytes)}`;
|
|
5865
5870
|
} catch (err) {
|
|
5866
5871
|
problems.push(`Asset "${id}" (${ref}) could not be fetched: ${err.message}`);
|
|
5867
5872
|
}
|
|
@@ -5869,9 +5874,9 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
5869
5874
|
return out;
|
|
5870
5875
|
}
|
|
5871
5876
|
function decodePngDataUrl(url, channels) {
|
|
5872
|
-
const parsed =
|
|
5877
|
+
const parsed = _chunkW5M3J7PVcjs.parseDataUrl.call(void 0, url);
|
|
5873
5878
|
if (!parsed) throw new Error("Asset is not a data URL.");
|
|
5874
|
-
const png =
|
|
5879
|
+
const png = _chunkW5M3J7PVcjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
|
|
5875
5880
|
if (png.channels === channels) return png;
|
|
5876
5881
|
if (channels === 1) {
|
|
5877
5882
|
const out2 = new Uint8ClampedArray(png.width * png.height);
|
|
@@ -5957,7 +5962,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5957
5962
|
name: typeof r.name === "string" ? r.name : "",
|
|
5958
5963
|
visible: r.visible !== false,
|
|
5959
5964
|
opacity: num2(r.opacity, 0, 1, 1),
|
|
5960
|
-
blend:
|
|
5965
|
+
blend: _chunk2VX55NFMcjs.normalizeBlendMode.call(void 0, r.blend)
|
|
5961
5966
|
};
|
|
5962
5967
|
if (r.clipped === true) base.clipped = true;
|
|
5963
5968
|
const edge = readEdgeColor(r.edge);
|
|
@@ -6012,7 +6017,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
6012
6017
|
}
|
|
6013
6018
|
case "group": {
|
|
6014
6019
|
const children = Array.isArray(r.children) ? r.children.map((c) => deserializeLayer(c, ctx)).filter(Boolean) : [];
|
|
6015
|
-
const blend = r.blend === "pass-through" ? "pass-through" :
|
|
6020
|
+
const blend = r.blend === "pass-through" ? "pass-through" : _chunk2VX55NFMcjs.isBlendMode.call(void 0, r.blend) ? r.blend : "pass-through";
|
|
6016
6021
|
const group = { ...base, type: "group", blend, children };
|
|
6017
6022
|
if (r.collapsed === true) group.collapsed = true;
|
|
6018
6023
|
return group;
|
|
@@ -6064,7 +6069,7 @@ function readContents(id, ctx) {
|
|
|
6064
6069
|
const c = { id, name: typeof raw.name === "string" ? raw.name : "Contents", width, height, kind: raw.kind === "document" ? "document" : "raster" };
|
|
6065
6070
|
if (raw.file && typeof raw.file.type === "string" && typeof raw.file.data === "string") {
|
|
6066
6071
|
try {
|
|
6067
|
-
c.file = { type: raw.file.type, bytes:
|
|
6072
|
+
c.file = { type: raw.file.type, bytes: _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, raw.file.data) };
|
|
6068
6073
|
} catch (e9) {
|
|
6069
6074
|
ctx.problems.push(`Smart object contents "${c.name}": the embedded file could not be read`);
|
|
6070
6075
|
}
|
|
@@ -6104,11 +6109,11 @@ function readSmartFilters(raw, ctx, what) {
|
|
|
6104
6109
|
let k = 0;
|
|
6105
6110
|
for (const f of list2) {
|
|
6106
6111
|
if (!f || typeof f !== "object") continue;
|
|
6107
|
-
const blend =
|
|
6112
|
+
const blend = _chunk2VX55NFMcjs.isBlendMode.call(void 0, f.blend) && f.blend !== "pigment" ? f.blend : "normal";
|
|
6108
6113
|
const opacity = num2(f.opacity, 0, 1, 1);
|
|
6109
6114
|
if (f.kind === "psd") {
|
|
6110
6115
|
try {
|
|
6111
|
-
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:
|
|
6116
|
+
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: _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, String(_nullishCoalesce(f.data, () => ( "")))), blend, opacity });
|
|
6112
6117
|
} catch (e10) {
|
|
6113
6118
|
ctx.problems.push(`${what}: a Photoshop smart filter could not be read`);
|
|
6114
6119
|
}
|
|
@@ -6137,8 +6142,8 @@ function readSmartObject(r, base, ctx) {
|
|
|
6137
6142
|
let placement;
|
|
6138
6143
|
try {
|
|
6139
6144
|
const raw = { corners: p.corners };
|
|
6140
|
-
if (p.warp &&
|
|
6141
|
-
if (
|
|
6145
|
+
if (p.warp && _chunkIOFVM3L3cjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6146
|
+
if (_chunkDPYAO5U6cjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6142
6147
|
placement = normalizePlacement(raw, contents);
|
|
6143
6148
|
} catch (e) {
|
|
6144
6149
|
ctx.problems.push(`${what}: its placement is invalid (${e instanceof Error ? e.message : String(e)}); it was placed at the top left`);
|
|
@@ -6150,7 +6155,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6150
6155
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
|
|
6151
6156
|
if (r.psd && typeof r.psd.key === "string" && typeof r.psd.data === "string") {
|
|
6152
6157
|
try {
|
|
6153
|
-
layer.psd = { key: r.psd.key, data:
|
|
6158
|
+
layer.psd = { key: r.psd.key, data: _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, r.psd.data) };
|
|
6154
6159
|
if (typeof r.psd.placed === "string") layer.psd.placed = r.psd.placed;
|
|
6155
6160
|
} catch (e11) {
|
|
6156
6161
|
}
|
|
@@ -7308,7 +7313,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
7308
7313
|
const fr = (p) => ({ x: p.x / w, y: p.y / h });
|
|
7309
7314
|
const subpaths = [];
|
|
7310
7315
|
components.forEach((c, ci) => {
|
|
7311
|
-
|
|
7316
|
+
_chunkIOFVM3L3cjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
|
|
7312
7317
|
if (!sp.anchors.length) return;
|
|
7313
7318
|
subpaths.push({
|
|
7314
7319
|
closed: sp.closed,
|
|
@@ -8134,7 +8139,7 @@ function merged(levels) {
|
|
|
8134
8139
|
function charStyle(d, fonts, notes, vertical = false) {
|
|
8135
8140
|
const n = (k) => eNum(eGet(d, k));
|
|
8136
8141
|
const flag = (k) => eBool(eGet(d, k));
|
|
8137
|
-
const s = { ...
|
|
8142
|
+
const s = { ..._chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE };
|
|
8138
8143
|
const fi = n("Font");
|
|
8139
8144
|
const ps = fi !== void 0 ? fonts[fi] : void 0;
|
|
8140
8145
|
if (ps) {
|
|
@@ -8219,7 +8224,7 @@ function typeFromTySh(data, notes) {
|
|
|
8219
8224
|
}
|
|
8220
8225
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
8221
8226
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
8222
|
-
let runs = [{ length: text3.length, style: { ...
|
|
8227
|
+
let runs = [{ length: text3.length, style: { ..._chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE } }];
|
|
8223
8228
|
let paragraphs = [{ length: text3.length, style: {} }];
|
|
8224
8229
|
let frame = { kind: "point" };
|
|
8225
8230
|
let transform = t.transform;
|
|
@@ -8275,14 +8280,14 @@ function typeFromTySh(data, notes) {
|
|
|
8275
8280
|
const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
|
|
8276
8281
|
if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
|
|
8277
8282
|
frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
|
|
8278
|
-
transform =
|
|
8283
|
+
transform = _chunkIOFVM3L3cjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
|
|
8279
8284
|
}
|
|
8280
8285
|
}
|
|
8281
8286
|
}
|
|
8282
8287
|
return {
|
|
8283
8288
|
text: text3,
|
|
8284
|
-
runs:
|
|
8285
|
-
paragraphs:
|
|
8289
|
+
runs: _chunkIOFVM3L3cjs.fitRuns.call(void 0, runs, text3.length, _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE),
|
|
8290
|
+
paragraphs: _chunkIOFVM3L3cjs.fitParagraphRuns.call(void 0, paragraphs, text3),
|
|
8286
8291
|
frame,
|
|
8287
8292
|
orientation: vertical ? "vertical" : "horizontal",
|
|
8288
8293
|
transform,
|
|
@@ -8358,7 +8363,7 @@ function buildEngineData(layer, template) {
|
|
|
8358
8363
|
fonts.push(ps);
|
|
8359
8364
|
return fonts.length - 1;
|
|
8360
8365
|
};
|
|
8361
|
-
const runs =
|
|
8366
|
+
const runs = _chunkIOFVM3L3cjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE);
|
|
8362
8367
|
const vertical = layer.orientation === "vertical";
|
|
8363
8368
|
const sruns = [];
|
|
8364
8369
|
const slens = [];
|
|
@@ -8367,10 +8372,10 @@ function buildEngineData(layer, template) {
|
|
|
8367
8372
|
slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
|
|
8368
8373
|
});
|
|
8369
8374
|
if (!runs.length) {
|
|
8370
|
-
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(
|
|
8375
|
+
sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE)))]])]]));
|
|
8371
8376
|
slens.push(E.int(1));
|
|
8372
8377
|
}
|
|
8373
|
-
const paras =
|
|
8378
|
+
const paras = _chunkIOFVM3L3cjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
|
|
8374
8379
|
const pruns = [];
|
|
8375
8380
|
const plens = [];
|
|
8376
8381
|
paras.forEach((p, i) => {
|
|
@@ -8426,7 +8431,7 @@ function buildEngineData(layer, template) {
|
|
|
8426
8431
|
eSet(e, key, rd);
|
|
8427
8432
|
}
|
|
8428
8433
|
eSet(rd, "FontSet", fontSet);
|
|
8429
|
-
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _248 => _248[0], 'optionalAccess', _249 => _249.style]), () => (
|
|
8434
|
+
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _248 => _248[0], 'optionalAccess', _249 => _249.style]), () => ( _chunkIOFVM3L3cjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8430
8435
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8431
8436
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8432
8437
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8437,13 +8442,13 @@ function inkBounds2(layer) {
|
|
|
8437
8442
|
if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
|
|
8438
8443
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
8439
8444
|
if (!b) return [0, 0, 0, 0];
|
|
8440
|
-
const inv =
|
|
8445
|
+
const inv = _chunkIOFVM3L3cjs.invertMatrix.call(void 0, textMatrix(layer));
|
|
8441
8446
|
const pts = [
|
|
8442
8447
|
{ x: b.x, y: b.y },
|
|
8443
8448
|
{ x: b.x + b.width, y: b.y },
|
|
8444
8449
|
{ x: b.x + b.width, y: b.y + b.height },
|
|
8445
8450
|
{ x: b.x, y: b.y + b.height }
|
|
8446
|
-
].map((p) =>
|
|
8451
|
+
].map((p) => _chunkIOFVM3L3cjs.applyMatrix.call(void 0, inv, p));
|
|
8447
8452
|
return [Math.min(...pts.map((p) => p.x)), Math.min(...pts.map((p) => p.y)), Math.max(...pts.map((p) => p.x)), Math.max(...pts.map((p) => p.y))];
|
|
8448
8453
|
}
|
|
8449
8454
|
function tyShForLayer(layer) {
|
|
@@ -8724,7 +8729,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8724
8729
|
var warpStyleOf = (name) => {
|
|
8725
8730
|
if (!name.startsWith("warp")) return null;
|
|
8726
8731
|
const s = _optionalChain([name, 'access', _263 => _263[4], 'optionalAccess', _264 => _264.toLowerCase, 'call', _265 => _265()]) + name.slice(5);
|
|
8727
|
-
return
|
|
8732
|
+
return _chunkIOFVM3L3cjs.WARP_STYLES.includes(s) ? s : null;
|
|
8728
8733
|
};
|
|
8729
8734
|
function warpFromDescriptor(w, contents) {
|
|
8730
8735
|
const full = { x: 0, y: 0, width: contents.width, height: contents.height };
|
|
@@ -8754,7 +8759,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8754
8759
|
} else {
|
|
8755
8760
|
const style = warpStyleOf(styleName);
|
|
8756
8761
|
if (!style) return void 0;
|
|
8757
|
-
mesh =
|
|
8762
|
+
mesh = _chunkIOFVM3L3cjs.warpPresetMesh.call(void 0,
|
|
8758
8763
|
{
|
|
8759
8764
|
style,
|
|
8760
8765
|
bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
|
|
@@ -8769,7 +8774,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8769
8774
|
const same = Math.abs(bounds.x) < 1e-6 && Math.abs(bounds.y) < 1e-6 && Math.abs(bounds.width - contents.width) < 1e-6 && Math.abs(bounds.height - contents.height) < 1e-6;
|
|
8770
8775
|
if (!same) {
|
|
8771
8776
|
const m = mesh;
|
|
8772
|
-
mesh =
|
|
8777
|
+
mesh = _chunkIOFVM3L3cjs.fitWarpMesh.call(void 0, (s, t) => _chunkIOFVM3L3cjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
|
|
8773
8778
|
}
|
|
8774
8779
|
return { mesh, frame };
|
|
8775
8780
|
}
|
|
@@ -10017,7 +10022,7 @@ function recordPixels(ctx, rec, name) {
|
|
|
10017
10022
|
cmykToRgb16: ctx.cmykToRgb16
|
|
10018
10023
|
};
|
|
10019
10024
|
const deep = set.cmykToRgb && !set.cmykToRgb16 ? null : toRgbaDeep(set);
|
|
10020
|
-
if (deep) return
|
|
10025
|
+
if (deep) return _chunk2VX55NFMcjs.surfaceFromDeepPixels.call(void 0, { width, height, data: deep }, 4, rec.rect.left, rec.rect.top);
|
|
10021
10026
|
return _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width, height, data: toRgba8(set) }, 4, rec.rect.left, rec.rect.top);
|
|
10022
10027
|
}
|
|
10023
10028
|
function recordMask(ctx, rec, name) {
|
|
@@ -10034,7 +10039,7 @@ function recordMask(ctx, rec, name) {
|
|
|
10034
10039
|
if (width && height && !ctx.skipPixels) {
|
|
10035
10040
|
const plane = decodeOr(ctx, rec, id, name);
|
|
10036
10041
|
const depth = ctx.file.header.depth;
|
|
10037
|
-
if (plane && (depth === 16 || depth === 32)) surface =
|
|
10042
|
+
if (plane && (depth === 16 || depth === 32)) surface = _chunk2VX55NFMcjs.surfaceFromDeepPixels.call(void 0, { width, height, data: toMaskDeep(plane, width, height, depth) }, 1, rect.left, rect.top, def);
|
|
10038
10043
|
else if (plane) surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width, height, data: toMask8(plane, width, height, depth) }, 1, rect.left, rect.top, def);
|
|
10039
10044
|
}
|
|
10040
10045
|
const mask = { surface, defaultValue: def };
|
|
@@ -10108,7 +10113,7 @@ function recordEffects(ctx, rec, name, notes, group) {
|
|
|
10108
10113
|
}
|
|
10109
10114
|
for (const e of parsed.effects.items) {
|
|
10110
10115
|
for (const id of patternIds(e)) {
|
|
10111
|
-
if (ctx.patterns.has(id) ||
|
|
10116
|
+
if (ctx.patterns.has(id) || _chunkDPYAO5U6cjs.builtinPattern.call(void 0, id)) continue;
|
|
10112
10117
|
ctx.warn.add("A pattern effect uses a pattern the file does not contain, and paints nothing", name);
|
|
10113
10118
|
notes.push(`pattern "${id}" is not in the file`);
|
|
10114
10119
|
}
|
|
@@ -10319,7 +10324,7 @@ function contentsFor(ctx, placed, name, notes) {
|
|
|
10319
10324
|
document: { layers: nested.layers, globalLight: nested.globalLight, patterns: nested.patterns.length ? nested.patterns : void 0 }
|
|
10320
10325
|
};
|
|
10321
10326
|
} else if (t.ext === "png") {
|
|
10322
|
-
const png =
|
|
10327
|
+
const png = _chunkW5M3J7PVcjs.decodePng.call(void 0, file.bytes);
|
|
10323
10328
|
out = { ...base, kind: "raster", width: png.width, height: png.height, raster: _chunk474IQG74cjs.surfaceFromPixels.call(void 0, png, 4, 0, 0) };
|
|
10324
10329
|
} else {
|
|
10325
10330
|
const size = _nullishCoalesce(placed.size, () => ( { width: 0, height: 0 }));
|
|
@@ -10361,7 +10366,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10361
10366
|
if (placement && (size.width !== contents.width || size.height !== contents.height)) {
|
|
10362
10367
|
const kx = contents.width / size.width;
|
|
10363
10368
|
const ky = contents.height / size.height;
|
|
10364
|
-
if (placement.warp) placement = { ...placement, warp:
|
|
10369
|
+
if (placement.warp) placement = { ...placement, warp: _chunkIOFVM3L3cjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
|
|
10365
10370
|
}
|
|
10366
10371
|
}
|
|
10367
10372
|
if (!contents || !placement) {
|
|
@@ -10445,7 +10450,7 @@ function mergedLayer(ctx) {
|
|
|
10445
10450
|
};
|
|
10446
10451
|
const deep = hasAlpha || set.cmykToRgb && !set.cmykToRgb16 ? null : toRgbaDeep(set);
|
|
10447
10452
|
let surface;
|
|
10448
|
-
if (deep) surface =
|
|
10453
|
+
if (deep) surface = _chunk2VX55NFMcjs.surfaceFromDeepPixels.call(void 0, { width, height, data: deep }, 4);
|
|
10449
10454
|
else {
|
|
10450
10455
|
const data = toRgba8(set);
|
|
10451
10456
|
if (hasAlpha) unmatteWhite(data);
|
|
@@ -10686,34 +10691,34 @@ function blendOf(d, key, fallback, notes) {
|
|
|
10686
10691
|
function colorOf(d, fallback = "#000000") {
|
|
10687
10692
|
if (!d) return fallback;
|
|
10688
10693
|
const g = (k) => descNumber(d, k);
|
|
10689
|
-
if (g("redFloat") !== void 0) return
|
|
10694
|
+
if (g("redFloat") !== void 0) return _chunkDPYAO5U6cjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
|
|
10690
10695
|
switch (d.classId) {
|
|
10691
10696
|
case "HSBC": {
|
|
10692
10697
|
const rgb = decodePsdColor(1, [(_nullishCoalesce(g("H "), () => ( 0))) / 360 * 65535, (_nullishCoalesce(g("Strt"), () => ( 0))) / 100 * 65535, (_nullishCoalesce(g("Brgh"), () => ( 0))) / 100 * 65535]);
|
|
10693
|
-
return rgb ?
|
|
10698
|
+
return rgb ? _chunkDPYAO5U6cjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10694
10699
|
}
|
|
10695
10700
|
case "CMYC": {
|
|
10696
10701
|
const inv = (k) => (1 - (_nullishCoalesce(g(k), () => ( 0))) / 100) * 65535;
|
|
10697
10702
|
const rgb = decodePsdColor(2, [inv("Cyn "), inv("Mgnt"), inv("Ylw "), inv("Blck")]);
|
|
10698
|
-
return rgb ?
|
|
10703
|
+
return rgb ? _chunkDPYAO5U6cjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10699
10704
|
}
|
|
10700
10705
|
case "LbCl": {
|
|
10701
10706
|
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]);
|
|
10702
|
-
return rgb ?
|
|
10707
|
+
return rgb ? _chunkDPYAO5U6cjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10703
10708
|
}
|
|
10704
10709
|
case "Grsc": {
|
|
10705
10710
|
const v = 1 - (_nullishCoalesce(g("Gry "), () => ( 0))) / 100;
|
|
10706
|
-
return
|
|
10711
|
+
return _chunkDPYAO5U6cjs.effectColorHex.call(void 0, [v, v, v]);
|
|
10707
10712
|
}
|
|
10708
10713
|
}
|
|
10709
10714
|
const r = g("Rd ");
|
|
10710
10715
|
const gr = g("Grn ");
|
|
10711
10716
|
const b = g("Bl ");
|
|
10712
10717
|
if (r === void 0 || gr === void 0 || b === void 0) return fallback;
|
|
10713
|
-
return
|
|
10718
|
+
return _chunkDPYAO5U6cjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
|
|
10714
10719
|
}
|
|
10715
10720
|
function colorDesc(hex) {
|
|
10716
|
-
const [r, g, b] = _nullishCoalesce(
|
|
10721
|
+
const [r, g, b] = _nullishCoalesce(_chunkDPYAO5U6cjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
|
|
10717
10722
|
return descriptor("RGBC", [
|
|
10718
10723
|
["Rd ", dbl3(r * 255)],
|
|
10719
10724
|
["Grn ", dbl3(g * 255)],
|
|
@@ -10796,9 +10801,9 @@ function gradientOf(d, notes) {
|
|
|
10796
10801
|
raw.forEach((s, i) => {
|
|
10797
10802
|
if (i > 0 && Math.abs(s.mid - 0.5) > 1e-3) {
|
|
10798
10803
|
const a = raw[i - 1];
|
|
10799
|
-
const ca =
|
|
10800
|
-
const cb =
|
|
10801
|
-
stops.push({ position: a.position + (s.position - a.position) * s.mid, color:
|
|
10804
|
+
const ca = _chunkDPYAO5U6cjs.parseEffectColor.call(void 0, a.color);
|
|
10805
|
+
const cb = _chunkDPYAO5U6cjs.parseEffectColor.call(void 0, s.color);
|
|
10806
|
+
stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkDPYAO5U6cjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
|
|
10802
10807
|
notes.add("gradient midpoints are drawn as straight segments");
|
|
10803
10808
|
}
|
|
10804
10809
|
stops.push({ position: s.position, color: s.color });
|
|
@@ -10910,8 +10915,8 @@ var KINDS = [
|
|
|
10910
10915
|
["FrFX", "frameFXMulti", "stroke"]
|
|
10911
10916
|
];
|
|
10912
10917
|
function common(d, kind, notes) {
|
|
10913
|
-
const def =
|
|
10914
|
-
return { id:
|
|
10918
|
+
const def = _chunkDPYAO5U6cjs.defaultLayerEffect.call(void 0, kind, "x");
|
|
10919
|
+
return { id: _chunkDPYAO5U6cjs.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) };
|
|
10915
10920
|
}
|
|
10916
10921
|
function readOne(kind, d, notes) {
|
|
10917
10922
|
const size = (key, fallback) => clamp3(num3(d, key, fallback), 0, 250);
|
|
@@ -10954,7 +10959,7 @@ function readOne(kind, d, notes) {
|
|
|
10954
10959
|
case "bevel-emboss": {
|
|
10955
10960
|
const styles = { OtrB: "outer-bevel", InrB: "inner-bevel", Embs: "emboss", PlEb: "pillow-emboss", strokeEmboss: "stroke-emboss" };
|
|
10956
10961
|
const out = {
|
|
10957
|
-
id:
|
|
10962
|
+
id: _chunkDPYAO5U6cjs.newEffectId.call(void 0, ),
|
|
10958
10963
|
enabled: descBool(d, "enab") !== false,
|
|
10959
10964
|
kind,
|
|
10960
10965
|
style: _nullishCoalesce(styles[_nullishCoalesce(enumOf3(d, "bvlS"), () => ( ""))], () => ( "inner-bevel")),
|
|
@@ -11165,10 +11170,10 @@ function writeLfx2(effects) {
|
|
|
11165
11170
|
["Scl ", unit3("#Prc", 100)],
|
|
11166
11171
|
["masterFXSwitch", boolV3(effects.enabled)]
|
|
11167
11172
|
];
|
|
11168
|
-
const scale =
|
|
11173
|
+
const scale = _chunkDPYAO5U6cjs.effectsScale.call(void 0, effects);
|
|
11169
11174
|
let dropped = 0;
|
|
11170
11175
|
for (const [single, multi, kind] of KINDS) {
|
|
11171
|
-
const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(
|
|
11176
|
+
const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkDPYAO5U6cjs.scaleLayerEffect.call(void 0, e, scale)));
|
|
11172
11177
|
if (!of.length) continue;
|
|
11173
11178
|
if (of.length === 1) items.push([single, obj3(of[0])]);
|
|
11174
11179
|
else if (multi) items.push([multi, { type: "VlLs", items: of.map(obj3) }]);
|
|
@@ -11200,7 +11205,7 @@ function parseLrfx(data) {
|
|
|
11200
11205
|
const colorAt = (rd) => {
|
|
11201
11206
|
rd.u16();
|
|
11202
11207
|
const c = [rd.u16(), rd.u16(), rd.u16(), rd.u16()];
|
|
11203
|
-
return
|
|
11208
|
+
return _chunkDPYAO5U6cjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
|
|
11204
11209
|
};
|
|
11205
11210
|
const blendAt = (rd) => {
|
|
11206
11211
|
rd.skip(4);
|
|
@@ -11219,7 +11224,7 @@ function parseLrfx(data) {
|
|
|
11219
11224
|
const enabled = b.u8() !== 0;
|
|
11220
11225
|
const useGlobalLight = b.u8() !== 0;
|
|
11221
11226
|
const opacity = b.u8() / 255;
|
|
11222
|
-
const base = { id:
|
|
11227
|
+
const base = { id: _chunkDPYAO5U6cjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
|
|
11223
11228
|
items.push(key === "dsdw" ? { ...base, kind: "drop-shadow", spread: 0, knocksOut: true } : { ...base, kind: "inner-shadow", choke: 0 });
|
|
11224
11229
|
} else if (key === "oglw" || key === "iglw") {
|
|
11225
11230
|
b.u32();
|
|
@@ -11229,7 +11234,7 @@ function parseLrfx(data) {
|
|
|
11229
11234
|
const blend = blendAt(b);
|
|
11230
11235
|
const enabled = b.u8() !== 0;
|
|
11231
11236
|
const opacity = b.u8() / 255;
|
|
11232
|
-
const base = { id:
|
|
11237
|
+
const base = { id: _chunkDPYAO5U6cjs.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 };
|
|
11233
11238
|
items.push(key === "oglw" ? { ...base, kind: "outer-glow", spread: 0 } : { ...base, kind: "inner-glow", choke: 0, source: "edge" });
|
|
11234
11239
|
} else if (key === "sofi") {
|
|
11235
11240
|
b.u32();
|
|
@@ -11237,7 +11242,7 @@ function parseLrfx(data) {
|
|
|
11237
11242
|
const color = colorAt(b);
|
|
11238
11243
|
const opacity = b.u8() / 255;
|
|
11239
11244
|
const enabled = b.u8() !== 0;
|
|
11240
|
-
items.push({ id:
|
|
11245
|
+
items.push({ id: _chunkDPYAO5U6cjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
|
|
11241
11246
|
} else if (key === "bevl") notes.add("legacy bevels are not read");
|
|
11242
11247
|
}
|
|
11243
11248
|
return { effects: { enabled: true, items }, notes: [...notes] };
|
|
@@ -11289,7 +11294,7 @@ function rleChannel(id, plane, width, height, psb, depth = 8) {
|
|
|
11289
11294
|
function surfacePlanes(surface, bounds, depth) {
|
|
11290
11295
|
const n = bounds.width * bounds.height;
|
|
11291
11296
|
if (depth === 8) return rgbaToPlanes(_chunk474IQG74cjs.readRegion.call(void 0, surface, bounds), n);
|
|
11292
|
-
return deepToPlanes(
|
|
11297
|
+
return deepToPlanes(_chunk2VX55NFMcjs.readDeepRegion.call(void 0, surface, bounds, depth), n);
|
|
11293
11298
|
}
|
|
11294
11299
|
var emptyChannel = (id) => ({ id, compression: 0, data: new Uint8Array(0) });
|
|
11295
11300
|
function maskChannel(mask, ox, oy, psb, depth = 8) {
|
|
@@ -11303,7 +11308,7 @@ function maskChannel(mask, ox, oy, psb, depth = 8) {
|
|
|
11303
11308
|
if (!bounds) return { channel: emptyChannel(CHANNEL_USER_MASK), mask: m };
|
|
11304
11309
|
m.rect = toRect({ ...bounds, x: bounds.x + ox, y: bounds.y + oy });
|
|
11305
11310
|
let bytes;
|
|
11306
|
-
if (depth !== 8 &&
|
|
11311
|
+
if (depth !== 8 && _chunk2VX55NFMcjs.surfaceDepth.call(void 0, mask.surface) !== 8) bytes = deepMaskPlane(_chunk2VX55NFMcjs.readDeepRegion.call(void 0, mask.surface, bounds, depth));
|
|
11307
11312
|
else {
|
|
11308
11313
|
const plane = _chunk474IQG74cjs.readRegion.call(void 0, mask.surface, bounds);
|
|
11309
11314
|
bytes = planeAtDepth(new Uint8Array(plane.buffer, plane.byteOffset, plane.length), depth);
|
|
@@ -11353,7 +11358,7 @@ function smartContentsFile(c) {
|
|
|
11353
11358
|
if (c.file) return { name: c.name, bytes: c.file.bytes };
|
|
11354
11359
|
if (c.kind === "raster") {
|
|
11355
11360
|
const data = _chunk474IQG74cjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
|
|
11356
|
-
return { name: `${base}.png`, bytes:
|
|
11361
|
+
return { name: `${base}.png`, bytes: _chunkW5M3J7PVcjs.encodePng.call(void 0, c.width, c.height, data) };
|
|
11357
11362
|
}
|
|
11358
11363
|
const doc = c.document;
|
|
11359
11364
|
const merged2 = _chunk474IQG74cjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
|
|
@@ -11403,7 +11408,7 @@ function exportPsd(input) {
|
|
|
11403
11408
|
const surfaceChannels = (surface, bounds) => {
|
|
11404
11409
|
if (mode !== "rgb" && depth === 16) {
|
|
11405
11410
|
const n2 = bounds.width * bounds.height;
|
|
11406
|
-
const s =
|
|
11411
|
+
const s = _chunk2VX55NFMcjs.readDeepRegion.call(void 0, surface, bounds, 16);
|
|
11407
11412
|
const alpha = new Uint16Array(n2);
|
|
11408
11413
|
for (let i = 0; i < n2; i++) alpha[i] = s[i * 4 + 3];
|
|
11409
11414
|
const planes2 = [alpha, ...input.colorPlanes16(s, n2)];
|
|
@@ -11430,7 +11435,7 @@ function exportPsd(input) {
|
|
|
11430
11435
|
const key = layer.type === "group" ? "lfxs" : "lfx2";
|
|
11431
11436
|
if (fx.psd) {
|
|
11432
11437
|
const original = parseLfx2(fx.psd.data);
|
|
11433
|
-
if (original ?
|
|
11438
|
+
if (original ? _chunkDPYAO5U6cjs.effectsFingerprint.call(void 0, original.effects) === _chunkDPYAO5U6cjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
|
|
11434
11439
|
}
|
|
11435
11440
|
if (!fx.items.length && fx.enabled && (_nullishCoalesce(fx.scale, () => ( 1))) === 1) return null;
|
|
11436
11441
|
const { data, dropped } = writeLfx2(fx);
|
|
@@ -11682,7 +11687,7 @@ function exportPsd(input) {
|
|
|
11682
11687
|
const byId = new Map((_nullishCoalesce(input.patterns, () => ( []))).map((p) => [p.id, p]));
|
|
11683
11688
|
const embed = [];
|
|
11684
11689
|
for (const id of patternIds2) {
|
|
11685
|
-
const p = _nullishCoalesce(byId.get(id), () => (
|
|
11690
|
+
const p = _nullishCoalesce(byId.get(id), () => ( _chunkDPYAO5U6cjs.builtinPattern.call(void 0, id)));
|
|
11686
11691
|
if (p) embed.push(p);
|
|
11687
11692
|
else note(`Pattern "${id}" is not in the document and was not embedded`, id);
|
|
11688
11693
|
}
|
|
@@ -11723,6 +11728,358 @@ function exportPsd(input) {
|
|
|
11723
11728
|
return { bytes, psb, records: records.length, warnings };
|
|
11724
11729
|
}
|
|
11725
11730
|
|
|
11731
|
+
// src/image-editor/effect-tools.ts
|
|
11732
|
+
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11733
|
+
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
11734
|
+
var WRITE_IDEMPOTENT = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11735
|
+
var DESTRUCTIVE = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
11736
|
+
var EFFECT_ID = { type: "string", description: "Effect id from list_layer_effects or add_layer_effect." };
|
|
11737
|
+
var BLEND_IDS = _chunk2VX55NFMcjs.BLEND_MODES.map((m) => m.id).filter((id) => id !== "pigment");
|
|
11738
|
+
var DEFS = {
|
|
11739
|
+
color: { type: "string", pattern: "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$", description: "Colour as #rrggbb." },
|
|
11740
|
+
contour: {
|
|
11741
|
+
type: "object",
|
|
11742
|
+
description: "A transfer curve over the effect coverage: points { input, output } from 0 to 1 (at least 2), sorted by input. Linear is [{0,0},{1,1}].",
|
|
11743
|
+
properties: {
|
|
11744
|
+
name: { type: "string", description: 'Display name (e.g. "Cone", "Gaussian").' },
|
|
11745
|
+
points: {
|
|
11746
|
+
type: "array",
|
|
11747
|
+
minItems: 2,
|
|
11748
|
+
description: "Curve points.",
|
|
11749
|
+
items: {
|
|
11750
|
+
type: "object",
|
|
11751
|
+
properties: {
|
|
11752
|
+
input: { type: "number", minimum: 0, maximum: 1, description: "Coverage in (0..1)." },
|
|
11753
|
+
output: { type: "number", minimum: 0, maximum: 1, description: "Coverage out (0..1)." },
|
|
11754
|
+
corner: { type: "boolean", description: "Sharp corner instead of a smooth point (default false)." }
|
|
11755
|
+
},
|
|
11756
|
+
required: ["input", "output"],
|
|
11757
|
+
additionalProperties: false
|
|
11758
|
+
}
|
|
11759
|
+
}
|
|
11760
|
+
},
|
|
11761
|
+
required: ["name", "points"],
|
|
11762
|
+
additionalProperties: false
|
|
11763
|
+
},
|
|
11764
|
+
gradient: {
|
|
11765
|
+
type: "object",
|
|
11766
|
+
description: "A gradient: colour stops, optional opacity stops and its layout.",
|
|
11767
|
+
properties: {
|
|
11768
|
+
stops: {
|
|
11769
|
+
type: "array",
|
|
11770
|
+
minItems: 1,
|
|
11771
|
+
description: "Colour stops { position 0..1, color #rrggbb }.",
|
|
11772
|
+
items: {
|
|
11773
|
+
type: "object",
|
|
11774
|
+
properties: { position: { type: "number", minimum: 0, maximum: 1, description: "0..1 along the gradient." }, color: { $ref: "#/$defs/color" } },
|
|
11775
|
+
required: ["position", "color"],
|
|
11776
|
+
additionalProperties: false
|
|
11777
|
+
}
|
|
11778
|
+
},
|
|
11779
|
+
opacityStops: {
|
|
11780
|
+
type: "array",
|
|
11781
|
+
description: "Opacity stops { position 0..1, opacity 0..1 } (default opaque).",
|
|
11782
|
+
items: {
|
|
11783
|
+
type: "object",
|
|
11784
|
+
properties: {
|
|
11785
|
+
position: { type: "number", minimum: 0, maximum: 1, description: "0..1 along the gradient." },
|
|
11786
|
+
opacity: { type: "number", minimum: 0, maximum: 1, description: "0..1." }
|
|
11787
|
+
},
|
|
11788
|
+
required: ["position", "opacity"],
|
|
11789
|
+
additionalProperties: false
|
|
11790
|
+
}
|
|
11791
|
+
},
|
|
11792
|
+
style: { type: "string", enum: ["linear", "radial", "angle", "reflected", "diamond"], description: "Geometry." },
|
|
11793
|
+
angle: { type: "number", minimum: -360, maximum: 360, description: "Degrees, 90 = bottom to top." },
|
|
11794
|
+
scale: { type: "number", minimum: 0.1, maximum: 1.5, description: "1 = 100 %." },
|
|
11795
|
+
reverse: { type: "boolean", description: "Swap the ends." },
|
|
11796
|
+
align: { type: "boolean", description: "Lay out over the layer bounds (true) or the canvas." },
|
|
11797
|
+
offset: {
|
|
11798
|
+
type: "object",
|
|
11799
|
+
description: "Centre offset as fractions of the bounds.",
|
|
11800
|
+
properties: { x: { type: "number", minimum: -1, maximum: 1, description: "Fraction of the width." }, y: { type: "number", minimum: -1, maximum: 1, description: "Fraction of the height." } },
|
|
11801
|
+
required: ["x", "y"],
|
|
11802
|
+
additionalProperties: false
|
|
11803
|
+
}
|
|
11804
|
+
},
|
|
11805
|
+
required: ["stops", "style", "angle", "scale", "reverse", "align", "offset"],
|
|
11806
|
+
additionalProperties: false
|
|
11807
|
+
},
|
|
11808
|
+
phase: {
|
|
11809
|
+
type: "object",
|
|
11810
|
+
description: "Pattern origin offset in px.",
|
|
11811
|
+
properties: { x: { type: "number", description: "px." }, y: { type: "number", description: "px." } },
|
|
11812
|
+
required: ["x", "y"],
|
|
11813
|
+
additionalProperties: false
|
|
11814
|
+
},
|
|
11815
|
+
fill: {
|
|
11816
|
+
description: "What a stroke or glow paints with. Glows take color or gradient only.",
|
|
11817
|
+
anyOf: [
|
|
11818
|
+
{
|
|
11819
|
+
type: "object",
|
|
11820
|
+
properties: { type: { const: "color", description: "Solid colour." }, color: { $ref: "#/$defs/color" } },
|
|
11821
|
+
required: ["type", "color"],
|
|
11822
|
+
additionalProperties: false
|
|
11823
|
+
},
|
|
11824
|
+
{
|
|
11825
|
+
type: "object",
|
|
11826
|
+
properties: { type: { const: "gradient", description: "Gradient." }, gradient: { $ref: "#/$defs/gradient" } },
|
|
11827
|
+
required: ["type", "gradient"],
|
|
11828
|
+
additionalProperties: false
|
|
11829
|
+
},
|
|
11830
|
+
{
|
|
11831
|
+
type: "object",
|
|
11832
|
+
properties: {
|
|
11833
|
+
type: { const: "pattern", description: "Pattern (strokes only)." },
|
|
11834
|
+
patternId: { type: "string", description: "Pattern id from list_layer_effects.patterns." },
|
|
11835
|
+
name: { type: "string", description: "Display name." },
|
|
11836
|
+
scale: { type: "number", minimum: 0.01, maximum: 10, description: "1 = 100 %." },
|
|
11837
|
+
angle: { type: "number", minimum: -360, maximum: 360, description: "Rotation in degrees (default 0)." },
|
|
11838
|
+
link: { type: "boolean", description: "Tile from the layer (default true) or the canvas origin." },
|
|
11839
|
+
phase: { $ref: "#/$defs/phase" }
|
|
11840
|
+
},
|
|
11841
|
+
required: ["type", "patternId", "scale"],
|
|
11842
|
+
additionalProperties: false
|
|
11843
|
+
}
|
|
11844
|
+
]
|
|
11845
|
+
}
|
|
11846
|
+
};
|
|
11847
|
+
var nullable = (schema, description) => ({ anyOf: [schema, { type: "null" }], description });
|
|
11848
|
+
function settingsSchema(forUpdate) {
|
|
11849
|
+
const opt = (schema, description) => forUpdate ? nullable(schema, `${description} null removes it.`) : { ...schema, description };
|
|
11850
|
+
return {
|
|
11851
|
+
type: "object",
|
|
11852
|
+
description: forUpdate ? "Settings to change (only these; nested objects are replaced whole). Which settings a kind takes: see add_layer_effect." : "Settings to change from Photoshop's defaults (all optional). Unknown settings for the kind are refused with the list of its settings.",
|
|
11853
|
+
properties: {
|
|
11854
|
+
enabled: { type: "boolean", description: "All kinds: false keeps the effect but hides it (default true)." },
|
|
11855
|
+
blend: { type: "string", enum: BLEND_IDS, description: "All but bevel-emboss: blend mode (shadows multiply, glows screen, others normal)." },
|
|
11856
|
+
opacity: { type: "number", minimum: 0, maximum: 1, description: "All but bevel-emboss: 0..1 (shadows / glows 0.75, satin 0.5, others 1)." },
|
|
11857
|
+
color: { $ref: "#/$defs/color", description: "drop-shadow, inner-shadow, satin, color-overlay: #rrggbb." },
|
|
11858
|
+
angle: { type: "number", minimum: -360, maximum: 360, description: "Shadows, satin, bevel-emboss: light direction in degrees, counter-clockwise from 3 o'clock (default 120; satin 19)." },
|
|
11859
|
+
useGlobalLight: { type: "boolean", description: "Shadows, bevel-emboss: follow the document global light instead of angle (default true)." },
|
|
11860
|
+
distance: { type: "number", minimum: 0, maximum: 3e4, description: "Shadows, satin: offset in px (default 5; satin 11)." },
|
|
11861
|
+
spread: { type: "number", minimum: 0, maximum: 1, description: "drop-shadow, outer-glow: 0..1 of the size made solid (default 0)." },
|
|
11862
|
+
choke: { type: "number", minimum: 0, maximum: 1, description: "inner-shadow, inner-glow: 0..1 of the size made solid (default 0)." },
|
|
11863
|
+
size: { type: "number", minimum: 0, maximum: 250, description: "Shadows, glows, satin, bevel-emboss: blur / size in px (default 5; satin 14); stroke: width in px (default 3)." },
|
|
11864
|
+
contour: opt({ $ref: "#/$defs/contour" }, "Shadows, glows, satin: coverage contour (default linear)."),
|
|
11865
|
+
antiAlias: { type: "boolean", description: "Shadows, glows, satin: smooth the contour (default false; satin true)." },
|
|
11866
|
+
noise: { type: "number", minimum: 0, maximum: 1, description: "Shadows, glows: speckle 0..1 (default 0)." },
|
|
11867
|
+
knocksOut: { type: "boolean", description: "drop-shadow: the layer hides the shadow beneath its see-through fill (default true)." },
|
|
11868
|
+
fill: { $ref: "#/$defs/fill", description: "outer-glow, inner-glow (color or gradient), stroke (color, gradient or pattern)." },
|
|
11869
|
+
technique: { type: "string", enum: ["softer", "precise", "smooth", "chisel-hard", "chisel-soft"], description: "Glows: softer | precise (default softer); bevel-emboss: smooth | chisel-hard | chisel-soft (default smooth)." },
|
|
11870
|
+
range: { type: "number", minimum: 0.01, maximum: 1, description: "Glows: the part of the glow the contour spans (default 0.5)." },
|
|
11871
|
+
jitter: { type: "number", minimum: 0, maximum: 1, description: "Glows: gradient jitter 0..1 (stored, not rendered; default 0)." },
|
|
11872
|
+
source: { type: "string", enum: ["edge", "center"], description: "inner-glow: glow from the edge (default) or the centre." },
|
|
11873
|
+
style: { type: "string", enum: ["inner-bevel", "outer-bevel", "emboss", "pillow-emboss", "stroke-emboss"], description: "bevel-emboss: style (default inner-bevel)." },
|
|
11874
|
+
depth: { type: "number", minimum: 0, maximum: 10, description: "bevel-emboss: depth, 1 = 100 % (default 1)." },
|
|
11875
|
+
direction: { type: "string", enum: ["up", "down"], description: "bevel-emboss: raised (up, default) or sunk (down)." },
|
|
11876
|
+
soften: { type: "number", minimum: 0, maximum: 16, description: "bevel-emboss: blur of the height in px (default 0)." },
|
|
11877
|
+
altitude: { type: "number", minimum: 0, maximum: 90, description: "bevel-emboss: light altitude in degrees (default 30)." },
|
|
11878
|
+
glossContour: opt({ $ref: "#/$defs/contour" }, "bevel-emboss: gloss contour over the shading (default linear)."),
|
|
11879
|
+
highlightColor: { $ref: "#/$defs/color", description: "bevel-emboss: highlight colour (default #ffffff)." },
|
|
11880
|
+
highlightBlend: { type: "string", enum: BLEND_IDS, description: "bevel-emboss: highlight mode (default screen)." },
|
|
11881
|
+
highlightOpacity: { type: "number", minimum: 0, maximum: 1, description: "bevel-emboss: highlight opacity (default 0.75)." },
|
|
11882
|
+
shadowColor: { $ref: "#/$defs/color", description: "bevel-emboss: shadow colour (default #000000)." },
|
|
11883
|
+
shadowBlend: { type: "string", enum: BLEND_IDS, description: "bevel-emboss: shadow mode (default multiply)." },
|
|
11884
|
+
shadowOpacity: { type: "number", minimum: 0, maximum: 1, description: "bevel-emboss: shadow opacity (default 0.75)." },
|
|
11885
|
+
contourElement: opt(
|
|
11886
|
+
{
|
|
11887
|
+
type: "object",
|
|
11888
|
+
properties: {
|
|
11889
|
+
contour: { $ref: "#/$defs/contour" },
|
|
11890
|
+
range: { type: "number", minimum: 0, maximum: 1, description: "Stored range (default 0.5)." },
|
|
11891
|
+
antiAlias: { type: "boolean", description: "Smooth the contour." }
|
|
11892
|
+
},
|
|
11893
|
+
required: ["contour", "range", "antiAlias"],
|
|
11894
|
+
additionalProperties: false
|
|
11895
|
+
},
|
|
11896
|
+
"bevel-emboss: the Contour element, shaping the bevel's height profile (default off)."
|
|
11897
|
+
),
|
|
11898
|
+
texture: opt(
|
|
11899
|
+
{
|
|
11900
|
+
type: "object",
|
|
11901
|
+
properties: {
|
|
11902
|
+
patternId: { type: "string", description: "Pattern id from list_layer_effects.patterns." },
|
|
11903
|
+
name: { type: "string", description: "Display name." },
|
|
11904
|
+
scale: { type: "number", minimum: 0.01, maximum: 10, description: "1 = 100 %." },
|
|
11905
|
+
depth: { type: "number", minimum: -10, maximum: 10, description: "1 = +100 %; negative carves the pattern in." },
|
|
11906
|
+
invert: { type: "boolean", description: "Invert the pattern." },
|
|
11907
|
+
link: { type: "boolean", description: "Tile from the layer (default true)." },
|
|
11908
|
+
phase: { $ref: "#/$defs/phase" }
|
|
11909
|
+
},
|
|
11910
|
+
required: ["patternId", "scale", "depth", "invert"],
|
|
11911
|
+
additionalProperties: false
|
|
11912
|
+
},
|
|
11913
|
+
"bevel-emboss: the Texture element, a pattern's luminance as extra height (default off)."
|
|
11914
|
+
),
|
|
11915
|
+
invert: { type: "boolean", description: "satin: invert (default true)." },
|
|
11916
|
+
gradient: { $ref: "#/$defs/gradient", description: "gradient-overlay: the gradient (default black to white, 90\xB0)." },
|
|
11917
|
+
dither: { type: "boolean", description: "gradient-overlay: dither (stored; default false)." },
|
|
11918
|
+
patternId: { type: "string", description: "pattern-overlay: pattern id from list_layer_effects.patterns (default checker)." },
|
|
11919
|
+
name: { type: "string", description: "pattern-overlay: pattern display name." },
|
|
11920
|
+
scale: { type: "number", minimum: 0.01, maximum: 10, description: "pattern-overlay: 1 = 100 % (default 1)." },
|
|
11921
|
+
link: { type: "boolean", description: "pattern-overlay: tile from the layer (default true) or the canvas origin." },
|
|
11922
|
+
phase: { $ref: "#/$defs/phase", description: "pattern-overlay: origin offset in px (default 0, 0)." },
|
|
11923
|
+
position: { type: "string", enum: ["outside", "inside", "center"], description: "stroke: where the stroke sits on the edge (default outside)." }
|
|
11924
|
+
},
|
|
11925
|
+
additionalProperties: false
|
|
11926
|
+
};
|
|
11927
|
+
}
|
|
11928
|
+
function patternList(documentPatterns) {
|
|
11929
|
+
const doc = documentPatterns.map((p) => ({ id: p.id, name: p.name, width: p.width, height: p.height, builtin: false }));
|
|
11930
|
+
const builtins = _chunkDPYAO5U6cjs.builtinPatternIds.call(void 0, ).map((id) => {
|
|
11931
|
+
const p = _chunkDPYAO5U6cjs.builtinPattern.call(void 0, id);
|
|
11932
|
+
return { id, name: p.name, width: p.width, height: p.height, builtin: true };
|
|
11933
|
+
});
|
|
11934
|
+
return [...doc, ...builtins];
|
|
11935
|
+
}
|
|
11936
|
+
function describeLayerEffects(effects) {
|
|
11937
|
+
return {
|
|
11938
|
+
enabled: effects.enabled,
|
|
11939
|
+
scale: _nullishCoalesce(effects.scale, () => ( 1)),
|
|
11940
|
+
margin: _chunkDPYAO5U6cjs.effectsMargin.call(void 0, effects),
|
|
11941
|
+
fromPsd: Boolean(effects.psd),
|
|
11942
|
+
effects: effects.items.map((e) => ({ ...JSON.parse(JSON.stringify(e)), label: _chunkDPYAO5U6cjs.layerEffectLabel.call(void 0, e.kind) }))
|
|
11943
|
+
};
|
|
11944
|
+
}
|
|
11945
|
+
function createImageEffectTools(controller) {
|
|
11946
|
+
return createLayerEffectTools(
|
|
11947
|
+
{
|
|
11948
|
+
requireLayer: (id) => void requireLayer(controller.getLayers(), id),
|
|
11949
|
+
getLayerEffects: (id) => controller.getLayerEffects(id),
|
|
11950
|
+
addLayerEffect: (id, kind, settings, index) => controller.addLayerEffect(id, kind, settings, index),
|
|
11951
|
+
updateLayerEffect: (id, effectId, changes) => controller.updateLayerEffect(id, effectId, changes),
|
|
11952
|
+
removeLayerEffect: (id, effectId) => controller.removeLayerEffect(id, effectId),
|
|
11953
|
+
setLayerEffectsEnabled: (id, enabled, scale) => controller.setLayerEffectsEnabled(id, enabled, scale),
|
|
11954
|
+
getGlobalLight: () => controller.getGlobalLight(),
|
|
11955
|
+
setGlobalLight: (light) => controller.setGlobalLight(light),
|
|
11956
|
+
getDocumentPatterns: () => controller.getDocumentPatterns()
|
|
11957
|
+
},
|
|
11958
|
+
{ layers: "a pixel, shape, type, smart object, annotation or group layer" }
|
|
11959
|
+
);
|
|
11960
|
+
}
|
|
11961
|
+
function createLayerEffectTools(host, options) {
|
|
11962
|
+
const error = _nullishCoalesce(options.error, () => ( ((m) => new LayerOperationError(m))));
|
|
11963
|
+
const LAYER_ID = { type: "string", description: `Layer id from list_layers (${options.layers}).` };
|
|
11964
|
+
const layerArg = (id) => {
|
|
11965
|
+
if (typeof id !== "string" || !id) throw error("layerId is required (a layer id from list_layers).");
|
|
11966
|
+
host.requireLayer(id);
|
|
11967
|
+
return id;
|
|
11968
|
+
};
|
|
11969
|
+
const result = (layerId, extra = {}) => ({ layerId, ...extra, ...describeLayerEffects(host.getLayerEffects(layerId)) });
|
|
11970
|
+
const globalLight = () => _nullishCoalesce(_optionalChain([host, 'access', _325 => _325.getGlobalLight, 'optionalCall', _326 => _326()]), () => ( { ..._chunkDPYAO5U6cjs.DEFAULT_GLOBAL_LIGHT }));
|
|
11971
|
+
const list2 = {
|
|
11972
|
+
name: "list_layer_effects",
|
|
11973
|
+
title: "List layer effects",
|
|
11974
|
+
description: "Returns a layer's effects: the master switch (enabled), Scale Effects (scale, 1 = 100 %), margin (px the effects reach beyond the shape), whether they came from a PSD, and every effect with its id, kind, label and all settings. Also returns the document global light and the pattern ids pattern effects can use.",
|
|
11975
|
+
inputSchema: { type: "object", properties: { layerId: LAYER_ID }, required: ["layerId"], additionalProperties: false },
|
|
11976
|
+
annotations: { title: "List layer effects", ...READ },
|
|
11977
|
+
handler: ({ layerId }) => result(layerArg(layerId), { globalLight: globalLight(), patterns: patternList(_nullishCoalesce(_optionalChain([host, 'access', _327 => _327.getDocumentPatterns, 'optionalCall', _328 => _328()]), () => ( []))), kinds: [..._chunkDPYAO5U6cjs.LAYER_EFFECT_KINDS] })
|
|
11978
|
+
};
|
|
11979
|
+
const add = {
|
|
11980
|
+
name: "add_layer_effect",
|
|
11981
|
+
title: "Add a layer effect",
|
|
11982
|
+
description: `Adds a live effect to ${options.layers} with Photoshop's defaults, changed by settings: drop-shadow, inner-shadow, outer-glow, inner-glow, bevel-emboss, satin, color-overlay, gradient-overlay, pattern-overlay or stroke. Several of one kind are allowed (the first listed is on top). The effect is drawn from the layer's pixels, so it follows later changes. One undo step. Returns the new effect's id and the layer's effects.`,
|
|
11983
|
+
inputSchema: {
|
|
11984
|
+
type: "object",
|
|
11985
|
+
$defs: DEFS,
|
|
11986
|
+
properties: {
|
|
11987
|
+
layerId: LAYER_ID,
|
|
11988
|
+
kind: { type: "string", enum: [..._chunkDPYAO5U6cjs.LAYER_EFFECT_KINDS], description: "Effect kind." },
|
|
11989
|
+
settings: settingsSchema(false),
|
|
11990
|
+
index: { type: "integer", minimum: 0, description: "Position in the layer's effect list (default the end)." }
|
|
11991
|
+
},
|
|
11992
|
+
required: ["layerId", "kind"],
|
|
11993
|
+
additionalProperties: false
|
|
11994
|
+
},
|
|
11995
|
+
annotations: { title: "Add a layer effect", ...WRITE },
|
|
11996
|
+
handler: ({ layerId, kind, settings, index }) => {
|
|
11997
|
+
const id = layerArg(layerId);
|
|
11998
|
+
if (!_chunkDPYAO5U6cjs.isLayerEffectKind.call(void 0, kind)) throw error(`kind must be one of ${_chunkDPYAO5U6cjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
11999
|
+
const { effect } = host.addLayerEffect(id, kind, _nullishCoalesce(settings, () => ( {})), index);
|
|
12000
|
+
return result(id, { effectId: effect.id });
|
|
12001
|
+
}
|
|
12002
|
+
};
|
|
12003
|
+
const update = {
|
|
12004
|
+
name: "update_layer_effect",
|
|
12005
|
+
title: "Change a layer effect",
|
|
12006
|
+
description: "Changes settings of one effect (only the given ones; fill, gradient, contour and texture objects are replaced whole, null removes an optional contour or texture). The kind cannot change. Validates everything before changing anything. One undo step. Returns the layer's effects.",
|
|
12007
|
+
inputSchema: {
|
|
12008
|
+
type: "object",
|
|
12009
|
+
$defs: DEFS,
|
|
12010
|
+
properties: { layerId: LAYER_ID, effectId: EFFECT_ID, settings: settingsSchema(true) },
|
|
12011
|
+
required: ["layerId", "effectId", "settings"],
|
|
12012
|
+
additionalProperties: false
|
|
12013
|
+
},
|
|
12014
|
+
annotations: { title: "Change a layer effect", ...WRITE_IDEMPOTENT },
|
|
12015
|
+
handler: ({ layerId, effectId, settings }) => {
|
|
12016
|
+
const id = layerArg(layerId);
|
|
12017
|
+
const changes = _nullishCoalesce(settings, () => ( {}));
|
|
12018
|
+
if (!Object.keys(changes).length) throw error("Give at least one setting to change.");
|
|
12019
|
+
host.updateLayerEffect(id, effectId, changes);
|
|
12020
|
+
return result(id);
|
|
12021
|
+
}
|
|
12022
|
+
};
|
|
12023
|
+
const remove = {
|
|
12024
|
+
name: "remove_layer_effect",
|
|
12025
|
+
title: "Remove a layer effect",
|
|
12026
|
+
description: "Removes one effect from a layer (to hide it but keep its settings, set enabled false with update_layer_effect instead). One undo step. Returns the layer's remaining effects.",
|
|
12027
|
+
inputSchema: { type: "object", properties: { layerId: LAYER_ID, effectId: EFFECT_ID }, required: ["layerId", "effectId"], additionalProperties: false },
|
|
12028
|
+
annotations: { title: "Remove a layer effect", ...DESTRUCTIVE },
|
|
12029
|
+
handler: ({ layerId, effectId }) => {
|
|
12030
|
+
const id = layerArg(layerId);
|
|
12031
|
+
host.removeLayerEffect(id, effectId);
|
|
12032
|
+
return result(id);
|
|
12033
|
+
}
|
|
12034
|
+
};
|
|
12035
|
+
const setEnabled = {
|
|
12036
|
+
name: "set_layer_effects_enabled",
|
|
12037
|
+
title: "Switch layer effects on or off",
|
|
12038
|
+
description: "Turns all of a layer's effects on or off at once (the master switch; each effect keeps its own enabled flag) and optionally sets Scale Effects, which multiplies every size, distance and pattern scale. One undo step. Returns the layer's effects.",
|
|
12039
|
+
inputSchema: {
|
|
12040
|
+
type: "object",
|
|
12041
|
+
properties: {
|
|
12042
|
+
layerId: LAYER_ID,
|
|
12043
|
+
enabled: { type: "boolean", description: "true renders the enabled effects; false hides them all." },
|
|
12044
|
+
scale: { type: "number", minimum: 0.01, maximum: 10, description: "Scale Effects, 1 = 100 % (unchanged when left out)." }
|
|
12045
|
+
},
|
|
12046
|
+
required: ["layerId", "enabled"],
|
|
12047
|
+
additionalProperties: false
|
|
12048
|
+
},
|
|
12049
|
+
annotations: { title: "Switch layer effects on or off", ...WRITE_IDEMPOTENT },
|
|
12050
|
+
handler: ({ layerId, enabled, scale }) => {
|
|
12051
|
+
const id = layerArg(layerId);
|
|
12052
|
+
host.setLayerEffectsEnabled(id, enabled, scale);
|
|
12053
|
+
return result(id);
|
|
12054
|
+
}
|
|
12055
|
+
};
|
|
12056
|
+
const light = {
|
|
12057
|
+
name: "set_global_light",
|
|
12058
|
+
title: "Set the global light",
|
|
12059
|
+
description: "Sets the document global light that shadows and bevels with useGlobalLight follow (Photoshop default: angle 120\xB0, altitude 30\xB0). One undo step. Returns the light.",
|
|
12060
|
+
inputSchema: {
|
|
12061
|
+
type: "object",
|
|
12062
|
+
properties: {
|
|
12063
|
+
angle: { type: "number", minimum: -360, maximum: 360, description: "Degrees, counter-clockwise from 3 o'clock: where the light comes from (unchanged when left out)." },
|
|
12064
|
+
altitude: { type: "number", minimum: 0, maximum: 90, description: "Degrees above the canvas, for bevels (unchanged when left out)." }
|
|
12065
|
+
},
|
|
12066
|
+
additionalProperties: false
|
|
12067
|
+
},
|
|
12068
|
+
annotations: { title: "Set the global light", ...WRITE_IDEMPOTENT },
|
|
12069
|
+
handler: ({ angle, altitude }) => {
|
|
12070
|
+
if (angle === void 0 && altitude === void 0) throw error("Give angle, altitude or both.");
|
|
12071
|
+
const next = {};
|
|
12072
|
+
if (angle !== void 0) next.angle = angle;
|
|
12073
|
+
if (altitude !== void 0) next.altitude = altitude;
|
|
12074
|
+
return { globalLight: host.setGlobalLight(next) };
|
|
12075
|
+
}
|
|
12076
|
+
};
|
|
12077
|
+
return host.setGlobalLight ? [list2, add, update, remove, setEnabled, light] : [list2, add, update, remove, setEnabled];
|
|
12078
|
+
}
|
|
12079
|
+
|
|
12080
|
+
|
|
12081
|
+
|
|
12082
|
+
|
|
11726
12083
|
|
|
11727
12084
|
|
|
11728
12085
|
|
|
@@ -12085,4 +12442,4 @@ function exportPsd(input) {
|
|
|
12085
12442
|
|
|
12086
12443
|
|
|
12087
12444
|
|
|
12088
|
-
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.MARGIN_FIT_MIN_GUTTER = MARGIN_FIT_MIN_GUTTER; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.layerMaskSelection = layerMaskSelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.TEXT_ORIENTATIONS = TEXT_ORIENTATIONS; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.MAX_EFFECT_ANIMATION_MS = MAX_EFFECT_ANIMATION_MS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.componentsCoverage = componentsCoverage; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.VECTOR_MASK_EDGE_DEFAULTS = VECTOR_MASK_EDGE_DEFAULTS; exports.vectorMaskSegments = vectorMaskSegments; exports.validVectorMaskEdges = validVectorMaskEdges; exports.hybridVectorMaskCoverage = hybridVectorMaskCoverage; exports.isActiveVectorMask = isActiveVectorMask; exports.vectorMaskCoverage = vectorMaskCoverage; exports.layerGuide = layerGuide; exports.effectiveLayerMask = effectiveLayerMask; exports.resolveVectorMasks = resolveVectorMasks; exports.offsetVectorMask = offsetVectorMask; exports.transformVectorMask = transformVectorMask; exports.followLayerMove = followLayerMove; exports.vectorMaskBounds = vectorMaskBounds; exports.vectorMaskThumbnail = vectorMaskThumbnail; exports.EDGE_COLOR_RADIUS = EDGE_COLOR_RADIUS; exports.hasEdgeUnmix = hasEdgeUnmix; exports.maskCoverageOverCanvas = maskCoverageOverCanvas; exports.hasSoftBand = hasSoftBand; exports.despillEdge = despillEdge; exports.applyEdgeUnmix = applyEdgeUnmix; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.textOrientation = textOrientation; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.ANCHOR_FRACTION = ANCHOR_FRACTION; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.translateLayer = translateLayer; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.readEdgeColor = readEdgeColor; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.readShapeComponents = readShapeComponents; 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;
|
|
12445
|
+
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.MARGIN_FIT_MIN_GUTTER = MARGIN_FIT_MIN_GUTTER; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.layerMaskSelection = layerMaskSelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.TEXT_ORIENTATIONS = TEXT_ORIENTATIONS; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.MAX_EFFECT_ANIMATION_MS = MAX_EFFECT_ANIMATION_MS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.componentsCoverage = componentsCoverage; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.VECTOR_MASK_EDGE_DEFAULTS = VECTOR_MASK_EDGE_DEFAULTS; exports.vectorMaskSegments = vectorMaskSegments; exports.validVectorMaskEdges = validVectorMaskEdges; exports.hybridVectorMaskCoverage = hybridVectorMaskCoverage; exports.isActiveVectorMask = isActiveVectorMask; exports.vectorMaskCoverage = vectorMaskCoverage; exports.layerGuide = layerGuide; exports.effectiveLayerMask = effectiveLayerMask; exports.resolveVectorMasks = resolveVectorMasks; exports.offsetVectorMask = offsetVectorMask; exports.transformVectorMask = transformVectorMask; exports.followLayerMove = followLayerMove; exports.vectorMaskBounds = vectorMaskBounds; exports.vectorMaskThumbnail = vectorMaskThumbnail; exports.EDGE_COLOR_RADIUS = EDGE_COLOR_RADIUS; exports.hasEdgeUnmix = hasEdgeUnmix; exports.maskCoverageOverCanvas = maskCoverageOverCanvas; exports.hasSoftBand = hasSoftBand; exports.despillEdge = despillEdge; exports.applyEdgeUnmix = applyEdgeUnmix; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.textOrientation = textOrientation; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.ANCHOR_FRACTION = ANCHOR_FRACTION; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.translateLayer = translateLayer; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.readEdgeColor = readEdgeColor; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.readShapeComponents = readShapeComponents; 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; exports.describeLayerEffects = describeLayerEffects; exports.createImageEffectTools = createImageEffectTools; exports.createLayerEffectTools = createLayerEffectTools;
|