@pixerate/editor 0.120.0 → 0.122.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/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/{chunk-HTAFDTNR.cjs → chunk-4PUPGALM.cjs} +251 -156
- package/dist/chunk-4PUPGALM.cjs.map +1 -0
- package/dist/{chunk-N3467VD6.js → chunk-7QN76ESJ.js} +1 -179
- package/dist/chunk-7QN76ESJ.js.map +1 -0
- package/dist/{chunk-UMVW2Q66.js → chunk-CLTTLLWA.js} +1090 -982
- package/dist/chunk-CLTTLLWA.js.map +1 -0
- package/dist/{chunk-EJVDBITD.cjs → chunk-DCLJNVZS.cjs} +2 -180
- package/dist/chunk-DCLJNVZS.cjs.map +1 -0
- package/dist/{chunk-WMRIG4XQ.cjs → chunk-DFFBJV3U.cjs} +1855 -1747
- package/dist/chunk-DFFBJV3U.cjs.map +1 -0
- package/dist/chunk-GX332W2C.js +181 -0
- package/dist/chunk-GX332W2C.js.map +1 -0
- package/dist/{chunk-BOWUU4LJ.js → chunk-IX3YKUVK.js} +105 -10
- package/dist/chunk-IX3YKUVK.js.map +1 -0
- package/dist/{chunk-TS5IEUW6.cjs → chunk-K7V27T72.cjs} +178 -3
- package/dist/chunk-K7V27T72.cjs.map +1 -0
- package/dist/chunk-MUUXNRU4.cjs +181 -0
- package/dist/chunk-MUUXNRU4.cjs.map +1 -0
- package/dist/{chunk-YHW26LS2.js → chunk-ZZPGTNXJ.js} +177 -2
- package/dist/chunk-ZZPGTNXJ.js.map +1 -0
- package/dist/{render-B05K68_h.d.ts → deep-DLwKZDFr.d.ts} +143 -134
- package/dist/{render-DnAbIKcs.d.cts → deep-QS3ppbMX.d.cts} +143 -134
- package/dist/{export-D2D8hb_u.d.ts → export-VmTofKIk.d.ts} +11 -4
- package/dist/{export-fP2hZYjm.d.cts → export-jKKj8Fg8.d.cts} +11 -4
- package/dist/image-editor/index.cjs +760 -734
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +18 -6
- package/dist/image-editor/index.d.ts +18 -6
- package/dist/image-editor/index.js +37 -11
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +22 -2
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +159 -1
- package/dist/paint/index.d.ts +159 -1
- package/dist/paint/index.js +21 -1
- package/dist/paint-editor/index.cjs +95 -94
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +2 -2
- package/dist/paint-editor/index.d.ts +2 -2
- package/dist/paint-editor/index.js +12 -11
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +5 -4
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +29 -7
- package/dist/raster/index.d.ts +29 -7
- package/dist/raster/index.js +11 -10
- package/dist/vector/index.cjs +14 -12
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.js +7 -5
- package/dist/vector/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/pixerate-canvas/SKILL.md +23 -1
- package/skills/pixerate-image-editor/SKILL.md +7 -1
- package/skills/pixerate-image-editor/references/photoshop-files.md +4 -3
- package/skills/pixerate-paint-editor/SKILL.md +32 -7
- package/dist/chunk-BOWUU4LJ.js.map +0 -1
- package/dist/chunk-EJVDBITD.cjs.map +0 -1
- package/dist/chunk-HTAFDTNR.cjs.map +0 -1
- package/dist/chunk-N3467VD6.js.map +0 -1
- package/dist/chunk-TS5IEUW6.cjs.map +0 -1
- package/dist/chunk-UMVW2Q66.js.map +0 -1
- package/dist/chunk-WMRIG4XQ.cjs.map +0 -1
- package/dist/chunk-YHW26LS2.js.map +0 -1
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkDFFBJV3Ucjs = require('./chunk-DFFBJV3U.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -44,13 +44,13 @@ var _chunkWMRIG4XQcjs = require('./chunk-WMRIG4XQ.cjs');
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
var _chunkMUUXNRU4cjs = require('./chunk-MUUXNRU4.cjs');
|
|
47
48
|
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
|
|
53
|
-
var _chunkEJVDBITDcjs = require('./chunk-EJVDBITD.cjs');
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
@@ -66,12 +66,16 @@ var _chunkEJVDBITDcjs = require('./chunk-EJVDBITD.cjs');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
|
|
70
|
+
var _chunk7ISPWEJAcjs = require('./chunk-7ISPWEJA.cjs');
|
|
69
71
|
|
|
70
72
|
|
|
71
73
|
|
|
72
74
|
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
var _chunkDCLJNVZScjs = require('./chunk-DCLJNVZS.cjs');
|
|
75
79
|
|
|
76
80
|
|
|
77
81
|
|
|
@@ -1137,7 +1141,7 @@ function smoothCoverage(m, w, h, r) {
|
|
|
1137
1141
|
return src;
|
|
1138
1142
|
}
|
|
1139
1143
|
function featherCoverage(m, w, h, radius) {
|
|
1140
|
-
const out =
|
|
1144
|
+
const out = _chunkDFFBJV3Ucjs.gaussianBlur.call(void 0, m, w, h, Number.isFinite(radius) ? Math.max(0, radius) : 0, "zero");
|
|
1141
1145
|
for (let i = 0; i < out.length; i++) if (Math.abs(out[i]) < 1e-7) out[i] = 0;
|
|
1142
1146
|
return out;
|
|
1143
1147
|
}
|
|
@@ -1285,7 +1289,7 @@ function layerMaskCoverage(mask) {
|
|
|
1285
1289
|
let v = new Float32Array(sel.data.length);
|
|
1286
1290
|
for (let i = 0; i < v.length; i++) v[i] = sel.data[i] / 255;
|
|
1287
1291
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
1288
|
-
if (feather > 0) v =
|
|
1292
|
+
if (feather > 0) v = _chunkDFFBJV3Ucjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
|
|
1289
1293
|
const density = _nullishCoalesce(mask.density, () => ( 1));
|
|
1290
1294
|
if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
|
|
1291
1295
|
return v;
|
|
@@ -1528,7 +1532,7 @@ function normalizeAdjustmentLayers(raw) {
|
|
|
1528
1532
|
return out;
|
|
1529
1533
|
}
|
|
1530
1534
|
function curveLutFromLevels(points) {
|
|
1531
|
-
return
|
|
1535
|
+
return _chunkDFFBJV3Ucjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
|
|
1532
1536
|
}
|
|
1533
1537
|
var toUnitLevels = (c) => ({
|
|
1534
1538
|
inBlack: c.inBlack / 255,
|
|
@@ -2181,6 +2185,67 @@ function applyProcess2Adjustments(imageData, adjustments) {
|
|
|
2181
2185
|
if (hasOpacity) data[i + 3] = clamp(data[i + 3] * opacity);
|
|
2182
2186
|
}
|
|
2183
2187
|
}
|
|
2188
|
+
function applyProcess2Float(data, adjustments, linear) {
|
|
2189
|
+
const hasColor = !!adjustments.brightness || !!adjustments.contrast || !!adjustments.saturation || !!adjustments.exposure || !!adjustments.temperature || !!adjustments.tint;
|
|
2190
|
+
if (!hasColor) return;
|
|
2191
|
+
const { m, luts, scale, saturation } = getProcess2Plan(adjustments);
|
|
2192
|
+
const N = TONE_LUT_SIZE;
|
|
2193
|
+
const wr = LUMA_709[0], wg = LUMA_709[1], wb = LUMA_709[2];
|
|
2194
|
+
const c = [0, 0, 0];
|
|
2195
|
+
const dec = (v) => v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
2196
|
+
const enc = (v) => v <= 0 ? 0 : v >= 1 ? 1 : v <= 31308e-7 ? v * 12.92 : 1.055 * Math.pow(v, 1 / 2.4) - 0.055;
|
|
2197
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
2198
|
+
if (!(data[i + 3] > 0)) continue;
|
|
2199
|
+
const r0 = linear ? data[i] : dec(data[i]);
|
|
2200
|
+
const g0 = linear ? data[i + 1] : dec(data[i + 1]);
|
|
2201
|
+
const b0 = linear ? data[i + 2] : dec(data[i + 2]);
|
|
2202
|
+
c[0] = m[0] * r0 + m[1] * g0 + m[2] * b0;
|
|
2203
|
+
c[1] = m[3] * r0 + m[4] * g0 + m[5] * b0;
|
|
2204
|
+
c[2] = m[6] * r0 + m[7] * g0 + m[8] * b0;
|
|
2205
|
+
for (let ch = 0; ch < 3; ch++) {
|
|
2206
|
+
const lut = luts[ch];
|
|
2207
|
+
const v = c[ch];
|
|
2208
|
+
let f;
|
|
2209
|
+
if (v <= 0) c[ch] = lut[0];
|
|
2210
|
+
else if ((f = v * scale[ch]) >= N) c[ch] = linear ? lut[N] + (lut[N] - lut[N - 1]) * (f - N) : lut[N];
|
|
2211
|
+
else {
|
|
2212
|
+
const k = f | 0;
|
|
2213
|
+
c[ch] = lut[k] + (lut[k + 1] - lut[k]) * (f - k);
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
if (saturation !== 1) {
|
|
2217
|
+
const y = wr * c[0] + wg * c[1] + wb * c[2];
|
|
2218
|
+
for (let ch = 0; ch < 3; ch++) c[ch] = y + (c[ch] - y) * saturation;
|
|
2219
|
+
}
|
|
2220
|
+
for (let ch = 0; ch < 3; ch++) data[i + ch] = linear ? Math.max(0, c[ch]) : enc(c[ch]);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
function applyBoxBlurFloat(imageData, radius) {
|
|
2224
|
+
if (radius < 1) return;
|
|
2225
|
+
const { width: w, height: h, data: src } = imageData;
|
|
2226
|
+
const temp = new Float32Array(src.length);
|
|
2227
|
+
const n = 2 * radius + 1;
|
|
2228
|
+
for (let y = 0; y < h; y++) {
|
|
2229
|
+
for (let x = 0; x < w; x++) {
|
|
2230
|
+
const d = (y * w + x) * 4;
|
|
2231
|
+
for (let c = 0; c < 4; c++) {
|
|
2232
|
+
let s = 0;
|
|
2233
|
+
for (let k = -radius; k <= radius; k++) s += src[(y * w + Math.min(w - 1, Math.max(0, x + k))) * 4 + c];
|
|
2234
|
+
temp[d + c] = s / n;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
for (let x = 0; x < w; x++) {
|
|
2239
|
+
for (let y = 0; y < h; y++) {
|
|
2240
|
+
const d = (y * w + x) * 4;
|
|
2241
|
+
for (let c = 0; c < 4; c++) {
|
|
2242
|
+
let s = 0;
|
|
2243
|
+
for (let k = -radius; k <= radius; k++) s += temp[(Math.min(h - 1, Math.max(0, y + k)) * w + x) * 4 + c];
|
|
2244
|
+
src[d + c] = s / n;
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2184
2249
|
function applyBoxBlur(imageData, radius) {
|
|
2185
2250
|
applyFastBoxBlur(imageData, radius);
|
|
2186
2251
|
}
|
|
@@ -2282,7 +2347,7 @@ function newLayerId(prefix = "layer") {
|
|
|
2282
2347
|
return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
|
|
2283
2348
|
}
|
|
2284
2349
|
function pixelLayers(layers) {
|
|
2285
|
-
return
|
|
2350
|
+
return _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
2286
2351
|
}
|
|
2287
2352
|
function developFilter(layer) {
|
|
2288
2353
|
return _optionalChain([layer, 'access', _10 => _10.filters, 'optionalAccess', _11 => _11.find, 'call', _12 => _12((f) => f.kind === "develop")]);
|
|
@@ -2313,10 +2378,10 @@ function isRenderedLayer(layer) {
|
|
|
2313
2378
|
return layer.type === "smart" || layer.type === "shape" || layer.type === "type";
|
|
2314
2379
|
}
|
|
2315
2380
|
function shapeLayers(layers) {
|
|
2316
|
-
return
|
|
2381
|
+
return _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
|
|
2317
2382
|
}
|
|
2318
2383
|
function smartObjectLayers(layers) {
|
|
2319
|
-
return
|
|
2384
|
+
return _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
|
|
2320
2385
|
}
|
|
2321
2386
|
|
|
2322
2387
|
// src/image-editor/layers/compositor.ts
|
|
@@ -2379,6 +2444,27 @@ function runLayerFilters(data, width, height, filters) {
|
|
|
2379
2444
|
else if (f.kind === "blur") applyBoxBlur({ width, height, data }, Math.min(Math.round(f.radius), 40));
|
|
2380
2445
|
}
|
|
2381
2446
|
}
|
|
2447
|
+
function runLayerFiltersFloat(data, width, height, filters, linear) {
|
|
2448
|
+
for (const f of filters) {
|
|
2449
|
+
if (!isActiveFilter(f)) continue;
|
|
2450
|
+
if (f.kind === "blur") applyBoxBlurFloat({ width, height, data }, Math.min(Math.round(f.radius), 40));
|
|
2451
|
+
else if (f.kind === "develop") {
|
|
2452
|
+
const adj = developAdjustments(f);
|
|
2453
|
+
if (normalizeProcessVersion(adj.process) === LATEST_PROCESS_VERSION) applyProcess2Float(data, adj, linear);
|
|
2454
|
+
else {
|
|
2455
|
+
const bytes = linear ? _chunk7ISPWEJAcjs.to8From32.call(void 0, data, 4) : Uint8ClampedArray.from(data, (v) => v * 255);
|
|
2456
|
+
applyLegacyAdjustments({ data: bytes }, adj);
|
|
2457
|
+
if (linear) data.set(_chunk7ISPWEJAcjs.to32From8.call(void 0, bytes, 4));
|
|
2458
|
+
else for (let i = 0; i < data.length; i++) data[i] = bytes[i] / 255;
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
function filterReach(filters) {
|
|
2464
|
+
let r = 0;
|
|
2465
|
+
for (const f of filters) if (isActiveFilter(f) && f.kind === "blur") r += Math.min(Math.round(f.radius), 40);
|
|
2466
|
+
return r;
|
|
2467
|
+
}
|
|
2382
2468
|
var filterSpecCache = /* @__PURE__ */ new WeakMap();
|
|
2383
2469
|
function pixelFilterSpec(layer) {
|
|
2384
2470
|
const list2 = layer.filters;
|
|
@@ -2422,14 +2508,20 @@ var PHOTO_PROFILE = {
|
|
|
2422
2508
|
return v;
|
|
2423
2509
|
}
|
|
2424
2510
|
};
|
|
2425
|
-
var LayerCompositor = class extends
|
|
2511
|
+
var LayerCompositor = class extends _chunkDFFBJV3Ucjs.RasterCompositor {
|
|
2426
2512
|
constructor(options = {}) {
|
|
2427
2513
|
super(PHOTO_PROFILE, options);
|
|
2428
2514
|
}
|
|
2429
2515
|
};
|
|
2430
2516
|
function compositeDeep(layers, rect, sources, depth) {
|
|
2431
|
-
const deep = new (0,
|
|
2432
|
-
applyFilterRunDeep: (run, acc, _r, masks) => applyAdjustmentLayersFloat(acc, run.map(adjustmentNodeAsLayer), masks)
|
|
2517
|
+
const deep = new (0, _chunkDFFBJV3Ucjs.DeepCompositor)(new LayerCompositor(), PHOTO_PROFILE, {
|
|
2518
|
+
applyFilterRunDeep: (run, acc, _r, masks) => applyAdjustmentLayersFloat(acc, run.map(adjustmentNodeAsLayer), masks),
|
|
2519
|
+
pixelFiltersDeep: (l) => {
|
|
2520
|
+
if (l.type !== "pixel") return null;
|
|
2521
|
+
const filters = (_nullishCoalesce(l.filters, () => ( []))).filter(isActiveFilter);
|
|
2522
|
+
if (!filters.length) return null;
|
|
2523
|
+
return { reach: filterReach(filters), apply: (data, width, height, linear) => runLayerFiltersFloat(data, width, height, filters, linear) };
|
|
2524
|
+
}
|
|
2433
2525
|
}, depth);
|
|
2434
2526
|
return deep.composite(layers, rect, sources);
|
|
2435
2527
|
}
|
|
@@ -2974,47 +3066,47 @@ var fail = (message) => {
|
|
|
2974
3066
|
throw new LayerOperationError(message);
|
|
2975
3067
|
};
|
|
2976
3068
|
function requireLayer(layers, id) {
|
|
2977
|
-
const loc =
|
|
3069
|
+
const loc = _chunkDFFBJV3Ucjs.findLayer.call(void 0, layers, id);
|
|
2978
3070
|
if (!loc) {
|
|
2979
|
-
const ids =
|
|
3071
|
+
const ids = _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, layers).map((l) => l.id);
|
|
2980
3072
|
fail(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
|
|
2981
3073
|
}
|
|
2982
3074
|
return loc;
|
|
2983
3075
|
}
|
|
2984
3076
|
function requireUnlocked(layer, what, action) {
|
|
2985
|
-
if (
|
|
2986
|
-
if (what !== "all" &&
|
|
3077
|
+
if (_chunkDFFBJV3Ucjs.isLayerLocked.call(void 0, layer, "all")) fail(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
|
|
3078
|
+
if (what !== "all" && _chunkDFFBJV3Ucjs.isLayerLocked.call(void 0, layer, what)) fail(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
|
|
2987
3079
|
}
|
|
2988
3080
|
function placeLayer(layers, layer, placement = {}, defaultIndex) {
|
|
2989
3081
|
const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
|
|
2990
3082
|
if (given > 1) fail("Give only one of aboveId, belowId and parentId.");
|
|
2991
3083
|
if (placement.aboveId || placement.belowId) {
|
|
2992
3084
|
const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
|
|
2993
|
-
return
|
|
3085
|
+
return _chunkDFFBJV3Ucjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _21 => _21.parent, 'optionalAccess', _22 => _22.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
|
|
2994
3086
|
}
|
|
2995
3087
|
if (placement.parentId) {
|
|
2996
3088
|
const ref = requireLayer(layers, placement.parentId);
|
|
2997
3089
|
if (ref.layer.type !== "group") fail(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
|
|
2998
|
-
return
|
|
3090
|
+
return _chunkDFFBJV3Ucjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
|
|
2999
3091
|
}
|
|
3000
|
-
return
|
|
3092
|
+
return _chunkDFFBJV3Ucjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
|
|
3001
3093
|
}
|
|
3002
3094
|
function removeLayer(layers, id) {
|
|
3003
3095
|
const loc = requireLayer(layers, id);
|
|
3004
3096
|
requireUnlocked(loc.layer, "all", "delete it");
|
|
3005
|
-
return
|
|
3097
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3006
3098
|
}
|
|
3007
3099
|
function moveLayer(layers, id, placement) {
|
|
3008
3100
|
const loc = requireLayer(layers, id);
|
|
3009
3101
|
requireUnlocked(loc.layer, "all", "move it");
|
|
3010
3102
|
const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
|
|
3011
3103
|
if (target === id) fail("A layer cannot be placed relative to itself.");
|
|
3012
|
-
if (target && loc.layer.type === "group" &&
|
|
3104
|
+
if (target && loc.layer.type === "group" && _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
|
|
3013
3105
|
fail(`Group "${id}" cannot be moved into its own child "${target}".`);
|
|
3014
3106
|
}
|
|
3015
3107
|
if (target) requireLayer(layers, target);
|
|
3016
3108
|
if (!target && placement.index === void 0) fail("Give aboveId, belowId, parentId or index.");
|
|
3017
|
-
const without =
|
|
3109
|
+
const without = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3018
3110
|
return placeLayer(without, loc.layer, placement);
|
|
3019
3111
|
}
|
|
3020
3112
|
function withNewIds(layer) {
|
|
@@ -3033,7 +3125,7 @@ function duplicateLayer(layers, id, name) {
|
|
|
3033
3125
|
const copy = withNewIds(loc.layer);
|
|
3034
3126
|
copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
|
|
3035
3127
|
delete copy.locks;
|
|
3036
|
-
return { layers:
|
|
3128
|
+
return { layers: _chunkDFFBJV3Ucjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _25 => _25.parent, 'optionalAccess', _26 => _26.id]), () => ( null)), loc.index + 1), id: copy.id };
|
|
3037
3129
|
}
|
|
3038
3130
|
function setLayerProperties(layers, id, props) {
|
|
3039
3131
|
const loc = requireLayer(layers, id);
|
|
@@ -3080,7 +3172,7 @@ function setLayerProperties(layers, id, props) {
|
|
|
3080
3172
|
if (props.collapsed) g.collapsed = true;
|
|
3081
3173
|
else delete g.collapsed;
|
|
3082
3174
|
}
|
|
3083
|
-
return
|
|
3175
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3084
3176
|
}
|
|
3085
3177
|
function groupLayers(layers, ids, name = "Group") {
|
|
3086
3178
|
if (!ids.length) fail("Give at least one layer id to group.");
|
|
@@ -3109,17 +3201,17 @@ function groupLayers(layers, ids, name = "Group") {
|
|
|
3109
3201
|
group.children[0] = c;
|
|
3110
3202
|
}
|
|
3111
3203
|
let out = layers;
|
|
3112
|
-
for (const l of ordered) out =
|
|
3113
|
-
return { layers:
|
|
3204
|
+
for (const l of ordered) out = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
3205
|
+
return { layers: _chunkDFFBJV3Ucjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
|
|
3114
3206
|
}
|
|
3115
3207
|
function ungroupLayer(layers, id) {
|
|
3116
3208
|
const loc = requireLayer(layers, id);
|
|
3117
3209
|
if (loc.layer.type !== "group") fail(`Layer "${id}" is not a group.`);
|
|
3118
3210
|
requireUnlocked(loc.layer, "all", "ungroup it");
|
|
3119
3211
|
const group = loc.layer;
|
|
3120
|
-
let out =
|
|
3212
|
+
let out = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3121
3213
|
group.children.forEach((c, i) => {
|
|
3122
|
-
out =
|
|
3214
|
+
out = _chunkDFFBJV3Ucjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _35 => _35.parent, 'optionalAccess', _36 => _36.id]), () => ( null)), loc.index + i);
|
|
3123
3215
|
});
|
|
3124
3216
|
return { layers: out, ids: group.children.map((c) => c.id) };
|
|
3125
3217
|
}
|
|
@@ -3134,12 +3226,12 @@ function offsetLayer(layers, id, offset) {
|
|
|
3134
3226
|
if (mask && mask.linked === false && !mask.source) {
|
|
3135
3227
|
next.mask = { ...mask, surface: _chunk7ISPWEJAcjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
|
|
3136
3228
|
}
|
|
3137
|
-
return
|
|
3229
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3138
3230
|
}
|
|
3139
3231
|
function setLayerMask(layers, id, mask) {
|
|
3140
3232
|
const loc = requireLayer(layers, id);
|
|
3141
3233
|
requireUnlocked(loc.layer, "all", "change its mask");
|
|
3142
|
-
return
|
|
3234
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, (l) => {
|
|
3143
3235
|
const next = { ...l };
|
|
3144
3236
|
if (mask) next.mask = mask;
|
|
3145
3237
|
else delete next.mask;
|
|
@@ -3178,7 +3270,7 @@ function requirePixelLayer(layers, id) {
|
|
|
3178
3270
|
function addLayerFilter(layers, id, filter) {
|
|
3179
3271
|
const layer = requirePixelLayer(layers, id);
|
|
3180
3272
|
if (_optionalChain([layer, 'access', _37 => _37.filters, 'optionalAccess', _38 => _38.some, 'call', _39 => _39((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
|
|
3181
|
-
return
|
|
3273
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
|
|
3182
3274
|
}
|
|
3183
3275
|
function updateLayerFilter(layers, id, filterId, changes) {
|
|
3184
3276
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -3189,7 +3281,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
|
|
|
3189
3281
|
const merged2 = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
|
|
3190
3282
|
const filters = [...layer.filters];
|
|
3191
3283
|
filters[i] = merged2;
|
|
3192
|
-
return
|
|
3284
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
|
|
3193
3285
|
}
|
|
3194
3286
|
function removeLayerFilter(layers, id, filterId) {
|
|
3195
3287
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -3198,7 +3290,7 @@ function removeLayerFilter(layers, id, filterId) {
|
|
|
3198
3290
|
const next = { ...layer };
|
|
3199
3291
|
if (filters.length) next.filters = filters;
|
|
3200
3292
|
else delete next.filters;
|
|
3201
|
-
return
|
|
3293
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3202
3294
|
}
|
|
3203
3295
|
function requireEffectLayer(layers, id, action) {
|
|
3204
3296
|
const layer = requireLayer(layers, id).layer;
|
|
@@ -3213,7 +3305,7 @@ function guard(fn) {
|
|
|
3213
3305
|
try {
|
|
3214
3306
|
return fn();
|
|
3215
3307
|
} catch (e) {
|
|
3216
|
-
if (e instanceof
|
|
3308
|
+
if (e instanceof _chunkDFFBJV3Ucjs.LayerEffectError) fail(e.message);
|
|
3217
3309
|
throw e;
|
|
3218
3310
|
}
|
|
3219
3311
|
}
|
|
@@ -3221,20 +3313,20 @@ function setLayerEffects(layers, id, effects) {
|
|
|
3221
3313
|
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
3222
3314
|
const next = { ...layer };
|
|
3223
3315
|
if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
|
|
3224
|
-
guard(() =>
|
|
3316
|
+
guard(() => _chunkDFFBJV3Ucjs.validateLayerEffects.call(void 0, effects));
|
|
3225
3317
|
next.effects = effects;
|
|
3226
3318
|
} else delete next.effects;
|
|
3227
|
-
return
|
|
3319
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3228
3320
|
}
|
|
3229
3321
|
function addLayerEffect(layers, id, kind, params = {}, index) {
|
|
3230
|
-
if (!
|
|
3322
|
+
if (!_chunkDFFBJV3Ucjs.isLayerEffectKind.call(void 0, kind)) fail(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkDFFBJV3Ucjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
3231
3323
|
const layer = requireEffectLayer(layers, id, "add effects");
|
|
3232
3324
|
const current = layerEffectsOf(layer);
|
|
3233
3325
|
const ids = new Set(current.items.map((e) => e.id));
|
|
3234
|
-
let effectId =
|
|
3235
|
-
while (ids.has(effectId)) effectId =
|
|
3326
|
+
let effectId = _chunkDFFBJV3Ucjs.newEffectId.call(void 0, );
|
|
3327
|
+
while (ids.has(effectId)) effectId = _chunkDFFBJV3Ucjs.newEffectId.call(void 0, );
|
|
3236
3328
|
const { id: _ignored, kind: _kind, ...rest } = params;
|
|
3237
|
-
const effect = guard(() =>
|
|
3329
|
+
const effect = guard(() => _chunkDFFBJV3Ucjs.mergeLayerEffect.call(void 0, _chunkDFFBJV3Ucjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
|
|
3238
3330
|
const items = [...current.items];
|
|
3239
3331
|
const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
|
|
3240
3332
|
items.splice(at, 0, effect);
|
|
@@ -3251,7 +3343,7 @@ function updateLayerEffect(layers, id, effectId, changes) {
|
|
|
3251
3343
|
const i = requireEffect(layer, effectId);
|
|
3252
3344
|
const current = layer.effects;
|
|
3253
3345
|
const items = [...current.items];
|
|
3254
|
-
items[i] = guard(() =>
|
|
3346
|
+
items[i] = guard(() => _chunkDFFBJV3Ucjs.mergeLayerEffect.call(void 0, items[i], changes));
|
|
3255
3347
|
return setLayerEffects(layers, id, { ...current, items });
|
|
3256
3348
|
}
|
|
3257
3349
|
function removeLayerEffect(layers, id, effectId) {
|
|
@@ -3286,7 +3378,7 @@ function unionRect(a, b) {
|
|
|
3286
3378
|
}
|
|
3287
3379
|
|
|
3288
3380
|
// src/image-editor/layers/shape.ts
|
|
3289
|
-
var SHAPE_RENDER_MARGIN =
|
|
3381
|
+
var SHAPE_RENDER_MARGIN = _chunkDFFBJV3Ucjs.MAX_EFFECT_REACH;
|
|
3290
3382
|
var DEFAULT_MITER_LIMIT = 100;
|
|
3291
3383
|
var fail2 = (message) => {
|
|
3292
3384
|
throw new LayerOperationError(message);
|
|
@@ -3502,11 +3594,11 @@ function fillCoverage(geo, rect, rule, inverted = false) {
|
|
|
3502
3594
|
function paintContext(env) {
|
|
3503
3595
|
const tiles = /* @__PURE__ */ new Map();
|
|
3504
3596
|
return {
|
|
3505
|
-
light:
|
|
3597
|
+
light: _chunkDFFBJV3Ucjs.DEFAULT_GLOBAL_LIGHT,
|
|
3506
3598
|
pattern: (id) => {
|
|
3507
3599
|
if (tiles.has(id)) return tiles.get(id);
|
|
3508
|
-
const p = _nullishCoalesce(_optionalChain([env, 'access', _44 => _44.pattern, 'optionalCall', _45 => _45(id)]), () => (
|
|
3509
|
-
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0,
|
|
3600
|
+
const p = _nullishCoalesce(_optionalChain([env, 'access', _44 => _44.pattern, 'optionalCall', _45 => _45(id)]), () => ( _chunkDFFBJV3Ucjs.builtinPattern.call(void 0, id)));
|
|
3601
|
+
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkDFFBJV3Ucjs.PatternTile)(p) : null;
|
|
3510
3602
|
tiles.set(id, t);
|
|
3511
3603
|
return t;
|
|
3512
3604
|
}
|
|
@@ -3537,9 +3629,9 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
|
|
|
3537
3629
|
if (!fCov && !sCov) return null;
|
|
3538
3630
|
const canvas = { x: 0, y: 0, width: env.width, height: env.height };
|
|
3539
3631
|
const anchor = { x: geo.frame.x, y: geo.frame.y };
|
|
3540
|
-
const fc = fCov ?
|
|
3632
|
+
const fc = fCov ? _chunkDFFBJV3Ucjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
3541
3633
|
const fo = _nullishCoalesce(_optionalChain([layer, 'access', _46 => _46.fill, 'optionalAccess', _47 => _47.opacity]), () => ( 1));
|
|
3542
|
-
const sc = sCov ?
|
|
3634
|
+
const sc = sCov ? _chunkDFFBJV3Ucjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
3543
3635
|
const so = _nullishCoalesce(_optionalChain([layer, 'access', _48 => _48.stroke, 'optionalAccess', _49 => _49.paint, 'access', _50 => _50.opacity]), () => ( 1));
|
|
3544
3636
|
const out = new Uint8ClampedArray(n * 4);
|
|
3545
3637
|
let any = false;
|
|
@@ -3632,9 +3724,9 @@ function normalizeShapePaint(v, path = "paint") {
|
|
|
3632
3724
|
offset: _nullishCoalesce(g.offset, () => ( { x: 0, y: 0 }))
|
|
3633
3725
|
};
|
|
3634
3726
|
try {
|
|
3635
|
-
|
|
3727
|
+
_chunkDFFBJV3Ucjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
|
|
3636
3728
|
} catch (e) {
|
|
3637
|
-
if (e instanceof
|
|
3729
|
+
if (e instanceof _chunkDFFBJV3Ucjs.LayerEffectError) fail2(e.message);
|
|
3638
3730
|
throw e;
|
|
3639
3731
|
}
|
|
3640
3732
|
if (gradient.stops.length < 1) fail2(`${path}.gradient.stops needs at least one { position, color }.`);
|
|
@@ -3846,7 +3938,7 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
3846
3938
|
if (!("annotation" in patch)) delete next.annotation;
|
|
3847
3939
|
if (!next.components.length) fail2("A shape needs at least one component; delete the layer instead.");
|
|
3848
3940
|
const rendered = rerenderShape(next, env);
|
|
3849
|
-
return { layers:
|
|
3941
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
3850
3942
|
}
|
|
3851
3943
|
function transformShapeComponents(components, f, affine) {
|
|
3852
3944
|
return components.map((c) => {
|
|
@@ -3877,7 +3969,7 @@ function shapeAsPixelLayer(layer) {
|
|
|
3877
3969
|
}
|
|
3878
3970
|
function annotationPaint(color, opacity) {
|
|
3879
3971
|
const c = parseCssColor(color);
|
|
3880
|
-
if (!c || !
|
|
3972
|
+
if (!c || !_chunkDFFBJV3Ucjs.parseEffectColor.call(void 0, c.hex)) return void 0;
|
|
3881
3973
|
const a = c.alpha * opacity;
|
|
3882
3974
|
return a !== 1 ? { type: "color", color: c.hex, opacity: a } : { type: "color", color: c.hex };
|
|
3883
3975
|
}
|
|
@@ -3958,7 +4050,7 @@ function annotationOfShape(layer) {
|
|
|
3958
4050
|
var fail3 = (message) => {
|
|
3959
4051
|
throw new LayerOperationError(message);
|
|
3960
4052
|
};
|
|
3961
|
-
var TEXT_RENDER_MARGIN =
|
|
4053
|
+
var TEXT_RENDER_MARGIN = _chunkDFFBJV3Ucjs.MAX_EFFECT_REACH;
|
|
3962
4054
|
function textMatrix(layer) {
|
|
3963
4055
|
return _nullishCoalesce(layer.transform, () => ( _chunkVYW7JBTMcjs.IDENTITY_MATRIX));
|
|
3964
4056
|
}
|
|
@@ -4244,7 +4336,7 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4244
4336
|
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkVYW7JBTMcjs.styleAt.call(void 0, current.runs, 0, _chunkVYW7JBTMcjs.DEFAULT_TEXT_STYLE) }];
|
|
4245
4337
|
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkVYW7JBTMcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4246
4338
|
const rendered = rerenderText(next, env);
|
|
4247
|
-
return { layers:
|
|
4339
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
4248
4340
|
}
|
|
4249
4341
|
function replaceTextRange(layer, start, end, insert) {
|
|
4250
4342
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
@@ -4617,23 +4709,23 @@ function isTransformAnchor(value) {
|
|
|
4617
4709
|
return typeof value === "string" && value in ANCHOR_FRACTION;
|
|
4618
4710
|
}
|
|
4619
4711
|
function identityTransform(box2) {
|
|
4620
|
-
return { box: { ...box2 }, corners:
|
|
4712
|
+
return { box: { ...box2 }, corners: _chunkMUUXNRU4cjs.boxQuad.call(void 0, box2) };
|
|
4621
4713
|
}
|
|
4622
4714
|
function cornersFromMatrix(box2, m) {
|
|
4623
|
-
const q2 =
|
|
4715
|
+
const q2 = _chunkMUUXNRU4cjs.boxQuad.call(void 0, box2);
|
|
4624
4716
|
return [_chunkVYW7JBTMcjs.applyMatrix.call(void 0, m, q2[0]), _chunkVYW7JBTMcjs.applyMatrix.call(void 0, m, q2[1]), _chunkVYW7JBTMcjs.applyMatrix.call(void 0, m, q2[2]), _chunkVYW7JBTMcjs.applyMatrix.call(void 0, m, q2[3])];
|
|
4625
4717
|
}
|
|
4626
4718
|
function matrixFromCorners(box2, corners, eps = 1e-6) {
|
|
4627
4719
|
const [tl, tr, br, bl] = corners;
|
|
4628
4720
|
const size = 1 + Math.max(box2.width, box2.height);
|
|
4629
4721
|
if (Math.abs(tl.x + br.x - tr.x - bl.x) > eps * size || Math.abs(tl.y + br.y - tr.y - bl.y) > eps * size) return null;
|
|
4630
|
-
const h =
|
|
4631
|
-
return h ?
|
|
4722
|
+
const h = _chunkMUUXNRU4cjs.rectToQuad.call(void 0, box2, corners);
|
|
4723
|
+
return h ? _chunkMUUXNRU4cjs.affineFromHomography.call(void 0, h, 1e-9) : null;
|
|
4632
4724
|
}
|
|
4633
4725
|
function transformHomography(geometry) {
|
|
4634
|
-
const h =
|
|
4726
|
+
const h = _chunkMUUXNRU4cjs.rectToQuad.call(void 0, geometry.box, geometry.corners);
|
|
4635
4727
|
if (!h) return null;
|
|
4636
|
-
return
|
|
4728
|
+
return _chunkMUUXNRU4cjs.homographyKeepsQuad.call(void 0, h, _chunkMUUXNRU4cjs.boxQuad.call(void 0, geometry.box)) ? h : null;
|
|
4637
4729
|
}
|
|
4638
4730
|
function hasWarp(geometry) {
|
|
4639
4731
|
const w = geometry.warp;
|
|
@@ -4644,7 +4736,7 @@ function hasWarp(geometry) {
|
|
|
4644
4736
|
}
|
|
4645
4737
|
function isIdentityTransform(geometry) {
|
|
4646
4738
|
if (hasWarp(geometry)) return false;
|
|
4647
|
-
const q2 =
|
|
4739
|
+
const q2 = _chunkMUUXNRU4cjs.boxQuad.call(void 0, geometry.box);
|
|
4648
4740
|
return geometry.corners.every((c, i) => Math.abs(c.x - q2[i].x) < 1e-6 && Math.abs(c.y - q2[i].y) < 1e-6);
|
|
4649
4741
|
}
|
|
4650
4742
|
function transformMap(geometry) {
|
|
@@ -4652,8 +4744,8 @@ function transformMap(geometry) {
|
|
|
4652
4744
|
if (!h) return null;
|
|
4653
4745
|
const { box: box2 } = geometry;
|
|
4654
4746
|
const warp = hasWarp(geometry) ? geometry.warp : null;
|
|
4655
|
-
if (!warp) return (p) =>
|
|
4656
|
-
return (p) =>
|
|
4747
|
+
if (!warp) return (p) => _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, p);
|
|
4748
|
+
return (p) => _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, _chunkVYW7JBTMcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
|
|
4657
4749
|
}
|
|
4658
4750
|
function transformedPoint(geometry, fx, fy) {
|
|
4659
4751
|
const f = transformMap(geometry);
|
|
@@ -4662,9 +4754,9 @@ function transformedPoint(geometry, fx, fy) {
|
|
|
4662
4754
|
}
|
|
4663
4755
|
function anchorPoint(geometry, anchor) {
|
|
4664
4756
|
const [fx, fy] = ANCHOR_FRACTION[anchor];
|
|
4665
|
-
const h =
|
|
4757
|
+
const h = _chunkMUUXNRU4cjs.rectToQuad.call(void 0, geometry.box, geometry.corners);
|
|
4666
4758
|
const p = { x: geometry.box.x + fx * geometry.box.width, y: geometry.box.y + fy * geometry.box.height };
|
|
4667
|
-
return _nullishCoalesce((h &&
|
|
4759
|
+
return _nullishCoalesce((h && _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, p)), () => ( p));
|
|
4668
4760
|
}
|
|
4669
4761
|
function transformedBox(geometry) {
|
|
4670
4762
|
const f = transformMap(geometry);
|
|
@@ -4705,8 +4797,8 @@ function describeTransform(geometry, reference = "center") {
|
|
|
4705
4797
|
const ref = referencePoint(geometry.box, reference);
|
|
4706
4798
|
const bounds = transformedBox(geometry);
|
|
4707
4799
|
if (!m) {
|
|
4708
|
-
const h =
|
|
4709
|
-
const at2 = _nullishCoalesce((h &&
|
|
4800
|
+
const h = _chunkMUUXNRU4cjs.rectToQuad.call(void 0, geometry.box, geometry.corners);
|
|
4801
|
+
const at2 = _nullishCoalesce((h && _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, ref)), () => ( ref));
|
|
4710
4802
|
return { affine: false, scaleX: 100, scaleY: 100, rotate: 0, skewX: 0, x: at2.x, y: at2.y, bounds, corners: geometry.corners };
|
|
4711
4803
|
}
|
|
4712
4804
|
const [a, b, c, d] = m;
|
|
@@ -4754,14 +4846,14 @@ function isValidWarp(mesh) {
|
|
|
4754
4846
|
}
|
|
4755
4847
|
function geometryHomography(geometry) {
|
|
4756
4848
|
const m = matrixFromCorners(geometry.box, geometry.corners);
|
|
4757
|
-
return m ?
|
|
4849
|
+
return m ? _chunkMUUXNRU4cjs.homographyFromAffine.call(void 0, m) : transformHomography(geometry);
|
|
4758
4850
|
}
|
|
4759
4851
|
|
|
4760
4852
|
// src/image-editor/layers/smart.ts
|
|
4761
4853
|
var fail4 = (message) => {
|
|
4762
4854
|
throw new LayerOperationError(message);
|
|
4763
4855
|
};
|
|
4764
|
-
var SMART_RENDER_MARGIN =
|
|
4856
|
+
var SMART_RENDER_MARGIN = _chunkDFFBJV3Ucjs.MAX_EFFECT_REACH;
|
|
4765
4857
|
function newContentsId() {
|
|
4766
4858
|
return newLayerId("so");
|
|
4767
4859
|
}
|
|
@@ -4772,7 +4864,7 @@ function placementGeometry(layer) {
|
|
|
4772
4864
|
return { box: contentsBox(layer.contents), corners: layer.placement.corners, warp: _nullishCoalesce(layer.placement.warp, () => ( null)) };
|
|
4773
4865
|
}
|
|
4774
4866
|
function placementAt(contents, x, y) {
|
|
4775
|
-
return { corners:
|
|
4867
|
+
return { corners: _chunkMUUXNRU4cjs.boxQuad.call(void 0, { x, y, width: contents.width, height: contents.height }) };
|
|
4776
4868
|
}
|
|
4777
4869
|
function isContentsDecoded(contents) {
|
|
4778
4870
|
return contents.kind === "raster" ? Boolean(contents.raster) : Boolean(contents.document);
|
|
@@ -4827,7 +4919,7 @@ function placementKey(p, canvas) {
|
|
|
4827
4919
|
function integerMove(layer) {
|
|
4828
4920
|
const g = placementGeometry(layer);
|
|
4829
4921
|
if (hasWarp(g)) return null;
|
|
4830
|
-
const q2 =
|
|
4922
|
+
const q2 = _chunkMUUXNRU4cjs.boxQuad.call(void 0, g.box);
|
|
4831
4923
|
const dx = g.corners[0].x - q2[0].x;
|
|
4832
4924
|
const dy = g.corners[0].y - q2[0].y;
|
|
4833
4925
|
if (Math.abs(dx - Math.round(dx)) > 1e-9 || Math.abs(dy - Math.round(dy)) > 1e-9) return null;
|
|
@@ -4868,7 +4960,7 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4868
4960
|
k = step;
|
|
4869
4961
|
let r = _optionalChain([options, 'access', _84 => _84.reduced, 'optionalAccess', _85 => _85.get, 'call', _86 => _86(k)]);
|
|
4870
4962
|
if (!r) {
|
|
4871
|
-
r =
|
|
4963
|
+
r = _chunkDFFBJV3Ucjs.reduceSurface.call(void 0, src, k);
|
|
4872
4964
|
_optionalChain([options, 'access', _87 => _87.reduced, 'optionalAccess', _88 => _88.set, 'call', _89 => _89(k, r)]);
|
|
4873
4965
|
}
|
|
4874
4966
|
source = r;
|
|
@@ -4878,15 +4970,15 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4878
4970
|
if (hasWarp(g)) {
|
|
4879
4971
|
const f = transformMap(g);
|
|
4880
4972
|
if (!f) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
|
|
4881
|
-
out =
|
|
4973
|
+
out = _chunkDFFBJV3Ucjs.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 });
|
|
4882
4974
|
} else {
|
|
4883
4975
|
const h = transformHomography(g);
|
|
4884
4976
|
if (!h) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
|
|
4885
|
-
const hk =
|
|
4886
|
-
out =
|
|
4977
|
+
const hk = _chunkMUUXNRU4cjs.multiplyHomographies.call(void 0, [k, 0, 0, 0, k, 0, 0, 0, 1], h);
|
|
4978
|
+
out = _chunkDFFBJV3Ucjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
|
|
4887
4979
|
}
|
|
4888
4980
|
} catch (e) {
|
|
4889
|
-
if (e instanceof
|
|
4981
|
+
if (e instanceof _chunkDFFBJV3Ucjs.TransformTooLargeError) fail4(e.message);
|
|
4890
4982
|
throw e;
|
|
4891
4983
|
}
|
|
4892
4984
|
}
|
|
@@ -4918,7 +5010,7 @@ function filterMaskCoverage(mask, canvas) {
|
|
|
4918
5010
|
}
|
|
4919
5011
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
4920
5012
|
if (all && !(feather > 0)) return null;
|
|
4921
|
-
if (feather > 0) v =
|
|
5013
|
+
if (feather > 0) v = _chunkDFFBJV3Ucjs.gaussianBlur.call(void 0, v, W, H, feather, "clamp");
|
|
4922
5014
|
const density = _nullishCoalesce(mask.density, () => ( 1));
|
|
4923
5015
|
if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
|
|
4924
5016
|
return v;
|
|
@@ -4940,7 +5032,7 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4940
5032
|
if (f.opacity >= 1) acc = out;
|
|
4941
5033
|
else lerpInto(acc, out, f.opacity, null);
|
|
4942
5034
|
} else {
|
|
4943
|
-
|
|
5035
|
+
_chunkDFFBJV3Ucjs.blendTile.call(void 0, acc, out, f.blend, f.opacity, null);
|
|
4944
5036
|
}
|
|
4945
5037
|
}
|
|
4946
5038
|
entry = { key, base, filtered: acc };
|
|
@@ -4987,7 +5079,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4987
5079
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4988
5080
|
}
|
|
4989
5081
|
if (raw.interpolation !== void 0) {
|
|
4990
|
-
if (!
|
|
5082
|
+
if (!_chunkDFFBJV3Ucjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
|
|
4991
5083
|
if (raw.interpolation !== "bicubic") out.interpolation = raw.interpolation;
|
|
4992
5084
|
}
|
|
4993
5085
|
const g = { box: { x: 0, y: 0, width: contents.width, height: contents.height }, corners: out.corners, warp: _nullishCoalesce(out.warp, () => ( null)) };
|
|
@@ -5004,10 +5096,10 @@ function followMask(mask, before, after) {
|
|
|
5004
5096
|
const h0 = placementHomography(before);
|
|
5005
5097
|
const h1 = placementHomography(after);
|
|
5006
5098
|
if (!h0 || !h1) return mask;
|
|
5007
|
-
const inv =
|
|
5099
|
+
const inv = _chunkMUUXNRU4cjs.invertHomography.call(void 0, h0);
|
|
5008
5100
|
if (!inv) return mask;
|
|
5009
|
-
const delta =
|
|
5010
|
-
const surface =
|
|
5101
|
+
const delta = _chunkMUUXNRU4cjs.multiplyHomographies.call(void 0, inv, h1);
|
|
5102
|
+
const surface = _chunkDFFBJV3Ucjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
|
|
5011
5103
|
return { ...mask, surface };
|
|
5012
5104
|
}
|
|
5013
5105
|
function setSmartPlacement(layers, id, placement, canvas) {
|
|
@@ -5028,7 +5120,7 @@ function setSmartPlacement(layers, id, placement, canvas) {
|
|
|
5028
5120
|
next.smartFilters = { ...next.smartFilters, mask: m };
|
|
5029
5121
|
}
|
|
5030
5122
|
next = rerender(next, canvas, "be transformed");
|
|
5031
|
-
return { layers:
|
|
5123
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
|
|
5032
5124
|
}
|
|
5033
5125
|
function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
5034
5126
|
const layer = requireSmartObject(layers, id);
|
|
@@ -5050,7 +5142,7 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
|
5050
5142
|
} else {
|
|
5051
5143
|
next = rerender(next, canvas, "move");
|
|
5052
5144
|
}
|
|
5053
|
-
return
|
|
5145
|
+
return _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next);
|
|
5054
5146
|
}
|
|
5055
5147
|
function translateLayer(layer, dx, dy) {
|
|
5056
5148
|
if (!dx && !dy) return layer;
|
|
@@ -5118,7 +5210,7 @@ function layerExtent(layer, surfaceOf, canvas) {
|
|
|
5118
5210
|
} else {
|
|
5119
5211
|
b = full;
|
|
5120
5212
|
}
|
|
5121
|
-
const m =
|
|
5213
|
+
const m = _chunkDFFBJV3Ucjs.effectsMargin.call(void 0, layer.effects);
|
|
5122
5214
|
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) };
|
|
5123
5215
|
return b;
|
|
5124
5216
|
}
|
|
@@ -5187,7 +5279,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
5187
5279
|
delete resolved.source;
|
|
5188
5280
|
layer = resolved;
|
|
5189
5281
|
}
|
|
5190
|
-
if (
|
|
5282
|
+
if (_chunkDFFBJV3Ucjs.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.`);
|
|
5191
5283
|
return translateLayer(layer, -b.x, -b.y);
|
|
5192
5284
|
});
|
|
5193
5285
|
if (nested[0].clipped) {
|
|
@@ -5214,8 +5306,8 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
5214
5306
|
smart = { ...smart, surface: renderSmartObject(smart, canvas) };
|
|
5215
5307
|
const below = ordered.filter((l) => l.index < top.index).length;
|
|
5216
5308
|
let out = layers;
|
|
5217
|
-
for (const l of ordered) out =
|
|
5218
|
-
return { layers:
|
|
5309
|
+
for (const l of ordered) out = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
5310
|
+
return { layers: _chunkDFFBJV3Ucjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
|
|
5219
5311
|
}
|
|
5220
5312
|
function rasterizeSmartObject(layers, id) {
|
|
5221
5313
|
const layer = requireSmartObject(layers, id);
|
|
@@ -5235,7 +5327,7 @@ function rasterizeSmartObject(layers, id) {
|
|
|
5235
5327
|
if (layer.locks) out.locks = layer.locks;
|
|
5236
5328
|
if (layer.effects) out.effects = layer.effects;
|
|
5237
5329
|
if (layer.fillOpacity !== void 0) out.fillOpacity = layer.fillOpacity;
|
|
5238
|
-
return { layers:
|
|
5330
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
|
|
5239
5331
|
}
|
|
5240
5332
|
function copySmartObject(layers, id, linked, name) {
|
|
5241
5333
|
const loc = requireLayer(layers, id);
|
|
@@ -5245,19 +5337,19 @@ function copySmartObject(layers, id, linked, name) {
|
|
|
5245
5337
|
delete copy.psd;
|
|
5246
5338
|
if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
|
|
5247
5339
|
if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
|
|
5248
|
-
return { layers:
|
|
5340
|
+
return { layers: _chunkDFFBJV3Ucjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _114 => _114.parent, 'optionalAccess', _115 => _115.id]), () => ( null)), loc.index + 1), layer: copy };
|
|
5249
5341
|
}
|
|
5250
5342
|
function instancesOf(layers, contentsId) {
|
|
5251
|
-
return
|
|
5343
|
+
return _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
|
|
5252
5344
|
}
|
|
5253
5345
|
function replaceContents(layers, contentsId, contents, canvas) {
|
|
5254
5346
|
const ids = instancesOf(layers, contentsId);
|
|
5255
5347
|
if (!ids.length) fail4(`No smart object uses contents "${contentsId}".`);
|
|
5256
|
-
for (const id of ids) requireUnlocked(
|
|
5348
|
+
for (const id of ids) requireUnlocked(_chunkDFFBJV3Ucjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
|
|
5257
5349
|
const next = { ...contents, id: contentsId };
|
|
5258
5350
|
let out = layers;
|
|
5259
5351
|
for (const id of ids) {
|
|
5260
|
-
out =
|
|
5352
|
+
out = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, out, id, (l) => {
|
|
5261
5353
|
const layer = l;
|
|
5262
5354
|
return rerender({ ...layer, contents: next, placement: refitPlacement(layer, next) }, canvas, "take the new contents");
|
|
5263
5355
|
});
|
|
@@ -5274,8 +5366,8 @@ function refitPlacement(layer, contents) {
|
|
|
5274
5366
|
const h = transformHomography(g);
|
|
5275
5367
|
if (!h) return placementAt(contents, 0, 0);
|
|
5276
5368
|
const shift = [1, 0, (W0 - W1) / 2, 0, 1, (H0 - H1) / 2, 0, 0, 1];
|
|
5277
|
-
const hn =
|
|
5278
|
-
const pts =
|
|
5369
|
+
const hn = _chunkMUUXNRU4cjs.multiplyHomographies.call(void 0, shift, h);
|
|
5370
|
+
const pts = _chunkMUUXNRU4cjs.boxQuad.call(void 0, { x: 0, y: 0, width: W1, height: H1 }).map((p) => {
|
|
5279
5371
|
const w = hn[6] * p.x + hn[7] * p.y + hn[8];
|
|
5280
5372
|
return { x: (hn[0] * p.x + hn[1] * p.y + hn[2]) / w, y: (hn[3] * p.x + hn[4] * p.y + hn[5]) / w };
|
|
5281
5373
|
});
|
|
@@ -5320,7 +5412,7 @@ function addSmartFilter(layers, id, filter, canvas, index) {
|
|
|
5320
5412
|
const at = index === void 0 ? filters.length : Math.max(0, Math.min(filters.length, Math.floor(index)));
|
|
5321
5413
|
filters.splice(at, 0, filter);
|
|
5322
5414
|
const next = withStack(layer, { ...stack, filters }, canvas);
|
|
5323
|
-
return { layers:
|
|
5415
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
|
|
5324
5416
|
}
|
|
5325
5417
|
function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
5326
5418
|
const layer = editableSmart(layers, id);
|
|
@@ -5342,7 +5434,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
|
5342
5434
|
const filters = [...layer.smartFilters.filters];
|
|
5343
5435
|
filters[i] = merged2;
|
|
5344
5436
|
const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
|
|
5345
|
-
return { layers:
|
|
5437
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
|
|
5346
5438
|
}
|
|
5347
5439
|
function removeSmartFilter(layers, id, filterId, canvas) {
|
|
5348
5440
|
const layer = editableSmart(layers, id);
|
|
@@ -5350,7 +5442,7 @@ function removeSmartFilter(layers, id, filterId, canvas) {
|
|
|
5350
5442
|
const stack = layer.smartFilters;
|
|
5351
5443
|
const filters = stack.filters.filter((f) => f.id !== filterId);
|
|
5352
5444
|
const next = withStack(layer, filters.length ? { ...stack, filters } : stack.enabled ? void 0 : { enabled: false, filters }, canvas);
|
|
5353
|
-
return { layers:
|
|
5445
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5354
5446
|
}
|
|
5355
5447
|
function moveSmartFilter(layers, id, filterId, index, canvas) {
|
|
5356
5448
|
const layer = editableSmart(layers, id);
|
|
@@ -5361,12 +5453,12 @@ function moveSmartFilter(layers, id, filterId, index, canvas) {
|
|
|
5361
5453
|
const [f] = filters.splice(i, 1);
|
|
5362
5454
|
filters.splice(index, 0, f);
|
|
5363
5455
|
const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
|
|
5364
|
-
return { layers:
|
|
5456
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5365
5457
|
}
|
|
5366
5458
|
function setSmartFiltersEnabled(layers, id, enabled, canvas) {
|
|
5367
5459
|
const layer = editableSmart(layers, id);
|
|
5368
5460
|
const next = withStack(layer, { ...stackOf(layer), enabled: Boolean(enabled) }, canvas);
|
|
5369
|
-
return { layers:
|
|
5461
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5370
5462
|
}
|
|
5371
5463
|
function setSmartFilterMask(layers, id, mask, canvas) {
|
|
5372
5464
|
const layer = editableSmart(layers, id);
|
|
@@ -5375,7 +5467,7 @@ function setSmartFilterMask(layers, id, mask, canvas) {
|
|
|
5375
5467
|
if (mask) stack.mask = mask;
|
|
5376
5468
|
else delete stack.mask;
|
|
5377
5469
|
const next = withStack(layer, stack, canvas);
|
|
5378
|
-
return { layers:
|
|
5470
|
+
return { layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5379
5471
|
}
|
|
5380
5472
|
function withFilterMaskSurface(layer, surface, canvas) {
|
|
5381
5473
|
const stack = stackOf(layer);
|
|
@@ -5389,7 +5481,7 @@ function placementBounds(layer) {
|
|
|
5389
5481
|
// src/image-editor/layers/serialize.ts
|
|
5390
5482
|
var LAYERED_SCHEMA_VERSION = 3;
|
|
5391
5483
|
function serializePatterns(patterns) {
|
|
5392
|
-
return patterns.map((p) => ({ id: p.id, name: p.name, png:
|
|
5484
|
+
return patterns.map((p) => ({ id: p.id, name: p.name, png: _chunkDCLJNVZScjs.pngDataUrl.call(void 0, p.width, p.height, p.data) }));
|
|
5393
5485
|
}
|
|
5394
5486
|
function deserializePatterns(raw, problems = []) {
|
|
5395
5487
|
if (!Array.isArray(raw)) return [];
|
|
@@ -5412,7 +5504,7 @@ function encodeSurface(surface) {
|
|
|
5412
5504
|
let out = null;
|
|
5413
5505
|
if (b) {
|
|
5414
5506
|
const data = _chunk7ISPWEJAcjs.readRegion.call(void 0, surface, b);
|
|
5415
|
-
out = { url:
|
|
5507
|
+
out = { url: _chunkDCLJNVZScjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
|
|
5416
5508
|
}
|
|
5417
5509
|
encodedCache.set(surface, out);
|
|
5418
5510
|
return out;
|
|
@@ -5429,7 +5521,7 @@ function encodeDeepSurface(surface) {
|
|
|
5429
5521
|
const view = new DataView(bytes.buffer);
|
|
5430
5522
|
if (samples instanceof Uint16Array) for (let i = 0; i < samples.length; i++) view.setUint16(2 * i, samples[i], true);
|
|
5431
5523
|
else for (let i = 0; i < samples.length; i++) view.setFloat32(4 * i, samples[i], true);
|
|
5432
|
-
out = { depth, x: b.x, y: b.y, width: b.width, height: b.height, data:
|
|
5524
|
+
out = { depth, x: b.x, y: b.y, width: b.width, height: b.height, data: _chunkDCLJNVZScjs.bytesToBase64.call(void 0, _chunk643B2HKCcjs.deflate.call(void 0, bytes)) };
|
|
5433
5525
|
}
|
|
5434
5526
|
deepCache.set(surface, out);
|
|
5435
5527
|
return out;
|
|
@@ -5441,7 +5533,7 @@ function decodeDeepSurface(surface, raw, problems, label) {
|
|
|
5441
5533
|
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");
|
|
5442
5534
|
const n = d.width * d.height * surface.channels;
|
|
5443
5535
|
const size = d.depth === 16 ? 2 : 4;
|
|
5444
|
-
const bytes = _chunk643B2HKCcjs.inflate.call(void 0,
|
|
5536
|
+
const bytes = _chunk643B2HKCcjs.inflate.call(void 0, _chunkDCLJNVZScjs.base64ToBytes.call(void 0, d.data), { maxOutput: n * size });
|
|
5445
5537
|
if (bytes.length !== n * size) throw new Error("wrong length");
|
|
5446
5538
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
5447
5539
|
const samples = d.depth === 16 ? new Uint16Array(n) : new Float32Array(n);
|
|
@@ -5470,7 +5562,7 @@ function baseFields(layer, ctx) {
|
|
|
5470
5562
|
function serializeEffects(effects) {
|
|
5471
5563
|
const out = { enabled: effects.enabled, items: JSON.parse(JSON.stringify(effects.items)) };
|
|
5472
5564
|
if (effects.scale !== void 0 && effects.scale !== 1) out.scale = effects.scale;
|
|
5473
|
-
if (effects.psd) out.psd = { key: effects.psd.key, data:
|
|
5565
|
+
if (effects.psd) out.psd = { key: effects.psd.key, data: _chunkDCLJNVZScjs.bytesToBase64.call(void 0, effects.psd.data) };
|
|
5474
5566
|
return out;
|
|
5475
5567
|
}
|
|
5476
5568
|
function deserializeEffects(raw) {
|
|
@@ -5480,12 +5572,12 @@ function deserializeEffects(raw) {
|
|
|
5480
5572
|
const p = r.psd;
|
|
5481
5573
|
if (p && typeof p.key === "string" && typeof p.data === "string") {
|
|
5482
5574
|
try {
|
|
5483
|
-
psd = { key: p.key, data:
|
|
5575
|
+
psd = { key: p.key, data: _chunkDCLJNVZScjs.base64ToBytes.call(void 0, p.data) };
|
|
5484
5576
|
} catch (e7) {
|
|
5485
5577
|
psd = void 0;
|
|
5486
5578
|
}
|
|
5487
5579
|
}
|
|
5488
|
-
return
|
|
5580
|
+
return _chunkDFFBJV3Ucjs.normalizeLayerEffects.call(void 0, { ...r, psd });
|
|
5489
5581
|
}
|
|
5490
5582
|
function serializeMask(mask, hint, ctx) {
|
|
5491
5583
|
const out = { defaultValue: mask.defaultValue };
|
|
@@ -5568,8 +5660,8 @@ function serializeType(layer, base, ctx) {
|
|
|
5568
5660
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5569
5661
|
if (_optionalChain([layer, 'access', _123 => _123.psd, 'optionalAccess', _124 => _124.tySh]) || _optionalChain([layer, 'access', _125 => _125.psd, 'optionalAccess', _126 => _126.blocks, 'optionalAccess', _127 => _127.length])) {
|
|
5570
5662
|
out.psd = {};
|
|
5571
|
-
if (layer.psd.tySh) out.psd.tySh =
|
|
5572
|
-
if (_optionalChain([layer, 'access', _128 => _128.psd, 'access', _129 => _129.blocks, 'optionalAccess', _130 => _130.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data:
|
|
5663
|
+
if (layer.psd.tySh) out.psd.tySh = _chunkDCLJNVZScjs.bytesToBase64.call(void 0, layer.psd.tySh);
|
|
5664
|
+
if (_optionalChain([layer, 'access', _128 => _128.psd, 'access', _129 => _129.blocks, 'optionalAccess', _130 => _130.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkDCLJNVZScjs.bytesToBase64.call(void 0, b.data) }));
|
|
5573
5665
|
if (layer.psd.signature) out.psd.signature = layer.psd.signature;
|
|
5574
5666
|
}
|
|
5575
5667
|
return out;
|
|
@@ -5607,8 +5699,8 @@ function readType(r, base, ctx) {
|
|
|
5607
5699
|
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)) }));
|
|
5608
5700
|
if (r.psd && typeof r.psd === "object") {
|
|
5609
5701
|
const psd = {};
|
|
5610
|
-
if (typeof r.psd.tySh === "string") psd.tySh =
|
|
5611
|
-
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:
|
|
5702
|
+
if (typeof r.psd.tySh === "string") psd.tySh = _chunkDCLJNVZScjs.base64ToBytes.call(void 0, r.psd.tySh);
|
|
5703
|
+
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: _chunkDCLJNVZScjs.base64ToBytes.call(void 0, b.data) }));
|
|
5612
5704
|
if (typeof r.psd.signature === "string") psd.signature = r.psd.signature;
|
|
5613
5705
|
if (psd.tySh || _optionalChain([psd, 'access', _139 => _139.blocks, 'optionalAccess', _140 => _140.length])) layer.psd = psd;
|
|
5614
5706
|
}
|
|
@@ -5636,7 +5728,7 @@ function serializeShape(layer, base) {
|
|
|
5636
5728
|
if (layer.inverted) out.inverted = true;
|
|
5637
5729
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5638
5730
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5639
|
-
if (_optionalChain([layer, 'access', _145 => _145.psd, 'optionalAccess', _146 => _146.blocks, 'optionalAccess', _147 => _147.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data:
|
|
5731
|
+
if (_optionalChain([layer, 'access', _145 => _145.psd, 'optionalAccess', _146 => _146.blocks, 'optionalAccess', _147 => _147.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkDCLJNVZScjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
|
|
5640
5732
|
return out;
|
|
5641
5733
|
}
|
|
5642
5734
|
function readShape(r, base, ctx) {
|
|
@@ -5668,7 +5760,7 @@ function readShape(r, base, ctx) {
|
|
|
5668
5760
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) out.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
|
|
5669
5761
|
if (a && shapeFromAnnotation(a)) out.annotation = a;
|
|
5670
5762
|
if (r.psd && Array.isArray(r.psd.blocks)) {
|
|
5671
|
-
const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data:
|
|
5763
|
+
const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkDCLJNVZScjs.base64ToBytes.call(void 0, b.data) }));
|
|
5672
5764
|
if (blocks.length) out.psd = { blocks };
|
|
5673
5765
|
if (out.psd && typeof r.psd.signature === "string") out.psd.signature = r.psd.signature;
|
|
5674
5766
|
}
|
|
@@ -5681,7 +5773,7 @@ function readShape(r, base, ctx) {
|
|
|
5681
5773
|
function serializeSmartFilters(stack, layerId, ctx) {
|
|
5682
5774
|
const out = {
|
|
5683
5775
|
enabled: stack.enabled,
|
|
5684
|
-
filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data:
|
|
5776
|
+
filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data: _chunkDCLJNVZScjs.bytesToBase64.call(void 0, f.data) } : JSON.parse(JSON.stringify(f)))
|
|
5685
5777
|
};
|
|
5686
5778
|
if (stack.mask) out.mask = serializeMask(stack.mask, `${layerId}-filter-mask`, ctx);
|
|
5687
5779
|
return out;
|
|
@@ -5707,7 +5799,7 @@ function serializeSmartObject(layer, base, ctx) {
|
|
|
5707
5799
|
}
|
|
5708
5800
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5709
5801
|
if (layer.psd) {
|
|
5710
|
-
out.psd = { key: layer.psd.key, data:
|
|
5802
|
+
out.psd = { key: layer.psd.key, data: _chunkDCLJNVZScjs.bytesToBase64.call(void 0, layer.psd.data) };
|
|
5711
5803
|
if (layer.psd.placed) out.psd.placed = layer.psd.placed;
|
|
5712
5804
|
}
|
|
5713
5805
|
return out;
|
|
@@ -5719,7 +5811,7 @@ function serializeContents(c, ctx) {
|
|
|
5719
5811
|
if (enc) {
|
|
5720
5812
|
if (enc.x !== 0 || enc.y !== 0) {
|
|
5721
5813
|
const data = _chunk7ISPWEJAcjs.readRegion.call(void 0, c.raster, { x: 0, y: 0, width: c.width, height: c.height });
|
|
5722
|
-
out.asset = ctx.addAsset(
|
|
5814
|
+
out.asset = ctx.addAsset(_chunkDCLJNVZScjs.pngDataUrl.call(void 0, c.width, c.height, data, 4), `contents-${c.id}`);
|
|
5723
5815
|
} else out.asset = ctx.addAsset(enc.url, `contents-${c.id}`);
|
|
5724
5816
|
}
|
|
5725
5817
|
}
|
|
@@ -5728,7 +5820,7 @@ function serializeContents(c, ctx) {
|
|
|
5728
5820
|
if (c.document.globalLight) out.globalLight = { ...c.document.globalLight };
|
|
5729
5821
|
if (_optionalChain([c, 'access', _152 => _152.document, 'access', _153 => _153.patterns, 'optionalAccess', _154 => _154.length])) out.patterns = serializePatterns(c.document.patterns);
|
|
5730
5822
|
}
|
|
5731
|
-
if (c.file) out.file = { type: c.file.type, data:
|
|
5823
|
+
if (c.file) out.file = { type: c.file.type, data: _chunkDCLJNVZScjs.bytesToBase64.call(void 0, c.file.bytes) };
|
|
5732
5824
|
if (c.linked) out.linked = { path: c.linked.path };
|
|
5733
5825
|
return out;
|
|
5734
5826
|
}
|
|
@@ -5764,7 +5856,7 @@ async function serializeLayersExternal(layers, store) {
|
|
|
5764
5856
|
for (const [id, url] of Object.entries(inline.assets)) {
|
|
5765
5857
|
let ref = refs.get(url);
|
|
5766
5858
|
if (!ref) {
|
|
5767
|
-
const parsed =
|
|
5859
|
+
const parsed = _chunkDCLJNVZScjs.parseDataUrl.call(void 0, url);
|
|
5768
5860
|
const png = decodePngHeader(parsed.bytes);
|
|
5769
5861
|
ref = await store.put(new Blob([parsed.bytes], { type: "image/png" }), { id, width: png.width, height: png.height });
|
|
5770
5862
|
if (typeof ref !== "string" || !ref) throw new Error(`The asset store returned no reference for "${id}".`);
|
|
@@ -5792,7 +5884,7 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
5792
5884
|
try {
|
|
5793
5885
|
const blob = await store.get(ref);
|
|
5794
5886
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
5795
|
-
out[id] = `data:image/png;base64,${
|
|
5887
|
+
out[id] = `data:image/png;base64,${_chunkDCLJNVZScjs.bytesToBase64.call(void 0, bytes)}`;
|
|
5796
5888
|
} catch (err) {
|
|
5797
5889
|
problems.push(`Asset "${id}" (${ref}) could not be fetched: ${err.message}`);
|
|
5798
5890
|
}
|
|
@@ -5800,9 +5892,9 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
5800
5892
|
return out;
|
|
5801
5893
|
}
|
|
5802
5894
|
function decodePngDataUrl(url, channels) {
|
|
5803
|
-
const parsed =
|
|
5895
|
+
const parsed = _chunkDCLJNVZScjs.parseDataUrl.call(void 0, url);
|
|
5804
5896
|
if (!parsed) throw new Error("Asset is not a data URL.");
|
|
5805
|
-
const png =
|
|
5897
|
+
const png = _chunkDCLJNVZScjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
|
|
5806
5898
|
if (png.channels === channels) return png;
|
|
5807
5899
|
if (channels === 1) {
|
|
5808
5900
|
const out2 = new Uint8ClampedArray(png.width * png.height);
|
|
@@ -5977,7 +6069,7 @@ function readContents(id, ctx) {
|
|
|
5977
6069
|
const c = { id, name: typeof raw.name === "string" ? raw.name : "Contents", width, height, kind: raw.kind === "document" ? "document" : "raster" };
|
|
5978
6070
|
if (raw.file && typeof raw.file.type === "string" && typeof raw.file.data === "string") {
|
|
5979
6071
|
try {
|
|
5980
|
-
c.file = { type: raw.file.type, bytes:
|
|
6072
|
+
c.file = { type: raw.file.type, bytes: _chunkDCLJNVZScjs.base64ToBytes.call(void 0, raw.file.data) };
|
|
5981
6073
|
} catch (e9) {
|
|
5982
6074
|
ctx.problems.push(`Smart object contents "${c.name}": the embedded file could not be read`);
|
|
5983
6075
|
}
|
|
@@ -6012,7 +6104,7 @@ function readSmartFilters(raw, ctx, what) {
|
|
|
6012
6104
|
const opacity = num2(f.opacity, 0, 1, 1);
|
|
6013
6105
|
if (f.kind === "psd") {
|
|
6014
6106
|
try {
|
|
6015
|
-
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:
|
|
6107
|
+
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: _chunkDCLJNVZScjs.base64ToBytes.call(void 0, String(_nullishCoalesce(f.data, () => ( "")))), blend, opacity });
|
|
6016
6108
|
} catch (e10) {
|
|
6017
6109
|
ctx.problems.push(`${what}: a Photoshop smart filter could not be read`);
|
|
6018
6110
|
}
|
|
@@ -6038,7 +6130,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6038
6130
|
try {
|
|
6039
6131
|
const raw = { corners: p.corners };
|
|
6040
6132
|
if (p.warp && _chunkVYW7JBTMcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
6041
|
-
if (
|
|
6133
|
+
if (_chunkDFFBJV3Ucjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
6042
6134
|
placement = normalizePlacement(raw, contents);
|
|
6043
6135
|
} catch (e) {
|
|
6044
6136
|
ctx.problems.push(`${what}: its placement is invalid (${e instanceof Error ? e.message : String(e)}); it was placed at the top left`);
|
|
@@ -6050,7 +6142,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
6050
6142
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
|
|
6051
6143
|
if (r.psd && typeof r.psd.key === "string" && typeof r.psd.data === "string") {
|
|
6052
6144
|
try {
|
|
6053
|
-
layer.psd = { key: r.psd.key, data:
|
|
6145
|
+
layer.psd = { key: r.psd.key, data: _chunkDCLJNVZScjs.base64ToBytes.call(void 0, r.psd.data) };
|
|
6054
6146
|
if (typeof r.psd.placed === "string") layer.psd.placed = r.psd.placed;
|
|
6055
6147
|
} catch (e11) {
|
|
6056
6148
|
}
|
|
@@ -8607,14 +8699,14 @@ var toQuad = (p) => [
|
|
|
8607
8699
|
function cornersFromQuad(quad, frame, contents) {
|
|
8608
8700
|
if (quad.length !== 8 || !quad.every(Number.isFinite)) return null;
|
|
8609
8701
|
const q2 = toQuad(quad);
|
|
8610
|
-
const h =
|
|
8702
|
+
const h = _chunkMUUXNRU4cjs.rectToQuad.call(void 0, frame, q2);
|
|
8611
8703
|
if (!h) return null;
|
|
8612
|
-
const out =
|
|
8704
|
+
const out = _chunkMUUXNRU4cjs.boxQuad.call(void 0, { x: 0, y: 0, width: contents.width, height: contents.height }).map((p) => _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, p));
|
|
8613
8705
|
return out.every(Boolean) ? out : null;
|
|
8614
8706
|
}
|
|
8615
8707
|
function quadFromCorners(corners, frame, contents) {
|
|
8616
|
-
const h =
|
|
8617
|
-
const pts =
|
|
8708
|
+
const h = _chunkMUUXNRU4cjs.rectToQuad.call(void 0, { x: 0, y: 0, width: contents.width, height: contents.height }, corners);
|
|
8709
|
+
const pts = _chunkMUUXNRU4cjs.boxQuad.call(void 0, frame).map((p) => _nullishCoalesce((h ? _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, p) : p), () => ( p)));
|
|
8618
8710
|
return pts.flatMap((p) => [p.x, p.y]);
|
|
8619
8711
|
}
|
|
8620
8712
|
var PLACED_KEYS = ["SoLd", "SoLE", "PlLd"];
|
|
@@ -9871,7 +9963,7 @@ function recordEffects(ctx, rec, name, notes, group) {
|
|
|
9871
9963
|
}
|
|
9872
9964
|
for (const e of parsed.effects.items) {
|
|
9873
9965
|
for (const id of patternIds(e)) {
|
|
9874
|
-
if (ctx.patterns.has(id) ||
|
|
9966
|
+
if (ctx.patterns.has(id) || _chunkDFFBJV3Ucjs.builtinPattern.call(void 0, id)) continue;
|
|
9875
9967
|
ctx.warn.add("A pattern effect uses a pattern the file does not contain, and paints nothing", name);
|
|
9876
9968
|
notes.push(`pattern "${id}" is not in the file`);
|
|
9877
9969
|
}
|
|
@@ -10081,7 +10173,7 @@ function contentsFor(ctx, placed, name, notes) {
|
|
|
10081
10173
|
document: { layers: nested.layers, globalLight: nested.globalLight, patterns: nested.patterns.length ? nested.patterns : void 0 }
|
|
10082
10174
|
};
|
|
10083
10175
|
} else if (t.ext === "png") {
|
|
10084
|
-
const png =
|
|
10176
|
+
const png = _chunkDCLJNVZScjs.decodePng.call(void 0, file.bytes);
|
|
10085
10177
|
out = { ...base, kind: "raster", width: png.width, height: png.height, raster: _chunk7ISPWEJAcjs.surfaceFromPixels.call(void 0, png, 4, 0, 0) };
|
|
10086
10178
|
} else {
|
|
10087
10179
|
const size = _nullishCoalesce(placed.size, () => ( { width: 0, height: 0 }));
|
|
@@ -10147,7 +10239,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10147
10239
|
ctx.warn.add("A smart object without readable contents came in with its stored pixels as contents", name);
|
|
10148
10240
|
notes.push("contents missing");
|
|
10149
10241
|
}
|
|
10150
|
-
placement = { corners:
|
|
10242
|
+
placement = { corners: _chunkMUUXNRU4cjs.boxQuad.call(void 0, { x: rec.rect.left, y: rec.rect.top, width, height }) };
|
|
10151
10243
|
preview = true;
|
|
10152
10244
|
}
|
|
10153
10245
|
const layer = { type: "smart", id: ctx.newId(name), ...props, contents, placement, surface, offset: { x: 0, y: 0 } };
|
|
@@ -10424,34 +10516,34 @@ function blendOf(d, key, fallback, notes) {
|
|
|
10424
10516
|
function colorOf(d, fallback = "#000000") {
|
|
10425
10517
|
if (!d) return fallback;
|
|
10426
10518
|
const g = (k) => descNumber(d, k);
|
|
10427
|
-
if (g("redFloat") !== void 0) return
|
|
10519
|
+
if (g("redFloat") !== void 0) return _chunkDFFBJV3Ucjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
|
|
10428
10520
|
switch (d.classId) {
|
|
10429
10521
|
case "HSBC": {
|
|
10430
10522
|
const rgb = decodePsdColor(1, [(_nullishCoalesce(g("H "), () => ( 0))) / 360 * 65535, (_nullishCoalesce(g("Strt"), () => ( 0))) / 100 * 65535, (_nullishCoalesce(g("Brgh"), () => ( 0))) / 100 * 65535]);
|
|
10431
|
-
return rgb ?
|
|
10523
|
+
return rgb ? _chunkDFFBJV3Ucjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10432
10524
|
}
|
|
10433
10525
|
case "CMYC": {
|
|
10434
10526
|
const inv = (k) => (1 - (_nullishCoalesce(g(k), () => ( 0))) / 100) * 65535;
|
|
10435
10527
|
const rgb = decodePsdColor(2, [inv("Cyn "), inv("Mgnt"), inv("Ylw "), inv("Blck")]);
|
|
10436
|
-
return rgb ?
|
|
10528
|
+
return rgb ? _chunkDFFBJV3Ucjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10437
10529
|
}
|
|
10438
10530
|
case "LbCl": {
|
|
10439
10531
|
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]);
|
|
10440
|
-
return rgb ?
|
|
10532
|
+
return rgb ? _chunkDFFBJV3Ucjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10441
10533
|
}
|
|
10442
10534
|
case "Grsc": {
|
|
10443
10535
|
const v = 1 - (_nullishCoalesce(g("Gry "), () => ( 0))) / 100;
|
|
10444
|
-
return
|
|
10536
|
+
return _chunkDFFBJV3Ucjs.effectColorHex.call(void 0, [v, v, v]);
|
|
10445
10537
|
}
|
|
10446
10538
|
}
|
|
10447
10539
|
const r = g("Rd ");
|
|
10448
10540
|
const gr = g("Grn ");
|
|
10449
10541
|
const b = g("Bl ");
|
|
10450
10542
|
if (r === void 0 || gr === void 0 || b === void 0) return fallback;
|
|
10451
|
-
return
|
|
10543
|
+
return _chunkDFFBJV3Ucjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
|
|
10452
10544
|
}
|
|
10453
10545
|
function colorDesc(hex) {
|
|
10454
|
-
const [r, g, b] = _nullishCoalesce(
|
|
10546
|
+
const [r, g, b] = _nullishCoalesce(_chunkDFFBJV3Ucjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
|
|
10455
10547
|
return descriptor("RGBC", [
|
|
10456
10548
|
["Rd ", dbl3(r * 255)],
|
|
10457
10549
|
["Grn ", dbl3(g * 255)],
|
|
@@ -10534,9 +10626,9 @@ function gradientOf(d, notes) {
|
|
|
10534
10626
|
raw.forEach((s, i) => {
|
|
10535
10627
|
if (i > 0 && Math.abs(s.mid - 0.5) > 1e-3) {
|
|
10536
10628
|
const a = raw[i - 1];
|
|
10537
|
-
const ca =
|
|
10538
|
-
const cb =
|
|
10539
|
-
stops.push({ position: a.position + (s.position - a.position) * s.mid, color:
|
|
10629
|
+
const ca = _chunkDFFBJV3Ucjs.parseEffectColor.call(void 0, a.color);
|
|
10630
|
+
const cb = _chunkDFFBJV3Ucjs.parseEffectColor.call(void 0, s.color);
|
|
10631
|
+
stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkDFFBJV3Ucjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
|
|
10540
10632
|
notes.add("gradient midpoints are drawn as straight segments");
|
|
10541
10633
|
}
|
|
10542
10634
|
stops.push({ position: s.position, color: s.color });
|
|
@@ -10648,8 +10740,8 @@ var KINDS = [
|
|
|
10648
10740
|
["FrFX", "frameFXMulti", "stroke"]
|
|
10649
10741
|
];
|
|
10650
10742
|
function common(d, kind, notes) {
|
|
10651
|
-
const def =
|
|
10652
|
-
return { id:
|
|
10743
|
+
const def = _chunkDFFBJV3Ucjs.defaultLayerEffect.call(void 0, kind, "x");
|
|
10744
|
+
return { id: _chunkDFFBJV3Ucjs.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) };
|
|
10653
10745
|
}
|
|
10654
10746
|
function readOne(kind, d, notes) {
|
|
10655
10747
|
const size = (key, fallback) => clamp3(num3(d, key, fallback), 0, 250);
|
|
@@ -10692,7 +10784,7 @@ function readOne(kind, d, notes) {
|
|
|
10692
10784
|
case "bevel-emboss": {
|
|
10693
10785
|
const styles = { OtrB: "outer-bevel", InrB: "inner-bevel", Embs: "emboss", PlEb: "pillow-emboss", strokeEmboss: "stroke-emboss" };
|
|
10694
10786
|
const out = {
|
|
10695
|
-
id:
|
|
10787
|
+
id: _chunkDFFBJV3Ucjs.newEffectId.call(void 0, ),
|
|
10696
10788
|
enabled: descBool(d, "enab") !== false,
|
|
10697
10789
|
kind,
|
|
10698
10790
|
style: _nullishCoalesce(styles[_nullishCoalesce(enumOf3(d, "bvlS"), () => ( ""))], () => ( "inner-bevel")),
|
|
@@ -10903,10 +10995,10 @@ function writeLfx2(effects) {
|
|
|
10903
10995
|
["Scl ", unit3("#Prc", 100)],
|
|
10904
10996
|
["masterFXSwitch", boolV3(effects.enabled)]
|
|
10905
10997
|
];
|
|
10906
|
-
const scale =
|
|
10998
|
+
const scale = _chunkDFFBJV3Ucjs.effectsScale.call(void 0, effects);
|
|
10907
10999
|
let dropped = 0;
|
|
10908
11000
|
for (const [single, multi, kind] of KINDS) {
|
|
10909
|
-
const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(
|
|
11001
|
+
const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkDFFBJV3Ucjs.scaleLayerEffect.call(void 0, e, scale)));
|
|
10910
11002
|
if (!of.length) continue;
|
|
10911
11003
|
if (of.length === 1) items.push([single, obj3(of[0])]);
|
|
10912
11004
|
else if (multi) items.push([multi, { type: "VlLs", items: of.map(obj3) }]);
|
|
@@ -10938,7 +11030,7 @@ function parseLrfx(data) {
|
|
|
10938
11030
|
const colorAt = (rd) => {
|
|
10939
11031
|
rd.u16();
|
|
10940
11032
|
const c = [rd.u16(), rd.u16(), rd.u16(), rd.u16()];
|
|
10941
|
-
return
|
|
11033
|
+
return _chunkDFFBJV3Ucjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
|
|
10942
11034
|
};
|
|
10943
11035
|
const blendAt = (rd) => {
|
|
10944
11036
|
rd.skip(4);
|
|
@@ -10957,7 +11049,7 @@ function parseLrfx(data) {
|
|
|
10957
11049
|
const enabled = b.u8() !== 0;
|
|
10958
11050
|
const useGlobalLight = b.u8() !== 0;
|
|
10959
11051
|
const opacity = b.u8() / 255;
|
|
10960
|
-
const base = { id:
|
|
11052
|
+
const base = { id: _chunkDFFBJV3Ucjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
|
|
10961
11053
|
items.push(key === "dsdw" ? { ...base, kind: "drop-shadow", spread: 0, knocksOut: true } : { ...base, kind: "inner-shadow", choke: 0 });
|
|
10962
11054
|
} else if (key === "oglw" || key === "iglw") {
|
|
10963
11055
|
b.u32();
|
|
@@ -10967,7 +11059,7 @@ function parseLrfx(data) {
|
|
|
10967
11059
|
const blend = blendAt(b);
|
|
10968
11060
|
const enabled = b.u8() !== 0;
|
|
10969
11061
|
const opacity = b.u8() / 255;
|
|
10970
|
-
const base = { id:
|
|
11062
|
+
const base = { id: _chunkDFFBJV3Ucjs.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 };
|
|
10971
11063
|
items.push(key === "oglw" ? { ...base, kind: "outer-glow", spread: 0 } : { ...base, kind: "inner-glow", choke: 0, source: "edge" });
|
|
10972
11064
|
} else if (key === "sofi") {
|
|
10973
11065
|
b.u32();
|
|
@@ -10975,7 +11067,7 @@ function parseLrfx(data) {
|
|
|
10975
11067
|
const color = colorAt(b);
|
|
10976
11068
|
const opacity = b.u8() / 255;
|
|
10977
11069
|
const enabled = b.u8() !== 0;
|
|
10978
|
-
items.push({ id:
|
|
11070
|
+
items.push({ id: _chunkDFFBJV3Ucjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
|
|
10979
11071
|
} else if (key === "bevl") notes.add("legacy bevels are not read");
|
|
10980
11072
|
}
|
|
10981
11073
|
return { effects: { enabled: true, items }, notes: [...notes] };
|
|
@@ -11091,7 +11183,7 @@ function smartContentsFile(c) {
|
|
|
11091
11183
|
if (c.file) return { name: c.name, bytes: c.file.bytes };
|
|
11092
11184
|
if (c.kind === "raster") {
|
|
11093
11185
|
const data = _chunk7ISPWEJAcjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
|
|
11094
|
-
return { name: `${base}.png`, bytes:
|
|
11186
|
+
return { name: `${base}.png`, bytes: _chunkDCLJNVZScjs.encodePng.call(void 0, c.width, c.height, data) };
|
|
11095
11187
|
}
|
|
11096
11188
|
const doc = c.document;
|
|
11097
11189
|
const merged2 = _chunk7ISPWEJAcjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
|
|
@@ -11158,7 +11250,7 @@ function exportPsd(input) {
|
|
|
11158
11250
|
const key = layer.type === "group" ? "lfxs" : "lfx2";
|
|
11159
11251
|
if (fx.psd) {
|
|
11160
11252
|
const original = parseLfx2(fx.psd.data);
|
|
11161
|
-
if (original ?
|
|
11253
|
+
if (original ? _chunkDFFBJV3Ucjs.effectsFingerprint.call(void 0, original.effects) === _chunkDFFBJV3Ucjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
|
|
11162
11254
|
}
|
|
11163
11255
|
if (!fx.items.length && fx.enabled && (_nullishCoalesce(fx.scale, () => ( 1))) === 1) return null;
|
|
11164
11256
|
const { data, dropped } = writeLfx2(fx);
|
|
@@ -11379,7 +11471,7 @@ function exportPsd(input) {
|
|
|
11379
11471
|
const byId = new Map((_nullishCoalesce(input.patterns, () => ( []))).map((p) => [p.id, p]));
|
|
11380
11472
|
const embed = [];
|
|
11381
11473
|
for (const id of patternIds2) {
|
|
11382
|
-
const p = _nullishCoalesce(byId.get(id), () => (
|
|
11474
|
+
const p = _nullishCoalesce(byId.get(id), () => ( _chunkDFFBJV3Ucjs.builtinPattern.call(void 0, id)));
|
|
11383
11475
|
if (p) embed.push(p);
|
|
11384
11476
|
else note(`Pattern "${id}" is not in the document and was not embedded`, id);
|
|
11385
11477
|
}
|
|
@@ -11769,5 +11861,8 @@ function exportPsd(input) {
|
|
|
11769
11861
|
|
|
11770
11862
|
|
|
11771
11863
|
|
|
11772
|
-
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.createSelectionMask = createSelectionMask; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.parseCssColor = parseCssColor; exports.LayerOperationError = LayerOperationError; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.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.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; 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;
|
|
11773
|
-
|
|
11864
|
+
|
|
11865
|
+
|
|
11866
|
+
|
|
11867
|
+
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.createSelectionMask = createSelectionMask; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.parseCssColor = parseCssColor; exports.LayerOperationError = LayerOperationError; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.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.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; 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;
|
|
11868
|
+
//# sourceMappingURL=chunk-4PUPGALM.cjs.map
|