@pixerate/editor 0.201.0 → 0.203.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/{chunk-GLQQ2VIL.cjs → chunk-53GOGBTM.cjs} +23 -1
- package/dist/{chunk-3TNA7JKI.js → chunk-ZPJEH456.js} +22 -0
- package/dist/commands/builtins.d.cts +6 -0
- package/dist/commands/builtins.d.ts +6 -0
- package/dist/commands/index.cjs +4 -2
- package/dist/commands/index.js +4 -2
- package/dist/image-editor/controller.d.cts +24 -1
- package/dist/image-editor/controller.d.ts +24 -1
- package/dist/image-editor/index.cjs +226 -171
- package/dist/image-editor/index.js +78 -23
- package/dist/image-editor/selection/segmentation.d.cts +7 -0
- package/dist/image-editor/selection/segmentation.d.ts +7 -0
- package/dist/paint-editor/guide-tools.d.cts +2 -2
- package/dist/paint-editor/guide-tools.d.ts +2 -2
- package/dist/paint-editor/hosted.d.cts +34 -0
- package/dist/paint-editor/hosted.d.ts +34 -0
- package/dist/paint-editor/index.cjs +101 -10
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +96 -5
- package/dist/paint-editor/sticker-tools.d.cts +2 -2
- package/dist/paint-editor/sticker-tools.d.ts +2 -2
- package/dist/paint-editor/thick-tools.d.cts +2 -2
- package/dist/paint-editor/thick-tools.d.ts +2 -2
- package/dist/paint-editor/tools.d.cts +19 -2
- package/dist/paint-editor/tools.d.ts +19 -2
- package/dist/paint-editor/wet-tools.d.cts +2 -2
- package/dist/paint-editor/wet-tools.d.ts +2 -2
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +2 -2
- package/skills/pixerate-paint-editor/SKILL.md +9 -0
|
@@ -10071,6 +10071,46 @@ var ImageEditorController = (_class13 = class {
|
|
|
10071
10071
|
this.setSelection(sel, "replace");
|
|
10072
10072
|
return _nullishCoalesce(this.state.selection, () => ( null));
|
|
10073
10073
|
}
|
|
10074
|
+
/**
|
|
10075
|
+
* Asks the segmentation provider (which must be set) for `request.target` in the flattened image
|
|
10076
|
+
* and returns its results with masks decoded to pixels.
|
|
10077
|
+
*/
|
|
10078
|
+
async modelSegments(request) {
|
|
10079
|
+
const provider = this.segmentation;
|
|
10080
|
+
const { width, height } = this.naturalSize;
|
|
10081
|
+
const image = await this.toDataURL({ format: "image/png" });
|
|
10082
|
+
const results = await provider.segment({ ...request, image, width, height });
|
|
10083
|
+
_optionalChain([request, 'access', _329 => _329.signal, 'optionalAccess', _330 => _330.throwIfAborted, 'call', _331 => _331()]);
|
|
10084
|
+
const decoded = [];
|
|
10085
|
+
for (const r of _nullishCoalesce(results, () => ( []))) decoded.push({ ...r, mask: r.mask !== void 0 ? await this.decodeMaskImage(r.mask) : void 0 });
|
|
10086
|
+
return decoded;
|
|
10087
|
+
}
|
|
10088
|
+
/**
|
|
10089
|
+
* The model's object for Object Selection: of what it returns, the pieces mostly inside the box
|
|
10090
|
+
* (clipped to the box grown by a tenth) or those under the point. `null` when none fits.
|
|
10091
|
+
*/
|
|
10092
|
+
async modelObject(target, signal) {
|
|
10093
|
+
const { width, height } = this.naturalSize;
|
|
10094
|
+
const decoded = await this.modelSegments(
|
|
10095
|
+
"rect" in target ? { target: "the main object inside the box", box: target.rect, maxSegments: 4, signal } : { target: "the object at the point", point: target.point, maxSegments: 4, signal }
|
|
10096
|
+
);
|
|
10097
|
+
let union = null;
|
|
10098
|
+
for (const r of decoded) {
|
|
10099
|
+
const one = segmentsToSelection(width, height, [r]);
|
|
10100
|
+
if (!_optionalChain([one, 'optionalAccess', _332 => _332.bounds])) continue;
|
|
10101
|
+
if ("rect" in target) {
|
|
10102
|
+
const r0 = target.rect;
|
|
10103
|
+
const grow = 0.1 * Math.max(r0.width, r0.height);
|
|
10104
|
+
const box = rectSelection(width, height, { x: r0.x - grow, y: r0.y - grow, width: r0.width + 2 * grow, height: r0.height + 2 * grow }, { antiAlias: false });
|
|
10105
|
+
const inside = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, one, box, "intersect");
|
|
10106
|
+
if (!inside || _chunkUYXL6ZWQcjs.selectionArea.call(void 0, inside) < _chunkUYXL6ZWQcjs.selectionArea.call(void 0, one) * 0.5) continue;
|
|
10107
|
+
union = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, union, inside, "add");
|
|
10108
|
+
} else if (_chunkUYXL6ZWQcjs.selectionValueAt.call(void 0, one, target.point.x, target.point.y) >= 0.5) {
|
|
10109
|
+
union = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, union, one, "add");
|
|
10110
|
+
}
|
|
10111
|
+
}
|
|
10112
|
+
return union;
|
|
10113
|
+
}
|
|
10074
10114
|
/**
|
|
10075
10115
|
* Object Selection: the object inside `target.rect` (natural pixels; what is outside the box is
|
|
10076
10116
|
* background) or under `target.point`, found by GrabCut (colour models of object and background
|
|
@@ -10088,10 +10128,17 @@ var ImageEditorController = (_class13 = class {
|
|
|
10088
10128
|
} else if (!(target.point.x >= 0 && target.point.y >= 0 && target.point.x < width && target.point.y < height)) {
|
|
10089
10129
|
throw new Error(`(${target.point.x}, ${target.point.y}) is outside the image (0..${width - 1}, 0..${height - 1}); click on the object.`);
|
|
10090
10130
|
}
|
|
10131
|
+
if (this.segmentation && options.useModel !== false) {
|
|
10132
|
+
const found = await this.modelObject(target, options.signal);
|
|
10133
|
+
if (found) {
|
|
10134
|
+
this.setSelection(found, _nullishCoalesce(options.mode, () => ( "replace")));
|
|
10135
|
+
return { selection: _nullishCoalesce(this.state.selection, () => ( null)), method: "model" };
|
|
10136
|
+
}
|
|
10137
|
+
}
|
|
10091
10138
|
const pixels = await this.requirePixels({ sample: options.sampleAllLayers === false ? "active-layer" : "composite" });
|
|
10092
10139
|
const region = selectObjectIn(pixels, target, { enhanceEdge: options.enhanceEdge });
|
|
10093
10140
|
this.setSelection(region, _nullishCoalesce(options.mode, () => ( "replace")));
|
|
10094
|
-
return _nullishCoalesce(this.state.selection, () => ( null));
|
|
10141
|
+
return { selection: _nullishCoalesce(this.state.selection, () => ( null)), method: "grabcut" };
|
|
10095
10142
|
}
|
|
10096
10143
|
/**
|
|
10097
10144
|
* Select › Focus Area: selects the parts of the image that are in focus (fine detail above the
|
|
@@ -10111,11 +10158,18 @@ var ImageEditorController = (_class13 = class {
|
|
|
10111
10158
|
* (the selection is then unchanged), why.
|
|
10112
10159
|
*/
|
|
10113
10160
|
async selectSky(options = {}) {
|
|
10161
|
+
if (this.segmentation && options.useModel !== false) {
|
|
10162
|
+
const { width, height } = this.naturalSize;
|
|
10163
|
+
const sky = segmentsToSelection(width, height, await this.modelSegments({ target: "the sky", signal: options.signal }));
|
|
10164
|
+
if (!_optionalChain([sky, 'optionalAccess', _333 => _333.bounds])) return { selection: _nullishCoalesce(this.state.selection, () => ( null)), method: "model", note: "The segmentation model found no sky." };
|
|
10165
|
+
this.setSelection(sky, _nullishCoalesce(options.mode, () => ( "replace")));
|
|
10166
|
+
return { selection: _nullishCoalesce(this.state.selection, () => ( null)), method: "model" };
|
|
10167
|
+
}
|
|
10114
10168
|
const pixels = await this.requirePixels({ sample: options.sampleAllLayers === false ? "active-layer" : "composite" });
|
|
10115
10169
|
const { selection, reason } = findSky(pixels, options);
|
|
10116
|
-
if (!selection.bounds) return { selection: _nullishCoalesce(this.state.selection, () => ( null)), note: reason };
|
|
10170
|
+
if (!selection.bounds) return { selection: _nullishCoalesce(this.state.selection, () => ( null)), method: "classical", note: reason };
|
|
10117
10171
|
this.setSelection(selection, _nullishCoalesce(options.mode, () => ( "replace")));
|
|
10118
|
-
return { selection: _nullishCoalesce(this.state.selection, () => ( null)) };
|
|
10172
|
+
return { selection: _nullishCoalesce(this.state.selection, () => ( null)), method: "classical" };
|
|
10119
10173
|
}
|
|
10120
10174
|
/**
|
|
10121
10175
|
* Supplies the pixels the selection tools sample (natural size RGBA), e.g. decoded in a worker
|
|
@@ -10138,7 +10192,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10138
10192
|
try {
|
|
10139
10193
|
const canvas = await this.renderSource();
|
|
10140
10194
|
const ctx = canvas.getContext("2d");
|
|
10141
|
-
const data2 = _optionalChain([ctx, 'optionalAccess',
|
|
10195
|
+
const data2 = _optionalChain([ctx, 'optionalAccess', _334 => _334.getImageData, 'optionalCall', _335 => _335(0, 0, width, height)]);
|
|
10142
10196
|
if (data2 && data2.data && data2.data.length >= width * height * 4) {
|
|
10143
10197
|
base = { width, height, data: data2.data };
|
|
10144
10198
|
this.samplePixels = base;
|
|
@@ -10213,7 +10267,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10213
10267
|
/** Select › Modify: grow, shrink, feather, border or smooth by `radius` pixels (one undo step). */
|
|
10214
10268
|
modifySelection(op, radius) {
|
|
10215
10269
|
const sel = this.state.selection;
|
|
10216
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
10270
|
+
if (!_optionalChain([sel, 'optionalAccess', _336 => _336.bounds])) return false;
|
|
10217
10271
|
return this.setSelection(_chunkUYXL6ZWQcjs.modifySelection.call(void 0, sel, op, radius));
|
|
10218
10272
|
}
|
|
10219
10273
|
/**
|
|
@@ -10222,7 +10276,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10222
10276
|
*/
|
|
10223
10277
|
async refineSelection(params, options = {}) {
|
|
10224
10278
|
const sel = this.state.selection;
|
|
10225
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
10279
|
+
if (!_optionalChain([sel, 'optionalAccess', _337 => _337.bounds])) return false;
|
|
10226
10280
|
const pixels = (_nullishCoalesce(params.radius, () => ( 0))) > 0 ? await this.requirePixels(options) : null;
|
|
10227
10281
|
return this.setSelection(refineSelection(pixels, sel, params));
|
|
10228
10282
|
}
|
|
@@ -10253,7 +10307,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10253
10307
|
let mask;
|
|
10254
10308
|
if (source === "selection") {
|
|
10255
10309
|
const sel = this.state.selection;
|
|
10256
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
10310
|
+
if (!_optionalChain([sel, 'optionalAccess', _338 => _338.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, or export a channel or a layer mask.");
|
|
10257
10311
|
mask = sel;
|
|
10258
10312
|
} else if ("channelId" in source) {
|
|
10259
10313
|
mask = this.requireChannel(source.channelId).mask;
|
|
@@ -10277,7 +10331,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10277
10331
|
const canvas = this.renderer.createCanvas(w, h);
|
|
10278
10332
|
const ctx = canvas.getContext("2d");
|
|
10279
10333
|
if (ctx) ctx.drawImage(img, 0, 0, w, h);
|
|
10280
|
-
const data = _optionalChain([ctx, 'optionalAccess',
|
|
10334
|
+
const data = _optionalChain([ctx, 'optionalAccess', _339 => _339.getImageData, 'optionalCall', _340 => _340(0, 0, w, h)]);
|
|
10281
10335
|
if (!data) throw new Error("The mask image pixels are not available (no canvas access); pass pixels.");
|
|
10282
10336
|
return { width: w, height: h, data: data.data };
|
|
10283
10337
|
}
|
|
@@ -10293,7 +10347,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10293
10347
|
const provider = this.segmentation;
|
|
10294
10348
|
if (!provider) {
|
|
10295
10349
|
const pixels = await this.requirePixels({});
|
|
10296
|
-
_optionalChain([options, 'access',
|
|
10350
|
+
_optionalChain([options, 'access', _341 => _341.signal, 'optionalAccess', _342 => _342.throwIfAborted, 'call', _343 => _343()]);
|
|
10297
10351
|
const { selection, reason } = findSubject(pixels, { enhanceEdge: options.enhanceEdge });
|
|
10298
10352
|
if (selection.bounds) this.shapeCommand(selection, options);
|
|
10299
10353
|
const unused = target.trim() ? ` "${target.trim()}" was not used to choose it.` : "";
|
|
@@ -10306,26 +10360,20 @@ var ImageEditorController = (_class13 = class {
|
|
|
10306
10360
|
const description = target.trim();
|
|
10307
10361
|
if (!description) throw new Error("Describe the subject to select.");
|
|
10308
10362
|
const { width, height } = this.naturalSize;
|
|
10309
|
-
const
|
|
10310
|
-
const results = await provider.segment({ image, width, height, target: description, maxSegments: options.maxSegments, signal: options.signal });
|
|
10311
|
-
_optionalChain([options, 'access', _339 => _339.signal, 'optionalAccess', _340 => _340.throwIfAborted, 'call', _341 => _341()]);
|
|
10312
|
-
const decoded = [];
|
|
10313
|
-
for (const r of _nullishCoalesce(results, () => ( []))) {
|
|
10314
|
-
decoded.push({ ...r, mask: r.mask !== void 0 ? await this.decodeMaskImage(r.mask) : void 0 });
|
|
10315
|
-
}
|
|
10363
|
+
const decoded = await this.modelSegments({ target: description, maxSegments: options.maxSegments, signal: options.signal });
|
|
10316
10364
|
const segments = decoded.map((r) => {
|
|
10317
10365
|
const one = segmentsToSelection(width, height, [r]);
|
|
10318
|
-
return { label: r.label || description, bounds: _nullishCoalesce(_optionalChain([one, 'optionalAccess',
|
|
10366
|
+
return { label: r.label || description, bounds: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _344 => _344.bounds]), () => ( null)), ...r.score !== void 0 ? { score: r.score } : {} };
|
|
10319
10367
|
});
|
|
10320
10368
|
const mask = segmentsToSelection(width, height, decoded);
|
|
10321
10369
|
if (mask && options.beforeApply) {
|
|
10322
10370
|
const outlines = decoded.flatMap((r, i) => {
|
|
10323
10371
|
const rings = segmentationOutlines(r);
|
|
10324
|
-
const b = _optionalChain([segments, 'access',
|
|
10372
|
+
const b = _optionalChain([segments, 'access', _345 => _345[i], 'optionalAccess', _346 => _346.bounds]);
|
|
10325
10373
|
return rings.length ? rings : b ? [[{ x: b.x, y: b.y }, { x: b.x + b.width, y: b.y }, { x: b.x + b.width, y: b.y + b.height }, { x: b.x, y: b.y + b.height }]] : [];
|
|
10326
10374
|
});
|
|
10327
10375
|
await options.beforeApply(outlines);
|
|
10328
|
-
_optionalChain([options, 'access',
|
|
10376
|
+
_optionalChain([options, 'access', _347 => _347.signal, 'optionalAccess', _348 => _348.throwIfAborted, 'call', _349 => _349()]);
|
|
10329
10377
|
}
|
|
10330
10378
|
if (mask) this.shapeCommand(mask, options);
|
|
10331
10379
|
return { segments: segments.filter((s) => s.bounds), method: "model" };
|
|
@@ -10358,7 +10406,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10358
10406
|
const view = this.state.maskView;
|
|
10359
10407
|
if (!view) return null;
|
|
10360
10408
|
const layer = this.getLayer(view.layerId);
|
|
10361
|
-
return _optionalChain([layer, 'optionalAccess',
|
|
10409
|
+
return _optionalChain([layer, 'optionalAccess', _350 => _350.mask]) && !layer.mask.source ? view : null;
|
|
10362
10410
|
}
|
|
10363
10411
|
/**
|
|
10364
10412
|
* Shows a layer's mask on the canvas: `gray` alone in grey (Alt-click the mask thumbnail),
|
|
@@ -10381,7 +10429,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10381
10429
|
if (!layer.mask) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${layer.name || id}" has no mask to show; add one with add_layer_mask.`);
|
|
10382
10430
|
if (layer.mask.source) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${layer.name || id}" has a depth mask, which is computed, not painted, so it has no mask view.`);
|
|
10383
10431
|
const cur = this.state.maskView;
|
|
10384
|
-
if (_optionalChain([cur, 'optionalAccess',
|
|
10432
|
+
if (_optionalChain([cur, 'optionalAccess', _351 => _351.layerId]) !== id || cur.mode !== mode) {
|
|
10385
10433
|
this.state.maskView = { layerId: id, mode };
|
|
10386
10434
|
this.notify();
|
|
10387
10435
|
}
|
|
@@ -10393,7 +10441,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10393
10441
|
return _nullishCoalesce(this.state.channels, () => ( []));
|
|
10394
10442
|
}
|
|
10395
10443
|
getChannel(id) {
|
|
10396
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
10444
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _352 => _352.state, 'access', _353 => _353.channels, 'optionalAccess', _354 => _354.find, 'call', _355 => _355((c) => c.id === id)]), () => ( null));
|
|
10397
10445
|
}
|
|
10398
10446
|
requireChannel(id) {
|
|
10399
10447
|
const channel = this.getChannel(id);
|
|
@@ -10422,14 +10470,14 @@ var ImageEditorController = (_class13 = class {
|
|
|
10422
10470
|
*/
|
|
10423
10471
|
saveSelection(options = {}) {
|
|
10424
10472
|
const sel = this.state.selection;
|
|
10425
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
10473
|
+
if (!_optionalChain([sel, 'optionalAccess', _356 => _356.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, then save the selection to a channel.");
|
|
10426
10474
|
const { width, height } = this.naturalSize;
|
|
10427
10475
|
const sized = sel.width === width && sel.height === height ? sel : _chunkUYXL6ZWQcjs.resizeSelection.call(void 0, sel, width, height);
|
|
10428
10476
|
const channels = [...this.getChannels()];
|
|
10429
10477
|
if (options.channelId !== void 0) {
|
|
10430
10478
|
const existing = this.requireChannel(options.channelId);
|
|
10431
10479
|
const mask = _nullishCoalesce(_chunkUYXL6ZWQcjs.combineSelections.call(void 0, existing.mask.bounds ? existing.mask : null, sized, _nullishCoalesce(options.mode, () => ( "replace"))), () => ( _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, width, height)));
|
|
10432
|
-
const next = { ...existing, mask, ..._optionalChain([options, 'access',
|
|
10480
|
+
const next = { ...existing, mask, ..._optionalChain([options, 'access', _357 => _357.name, 'optionalAccess', _358 => _358.trim, 'call', _359 => _359()]) ? { name: options.name.trim() } : {} };
|
|
10433
10481
|
this.setChannels(channels.map((c) => c.id === existing.id ? next : c));
|
|
10434
10482
|
return next;
|
|
10435
10483
|
}
|
|
@@ -10440,7 +10488,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10440
10488
|
const channels = this.getChannels();
|
|
10441
10489
|
const channel = {
|
|
10442
10490
|
id: this.newChannelId(),
|
|
10443
|
-
name: _optionalChain([name, 'optionalAccess',
|
|
10491
|
+
name: _optionalChain([name, 'optionalAccess', _360 => _360.trim, 'call', _361 => _361()]) || `Alpha ${channels.length + 1}`,
|
|
10444
10492
|
mask,
|
|
10445
10493
|
color: DEFAULT_CHANNEL_COLOR,
|
|
10446
10494
|
opacity: 0.5,
|
|
@@ -10485,7 +10533,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10485
10533
|
/** Duplicates an alpha channel just after it (one undo step). Returns the copy. */
|
|
10486
10534
|
duplicateChannel(id, name) {
|
|
10487
10535
|
const channel = this.requireChannel(id);
|
|
10488
|
-
const copy = { ...channel, id: this.newChannelId(), name: _optionalChain([name, 'optionalAccess',
|
|
10536
|
+
const copy = { ...channel, id: this.newChannelId(), name: _optionalChain([name, 'optionalAccess', _362 => _362.trim, 'call', _363 => _363()]) || `${channel.name} copy` };
|
|
10489
10537
|
const channels = [...this.getChannels()];
|
|
10490
10538
|
channels.splice(channels.findIndex((c) => c.id === id) + 1, 0, copy);
|
|
10491
10539
|
this.setChannels(channels);
|
|
@@ -10516,7 +10564,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10516
10564
|
quickMaskSurface() {
|
|
10517
10565
|
const { width, height } = this.naturalSize;
|
|
10518
10566
|
const sel = this.state.selection;
|
|
10519
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
10567
|
+
if (!_optionalChain([sel, 'optionalAccess', _364 => _364.bounds])) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 1, 0);
|
|
10520
10568
|
return (sel.width === width && sel.height === height ? sel : _chunkUYXL6ZWQcjs.resizeSelection.call(void 0, sel, width, height)).surface;
|
|
10521
10569
|
}
|
|
10522
10570
|
/** The selection a painted Quick Mask surface stands for (it shares the surface's tiles). */
|
|
@@ -10537,7 +10585,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10537
10585
|
*/
|
|
10538
10586
|
applySelectionAsLayerMask(layerId, props = {}) {
|
|
10539
10587
|
const sel = this.state.selection;
|
|
10540
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
10588
|
+
if (!_optionalChain([sel, 'optionalAccess', _365 => _365.bounds]) || !this.getAdjustmentLayer(layerId)) return false;
|
|
10541
10589
|
return this.setLayerMask(layerId, this.maskFromSelection(sel, props));
|
|
10542
10590
|
}
|
|
10543
10591
|
setLayerMask(layerId, mask, commitToHistory = true) {
|
|
@@ -10577,7 +10625,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10577
10625
|
/** A layer's painted mask over the canvas as a selection mask; null without one (or for a depth mask). */
|
|
10578
10626
|
layerMaskCoverage(layerId) {
|
|
10579
10627
|
const layer = this.getLayer(layerId);
|
|
10580
|
-
if (!_optionalChain([layer, 'optionalAccess',
|
|
10628
|
+
if (!_optionalChain([layer, 'optionalAccess', _366 => _366.mask]) || layer.mask.source) return null;
|
|
10581
10629
|
const { width, height } = this.naturalSize;
|
|
10582
10630
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
10583
10631
|
const oy = layer.type === "pixel" ? layer.offset.y : 0;
|
|
@@ -10612,7 +10660,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10612
10660
|
this.state.layers = _chunkHGTDMKNEcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
|
|
10613
10661
|
const next = { ...l };
|
|
10614
10662
|
if (_chunkUYXL6ZWQcjs.isDefaultDepthMask.call(void 0, merged)) {
|
|
10615
|
-
if (_optionalChain([next, 'access',
|
|
10663
|
+
if (_optionalChain([next, 'access', _367 => _367.mask, 'optionalAccess', _368 => _368.source])) delete next.mask;
|
|
10616
10664
|
} else next.mask = _chunkUYXL6ZWQcjs.depthRasterMask.call(void 0, merged);
|
|
10617
10665
|
return next;
|
|
10618
10666
|
});
|
|
@@ -10622,7 +10670,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10622
10670
|
resetDepthMask() {
|
|
10623
10671
|
this.recordHistory();
|
|
10624
10672
|
const target = this.developLayer();
|
|
10625
|
-
if (_optionalChain([target, 'optionalAccess',
|
|
10673
|
+
if (_optionalChain([target, 'optionalAccess', _369 => _369.mask, 'optionalAccess', _370 => _370.source])) {
|
|
10626
10674
|
this.state.layers = _chunkHGTDMKNEcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
|
|
10627
10675
|
const next = { ...l };
|
|
10628
10676
|
delete next.mask;
|
|
@@ -10634,7 +10682,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10634
10682
|
// --- Annotations & Layers ---
|
|
10635
10683
|
/** The layer showing annotation `id`: an annotation layer, or a shape layer migrated from it. */
|
|
10636
10684
|
annotationLayer(id) {
|
|
10637
|
-
return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers).find((l) => (l.type === "annotation" || l.type === "shape" || l.type === "type") && _optionalChain([_chunkUYXL6ZWQcjs.annotationOfLayer.call(void 0, l), 'optionalAccess',
|
|
10685
|
+
return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers).find((l) => (l.type === "annotation" || l.type === "shape" || l.type === "type") && _optionalChain([_chunkUYXL6ZWQcjs.annotationOfLayer.call(void 0, l), 'optionalAccess', _371 => _371.id]) === id);
|
|
10638
10686
|
}
|
|
10639
10687
|
/** What migrating an annotation needs: the canvas size, patterns and the text shaper. */
|
|
10640
10688
|
annotationEnv() {
|
|
@@ -10652,7 +10700,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10652
10700
|
const fullAnnotation = { ...annotation, id };
|
|
10653
10701
|
const layer = _chunkUYXL6ZWQcjs.annotationLayerFor.call(void 0, fullAnnotation, this.annotationEnv());
|
|
10654
10702
|
const loc = placement.aboveId ? _chunkHGTDMKNEcjs.findLayer.call(void 0, this.state.layers, placement.aboveId) : null;
|
|
10655
|
-
this.state.layers = loc ? _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, layer, _nullishCoalesce(_optionalChain([loc, 'access',
|
|
10703
|
+
this.state.layers = loc ? _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, layer, _nullishCoalesce(_optionalChain([loc, 'access', _372 => _372.parent, 'optionalAccess', _373 => _373.id]), () => ( null)), loc.index + 1) : _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, layer, null);
|
|
10656
10704
|
this.state.selectedAnnotationId = id;
|
|
10657
10705
|
this.notify();
|
|
10658
10706
|
return id;
|
|
@@ -10775,7 +10823,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10775
10823
|
await this.renderer.renderToCanvas(targetCanvas, source, this.state, {
|
|
10776
10824
|
...options,
|
|
10777
10825
|
// The clone source follows the brush cursor (both editors pass it).
|
|
10778
|
-
cloneSourceMarker: _optionalChain([options, 'optionalAccess',
|
|
10826
|
+
cloneSourceMarker: _optionalChain([options, 'optionalAccess', _374 => _374.cloneSourceMarker]) !== void 0 ? options.cloneSourceMarker : _optionalChain([options, 'optionalAccess', _375 => _375.brushCursor]) ? this.cloneSourceMarker(options.brushCursor) : null,
|
|
10779
10827
|
dirty: dirty === "all" ? void 0 : dirty,
|
|
10780
10828
|
checkpointLayerId: this.state.activeLayerId
|
|
10781
10829
|
});
|
|
@@ -10788,7 +10836,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10788
10836
|
return this.renderer.createCanvas(1, 1);
|
|
10789
10837
|
}
|
|
10790
10838
|
this.syncViews();
|
|
10791
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
10839
|
+
if (_optionalChain([options, 'optionalAccess', _376 => _376.layerIds])) {
|
|
10792
10840
|
const keep = new Set(options.layerIds);
|
|
10793
10841
|
const layers = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => keep.has(l.id));
|
|
10794
10842
|
return this.renderer.renderExport(source, { ...this.state, layers }, options);
|
|
@@ -10942,7 +10990,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10942
10990
|
let px2 = await this.decodeImage(newDataUrl);
|
|
10943
10991
|
if (px2.width !== width || px2.height !== height) px2 = resizePixels(px2, width, height);
|
|
10944
10992
|
const data = new Uint8ClampedArray(px2.data);
|
|
10945
|
-
const sel = _optionalChain([this, 'access',
|
|
10993
|
+
const sel = _optionalChain([this, 'access', _377 => _377.state, 'access', _378 => _378.selection, 'optionalAccess', _379 => _379.bounds]) ? this.state.selection : null;
|
|
10946
10994
|
if (sel) for (let p = 0, i = 3; p < width * height; p++, i += 4) data[i] = Math.round(data[i] * sel.data[p] / 255);
|
|
10947
10995
|
return this.addPixelLayer({ name: "Inpaint", pixels: { width, height, data } });
|
|
10948
10996
|
}
|
|
@@ -10989,7 +11037,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
10989
11037
|
}
|
|
10990
11038
|
/** Font families the shaper offers (generic families at least). */
|
|
10991
11039
|
listFonts() {
|
|
10992
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
11040
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _380 => _380.getTextShaper, 'call', _381 => _381(), 'optionalAccess', _382 => _382.families, 'optionalCall', _383 => _383()]), () => ( ["sans-serif", "serif", "monospace"]));
|
|
10993
11041
|
}
|
|
10994
11042
|
typeInfo(id) {
|
|
10995
11043
|
const layer = _chunkUYXL6ZWQcjs.requireTypeLayer.call(void 0, this.state.layers, id);
|
|
@@ -11063,8 +11111,8 @@ var ImageEditorController = (_class13 = class {
|
|
|
11063
11111
|
const layer = this.layoutTypeLayer({ ...init, text, orientation: vertical ? "vertical" : "horizontal" });
|
|
11064
11112
|
const { width, height } = this.naturalSize;
|
|
11065
11113
|
const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
|
|
11066
|
-
const x0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess',
|
|
11067
|
-
const y0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess',
|
|
11114
|
+
const x0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess', _384 => _384.x]), () => ( 0)));
|
|
11115
|
+
const y0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess', _385 => _385.y]), () => ( 0)));
|
|
11068
11116
|
const x1 = Math.min(width, b ? b.x + b.width : 0);
|
|
11069
11117
|
const y1 = Math.min(height, b ? b.y + b.height : 0);
|
|
11070
11118
|
let mask;
|
|
@@ -11241,7 +11289,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11241
11289
|
if (colors.size > 1) warnings.push("The text had several colours; the shape takes the first one.");
|
|
11242
11290
|
const missing = _chunkBRKVNXDZcjs.layoutText.call(void 0, layer, shaper).missingFonts;
|
|
11243
11291
|
if (missing.length) warnings.push(`Missing fonts were drawn with a fallback: ${missing.join(", ")}.`);
|
|
11244
|
-
const first = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
11292
|
+
const first = _nullishCoalesce(_optionalChain([layer, 'access', _386 => _386.runs, 'access', _387 => _387.find, 'call', _388 => _388((r) => r.length > 0), 'optionalAccess', _389 => _389.style]), () => ( _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE));
|
|
11245
11293
|
const fill = first.opacity !== void 0 && first.opacity !== 1 ? { type: "color", color: first.color, opacity: first.opacity } : { type: "color", color: first.color };
|
|
11246
11294
|
const shape = _chunkUYXL6ZWQcjs.createShapeLayer.call(void 0, { components: [{ op: "combine", subpaths }], fill, stroke: null, name: layer.name }, this.shapeEnv(), layer.id);
|
|
11247
11295
|
const keep = { visible: layer.visible, opacity: layer.opacity, blend: layer.blend };
|
|
@@ -11274,7 +11322,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11274
11322
|
// --- Shape layers ---
|
|
11275
11323
|
/** What shape rendering needs: the canvas size and the document's patterns. */
|
|
11276
11324
|
shapeEnv() {
|
|
11277
|
-
return { ...this.naturalSize, pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access',
|
|
11325
|
+
return { ...this.naturalSize, pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _390 => _390.state, 'access', _391 => _391.patterns, 'optionalAccess', _392 => _392.find, 'call', _393 => _393((p) => p.id === id)]), () => ( null)) };
|
|
11278
11326
|
}
|
|
11279
11327
|
/** One component from tool or UI input (validated). */
|
|
11280
11328
|
componentFrom(spec, path) {
|
|
@@ -11317,9 +11365,9 @@ var ImageEditorController = (_class13 = class {
|
|
|
11317
11365
|
* open path) and stroked with `stroke`. Goes above the active layer unless placed. Returns its id.
|
|
11318
11366
|
*/
|
|
11319
11367
|
addShapeLayer(init) {
|
|
11320
|
-
const specs = _optionalChain([init, 'access',
|
|
11321
|
-
if (_optionalChain([init, 'access',
|
|
11322
|
-
const components = specs.map((c, i) => this.componentFrom(c, _optionalChain([init, 'access',
|
|
11368
|
+
const specs = _optionalChain([init, 'access', _394 => _394.components, 'optionalAccess', _395 => _395.length]) ? init.components : [init];
|
|
11369
|
+
if (_optionalChain([init, 'access', _396 => _396.components, 'optionalAccess', _397 => _397.length]) && (init.shape !== void 0 || init.subpaths !== void 0)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Give components, or shape / subpaths, not both.");
|
|
11370
|
+
const components = specs.map((c, i) => this.componentFrom(c, _optionalChain([init, 'access', _398 => _398.components, 'optionalAccess', _399 => _399.length]) ? `components[${i}].` : ""));
|
|
11323
11371
|
const stroke = init.stroke ? _chunkUYXL6ZWQcjs.normalizeShapeStroke.call(void 0, init.stroke, "stroke") : null;
|
|
11324
11372
|
const openOnly = components.every((c) => !c.live && c.subpaths.every((sp) => !sp.closed));
|
|
11325
11373
|
const fill = init.fill === void 0 ? stroke && openOnly ? null : _chunkUYXL6ZWQcjs.normalizeShapePaint.call(void 0, this.state.paint.foreground, "fill") : init.fill === null ? null : _chunkUYXL6ZWQcjs.normalizeShapePaint.call(void 0, init.fill, "fill");
|
|
@@ -11430,7 +11478,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11430
11478
|
if (layer.locks) next.locks = layer.locks;
|
|
11431
11479
|
if (this.state.selectedAnnotationId === layer.annotation.id) this.state.selectedAnnotationId = null;
|
|
11432
11480
|
} else if (layer.type === "pixel") {
|
|
11433
|
-
if (!_optionalChain([layer, 'access',
|
|
11481
|
+
if (!_optionalChain([layer, 'access', _400 => _400.filters, 'optionalAccess', _401 => _401.length])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${layer.name || id}" is already pixels with no filters to bake.`);
|
|
11434
11482
|
_chunkUYXL6ZWQcjs.requireUnlocked.call(void 0, layer, "pixels", "rasterize it");
|
|
11435
11483
|
const spatial = layer.filters.some((f) => f.enabled && f.kind === "blur");
|
|
11436
11484
|
const content = { ...layer, visible: true, opacity: 1, blend: "normal" };
|
|
@@ -11449,7 +11497,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11449
11497
|
return this.rasterizeSmartObject(id);
|
|
11450
11498
|
} else if (layer.type === "shape" || layer.type === "type") {
|
|
11451
11499
|
next = layer.type === "shape" ? _chunkUYXL6ZWQcjs.shapeAsPixelLayer.call(void 0, layer) : _chunkUYXL6ZWQcjs.typeAsPixelLayer.call(void 0, layer);
|
|
11452
|
-
if (this.state.selectedAnnotationId && this.state.selectedAnnotationId === _optionalChain([layer, 'access',
|
|
11500
|
+
if (this.state.selectedAnnotationId && this.state.selectedAnnotationId === _optionalChain([layer, 'access', _402 => _402.annotation, 'optionalAccess', _403 => _403.id])) this.state.selectedAnnotationId = null;
|
|
11453
11501
|
} else {
|
|
11454
11502
|
throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Only shape, type and annotation layers, smart objects and pixel layers with filters rasterize; "${layer.name || id}" is a ${layer.type} layer. Merge it down or flatten instead.`);
|
|
11455
11503
|
}
|
|
@@ -11463,8 +11511,8 @@ var ImageEditorController = (_class13 = class {
|
|
|
11463
11511
|
const doc = this.state.colorProfile;
|
|
11464
11512
|
const p = resolveProfile(doc);
|
|
11465
11513
|
const m = this.state.colorMode;
|
|
11466
|
-
const out = { name: _nullishCoalesce(_optionalChain([doc, 'optionalAccess',
|
|
11467
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
11514
|
+
const out = { name: _nullishCoalesce(_optionalChain([doc, 'optionalAccess', _404 => _404.name]), () => ( p.description)), builtin: doc ? _nullishCoalesce(doc.builtin, () => ( null)) : "srgb", colorSpace: p.colorSpace, srgb: isSrgb(doc), mode: _nullishCoalesce(_optionalChain([m, 'optionalAccess', _405 => _405.mode]), () => ( "rgb")) };
|
|
11515
|
+
if (_optionalChain([m, 'optionalAccess', _406 => _406.mode]) === "cmyk") out.cmykProfile = { name: m.profile.name, builtin: _nullishCoalesce(m.profile.builtin, () => ( null)), intent: m.intent };
|
|
11468
11516
|
return out;
|
|
11469
11517
|
}
|
|
11470
11518
|
/**
|
|
@@ -11554,7 +11602,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11554
11602
|
const textEnv = this.textEnv();
|
|
11555
11603
|
const walk = (layers) => layers.map((l) => {
|
|
11556
11604
|
let next2 = l;
|
|
11557
|
-
if (_optionalChain([l, 'access',
|
|
11605
|
+
if (_optionalChain([l, 'access', _407 => _407.effects, 'optionalAccess', _408 => _408.items, 'access', _409 => _409.length])) next2 = { ...next2, effects: convertColorFields(l.effects, hex) };
|
|
11558
11606
|
if (l.type === "group") {
|
|
11559
11607
|
if (next2 !== l) converted.push(l.id);
|
|
11560
11608
|
return { ...next2, children: walk(l.children) };
|
|
@@ -11738,8 +11786,8 @@ var ImageEditorController = (_class13 = class {
|
|
|
11738
11786
|
else delete s.bitDepth;
|
|
11739
11787
|
delete s.colorProfile;
|
|
11740
11788
|
delete s.colorMode;
|
|
11741
|
-
if (_optionalChain([result, 'access',
|
|
11742
|
-
else if (_optionalChain([result, 'access',
|
|
11789
|
+
if (_optionalChain([result, 'access', _410 => _410.sourceMode, 'optionalAccess', _411 => _411.mode]) === "cmyk") s.colorMode = { mode: "cmyk", profile: result.sourceMode.profile, intent: "relative" };
|
|
11790
|
+
else if (_optionalChain([result, 'access', _412 => _412.sourceMode, 'optionalAccess', _413 => _413.mode]) === "lab") s.colorMode = { mode: "lab" };
|
|
11743
11791
|
else if (result.iccProfile) {
|
|
11744
11792
|
try {
|
|
11745
11793
|
const doc = documentProfile(result.iccProfile);
|
|
@@ -11803,7 +11851,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11803
11851
|
const compositor = new (0, _chunkUYXL6ZWQcjs.LayerCompositor)();
|
|
11804
11852
|
const bakeMask = (layer) => {
|
|
11805
11853
|
const mask = layer.mask;
|
|
11806
|
-
if (!_optionalChain([mask, 'optionalAccess',
|
|
11854
|
+
if (!_optionalChain([mask, 'optionalAccess', _414 => _414.source])) return mask;
|
|
11807
11855
|
add2("Parametric (depth) masks were baked into pixel masks", layer.name);
|
|
11808
11856
|
const plain3 = { ...layer, mask: { ...mask, density: 1, feather: 0, enabled: true } };
|
|
11809
11857
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
@@ -11820,7 +11868,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11820
11868
|
};
|
|
11821
11869
|
const prepare = async (layer) => {
|
|
11822
11870
|
const p = await prepareLayer(layer);
|
|
11823
|
-
if (_optionalChain([p, 'optionalAccess',
|
|
11871
|
+
if (_optionalChain([p, 'optionalAccess', _415 => _415.blend]) === "pigment") add2("The Pigment blend mode has no PSD equivalent and was written as Normal", layer.name);
|
|
11824
11872
|
return p;
|
|
11825
11873
|
};
|
|
11826
11874
|
const prepareLayer = async (layer) => {
|
|
@@ -11863,7 +11911,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11863
11911
|
return out2;
|
|
11864
11912
|
}
|
|
11865
11913
|
if (layer.type === "shape" || layer.type === "type") {
|
|
11866
|
-
if (layer.type === "type" && _optionalChain([layer, 'access',
|
|
11914
|
+
if (layer.type === "type" && _optionalChain([layer, 'access', _416 => _416.missingFonts, 'optionalAccess', _417 => _417.length])) add2(`Type layers drawn with a fallback for missing fonts (${layer.missingFonts.join(", ")}) keep the font names, so Photoshop may draw them differently`, layer.name);
|
|
11867
11915
|
const out2 = { ...layer };
|
|
11868
11916
|
const mask2 = bakeMask(layer);
|
|
11869
11917
|
if (mask2) out2.mask = mask2;
|
|
@@ -11882,7 +11930,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11882
11930
|
out.surface = this.surfaceOf(layer);
|
|
11883
11931
|
delete out.source;
|
|
11884
11932
|
}
|
|
11885
|
-
const active = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
11933
|
+
const active = _nullishCoalesce(_optionalChain([layer, 'access', _418 => _418.filters, 'optionalAccess', _419 => _419.filter, 'call', _420 => _420(_chunkUYXL6ZWQcjs.isActiveFilter)]), () => ( []));
|
|
11886
11934
|
if (active.length) {
|
|
11887
11935
|
add2("Layer filters (develop, blur) were baked into the pixels", layer.name);
|
|
11888
11936
|
const content = { ...out, visible: true, opacity: 1, blend: "normal" };
|
|
@@ -11893,7 +11941,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11893
11941
|
const data = compositor.composite([content], canvas, sources);
|
|
11894
11942
|
out = { ...out, surface: _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, -layer.offset.x, -layer.offset.y) };
|
|
11895
11943
|
}
|
|
11896
|
-
if (_optionalChain([layer, 'access',
|
|
11944
|
+
if (_optionalChain([layer, 'access', _421 => _421.filters, 'optionalAccess', _422 => _422.some, 'call', _423 => _423((f) => !f.enabled)])) add2("Disabled layer filters were left out", layer.name);
|
|
11897
11945
|
delete out.filters;
|
|
11898
11946
|
const mask = bakeMask(layer);
|
|
11899
11947
|
if (mask) out.mask = mask;
|
|
@@ -11957,7 +12005,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11957
12005
|
);
|
|
11958
12006
|
}
|
|
11959
12007
|
layers = resizeLegacyMasks(layers, prev, next.dimensions);
|
|
11960
|
-
const env = { ...next.dimensions, pattern: (pid) => _nullishCoalesce(_optionalChain([this, 'access',
|
|
12008
|
+
const env = { ...next.dimensions, pattern: (pid) => _nullishCoalesce(_optionalChain([this, 'access', _424 => _424.state, 'access', _425 => _425.patterns, 'optionalAccess', _426 => _426.find, 'call', _427 => _427((p) => p.id === pid)]), () => ( null)) };
|
|
11961
12009
|
for (const l of _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers)) {
|
|
11962
12010
|
if (l.type === "annotation") {
|
|
11963
12011
|
layers = _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, l.id, () => ({ ...l, annotation: scaleAnnotation(l.annotation, sx, sy) }));
|
|
@@ -11966,7 +12014,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11966
12014
|
const scaled = a ? scaleAnnotation(a, sx, sy) : null;
|
|
11967
12015
|
const fromAnnotation = scaled ? _chunkUYXL6ZWQcjs.shapeFromAnnotation.call(void 0, scaled) : null;
|
|
11968
12016
|
const m = [sx, 0, 0, sy, 0, 0];
|
|
11969
|
-
const components = _nullishCoalesce(_optionalChain([fromAnnotation, 'optionalAccess',
|
|
12017
|
+
const components = _nullishCoalesce(_optionalChain([fromAnnotation, 'optionalAccess', _428 => _428.components]), () => ( _chunkUYXL6ZWQcjs.transformShapeComponents.call(void 0, l.components, (p) => ({ x: p.x * sx, y: p.y * sy }), m)));
|
|
11970
12018
|
const moved = { ...l, components, ...fromAnnotation ? { fill: fromAnnotation.fill, stroke: fromAnnotation.stroke } : {} };
|
|
11971
12019
|
if (scaled && fromAnnotation) moved.annotation = scaled;
|
|
11972
12020
|
else delete moved.annotation;
|
|
@@ -11984,7 +12032,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
11984
12032
|
this.notify();
|
|
11985
12033
|
}
|
|
11986
12034
|
toJSON(options) {
|
|
11987
|
-
const root = _optionalChain([this, 'access',
|
|
12035
|
+
const root = _optionalChain([this, 'access', _429 => _429.contentsStack, 'access', _430 => _430[0], 'optionalAccess', _431 => _431.saved]);
|
|
11988
12036
|
const current = this.state;
|
|
11989
12037
|
const element = this.imageElement;
|
|
11990
12038
|
if (root) {
|
|
@@ -11995,8 +12043,8 @@ var ImageEditorController = (_class13 = class {
|
|
|
11995
12043
|
let out;
|
|
11996
12044
|
try {
|
|
11997
12045
|
out = this.serializeState();
|
|
11998
|
-
if (_optionalChain([this, 'access',
|
|
11999
|
-
if (_optionalChain([this, 'access',
|
|
12046
|
+
if (_optionalChain([this, 'access', _432 => _432.state, 'access', _433 => _433.selection, 'optionalAccess', _434 => _434.bounds])) out.selection = _chunkUYXL6ZWQcjs.serializeSelection.call(void 0, this.state.selection);
|
|
12047
|
+
if (_optionalChain([this, 'access', _435 => _435.state, 'access', _436 => _436.channels, 'optionalAccess', _437 => _437.length])) out.channels = serializeChannels(this.state.channels);
|
|
12000
12048
|
} finally {
|
|
12001
12049
|
if (root) {
|
|
12002
12050
|
this.state = current;
|
|
@@ -12110,10 +12158,10 @@ var ImageEditorController = (_class13 = class {
|
|
|
12110
12158
|
serializeState() {
|
|
12111
12159
|
const { width, height } = this.naturalSize;
|
|
12112
12160
|
const view = _chunkUYXL6ZWQcjs.legacyView.call(void 0, this.stack(), width, height, null);
|
|
12113
|
-
if (view.exact && !this.state.globalLight && !_optionalChain([this, 'access',
|
|
12161
|
+
if (view.exact && !this.state.globalLight && !_optionalChain([this, 'access', _438 => _438.state, 'access', _439 => _439.patterns, 'optionalAccess', _440 => _440.length]) && this.bitDepth === 8 && !this.state.colorProfile && !this.state.colorMode) {
|
|
12114
12162
|
return {
|
|
12115
12163
|
// States without adjustment layers keep schema 1, so they round-trip unchanged.
|
|
12116
|
-
version: _optionalChain([view, 'access',
|
|
12164
|
+
version: _optionalChain([view, 'access', _441 => _441.adjustments, 'access', _442 => _442.layers, 'optionalAccess', _443 => _443.length]) ? 2 : 1,
|
|
12117
12165
|
crop: this.state.crop ? { ...this.state.crop } : null,
|
|
12118
12166
|
transform: { ...this.state.transform },
|
|
12119
12167
|
adjustments: serializeAdjustments(view.adjustments),
|
|
@@ -12138,7 +12186,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
12138
12186
|
};
|
|
12139
12187
|
if (this.state.legacyOutputBlur !== void 0) out.legacyOutputBlur = this.state.legacyOutputBlur;
|
|
12140
12188
|
if (this.state.globalLight) out.globalLight = { ...this.state.globalLight };
|
|
12141
|
-
if (_optionalChain([this, 'access',
|
|
12189
|
+
if (_optionalChain([this, 'access', _444 => _444.state, 'access', _445 => _445.patterns, 'optionalAccess', _446 => _446.length])) out.patterns = _chunkUYXL6ZWQcjs.serializePatterns.call(void 0, this.state.patterns);
|
|
12142
12190
|
if (smartContents) out.smartContents = smartContents;
|
|
12143
12191
|
if (this.state.bitDepth === 16 || this.state.bitDepth === 32) out.bitDepth = this.state.bitDepth;
|
|
12144
12192
|
if (this.state.colorProfile) out.colorProfile = serializeColorProfile(this.state.colorProfile);
|
|
@@ -12148,7 +12196,7 @@ var ImageEditorController = (_class13 = class {
|
|
|
12148
12196
|
}, _class13);
|
|
12149
12197
|
function serializeAdjustments(adjustments) {
|
|
12150
12198
|
const out = { ...adjustments };
|
|
12151
|
-
if (_optionalChain([out, 'access',
|
|
12199
|
+
if (_optionalChain([out, 'access', _447 => _447.layers, 'optionalAccess', _448 => _448.length])) out.layers = JSON.parse(JSON.stringify(out.layers));
|
|
12152
12200
|
else delete out.layers;
|
|
12153
12201
|
if (_chunkUYXL6ZWQcjs.normalizeProcessVersion.call(void 0, out.process) === _chunkUYXL6ZWQcjs.LEGACY_PROCESS_VERSION) {
|
|
12154
12202
|
delete out.process;
|
|
@@ -12184,11 +12232,11 @@ function withDevelop(layer, partial) {
|
|
|
12184
12232
|
return { ...layer, filters };
|
|
12185
12233
|
}
|
|
12186
12234
|
function withBlur(layer, radius) {
|
|
12187
|
-
const existing = _optionalChain([layer, 'access',
|
|
12235
|
+
const existing = _optionalChain([layer, 'access', _449 => _449.filters, 'optionalAccess', _450 => _450.find, 'call', _451 => _451((f) => f.kind === "blur")]);
|
|
12188
12236
|
const filters = (_nullishCoalesce(layer.filters, () => ( []))).filter((f) => f.kind !== "blur");
|
|
12189
12237
|
if (radius > 0) {
|
|
12190
12238
|
filters.push({
|
|
12191
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
12239
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _452 => _452.id]), () => ( (layer.source === "document" ? _chunkUYXL6ZWQcjs.BLUR_FILTER_ID : _chunkUYXL6ZWQcjs.newLayerId.call(void 0, "flt")))),
|
|
12192
12240
|
kind: "blur",
|
|
12193
12241
|
enabled: true,
|
|
12194
12242
|
radius
|
|
@@ -12284,7 +12332,7 @@ function collectStateTiles(layers, into) {
|
|
|
12284
12332
|
if (l.type === "shape" || l.type === "type") _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.surface, into);
|
|
12285
12333
|
if (l.type === "smart") {
|
|
12286
12334
|
_chunkCWM3CUUXcjs.collectTiles.call(void 0, l.surface, into);
|
|
12287
|
-
if (_optionalChain([l, 'access',
|
|
12335
|
+
if (_optionalChain([l, 'access', _453 => _453.smartFilters, 'optionalAccess', _454 => _454.mask])) _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.smartFilters.mask.surface, into);
|
|
12288
12336
|
if (l.contents.raster) _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.contents.raster, into);
|
|
12289
12337
|
if (l.contents.document) collectStateTiles(l.contents.document.layers, into);
|
|
12290
12338
|
}
|
|
@@ -12316,7 +12364,7 @@ function pixelsOnly(layers) {
|
|
|
12316
12364
|
for (const l of layers) {
|
|
12317
12365
|
if (l.type === "adjustment") continue;
|
|
12318
12366
|
if (l.type === "group") out.push({ ...l, children: pixelsOnly(l.children) });
|
|
12319
|
-
else if (l.type === "pixel" && _optionalChain([l, 'access',
|
|
12367
|
+
else if (l.type === "pixel" && _optionalChain([l, 'access', _455 => _455.filters, 'optionalAccess', _456 => _456.length])) {
|
|
12320
12368
|
const p = { ...l };
|
|
12321
12369
|
delete p.filters;
|
|
12322
12370
|
out.push(p);
|
|
@@ -12382,7 +12430,7 @@ function toHex(c) {
|
|
|
12382
12430
|
return "#" + [c[0], c[1], c[2]].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("");
|
|
12383
12431
|
}
|
|
12384
12432
|
function normalizeSelection(mask) {
|
|
12385
|
-
return _optionalChain([mask, 'optionalAccess',
|
|
12433
|
+
return _optionalChain([mask, 'optionalAccess', _457 => _457.bounds]) ? mask : null;
|
|
12386
12434
|
}
|
|
12387
12435
|
function sameSelection(a, b) {
|
|
12388
12436
|
if (a.width !== b.width || a.height !== b.height) return false;
|
|
@@ -12592,7 +12640,7 @@ function loadImageEditorDocument(input) {
|
|
|
12592
12640
|
}
|
|
12593
12641
|
const state = { version: 1, ...result.value };
|
|
12594
12642
|
if (isV2) {
|
|
12595
|
-
if (_optionalChain([state, 'access',
|
|
12643
|
+
if (_optionalChain([state, 'access', _458 => _458.adjustments, 'access', _459 => _459.layers, 'optionalAccess', _460 => _460.length])) state.version = 2;
|
|
12596
12644
|
result.report.version = 2;
|
|
12597
12645
|
}
|
|
12598
12646
|
if (state.selection === void 0) delete state.selection;
|
|
@@ -12800,7 +12848,7 @@ function findAdjustmentControl(id) {
|
|
|
12800
12848
|
}
|
|
12801
12849
|
function findLayerControl(kind, id) {
|
|
12802
12850
|
if (id === "opacity") return ADJUSTMENT_LAYER_OPACITY_CONTROL;
|
|
12803
|
-
return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access',
|
|
12851
|
+
return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access', _461 => _461[kind], 'optionalAccess', _462 => _462.find, 'call', _463 => _463((c) => c.id === id)]);
|
|
12804
12852
|
}
|
|
12805
12853
|
function clampControlValue(spec, v) {
|
|
12806
12854
|
if (typeof v !== "number" || !Number.isFinite(v)) return spec.default;
|
|
@@ -13258,7 +13306,7 @@ function summary(controller) {
|
|
|
13258
13306
|
const area = _chunkUYXL6ZWQcjs.selectionArea.call(void 0, sel);
|
|
13259
13307
|
return {
|
|
13260
13308
|
empty: !sel,
|
|
13261
|
-
bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
13309
|
+
bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _464 => _464.bounds]), () => ( null)),
|
|
13262
13310
|
/** Σ coverage in pixels. */
|
|
13263
13311
|
area: Math.round(area),
|
|
13264
13312
|
percent: Math.round(area / Math.max(1, width * height) * 1e4) / 100,
|
|
@@ -13334,7 +13382,7 @@ function createImageSelectionTools(controller) {
|
|
|
13334
13382
|
break;
|
|
13335
13383
|
}
|
|
13336
13384
|
case "polygon": {
|
|
13337
|
-
const list = Array.isArray(points) ? points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess',
|
|
13385
|
+
const list = Array.isArray(points) ? points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _465 => _465.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _466 => _466.y]), NaN) })) : [];
|
|
13338
13386
|
if (list.length < 3 || !list.every((p) => Number.isFinite(p.x) && Number.isFinite(p.y))) {
|
|
13339
13387
|
throw new Error("polygon needs points: at least 3 { x, y } vertices.");
|
|
13340
13388
|
}
|
|
@@ -13571,7 +13619,7 @@ function createImageSelectionTools(controller) {
|
|
|
13571
13619
|
},
|
|
13572
13620
|
annotations: writeAnnotations("Select a polygon (lasso)", true),
|
|
13573
13621
|
handler: async (args) => {
|
|
13574
|
-
const list = Array.isArray(args.points) ? args.points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess',
|
|
13622
|
+
const list = Array.isArray(args.points) ? args.points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _467 => _467.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _468 => _468.y]), NaN) })) : [];
|
|
13575
13623
|
if (list.length < 3 || !list.every((p) => Number.isFinite(p.x) && Number.isFinite(p.y))) {
|
|
13576
13624
|
throw new Error("points needs at least 3 { x, y } vertices in natural image pixels.");
|
|
13577
13625
|
}
|
|
@@ -13608,7 +13656,7 @@ function createImageSelectionTools(controller) {
|
|
|
13608
13656
|
},
|
|
13609
13657
|
annotations: writeAnnotations("Quick Selection"),
|
|
13610
13658
|
handler: async (args) => {
|
|
13611
|
-
const strokes = Array.isArray(args.strokes) ? args.strokes.map((s) => Array.isArray(s) ? s.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess',
|
|
13659
|
+
const strokes = Array.isArray(args.strokes) ? args.strokes.map((s) => Array.isArray(s) ? s.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _469 => _469.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _470 => _470.y]), NaN) })) : []) : [];
|
|
13612
13660
|
if (!strokes.length || strokes.some((s) => !s.length || !s.every((p) => Number.isFinite(p.x) && Number.isFinite(p.y)))) {
|
|
13613
13661
|
throw new Error("strokes needs at least one stroke of { x, y } points in natural image pixels.");
|
|
13614
13662
|
}
|
|
@@ -13624,7 +13672,7 @@ function createImageSelectionTools(controller) {
|
|
|
13624
13672
|
const selectObjectTool = {
|
|
13625
13673
|
name: "select_object",
|
|
13626
13674
|
title: "Object Selection",
|
|
13627
|
-
description:
|
|
13675
|
+
description: 'Object Selection: selects the object inside rect (a box drawn loosely around it, natural image pixels; what lies outside the box is treated as background) or the object under point. With a host segmentation model it asks the model (falling back if nothing it returns fits); otherwise it finds the object from the colours of object and background and the edges between them (GrabCut). Combined with the selection by mode. A box is more reliable than a point: make it a little larger than the object on every side. Check with get_selection and capture_view, then fix with quick_select strokes or select_object with mode add / subtract. One undoable step. Returns the selection and method ("model" or "grabcut").',
|
|
13628
13676
|
inputSchema: {
|
|
13629
13677
|
type: "object",
|
|
13630
13678
|
properties: {
|
|
@@ -13638,20 +13686,25 @@ function createImageSelectionTools(controller) {
|
|
|
13638
13686
|
point: { ...pointSchema, description: "A point on the object (natural image pixels). Pass this or rect." },
|
|
13639
13687
|
mode: modeSchema,
|
|
13640
13688
|
sampleAllLayers: { type: "boolean", description: "Read every layer (default true); false reads only the active pixel layer." },
|
|
13641
|
-
enhanceEdge: { type: "boolean", description: "Smoother, less blocky edges (Auto-Enhance; default false)." }
|
|
13689
|
+
enhanceEdge: { type: "boolean", description: "Smoother, less blocky edges (Auto-Enhance; default false)." },
|
|
13690
|
+
useModel: { type: "boolean", description: "Use the host segmentation model when there is one (default true); false always uses GrabCut." }
|
|
13642
13691
|
},
|
|
13643
13692
|
additionalProperties: false
|
|
13644
13693
|
},
|
|
13645
|
-
annotations: writeAnnotations("Object Selection"),
|
|
13694
|
+
annotations: { ...writeAnnotations("Object Selection"), openWorldHint: true },
|
|
13646
13695
|
handler: async (args) => {
|
|
13647
13696
|
const rect = args.rect;
|
|
13648
13697
|
const point = args.point;
|
|
13649
13698
|
if (!rect && !point) throw new Error("Pass rect (a box around the object) or point (a point on it).");
|
|
13650
13699
|
if (rect && point) throw new Error("Pass rect or point, not both.");
|
|
13651
|
-
const options = {
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13700
|
+
const options = {
|
|
13701
|
+
mode: _chunkUYXL6ZWQcjs.parseSelectionMode.call(void 0, args.mode),
|
|
13702
|
+
sampleAllLayers: args.sampleAllLayers,
|
|
13703
|
+
enhanceEdge: args.enhanceEdge,
|
|
13704
|
+
useModel: args.useModel
|
|
13705
|
+
};
|
|
13706
|
+
const { method } = rect ? await controller.selectObject({ rect: { x: num2(rect.x, NaN), y: num2(rect.y, NaN), width: num2(rect.width, NaN), height: num2(rect.height, NaN) } }, options) : await controller.selectObject({ point: { x: num2(point.x, NaN), y: num2(point.y, NaN) } }, options);
|
|
13707
|
+
return { ...summary(controller), method };
|
|
13655
13708
|
}
|
|
13656
13709
|
};
|
|
13657
13710
|
const selectFocusAreaTool = {
|
|
@@ -13684,26 +13737,28 @@ function createImageSelectionTools(controller) {
|
|
|
13684
13737
|
const selectSkyTool = {
|
|
13685
13738
|
name: "select_sky",
|
|
13686
13739
|
title: "Select the sky",
|
|
13687
|
-
description:
|
|
13740
|
+
description: 'Select \u203A Sky: selects the sky, combined with the selection by mode. With a host segmentation model it asks the model; otherwise it finds it classically (blue, or bright and grey when overcast, smooth, reaching down from the top of the image, including patches seen through branches or gaps) with the edge fitted to the skyline. Use it to replace or recolour a sky or to adjust the land without it (invert_selection). Raise threshold to take in haze or a sunset glow, lower it if bright buildings come in. One undoable step. Returns the selection, method ("model" or "classical"; threshold and softness apply to classical), and a note when no sky was found (the selection is then unchanged).',
|
|
13688
13741
|
inputSchema: {
|
|
13689
13742
|
type: "object",
|
|
13690
13743
|
properties: {
|
|
13691
13744
|
threshold: { type: "number", minimum: 0, maximum: 100, description: "How sky-like a pixel must be, 0..100 (default 50): higher takes in less sky-like pixels." },
|
|
13692
13745
|
softness: { type: "number", minimum: 0, maximum: 100, description: "Soften the edge over this many natural pixels (default 4; 0 for a hard edge)." },
|
|
13693
13746
|
mode: modeSchema,
|
|
13694
|
-
sampleAllLayers: { type: "boolean", description: "Read every layer (default true); false reads only the active pixel layer." }
|
|
13747
|
+
sampleAllLayers: { type: "boolean", description: "Read every layer (default true); false reads only the active pixel layer." },
|
|
13748
|
+
useModel: { type: "boolean", description: "Use the host segmentation model when there is one (default true); false finds the sky classically." }
|
|
13695
13749
|
},
|
|
13696
13750
|
additionalProperties: false
|
|
13697
13751
|
},
|
|
13698
|
-
annotations: writeAnnotations("Select the sky", true),
|
|
13752
|
+
annotations: { ...writeAnnotations("Select the sky", true), openWorldHint: true },
|
|
13699
13753
|
handler: async (args) => {
|
|
13700
|
-
const { note } = await controller.selectSky({
|
|
13754
|
+
const { note, method } = await controller.selectSky({
|
|
13701
13755
|
threshold: args.threshold === void 0 ? void 0 : num2(args.threshold, 50),
|
|
13702
13756
|
softness: args.softness === void 0 ? void 0 : num2(args.softness, 4),
|
|
13703
13757
|
mode: _chunkUYXL6ZWQcjs.parseSelectionMode.call(void 0, args.mode),
|
|
13704
|
-
sampleAllLayers: args.sampleAllLayers
|
|
13758
|
+
sampleAllLayers: args.sampleAllLayers,
|
|
13759
|
+
useModel: args.useModel
|
|
13705
13760
|
});
|
|
13706
|
-
return { ...summary(controller), ...note ? { note } : {} };
|
|
13761
|
+
return { ...summary(controller), method, ...note ? { note } : {} };
|
|
13707
13762
|
}
|
|
13708
13763
|
};
|
|
13709
13764
|
const magicWandTool = {
|
|
@@ -13799,7 +13854,7 @@ function createImageSelectionTools(controller) {
|
|
|
13799
13854
|
await controller.selectColorRangePreset(args.preset, { ...common, falloff: num2(args.fuzziness, 20) });
|
|
13800
13855
|
} else {
|
|
13801
13856
|
const samples = args.samples.map((s, i) => {
|
|
13802
|
-
if (typeof _optionalChain([s, 'optionalAccess',
|
|
13857
|
+
if (typeof _optionalChain([s, 'optionalAccess', _471 => _471.color]) !== "string" || !/^#?[0-9a-f]{6}$/i.test(s.color.trim())) throw new Error(`samples[${i}].color must be #rrggbb.`);
|
|
13803
13858
|
const at = typeof s.x === "number" && typeof s.y === "number" ? { x: s.x, y: s.y } : void 0;
|
|
13804
13859
|
return at ? { color: s.color, at } : { color: s.color };
|
|
13805
13860
|
});
|
|
@@ -14320,13 +14375,13 @@ function createImageSubjectSelectionTool(controller) {
|
|
|
14320
14375
|
handler: async ({ target, maxSegments, mode, feather, enhanceEdge }, context) => {
|
|
14321
14376
|
if (target !== void 0 && typeof target !== "string") throw new Error("target must be a description in words.");
|
|
14322
14377
|
if (controller.segmentationProvider && !String(_nullishCoalesce(target, () => ( ""))).trim()) throw new Error("target must describe what to select (a model is set, and it selects by description).");
|
|
14323
|
-
const perform = _optionalChain([context, 'optionalAccess',
|
|
14378
|
+
const perform = _optionalChain([context, 'optionalAccess', _472 => _472.perform]);
|
|
14324
14379
|
const { segments, method, note } = await controller.selectSubject(String(_nullishCoalesce(target, () => ( ""))), {
|
|
14325
14380
|
mode: _chunkUYXL6ZWQcjs.parseSelectionMode.call(void 0, mode),
|
|
14326
14381
|
feather: num2(feather, 0),
|
|
14327
14382
|
maxSegments: typeof maxSegments === "number" ? Math.max(1, Math.round(maxSegments)) : void 0,
|
|
14328
14383
|
enhanceEdge: enhanceEdge === true,
|
|
14329
|
-
signal: _optionalChain([context, 'optionalAccess',
|
|
14384
|
+
signal: _optionalChain([context, 'optionalAccess', _473 => _473.signal]),
|
|
14330
14385
|
// Under playback the cursor traces what the model found, as a lasso, before it is selected.
|
|
14331
14386
|
beforeApply: perform ? (outlines) => perform(planOutlineTrace(outlines)) : void 0
|
|
14332
14387
|
});
|
|
@@ -14404,7 +14459,7 @@ async function renderImageRegion(controller, request) {
|
|
|
14404
14459
|
const maskView = maskViewCanvas(controller, document);
|
|
14405
14460
|
if (maskView) context.drawImage(maskView, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
|
|
14406
14461
|
const selection = state.selection;
|
|
14407
|
-
if (_optionalChain([selection, 'optionalAccess',
|
|
14462
|
+
if (_optionalChain([selection, 'optionalAccess', _474 => _474.bounds]) && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
|
|
14408
14463
|
const shade = selectionShade(selection, document);
|
|
14409
14464
|
if (shade) context.drawImage(shade, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
|
|
14410
14465
|
}
|
|
@@ -14429,7 +14484,7 @@ function createImageCaptureSurface(controller) {
|
|
|
14429
14484
|
return {
|
|
14430
14485
|
units: "image pixels",
|
|
14431
14486
|
content: whole,
|
|
14432
|
-
selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access',
|
|
14487
|
+
selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access', _475 => _475.getState, 'call', _476 => _476(), 'access', _477 => _477.selection, 'optionalAccess', _478 => _478.bounds]), () => ( null)) }),
|
|
14433
14488
|
overlays: "a shade over unselected pixels, the crop box outline and a layer mask view (set_mask_view)",
|
|
14434
14489
|
maxScale: 8,
|
|
14435
14490
|
render: (request) => renderImageRegion(controller, request)
|
|
@@ -14763,7 +14818,7 @@ function describeLayer(layer, activeId, boundsOf) {
|
|
|
14763
14818
|
out.bounds = boundsOf(layer);
|
|
14764
14819
|
out.fillOpacity = round3(_nullishCoalesce(layer.fillOpacity, () => ( 1)));
|
|
14765
14820
|
out.shape = {
|
|
14766
|
-
components: layer.components.map((c) => ({ op: c.op, kind: _nullishCoalesce(_optionalChain([c, 'access',
|
|
14821
|
+
components: layer.components.map((c) => ({ op: c.op, kind: _nullishCoalesce(_optionalChain([c, 'access', _479 => _479.live, 'optionalAccess', _480 => _480.kind]), () => ( "path")) })),
|
|
14767
14822
|
fill: layer.fill ? layer.fill.type : null,
|
|
14768
14823
|
stroke: layer.stroke ? { width: layer.stroke.width, paint: layer.stroke.paint.type } : null
|
|
14769
14824
|
};
|
|
@@ -14786,8 +14841,8 @@ function describeLayer(layer, activeId, boundsOf) {
|
|
|
14786
14841
|
out.bounds = boundsOf(layer);
|
|
14787
14842
|
out.fillOpacity = round3(_nullishCoalesce(layer.fillOpacity, () => ( 1)));
|
|
14788
14843
|
out.contents = { id: layer.contents.id, name: layer.contents.name, kind: layer.contents.kind, width: layer.contents.width, height: layer.contents.height };
|
|
14789
|
-
out.smartFilters = (_nullishCoalesce(_optionalChain([layer, 'access',
|
|
14790
|
-
out.filterMask = maskSummary(_optionalChain([layer, 'access',
|
|
14844
|
+
out.smartFilters = (_nullishCoalesce(_optionalChain([layer, 'access', _481 => _481.smartFilters, 'optionalAccess', _482 => _482.filters]), () => ( []))).map((f) => ({ id: f.id, kind: f.kind, enabled: f.enabled }));
|
|
14845
|
+
out.filterMask = maskSummary(_optionalChain([layer, 'access', _483 => _483.smartFilters, 'optionalAccess', _484 => _484.mask]));
|
|
14791
14846
|
break;
|
|
14792
14847
|
}
|
|
14793
14848
|
return out;
|
|
@@ -14815,7 +14870,7 @@ function createImageLayerTools(controller) {
|
|
|
14815
14870
|
if (!loc) return null;
|
|
14816
14871
|
return {
|
|
14817
14872
|
...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)),
|
|
14818
|
-
parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
14873
|
+
parentId: _nullishCoalesce(_optionalChain([loc, 'access', _485 => _485.parent, 'optionalAccess', _486 => _486.id]), () => ( null)),
|
|
14819
14874
|
index: loc.index
|
|
14820
14875
|
};
|
|
14821
14876
|
};
|
|
@@ -15138,7 +15193,7 @@ function createImageLayerTools(controller) {
|
|
|
15138
15193
|
if (view !== "gray" && view !== "overlay" && view !== "off") throw new Error(`Unknown view "${String(view)}". Use gray, overlay or off.`);
|
|
15139
15194
|
const id = view === "off" || layerId === void 0 ? void 0 : exists(layerId);
|
|
15140
15195
|
const shown = controller.setMaskView(view, id);
|
|
15141
|
-
return { view: _nullishCoalesce(_optionalChain([shown, 'optionalAccess',
|
|
15196
|
+
return { view: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _487 => _487.mode]), () => ( "off")), layerId: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _488 => _488.layerId]), () => ( null)) };
|
|
15142
15197
|
}
|
|
15143
15198
|
};
|
|
15144
15199
|
const maskProps = {
|
|
@@ -16000,7 +16055,7 @@ function handleSelectionShortcut(controller, e, onError) {
|
|
|
16000
16055
|
try {
|
|
16001
16056
|
fn();
|
|
16002
16057
|
} catch (err) {
|
|
16003
|
-
_optionalChain([onError, 'optionalCall',
|
|
16058
|
+
_optionalChain([onError, 'optionalCall', _489 => _489(err instanceof Error ? err.message : String(err))]);
|
|
16004
16059
|
}
|
|
16005
16060
|
return true;
|
|
16006
16061
|
};
|
|
@@ -16015,9 +16070,9 @@ function handleMaskViewKey(controller, e) {
|
|
|
16015
16070
|
if (e.ctrlKey || e.metaKey || e.altKey || e.key !== "\\") return false;
|
|
16016
16071
|
const id = controller.getState().activeLayerId;
|
|
16017
16072
|
const layer = id ? controller.getLayer(id) : null;
|
|
16018
|
-
if (!_optionalChain([layer, 'optionalAccess',
|
|
16073
|
+
if (!_optionalChain([layer, 'optionalAccess', _490 => _490.mask]) || layer.mask.source) return false;
|
|
16019
16074
|
const view = controller.getMaskView();
|
|
16020
|
-
controller.setMaskView(_optionalChain([view, 'optionalAccess',
|
|
16075
|
+
controller.setMaskView(_optionalChain([view, 'optionalAccess', _491 => _491.layerId]) === layer.id && view.mode === "overlay" ? "off" : "overlay", layer.id);
|
|
16021
16076
|
return true;
|
|
16022
16077
|
}
|
|
16023
16078
|
function handleQuickMaskKey(controller, e) {
|
|
@@ -16231,7 +16286,7 @@ var PaintGesture = (_class15 = class {
|
|
|
16231
16286
|
const layer = this.controller.getActiveLayer();
|
|
16232
16287
|
if (!layer) throw new Error("Select a layer to move in the Layers panel.");
|
|
16233
16288
|
if (layer.type !== "pixel" && layer.type !== "shape" && layer.type !== "smart") throw new Error(`Only pixel, shape and smart object layers move; "${layer.name}" is a ${layer.type} layer.`);
|
|
16234
|
-
if (_optionalChain([layer, 'access',
|
|
16289
|
+
if (_optionalChain([layer, 'access', _492 => _492.locks, 'optionalAccess', _493 => _493.all]) || _optionalChain([layer, 'access', _494 => _494.locks, 'optionalAccess', _495 => _495.position])) throw new Error(`Layer "${layer.name}" has its position locked.`);
|
|
16235
16290
|
const origin = layer.type === "pixel" ? { ...layer.offset } : layer.type === "smart" ? { ...layer.placement.corners[0] } : (() => {
|
|
16236
16291
|
const b = _chunkUYXL6ZWQcjs.shapeGeometryBounds.call(void 0, layer);
|
|
16237
16292
|
return b ? { x: b.x, y: b.y } : { x: 0, y: 0 };
|
|
@@ -16288,7 +16343,7 @@ var PaintGesture = (_class15 = class {
|
|
|
16288
16343
|
this.move = null;
|
|
16289
16344
|
}
|
|
16290
16345
|
cancel() {
|
|
16291
|
-
_optionalChain([this, 'access',
|
|
16346
|
+
_optionalChain([this, 'access', _496 => _496.stroke, 'optionalAccess', _497 => _497.cancel, 'call', _498 => _498()]);
|
|
16292
16347
|
this.stroke = null;
|
|
16293
16348
|
this.move = null;
|
|
16294
16349
|
}
|
|
@@ -17369,7 +17424,7 @@ function createImageSmartObjectTools(controller) {
|
|
|
17369
17424
|
const layerSummary = (id) => {
|
|
17370
17425
|
const s = controller.getState();
|
|
17371
17426
|
const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
|
|
17372
|
-
return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
17427
|
+
return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _499 => _499.parent, 'optionalAccess', _500 => _500.id]), () => ( null)), index: loc.index } : null;
|
|
17373
17428
|
};
|
|
17374
17429
|
const getSmart = {
|
|
17375
17430
|
name: "get_smart_object",
|
|
@@ -17926,7 +17981,7 @@ function createImageShapeTools(controller) {
|
|
|
17926
17981
|
const layerSummary = (id) => {
|
|
17927
17982
|
const s = controller.getState();
|
|
17928
17983
|
const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
|
|
17929
|
-
return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
17984
|
+
return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _501 => _501.parent, 'optionalAccess', _502 => _502.id]), () => ( null)), index: loc.index } : null;
|
|
17930
17985
|
};
|
|
17931
17986
|
const get = {
|
|
17932
17987
|
name: "get_shape_layer",
|
|
@@ -18143,7 +18198,7 @@ function createImageShapeTools(controller) {
|
|
|
18143
18198
|
const mode = args.mode;
|
|
18144
18199
|
controller.pathToSelection(pathSpec(args), { feather: args.feather, antiAlias: args.antiAlias, mode });
|
|
18145
18200
|
const sel = controller.getSelection();
|
|
18146
|
-
return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
18201
|
+
return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _503 => _503.bounds]), () => ( null)), area: Math.round(sel ? _chunkUYXL6ZWQcjs.selectionArea.call(void 0, sel) : 0) };
|
|
18147
18202
|
}
|
|
18148
18203
|
};
|
|
18149
18204
|
const getVectorMask = {
|
|
@@ -18174,7 +18229,7 @@ function createImageShapeTools(controller) {
|
|
|
18174
18229
|
handler: (args) => {
|
|
18175
18230
|
const id = layerArg(args.layerId);
|
|
18176
18231
|
const spec = pathSpec(args);
|
|
18177
|
-
const hasPath = _optionalChain([spec, 'access',
|
|
18232
|
+
const hasPath = _optionalChain([spec, 'access', _504 => _504.components, 'optionalAccess', _505 => _505.length]) || spec.shape !== void 0 || spec.subpaths !== void 0;
|
|
18178
18233
|
const from = _nullishCoalesce(args.from, () => ( (hasPath ? "path" : "reveal-all")));
|
|
18179
18234
|
if (from !== "selection" && TRACE_KEYS.some((k) => args[k] !== void 0)) throw new Error("tolerance, cornerRoundness and minArea apply only to from selection.");
|
|
18180
18235
|
controller.addVectorMask(id, from, spec, traceOptions(args));
|
|
@@ -18294,7 +18349,7 @@ function createImageTypeTools(controller) {
|
|
|
18294
18349
|
const layerSummary = (id) => {
|
|
18295
18350
|
const s = controller.getState();
|
|
18296
18351
|
const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
|
|
18297
|
-
return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
18352
|
+
return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _506 => _506.parent, 'optionalAccess', _507 => _507.id]), () => ( null)), index: loc.index } : null;
|
|
18298
18353
|
};
|
|
18299
18354
|
const range = (args) => ({ start: args.start, end: args.end });
|
|
18300
18355
|
const listFonts = {
|
|
@@ -18303,7 +18358,7 @@ function createImageTypeTools(controller) {
|
|
|
18303
18358
|
description: "Returns the font families type layers can use here (generic families such as sans-serif always work). Changes nothing.",
|
|
18304
18359
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
18305
18360
|
annotations: { title: "List fonts", ...READ11 },
|
|
18306
|
-
handler: () => ({ families: controller.listFonts(), shaper: _nullishCoalesce(_optionalChain([controller, 'access',
|
|
18361
|
+
handler: () => ({ families: controller.listFonts(), shaper: _nullishCoalesce(_optionalChain([controller, 'access', _508 => _508.getTextShaper, 'call', _509 => _509(), 'optionalAccess', _510 => _510.id]), () => ( null)) })
|
|
18307
18362
|
};
|
|
18308
18363
|
const get = {
|
|
18309
18364
|
name: "get_text_layer",
|
|
@@ -18459,7 +18514,7 @@ function createImageTypeTools(controller) {
|
|
|
18459
18514
|
const init = pick2(args, ["text", "x", "y", "orientation", "box", "style", "paragraph", "rotation", "mode", "feather", "antiAlias"]);
|
|
18460
18515
|
controller.selectTextShape(init);
|
|
18461
18516
|
const sel = controller.getSelection();
|
|
18462
|
-
return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
18517
|
+
return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _511 => _511.bounds]), () => ( null)), area: Math.round(sel ? _chunkUYXL6ZWQcjs.selectionArea.call(void 0, sel) : 0) };
|
|
18463
18518
|
}
|
|
18464
18519
|
};
|
|
18465
18520
|
return [listFonts, get, add2, setText, setStyle, setParagraph, setFrame, setOrientation, toShape, typeMask];
|
|
@@ -18638,7 +18693,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
18638
18693
|
for (const ref of [aboveId, parentId]) {
|
|
18639
18694
|
if (ref !== void 0 && !controller.getLayer(ref)) throw new Error(`Unknown layer "${ref}". Call list_layers for ids.`);
|
|
18640
18695
|
}
|
|
18641
|
-
if (parentId !== void 0 && _optionalChain([controller, 'access',
|
|
18696
|
+
if (parentId !== void 0 && _optionalChain([controller, 'access', _512 => _512.getLayer, 'call', _513 => _513(parentId), 'optionalAccess', _514 => _514.type]) !== "group") throw new Error(`Layer "${parentId}" is not a group.`);
|
|
18642
18697
|
const id = controller.addAdjustmentLayer({ kind, params, opacity, blend, name, aboveId, parentId, useSelection: useSelection !== false });
|
|
18643
18698
|
const layer = controller.getAdjustmentLayer(id);
|
|
18644
18699
|
return { layer: JSON.parse(JSON.stringify(layer)), index: controller.getAdjustmentLayers().findIndex((l) => l.id === id), masked: Boolean(layer.mask) };
|
|
@@ -18952,7 +19007,7 @@ function maskThumbnailClick(controller, layer, e) {
|
|
|
18952
19007
|
} else if (e.altKey && !layer.mask.source) {
|
|
18953
19008
|
const mode = e.shiftKey ? "overlay" : "gray";
|
|
18954
19009
|
const view = controller.getMaskView();
|
|
18955
|
-
controller.setMaskView(_optionalChain([view, 'optionalAccess',
|
|
19010
|
+
controller.setMaskView(_optionalChain([view, 'optionalAccess', _515 => _515.layerId]) === layer.id && view.mode === mode ? "off" : mode, layer.id);
|
|
18956
19011
|
} else if (e.shiftKey) {
|
|
18957
19012
|
controller.setLayerMaskProps(layer.id, { enabled: layer.mask.enabled === false });
|
|
18958
19013
|
} else {
|
|
@@ -19016,7 +19071,7 @@ function layerHasThumbnail(layer) {
|
|
|
19016
19071
|
return layer.type === "pixel" || layer.type === "shape" || layer.type === "type";
|
|
19017
19072
|
}
|
|
19018
19073
|
function layerWarning(layer) {
|
|
19019
|
-
if (layer.type === "type" && _optionalChain([layer, 'access',
|
|
19074
|
+
if (layer.type === "type" && _optionalChain([layer, 'access', _516 => _516.missingFonts, 'optionalAccess', _517 => _517.length])) {
|
|
19020
19075
|
return `Missing ${layer.missingFonts.length === 1 ? "font" : "fonts"}: ${layer.missingFonts.join(", ")}. ${layer.rendering === "stored" ? "Showing the saved pixels until the text is edited." : "Drawn with a fallback font."}`;
|
|
19021
19076
|
}
|
|
19022
19077
|
return null;
|
|
@@ -19039,16 +19094,16 @@ function layerMenu(controller) {
|
|
|
19039
19094
|
const siblings = loc ? loc.parent ? loc.parent.children : s.layers : [];
|
|
19040
19095
|
const below = loc ? siblings[loc.index - 1] : void 0;
|
|
19041
19096
|
const hasSel = controller.hasSelection;
|
|
19042
|
-
const isPixel = _optionalChain([active, 'optionalAccess',
|
|
19043
|
-
const hasOwnPixels = _optionalChain([active, 'optionalAccess',
|
|
19097
|
+
const isPixel = _optionalChain([active, 'optionalAccess', _518 => _518.type]) === "pixel";
|
|
19098
|
+
const hasOwnPixels = _optionalChain([active, 'optionalAccess', _519 => _519.type]) === "pixel" || _optionalChain([active, 'optionalAccess', _520 => _520.type]) === "shape" || _optionalChain([active, 'optionalAccess', _521 => _521.type]) === "type" || _optionalChain([active, 'optionalAccess', _522 => _522.type]) === "smart";
|
|
19044
19099
|
return [
|
|
19045
19100
|
{ action: "new-layer", label: "New Layer", enabled: true },
|
|
19046
19101
|
{ action: "new-group", label: "New Group", enabled: true },
|
|
19047
19102
|
{ action: "duplicate", label: "Duplicate Layer", enabled: Boolean(active) },
|
|
19048
19103
|
{ action: "delete", label: "Delete Layer", enabled: Boolean(active) },
|
|
19049
19104
|
{ action: "group-selected", label: "Group Layer", enabled: Boolean(active) },
|
|
19050
|
-
{ action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess',
|
|
19051
|
-
{ action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
19105
|
+
{ action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess', _523 => _523.type]) === "group" },
|
|
19106
|
+
{ action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess', _524 => _524.visible]) && _optionalChain([below, 'optionalAccess', _525 => _525.type]) === "pixel") },
|
|
19052
19107
|
{ action: "merge-visible", label: "Merge Visible", enabled: s.layers.some((l) => l.visible) },
|
|
19053
19108
|
{ action: "flatten", label: "Flatten Image", enabled: s.layers.length > 0 },
|
|
19054
19109
|
{ action: "via-copy", label: "Layer via Copy", enabled: isPixel && hasSel },
|
|
@@ -19058,27 +19113,27 @@ function layerMenu(controller) {
|
|
|
19058
19113
|
{ action: "add-mask-hide-selection", label: "Add Mask Hiding Selection", enabled: Boolean(active) && hasSel },
|
|
19059
19114
|
{ action: "add-mask-transparency", label: "Add Mask from Transparency", enabled: hasOwnPixels },
|
|
19060
19115
|
{ action: "select-transparency", label: "Select Layer Pixels", enabled: hasOwnPixels },
|
|
19061
|
-
{ action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess',
|
|
19062
|
-
{ action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
19063
|
-
{ action: "toggle-mask", label: _optionalChain([active, 'optionalAccess',
|
|
19064
|
-
{ action: "toggle-mask-link", label: _optionalChain([active, 'optionalAccess',
|
|
19065
|
-
{ action: "add-vector-mask", label: "Add Vector Mask (Reveal All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access',
|
|
19066
|
-
{ action: "add-vector-mask-hide", label: "Add Vector Mask (Hide All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access',
|
|
19067
|
-
{ action: "add-vector-mask-selection", label: "Add Vector Mask from Selection", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access',
|
|
19068
|
-
{ action: "delete-vector-mask", label: "Delete Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
19069
|
-
{ action: "toggle-vector-mask", label: _optionalChain([active, 'optionalAccess',
|
|
19070
|
-
{ action: "rasterize-vector-mask", label: "Rasterize Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
19071
|
-
{ action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess',
|
|
19116
|
+
{ action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess', _526 => _526.mask])) },
|
|
19117
|
+
{ action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _527 => _527.mask])) },
|
|
19118
|
+
{ action: "toggle-mask", label: _optionalChain([active, 'optionalAccess', _528 => _528.mask, 'optionalAccess', _529 => _529.enabled]) === false ? "Enable Layer Mask" : "Disable Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _530 => _530.mask])) },
|
|
19119
|
+
{ action: "toggle-mask-link", label: _optionalChain([active, 'optionalAccess', _531 => _531.mask, 'optionalAccess', _532 => _532.linked]) === false ? "Link Layer Mask" : "Unlink Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _533 => _533.mask]) && !active.mask.source) },
|
|
19120
|
+
{ action: "add-vector-mask", label: "Add Vector Mask (Reveal All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _534 => _534.mask, 'optionalAccess', _535 => _535.source])) },
|
|
19121
|
+
{ action: "add-vector-mask-hide", label: "Add Vector Mask (Hide All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _536 => _536.mask, 'optionalAccess', _537 => _537.source])) },
|
|
19122
|
+
{ action: "add-vector-mask-selection", label: "Add Vector Mask from Selection", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _538 => _538.mask, 'optionalAccess', _539 => _539.source])) && hasSel },
|
|
19123
|
+
{ action: "delete-vector-mask", label: "Delete Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _540 => _540.vectorMask])) },
|
|
19124
|
+
{ action: "toggle-vector-mask", label: _optionalChain([active, 'optionalAccess', _541 => _541.vectorMask, 'optionalAccess', _542 => _542.enabled]) === false ? "Enable Vector Mask" : "Disable Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _543 => _543.vectorMask])) },
|
|
19125
|
+
{ action: "rasterize-vector-mask", label: "Rasterize Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _544 => _544.vectorMask])) },
|
|
19126
|
+
{ action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess', _545 => _545.type]) === "annotation" || _optionalChain([active, 'optionalAccess', _546 => _546.type]) === "smart" || _optionalChain([active, 'optionalAccess', _547 => _547.type]) === "shape" || _optionalChain([active, 'optionalAccess', _548 => _548.type]) === "type" || isPixel && Boolean(_optionalChain([active, 'optionalAccess', _549 => _549.type]) === "pixel" && _optionalChain([active, 'access', _550 => _550.filters, 'optionalAccess', _551 => _551.length])) },
|
|
19072
19127
|
{ action: "convert-smart", label: "Convert to Smart Object", enabled: Boolean(active && active.type !== "annotation") },
|
|
19073
|
-
{ action: "edit-contents", label: "Edit Contents", enabled: _optionalChain([active, 'optionalAccess',
|
|
19074
|
-
{ action: "smart-via-copy", label: "New Smart Object via Copy", enabled: _optionalChain([active, 'optionalAccess',
|
|
19075
|
-
{ action: "add-filter-mask", label: "Add Smart Filter Mask", enabled: _optionalChain([active, 'optionalAccess',
|
|
19076
|
-
{ action: "toggle-clip", label: _optionalChain([active, 'optionalAccess',
|
|
19128
|
+
{ action: "edit-contents", label: "Edit Contents", enabled: _optionalChain([active, 'optionalAccess', _552 => _552.type]) === "smart" },
|
|
19129
|
+
{ action: "smart-via-copy", label: "New Smart Object via Copy", enabled: _optionalChain([active, 'optionalAccess', _553 => _553.type]) === "smart" },
|
|
19130
|
+
{ action: "add-filter-mask", label: "Add Smart Filter Mask", enabled: _optionalChain([active, 'optionalAccess', _554 => _554.type]) === "smart" && !_optionalChain([active, 'access', _555 => _555.smartFilters, 'optionalAccess', _556 => _556.mask]) },
|
|
19131
|
+
{ action: "toggle-clip", label: _optionalChain([active, 'optionalAccess', _557 => _557.clipped]) ? "Release Clipping Mask" : "Create Clipping Mask", enabled: Boolean(loc && loc.index > 0) }
|
|
19077
19132
|
];
|
|
19078
19133
|
}
|
|
19079
19134
|
async function runLayerMenuAction(controller, action) {
|
|
19080
19135
|
const active = controller.getActiveLayer();
|
|
19081
|
-
const id = _optionalChain([active, 'optionalAccess',
|
|
19136
|
+
const id = _optionalChain([active, 'optionalAccess', _558 => _558.id]);
|
|
19082
19137
|
try {
|
|
19083
19138
|
switch (action) {
|
|
19084
19139
|
case "new-layer":
|
|
@@ -19134,10 +19189,10 @@ async function runLayerMenuAction(controller, action) {
|
|
|
19134
19189
|
if (id) controller.removeLayerMask(id);
|
|
19135
19190
|
break;
|
|
19136
19191
|
case "toggle-mask":
|
|
19137
|
-
if (id && _optionalChain([active, 'optionalAccess',
|
|
19192
|
+
if (id && _optionalChain([active, 'optionalAccess', _559 => _559.mask])) controller.setLayerMaskProps(id, { enabled: active.mask.enabled === false });
|
|
19138
19193
|
break;
|
|
19139
19194
|
case "toggle-mask-link":
|
|
19140
|
-
if (id && _optionalChain([active, 'optionalAccess',
|
|
19195
|
+
if (id && _optionalChain([active, 'optionalAccess', _560 => _560.mask])) controller.setLayerMaskProps(id, { linked: active.mask.linked === false });
|
|
19141
19196
|
break;
|
|
19142
19197
|
case "add-vector-mask":
|
|
19143
19198
|
case "add-vector-mask-hide":
|
|
@@ -19150,7 +19205,7 @@ async function runLayerMenuAction(controller, action) {
|
|
|
19150
19205
|
if (id) controller.removeVectorMask(id);
|
|
19151
19206
|
break;
|
|
19152
19207
|
case "toggle-vector-mask":
|
|
19153
|
-
if (id && _optionalChain([active, 'optionalAccess',
|
|
19208
|
+
if (id && _optionalChain([active, 'optionalAccess', _561 => _561.vectorMask])) controller.setVectorMaskProps(id, { enabled: active.vectorMask.enabled === false });
|
|
19154
19209
|
break;
|
|
19155
19210
|
case "rasterize-vector-mask":
|
|
19156
19211
|
if (id) controller.rasterizeVectorMask(id);
|
|
@@ -19171,7 +19226,7 @@ async function runLayerMenuAction(controller, action) {
|
|
|
19171
19226
|
if (id) controller.setSmartFilterMask(id, "reveal-all");
|
|
19172
19227
|
break;
|
|
19173
19228
|
case "toggle-clip":
|
|
19174
|
-
if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess',
|
|
19229
|
+
if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess', _562 => _562.clipped]) });
|
|
19175
19230
|
break;
|
|
19176
19231
|
}
|
|
19177
19232
|
return null;
|
|
@@ -19181,7 +19236,7 @@ async function runLayerMenuAction(controller, action) {
|
|
|
19181
19236
|
}
|
|
19182
19237
|
function smartFilterRows(layer) {
|
|
19183
19238
|
if (layer.type !== "smart") return [];
|
|
19184
|
-
const list = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
19239
|
+
const list = _nullishCoalesce(_optionalChain([layer, 'access', _563 => _563.smartFilters, 'optionalAccess', _564 => _564.filters]), () => ( []));
|
|
19185
19240
|
const rows = list.map((f, index) => ({
|
|
19186
19241
|
filter: f,
|
|
19187
19242
|
index,
|
|
@@ -19207,8 +19262,8 @@ function extractNormalizedLayerItems(controller, fallbackImageUrl = "") {
|
|
|
19207
19262
|
};
|
|
19208
19263
|
collectSerialized(_nullishCoalesce(serialized.layers, () => ( [])));
|
|
19209
19264
|
const sLayerMap = new Map(allSerializedLayers.map((sl) => [sl.id, sl]));
|
|
19210
|
-
const imgW = _optionalChain([state, 'access',
|
|
19211
|
-
const imgH = _optionalChain([state, 'access',
|
|
19265
|
+
const imgW = _optionalChain([state, 'access', _565 => _565.imageDimensions, 'optionalAccess', _566 => _566.width]) || 1;
|
|
19266
|
+
const imgH = _optionalChain([state, 'access', _567 => _567.imageDimensions, 'optionalAccess', _568 => _568.height]) || 1;
|
|
19212
19267
|
return ctrlLayers.map((l) => {
|
|
19213
19268
|
const bounds = controller.getLayerBounds(l.id) || {
|
|
19214
19269
|
x: 0,
|
|
@@ -19217,8 +19272,8 @@ function extractNormalizedLayerItems(controller, fallbackImageUrl = "") {
|
|
|
19217
19272
|
height: imgH
|
|
19218
19273
|
};
|
|
19219
19274
|
const sLayer = sLayerMap.get(l.id);
|
|
19220
|
-
const assetKey = _optionalChain([sLayer, 'optionalAccess',
|
|
19221
|
-
const layerDataUrl = assetKey && assets[assetKey] || assets[l.id] || (_optionalChain([sLayer, 'optionalAccess',
|
|
19275
|
+
const assetKey = _optionalChain([sLayer, 'optionalAccess', _569 => _569.asset]);
|
|
19276
|
+
const layerDataUrl = assetKey && assets[assetKey] || assets[l.id] || (_optionalChain([sLayer, 'optionalAccess', _570 => _570.source]) === "document" ? fallbackImageUrl : "");
|
|
19222
19277
|
return {
|
|
19223
19278
|
id: l.id,
|
|
19224
19279
|
name: l.name || "Untitled Layer",
|
|
@@ -19272,9 +19327,9 @@ async function addLayerOfKind(controller, id, init) {
|
|
|
19272
19327
|
const cx = Math.round(canvas.width / 2);
|
|
19273
19328
|
const cy = Math.round(canvas.height / 2);
|
|
19274
19329
|
return controller.addTextLayer({
|
|
19275
|
-
text: _optionalChain([init, 'optionalAccess',
|
|
19276
|
-
x: typeof _optionalChain([init, 'optionalAccess',
|
|
19277
|
-
y: typeof _optionalChain([init, 'optionalAccess',
|
|
19330
|
+
text: _optionalChain([init, 'optionalAccess', _571 => _571.text]) || "New Text",
|
|
19331
|
+
x: typeof _optionalChain([init, 'optionalAccess', _572 => _572.x]) === "number" ? init.x : cx - 100,
|
|
19332
|
+
y: typeof _optionalChain([init, 'optionalAccess', _573 => _573.y]) === "number" ? init.y : cy,
|
|
19278
19333
|
...init
|
|
19279
19334
|
});
|
|
19280
19335
|
}
|
|
@@ -19287,10 +19342,10 @@ async function addLayerOfKind(controller, id, init) {
|
|
|
19287
19342
|
return controller.addShapeLayer({
|
|
19288
19343
|
shape: {
|
|
19289
19344
|
kind: "rect",
|
|
19290
|
-
x: typeof _optionalChain([init, 'optionalAccess',
|
|
19291
|
-
y: typeof _optionalChain([init, 'optionalAccess',
|
|
19292
|
-
width: typeof _optionalChain([init, 'optionalAccess',
|
|
19293
|
-
height: typeof _optionalChain([init, 'optionalAccess',
|
|
19345
|
+
x: typeof _optionalChain([init, 'optionalAccess', _574 => _574.x]) === "number" ? init.x : cx - Math.round(w / 2),
|
|
19346
|
+
y: typeof _optionalChain([init, 'optionalAccess', _575 => _575.y]) === "number" ? init.y : cy - Math.round(h / 2),
|
|
19347
|
+
width: typeof _optionalChain([init, 'optionalAccess', _576 => _576.width]) === "number" ? init.width : w,
|
|
19348
|
+
height: typeof _optionalChain([init, 'optionalAccess', _577 => _577.height]) === "number" ? init.height : h
|
|
19294
19349
|
},
|
|
19295
19350
|
name: "Rectangle",
|
|
19296
19351
|
...init
|
|
@@ -19305,10 +19360,10 @@ async function addLayerOfKind(controller, id, init) {
|
|
|
19305
19360
|
return controller.addShapeLayer({
|
|
19306
19361
|
shape: {
|
|
19307
19362
|
kind: "ellipse",
|
|
19308
|
-
x: typeof _optionalChain([init, 'optionalAccess',
|
|
19309
|
-
y: typeof _optionalChain([init, 'optionalAccess',
|
|
19310
|
-
width: typeof _optionalChain([init, 'optionalAccess',
|
|
19311
|
-
height: typeof _optionalChain([init, 'optionalAccess',
|
|
19363
|
+
x: typeof _optionalChain([init, 'optionalAccess', _578 => _578.x]) === "number" ? init.x : cx - Math.round(w / 2),
|
|
19364
|
+
y: typeof _optionalChain([init, 'optionalAccess', _579 => _579.y]) === "number" ? init.y : cy - Math.round(h / 2),
|
|
19365
|
+
width: typeof _optionalChain([init, 'optionalAccess', _580 => _580.width]) === "number" ? init.width : w,
|
|
19366
|
+
height: typeof _optionalChain([init, 'optionalAccess', _581 => _581.height]) === "number" ? init.height : h
|
|
19312
19367
|
},
|
|
19313
19368
|
name: "Ellipse",
|
|
19314
19369
|
...init
|
|
@@ -19369,18 +19424,18 @@ function layerEffectsPanel(layer) {
|
|
|
19369
19424
|
if (!layer) return { ...empty, available: false, reason: "Select a layer to add a layer style." };
|
|
19370
19425
|
if (layer.type === "adjustment") return { ...empty, available: false, reason: "Adjustment layers cannot have a layer style." };
|
|
19371
19426
|
const fx = layer.effects;
|
|
19372
|
-
const readOnly = Boolean(_optionalChain([layer, 'access',
|
|
19427
|
+
const readOnly = Boolean(_optionalChain([layer, 'access', _582 => _582.locks, 'optionalAccess', _583 => _583.all]));
|
|
19373
19428
|
return {
|
|
19374
19429
|
available: true,
|
|
19375
19430
|
readOnly,
|
|
19376
19431
|
reason: readOnly ? "The layer is locked; unlock it to change its layer style." : void 0,
|
|
19377
|
-
enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess',
|
|
19378
|
-
scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess',
|
|
19379
|
-
rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess',
|
|
19432
|
+
enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _584 => _584.enabled]), () => ( true)),
|
|
19433
|
+
scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _585 => _585.scale]), () => ( 1)),
|
|
19434
|
+
rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess', _586 => _586.items]), () => ( []))).map((e) => ({ id: e.id, kind: e.kind, label: _chunkHGTDMKNEcjs.layerEffectLabel.call(void 0, e.kind), enabled: e.enabled }))
|
|
19380
19435
|
};
|
|
19381
19436
|
}
|
|
19382
19437
|
function layerEffectsBadge(layer) {
|
|
19383
|
-
if (!_optionalChain([layer, 'access',
|
|
19438
|
+
if (!_optionalChain([layer, 'access', _587 => _587.effects, 'optionalAccess', _588 => _588.items, 'access', _589 => _589.length])) return null;
|
|
19384
19439
|
return _chunkHGTDMKNEcjs.hasActiveEffects.call(void 0, layer.effects) ? "on" : "off";
|
|
19385
19440
|
}
|
|
19386
19441
|
var LAYER_EFFECT_MENU = _chunkHGTDMKNEcjs.LAYER_EFFECT_KINDS.map((kind) => ({ kind, label: _chunkHGTDMKNEcjs.layerEffectLabel.call(void 0, kind) }));
|
|
@@ -19425,8 +19480,8 @@ function fillControls(f, allowPattern, patterns) {
|
|
|
19425
19480
|
}
|
|
19426
19481
|
function gradientControls(prefix, g) {
|
|
19427
19482
|
return [
|
|
19428
|
-
{ key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access',
|
|
19429
|
-
{ key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access',
|
|
19483
|
+
{ key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _590 => _590.stops, 'access', _591 => _591[0], 'optionalAccess', _592 => _592.color]), () => ( "#000000")) },
|
|
19484
|
+
{ key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _593 => _593.stops, 'access', _594 => _594[g.stops.length - 1], 'optionalAccess', _595 => _595.color]), () => ( "#ffffff")) },
|
|
19430
19485
|
{ key: `${prefix}.style`, label: "Style", type: "select", value: g.style, options: opt(["linear", "Linear"], ["radial", "Radial"], ["angle", "Angle"], ["reflected", "Reflected"], ["diamond", "Diamond"]) },
|
|
19431
19486
|
{ key: `${prefix}.angle`, label: "Angle", type: "range", min: -180, max: 180, step: 1, value: g.angle, unit: "\xB0" },
|
|
19432
19487
|
{ key: `${prefix}.scale`, label: "Scale", type: "range", min: 0.1, max: 1.5, step: 0.01, value: g.scale, percent: true, unit: "%" },
|
|
@@ -19518,19 +19573,19 @@ function layerEffectControls(e, patterns = []) {
|
|
|
19518
19573
|
}
|
|
19519
19574
|
function fillOfType(current, type, patterns) {
|
|
19520
19575
|
if (type === "gradient") return { type: "gradient", gradient: _chunkHGTDMKNEcjs.defaultEffectGradient.call(void 0, ) };
|
|
19521
|
-
if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access',
|
|
19576
|
+
if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access', _596 => _596[0], 'optionalAccess', _597 => _597.id]), () => ( "checker")), scale: 1 };
|
|
19522
19577
|
return { type: "color", color: current.type === "color" ? current.color : "#000000" };
|
|
19523
19578
|
}
|
|
19524
19579
|
function effectControlChange(effect, key, value, patterns = []) {
|
|
19525
19580
|
const [top, ...rest] = key.split(".");
|
|
19526
19581
|
if (top === "fill" && rest[0] === "type") return { fill: fillOfType(effect.fill, String(value), patterns) };
|
|
19527
19582
|
if (top === "patternId" && !rest.length) {
|
|
19528
|
-
const name = _optionalChain([patternOptions, 'call',
|
|
19583
|
+
const name = _optionalChain([patternOptions, 'call', _598 => _598(patterns), 'access', _599 => _599.find, 'call', _600 => _600((o) => o.value === value), 'optionalAccess', _601 => _601.label]);
|
|
19529
19584
|
return name ? { patternId: value, name } : { patternId: value };
|
|
19530
19585
|
}
|
|
19531
19586
|
if (!rest.length) return { [top]: value };
|
|
19532
19587
|
if (top === "fill" && rest[0] === "patternId") {
|
|
19533
|
-
const name = _optionalChain([patternOptions, 'call',
|
|
19588
|
+
const name = _optionalChain([patternOptions, 'call', _602 => _602(patterns), 'access', _603 => _603.find, 'call', _604 => _604((o) => o.value === value), 'optionalAccess', _605 => _605.label]);
|
|
19534
19589
|
return { fill: { ...effect.fill, patternId: value, ...name ? { name } : {} } };
|
|
19535
19590
|
}
|
|
19536
19591
|
return { [top]: setPath(getPath(effect, top), rest, value) };
|
|
@@ -19557,7 +19612,7 @@ function colorPanelView(controller) {
|
|
|
19557
19612
|
profileName: profile.name,
|
|
19558
19613
|
workingSpace: profile.builtin,
|
|
19559
19614
|
mode: profile.mode,
|
|
19560
|
-
cmykProfileName: _nullishCoalesce(_optionalChain([profile, 'access',
|
|
19615
|
+
cmykProfileName: _nullishCoalesce(_optionalChain([profile, 'access', _606 => _606.cmykProfile, 'optionalAccess', _607 => _607.name]), () => ( null)),
|
|
19561
19616
|
proof: proof ? { id: _nullishCoalesce(proof.profile.builtin, () => ( null)), name: proof.profile.name, intent: proof.intent, simulatePaper: proof.simulatePaper, gamutWarning: proof.gamutWarning, bpc: proof.bpc } : null
|
|
19562
19617
|
};
|
|
19563
19618
|
}
|
|
@@ -19765,7 +19820,7 @@ var FreeTransformTool = (_class16 = class {
|
|
|
19765
19820
|
__init131() {this.error = null}
|
|
19766
19821
|
__init132() {this.lastResult = null}
|
|
19767
19822
|
get active() {
|
|
19768
|
-
return Boolean(_optionalChain([this, 'access',
|
|
19823
|
+
return Boolean(_optionalChain([this, 'access', _608 => _608.sessionRef, 'optionalAccess', _609 => _609.isOpen]));
|
|
19769
19824
|
}
|
|
19770
19825
|
get session() {
|
|
19771
19826
|
return this.active ? this.sessionRef : null;
|
|
@@ -19774,7 +19829,7 @@ var FreeTransformTool = (_class16 = class {
|
|
|
19774
19829
|
return this.modeValue;
|
|
19775
19830
|
}
|
|
19776
19831
|
get interpolation() {
|
|
19777
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
19832
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _610 => _610.sessionRef, 'optionalAccess', _611 => _611.interpolation]), () => ( "bicubic"));
|
|
19778
19833
|
}
|
|
19779
19834
|
/** Whether the open transform has changed anything yet (a commit would add an undo step). */
|
|
19780
19835
|
get modified() {
|
|
@@ -19793,7 +19848,7 @@ var FreeTransformTool = (_class16 = class {
|
|
|
19793
19848
|
};
|
|
19794
19849
|
}
|
|
19795
19850
|
changed() {
|
|
19796
|
-
_optionalChain([this, 'access',
|
|
19851
|
+
_optionalChain([this, 'access', _612 => _612.options, 'access', _613 => _613.onChange, 'optionalCall', _614 => _614()]);
|
|
19797
19852
|
for (const l of this.listeners) l();
|
|
19798
19853
|
}
|
|
19799
19854
|
/** Opens a Free Transform (default: the selected pixels of the active layer, or the whole layer). Returns an error message or `null`. */
|
|
@@ -20186,7 +20241,7 @@ var FreeTransformTool = (_class16 = class {
|
|
|
20186
20241
|
}
|
|
20187
20242
|
/** Abandons the transform and restores everything. */
|
|
20188
20243
|
cancel() {
|
|
20189
|
-
_optionalChain([this, 'access',
|
|
20244
|
+
_optionalChain([this, 'access', _615 => _615.sessionRef, 'optionalAccess', _616 => _616.cancel, 'call', _617 => _617()]);
|
|
20190
20245
|
this.sessionRef = null;
|
|
20191
20246
|
this.corners = null;
|
|
20192
20247
|
this.mesh = null;
|
|
@@ -20242,7 +20297,7 @@ function imageLayerAppliedEffects(layer) {
|
|
|
20242
20297
|
const ref = (r) => ({ effect: r.effect, ...r.name ? { name: r.name } : {}, ...r.provider ? { provider: r.provider } : {} });
|
|
20243
20298
|
if (layer.type === "pixel" && layer.generator) out.push({ id: "generator", ...ref(layer.generator), role: "effect layer", enabled: true, values: layer.generator.values, ...layer.generator.time ? { time: layer.generator.time } : {}, ...layer.generator.animate ? { animate: layer.generator.animate } : {} });
|
|
20244
20299
|
if (layer.type === "smart")
|
|
20245
|
-
(_nullishCoalesce(_optionalChain([layer, 'access',
|
|
20300
|
+
(_nullishCoalesce(_optionalChain([layer, 'access', _618 => _618.smartFilters, 'optionalAccess', _619 => _619.filters]), () => ( []))).forEach((f, index) => {
|
|
20246
20301
|
if (f.kind === "effect") out.push({ id: f.id, ...ref(f), role: "smart filter", enabled: f.enabled && layer.smartFilters.enabled, opacity: f.opacity, blend: f.blend, values: f.values, index });
|
|
20247
20302
|
});
|
|
20248
20303
|
return out;
|
|
@@ -20394,7 +20449,7 @@ var OTHER_TOOL_LABELS = {
|
|
|
20394
20449
|
watermark: "Watermark"
|
|
20395
20450
|
};
|
|
20396
20451
|
function imageToolLabel(tool) {
|
|
20397
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([PAINT_TOOLS, 'access',
|
|
20452
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([PAINT_TOOLS, 'access', _620 => _620.find, 'call', _621 => _621((t) => t.id === tool), 'optionalAccess', _622 => _622.label]), () => ( OTHER_TOOL_LABELS[tool])), () => ( tool));
|
|
20398
20453
|
}
|
|
20399
20454
|
var IMAGE_TOOL_SHORTCUTS = {
|
|
20400
20455
|
...Object.fromEntries(PAINT_TOOLS.filter((t) => t.shortcut).map((t) => [t.id, t.shortcut])),
|