@pixerate/editor 0.214.0 → 0.216.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/{chunk-UOGKSVRQ.cjs → chunk-B46UQUDC.cjs} +770 -733
- package/dist/{chunk-W3TOZTL7.js → chunk-F7Z2MKY2.js} +115 -4
- package/dist/{chunk-YBJXCQTR.js → chunk-QXY4YTRI.js} +738 -701
- package/dist/{chunk-H65IBXFI.cjs → chunk-S55JFWDA.cjs} +350 -239
- package/dist/{chunk-QYLWG22N.cjs → chunk-SS53NNZO.cjs} +304 -1
- package/dist/{chunk-LQ5SALHK.js → chunk-U7C655AM.js} +5 -311
- package/dist/{chunk-L52VMQZS.cjs → chunk-UC3PWFM3.cjs} +68 -374
- package/dist/{chunk-L3G23N5Y.js → chunk-ZNA3IQZF.js} +304 -1
- package/dist/image-editor/controller.d.cts +41 -0
- package/dist/image-editor/controller.d.ts +41 -0
- package/dist/image-editor/index.cjs +1461 -1125
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +384 -48
- package/dist/image-editor/layers/edge-color.d.cts +27 -0
- package/dist/image-editor/layers/edge-color.d.ts +27 -0
- package/dist/image-editor/layers/serialize.d.cts +13 -0
- package/dist/image-editor/layers/serialize.d.ts +13 -0
- package/dist/image-editor/selection/index.d.cts +1 -0
- package/dist/image-editor/selection/index.d.ts +1 -0
- package/dist/image-editor/selection/inspect.d.cts +9 -0
- package/dist/image-editor/selection/inspect.d.ts +9 -0
- package/dist/image-editor/selection/uncertainty.d.cts +40 -0
- package/dist/image-editor/selection/uncertainty.d.ts +40 -0
- package/dist/image-editor/selection-worker.cjs +4 -4
- package/dist/image-editor/selection-worker.js +2 -2
- package/dist/paint-editor/index.cjs +79 -79
- package/dist/paint-editor/index.js +3 -3
- package/dist/raster/compositor.d.cts +10 -1
- package/dist/raster/compositor.d.ts +10 -1
- package/dist/raster/deep-compositor.d.cts +1 -1
- package/dist/raster/deep-compositor.d.ts +1 -1
- package/dist/raster/index.cjs +4 -2
- package/dist/raster/index.js +3 -1
- package/dist/raster/layers.d.cts +16 -0
- package/dist/raster/layers.d.ts +16 -0
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +9 -7
- package/skills/pixerate-image-editor/references/paths.md +12 -0
- package/skills/pixerate-image-selection-masking/SKILL.md +11 -11
|
@@ -7,9 +7,9 @@ var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var _chunkQYLWG22Ncjs = require('./chunk-QYLWG22N.cjs');
|
|
11
10
|
|
|
12
11
|
|
|
12
|
+
var _chunkSS53NNZOcjs = require('./chunk-SS53NNZO.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -43,7 +43,9 @@ var _chunkQYLWG22Ncjs = require('./chunk-QYLWG22N.cjs');
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
var _chunkB46UQUDCcjs = require('./chunk-B46UQUDC.cjs');
|
|
47
49
|
|
|
48
50
|
|
|
49
51
|
|
|
@@ -725,7 +727,7 @@ function layerMaskSelection(layer, width, height) {
|
|
|
725
727
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
726
728
|
const oy = layer.type === "pixel" ? layer.offset.y : 0;
|
|
727
729
|
const data = _chunk474IQG74cjs.readRegion.call(void 0, layer.mask.surface, { x: -ox, y: -oy, width, height });
|
|
728
|
-
return
|
|
730
|
+
return _chunkSS53NNZOcjs.createSelectionMask.call(void 0, width, height, new Uint8Array(data.buffer, data.byteOffset, data.length));
|
|
729
731
|
}
|
|
730
732
|
var MAX_SIDE = 1 << 15;
|
|
731
733
|
function normalizeLayerMask(raw) {
|
|
@@ -748,7 +750,7 @@ function normalizeLayerMask(raw) {
|
|
|
748
750
|
return out;
|
|
749
751
|
}
|
|
750
752
|
function layerMaskFromSelection(selection, props = {}) {
|
|
751
|
-
return normalizeLayerMask({ width: selection.width, height: selection.height, rle:
|
|
753
|
+
return normalizeLayerMask({ width: selection.width, height: selection.height, rle: _chunkSS53NNZOcjs.encodeSelectionRle.call(void 0, selection.data), ...props });
|
|
752
754
|
}
|
|
753
755
|
function updateLayerMaskProps(mask, props) {
|
|
754
756
|
return normalizeLayerMask({
|
|
@@ -777,7 +779,7 @@ function decodeLayerMask(mask) {
|
|
|
777
779
|
const key = `${mask.width}x${mask.height}:${mask.rle}`;
|
|
778
780
|
return lru(decoded, key, () => {
|
|
779
781
|
try {
|
|
780
|
-
return
|
|
782
|
+
return _chunkSS53NNZOcjs.createSelectionMask.call(void 0, mask.width, mask.height, _chunkSS53NNZOcjs.decodeSelectionRle.call(void 0, mask.rle, mask.width * mask.height));
|
|
781
783
|
} catch (e2) {
|
|
782
784
|
return null;
|
|
783
785
|
}
|
|
@@ -785,7 +787,7 @@ function decodeLayerMask(mask) {
|
|
|
785
787
|
}
|
|
786
788
|
function layerMaskKey(mask) {
|
|
787
789
|
if (!mask) return "";
|
|
788
|
-
return `${mask.width}x${mask.height}:${
|
|
790
|
+
return `${mask.width}x${mask.height}:${_chunkSS53NNZOcjs.hashMaskContent.call(void 0, mask.rle)}:${_nullishCoalesce(mask.density, () => ( 1))}:${_nullishCoalesce(mask.feather, () => ( 0))}:${mask.enabled !== false}`;
|
|
789
791
|
}
|
|
790
792
|
function layerMaskCoverage(mask) {
|
|
791
793
|
if (mask.enabled === false) return null;
|
|
@@ -1038,7 +1040,7 @@ function normalizeAdjustmentLayers(raw) {
|
|
|
1038
1040
|
return out;
|
|
1039
1041
|
}
|
|
1040
1042
|
function curveLutFromLevels(points) {
|
|
1041
|
-
return
|
|
1043
|
+
return _chunkB46UQUDCcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
|
|
1042
1044
|
}
|
|
1043
1045
|
var toUnitLevels = (c) => ({
|
|
1044
1046
|
inBlack: c.inBlack / 255,
|
|
@@ -2234,7 +2236,7 @@ function newLayerId(prefix = "layer") {
|
|
|
2234
2236
|
return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
|
|
2235
2237
|
}
|
|
2236
2238
|
function pixelLayers(layers) {
|
|
2237
|
-
return
|
|
2239
|
+
return _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
2238
2240
|
}
|
|
2239
2241
|
function developFilter(layer) {
|
|
2240
2242
|
return _optionalChain([layer, 'access', _10 => _10.filters, 'optionalAccess', _11 => _11.find, 'call', _12 => _12((f) => f.kind === "develop")]);
|
|
@@ -2265,14 +2267,14 @@ function isRenderedLayer(layer) {
|
|
|
2265
2267
|
return layer.type === "smart" || layer.type === "shape" || layer.type === "type";
|
|
2266
2268
|
}
|
|
2267
2269
|
function shapeLayers(layers) {
|
|
2268
|
-
return
|
|
2270
|
+
return _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
|
|
2269
2271
|
}
|
|
2270
2272
|
function smartObjectLayers(layers) {
|
|
2271
|
-
return
|
|
2273
|
+
return _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
|
|
2272
2274
|
}
|
|
2273
2275
|
|
|
2274
2276
|
// src/image-editor/layers/shape.ts
|
|
2275
|
-
var SHAPE_RENDER_MARGIN =
|
|
2277
|
+
var SHAPE_RENDER_MARGIN = _chunkB46UQUDCcjs.MAX_EFFECT_REACH;
|
|
2276
2278
|
var DEFAULT_MITER_LIMIT = 100;
|
|
2277
2279
|
var fail = (message) => {
|
|
2278
2280
|
throw new LayerOperationError(message);
|
|
@@ -2492,11 +2494,11 @@ function componentsCoverage(components, rect, rule = "nonzero", inverted = false
|
|
|
2492
2494
|
function paintContext(env) {
|
|
2493
2495
|
const tiles = /* @__PURE__ */ new Map();
|
|
2494
2496
|
return {
|
|
2495
|
-
light:
|
|
2497
|
+
light: _chunkB46UQUDCcjs.DEFAULT_GLOBAL_LIGHT,
|
|
2496
2498
|
pattern: (id) => {
|
|
2497
2499
|
if (tiles.has(id)) return tiles.get(id);
|
|
2498
|
-
const p = _nullishCoalesce(_optionalChain([env, 'access', _18 => _18.pattern, 'optionalCall', _19 => _19(id)]), () => (
|
|
2499
|
-
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0,
|
|
2500
|
+
const p = _nullishCoalesce(_optionalChain([env, 'access', _18 => _18.pattern, 'optionalCall', _19 => _19(id)]), () => ( _chunkB46UQUDCcjs.builtinPattern.call(void 0, id)));
|
|
2501
|
+
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkB46UQUDCcjs.PatternTile)(p) : null;
|
|
2500
2502
|
tiles.set(id, t);
|
|
2501
2503
|
return t;
|
|
2502
2504
|
}
|
|
@@ -2527,9 +2529,9 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
|
|
|
2527
2529
|
if (!fCov && !sCov) return null;
|
|
2528
2530
|
const canvas = { x: 0, y: 0, width: env.width, height: env.height };
|
|
2529
2531
|
const anchor = { x: geo.frame.x, y: geo.frame.y };
|
|
2530
|
-
const fc = fCov ?
|
|
2532
|
+
const fc = fCov ? _chunkB46UQUDCcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
2531
2533
|
const fo = _nullishCoalesce(_optionalChain([layer, 'access', _20 => _20.fill, 'optionalAccess', _21 => _21.opacity]), () => ( 1));
|
|
2532
|
-
const sc = sCov ?
|
|
2534
|
+
const sc = sCov ? _chunkB46UQUDCcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
2533
2535
|
const so = _nullishCoalesce(_optionalChain([layer, 'access', _22 => _22.stroke, 'optionalAccess', _23 => _23.paint, 'access', _24 => _24.opacity]), () => ( 1));
|
|
2534
2536
|
const out = new Uint8ClampedArray(n * 4);
|
|
2535
2537
|
let any = false;
|
|
@@ -2622,9 +2624,9 @@ function normalizeShapePaint(v, path = "paint") {
|
|
|
2622
2624
|
offset: _nullishCoalesce(g.offset, () => ( { x: 0, y: 0 }))
|
|
2623
2625
|
};
|
|
2624
2626
|
try {
|
|
2625
|
-
|
|
2627
|
+
_chunkB46UQUDCcjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
|
|
2626
2628
|
} catch (e) {
|
|
2627
|
-
if (e instanceof
|
|
2629
|
+
if (e instanceof _chunkB46UQUDCcjs.LayerEffectError) fail(e.message);
|
|
2628
2630
|
throw e;
|
|
2629
2631
|
}
|
|
2630
2632
|
if (gradient.stops.length < 1) fail(`${path}.gradient.stops needs at least one { position, color }.`);
|
|
@@ -2836,7 +2838,7 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
|
|
|
2836
2838
|
if (!("annotation" in patch)) delete next.annotation;
|
|
2837
2839
|
if (!next.components.length) fail("A shape needs at least one component; delete the layer instead.");
|
|
2838
2840
|
const rendered = rerenderShape(next, env);
|
|
2839
|
-
return { layers:
|
|
2841
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
2840
2842
|
}
|
|
2841
2843
|
function transformShapeComponents(components, f, affine) {
|
|
2842
2844
|
return components.map((c) => {
|
|
@@ -2867,7 +2869,7 @@ function shapeAsPixelLayer(layer) {
|
|
|
2867
2869
|
}
|
|
2868
2870
|
function annotationPaint(color, opacity) {
|
|
2869
2871
|
const c = _chunkA2IS7EHEcjs.parseCssColor.call(void 0, color);
|
|
2870
|
-
if (!c || !
|
|
2872
|
+
if (!c || !_chunkB46UQUDCcjs.parseEffectColor.call(void 0, c.hex)) return void 0;
|
|
2871
2873
|
const a = c.alpha * opacity;
|
|
2872
2874
|
return a !== 1 ? { type: "color", color: c.hex, opacity: a } : { type: "color", color: c.hex };
|
|
2873
2875
|
}
|
|
@@ -3088,18 +3090,18 @@ function userErrorMessage(err) {
|
|
|
3088
3090
|
return err instanceof Error ? err.message : String(err);
|
|
3089
3091
|
}
|
|
3090
3092
|
function isPaintableLayer(layer) {
|
|
3091
|
-
return layer.type === "pixel" && layer.visible && !
|
|
3093
|
+
return layer.type === "pixel" && layer.visible && !_chunkB46UQUDCcjs.isLayerLocked.call(void 0, layer, "pixels");
|
|
3092
3094
|
}
|
|
3093
3095
|
function defaultActiveLayerId(layers) {
|
|
3094
|
-
const pixels =
|
|
3096
|
+
const pixels = _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
3095
3097
|
for (let i = pixels.length - 1; i >= 0; i--) if (isPaintableLayer(pixels[i])) return pixels[i].id;
|
|
3096
3098
|
return _nullishCoalesce(_optionalChain([pixels, 'access', _38 => _38[pixels.length - 1], 'optionalAccess', _39 => _39.id]), () => ( null));
|
|
3097
3099
|
}
|
|
3098
3100
|
function activeLayerAfterRemoval(prev, next, removedId) {
|
|
3099
|
-
const before =
|
|
3101
|
+
const before = _chunkB46UQUDCcjs.flattenLayers.call(void 0, prev);
|
|
3100
3102
|
const at = before.findIndex((l) => l.id === removedId);
|
|
3101
3103
|
for (let i = at - 1; i >= 0; i--) {
|
|
3102
|
-
const loc =
|
|
3104
|
+
const loc = _chunkB46UQUDCcjs.findLayer.call(void 0, next, before[i].id);
|
|
3103
3105
|
if (loc && isPaintableLayer(loc.layer)) return loc.layer.id;
|
|
3104
3106
|
}
|
|
3105
3107
|
return defaultActiveLayerId(next);
|
|
@@ -3108,47 +3110,47 @@ var fail2 = (message) => {
|
|
|
3108
3110
|
throw new LayerOperationError(message);
|
|
3109
3111
|
};
|
|
3110
3112
|
function requireLayer(layers, id) {
|
|
3111
|
-
const loc =
|
|
3113
|
+
const loc = _chunkB46UQUDCcjs.findLayer.call(void 0, layers, id);
|
|
3112
3114
|
if (!loc) {
|
|
3113
|
-
const ids =
|
|
3115
|
+
const ids = _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
|
|
3114
3116
|
fail2(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
|
|
3115
3117
|
}
|
|
3116
3118
|
return loc;
|
|
3117
3119
|
}
|
|
3118
3120
|
function requireUnlocked(layer, what, action) {
|
|
3119
|
-
if (
|
|
3120
|
-
if (what !== "all" &&
|
|
3121
|
+
if (_chunkB46UQUDCcjs.isLayerLocked.call(void 0, layer, "all")) fail2(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
|
|
3122
|
+
if (what !== "all" && _chunkB46UQUDCcjs.isLayerLocked.call(void 0, layer, what)) fail2(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
|
|
3121
3123
|
}
|
|
3122
3124
|
function placeLayer(layers, layer, placement = {}, defaultIndex) {
|
|
3123
3125
|
const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
|
|
3124
3126
|
if (given > 1) fail2("Give only one of aboveId, belowId and parentId.");
|
|
3125
3127
|
if (placement.aboveId || placement.belowId) {
|
|
3126
3128
|
const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
|
|
3127
|
-
return
|
|
3129
|
+
return _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _40 => _40.parent, 'optionalAccess', _41 => _41.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
|
|
3128
3130
|
}
|
|
3129
3131
|
if (placement.parentId) {
|
|
3130
3132
|
const ref = requireLayer(layers, placement.parentId);
|
|
3131
3133
|
if (ref.layer.type !== "group") fail2(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
|
|
3132
|
-
return
|
|
3134
|
+
return _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
|
|
3133
3135
|
}
|
|
3134
|
-
return
|
|
3136
|
+
return _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
|
|
3135
3137
|
}
|
|
3136
3138
|
function removeLayer(layers, id) {
|
|
3137
3139
|
const loc = requireLayer(layers, id);
|
|
3138
3140
|
requireUnlocked(loc.layer, "all", "delete it");
|
|
3139
|
-
return
|
|
3141
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3140
3142
|
}
|
|
3141
3143
|
function moveLayer(layers, id, placement) {
|
|
3142
3144
|
const loc = requireLayer(layers, id);
|
|
3143
3145
|
requireUnlocked(loc.layer, "all", "move it");
|
|
3144
3146
|
const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
|
|
3145
3147
|
if (target === id) fail2("A layer cannot be placed relative to itself.");
|
|
3146
|
-
if (target && loc.layer.type === "group" &&
|
|
3148
|
+
if (target && loc.layer.type === "group" && _chunkB46UQUDCcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
|
|
3147
3149
|
fail2(`Group "${id}" cannot be moved into its own child "${target}".`);
|
|
3148
3150
|
}
|
|
3149
3151
|
if (target) requireLayer(layers, target);
|
|
3150
3152
|
if (!target && placement.index === void 0) fail2("Give aboveId, belowId, parentId or index.");
|
|
3151
|
-
const without =
|
|
3153
|
+
const without = _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3152
3154
|
return placeLayer(without, loc.layer, placement);
|
|
3153
3155
|
}
|
|
3154
3156
|
function withNewIds(layer) {
|
|
@@ -3167,7 +3169,7 @@ function duplicateLayer(layers, id, name) {
|
|
|
3167
3169
|
const copy = withNewIds(loc.layer);
|
|
3168
3170
|
copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
|
|
3169
3171
|
delete copy.locks;
|
|
3170
|
-
return { layers:
|
|
3172
|
+
return { layers: _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _44 => _44.parent, 'optionalAccess', _45 => _45.id]), () => ( null)), loc.index + 1), id: copy.id };
|
|
3171
3173
|
}
|
|
3172
3174
|
function setLayerProperties(layers, id, props) {
|
|
3173
3175
|
const loc = requireLayer(layers, id);
|
|
@@ -3214,7 +3216,7 @@ function setLayerProperties(layers, id, props) {
|
|
|
3214
3216
|
if (props.collapsed) g.collapsed = true;
|
|
3215
3217
|
else delete g.collapsed;
|
|
3216
3218
|
}
|
|
3217
|
-
return
|
|
3219
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3218
3220
|
}
|
|
3219
3221
|
function groupLayers(layers, ids, name = "Group") {
|
|
3220
3222
|
if (!ids.length) fail2("Give at least one layer id to group.");
|
|
@@ -3243,17 +3245,17 @@ function groupLayers(layers, ids, name = "Group") {
|
|
|
3243
3245
|
group.children[0] = c;
|
|
3244
3246
|
}
|
|
3245
3247
|
let out = layers;
|
|
3246
|
-
for (const l of ordered) out =
|
|
3247
|
-
return { layers:
|
|
3248
|
+
for (const l of ordered) out = _chunkB46UQUDCcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
3249
|
+
return { layers: _chunkB46UQUDCcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
|
|
3248
3250
|
}
|
|
3249
3251
|
function ungroupLayer(layers, id) {
|
|
3250
3252
|
const loc = requireLayer(layers, id);
|
|
3251
3253
|
if (loc.layer.type !== "group") fail2(`Layer "${id}" is not a group.`);
|
|
3252
3254
|
requireUnlocked(loc.layer, "all", "ungroup it");
|
|
3253
3255
|
const group = loc.layer;
|
|
3254
|
-
let out =
|
|
3256
|
+
let out = _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3255
3257
|
group.children.forEach((c, i) => {
|
|
3256
|
-
out =
|
|
3258
|
+
out = _chunkB46UQUDCcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _54 => _54.parent, 'optionalAccess', _55 => _55.id]), () => ( null)), loc.index + i);
|
|
3257
3259
|
});
|
|
3258
3260
|
return { layers: out, ids: group.children.map((c) => c.id) };
|
|
3259
3261
|
}
|
|
@@ -3268,12 +3270,12 @@ function offsetLayer(layers, id, offset) {
|
|
|
3268
3270
|
if (mask && mask.linked === false && !mask.source) {
|
|
3269
3271
|
next.mask = { ...mask, surface: _chunk474IQG74cjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
|
|
3270
3272
|
}
|
|
3271
|
-
return
|
|
3273
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => followLayerMove(next, next.offset.x - layer.offset.x, next.offset.y - layer.offset.y));
|
|
3272
3274
|
}
|
|
3273
3275
|
function setLayerMask(layers, id, mask) {
|
|
3274
3276
|
const loc = requireLayer(layers, id);
|
|
3275
3277
|
requireUnlocked(loc.layer, "all", "change its mask");
|
|
3276
|
-
return
|
|
3278
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, (l) => {
|
|
3277
3279
|
const next = { ...l };
|
|
3278
3280
|
if (mask) next.mask = mask;
|
|
3279
3281
|
else delete next.mask;
|
|
@@ -3312,7 +3314,7 @@ function requirePixelLayer(layers, id) {
|
|
|
3312
3314
|
function addLayerFilter(layers, id, filter) {
|
|
3313
3315
|
const layer = requirePixelLayer(layers, id);
|
|
3314
3316
|
if (_optionalChain([layer, 'access', _56 => _56.filters, 'optionalAccess', _57 => _57.some, 'call', _58 => _58((f) => f.kind === filter.kind)])) fail2(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
|
|
3315
|
-
return
|
|
3317
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
|
|
3316
3318
|
}
|
|
3317
3319
|
function updateLayerFilter(layers, id, filterId, changes) {
|
|
3318
3320
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -3323,7 +3325,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
|
|
|
3323
3325
|
const merged2 = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
|
|
3324
3326
|
const filters = [...layer.filters];
|
|
3325
3327
|
filters[i] = merged2;
|
|
3326
|
-
return
|
|
3328
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
|
|
3327
3329
|
}
|
|
3328
3330
|
function removeLayerFilter(layers, id, filterId) {
|
|
3329
3331
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -3332,7 +3334,7 @@ function removeLayerFilter(layers, id, filterId) {
|
|
|
3332
3334
|
const next = { ...layer };
|
|
3333
3335
|
if (filters.length) next.filters = filters;
|
|
3334
3336
|
else delete next.filters;
|
|
3335
|
-
return
|
|
3337
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3336
3338
|
}
|
|
3337
3339
|
function requireEffectLayer(layers, id, action) {
|
|
3338
3340
|
const layer = requireLayer(layers, id).layer;
|
|
@@ -3347,7 +3349,7 @@ function guard(fn) {
|
|
|
3347
3349
|
try {
|
|
3348
3350
|
return fn();
|
|
3349
3351
|
} catch (e) {
|
|
3350
|
-
if (e instanceof
|
|
3352
|
+
if (e instanceof _chunkB46UQUDCcjs.LayerEffectError) fail2(e.message);
|
|
3351
3353
|
throw e;
|
|
3352
3354
|
}
|
|
3353
3355
|
}
|
|
@@ -3355,20 +3357,20 @@ function setLayerEffects(layers, id, effects) {
|
|
|
3355
3357
|
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
3356
3358
|
const next = { ...layer };
|
|
3357
3359
|
if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
|
|
3358
|
-
guard(() =>
|
|
3360
|
+
guard(() => _chunkB46UQUDCcjs.validateLayerEffects.call(void 0, effects));
|
|
3359
3361
|
next.effects = effects;
|
|
3360
3362
|
} else delete next.effects;
|
|
3361
|
-
return
|
|
3363
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
3362
3364
|
}
|
|
3363
3365
|
function addLayerEffect(layers, id, kind, params = {}, index) {
|
|
3364
|
-
if (!
|
|
3366
|
+
if (!_chunkB46UQUDCcjs.isLayerEffectKind.call(void 0, kind)) fail2(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkB46UQUDCcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
3365
3367
|
const layer = requireEffectLayer(layers, id, "add effects");
|
|
3366
3368
|
const current = layerEffectsOf(layer);
|
|
3367
3369
|
const ids = new Set(current.items.map((e) => e.id));
|
|
3368
|
-
let effectId =
|
|
3369
|
-
while (ids.has(effectId)) effectId =
|
|
3370
|
+
let effectId = _chunkB46UQUDCcjs.newEffectId.call(void 0, );
|
|
3371
|
+
while (ids.has(effectId)) effectId = _chunkB46UQUDCcjs.newEffectId.call(void 0, );
|
|
3370
3372
|
const { id: _ignored, kind: _kind, ...rest } = params;
|
|
3371
|
-
const effect = guard(() =>
|
|
3373
|
+
const effect = guard(() => _chunkB46UQUDCcjs.mergeLayerEffect.call(void 0, _chunkB46UQUDCcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
|
|
3372
3374
|
const items = [...current.items];
|
|
3373
3375
|
const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
|
|
3374
3376
|
items.splice(at, 0, effect);
|
|
@@ -3385,7 +3387,7 @@ function updateLayerEffect(layers, id, effectId, changes) {
|
|
|
3385
3387
|
const i = requireEffect(layer, effectId);
|
|
3386
3388
|
const current = layer.effects;
|
|
3387
3389
|
const items = [...current.items];
|
|
3388
|
-
items[i] = guard(() =>
|
|
3390
|
+
items[i] = guard(() => _chunkB46UQUDCcjs.mergeLayerEffect.call(void 0, items[i], changes));
|
|
3389
3391
|
return setLayerEffects(layers, id, { ...current, items });
|
|
3390
3392
|
}
|
|
3391
3393
|
function removeLayerEffect(layers, id, effectId) {
|
|
@@ -3419,6 +3421,68 @@ function unionRect(a, b) {
|
|
|
3419
3421
|
return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
|
|
3420
3422
|
}
|
|
3421
3423
|
|
|
3424
|
+
// src/image-editor/layers/edge-color.ts
|
|
3425
|
+
var EDGE_COLOR_RADIUS = 8;
|
|
3426
|
+
function hasEdgeUnmix(edge) {
|
|
3427
|
+
return Boolean(edge && ((_nullishCoalesce(edge.decontaminate, () => ( 0))) > 0 || (_nullishCoalesce(edge.despill, () => ( 0))) > 0));
|
|
3428
|
+
}
|
|
3429
|
+
function maskCoverageOverCanvas(mask, ox, oy, width, height) {
|
|
3430
|
+
const bytes = _chunk474IQG74cjs.readRegion.call(void 0, mask.surface, { x: -ox, y: -oy, width, height });
|
|
3431
|
+
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
3432
|
+
if (!(feather > 0)) return new Uint8ClampedArray(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
3433
|
+
const v = new Float32Array(bytes.length);
|
|
3434
|
+
for (let i = 0; i < v.length; i++) v[i] = bytes[i];
|
|
3435
|
+
const blurred = _chunkK6PXS6DOcjs.gaussianBlur.call(void 0, v, width, height, feather, "clamp");
|
|
3436
|
+
return Uint8ClampedArray.from(blurred);
|
|
3437
|
+
}
|
|
3438
|
+
function hasSoftBand(coverage) {
|
|
3439
|
+
for (let i = 0; i < coverage.length; i++) if (coverage[i] > 5 && coverage[i] < 250) return true;
|
|
3440
|
+
return false;
|
|
3441
|
+
}
|
|
3442
|
+
function despillEdge(rgba, coverage, w, h, amount, radius = EDGE_COLOR_RADIUS) {
|
|
3443
|
+
const k = Math.min(1, Math.max(0, amount));
|
|
3444
|
+
if (!(k > 0)) return;
|
|
3445
|
+
const n = w * h;
|
|
3446
|
+
const out = new Float32Array(n);
|
|
3447
|
+
for (let i = 0; i < n; i++) out[i] = coverage[i] <= 5 ? 1 : 0;
|
|
3448
|
+
const weight = _chunkSS53NNZOcjs.boxMean.call(void 0, out, w, h, radius);
|
|
3449
|
+
const mean = [0, 1, 2].map((c) => {
|
|
3450
|
+
const v = new Float32Array(n);
|
|
3451
|
+
for (let i = 0; i < n; i++) v[i] = rgba[i * 4 + c] * out[i];
|
|
3452
|
+
return _chunkSS53NNZOcjs.boxMean.call(void 0, v, w, h, radius);
|
|
3453
|
+
});
|
|
3454
|
+
const luma = (r, g, b) => 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
3455
|
+
for (let i = 0; i < n; i++) {
|
|
3456
|
+
const c = coverage[i];
|
|
3457
|
+
if (c <= 5 || c >= 250 || weight[i] <= 1e-6) continue;
|
|
3458
|
+
const br = mean[0][i] / weight[i];
|
|
3459
|
+
const bg = mean[1][i] / weight[i];
|
|
3460
|
+
const bb = mean[2][i] / weight[i];
|
|
3461
|
+
const bl = luma(br, bg, bb);
|
|
3462
|
+
let ux = br - bl;
|
|
3463
|
+
let uy = bg - bl;
|
|
3464
|
+
let uz = bb - bl;
|
|
3465
|
+
const len = Math.hypot(ux, uy, uz);
|
|
3466
|
+
if (len < 4) continue;
|
|
3467
|
+
ux /= len;
|
|
3468
|
+
uy /= len;
|
|
3469
|
+
uz /= len;
|
|
3470
|
+
const p = i * 4;
|
|
3471
|
+
const l = luma(rgba[p], rgba[p + 1], rgba[p + 2]);
|
|
3472
|
+
const along = (rgba[p] - l) * ux + (rgba[p + 1] - l) * uy + (rgba[p + 2] - l) * uz;
|
|
3473
|
+
if (along <= 0) continue;
|
|
3474
|
+
const s = k * Math.min(1, 2 * (1 - c / 255)) * along;
|
|
3475
|
+
rgba[p] -= s * ux;
|
|
3476
|
+
rgba[p + 1] -= s * uy;
|
|
3477
|
+
rgba[p + 2] -= s * uz;
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
function applyEdgeUnmix(rgba, coverage, w, h, edge) {
|
|
3481
|
+
const d = _nullishCoalesce(edge.decontaminate, () => ( 0));
|
|
3482
|
+
if (d > 0) rgba.set(_chunkSS53NNZOcjs.decontaminateColors.call(void 0, rgba, coverage, w, h, d, EDGE_COLOR_RADIUS));
|
|
3483
|
+
despillEdge(rgba, coverage, w, h, _nullishCoalesce(edge.despill, () => ( 0)));
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3422
3486
|
// src/image-editor/layers/compositor.ts
|
|
3423
3487
|
var legacyViewCache = /* @__PURE__ */ new WeakMap();
|
|
3424
3488
|
function adjustmentNodeAsLayer(node) {
|
|
@@ -3496,9 +3560,34 @@ function filterReach(filters) {
|
|
|
3496
3560
|
return r;
|
|
3497
3561
|
}
|
|
3498
3562
|
var filterSpecCache = /* @__PURE__ */ new WeakMap();
|
|
3563
|
+
var maskIds = /* @__PURE__ */ new WeakMap();
|
|
3564
|
+
var nextMaskId = 1;
|
|
3565
|
+
var edgeSpecCache = /* @__PURE__ */ new WeakMap();
|
|
3566
|
+
function edgeFilterSpec(layer) {
|
|
3567
|
+
const edge = layer.edge;
|
|
3568
|
+
const mask = layer.mask;
|
|
3569
|
+
if (!hasEdgeUnmix(edge) || !mask || mask.enabled === false || mask.source) return pixelFilterSpec(layer);
|
|
3570
|
+
const hit = edgeSpecCache.get(layer);
|
|
3571
|
+
if (hit) return hit;
|
|
3572
|
+
let id = maskIds.get(mask.surface);
|
|
3573
|
+
if (id === void 0) maskIds.set(mask.surface, id = nextMaskId++);
|
|
3574
|
+
const filters = pixelFilterSpec(layer);
|
|
3575
|
+
const ox = layer.offset.x;
|
|
3576
|
+
const oy = layer.offset.y;
|
|
3577
|
+
const spec = {
|
|
3578
|
+
key: `edge:${JSON.stringify([_nullishCoalesce(edge.decontaminate, () => ( 0)), _nullishCoalesce(edge.despill, () => ( 0)), id, ox, oy, _nullishCoalesce(mask.feather, () => ( 0))])}|${_nullishCoalesce(_optionalChain([filters, 'optionalAccess', _61 => _61.key]), () => ( ""))}`,
|
|
3579
|
+
spatial: true,
|
|
3580
|
+
apply: (data, width, height) => {
|
|
3581
|
+
_optionalChain([filters, 'optionalAccess', _62 => _62.apply, 'call', _63 => _63(data, width, height)]);
|
|
3582
|
+
applyEdgeUnmix(data, maskCoverageOverCanvas(mask, ox, oy, width, height), width, height, edge);
|
|
3583
|
+
}
|
|
3584
|
+
};
|
|
3585
|
+
edgeSpecCache.set(layer, spec);
|
|
3586
|
+
return spec;
|
|
3587
|
+
}
|
|
3499
3588
|
function pixelFilterSpec(layer) {
|
|
3500
3589
|
const list2 = layer.filters;
|
|
3501
|
-
if (!_optionalChain([list2, 'optionalAccess',
|
|
3590
|
+
if (!_optionalChain([list2, 'optionalAccess', _64 => _64.length])) return null;
|
|
3502
3591
|
if (filterSpecCache.has(list2)) return filterSpecCache.get(list2);
|
|
3503
3592
|
const filters = list2.filter(isActiveFilter);
|
|
3504
3593
|
let spec = null;
|
|
@@ -3519,11 +3608,11 @@ var PHOTO_PROFILE = {
|
|
|
3519
3608
|
const views = layers.map(adjustmentNodeAsLayer);
|
|
3520
3609
|
applyAdjustmentLayers({ data: acc }, views, masks);
|
|
3521
3610
|
},
|
|
3522
|
-
contentTile: (l, r, sources) => l.type === "annotation" ? _nullishCoalesce(_optionalChain([sources, 'access',
|
|
3611
|
+
contentTile: (l, r, sources) => l.type === "annotation" ? _nullishCoalesce(_optionalChain([sources, 'access', _65 => _65.rasterizeAnnotation, 'optionalCall', _66 => _66(l.annotation, r)]), () => ( null)) : null,
|
|
3523
3612
|
/** Annotation layers draw with their annotation's blend mode unless the layer sets one. */
|
|
3524
3613
|
contentBlend: (l) => l.type === "annotation" && l.blend === "normal" && l.annotation.blend ? l.annotation.blend : l.blend,
|
|
3525
3614
|
layerKey: (l) => l.type === "pixel" ? [_nullishCoalesce(l.filters, () => ( null)), _nullishCoalesce(l.source, () => ( null))] : l.type === "adjustment" ? [l.kind, l.params] : l.type === "annotation" ? l.annotation : void 0,
|
|
3526
|
-
pixelFilters: (l) => l.type === "pixel" ?
|
|
3615
|
+
pixelFilters: (l) => l.type === "pixel" ? edgeFilterSpec(l) : null,
|
|
3527
3616
|
/**
|
|
3528
3617
|
* A smart object draws its rendered pixels (contents → placement → smart filters) like a pixel
|
|
3529
3618
|
* layer, and a shape layer the pixels rendered from its paths.
|
|
@@ -3531,14 +3620,14 @@ var PHOTO_PROFILE = {
|
|
|
3531
3620
|
isPixelLike: (l) => l.type === "smart" || l.type === "shape" || l.type === "type",
|
|
3532
3621
|
maskSourcePlane: (source, W, H, sources) => {
|
|
3533
3622
|
const opts = source;
|
|
3534
|
-
const depth = _nullishCoalesce(_optionalChain([sources, 'access',
|
|
3623
|
+
const depth = _nullishCoalesce(_optionalChain([sources, 'access', _67 => _67.depthMap, 'optionalCall', _68 => _68(opts)]), () => ( null));
|
|
3535
3624
|
if (!depth || depth.width !== W || depth.height !== H) return null;
|
|
3536
3625
|
const v = new Float32Array(W * H);
|
|
3537
3626
|
for (let i = 0; i < v.length; i++) v[i] = depthMaskAlpha(depth.data[i * 4], opts) / 255;
|
|
3538
3627
|
return v;
|
|
3539
3628
|
}
|
|
3540
3629
|
};
|
|
3541
|
-
var LayerCompositor = class extends
|
|
3630
|
+
var LayerCompositor = class extends _chunkB46UQUDCcjs.RasterCompositor {
|
|
3542
3631
|
constructor(options = {}) {
|
|
3543
3632
|
super(PHOTO_PROFILE, options);
|
|
3544
3633
|
}
|
|
@@ -3554,10 +3643,10 @@ var LayerCompositor = class extends _chunkUOGKSVRQcjs.RasterCompositor {
|
|
|
3554
3643
|
}
|
|
3555
3644
|
};
|
|
3556
3645
|
function compositeDeep(layers, rect, sources, depth) {
|
|
3557
|
-
const deep = new (0,
|
|
3646
|
+
const deep = new (0, _chunkB46UQUDCcjs.DeepCompositor)(new LayerCompositor(), PHOTO_PROFILE, {
|
|
3558
3647
|
applyFilterRunDeep: (run, acc, _r, masks) => applyAdjustmentLayersFloat(acc, run.map(adjustmentNodeAsLayer), masks),
|
|
3559
3648
|
pixelFiltersDeep: (l) => {
|
|
3560
|
-
if (l.type !== "pixel") return null;
|
|
3649
|
+
if (l.type !== "pixel" || hasEdgeUnmix(l.edge)) return null;
|
|
3561
3650
|
const filters = (_nullishCoalesce(l.filters, () => ( []))).filter(isActiveFilter);
|
|
3562
3651
|
if (!filters.length) return null;
|
|
3563
3652
|
return { reach: filterReach(filters), apply: (data, width, height, linear) => runLayerFiltersFloat(data, width, height, filters, linear) };
|
|
@@ -3570,7 +3659,7 @@ function compositeDeep(layers, rect, sources, depth) {
|
|
|
3570
3659
|
var fail3 = (message) => {
|
|
3571
3660
|
throw new LayerOperationError(message);
|
|
3572
3661
|
};
|
|
3573
|
-
var TEXT_RENDER_MARGIN =
|
|
3662
|
+
var TEXT_RENDER_MARGIN = _chunkB46UQUDCcjs.MAX_EFFECT_REACH;
|
|
3574
3663
|
function textMatrix(layer) {
|
|
3575
3664
|
return _nullishCoalesce(layer.transform, () => ( _chunkQAUIZPYIcjs.IDENTITY_MATRIX));
|
|
3576
3665
|
}
|
|
@@ -3630,7 +3719,7 @@ function textOutlines(layer, shaper) {
|
|
|
3630
3719
|
}
|
|
3631
3720
|
var rgbOf = (hex) => {
|
|
3632
3721
|
const c = _chunkA2IS7EHEcjs.parseCssColor.call(void 0, hex);
|
|
3633
|
-
const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
3722
|
+
const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _69 => _69.hex]), () => ( "#000000"))).slice(1);
|
|
3634
3723
|
return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
|
|
3635
3724
|
};
|
|
3636
3725
|
function renderOutlines(layer, shaper, region) {
|
|
@@ -3850,7 +3939,7 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
3850
3939
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
3851
3940
|
offset: { x: 0, y: 0 }
|
|
3852
3941
|
};
|
|
3853
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access',
|
|
3942
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _70 => _70.runs, 'access', _71 => _71[0], 'optionalAccess', _72 => _72.style]), () => ( _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)) }];
|
|
3854
3943
|
if (init.transform && !_chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
3855
3944
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
3856
3945
|
return rerenderText(layer, env);
|
|
@@ -3862,11 +3951,11 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
3862
3951
|
const next = { ...current, ...patch };
|
|
3863
3952
|
if (!("annotation" in patch)) delete next.annotation;
|
|
3864
3953
|
if (next.orientation !== "vertical") delete next.orientation;
|
|
3865
|
-
if ("text" in patch || "runs" in patch) next.runs = _chunkQAUIZPYIcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access',
|
|
3954
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkQAUIZPYIcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _73 => _73.runs, 'access', _74 => _74[0], 'optionalAccess', _75 => _75.style]), () => ( _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)));
|
|
3866
3955
|
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkQAUIZPYIcjs.styleAt.call(void 0, current.runs, 0, _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE) }];
|
|
3867
3956
|
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkQAUIZPYIcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
3868
3957
|
const rendered = rerenderText(next, env);
|
|
3869
|
-
return { layers:
|
|
3958
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
|
|
3870
3959
|
}
|
|
3871
3960
|
function replaceTextRange(layer, start, end, insert) {
|
|
3872
3961
|
const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
|
|
@@ -3957,7 +4046,7 @@ var legacyMaskMemo = /* @__PURE__ */ new WeakMap();
|
|
|
3957
4046
|
function rasterMaskFromLegacy(mask, width, height) {
|
|
3958
4047
|
const sel = decodeLayerMask(mask);
|
|
3959
4048
|
if (!sel) return null;
|
|
3960
|
-
const sized = sel.width === width && sel.height === height ? sel :
|
|
4049
|
+
const sized = sel.width === width && sel.height === height ? sel : _chunkSS53NNZOcjs.resizeSelection.call(void 0, sel, width, height);
|
|
3961
4050
|
const surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width, height, data: sized.data }, 1, 0, 0, 0);
|
|
3962
4051
|
legacyMaskMemo.set(surface, { width: mask.width, height: mask.height, rle: mask.rle });
|
|
3963
4052
|
const out = { surface, defaultValue: 0 };
|
|
@@ -3978,7 +4067,7 @@ function legacyMaskOf(mask, width, height) {
|
|
|
3978
4067
|
let memo = legacyMaskMemo.get(mask.surface);
|
|
3979
4068
|
if (!memo) {
|
|
3980
4069
|
const data = _chunk474IQG74cjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width, height });
|
|
3981
|
-
memo = { width, height, rle:
|
|
4070
|
+
memo = { width, height, rle: _chunkSS53NNZOcjs.encodeSelectionRle.call(void 0, new Uint8Array(data.buffer, data.byteOffset, data.length)) };
|
|
3982
4071
|
legacyMaskMemo.set(mask.surface, memo);
|
|
3983
4072
|
}
|
|
3984
4073
|
return normalizeLayerMask({ ...memo, density: mask.density, feather: mask.feather, enabled: mask.enabled });
|
|
@@ -4149,7 +4238,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
|
|
|
4149
4238
|
const { layers } = stack;
|
|
4150
4239
|
const target = developTarget(layers, activeLayerId);
|
|
4151
4240
|
const develop = target ? developFilter(target) : void 0;
|
|
4152
|
-
const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call',
|
|
4241
|
+
const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call', _76 => _76(target), 'optionalAccess', _77 => _77.radius]) : void 0))), () => ( 0));
|
|
4153
4242
|
const adjustments = {
|
|
4154
4243
|
...DEFAULT_ADJUSTMENTS_VALUES,
|
|
4155
4244
|
...develop ? {
|
|
@@ -4178,7 +4267,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
|
|
|
4178
4267
|
};
|
|
4179
4268
|
walk(layers);
|
|
4180
4269
|
if (adjNodes.length) adjustments.layers = adjNodes.map((n) => legacyAdjustmentLayer(n, width, height));
|
|
4181
|
-
const depthSource = _optionalChain([target, 'optionalAccess',
|
|
4270
|
+
const depthSource = _optionalChain([target, 'optionalAccess', _78 => _78.mask, 'optionalAccess', _79 => _79.source]);
|
|
4182
4271
|
const depthMask = depthSource ? { ...depthSource, depthRange: [...depthSource.depthRange] } : { ...DEFAULT_DEPTH_MASK_VALUES, depthRange: [...DEFAULT_DEPTH_MASK_VALUES.depthRange] };
|
|
4183
4272
|
return { adjustments, depthMask, annotations, exact: isLegacyShape(stack) };
|
|
4184
4273
|
}
|
|
@@ -4203,7 +4292,7 @@ function isLegacyShape(stack) {
|
|
|
4203
4292
|
let adjustments = 0;
|
|
4204
4293
|
for (; i < layers.length && layers[i].type === "adjustment"; i++) {
|
|
4205
4294
|
const l = layers[i];
|
|
4206
|
-
if (l.clipped || l.locks || _optionalChain([l, 'access',
|
|
4295
|
+
if (l.clipped || l.locks || _optionalChain([l, 'access', _80 => _80.mask, 'optionalAccess', _81 => _81.source]) || l.effects) return false;
|
|
4207
4296
|
adjustments++;
|
|
4208
4297
|
}
|
|
4209
4298
|
for (; i < layers.length; i++) {
|
|
@@ -4383,7 +4472,7 @@ function geometryHomography(geometry) {
|
|
|
4383
4472
|
var fail4 = (message) => {
|
|
4384
4473
|
throw new LayerOperationError(message);
|
|
4385
4474
|
};
|
|
4386
|
-
var SMART_RENDER_MARGIN =
|
|
4475
|
+
var SMART_RENDER_MARGIN = _chunkB46UQUDCcjs.MAX_EFFECT_REACH;
|
|
4387
4476
|
var incompleteSurfaces = /* @__PURE__ */ new WeakSet();
|
|
4388
4477
|
var isSmartSurfaceIncomplete = (surface) => incompleteSurfaces.has(surface);
|
|
4389
4478
|
var surfaceIds = /* @__PURE__ */ new WeakMap();
|
|
@@ -4410,7 +4499,7 @@ function isContentsDecoded(contents) {
|
|
|
4410
4499
|
}
|
|
4411
4500
|
function requireDecoded(layer, action) {
|
|
4412
4501
|
if (isContentsDecoded(layer.contents)) return;
|
|
4413
|
-
const what = _optionalChain([layer, 'access',
|
|
4502
|
+
const what = _optionalChain([layer, 'access', _82 => _82.contents, 'access', _83 => _83.file, 'optionalAccess', _84 => _84.type]) ? `a ${layer.contents.file.type.toUpperCase()} file` : "a file";
|
|
4414
4503
|
fail4(
|
|
4415
4504
|
`The contents of smart object "${layer.name || layer.id}" are ${what} that could not be decoded here, so it cannot ${action}. Run prepareSmartObjects() in a browser first, or rasterize it.`
|
|
4416
4505
|
);
|
|
@@ -4435,7 +4524,7 @@ function contentsSurface(contents) {
|
|
|
4435
4524
|
width: W,
|
|
4436
4525
|
height: H,
|
|
4437
4526
|
globalLight: doc.globalLight,
|
|
4438
|
-
pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access',
|
|
4527
|
+
pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _85 => _85.patterns, 'optionalAccess', _86 => _86.find, 'call', _87 => _87((p) => p.id === id)]), () => ( null))
|
|
4439
4528
|
});
|
|
4440
4529
|
s = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width: W, height: H, data }, 4, 0, 0);
|
|
4441
4530
|
}
|
|
@@ -4470,7 +4559,7 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4470
4559
|
const preview = Boolean(options.step && options.step > 1) || Boolean(options.clip);
|
|
4471
4560
|
const key = placementKey(placement, canvas);
|
|
4472
4561
|
if (!preview) {
|
|
4473
|
-
const hit = _optionalChain([placedCache, 'access',
|
|
4562
|
+
const hit = _optionalChain([placedCache, 'access', _88 => _88.get, 'call', _89 => _89(contents), 'optionalAccess', _90 => _90.get, 'call', _91 => _91(key)]);
|
|
4474
4563
|
if (hit) return hit;
|
|
4475
4564
|
}
|
|
4476
4565
|
const src = contentsSurface(contents);
|
|
@@ -4497,10 +4586,10 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4497
4586
|
let k = 1;
|
|
4498
4587
|
if (step > 1) {
|
|
4499
4588
|
k = step;
|
|
4500
|
-
let r = _optionalChain([options, 'access',
|
|
4589
|
+
let r = _optionalChain([options, 'access', _92 => _92.reduced, 'optionalAccess', _93 => _93.get, 'call', _94 => _94(k)]);
|
|
4501
4590
|
if (!r) {
|
|
4502
|
-
r =
|
|
4503
|
-
_optionalChain([options, 'access',
|
|
4591
|
+
r = _chunkB46UQUDCcjs.reduceSurface.call(void 0, src, k);
|
|
4592
|
+
_optionalChain([options, 'access', _95 => _95.reduced, 'optionalAccess', _96 => _96.set, 'call', _97 => _97(k, r)]);
|
|
4504
4593
|
}
|
|
4505
4594
|
source = r;
|
|
4506
4595
|
}
|
|
@@ -4509,15 +4598,15 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4509
4598
|
if (hasWarp(g)) {
|
|
4510
4599
|
const f = transformMap(g);
|
|
4511
4600
|
if (!f) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
|
|
4512
|
-
out =
|
|
4601
|
+
out = _chunkB46UQUDCcjs.warpSurface.call(void 0, source, (p) => f({ x: p.x * k, y: p.y * k }), { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
|
|
4513
4602
|
} else {
|
|
4514
4603
|
const h = transformHomography(g);
|
|
4515
4604
|
if (!h) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
|
|
4516
4605
|
const hk = _chunkQT26RHKKcjs.multiplyHomographies.call(void 0, [k, 0, 0, 0, k, 0, 0, 0, 1], h);
|
|
4517
|
-
out =
|
|
4606
|
+
out = _chunkB46UQUDCcjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
|
|
4518
4607
|
}
|
|
4519
4608
|
} catch (e) {
|
|
4520
|
-
if (e instanceof
|
|
4609
|
+
if (e instanceof _chunkB46UQUDCcjs.TransformTooLargeError) fail4(e.message);
|
|
4521
4610
|
throw e;
|
|
4522
4611
|
}
|
|
4523
4612
|
}
|
|
@@ -4533,15 +4622,15 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4533
4622
|
return out;
|
|
4534
4623
|
}
|
|
4535
4624
|
function activeSmartFilters(stack) {
|
|
4536
|
-
if (!_optionalChain([stack, 'optionalAccess',
|
|
4625
|
+
if (!_optionalChain([stack, 'optionalAccess', _98 => _98.enabled])) return [];
|
|
4537
4626
|
return stack.filters.filter((f) => f.kind !== "psd" && f.kind !== "effect" && isActiveFilter(f) && f.opacity > 0);
|
|
4538
4627
|
}
|
|
4539
4628
|
function activeEffectSmartFilters(stack) {
|
|
4540
|
-
if (!_optionalChain([stack, 'optionalAccess',
|
|
4629
|
+
if (!_optionalChain([stack, 'optionalAccess', _99 => _99.enabled])) return [];
|
|
4541
4630
|
return stack.filters.filter((f) => f.kind === "effect" && f.enabled && f.opacity > 0);
|
|
4542
4631
|
}
|
|
4543
4632
|
function runnableSmartFilters(stack) {
|
|
4544
|
-
if (!_optionalChain([stack, 'optionalAccess',
|
|
4633
|
+
if (!_optionalChain([stack, 'optionalAccess', _100 => _100.enabled])) return [];
|
|
4545
4634
|
return stack.filters.filter((f) => f.opacity > 0 && (f.kind === "effect" ? f.enabled : f.kind !== "psd" && isActiveFilter(f)));
|
|
4546
4635
|
}
|
|
4547
4636
|
function filterMaskCoverage(mask, canvas) {
|
|
@@ -4567,7 +4656,7 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4567
4656
|
if (!active.length || !(canvas.width > 0 && canvas.height > 0)) return placed;
|
|
4568
4657
|
const W = canvas.width;
|
|
4569
4658
|
const H = canvas.height;
|
|
4570
|
-
const token = active.some((f) => f.kind === "effect") ? _nullishCoalesce(_optionalChain([canvas, 'access',
|
|
4659
|
+
const token = active.some((f) => f.kind === "effect") ? _nullishCoalesce(_optionalChain([canvas, 'access', _101 => _101.effects, 'optionalAccess', _102 => _102.token]), () => ( -1)) : 0;
|
|
4571
4660
|
const key = JSON.stringify([W, H, token, active.map((f) => ({ ...f, id: void 0 }))]);
|
|
4572
4661
|
let entry = filteredCache.get(placed);
|
|
4573
4662
|
let incomplete = false;
|
|
@@ -4579,9 +4668,9 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4579
4668
|
if (f.kind === "effect") {
|
|
4580
4669
|
if (incomplete) continue;
|
|
4581
4670
|
const inputKey = JSON.stringify([surfaceId(placed), W, H, active.slice(0, i + 1).map((x) => ({ ...x, id: void 0, blend: x === f ? void 0 : x.blend, opacity: x === f ? void 0 : x.opacity }))]);
|
|
4582
|
-
const r = _optionalChain([canvas, 'access',
|
|
4583
|
-
if (!_optionalChain([r, 'optionalAccess',
|
|
4584
|
-
if (_optionalChain([r, 'optionalAccess',
|
|
4671
|
+
const r = _optionalChain([canvas, 'access', _103 => _103.effects, 'optionalAccess', _104 => _104.resolve, 'call', _105 => _105(f, acc, W, H, inputKey)]);
|
|
4672
|
+
if (!_optionalChain([r, 'optionalAccess', _106 => _106.result])) {
|
|
4673
|
+
if (_optionalChain([r, 'optionalAccess', _107 => _107.pending])) incomplete = true;
|
|
4585
4674
|
continue;
|
|
4586
4675
|
}
|
|
4587
4676
|
out2 = new Uint8ClampedArray(r.result);
|
|
@@ -4593,7 +4682,7 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4593
4682
|
if (f.opacity >= 1) acc = out2;
|
|
4594
4683
|
else lerpInto(acc, out2, f.opacity, null);
|
|
4595
4684
|
} else {
|
|
4596
|
-
|
|
4685
|
+
_chunkB46UQUDCcjs.blendTile.call(void 0, acc, out2, f.blend, f.opacity, null);
|
|
4597
4686
|
}
|
|
4598
4687
|
}
|
|
4599
4688
|
entry = { key, base, filtered: acc };
|
|
@@ -4632,7 +4721,7 @@ function rerender(layer, canvas, action = "change") {
|
|
|
4632
4721
|
return { ...layer, surface: renderSmartObject(layer, canvas) };
|
|
4633
4722
|
}
|
|
4634
4723
|
function normalizePlacement(raw, contents) {
|
|
4635
|
-
const c = _optionalChain([raw, 'optionalAccess',
|
|
4724
|
+
const c = _optionalChain([raw, 'optionalAccess', _108 => _108.corners]);
|
|
4636
4725
|
if (!Array.isArray(c) || c.length !== 4 || !c.every((p) => p && Number.isFinite(p.x) && Number.isFinite(p.y))) {
|
|
4637
4726
|
fail4("corners must be four finite points [top-left, top-right, bottom-right, bottom-left] in document pixels.");
|
|
4638
4727
|
}
|
|
@@ -4642,7 +4731,7 @@ function normalizePlacement(raw, contents) {
|
|
|
4642
4731
|
out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
|
|
4643
4732
|
}
|
|
4644
4733
|
if (raw.interpolation !== void 0) {
|
|
4645
|
-
if (!
|
|
4734
|
+
if (!_chunkB46UQUDCcjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
|
|
4646
4735
|
if (raw.interpolation !== "bicubic") out.interpolation = raw.interpolation;
|
|
4647
4736
|
}
|
|
4648
4737
|
const g = { box: { x: 0, y: 0, width: contents.width, height: contents.height }, corners: out.corners, warp: _nullishCoalesce(out.warp, () => ( null)) };
|
|
@@ -4662,7 +4751,7 @@ function followMask(mask, before, after) {
|
|
|
4662
4751
|
const inv = _chunkQT26RHKKcjs.invertHomography.call(void 0, h0);
|
|
4663
4752
|
if (!inv) return mask;
|
|
4664
4753
|
const delta = _chunkQT26RHKKcjs.multiplyHomographies.call(void 0, inv, h1);
|
|
4665
|
-
const surface =
|
|
4754
|
+
const surface = _chunkB46UQUDCcjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
|
|
4666
4755
|
return { ...mask, surface };
|
|
4667
4756
|
}
|
|
4668
4757
|
function setSmartPlacement(layers, id, placement, canvas) {
|
|
@@ -4677,13 +4766,13 @@ function setSmartPlacement(layers, id, placement, canvas) {
|
|
|
4677
4766
|
masksMoved ||= m !== layer.mask;
|
|
4678
4767
|
next.mask = m;
|
|
4679
4768
|
}
|
|
4680
|
-
if (_optionalChain([next, 'access',
|
|
4769
|
+
if (_optionalChain([next, 'access', _109 => _109.smartFilters, 'optionalAccess', _110 => _110.mask])) {
|
|
4681
4770
|
const m = followMask(next.smartFilters.mask, layer, next);
|
|
4682
4771
|
masksMoved ||= m !== next.smartFilters.mask;
|
|
4683
4772
|
next.smartFilters = { ...next.smartFilters, mask: m };
|
|
4684
4773
|
}
|
|
4685
4774
|
next = rerender(next, canvas, "be transformed");
|
|
4686
|
-
return { layers:
|
|
4775
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
|
|
4687
4776
|
}
|
|
4688
4777
|
function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
4689
4778
|
const layer = requireSmartObject(layers, id);
|
|
@@ -4695,18 +4784,18 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
|
4695
4784
|
let next = { ...layer, placement: { ...layer.placement, corners } };
|
|
4696
4785
|
const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface: _chunk474IQG74cjs.translateSurface.call(void 0, m2.surface, mx, my) } : m2;
|
|
4697
4786
|
if (layer.mask) next.mask = moveMask(layer.mask);
|
|
4698
|
-
if (_optionalChain([layer, 'access',
|
|
4787
|
+
if (_optionalChain([layer, 'access', _111 => _111.smartFilters, 'optionalAccess', _112 => _112.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
|
|
4699
4788
|
next = followLayerMove(next, mx, my);
|
|
4700
4789
|
const spatial = activeSmartFilters(layer.smartFilters).some((f) => f.kind === "blur") || activeEffectSmartFilters(layer.smartFilters).length > 0;
|
|
4701
4790
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
4702
4791
|
const m = SMART_RENDER_MARGIN;
|
|
4703
4792
|
const cut = b && (b.x <= -m || b.y <= -m || b.x + b.width >= canvas.width + m || b.y + b.height >= canvas.height + m);
|
|
4704
|
-
if (!spatial && !cut && !(_optionalChain([next, 'access',
|
|
4793
|
+
if (!spatial && !cut && !(_optionalChain([next, 'access', _113 => _113.smartFilters, 'optionalAccess', _114 => _114.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
|
|
4705
4794
|
next = { ...next, surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, mx, my) };
|
|
4706
4795
|
} else {
|
|
4707
4796
|
next = rerender(next, canvas, "move");
|
|
4708
4797
|
}
|
|
4709
|
-
return
|
|
4798
|
+
return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
4710
4799
|
}
|
|
4711
4800
|
function translateLayer(layer, dx, dy) {
|
|
4712
4801
|
if (!dx && !dy) return layer;
|
|
@@ -4726,7 +4815,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
4726
4815
|
mask: moveMask(layer.mask)
|
|
4727
4816
|
};
|
|
4728
4817
|
if (!next.mask) delete next.mask;
|
|
4729
|
-
if (_optionalChain([layer, 'access',
|
|
4818
|
+
if (_optionalChain([layer, 'access', _115 => _115.smartFilters, 'optionalAccess', _116 => _116.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
|
|
4730
4819
|
return next;
|
|
4731
4820
|
}
|
|
4732
4821
|
case "group": {
|
|
@@ -4774,7 +4863,7 @@ function layerExtent(layer, surfaceOf, canvas) {
|
|
|
4774
4863
|
} else {
|
|
4775
4864
|
b = full;
|
|
4776
4865
|
}
|
|
4777
|
-
const m =
|
|
4866
|
+
const m = _chunkB46UQUDCcjs.effectsMargin.call(void 0, layer.effects);
|
|
4778
4867
|
if (b && m > 0) b = { x: b.x - Math.ceil(m), y: b.y - Math.ceil(m), width: b.width + 2 * Math.ceil(m), height: b.height + 2 * Math.ceil(m) };
|
|
4779
4868
|
return b;
|
|
4780
4869
|
}
|
|
@@ -4786,14 +4875,14 @@ function union(a, b) {
|
|
|
4786
4875
|
return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
|
|
4787
4876
|
}
|
|
4788
4877
|
function asSmartFilters(filters) {
|
|
4789
|
-
if (!_optionalChain([filters, 'optionalAccess',
|
|
4878
|
+
if (!_optionalChain([filters, 'optionalAccess', _117 => _117.length])) return void 0;
|
|
4790
4879
|
return { enabled: true, filters: filters.map((f) => ({ ...f, blend: "normal", opacity: 1 })) };
|
|
4791
4880
|
}
|
|
4792
4881
|
function convertToSmartObject(layers, ids, canvas, options) {
|
|
4793
4882
|
if (!ids.length) fail4("Give at least one layer id to convert.");
|
|
4794
4883
|
const locs = [...new Set(ids)].map((id) => requireLayer(layers, id));
|
|
4795
|
-
const parent = _nullishCoalesce(_optionalChain([locs, 'access',
|
|
4796
|
-
if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access',
|
|
4884
|
+
const parent = _nullishCoalesce(_optionalChain([locs, 'access', _118 => _118[0], 'access', _119 => _119.parent, 'optionalAccess', _120 => _120.id]), () => ( null));
|
|
4885
|
+
if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _121 => _121.parent, 'optionalAccess', _122 => _122.id]), () => ( null))) !== parent)) fail4("Layers to convert must share one parent; move them next to each other first.");
|
|
4797
4886
|
for (const l of locs) requireUnlocked(l.layer, "all", "convert it");
|
|
4798
4887
|
const ordered = locs.sort((a, b) => a.index - b.index);
|
|
4799
4888
|
const top = ordered[ordered.length - 1];
|
|
@@ -4843,7 +4932,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4843
4932
|
delete resolved2.source;
|
|
4844
4933
|
layer = resolved2;
|
|
4845
4934
|
}
|
|
4846
|
-
if (
|
|
4935
|
+
if (_chunkB46UQUDCcjs.flattenLayers.call(void 0, [layer]).some((x) => x.type === "pixel" && x.source === "document")) fail4(`Layer "${layer.name || layer.id}" holds the document image inside a group; convert the Background on its own.`);
|
|
4847
4936
|
return translateLayer(layer, -b.x, -b.y);
|
|
4848
4937
|
});
|
|
4849
4938
|
if (nested[0].clipped) {
|
|
@@ -4851,7 +4940,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4851
4940
|
delete first.clipped;
|
|
4852
4941
|
nested[0] = first;
|
|
4853
4942
|
}
|
|
4854
|
-
const name = _optionalChain([options, 'access',
|
|
4943
|
+
const name = _optionalChain([options, 'access', _123 => _123.name, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()]) || top.layer.name || "Smart Object";
|
|
4855
4944
|
const contents = documentContents({ layers: nested }, b.width, b.height, `${name}.psb`);
|
|
4856
4945
|
smart = {
|
|
4857
4946
|
type: "smart",
|
|
@@ -4866,12 +4955,12 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
4866
4955
|
offset: { x: 0, y: 0 }
|
|
4867
4956
|
};
|
|
4868
4957
|
}
|
|
4869
|
-
if (_optionalChain([options, 'access',
|
|
4958
|
+
if (_optionalChain([options, 'access', _126 => _126.name, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()])) smart.name = options.name.trim();
|
|
4870
4959
|
smart = { ...smart, surface: renderSmartObject(smart, canvas) };
|
|
4871
4960
|
const below = ordered.filter((l) => l.index < top.index).length;
|
|
4872
4961
|
let out = layers;
|
|
4873
|
-
for (const l of ordered) out =
|
|
4874
|
-
return { layers:
|
|
4962
|
+
for (const l of ordered) out = _chunkB46UQUDCcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
4963
|
+
return { layers: _chunkB46UQUDCcjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
|
|
4875
4964
|
}
|
|
4876
4965
|
function rasterizeSmartObject(layers, id) {
|
|
4877
4966
|
const layer = requireSmartObject(layers, id);
|
|
@@ -4891,29 +4980,29 @@ function rasterizeSmartObject(layers, id) {
|
|
|
4891
4980
|
if (layer.locks) out.locks = layer.locks;
|
|
4892
4981
|
if (layer.effects) out.effects = layer.effects;
|
|
4893
4982
|
if (layer.fillOpacity !== void 0) out.fillOpacity = layer.fillOpacity;
|
|
4894
|
-
return { layers:
|
|
4983
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
|
|
4895
4984
|
}
|
|
4896
4985
|
function copySmartObject(layers, id, linked, name) {
|
|
4897
4986
|
const loc = requireLayer(layers, id);
|
|
4898
4987
|
const layer = requireSmartObject(layers, id);
|
|
4899
|
-
const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess',
|
|
4988
|
+
const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess', _129 => _129.trim, 'call', _130 => _130()]) || `${layer.name || "Smart Object"} copy` };
|
|
4900
4989
|
delete copy.locks;
|
|
4901
4990
|
delete copy.psd;
|
|
4902
4991
|
if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
|
|
4903
4992
|
if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
|
|
4904
|
-
return { layers:
|
|
4993
|
+
return { layers: _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _131 => _131.parent, 'optionalAccess', _132 => _132.id]), () => ( null)), loc.index + 1), layer: copy };
|
|
4905
4994
|
}
|
|
4906
4995
|
function instancesOf(layers, contentsId) {
|
|
4907
|
-
return
|
|
4996
|
+
return _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
|
|
4908
4997
|
}
|
|
4909
4998
|
function replaceContents(layers, contentsId, contents, canvas) {
|
|
4910
4999
|
const ids = instancesOf(layers, contentsId);
|
|
4911
5000
|
if (!ids.length) fail4(`No smart object uses contents "${contentsId}".`);
|
|
4912
|
-
for (const id of ids) requireUnlocked(
|
|
5001
|
+
for (const id of ids) requireUnlocked(_chunkB46UQUDCcjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
|
|
4913
5002
|
const next = { ...contents, id: contentsId };
|
|
4914
5003
|
let out = layers;
|
|
4915
5004
|
for (const id of ids) {
|
|
4916
|
-
out =
|
|
5005
|
+
out = _chunkB46UQUDCcjs.mapLayer.call(void 0, out, id, (l) => {
|
|
4917
5006
|
const layer = l;
|
|
4918
5007
|
return rerender({ ...layer, contents: next, placement: refitPlacement(layer, next) }, canvas, "take the new contents");
|
|
4919
5008
|
});
|
|
@@ -4973,7 +5062,7 @@ function stackOf(layer) {
|
|
|
4973
5062
|
return _nullishCoalesce(layer.smartFilters, () => ( { enabled: true, filters: [] }));
|
|
4974
5063
|
}
|
|
4975
5064
|
function requireFilter(layer, filterId) {
|
|
4976
|
-
const list2 = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
5065
|
+
const list2 = _nullishCoalesce(_optionalChain([layer, 'access', _133 => _133.smartFilters, 'optionalAccess', _134 => _134.filters]), () => ( []));
|
|
4977
5066
|
const i = list2.findIndex((f) => f.id === filterId);
|
|
4978
5067
|
if (i === -1) fail4(`Smart object "${layer.name || layer.id}" has no smart filter "${filterId}". Filters: ${list2.map((f) => `${f.id} (${f.kind})`).join(", ") || "none"}; call get_smart_object.`);
|
|
4979
5068
|
return i;
|
|
@@ -4990,7 +5079,7 @@ function addSmartFilter(layers, id, filter, canvas, index) {
|
|
|
4990
5079
|
const at = index === void 0 ? filters.length : Math.max(0, Math.min(filters.length, Math.floor(index)));
|
|
4991
5080
|
filters.splice(at, 0, filter);
|
|
4992
5081
|
const next = withStack(layer, { ...stack, filters }, canvas);
|
|
4993
|
-
return { layers:
|
|
5082
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
|
|
4994
5083
|
}
|
|
4995
5084
|
function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
4996
5085
|
const layer = editableSmart(layers, id);
|
|
@@ -5012,7 +5101,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
|
|
|
5012
5101
|
const filters = [...layer.smartFilters.filters];
|
|
5013
5102
|
filters[i] = merged2;
|
|
5014
5103
|
const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
|
|
5015
|
-
return { layers:
|
|
5104
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
|
|
5016
5105
|
}
|
|
5017
5106
|
function removeSmartFilter(layers, id, filterId, canvas) {
|
|
5018
5107
|
const layer = editableSmart(layers, id);
|
|
@@ -5020,7 +5109,7 @@ function removeSmartFilter(layers, id, filterId, canvas) {
|
|
|
5020
5109
|
const stack = layer.smartFilters;
|
|
5021
5110
|
const filters = stack.filters.filter((f) => f.id !== filterId);
|
|
5022
5111
|
const next = withStack(layer, filters.length ? { ...stack, filters } : stack.enabled ? void 0 : { enabled: false, filters }, canvas);
|
|
5023
|
-
return { layers:
|
|
5112
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5024
5113
|
}
|
|
5025
5114
|
function moveSmartFilter(layers, id, filterId, index, canvas) {
|
|
5026
5115
|
const layer = editableSmart(layers, id);
|
|
@@ -5031,21 +5120,21 @@ function moveSmartFilter(layers, id, filterId, index, canvas) {
|
|
|
5031
5120
|
const [f] = filters.splice(i, 1);
|
|
5032
5121
|
filters.splice(index, 0, f);
|
|
5033
5122
|
const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
|
|
5034
|
-
return { layers:
|
|
5123
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5035
5124
|
}
|
|
5036
5125
|
function setSmartFiltersEnabled(layers, id, enabled, canvas) {
|
|
5037
5126
|
const layer = editableSmart(layers, id);
|
|
5038
5127
|
const next = withStack(layer, { ...stackOf(layer), enabled: Boolean(enabled) }, canvas);
|
|
5039
|
-
return { layers:
|
|
5128
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5040
5129
|
}
|
|
5041
5130
|
function setSmartFilterMask(layers, id, mask, canvas) {
|
|
5042
5131
|
const layer = editableSmart(layers, id);
|
|
5043
|
-
if (_optionalChain([mask, 'optionalAccess',
|
|
5132
|
+
if (_optionalChain([mask, 'optionalAccess', _135 => _135.source])) fail4("A smart filter mask is painted, not generated; use a raster mask.");
|
|
5044
5133
|
const stack = { ...stackOf(layer) };
|
|
5045
5134
|
if (mask) stack.mask = mask;
|
|
5046
5135
|
else delete stack.mask;
|
|
5047
5136
|
const next = withStack(layer, stack, canvas);
|
|
5048
|
-
return { layers:
|
|
5137
|
+
return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
|
|
5049
5138
|
}
|
|
5050
5139
|
function withFilterMaskSurface(layer, surface, canvas) {
|
|
5051
5140
|
const stack = stackOf(layer);
|
|
@@ -5136,8 +5225,21 @@ function baseFields(layer, ctx) {
|
|
|
5136
5225
|
if (layer.vectorMask) out.vectorMask = serializeVectorMask(layer.vectorMask);
|
|
5137
5226
|
if (layer.locks && Object.values(layer.locks).some(Boolean)) out.locks = { ...layer.locks };
|
|
5138
5227
|
if (layer.effects) out.effects = serializeEffects(layer.effects);
|
|
5228
|
+
if (layer.edge) out.edge = { ...layer.edge, ...layer.edge.ambientColor ? { ambientColor: [...layer.edge.ambientColor] } : {} };
|
|
5139
5229
|
return out;
|
|
5140
5230
|
}
|
|
5231
|
+
function readEdgeColor(raw) {
|
|
5232
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
5233
|
+
const r = raw;
|
|
5234
|
+
const out = {};
|
|
5235
|
+
for (const k of ["decontaminate", "despill", "ambient"]) {
|
|
5236
|
+
const v = r[k];
|
|
5237
|
+
if (typeof v === "number" && Number.isFinite(v) && v > 0) out[k] = Math.min(1, v);
|
|
5238
|
+
}
|
|
5239
|
+
const c = r.ambientColor;
|
|
5240
|
+
if (Array.isArray(c) && c.length === 3 && c.every((v) => typeof v === "number" && Number.isFinite(v))) out.ambientColor = c.map((v) => Math.min(255, Math.max(0, Math.round(v))));
|
|
5241
|
+
return out.decontaminate || out.despill || out.ambient || out.ambientColor ? out : void 0;
|
|
5242
|
+
}
|
|
5141
5243
|
function serializeEffects(effects) {
|
|
5142
5244
|
const out = { enabled: effects.enabled, items: JSON.parse(JSON.stringify(effects.items)) };
|
|
5143
5245
|
if (effects.scale !== void 0 && effects.scale !== 1) out.scale = effects.scale;
|
|
@@ -5156,7 +5258,7 @@ function deserializeEffects(raw) {
|
|
|
5156
5258
|
psd = void 0;
|
|
5157
5259
|
}
|
|
5158
5260
|
}
|
|
5159
|
-
return
|
|
5261
|
+
return _chunkB46UQUDCcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
|
|
5160
5262
|
}
|
|
5161
5263
|
function serializeVectorMask(vm) {
|
|
5162
5264
|
const out = { components: JSON.parse(JSON.stringify(vm.components)) };
|
|
@@ -5172,12 +5274,12 @@ function readShapeComponents(stored) {
|
|
|
5172
5274
|
if (!Array.isArray(stored)) throw new Error("its components are missing");
|
|
5173
5275
|
return stored.map((raw, i) => {
|
|
5174
5276
|
const c = raw;
|
|
5175
|
-
const op = requireOperation(_optionalChain([c, 'optionalAccess',
|
|
5176
|
-
if (_optionalChain([c, 'optionalAccess',
|
|
5277
|
+
const op = requireOperation(_optionalChain([c, 'optionalAccess', _136 => _136.op]), `components[${i}].op`);
|
|
5278
|
+
if (_optionalChain([c, 'optionalAccess', _137 => _137.live])) {
|
|
5177
5279
|
const live = normalizeLiveShape(c.live, `components[${i}].live`);
|
|
5178
5280
|
return { op, subpaths: liveShapeSubpaths(live), live };
|
|
5179
5281
|
}
|
|
5180
|
-
return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess',
|
|
5282
|
+
return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _138 => _138.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _139 => _139.subpaths]), `components[${i}].subpaths`) };
|
|
5181
5283
|
});
|
|
5182
5284
|
}
|
|
5183
5285
|
function readVectorMask(r) {
|
|
@@ -5225,7 +5327,7 @@ function serializeLayer(layer, ctx) {
|
|
|
5225
5327
|
}
|
|
5226
5328
|
}
|
|
5227
5329
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5228
|
-
if (_optionalChain([layer, 'access',
|
|
5330
|
+
if (_optionalChain([layer, 'access', _140 => _140.filters, 'optionalAccess', _141 => _141.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
|
|
5229
5331
|
if (layer.generator) out.generator = JSON.parse(JSON.stringify(layer.generator));
|
|
5230
5332
|
if (layer.source !== "document") {
|
|
5231
5333
|
const deep = encodeDeepSurface(layer.surface);
|
|
@@ -5269,12 +5371,12 @@ function serializeType(layer, base, ctx) {
|
|
|
5269
5371
|
out.x = enc.x;
|
|
5270
5372
|
out.y = enc.y;
|
|
5271
5373
|
}
|
|
5272
|
-
if (_optionalChain([layer, 'access',
|
|
5374
|
+
if (_optionalChain([layer, 'access', _142 => _142.missingFonts, 'optionalAccess', _143 => _143.length])) out.missingFonts = [...layer.missingFonts];
|
|
5273
5375
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5274
|
-
if (_optionalChain([layer, 'access',
|
|
5376
|
+
if (_optionalChain([layer, 'access', _144 => _144.psd, 'optionalAccess', _145 => _145.tySh]) || _optionalChain([layer, 'access', _146 => _146.psd, 'optionalAccess', _147 => _147.blocks, 'optionalAccess', _148 => _148.length])) {
|
|
5275
5377
|
out.psd = {};
|
|
5276
5378
|
if (layer.psd.tySh) out.psd.tySh = _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, layer.psd.tySh);
|
|
5277
|
-
if (_optionalChain([layer, 'access',
|
|
5379
|
+
if (_optionalChain([layer, 'access', _149 => _149.psd, 'access', _150 => _150.blocks, 'optionalAccess', _151 => _151.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, b.data) }));
|
|
5278
5380
|
if (layer.psd.signature) out.psd.signature = layer.psd.signature;
|
|
5279
5381
|
}
|
|
5280
5382
|
return out;
|
|
@@ -5284,15 +5386,15 @@ function readType(r, base, ctx) {
|
|
|
5284
5386
|
try {
|
|
5285
5387
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5286
5388
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5287
|
-
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess',
|
|
5288
|
-
style: patchTextStyle(_chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess',
|
|
5389
|
+
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _152 => _152.length]), 0, 1e9, 0))),
|
|
5390
|
+
style: patchTextStyle(_chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _153 => _153.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5289
5391
|
}));
|
|
5290
5392
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5291
|
-
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess',
|
|
5292
|
-
style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess',
|
|
5393
|
+
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _154 => _154.length]), 0, 1e9, 0))),
|
|
5394
|
+
style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess', _155 => _155.style]) && typeof p.style === "object" ? p.style : {}, `paragraphs[${i}].style`)
|
|
5293
5395
|
}));
|
|
5294
5396
|
const f = r.frame;
|
|
5295
|
-
const frame = _optionalChain([f, 'optionalAccess',
|
|
5397
|
+
const frame = _optionalChain([f, 'optionalAccess', _156 => _156.kind]) === "box" ? { kind: "box", width: num2(f.width, 1, 1e6, 100), height: num2(f.height, 1, 1e6, 100) } : _optionalChain([f, 'optionalAccess', _157 => _157.origin]) === "top" ? { kind: "point", origin: "top" } : { kind: "point" };
|
|
5296
5398
|
const m = Array.isArray(r.transform) && r.transform.length === 6 && r.transform.every((v) => typeof v === "number" && Number.isFinite(v)) ? r.transform : void 0;
|
|
5297
5399
|
const layer = {
|
|
5298
5400
|
...base,
|
|
@@ -5304,7 +5406,7 @@ function readType(r, base, ctx) {
|
|
|
5304
5406
|
surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4),
|
|
5305
5407
|
offset: { x: 0, y: 0 }
|
|
5306
5408
|
};
|
|
5307
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access',
|
|
5409
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _158 => _158[0], 'optionalAccess', _159 => _159.style]), () => ( _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)) }];
|
|
5308
5410
|
if (m) layer.transform = m;
|
|
5309
5411
|
if (r.orientation === "vertical") layer.orientation = "vertical";
|
|
5310
5412
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
@@ -5316,10 +5418,10 @@ function readType(r, base, ctx) {
|
|
|
5316
5418
|
if (typeof r.psd.tySh === "string") psd.tySh = _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, r.psd.tySh);
|
|
5317
5419
|
if (Array.isArray(r.psd.blocks)) psd.blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkOLNIPTB3cjs.base64ToBytes.call(void 0, b.data) }));
|
|
5318
5420
|
if (typeof r.psd.signature === "string") psd.signature = r.psd.signature;
|
|
5319
|
-
if (psd.tySh || _optionalChain([psd, 'access',
|
|
5421
|
+
if (psd.tySh || _optionalChain([psd, 'access', _160 => _160.blocks, 'optionalAccess', _161 => _161.length])) layer.psd = psd;
|
|
5320
5422
|
}
|
|
5321
5423
|
if (typeof r.asset === "string") return { ...layer, surface: readSurface(r.asset, r.x, r.y, 4, 0, ctx, label), rendering: "stored" };
|
|
5322
|
-
const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
5424
|
+
const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _162 => _162.text, 'optionalAccess', _163 => _163.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _164 => _164.text, 'optionalAccess', _165 => _165.createCanvas]) };
|
|
5323
5425
|
try {
|
|
5324
5426
|
return rerenderText(layer, env);
|
|
5325
5427
|
} catch (e8) {
|
|
@@ -5342,7 +5444,7 @@ function serializeShape(layer, base) {
|
|
|
5342
5444
|
if (layer.inverted) out.inverted = true;
|
|
5343
5445
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5344
5446
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5345
|
-
if (_optionalChain([layer, 'access',
|
|
5447
|
+
if (_optionalChain([layer, 'access', _166 => _166.psd, 'optionalAccess', _167 => _167.blocks, 'optionalAccess', _168 => _168.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
|
|
5346
5448
|
return out;
|
|
5347
5449
|
}
|
|
5348
5450
|
function readShape(r, base, ctx) {
|
|
@@ -5356,12 +5458,12 @@ function readShape(r, base, ctx) {
|
|
|
5356
5458
|
if (!data) {
|
|
5357
5459
|
if (!Array.isArray(r.components) || !r.components.length) throw new Error("it has no components");
|
|
5358
5460
|
const components = r.components.map((c, i) => {
|
|
5359
|
-
const op = requireOperation(_optionalChain([c, 'optionalAccess',
|
|
5360
|
-
if (_optionalChain([c, 'optionalAccess',
|
|
5461
|
+
const op = requireOperation(_optionalChain([c, 'optionalAccess', _169 => _169.op]), `components[${i}].op`);
|
|
5462
|
+
if (_optionalChain([c, 'optionalAccess', _170 => _170.live])) {
|
|
5361
5463
|
const live = normalizeLiveShape(c.live, `components[${i}].live`);
|
|
5362
5464
|
return { op, subpaths: liveShapeSubpaths(live), live };
|
|
5363
5465
|
}
|
|
5364
|
-
return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess',
|
|
5466
|
+
return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _171 => _171.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _172 => _172.subpaths]), `components[${i}].subpaths`) };
|
|
5365
5467
|
});
|
|
5366
5468
|
data = {
|
|
5367
5469
|
components,
|
|
@@ -5432,7 +5534,7 @@ function serializeContents(c, ctx) {
|
|
|
5432
5534
|
if (c.kind === "document" && c.document) {
|
|
5433
5535
|
out.layers = c.document.layers.map((l) => serializeLayer(l, ctx));
|
|
5434
5536
|
if (c.document.globalLight) out.globalLight = { ...c.document.globalLight };
|
|
5435
|
-
if (_optionalChain([c, 'access',
|
|
5537
|
+
if (_optionalChain([c, 'access', _173 => _173.document, 'access', _174 => _174.patterns, 'optionalAccess', _175 => _175.length])) out.patterns = serializePatterns(c.document.patterns);
|
|
5436
5538
|
}
|
|
5437
5539
|
if (c.file) out.file = { type: c.file.type, data: _chunkOLNIPTB3cjs.bytesToBase64.call(void 0, c.file.bytes) };
|
|
5438
5540
|
if (c.linked) out.linked = { path: c.linked.path };
|
|
@@ -5597,6 +5699,8 @@ function deserializeLayer(raw, ctx) {
|
|
|
5597
5699
|
blend: _chunkOLNIPTB3cjs.normalizeBlendMode.call(void 0, r.blend)
|
|
5598
5700
|
};
|
|
5599
5701
|
if (r.clipped === true) base.clipped = true;
|
|
5702
|
+
const edge = readEdgeColor(r.edge);
|
|
5703
|
+
if (edge) base.edge = edge;
|
|
5600
5704
|
const mask = readMask(r.mask, ctx, `Layer "${base.name || id}"`);
|
|
5601
5705
|
if (mask) base.mask = mask;
|
|
5602
5706
|
if (r.vectorMask && typeof r.vectorMask === "object" && r.type !== "shape") {
|
|
@@ -5619,7 +5723,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5619
5723
|
...base,
|
|
5620
5724
|
type: "pixel",
|
|
5621
5725
|
surface: r.source === "document" ? _chunk474IQG74cjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
|
|
5622
|
-
offset: { x: Math.round(num2(_optionalChain([r, 'access',
|
|
5726
|
+
offset: { x: Math.round(num2(_optionalChain([r, 'access', _176 => _176.offset, 'optionalAccess', _177 => _177.x]), -1e7, 1e7, 0)), y: Math.round(num2(_optionalChain([r, 'access', _178 => _178.offset, 'optionalAccess', _179 => _179.y]), -1e7, 1e7, 0)) }
|
|
5623
5727
|
};
|
|
5624
5728
|
if (r.source === "document") layer.source = "document";
|
|
5625
5729
|
else if (r.deep) layer.surface = decodeDeepSurface(layer.surface, r.deep, ctx.problems, `Layer "${base.name || id}"`);
|
|
@@ -5628,7 +5732,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5628
5732
|
if (filters) layer.filters = filters;
|
|
5629
5733
|
const generator = readEffectRef(r.generator);
|
|
5630
5734
|
if (generator) {
|
|
5631
|
-
const duration = _optionalChain([r, 'access',
|
|
5735
|
+
const duration = _optionalChain([r, 'access', _180 => _180.generator, 'access', _181 => _181.animate, 'optionalAccess', _182 => _182.duration]);
|
|
5632
5736
|
layer.generator = {
|
|
5633
5737
|
...generator,
|
|
5634
5738
|
...typeof r.generator.time === "number" && r.generator.time > 0 ? { time: r.generator.time } : {},
|
|
@@ -5659,7 +5763,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5659
5763
|
return null;
|
|
5660
5764
|
}
|
|
5661
5765
|
const annotation = JSON.parse(JSON.stringify({ ...a, id: typeof a.id === "string" ? a.id : id }));
|
|
5662
|
-
const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
5766
|
+
const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _183 => _183.text, 'optionalAccess', _184 => _184.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _185 => _185.text, 'optionalAccess', _186 => _186.createCanvas]) });
|
|
5663
5767
|
if (migrated.type === "shape" || migrated.type === "type") {
|
|
5664
5768
|
const blend = base.blend === "normal" ? migrated.blend : base.blend;
|
|
5665
5769
|
return { ...migrated, ...base, blend, id, name: base.name };
|
|
@@ -5773,7 +5877,7 @@ function readSmartObject(r, base, ctx) {
|
|
|
5773
5877
|
try {
|
|
5774
5878
|
const raw = { corners: p.corners };
|
|
5775
5879
|
if (p.warp && _chunkQAUIZPYIcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
|
|
5776
|
-
if (
|
|
5880
|
+
if (_chunkB46UQUDCcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
|
|
5777
5881
|
placement = normalizePlacement(raw, contents);
|
|
5778
5882
|
} catch (e) {
|
|
5779
5883
|
ctx.problems.push(`${what}: its placement is invalid (${e instanceof Error ? e.message : String(e)}); it was placed at the top left`);
|
|
@@ -6237,7 +6341,7 @@ function descriptor(classId, items = []) {
|
|
|
6237
6341
|
return { name: "", classId, items };
|
|
6238
6342
|
}
|
|
6239
6343
|
function descGet(d, key) {
|
|
6240
|
-
return _optionalChain([d, 'access',
|
|
6344
|
+
return _optionalChain([d, 'access', _187 => _187.items, 'access', _188 => _188.find, 'call', _189 => _189(([k]) => k === key), 'optionalAccess', _190 => _190[1]]);
|
|
6241
6345
|
}
|
|
6242
6346
|
function descNumber(d, key) {
|
|
6243
6347
|
const v = descGet(d, key);
|
|
@@ -6247,7 +6351,7 @@ function descNumber(d, key) {
|
|
|
6247
6351
|
}
|
|
6248
6352
|
function descBool(d, key) {
|
|
6249
6353
|
const v = descGet(d, key);
|
|
6250
|
-
return _optionalChain([v, 'optionalAccess',
|
|
6354
|
+
return _optionalChain([v, 'optionalAccess', _191 => _191.type]) === "bool" ? v.value : void 0;
|
|
6251
6355
|
}
|
|
6252
6356
|
function descObject(d, key) {
|
|
6253
6357
|
const v = descGet(d, key);
|
|
@@ -6975,7 +7079,7 @@ function pathResourceForComponents(components, width, height) {
|
|
|
6975
7079
|
|
|
6976
7080
|
// src/image-editor/psd/channels.ts
|
|
6977
7081
|
var hexToRgb2 = (hex) => {
|
|
6978
|
-
const v = parseInt(_nullishCoalesce(_optionalChain([/^#?([0-9a-f]{6})$/i, 'access',
|
|
7082
|
+
const v = parseInt(_nullishCoalesce(_optionalChain([/^#?([0-9a-f]{6})$/i, 'access', _192 => _192.exec, 'call', _193 => _193(hex), 'optionalAccess', _194 => _194[1]]), () => ( "ff0000")), 16);
|
|
6979
7083
|
return [v >> 16 & 255, v >> 8 & 255, v & 255];
|
|
6980
7084
|
};
|
|
6981
7085
|
var rgbToHex = (r, g, b) => `#${[r, g, b].map((c) => c.toString(16).padStart(2, "0")).join("")}`;
|
|
@@ -7049,16 +7153,16 @@ function readAlphaChannels(planes, header, first, resource2, warn) {
|
|
|
7049
7153
|
if (start + size > planes.length) break;
|
|
7050
7154
|
const d = display[i];
|
|
7051
7155
|
const name = names[i] || `Alpha ${i + 1}`;
|
|
7052
|
-
if (_optionalChain([d, 'optionalAccess',
|
|
7156
|
+
if (_optionalChain([d, 'optionalAccess', _195 => _195.kind]) === 2) {
|
|
7053
7157
|
warn(`Spot colour channel "${name}" is not supported and was left out.`);
|
|
7054
7158
|
continue;
|
|
7055
7159
|
}
|
|
7056
7160
|
out.push({
|
|
7057
7161
|
name,
|
|
7058
7162
|
data: planeTo8(planes.subarray(start, start + size), n, header.depth),
|
|
7059
|
-
color: _nullishCoalesce(_optionalChain([d, 'optionalAccess',
|
|
7060
|
-
opacity: _nullishCoalesce(_optionalChain([d, 'optionalAccess',
|
|
7061
|
-
indicates: _optionalChain([d, 'optionalAccess',
|
|
7163
|
+
color: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _196 => _196.color]), () => ( "#ff0000")),
|
|
7164
|
+
opacity: _nullishCoalesce(_optionalChain([d, 'optionalAccess', _197 => _197.opacity]), () => ( 0.5)),
|
|
7165
|
+
indicates: _optionalChain([d, 'optionalAccess', _198 => _198.kind]) === 0 ? "selected" : "masked"
|
|
7062
7166
|
});
|
|
7063
7167
|
}
|
|
7064
7168
|
return out;
|
|
@@ -7074,7 +7178,7 @@ var enumV = (typeId, value) => ({ type: "enum", typeId, value });
|
|
|
7074
7178
|
var obj = (d) => ({ type: "Objc", value: d });
|
|
7075
7179
|
var enumOf = (d, key) => {
|
|
7076
7180
|
const v = descGet(d, key);
|
|
7077
|
-
return _optionalChain([v, 'optionalAccess',
|
|
7181
|
+
return _optionalChain([v, 'optionalAccess', _199 => _199.type]) === "enum" ? v.value : void 0;
|
|
7078
7182
|
};
|
|
7079
7183
|
function read(data) {
|
|
7080
7184
|
try {
|
|
@@ -7156,7 +7260,7 @@ function strokeFromVstk(data, dpi, notes) {
|
|
|
7156
7260
|
const miter = descNumber(d, "strokeStyleMiterLimit");
|
|
7157
7261
|
if (miter !== void 0 && miter !== 100) stroke.miterLimit = Math.max(1, Math.min(500, miter));
|
|
7158
7262
|
const dashes = descGet(d, "strokeStyleLineDashSet");
|
|
7159
|
-
if (_optionalChain([dashes, 'optionalAccess',
|
|
7263
|
+
if (_optionalChain([dashes, 'optionalAccess', _200 => _200.type]) === "VlLs") {
|
|
7160
7264
|
const list2 = dashes.items.map((v) => v.type === "UntF" || v.type === "doub" || v.type === "long" ? v.value : NaN).filter((v) => Number.isFinite(v) && v >= 0);
|
|
7161
7265
|
if (list2.length && list2.some((v) => v > 0)) stroke.dashes = list2;
|
|
7162
7266
|
}
|
|
@@ -7308,7 +7412,7 @@ function vogkBytes(components, dpi) {
|
|
|
7308
7412
|
["keyOriginLineArrowEnd", boolV(Boolean(live.endArrow))],
|
|
7309
7413
|
["keyOriginLineArrWdth", dbl(head ? head.width / w * 100 : 0)],
|
|
7310
7414
|
["keyOriginLineArrLngth", dbl(head ? head.length / w * 100 : 0)],
|
|
7311
|
-
["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess',
|
|
7415
|
+
["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess', _201 => _201.concavity]) ? head.concavity * 100 : 0)]
|
|
7312
7416
|
];
|
|
7313
7417
|
}
|
|
7314
7418
|
const m = live.transform;
|
|
@@ -7341,7 +7445,7 @@ function shapeSignature(layer) {
|
|
|
7341
7445
|
return JSON.stringify([layer.components, layer.fill, layer.stroke, _nullishCoalesce(layer.fillRule, () => ( "nonzero")), Boolean(layer.inverted)]);
|
|
7342
7446
|
}
|
|
7343
7447
|
function shapeFromBlocks(blocks, width, height, dpi, notes) {
|
|
7344
|
-
const block = (k) => _optionalChain([blocks, 'access',
|
|
7448
|
+
const block = (k) => _optionalChain([blocks, 'access', _202 => _202.find, 'call', _203 => _203((b) => b.key === k), 'optionalAccess', _204 => _204.data]);
|
|
7345
7449
|
const vector = _nullishCoalesce(block("vsms"), () => ( block("vmsk")));
|
|
7346
7450
|
const path = vector ? componentsFromVectorBlock(vector, width, height) : null;
|
|
7347
7451
|
if (!path) return null;
|
|
@@ -7396,18 +7500,18 @@ function sameExtent(sub, c) {
|
|
|
7396
7500
|
return a.every((v, i) => Math.abs(v - b[i]) < 1);
|
|
7397
7501
|
}
|
|
7398
7502
|
function shapeBlocks(layer, width, height, dpi, notes) {
|
|
7399
|
-
const kept = _optionalChain([layer, 'access',
|
|
7400
|
-
if (_optionalChain([kept, 'optionalAccess',
|
|
7503
|
+
const kept = _optionalChain([layer, 'access', _205 => _205.psd, 'optionalAccess', _206 => _206.blocks]);
|
|
7504
|
+
if (_optionalChain([kept, 'optionalAccess', _207 => _207.length]) && _optionalChain([layer, 'access', _208 => _208.psd, 'optionalAccess', _209 => _209.signature]) === shapeSignature(layer)) return kept.map((b) => ({ key: b.key, data: b.data }));
|
|
7401
7505
|
const out = [];
|
|
7402
7506
|
out.push({ key: "vsms", data: vectorBlockForComponents(layer.components, Boolean(layer.inverted), width, height) });
|
|
7403
7507
|
if (layer.fillRule === "evenodd" && layer.components.some((c) => c.subpaths.length > 1)) notes.add("Even-odd fill rules were written as nonzero (Photoshop fills shapes nonzero)");
|
|
7404
7508
|
const fill = _nullishCoalesce(layer.fill, () => ( { type: "color", color: "#000000" }));
|
|
7405
|
-
if (_optionalChain([layer, 'access',
|
|
7509
|
+
if (_optionalChain([layer, 'access', _210 => _210.fill, 'optionalAccess', _211 => _211.opacity]) !== void 0 && layer.fill.opacity < 1) notes.add("Shape fill opacity has no PSD equivalent and was written as 100 % (use the layer fill opacity)");
|
|
7406
7510
|
out.push({ key: "vscg", data: vscgBytes(fill) });
|
|
7407
7511
|
if (layer.stroke || !layer.fill) out.push({ key: "vstk", data: vstkBytes(layer.stroke, Boolean(layer.fill), dpi) });
|
|
7408
7512
|
const vogk = vogkBytes(layer.components, dpi);
|
|
7409
7513
|
if (vogk) out.push({ key: "vogk", data: vogk });
|
|
7410
|
-
if (layer.components.some((c) => _optionalChain([c, 'access',
|
|
7514
|
+
if (layer.components.some((c) => _optionalChain([c, 'access', _212 => _212.live, 'optionalAccess', _213 => _213.kind]) === "line" && (c.live.startArrow && c.live.endArrow && JSON.stringify(c.live.startArrow) !== JSON.stringify(c.live.endArrow) || false))) {
|
|
7411
7515
|
notes.add("Lines with different start and end arrowheads were written with one arrowhead size (Photoshop has one)");
|
|
7412
7516
|
}
|
|
7413
7517
|
return out;
|
|
@@ -7616,7 +7720,7 @@ var E = {
|
|
|
7616
7720
|
bool: (value) => ({ t: "bool", value })
|
|
7617
7721
|
};
|
|
7618
7722
|
function eGet(v, key) {
|
|
7619
|
-
return _optionalChain([v, 'optionalAccess',
|
|
7723
|
+
return _optionalChain([v, 'optionalAccess', _214 => _214.t]) === "dict" ? _optionalChain([v, 'access', _215 => _215.items, 'access', _216 => _216.find, 'call', _217 => _217(([k]) => k === key), 'optionalAccess', _218 => _218[1]]) : void 0;
|
|
7620
7724
|
}
|
|
7621
7725
|
function ePath(v, keys) {
|
|
7622
7726
|
return keys.reduce((at, k) => eGet(at, k), v);
|
|
@@ -7634,7 +7738,7 @@ function eStr(v) {
|
|
|
7634
7738
|
return v && (v.t === "string" || v.t === "name") ? v.value : void 0;
|
|
7635
7739
|
}
|
|
7636
7740
|
function eArray(v) {
|
|
7637
|
-
return _optionalChain([v, 'optionalAccess',
|
|
7741
|
+
return _optionalChain([v, 'optionalAccess', _219 => _219.t]) === "array" ? v.items : [];
|
|
7638
7742
|
}
|
|
7639
7743
|
function eSet(d, key, value) {
|
|
7640
7744
|
if (d.t !== "dict") return;
|
|
@@ -7736,7 +7840,7 @@ function fontFromPostScript(ps) {
|
|
|
7736
7840
|
}
|
|
7737
7841
|
family += suffix;
|
|
7738
7842
|
const s = style.toLowerCase();
|
|
7739
|
-
const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access',
|
|
7843
|
+
const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access', _220 => _220.find, 'call', _221 => _221(([re]) => re.test(s)), 'optionalAccess', _222 => _222[1]]), () => ( 400));
|
|
7740
7844
|
return { family: family || ps, weight, italic: /italic|oblique|it$/.test(s) };
|
|
7741
7845
|
}
|
|
7742
7846
|
var STYLE_NAMES = [
|
|
@@ -7761,7 +7865,7 @@ var hex2 = (v) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).pad
|
|
|
7761
7865
|
function merged(levels) {
|
|
7762
7866
|
const items = [];
|
|
7763
7867
|
for (const l of levels) {
|
|
7764
|
-
if (_optionalChain([l, 'optionalAccess',
|
|
7868
|
+
if (_optionalChain([l, 'optionalAccess', _223 => _223.t]) !== "dict") continue;
|
|
7765
7869
|
for (const [k, v] of l.items) if (!items.some(([o]) => o === k)) items.push([k, v]);
|
|
7766
7870
|
}
|
|
7767
7871
|
return E.dict(items);
|
|
@@ -7834,10 +7938,10 @@ function typeFromTySh(data, notes) {
|
|
|
7834
7938
|
const t = parseTySh(data);
|
|
7835
7939
|
if (!t) return null;
|
|
7836
7940
|
const txtV = descGet(t.text, "Txt ");
|
|
7837
|
-
const txt = _optionalChain([txtV, 'optionalAccess',
|
|
7941
|
+
const txt = _optionalChain([txtV, 'optionalAccess', _224 => _224.type]) === "TEXT" ? txtV.value.replace(/\0+$/, "") : void 0;
|
|
7838
7942
|
const ed = descGet(t.text, "EngineData");
|
|
7839
7943
|
let engine = null;
|
|
7840
|
-
if (_optionalChain([ed, 'optionalAccess',
|
|
7944
|
+
if (_optionalChain([ed, 'optionalAccess', _225 => _225.type]) === "tdta") {
|
|
7841
7945
|
try {
|
|
7842
7946
|
engine = parseEngineData(ed.data);
|
|
7843
7947
|
} catch (e18) {
|
|
@@ -7845,12 +7949,12 @@ function typeFromTySh(data, notes) {
|
|
|
7845
7949
|
}
|
|
7846
7950
|
}
|
|
7847
7951
|
const anti = descGet(t.text, "AntA");
|
|
7848
|
-
const antiAlias = !(_optionalChain([anti, 'optionalAccess',
|
|
7952
|
+
const antiAlias = !(_optionalChain([anti, 'optionalAccess', _226 => _226.type]) === "enum" && (anti.value === "Anno" || anti.value === "antiAliasNone"));
|
|
7849
7953
|
const ornt = descGet(t.text, "Ornt");
|
|
7850
|
-
const vertical = _optionalChain([ornt, 'optionalAccess',
|
|
7954
|
+
const vertical = _optionalChain([ornt, 'optionalAccess', _227 => _227.type]) === "enum" && ornt.value === "Vrtc";
|
|
7851
7955
|
if (t.warp) {
|
|
7852
7956
|
const style = descGet(t.warp, "warpStyle");
|
|
7853
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
7957
|
+
if (_optionalChain([style, 'optionalAccess', _228 => _228.type]) === "enum" && style.value !== "warpNone") notes.add("warped text is drawn without its warp when edited");
|
|
7854
7958
|
}
|
|
7855
7959
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
7856
7960
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
@@ -7899,7 +8003,7 @@ function typeFromTySh(data, notes) {
|
|
|
7899
8003
|
let at = 0;
|
|
7900
8004
|
runs = ssheets.map((sheet, i) => {
|
|
7901
8005
|
const own = named(styleSet, sheet);
|
|
7902
|
-
const paraDefault = _optionalChain([paraBases, 'access',
|
|
8006
|
+
const paraDefault = _optionalChain([paraBases, 'access', _229 => _229[paraAt(at)], 'optionalAccess', _230 => _230.charDefault]);
|
|
7903
8007
|
at += _nullishCoalesce(slens[i], () => ( 0));
|
|
7904
8008
|
const d = merged([eGet(sheet, "StyleSheetData"), eGet(own, "StyleSheetData"), eGet(paraDefault, "StyleSheetData"), eGet(normalStyle, "StyleSheetData")]);
|
|
7905
8009
|
return { length: _nullishCoalesce(slens[i], () => ( 0)), style: charStyle(d, fonts, notes, vertical) };
|
|
@@ -7980,8 +8084,8 @@ var fontEntry = (name) => E.dict([
|
|
|
7980
8084
|
["Synthetic", E.int(0)]
|
|
7981
8085
|
]);
|
|
7982
8086
|
function buildEngineData(layer, template) {
|
|
7983
|
-
const e = _optionalChain([template, 'optionalAccess',
|
|
7984
|
-
if (_optionalChain([eGet, 'call',
|
|
8087
|
+
const e = _optionalChain([template, 'optionalAccess', _231 => _231.t]) === "dict" ? eClone(template) : E.dict([["EngineDict", E.dict()], ["ResourceDict", E.dict()]]);
|
|
8088
|
+
if (_optionalChain([eGet, 'call', _232 => _232(e, "EngineDict"), 'optionalAccess', _233 => _233.t]) !== "dict") eSet(e, "EngineDict", E.dict());
|
|
7985
8089
|
const dict = eGet(e, "EngineDict");
|
|
7986
8090
|
const text3 = layer.text.replace(/\n/g, "\r");
|
|
7987
8091
|
const edText = `${text3}\r`;
|
|
@@ -8061,7 +8165,7 @@ function buildEngineData(layer, template) {
|
|
|
8061
8165
|
eSet(e, key, rd);
|
|
8062
8166
|
}
|
|
8063
8167
|
eSet(rd, "FontSet", fontSet);
|
|
8064
|
-
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access',
|
|
8168
|
+
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _234 => _234[0], 'optionalAccess', _235 => _235.style]), () => ( _chunkQAUIZPYIcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8065
8169
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8066
8170
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8067
8171
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8082,12 +8186,12 @@ function inkBounds2(layer) {
|
|
|
8082
8186
|
return [Math.min(...pts.map((p) => p.x)), Math.min(...pts.map((p) => p.y)), Math.max(...pts.map((p) => p.x)), Math.max(...pts.map((p) => p.y))];
|
|
8083
8187
|
}
|
|
8084
8188
|
function tyShForLayer(layer) {
|
|
8085
|
-
const raw = _optionalChain([layer, 'access',
|
|
8086
|
-
if (raw && _optionalChain([layer, 'access',
|
|
8189
|
+
const raw = _optionalChain([layer, 'access', _236 => _236.psd, 'optionalAccess', _237 => _237.tySh]);
|
|
8190
|
+
if (raw && _optionalChain([layer, 'access', _238 => _238.psd, 'optionalAccess', _239 => _239.signature]) === typeSignature(layer)) return raw;
|
|
8087
8191
|
const old = raw ? parseTySh(raw) : null;
|
|
8088
8192
|
const oldEd = old ? descGet(old.text, "EngineData") : void 0;
|
|
8089
8193
|
let template = null;
|
|
8090
|
-
if (_optionalChain([oldEd, 'optionalAccess',
|
|
8194
|
+
if (_optionalChain([oldEd, 'optionalAccess', _240 => _240.type]) === "tdta") {
|
|
8091
8195
|
try {
|
|
8092
8196
|
template = parseEngineData(oldEd.data);
|
|
8093
8197
|
} catch (e19) {
|
|
@@ -8119,8 +8223,8 @@ function tyShForLayer(layer) {
|
|
|
8119
8223
|
set("boundingBox", rect("boundingBox"));
|
|
8120
8224
|
if (!descGet(text3, "TextIndex")) set("TextIndex", { type: "long", value: 0 });
|
|
8121
8225
|
set("EngineData", { type: "tdta", data: writeEngineData(engine) });
|
|
8122
|
-
const warpStyle = _optionalChain([old, 'optionalAccess',
|
|
8123
|
-
const warp = _optionalChain([old, 'optionalAccess',
|
|
8226
|
+
const warpStyle = _optionalChain([old, 'optionalAccess', _241 => _241.warp]) ? descGet(old.warp, "warpStyle") : void 0;
|
|
8227
|
+
const warp = _optionalChain([old, 'optionalAccess', _242 => _242.warp]) && _optionalChain([warpStyle, 'optionalAccess', _243 => _243.type]) === "enum" && warpStyle.value === "warpNone" ? old.warp : null;
|
|
8124
8228
|
return writeTySh({ transform: textMatrix(layer), text: text3, warp, tail: new Uint8Array(16) });
|
|
8125
8229
|
}
|
|
8126
8230
|
|
|
@@ -8134,15 +8238,15 @@ var textV = (value) => ({ type: "TEXT", value });
|
|
|
8134
8238
|
var obj2 = (d) => ({ type: "Objc", value: d });
|
|
8135
8239
|
var text = (d, key) => {
|
|
8136
8240
|
const v = descGet(d, key);
|
|
8137
|
-
return _optionalChain([v, 'optionalAccess',
|
|
8241
|
+
return _optionalChain([v, 'optionalAccess', _244 => _244.type]) === "TEXT" ? v.value : void 0;
|
|
8138
8242
|
};
|
|
8139
8243
|
var enumOf2 = (d, key) => {
|
|
8140
8244
|
const v = descGet(d, key);
|
|
8141
|
-
return _optionalChain([v, 'optionalAccess',
|
|
8245
|
+
return _optionalChain([v, 'optionalAccess', _245 => _245.type]) === "enum" ? v.value : void 0;
|
|
8142
8246
|
};
|
|
8143
8247
|
var numbers = (d, key) => {
|
|
8144
8248
|
const v = descGet(d, key);
|
|
8145
|
-
if (_optionalChain([v, 'optionalAccess',
|
|
8249
|
+
if (_optionalChain([v, 'optionalAccess', _246 => _246.type]) !== "VlLs") return null;
|
|
8146
8250
|
const out = [];
|
|
8147
8251
|
for (const it of v.items) {
|
|
8148
8252
|
if (it.type === "doub" || it.type === "UntF" || it.type === "long") out.push(it.value);
|
|
@@ -8337,8 +8441,8 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8337
8441
|
const painted = _chunk474IQG74cjs.contentBounds.call(void 0, mask.surface);
|
|
8338
8442
|
let b = _nullishCoalesce(painted, () => ( { x: 0, y: 0, width: 1, height: 1 }));
|
|
8339
8443
|
if (mask.defaultValue !== 255 && area) {
|
|
8340
|
-
const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess',
|
|
8341
|
-
const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess',
|
|
8444
|
+
const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _247 => _247.x]), () => ( area.x)));
|
|
8445
|
+
const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _248 => _248.y]), () => ( area.y)));
|
|
8342
8446
|
const x1 = Math.max(area.x + area.width, painted ? painted.x + painted.width : 0);
|
|
8343
8447
|
const y1 = Math.max(area.y + area.height, painted ? painted.y + painted.height : 0);
|
|
8344
8448
|
b = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
|
|
@@ -8358,7 +8462,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8358
8462
|
}
|
|
8359
8463
|
var warpStyleOf = (name) => {
|
|
8360
8464
|
if (!name.startsWith("warp")) return null;
|
|
8361
|
-
const s = _optionalChain([name, 'access',
|
|
8465
|
+
const s = _optionalChain([name, 'access', _249 => _249[4], 'optionalAccess', _250 => _250.toLowerCase, 'call', _251 => _251()]) + name.slice(5);
|
|
8362
8466
|
return _chunkQAUIZPYIcjs.WARP_STYLES.includes(s) ? s : null;
|
|
8363
8467
|
};
|
|
8364
8468
|
function warpFromDescriptor(w, contents) {
|
|
@@ -8380,7 +8484,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8380
8484
|
if (!arr || arr.type !== "ObAr") return void 0;
|
|
8381
8485
|
const xs = descGet(arr.body, "Hrzn");
|
|
8382
8486
|
const ys = descGet(arr.body, "Vrtc");
|
|
8383
|
-
if (_optionalChain([xs, 'optionalAccess',
|
|
8487
|
+
if (_optionalChain([xs, 'optionalAccess', _252 => _252.type]) !== "UnFl" || _optionalChain([ys, 'optionalAccess', _253 => _253.type]) !== "UnFl" || xs.values.length !== 16 || ys.values.length !== 16) return void 0;
|
|
8384
8488
|
mesh = { us: [0, 1], vs: [0, 1], points: xs.values.map((x, i) => ({ x, y: ys.values[i] })) };
|
|
8385
8489
|
const px2 = mesh.points.map((p) => p.x);
|
|
8386
8490
|
const py = mesh.points.map((p) => p.y);
|
|
@@ -8547,13 +8651,13 @@ function blendOptions(f) {
|
|
|
8547
8651
|
function smartFiltersFromPsd(fx, newId, notes) {
|
|
8548
8652
|
const filters = [];
|
|
8549
8653
|
const list2 = descGet(fx, "filterFXList");
|
|
8550
|
-
for (const v of _optionalChain([list2, 'optionalAccess',
|
|
8654
|
+
for (const v of _optionalChain([list2, 'optionalAccess', _254 => _254.type]) === "VlLs" ? list2.items : []) {
|
|
8551
8655
|
if (v.type !== "Objc" && v.type !== "GlbO") continue;
|
|
8552
8656
|
const item = v.value;
|
|
8553
8657
|
const { blend, opacity } = blendOptionsOf(item);
|
|
8554
8658
|
const enabled = descBool(item, "enab") !== false;
|
|
8555
8659
|
const fltr = descObject(item, "Fltr");
|
|
8556
|
-
const radius = _optionalChain([fltr, 'optionalAccess',
|
|
8660
|
+
const radius = _optionalChain([fltr, 'optionalAccess', _255 => _255.classId]) === BOX_BLUR.classId ? descNumber(fltr, "Rds ") : void 0;
|
|
8557
8661
|
if (radius !== void 0 && radius >= 0 && radius <= 50) {
|
|
8558
8662
|
filters.push({ id: newId(), kind: "blur", enabled, radius, blend, opacity });
|
|
8559
8663
|
continue;
|
|
@@ -8906,7 +9010,7 @@ function readPsd(bytes) {
|
|
|
8906
9010
|
return { header, colorModeData, resources, layers, mergedAlpha, globalBlocks, imageCompression, imageData: r.rest() };
|
|
8907
9011
|
}
|
|
8908
9012
|
function layerBlock(rec, key) {
|
|
8909
|
-
return _optionalChain([rec, 'access',
|
|
9013
|
+
return _optionalChain([rec, 'access', _256 => _256.blocks, 'access', _257 => _257.find, 'call', _258 => _258((b) => b.key === key), 'optionalAccess', _259 => _259.data]);
|
|
8910
9014
|
}
|
|
8911
9015
|
function layerName(rec) {
|
|
8912
9016
|
const luni = layerBlock(rec, "luni");
|
|
@@ -8937,7 +9041,7 @@ function u8Block(rec, key) {
|
|
|
8937
9041
|
function layerTree(file) {
|
|
8938
9042
|
const stack = [[]];
|
|
8939
9043
|
file.layers.forEach((rec, index) => {
|
|
8940
|
-
const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call',
|
|
9044
|
+
const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _260 => _260(rec), 'optionalAccess', _261 => _261.kind]), () => ( SECTION_OTHER));
|
|
8941
9045
|
if (kind === SECTION_DIVIDER) {
|
|
8942
9046
|
stack.push([]);
|
|
8943
9047
|
} else if (kind === SECTION_OPEN || kind === SECTION_CLOSED) {
|
|
@@ -8955,7 +9059,7 @@ function layerTree(file) {
|
|
|
8955
9059
|
}
|
|
8956
9060
|
function channelRect(rec, id) {
|
|
8957
9061
|
if (id === CHANNEL_USER_MASK && rec.mask) return rec.mask.rect;
|
|
8958
|
-
if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access',
|
|
9062
|
+
if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _262 => _262.mask, 'access', _263 => _263.real, 'optionalAccess', _264 => _264.rect]), () => ( rec.mask.rect));
|
|
8959
9063
|
return rec.rect;
|
|
8960
9064
|
}
|
|
8961
9065
|
function decodeLayerChannel(file, rec, id) {
|
|
@@ -8973,7 +9077,7 @@ function decodeMergedImage(file) {
|
|
|
8973
9077
|
return decodePlanes(file.imageCompression, file.imageData, { planes: channels, width, height, depth, psb });
|
|
8974
9078
|
}
|
|
8975
9079
|
function resource(file, id) {
|
|
8976
|
-
return _optionalChain([file, 'access',
|
|
9080
|
+
return _optionalChain([file, 'access', _265 => _265.resources, 'access', _266 => _266.find, 'call', _267 => _267((r) => r.id === id), 'optionalAccess', _268 => _268.data]);
|
|
8977
9081
|
}
|
|
8978
9082
|
function resolution(file) {
|
|
8979
9083
|
const d = resource(file, 1005);
|
|
@@ -9711,8 +9815,8 @@ function baseProps(ctx, rec, name, notes) {
|
|
|
9711
9815
|
if (read2.flags & VMSK_NOT_LINKED) vm.linked = false;
|
|
9712
9816
|
if (read2.flags & VMSK_DISABLED) vm.enabled = false;
|
|
9713
9817
|
const m = rec.mask;
|
|
9714
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
9715
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
9818
|
+
if (_optionalChain([m, 'optionalAccess', _269 => _269.vectorDensity]) !== void 0 && m.vectorDensity < 255) vm.density = percent(m.vectorDensity);
|
|
9819
|
+
if (_optionalChain([m, 'optionalAccess', _270 => _270.vectorFeather]) !== void 0 && m.vectorFeather > 0) vm.feather = Math.min(1e3, m.vectorFeather);
|
|
9716
9820
|
props.vectorMask = vm;
|
|
9717
9821
|
} else {
|
|
9718
9822
|
ctx.warn.add("A vector mask could not be read and was ignored", name);
|
|
@@ -9743,7 +9847,7 @@ function recordEffects(ctx, rec, name, notes, group) {
|
|
|
9743
9847
|
}
|
|
9744
9848
|
for (const e of parsed.effects.items) {
|
|
9745
9849
|
for (const id of patternIds(e)) {
|
|
9746
|
-
if (ctx.patterns.has(id) ||
|
|
9850
|
+
if (ctx.patterns.has(id) || _chunkB46UQUDCcjs.builtinPattern.call(void 0, id)) continue;
|
|
9747
9851
|
ctx.warn.add("A pattern effect uses a pattern the file does not contain, and paints nothing", name);
|
|
9748
9852
|
notes.push(`pattern "${id}" is not in the file`);
|
|
9749
9853
|
}
|
|
@@ -9772,7 +9876,7 @@ function importNode(ctx, node, depth) {
|
|
|
9772
9876
|
if (node.children) {
|
|
9773
9877
|
const props2 = baseProps(ctx, rec, name, notes);
|
|
9774
9878
|
const divider = sectionDivider(rec);
|
|
9775
|
-
const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess',
|
|
9879
|
+
const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _271 => _271.blendKey]), () => ( rec.blendKey));
|
|
9776
9880
|
const groupBlend = key === "pass" ? "pass-through" : _nullishCoalesce(PSD_BLEND_KEYS[key], () => ( "normal"));
|
|
9777
9881
|
const children = [];
|
|
9778
9882
|
for (const child of node.children) {
|
|
@@ -9782,7 +9886,7 @@ function importNode(ctx, node, depth) {
|
|
|
9782
9886
|
const group = { type: "group", id: ctx.newId(name), ...props2, blend: groupBlend, children };
|
|
9783
9887
|
const effects2 = recordEffects(ctx, rec, name, notes, true);
|
|
9784
9888
|
if (effects2) group.effects = effects2;
|
|
9785
|
-
if (_optionalChain([divider, 'optionalAccess',
|
|
9889
|
+
if (_optionalChain([divider, 'optionalAccess', _272 => _272.kind]) === SECTION_CLOSED) group.collapsed = true;
|
|
9786
9890
|
const mask2 = recordMask(ctx, rec, name);
|
|
9787
9891
|
if (mask2) group.mask = mask2;
|
|
9788
9892
|
entry.type = "group";
|
|
@@ -10006,7 +10110,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10006
10110
|
const file = ctx.linked.get(placed.idnt);
|
|
10007
10111
|
contents = {
|
|
10008
10112
|
id: placed.idnt || ctx.newId(`${name}-contents`),
|
|
10009
|
-
name: _optionalChain([file, 'optionalAccess',
|
|
10113
|
+
name: _optionalChain([file, 'optionalAccess', _273 => _273.name]) || `${name}.png`,
|
|
10010
10114
|
width,
|
|
10011
10115
|
height,
|
|
10012
10116
|
kind: "raster",
|
|
@@ -10163,7 +10267,7 @@ function psdToLayers(file, options = {}) {
|
|
|
10163
10267
|
if (mode !== "rgb" && header.depth > 8 && header.colorMode !== MODE_INDEXED && header.colorMode !== MODE_BITMAP) {
|
|
10164
10268
|
warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to ${header.depth}-bit RGB.`);
|
|
10165
10269
|
} else if (mode !== "rgb" || header.depth !== 8 && header.depth !== 16 && header.depth !== 32) {
|
|
10166
|
-
const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess',
|
|
10270
|
+
const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess', _274 => _274.name]), () => ( "its profile"))}` : "";
|
|
10167
10271
|
warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to 8-bit RGB${how}.`);
|
|
10168
10272
|
}
|
|
10169
10273
|
let layers = [];
|
|
@@ -10201,7 +10305,7 @@ function psdToLayers(file, options = {}) {
|
|
|
10201
10305
|
const saved = r.id >= RESOURCE_PATH_FIRST && r.id <= RESOURCE_PATH_LAST;
|
|
10202
10306
|
if (!saved && r.id !== RESOURCE_WORK_PATH) continue;
|
|
10203
10307
|
const read2 = componentsFromPathResource(r.data, header.width, header.height);
|
|
10204
|
-
if (!_optionalChain([read2, 'optionalAccess',
|
|
10308
|
+
if (!_optionalChain([read2, 'optionalAccess', _275 => _275.components, 'access', _276 => _276.length])) continue;
|
|
10205
10309
|
if (read2.inverted) warn.extra.push(`The path "${r.name || "Work Path"}" starts by subtracting, which Pixerate's paths do not keep; it came in without that.`);
|
|
10206
10310
|
paths.push(saved ? { name: r.name || `Path ${paths.length + 1}`, components: read2.components } : { name: "Work Path", components: read2.components, work: true });
|
|
10207
10311
|
}
|
|
@@ -10291,15 +10395,15 @@ var pct = (d, key, fallback) => num3(d, key, fallback * 100) / 100;
|
|
|
10291
10395
|
var bool = (d, key) => descBool(d, key) === true;
|
|
10292
10396
|
var enumOf3 = (d, key) => {
|
|
10293
10397
|
const v = descGet(d, key);
|
|
10294
|
-
return _optionalChain([v, 'optionalAccess',
|
|
10398
|
+
return _optionalChain([v, 'optionalAccess', _277 => _277.type]) === "enum" ? v.value : void 0;
|
|
10295
10399
|
};
|
|
10296
10400
|
var text2 = (d, key) => {
|
|
10297
10401
|
const v = d ? descGet(d, key) : void 0;
|
|
10298
|
-
return _optionalChain([v, 'optionalAccess',
|
|
10402
|
+
return _optionalChain([v, 'optionalAccess', _278 => _278.type]) === "TEXT" ? v.value : "";
|
|
10299
10403
|
};
|
|
10300
10404
|
var list = (d, key) => {
|
|
10301
10405
|
const v = descGet(d, key);
|
|
10302
|
-
if (_optionalChain([v, 'optionalAccess',
|
|
10406
|
+
if (_optionalChain([v, 'optionalAccess', _279 => _279.type]) !== "VlLs") return [];
|
|
10303
10407
|
return v.items.flatMap((it) => it.type === "Objc" || it.type === "GlbO" ? [it.value] : []);
|
|
10304
10408
|
};
|
|
10305
10409
|
var clamp3 = (v, lo, hi) => Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : lo;
|
|
@@ -10321,34 +10425,34 @@ function blendOf(d, key, fallback, notes) {
|
|
|
10321
10425
|
function colorOf(d, fallback = "#000000") {
|
|
10322
10426
|
if (!d) return fallback;
|
|
10323
10427
|
const g = (k) => descNumber(d, k);
|
|
10324
|
-
if (g("redFloat") !== void 0) return
|
|
10428
|
+
if (g("redFloat") !== void 0) return _chunkB46UQUDCcjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
|
|
10325
10429
|
switch (d.classId) {
|
|
10326
10430
|
case "HSBC": {
|
|
10327
10431
|
const rgb = decodePsdColor(1, [(_nullishCoalesce(g("H "), () => ( 0))) / 360 * 65535, (_nullishCoalesce(g("Strt"), () => ( 0))) / 100 * 65535, (_nullishCoalesce(g("Brgh"), () => ( 0))) / 100 * 65535]);
|
|
10328
|
-
return rgb ?
|
|
10432
|
+
return rgb ? _chunkB46UQUDCcjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10329
10433
|
}
|
|
10330
10434
|
case "CMYC": {
|
|
10331
10435
|
const inv = (k) => (1 - (_nullishCoalesce(g(k), () => ( 0))) / 100) * 65535;
|
|
10332
10436
|
const rgb = decodePsdColor(2, [inv("Cyn "), inv("Mgnt"), inv("Ylw "), inv("Blck")]);
|
|
10333
|
-
return rgb ?
|
|
10437
|
+
return rgb ? _chunkB46UQUDCcjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10334
10438
|
}
|
|
10335
10439
|
case "LbCl": {
|
|
10336
10440
|
const rgb = decodePsdColor(7, [(_nullishCoalesce(g("Lmnc"), () => ( 0))) * 100, Math.round((_nullishCoalesce(g("A "), () => ( 0))) * 100) & 65535, Math.round((_nullishCoalesce(g("B "), () => ( 0))) * 100) & 65535]);
|
|
10337
|
-
return rgb ?
|
|
10441
|
+
return rgb ? _chunkB46UQUDCcjs.effectColorHex.call(void 0, rgb) : fallback;
|
|
10338
10442
|
}
|
|
10339
10443
|
case "Grsc": {
|
|
10340
10444
|
const v = 1 - (_nullishCoalesce(g("Gry "), () => ( 0))) / 100;
|
|
10341
|
-
return
|
|
10445
|
+
return _chunkB46UQUDCcjs.effectColorHex.call(void 0, [v, v, v]);
|
|
10342
10446
|
}
|
|
10343
10447
|
}
|
|
10344
10448
|
const r = g("Rd ");
|
|
10345
10449
|
const gr = g("Grn ");
|
|
10346
10450
|
const b = g("Bl ");
|
|
10347
10451
|
if (r === void 0 || gr === void 0 || b === void 0) return fallback;
|
|
10348
|
-
return
|
|
10452
|
+
return _chunkB46UQUDCcjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
|
|
10349
10453
|
}
|
|
10350
10454
|
function colorDesc(hex) {
|
|
10351
|
-
const [r, g, b] = _nullishCoalesce(
|
|
10455
|
+
const [r, g, b] = _nullishCoalesce(_chunkB46UQUDCcjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
|
|
10352
10456
|
return descriptor("RGBC", [
|
|
10353
10457
|
["Rd ", dbl3(r * 255)],
|
|
10354
10458
|
["Grn ", dbl3(g * 255)],
|
|
@@ -10369,8 +10473,8 @@ function contourOf(d, key) {
|
|
|
10369
10473
|
return { name, points };
|
|
10370
10474
|
}
|
|
10371
10475
|
function contourDesc(c) {
|
|
10372
|
-
const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
10373
|
-
const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
10476
|
+
const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _280 => _280.name]), () => ( "Linear"));
|
|
10477
|
+
const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _281 => _281.points]), () => ( [
|
|
10374
10478
|
{ input: 0, output: 0 },
|
|
10375
10479
|
{ input: 1, output: 1 }
|
|
10376
10480
|
]));
|
|
@@ -10405,7 +10509,7 @@ function gradientOf(d, notes) {
|
|
|
10405
10509
|
{ position: 0, color: "#000000" },
|
|
10406
10510
|
{ position: 1, color: "#ffffff" }
|
|
10407
10511
|
],
|
|
10408
|
-
style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access',
|
|
10512
|
+
style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _282 => _282.find, 'call', _283 => _283(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _284 => _284[0]]), () => ( "linear")),
|
|
10409
10513
|
angle: clamp3(num3(d, "Angl", 90), -360, 360),
|
|
10410
10514
|
scale: clamp3(pct(d, "Scl ", 1), 0.1, 1.5),
|
|
10411
10515
|
reverse: bool(d, "Rvrs"),
|
|
@@ -10431,9 +10535,9 @@ function gradientOf(d, notes) {
|
|
|
10431
10535
|
raw.forEach((s, i) => {
|
|
10432
10536
|
if (i > 0 && Math.abs(s.mid - 0.5) > 1e-3) {
|
|
10433
10537
|
const a = raw[i - 1];
|
|
10434
|
-
const ca =
|
|
10435
|
-
const cb =
|
|
10436
|
-
stops.push({ position: a.position + (s.position - a.position) * s.mid, color:
|
|
10538
|
+
const ca = _chunkB46UQUDCcjs.parseEffectColor.call(void 0, a.color);
|
|
10539
|
+
const cb = _chunkB46UQUDCcjs.parseEffectColor.call(void 0, s.color);
|
|
10540
|
+
stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkB46UQUDCcjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
|
|
10437
10541
|
notes.add("gradient midpoints are drawn as straight segments");
|
|
10438
10542
|
}
|
|
10439
10543
|
stops.push({ position: s.position, color: s.color });
|
|
@@ -10459,7 +10563,7 @@ function gradientItems(g) {
|
|
|
10459
10563
|
)
|
|
10460
10564
|
)
|
|
10461
10565
|
};
|
|
10462
|
-
const op = _optionalChain([g, 'access',
|
|
10566
|
+
const op = _optionalChain([g, 'access', _285 => _285.opacityStops, 'optionalAccess', _286 => _286.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
|
|
10463
10567
|
const trns = {
|
|
10464
10568
|
type: "VlLs",
|
|
10465
10569
|
items: op.map(
|
|
@@ -10545,8 +10649,8 @@ var KINDS = [
|
|
|
10545
10649
|
["FrFX", "frameFXMulti", "stroke"]
|
|
10546
10650
|
];
|
|
10547
10651
|
function common(d, kind, notes) {
|
|
10548
|
-
const def =
|
|
10549
|
-
return { id:
|
|
10652
|
+
const def = _chunkB46UQUDCcjs.defaultLayerEffect.call(void 0, kind, "x");
|
|
10653
|
+
return { id: _chunkB46UQUDCcjs.newEffectId.call(void 0, ), enabled: descBool(d, "enab") !== false, blend: blendOf(d, "Md ", def.blend, notes), opacity: clamp3(pct(d, "Opct", def.opacity), 0, 1) };
|
|
10550
10654
|
}
|
|
10551
10655
|
function readOne(kind, d, notes) {
|
|
10552
10656
|
const size = (key, fallback) => clamp3(num3(d, key, fallback), 0, 250);
|
|
@@ -10589,7 +10693,7 @@ function readOne(kind, d, notes) {
|
|
|
10589
10693
|
case "bevel-emboss": {
|
|
10590
10694
|
const styles = { OtrB: "outer-bevel", InrB: "inner-bevel", Embs: "emboss", PlEb: "pillow-emboss", strokeEmboss: "stroke-emboss" };
|
|
10591
10695
|
const out = {
|
|
10592
|
-
id:
|
|
10696
|
+
id: _chunkB46UQUDCcjs.newEffectId.call(void 0, ),
|
|
10593
10697
|
enabled: descBool(d, "enab") !== false,
|
|
10594
10698
|
kind,
|
|
10595
10699
|
style: _nullishCoalesce(styles[_nullishCoalesce(enumOf3(d, "bvlS"), () => ( ""))], () => ( "inner-bevel")),
|
|
@@ -10800,10 +10904,10 @@ function writeLfx2(effects) {
|
|
|
10800
10904
|
["Scl ", unit3("#Prc", 100)],
|
|
10801
10905
|
["masterFXSwitch", boolV3(effects.enabled)]
|
|
10802
10906
|
];
|
|
10803
|
-
const scale =
|
|
10907
|
+
const scale = _chunkB46UQUDCcjs.effectsScale.call(void 0, effects);
|
|
10804
10908
|
let dropped = 0;
|
|
10805
10909
|
for (const [single, multi, kind] of KINDS) {
|
|
10806
|
-
const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(
|
|
10910
|
+
const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkB46UQUDCcjs.scaleLayerEffect.call(void 0, e, scale)));
|
|
10807
10911
|
if (!of.length) continue;
|
|
10808
10912
|
if (of.length === 1) items.push([single, obj3(of[0])]);
|
|
10809
10913
|
else if (multi) items.push([multi, { type: "VlLs", items: of.map(obj3) }]);
|
|
@@ -10835,7 +10939,7 @@ function parseLrfx(data) {
|
|
|
10835
10939
|
const colorAt = (rd) => {
|
|
10836
10940
|
rd.u16();
|
|
10837
10941
|
const c = [rd.u16(), rd.u16(), rd.u16(), rd.u16()];
|
|
10838
|
-
return
|
|
10942
|
+
return _chunkB46UQUDCcjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
|
|
10839
10943
|
};
|
|
10840
10944
|
const blendAt = (rd) => {
|
|
10841
10945
|
rd.skip(4);
|
|
@@ -10854,7 +10958,7 @@ function parseLrfx(data) {
|
|
|
10854
10958
|
const enabled = b.u8() !== 0;
|
|
10855
10959
|
const useGlobalLight = b.u8() !== 0;
|
|
10856
10960
|
const opacity = b.u8() / 255;
|
|
10857
|
-
const base = { id:
|
|
10961
|
+
const base = { id: _chunkB46UQUDCcjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
|
|
10858
10962
|
items.push(key === "dsdw" ? { ...base, kind: "drop-shadow", spread: 0, knocksOut: true } : { ...base, kind: "inner-shadow", choke: 0 });
|
|
10859
10963
|
} else if (key === "oglw" || key === "iglw") {
|
|
10860
10964
|
b.u32();
|
|
@@ -10864,7 +10968,7 @@ function parseLrfx(data) {
|
|
|
10864
10968
|
const blend = blendAt(b);
|
|
10865
10969
|
const enabled = b.u8() !== 0;
|
|
10866
10970
|
const opacity = b.u8() / 255;
|
|
10867
|
-
const base = { id:
|
|
10971
|
+
const base = { id: _chunkB46UQUDCcjs.newEffectId.call(void 0, ), enabled, blend, opacity, fill: { type: "color", color }, technique: "softer", size: clamp3(blur, 0, 250), antiAlias: false, range: 0.5, jitter: 0, noise: 0 };
|
|
10868
10972
|
items.push(key === "oglw" ? { ...base, kind: "outer-glow", spread: 0 } : { ...base, kind: "inner-glow", choke: 0, source: "edge" });
|
|
10869
10973
|
} else if (key === "sofi") {
|
|
10870
10974
|
b.u32();
|
|
@@ -10872,7 +10976,7 @@ function parseLrfx(data) {
|
|
|
10872
10976
|
const color = colorAt(b);
|
|
10873
10977
|
const opacity = b.u8() / 255;
|
|
10874
10978
|
const enabled = b.u8() !== 0;
|
|
10875
|
-
items.push({ id:
|
|
10979
|
+
items.push({ id: _chunkB46UQUDCcjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
|
|
10876
10980
|
} else if (key === "bevl") notes.add("legacy bevels are not read");
|
|
10877
10981
|
}
|
|
10878
10982
|
return { effects: { enabled: true, items }, notes: [...notes] };
|
|
@@ -10956,9 +11060,9 @@ function prepareNestedLayers(layers) {
|
|
|
10956
11060
|
if (l.type === "annotation") continue;
|
|
10957
11061
|
let next = l;
|
|
10958
11062
|
if (l.type === "group") next = { ...l, children: prepareNestedLayers(l.children) };
|
|
10959
|
-
else if (l.type === "pixel" && (_optionalChain([l, 'access',
|
|
11063
|
+
else if (l.type === "pixel" && (_optionalChain([l, 'access', _287 => _287.filters, 'optionalAccess', _288 => _288.length]) || l.source === "document")) {
|
|
10960
11064
|
const p = { ...l };
|
|
10961
|
-
if (_optionalChain([l, 'access',
|
|
11065
|
+
if (_optionalChain([l, 'access', _289 => _289.filters, 'optionalAccess', _290 => _290.some, 'call', _291 => _291(isActiveFilter)])) {
|
|
10962
11066
|
const b = l.surface.bounds;
|
|
10963
11067
|
if (b) {
|
|
10964
11068
|
const r = { x: b.x + l.offset.x - 64, y: b.y + l.offset.y - 64, width: b.width + 128, height: b.height + 128 };
|
|
@@ -10975,7 +11079,7 @@ function prepareNestedLayers(layers) {
|
|
|
10975
11079
|
delete p.source;
|
|
10976
11080
|
next = p;
|
|
10977
11081
|
}
|
|
10978
|
-
if (_optionalChain([next, 'access',
|
|
11082
|
+
if (_optionalChain([next, 'access', _292 => _292.mask, 'optionalAccess', _293 => _293.source])) {
|
|
10979
11083
|
next = { ...next };
|
|
10980
11084
|
delete next.mask;
|
|
10981
11085
|
}
|
|
@@ -11065,7 +11169,7 @@ function exportPsd(input) {
|
|
|
11065
11169
|
const key = layer.type === "group" ? "lfxs" : "lfx2";
|
|
11066
11170
|
if (fx.psd) {
|
|
11067
11171
|
const original = parseLfx2(fx.psd.data);
|
|
11068
|
-
if (original ?
|
|
11172
|
+
if (original ? _chunkB46UQUDCcjs.effectsFingerprint.call(void 0, original.effects) === _chunkB46UQUDCcjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
|
|
11069
11173
|
}
|
|
11070
11174
|
if (!fx.items.length && fx.enabled && (_nullishCoalesce(fx.scale, () => ( 1))) === 1) return null;
|
|
11071
11175
|
const { data, dropped } = writeLfx2(fx);
|
|
@@ -11092,7 +11196,7 @@ function exportPsd(input) {
|
|
|
11092
11196
|
return {
|
|
11093
11197
|
opacity: Math.round(Math.min(1, Math.max(0, layer.opacity)) * 255),
|
|
11094
11198
|
clipping: layer.clipped ? 1 : 0,
|
|
11095
|
-
flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access',
|
|
11199
|
+
flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _294 => _294.locks, 'optionalAccess', _295 => _295.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
|
|
11096
11200
|
legacyName: name,
|
|
11097
11201
|
blocks
|
|
11098
11202
|
};
|
|
@@ -11149,7 +11253,7 @@ function exportPsd(input) {
|
|
|
11149
11253
|
}
|
|
11150
11254
|
case "pixel": {
|
|
11151
11255
|
if (layer.source === "document") throw new PsdError(`Layer "${layer.name}" reads the document image; resolve its pixels before export.`);
|
|
11152
|
-
if (_optionalChain([layer, 'access',
|
|
11256
|
+
if (_optionalChain([layer, 'access', _296 => _296.filters, 'optionalAccess', _297 => _297.some, 'call', _298 => _298(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
|
|
11153
11257
|
const extra = [];
|
|
11154
11258
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity < 1) {
|
|
11155
11259
|
extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
|
|
@@ -11181,7 +11285,7 @@ function exportPsd(input) {
|
|
|
11181
11285
|
if (c.linked) note("Linked smart objects were embedded (their preview is written as the contents)", layer.name);
|
|
11182
11286
|
linkedFiles.set(idnt, smartContentsFile(c));
|
|
11183
11287
|
}
|
|
11184
|
-
let placedId = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
11288
|
+
let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _299 => _299.psd, 'optionalAccess', _300 => _300.placed]), () => ( psdUuid(`${layer.id}:placed`)));
|
|
11185
11289
|
if (placedIds.has(placedId)) placedId = psdUuid(`${layer.id}:placed:${placedIds.size}`);
|
|
11186
11290
|
placedIds.add(placedId);
|
|
11187
11291
|
if (placedUnchanged(layer, idnt, placedId)) {
|
|
@@ -11191,12 +11295,12 @@ function exportPsd(input) {
|
|
|
11191
11295
|
const filterFX = layer.smartFilters ? filterFXDescriptor(layer.smartFilters, dropped) : void 0;
|
|
11192
11296
|
if (dropped.length) note("Develop smart filters have no Photoshop filter and were left out of the filter list (the layer\u2019s pixels still show them)", layer.name);
|
|
11193
11297
|
const raw = layer.psd && layer.psd.key !== "PlLd" ? parsePlaced(layer.psd.key, layer.psd.data) : null;
|
|
11194
|
-
const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess',
|
|
11298
|
+
const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _301 => _301.descriptor]) };
|
|
11195
11299
|
const wnotes = [];
|
|
11196
11300
|
extra.push({ key: "PlLd", data: plldBytes(spec) }, { key: "SoLd", data: soldBytes(spec, wnotes) });
|
|
11197
11301
|
for (const n2 of wnotes) note(`A smart object: ${n2}`, layer.name);
|
|
11198
11302
|
}
|
|
11199
|
-
const fm = _optionalChain([layer, 'access',
|
|
11303
|
+
const fm = _optionalChain([layer, 'access', _302 => _302.smartFilters, 'optionalAccess', _303 => _303.mask]);
|
|
11200
11304
|
if (fm && !fm.source) filterItems.push(filterMaskItem(placedId, fm, { x: 0, y: 0, width, height }));
|
|
11201
11305
|
const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
|
|
11202
11306
|
const bounds = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
@@ -11224,8 +11328,8 @@ function exportPsd(input) {
|
|
|
11224
11328
|
const losses = /* @__PURE__ */ new Set();
|
|
11225
11329
|
for (const b of shapeBlocks(layer, width, height, _nullishCoalesce(input.resolution, () => ( 72)), losses)) extra.push({ key: b.key, data: padEven(b.data) });
|
|
11226
11330
|
for (const n2 of losses) note(n2, layer.name);
|
|
11227
|
-
if (_optionalChain([layer, 'access',
|
|
11228
|
-
if (_optionalChain([layer, 'access',
|
|
11331
|
+
if (_optionalChain([layer, 'access', _304 => _304.fill, 'optionalAccess', _305 => _305.type]) === "pattern") patternIds2.add(layer.fill.patternId);
|
|
11332
|
+
if (_optionalChain([layer, 'access', _306 => _306.stroke, 'optionalAccess', _307 => _307.paint, 'access', _308 => _308.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
|
|
11229
11333
|
} else {
|
|
11230
11334
|
extra.push({ key: "TySh", data: padEven(tyShForLayer(layer)) });
|
|
11231
11335
|
}
|
|
@@ -11293,7 +11397,7 @@ function exportPsd(input) {
|
|
|
11293
11397
|
{ id: 1005, name: "", data: rw.result() },
|
|
11294
11398
|
{ id: 1057, name: "", data: version.result() }
|
|
11295
11399
|
];
|
|
11296
|
-
if (_optionalChain([input, 'access',
|
|
11400
|
+
if (_optionalChain([input, 'access', _309 => _309.iccProfile, 'optionalAccess', _310 => _310.length])) resources.push({ id: 1039, name: "", data: input.iccProfile });
|
|
11297
11401
|
resources.push(...alphaChannelResources(_nullishCoalesce(input.alphaChannels, () => ( []))));
|
|
11298
11402
|
let savedPathId = RESOURCE_PATH_FIRST;
|
|
11299
11403
|
for (const p of _nullishCoalesce(input.paths, () => ( []))) {
|
|
@@ -11317,7 +11421,7 @@ function exportPsd(input) {
|
|
|
11317
11421
|
const byId = new Map((_nullishCoalesce(input.patterns, () => ( []))).map((p) => [p.id, p]));
|
|
11318
11422
|
const embed = [];
|
|
11319
11423
|
for (const id of patternIds2) {
|
|
11320
|
-
const p = _nullishCoalesce(byId.get(id), () => (
|
|
11424
|
+
const p = _nullishCoalesce(byId.get(id), () => ( _chunkB46UQUDCcjs.builtinPattern.call(void 0, id)));
|
|
11321
11425
|
if (p) embed.push(p);
|
|
11322
11426
|
else note(`Pattern "${id}" is not in the document and was not embedded`, id);
|
|
11323
11427
|
}
|
|
@@ -11707,4 +11811,11 @@ function exportPsd(input) {
|
|
|
11707
11811
|
|
|
11708
11812
|
|
|
11709
11813
|
|
|
11710
|
-
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.layerMaskSelection = layerMaskSelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.TEXT_ORIENTATIONS = TEXT_ORIENTATIONS; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.MAX_EFFECT_ANIMATION_MS = MAX_EFFECT_ANIMATION_MS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.componentsCoverage = componentsCoverage; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.isActiveVectorMask = isActiveVectorMask; exports.vectorMaskCoverage = vectorMaskCoverage; exports.effectiveLayerMask = effectiveLayerMask; exports.resolveVectorMasks = resolveVectorMasks; exports.offsetVectorMask = offsetVectorMask; exports.transformVectorMask = transformVectorMask; exports.followLayerMove = followLayerMove; exports.vectorMaskBounds = vectorMaskBounds; exports.vectorMaskThumbnail = vectorMaskThumbnail; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.textOrientation = textOrientation; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.ANCHOR_FRACTION = ANCHOR_FRACTION; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.translateLayer = translateLayer; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.readShapeComponents = readShapeComponents; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
|
|
11814
|
+
|
|
11815
|
+
|
|
11816
|
+
|
|
11817
|
+
|
|
11818
|
+
|
|
11819
|
+
|
|
11820
|
+
|
|
11821
|
+
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.layerMaskSelection = layerMaskSelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.TEXT_ORIENTATIONS = TEXT_ORIENTATIONS; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.MAX_EFFECT_ANIMATION_MS = MAX_EFFECT_ANIMATION_MS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.componentsCoverage = componentsCoverage; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.isActiveVectorMask = isActiveVectorMask; exports.vectorMaskCoverage = vectorMaskCoverage; exports.effectiveLayerMask = effectiveLayerMask; exports.resolveVectorMasks = resolveVectorMasks; exports.offsetVectorMask = offsetVectorMask; exports.transformVectorMask = transformVectorMask; exports.followLayerMove = followLayerMove; exports.vectorMaskBounds = vectorMaskBounds; exports.vectorMaskThumbnail = vectorMaskThumbnail; exports.EDGE_COLOR_RADIUS = EDGE_COLOR_RADIUS; exports.hasEdgeUnmix = hasEdgeUnmix; exports.maskCoverageOverCanvas = maskCoverageOverCanvas; exports.hasSoftBand = hasSoftBand; exports.despillEdge = despillEdge; exports.applyEdgeUnmix = applyEdgeUnmix; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.textOrientation = textOrientation; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.ANCHOR_FRACTION = ANCHOR_FRACTION; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.translateLayer = translateLayer; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.readEdgeColor = readEdgeColor; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.readShapeComponents = readShapeComponents; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
|