@pixerate/editor 0.228.1 → 0.228.2

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.
@@ -46,7 +46,7 @@ var _chunkSS53NNZOcjs = require('./chunk-SS53NNZO.cjs');
46
46
 
47
47
 
48
48
 
49
- var _chunkB46UQUDCcjs = require('./chunk-B46UQUDC.cjs');
49
+ var _chunkHB4ICNNAcjs = require('./chunk-HB4ICNNA.cjs');
50
50
 
51
51
 
52
52
 
@@ -1044,7 +1044,7 @@ function normalizeAdjustmentLayers(raw) {
1044
1044
  return out;
1045
1045
  }
1046
1046
  function curveLutFromLevels(points) {
1047
- return _chunkB46UQUDCcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
1047
+ return _chunkHB4ICNNAcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
1048
1048
  }
1049
1049
  var toUnitLevels = (c) => ({
1050
1050
  inBlack: c.inBlack / 255,
@@ -2240,7 +2240,7 @@ function newLayerId(prefix = "layer") {
2240
2240
  return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
2241
2241
  }
2242
2242
  function pixelLayers(layers) {
2243
- return _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
2243
+ return _chunkHB4ICNNAcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
2244
2244
  }
2245
2245
  function developFilter(layer) {
2246
2246
  return _optionalChain([layer, 'access', _10 => _10.filters, 'optionalAccess', _11 => _11.find, 'call', _12 => _12((f) => f.kind === "develop")]);
@@ -2271,14 +2271,14 @@ function isRenderedLayer(layer) {
2271
2271
  return layer.type === "smart" || layer.type === "shape" || layer.type === "type";
2272
2272
  }
2273
2273
  function shapeLayers(layers) {
2274
- return _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
2274
+ return _chunkHB4ICNNAcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
2275
2275
  }
2276
2276
  function smartObjectLayers(layers) {
2277
- return _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
2277
+ return _chunkHB4ICNNAcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
2278
2278
  }
2279
2279
 
2280
2280
  // src/image-editor/layers/shape.ts
2281
- var SHAPE_RENDER_MARGIN = _chunkB46UQUDCcjs.MAX_EFFECT_REACH;
2281
+ var SHAPE_RENDER_MARGIN = _chunkHB4ICNNAcjs.MAX_EFFECT_REACH;
2282
2282
  var DEFAULT_MITER_LIMIT = 100;
2283
2283
  var fail = (message) => {
2284
2284
  throw new LayerOperationError(message);
@@ -2498,11 +2498,11 @@ function componentsCoverage(components, rect, rule = "nonzero", inverted = false
2498
2498
  function paintContext(env) {
2499
2499
  const tiles = /* @__PURE__ */ new Map();
2500
2500
  return {
2501
- light: _chunkB46UQUDCcjs.DEFAULT_GLOBAL_LIGHT,
2501
+ light: _chunkHB4ICNNAcjs.DEFAULT_GLOBAL_LIGHT,
2502
2502
  pattern: (id) => {
2503
2503
  if (tiles.has(id)) return tiles.get(id);
2504
- const p = _nullishCoalesce(_optionalChain([env, 'access', _18 => _18.pattern, 'optionalCall', _19 => _19(id)]), () => ( _chunkB46UQUDCcjs.builtinPattern.call(void 0, id)));
2505
- const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkB46UQUDCcjs.PatternTile)(p) : null;
2504
+ const p = _nullishCoalesce(_optionalChain([env, 'access', _18 => _18.pattern, 'optionalCall', _19 => _19(id)]), () => ( _chunkHB4ICNNAcjs.builtinPattern.call(void 0, id)));
2505
+ const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkHB4ICNNAcjs.PatternTile)(p) : null;
2506
2506
  tiles.set(id, t);
2507
2507
  return t;
2508
2508
  }
@@ -2533,9 +2533,9 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
2533
2533
  if (!fCov && !sCov) return null;
2534
2534
  const canvas = { x: 0, y: 0, width: env.width, height: env.height };
2535
2535
  const anchor = { x: geo.frame.x, y: geo.frame.y };
2536
- const fc = fCov ? _chunkB46UQUDCcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
2536
+ const fc = fCov ? _chunkHB4ICNNAcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
2537
2537
  const fo = _nullishCoalesce(_optionalChain([layer, 'access', _20 => _20.fill, 'optionalAccess', _21 => _21.opacity]), () => ( 1));
2538
- const sc = sCov ? _chunkB46UQUDCcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
2538
+ const sc = sCov ? _chunkHB4ICNNAcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
2539
2539
  const so = _nullishCoalesce(_optionalChain([layer, 'access', _22 => _22.stroke, 'optionalAccess', _23 => _23.paint, 'access', _24 => _24.opacity]), () => ( 1));
2540
2540
  const out = new Uint8ClampedArray(n * 4);
2541
2541
  let any = false;
@@ -2628,9 +2628,9 @@ function normalizeShapePaint(v, path = "paint") {
2628
2628
  offset: _nullishCoalesce(g.offset, () => ( { x: 0, y: 0 }))
2629
2629
  };
2630
2630
  try {
2631
- _chunkB46UQUDCcjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
2631
+ _chunkHB4ICNNAcjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
2632
2632
  } catch (e) {
2633
- if (e instanceof _chunkB46UQUDCcjs.LayerEffectError) fail(e.message);
2633
+ if (e instanceof _chunkHB4ICNNAcjs.LayerEffectError) fail(e.message);
2634
2634
  throw e;
2635
2635
  }
2636
2636
  if (gradient.stops.length < 1) fail(`${path}.gradient.stops needs at least one { position, color }.`);
@@ -2842,7 +2842,7 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
2842
2842
  if (!("annotation" in patch)) delete next.annotation;
2843
2843
  if (!next.components.length) fail("A shape needs at least one component; delete the layer instead.");
2844
2844
  const rendered = rerenderShape(next, env);
2845
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
2845
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
2846
2846
  }
2847
2847
  function transformShapeComponents(components, f, affine) {
2848
2848
  return components.map((c) => {
@@ -2873,7 +2873,7 @@ function shapeAsPixelLayer(layer) {
2873
2873
  }
2874
2874
  function annotationPaint(color, opacity) {
2875
2875
  const c = _chunkA2IS7EHEcjs.parseCssColor.call(void 0, color);
2876
- if (!c || !_chunkB46UQUDCcjs.parseEffectColor.call(void 0, c.hex)) return void 0;
2876
+ if (!c || !_chunkHB4ICNNAcjs.parseEffectColor.call(void 0, c.hex)) return void 0;
2877
2877
  const a = c.alpha * opacity;
2878
2878
  return a !== 1 ? { type: "color", color: c.hex, opacity: a } : { type: "color", color: c.hex };
2879
2879
  }
@@ -3312,18 +3312,18 @@ function userErrorMessage(err) {
3312
3312
  return err instanceof Error ? err.message : String(err);
3313
3313
  }
3314
3314
  function isPaintableLayer(layer) {
3315
- return layer.type === "pixel" && layer.visible && !_chunkB46UQUDCcjs.isLayerLocked.call(void 0, layer, "pixels");
3315
+ return layer.type === "pixel" && layer.visible && !_chunkHB4ICNNAcjs.isLayerLocked.call(void 0, layer, "pixels");
3316
3316
  }
3317
3317
  function defaultActiveLayerId(layers) {
3318
- const pixels = _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
3318
+ const pixels = _chunkHB4ICNNAcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
3319
3319
  for (let i = pixels.length - 1; i >= 0; i--) if (isPaintableLayer(pixels[i])) return pixels[i].id;
3320
3320
  return _nullishCoalesce(_optionalChain([pixels, 'access', _47 => _47[pixels.length - 1], 'optionalAccess', _48 => _48.id]), () => ( null));
3321
3321
  }
3322
3322
  function activeLayerAfterRemoval(prev, next, removedId) {
3323
- const before = _chunkB46UQUDCcjs.flattenLayers.call(void 0, prev);
3323
+ const before = _chunkHB4ICNNAcjs.flattenLayers.call(void 0, prev);
3324
3324
  const at = before.findIndex((l) => l.id === removedId);
3325
3325
  for (let i = at - 1; i >= 0; i--) {
3326
- const loc = _chunkB46UQUDCcjs.findLayer.call(void 0, next, before[i].id);
3326
+ const loc = _chunkHB4ICNNAcjs.findLayer.call(void 0, next, before[i].id);
3327
3327
  if (loc && isPaintableLayer(loc.layer)) return loc.layer.id;
3328
3328
  }
3329
3329
  return defaultActiveLayerId(next);
@@ -3332,47 +3332,47 @@ var fail2 = (message) => {
3332
3332
  throw new LayerOperationError(message);
3333
3333
  };
3334
3334
  function requireLayer(layers, id) {
3335
- const loc = _chunkB46UQUDCcjs.findLayer.call(void 0, layers, id);
3335
+ const loc = _chunkHB4ICNNAcjs.findLayer.call(void 0, layers, id);
3336
3336
  if (!loc) {
3337
- const ids = _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
3337
+ const ids = _chunkHB4ICNNAcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
3338
3338
  fail2(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
3339
3339
  }
3340
3340
  return loc;
3341
3341
  }
3342
3342
  function requireUnlocked(layer, what, action) {
3343
- if (_chunkB46UQUDCcjs.isLayerLocked.call(void 0, layer, "all")) fail2(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
3344
- 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}.`);
3343
+ if (_chunkHB4ICNNAcjs.isLayerLocked.call(void 0, layer, "all")) fail2(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
3344
+ if (what !== "all" && _chunkHB4ICNNAcjs.isLayerLocked.call(void 0, layer, what)) fail2(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
3345
3345
  }
3346
3346
  function placeLayer(layers, layer, placement = {}, defaultIndex) {
3347
3347
  const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
3348
3348
  if (given > 1) fail2("Give only one of aboveId, belowId and parentId.");
3349
3349
  if (placement.aboveId || placement.belowId) {
3350
3350
  const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
3351
- return _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _49 => _49.parent, 'optionalAccess', _50 => _50.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
3351
+ return _chunkHB4ICNNAcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _49 => _49.parent, 'optionalAccess', _50 => _50.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
3352
3352
  }
3353
3353
  if (placement.parentId) {
3354
3354
  const ref = requireLayer(layers, placement.parentId);
3355
3355
  if (ref.layer.type !== "group") fail2(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
3356
- return _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
3356
+ return _chunkHB4ICNNAcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
3357
3357
  }
3358
- return _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
3358
+ return _chunkHB4ICNNAcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
3359
3359
  }
3360
3360
  function removeLayer(layers, id) {
3361
3361
  const loc = requireLayer(layers, id);
3362
3362
  requireUnlocked(loc.layer, "all", "delete it");
3363
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => null);
3363
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => null);
3364
3364
  }
3365
3365
  function moveLayer(layers, id, placement) {
3366
3366
  const loc = requireLayer(layers, id);
3367
3367
  requireUnlocked(loc.layer, "all", "move it");
3368
3368
  const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
3369
3369
  if (target === id) fail2("A layer cannot be placed relative to itself.");
3370
- if (target && loc.layer.type === "group" && _chunkB46UQUDCcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
3370
+ if (target && loc.layer.type === "group" && _chunkHB4ICNNAcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
3371
3371
  fail2(`Group "${id}" cannot be moved into its own child "${target}".`);
3372
3372
  }
3373
3373
  if (target) requireLayer(layers, target);
3374
3374
  if (!target && placement.index === void 0) fail2("Give aboveId, belowId, parentId or index.");
3375
- const without = _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => null);
3375
+ const without = _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => null);
3376
3376
  return placeLayer(without, loc.layer, placement);
3377
3377
  }
3378
3378
  function withNewIds(layer) {
@@ -3391,7 +3391,7 @@ function duplicateLayer(layers, id, name) {
3391
3391
  const copy = withNewIds(loc.layer);
3392
3392
  copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
3393
3393
  delete copy.locks;
3394
- return { layers: _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _53 => _53.parent, 'optionalAccess', _54 => _54.id]), () => ( null)), loc.index + 1), id: copy.id };
3394
+ return { layers: _chunkHB4ICNNAcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _53 => _53.parent, 'optionalAccess', _54 => _54.id]), () => ( null)), loc.index + 1), id: copy.id };
3395
3395
  }
3396
3396
  function setLayerProperties(layers, id, props) {
3397
3397
  const loc = requireLayer(layers, id);
@@ -3438,7 +3438,7 @@ function setLayerProperties(layers, id, props) {
3438
3438
  if (props.collapsed) g.collapsed = true;
3439
3439
  else delete g.collapsed;
3440
3440
  }
3441
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next);
3441
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next);
3442
3442
  }
3443
3443
  function groupLayers(layers, ids, name = "Group") {
3444
3444
  if (!ids.length) fail2("Give at least one layer id to group.");
@@ -3467,17 +3467,17 @@ function groupLayers(layers, ids, name = "Group") {
3467
3467
  group.children[0] = c;
3468
3468
  }
3469
3469
  let out = layers;
3470
- for (const l of ordered) out = _chunkB46UQUDCcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
3471
- return { layers: _chunkB46UQUDCcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
3470
+ for (const l of ordered) out = _chunkHB4ICNNAcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
3471
+ return { layers: _chunkHB4ICNNAcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
3472
3472
  }
3473
3473
  function ungroupLayer(layers, id) {
3474
3474
  const loc = requireLayer(layers, id);
3475
3475
  if (loc.layer.type !== "group") fail2(`Layer "${id}" is not a group.`);
3476
3476
  requireUnlocked(loc.layer, "all", "ungroup it");
3477
3477
  const group = loc.layer;
3478
- let out = _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => null);
3478
+ let out = _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => null);
3479
3479
  group.children.forEach((c, i) => {
3480
- out = _chunkB46UQUDCcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _63 => _63.parent, 'optionalAccess', _64 => _64.id]), () => ( null)), loc.index + i);
3480
+ out = _chunkHB4ICNNAcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _63 => _63.parent, 'optionalAccess', _64 => _64.id]), () => ( null)), loc.index + i);
3481
3481
  });
3482
3482
  return { layers: out, ids: group.children.map((c) => c.id) };
3483
3483
  }
@@ -3492,12 +3492,12 @@ function offsetLayer(layers, id, offset) {
3492
3492
  if (mask && mask.linked === false && !mask.source) {
3493
3493
  next.mask = { ...mask, surface: _chunk474IQG74cjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
3494
3494
  }
3495
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => followLayerMove(next, next.offset.x - layer.offset.x, next.offset.y - layer.offset.y));
3495
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => followLayerMove(next, next.offset.x - layer.offset.x, next.offset.y - layer.offset.y));
3496
3496
  }
3497
3497
  function setLayerMask(layers, id, mask) {
3498
3498
  const loc = requireLayer(layers, id);
3499
3499
  requireUnlocked(loc.layer, "all", "change its mask");
3500
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, (l) => {
3500
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, (l) => {
3501
3501
  const next = { ...l };
3502
3502
  if (mask) next.mask = mask;
3503
3503
  else delete next.mask;
@@ -3536,7 +3536,7 @@ function requirePixelLayer(layers, id) {
3536
3536
  function addLayerFilter(layers, id, filter) {
3537
3537
  const layer = requirePixelLayer(layers, id);
3538
3538
  if (_optionalChain([layer, 'access', _65 => _65.filters, 'optionalAccess', _66 => _66.some, 'call', _67 => _67((f) => f.kind === filter.kind)])) fail2(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
3539
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
3539
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
3540
3540
  }
3541
3541
  function updateLayerFilter(layers, id, filterId, changes) {
3542
3542
  const layer = requirePixelLayer(layers, id);
@@ -3547,7 +3547,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
3547
3547
  const merged2 = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
3548
3548
  const filters = [...layer.filters];
3549
3549
  filters[i] = merged2;
3550
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
3550
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
3551
3551
  }
3552
3552
  function removeLayerFilter(layers, id, filterId) {
3553
3553
  const layer = requirePixelLayer(layers, id);
@@ -3556,7 +3556,7 @@ function removeLayerFilter(layers, id, filterId) {
3556
3556
  const next = { ...layer };
3557
3557
  if (filters.length) next.filters = filters;
3558
3558
  else delete next.filters;
3559
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next);
3559
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next);
3560
3560
  }
3561
3561
  function requireEffectLayer(layers, id, action) {
3562
3562
  const layer = requireLayer(layers, id).layer;
@@ -3571,7 +3571,7 @@ function guard(fn) {
3571
3571
  try {
3572
3572
  return fn();
3573
3573
  } catch (e) {
3574
- if (e instanceof _chunkB46UQUDCcjs.LayerEffectError) fail2(e.message);
3574
+ if (e instanceof _chunkHB4ICNNAcjs.LayerEffectError) fail2(e.message);
3575
3575
  throw e;
3576
3576
  }
3577
3577
  }
@@ -3579,20 +3579,20 @@ function setLayerEffects(layers, id, effects) {
3579
3579
  const layer = requireEffectLayer(layers, id, "change its effects");
3580
3580
  const next = { ...layer };
3581
3581
  if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
3582
- guard(() => _chunkB46UQUDCcjs.validateLayerEffects.call(void 0, effects));
3582
+ guard(() => _chunkHB4ICNNAcjs.validateLayerEffects.call(void 0, effects));
3583
3583
  next.effects = effects;
3584
3584
  } else delete next.effects;
3585
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next);
3585
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next);
3586
3586
  }
3587
3587
  function addLayerEffect(layers, id, kind, params = {}, index) {
3588
- if (!_chunkB46UQUDCcjs.isLayerEffectKind.call(void 0, kind)) fail2(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkB46UQUDCcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
3588
+ if (!_chunkHB4ICNNAcjs.isLayerEffectKind.call(void 0, kind)) fail2(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkHB4ICNNAcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
3589
3589
  const layer = requireEffectLayer(layers, id, "add effects");
3590
3590
  const current = layerEffectsOf(layer);
3591
3591
  const ids = new Set(current.items.map((e) => e.id));
3592
- let effectId = _chunkB46UQUDCcjs.newEffectId.call(void 0, );
3593
- while (ids.has(effectId)) effectId = _chunkB46UQUDCcjs.newEffectId.call(void 0, );
3592
+ let effectId = _chunkHB4ICNNAcjs.newEffectId.call(void 0, );
3593
+ while (ids.has(effectId)) effectId = _chunkHB4ICNNAcjs.newEffectId.call(void 0, );
3594
3594
  const { id: _ignored, kind: _kind, ...rest } = params;
3595
- const effect = guard(() => _chunkB46UQUDCcjs.mergeLayerEffect.call(void 0, _chunkB46UQUDCcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
3595
+ const effect = guard(() => _chunkHB4ICNNAcjs.mergeLayerEffect.call(void 0, _chunkHB4ICNNAcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
3596
3596
  const items = [...current.items];
3597
3597
  const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
3598
3598
  items.splice(at, 0, effect);
@@ -3609,7 +3609,7 @@ function updateLayerEffect(layers, id, effectId, changes) {
3609
3609
  const i = requireEffect(layer, effectId);
3610
3610
  const current = layer.effects;
3611
3611
  const items = [...current.items];
3612
- items[i] = guard(() => _chunkB46UQUDCcjs.mergeLayerEffect.call(void 0, items[i], changes));
3612
+ items[i] = guard(() => _chunkHB4ICNNAcjs.mergeLayerEffect.call(void 0, items[i], changes));
3613
3613
  return setLayerEffects(layers, id, { ...current, items });
3614
3614
  }
3615
3615
  function removeLayerEffect(layers, id, effectId) {
@@ -3854,7 +3854,7 @@ var PHOTO_PROFILE = {
3854
3854
  return v;
3855
3855
  }
3856
3856
  };
3857
- var LayerCompositor = class extends _chunkB46UQUDCcjs.RasterCompositor {
3857
+ var LayerCompositor = class extends _chunkHB4ICNNAcjs.RasterCompositor {
3858
3858
  constructor(options = {}) {
3859
3859
  super(PHOTO_PROFILE, options);
3860
3860
  }
@@ -3870,7 +3870,7 @@ var LayerCompositor = class extends _chunkB46UQUDCcjs.RasterCompositor {
3870
3870
  }
3871
3871
  };
3872
3872
  function compositeDeep(layers, rect, sources, depth) {
3873
- const deep = new (0, _chunkB46UQUDCcjs.DeepCompositor)(new LayerCompositor(), PHOTO_PROFILE, {
3873
+ const deep = new (0, _chunkHB4ICNNAcjs.DeepCompositor)(new LayerCompositor(), PHOTO_PROFILE, {
3874
3874
  applyFilterRunDeep: (run, acc, _r, masks) => applyAdjustmentLayersFloat(acc, run.map(adjustmentNodeAsLayer), masks),
3875
3875
  pixelFiltersDeep: (l) => {
3876
3876
  if (l.type !== "pixel" || hasEdgeUnmix(l.edge)) return null;
@@ -3886,7 +3886,7 @@ function compositeDeep(layers, rect, sources, depth) {
3886
3886
  var fail3 = (message) => {
3887
3887
  throw new LayerOperationError(message);
3888
3888
  };
3889
- var TEXT_RENDER_MARGIN = _chunkB46UQUDCcjs.MAX_EFFECT_REACH;
3889
+ var TEXT_RENDER_MARGIN = _chunkHB4ICNNAcjs.MAX_EFFECT_REACH;
3890
3890
  function textMatrix(layer) {
3891
3891
  return _nullishCoalesce(layer.transform, () => ( _chunkBQE3Y6ZOcjs.IDENTITY_MATRIX));
3892
3892
  }
@@ -4182,7 +4182,7 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
4182
4182
  if (!next.runs.length) next.runs = [{ length: 0, style: _chunkBQE3Y6ZOcjs.styleAt.call(void 0, current.runs, 0, _chunkBQE3Y6ZOcjs.DEFAULT_TEXT_STYLE) }];
4183
4183
  if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkBQE3Y6ZOcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
4184
4184
  const rendered = rerenderText(next, env);
4185
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
4185
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
4186
4186
  }
4187
4187
  function replaceTextRange(layer, start, end, insert) {
4188
4188
  const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
@@ -4699,7 +4699,7 @@ function geometryHomography(geometry) {
4699
4699
  var fail4 = (message) => {
4700
4700
  throw new LayerOperationError(message);
4701
4701
  };
4702
- var SMART_RENDER_MARGIN = _chunkB46UQUDCcjs.MAX_EFFECT_REACH;
4702
+ var SMART_RENDER_MARGIN = _chunkHB4ICNNAcjs.MAX_EFFECT_REACH;
4703
4703
  var incompleteSurfaces = /* @__PURE__ */ new WeakSet();
4704
4704
  var isSmartSurfaceIncomplete = (surface) => incompleteSurfaces.has(surface);
4705
4705
  var surfaceIds = /* @__PURE__ */ new WeakMap();
@@ -4815,7 +4815,7 @@ function placeContents(layer, canvas, options = {}) {
4815
4815
  k = step;
4816
4816
  let r = _optionalChain([options, 'access', _101 => _101.reduced, 'optionalAccess', _102 => _102.get, 'call', _103 => _103(k)]);
4817
4817
  if (!r) {
4818
- r = _chunkB46UQUDCcjs.reduceSurface.call(void 0, src, k);
4818
+ r = _chunkHB4ICNNAcjs.reduceSurface.call(void 0, src, k);
4819
4819
  _optionalChain([options, 'access', _104 => _104.reduced, 'optionalAccess', _105 => _105.set, 'call', _106 => _106(k, r)]);
4820
4820
  }
4821
4821
  source = r;
@@ -4825,15 +4825,15 @@ function placeContents(layer, canvas, options = {}) {
4825
4825
  if (hasWarp(g)) {
4826
4826
  const f = transformMap(g);
4827
4827
  if (!f) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
4828
- 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 });
4828
+ out = _chunkHB4ICNNAcjs.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 });
4829
4829
  } else {
4830
4830
  const h = transformHomography(g);
4831
4831
  if (!h) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
4832
4832
  const hk = _chunkQT26RHKKcjs.multiplyHomographies.call(void 0, [k, 0, 0, 0, k, 0, 0, 0, 1], h);
4833
- out = _chunkB46UQUDCcjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
4833
+ out = _chunkHB4ICNNAcjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
4834
4834
  }
4835
4835
  } catch (e) {
4836
- if (e instanceof _chunkB46UQUDCcjs.TransformTooLargeError) fail4(e.message);
4836
+ if (e instanceof _chunkHB4ICNNAcjs.TransformTooLargeError) fail4(e.message);
4837
4837
  throw e;
4838
4838
  }
4839
4839
  }
@@ -4910,7 +4910,7 @@ function applySmartFilters(placed, stack, canvas) {
4910
4910
  if (f.opacity >= 1) acc = out2;
4911
4911
  else lerpInto(acc, out2, f.opacity, null);
4912
4912
  } else {
4913
- _chunkB46UQUDCcjs.blendTile.call(void 0, acc, out2, f.blend, f.opacity, null);
4913
+ _chunkHB4ICNNAcjs.blendTile.call(void 0, acc, out2, f.blend, f.opacity, null);
4914
4914
  }
4915
4915
  }
4916
4916
  entry = { key, base, filtered: acc };
@@ -4971,7 +4971,7 @@ function normalizePlacement(raw, contents) {
4971
4971
  out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
4972
4972
  }
4973
4973
  if (raw.interpolation !== void 0) {
4974
- if (!_chunkB46UQUDCcjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
4974
+ if (!_chunkHB4ICNNAcjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
4975
4975
  if (raw.interpolation !== "bicubic") out.interpolation = raw.interpolation;
4976
4976
  }
4977
4977
  const g = { box: { x: 0, y: 0, width: contents.width, height: contents.height }, corners: out.corners, warp: _nullishCoalesce(out.warp, () => ( null)) };
@@ -4991,7 +4991,7 @@ function followMask(mask, before, after) {
4991
4991
  const inv = _chunkQT26RHKKcjs.invertHomography.call(void 0, h0);
4992
4992
  if (!inv) return mask;
4993
4993
  const delta = _chunkQT26RHKKcjs.multiplyHomographies.call(void 0, inv, h1);
4994
- const surface = _chunkB46UQUDCcjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
4994
+ const surface = _chunkHB4ICNNAcjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
4995
4995
  return { ...mask, surface };
4996
4996
  }
4997
4997
  function setSmartPlacement(layers, id, placement, canvas) {
@@ -5012,7 +5012,7 @@ function setSmartPlacement(layers, id, placement, canvas) {
5012
5012
  next.smartFilters = { ...next.smartFilters, mask: m };
5013
5013
  }
5014
5014
  next = rerender(next, canvas, "be transformed");
5015
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
5015
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
5016
5016
  }
5017
5017
  function offsetSmartObject(layers, id, dx, dy, canvas) {
5018
5018
  const layer = requireSmartObject(layers, id);
@@ -5035,7 +5035,7 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
5035
5035
  } else {
5036
5036
  next = rerender(next, canvas, "move");
5037
5037
  }
5038
- return _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next);
5038
+ return _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next);
5039
5039
  }
5040
5040
  function translateLayer(layer, dx, dy) {
5041
5041
  if (!dx && !dy) return layer;
@@ -5103,7 +5103,7 @@ function layerExtent(layer, surfaceOf, canvas) {
5103
5103
  } else {
5104
5104
  b = full;
5105
5105
  }
5106
- const m = _chunkB46UQUDCcjs.effectsMargin.call(void 0, layer.effects);
5106
+ const m = _chunkHB4ICNNAcjs.effectsMargin.call(void 0, layer.effects);
5107
5107
  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) };
5108
5108
  return b;
5109
5109
  }
@@ -5172,7 +5172,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5172
5172
  delete resolved2.source;
5173
5173
  layer = resolved2;
5174
5174
  }
5175
- 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.`);
5175
+ if (_chunkHB4ICNNAcjs.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.`);
5176
5176
  return translateLayer(layer, -b.x, -b.y);
5177
5177
  });
5178
5178
  if (nested[0].clipped) {
@@ -5199,8 +5199,8 @@ function convertToSmartObject(layers, ids, canvas, options) {
5199
5199
  smart = { ...smart, surface: renderSmartObject(smart, canvas) };
5200
5200
  const below = ordered.filter((l) => l.index < top.index).length;
5201
5201
  let out = layers;
5202
- for (const l of ordered) out = _chunkB46UQUDCcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
5203
- return { layers: _chunkB46UQUDCcjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
5202
+ for (const l of ordered) out = _chunkHB4ICNNAcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
5203
+ return { layers: _chunkHB4ICNNAcjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
5204
5204
  }
5205
5205
  function rasterizeSmartObject(layers, id) {
5206
5206
  const layer = requireSmartObject(layers, id);
@@ -5220,7 +5220,7 @@ function rasterizeSmartObject(layers, id) {
5220
5220
  if (layer.locks) out.locks = layer.locks;
5221
5221
  if (layer.effects) out.effects = layer.effects;
5222
5222
  if (layer.fillOpacity !== void 0) out.fillOpacity = layer.fillOpacity;
5223
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
5223
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
5224
5224
  }
5225
5225
  function copySmartObject(layers, id, linked, name) {
5226
5226
  const loc = requireLayer(layers, id);
@@ -5230,19 +5230,19 @@ function copySmartObject(layers, id, linked, name) {
5230
5230
  delete copy.psd;
5231
5231
  if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
5232
5232
  if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
5233
- return { layers: _chunkB46UQUDCcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _140 => _140.parent, 'optionalAccess', _141 => _141.id]), () => ( null)), loc.index + 1), layer: copy };
5233
+ return { layers: _chunkHB4ICNNAcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _140 => _140.parent, 'optionalAccess', _141 => _141.id]), () => ( null)), loc.index + 1), layer: copy };
5234
5234
  }
5235
5235
  function instancesOf(layers, contentsId) {
5236
- return _chunkB46UQUDCcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
5236
+ return _chunkHB4ICNNAcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
5237
5237
  }
5238
5238
  function replaceContents(layers, contentsId, contents, canvas) {
5239
5239
  const ids = instancesOf(layers, contentsId);
5240
5240
  if (!ids.length) fail4(`No smart object uses contents "${contentsId}".`);
5241
- for (const id of ids) requireUnlocked(_chunkB46UQUDCcjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
5241
+ for (const id of ids) requireUnlocked(_chunkHB4ICNNAcjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
5242
5242
  const next = { ...contents, id: contentsId };
5243
5243
  let out = layers;
5244
5244
  for (const id of ids) {
5245
- out = _chunkB46UQUDCcjs.mapLayer.call(void 0, out, id, (l) => {
5245
+ out = _chunkHB4ICNNAcjs.mapLayer.call(void 0, out, id, (l) => {
5246
5246
  const layer = l;
5247
5247
  return rerender({ ...layer, contents: next, placement: refitPlacement(layer, next) }, canvas, "take the new contents");
5248
5248
  });
@@ -5321,7 +5321,7 @@ function addSmartFilter(layers, id, filter, canvas, index) {
5321
5321
  const at = index === void 0 ? filters.length : Math.max(0, Math.min(filters.length, Math.floor(index)));
5322
5322
  filters.splice(at, 0, filter);
5323
5323
  const next = withStack(layer, { ...stack, filters }, canvas);
5324
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
5324
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
5325
5325
  }
5326
5326
  function updateSmartFilter(layers, id, filterId, changes, canvas) {
5327
5327
  const layer = editableSmart(layers, id);
@@ -5343,7 +5343,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
5343
5343
  const filters = [...layer.smartFilters.filters];
5344
5344
  filters[i] = merged2;
5345
5345
  const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
5346
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
5346
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
5347
5347
  }
5348
5348
  function removeSmartFilter(layers, id, filterId, canvas) {
5349
5349
  const layer = editableSmart(layers, id);
@@ -5351,7 +5351,7 @@ function removeSmartFilter(layers, id, filterId, canvas) {
5351
5351
  const stack = layer.smartFilters;
5352
5352
  const filters = stack.filters.filter((f) => f.id !== filterId);
5353
5353
  const next = withStack(layer, filters.length ? { ...stack, filters } : stack.enabled ? void 0 : { enabled: false, filters }, canvas);
5354
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5354
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5355
5355
  }
5356
5356
  function moveSmartFilter(layers, id, filterId, index, canvas) {
5357
5357
  const layer = editableSmart(layers, id);
@@ -5362,12 +5362,12 @@ function moveSmartFilter(layers, id, filterId, index, canvas) {
5362
5362
  const [f] = filters.splice(i, 1);
5363
5363
  filters.splice(index, 0, f);
5364
5364
  const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
5365
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5365
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5366
5366
  }
5367
5367
  function setSmartFiltersEnabled(layers, id, enabled, canvas) {
5368
5368
  const layer = editableSmart(layers, id);
5369
5369
  const next = withStack(layer, { ...stackOf(layer), enabled: Boolean(enabled) }, canvas);
5370
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5370
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5371
5371
  }
5372
5372
  function setSmartFilterMask(layers, id, mask, canvas) {
5373
5373
  const layer = editableSmart(layers, id);
@@ -5376,7 +5376,7 @@ function setSmartFilterMask(layers, id, mask, canvas) {
5376
5376
  if (mask) stack.mask = mask;
5377
5377
  else delete stack.mask;
5378
5378
  const next = withStack(layer, stack, canvas);
5379
- return { layers: _chunkB46UQUDCcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5379
+ return { layers: _chunkHB4ICNNAcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5380
5380
  }
5381
5381
  function withFilterMaskSurface(layer, surface, canvas) {
5382
5382
  const stack = stackOf(layer);
@@ -5500,7 +5500,7 @@ function deserializeEffects(raw) {
5500
5500
  psd = void 0;
5501
5501
  }
5502
5502
  }
5503
- return _chunkB46UQUDCcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
5503
+ return _chunkHB4ICNNAcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
5504
5504
  }
5505
5505
  function serializeVectorMask(vm) {
5506
5506
  const out = { components: JSON.parse(JSON.stringify(vm.components)) };
@@ -6133,7 +6133,7 @@ function readSmartObject(r, base, ctx) {
6133
6133
  try {
6134
6134
  const raw = { corners: p.corners };
6135
6135
  if (p.warp && _chunkBQE3Y6ZOcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
6136
- if (_chunkB46UQUDCcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
6136
+ if (_chunkHB4ICNNAcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
6137
6137
  placement = normalizePlacement(raw, contents);
6138
6138
  } catch (e) {
6139
6139
  ctx.problems.push(`${what}: its placement is invalid (${e instanceof Error ? e.message : String(e)}); it was placed at the top left`);
@@ -10103,7 +10103,7 @@ function recordEffects(ctx, rec, name, notes, group) {
10103
10103
  }
10104
10104
  for (const e of parsed.effects.items) {
10105
10105
  for (const id of patternIds(e)) {
10106
- if (ctx.patterns.has(id) || _chunkB46UQUDCcjs.builtinPattern.call(void 0, id)) continue;
10106
+ if (ctx.patterns.has(id) || _chunkHB4ICNNAcjs.builtinPattern.call(void 0, id)) continue;
10107
10107
  ctx.warn.add("A pattern effect uses a pattern the file does not contain, and paints nothing", name);
10108
10108
  notes.push(`pattern "${id}" is not in the file`);
10109
10109
  }
@@ -10681,34 +10681,34 @@ function blendOf(d, key, fallback, notes) {
10681
10681
  function colorOf(d, fallback = "#000000") {
10682
10682
  if (!d) return fallback;
10683
10683
  const g = (k) => descNumber(d, k);
10684
- if (g("redFloat") !== void 0) return _chunkB46UQUDCcjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
10684
+ if (g("redFloat") !== void 0) return _chunkHB4ICNNAcjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
10685
10685
  switch (d.classId) {
10686
10686
  case "HSBC": {
10687
10687
  const rgb = decodePsdColor(1, [(_nullishCoalesce(g("H "), () => ( 0))) / 360 * 65535, (_nullishCoalesce(g("Strt"), () => ( 0))) / 100 * 65535, (_nullishCoalesce(g("Brgh"), () => ( 0))) / 100 * 65535]);
10688
- return rgb ? _chunkB46UQUDCcjs.effectColorHex.call(void 0, rgb) : fallback;
10688
+ return rgb ? _chunkHB4ICNNAcjs.effectColorHex.call(void 0, rgb) : fallback;
10689
10689
  }
10690
10690
  case "CMYC": {
10691
10691
  const inv = (k) => (1 - (_nullishCoalesce(g(k), () => ( 0))) / 100) * 65535;
10692
10692
  const rgb = decodePsdColor(2, [inv("Cyn "), inv("Mgnt"), inv("Ylw "), inv("Blck")]);
10693
- return rgb ? _chunkB46UQUDCcjs.effectColorHex.call(void 0, rgb) : fallback;
10693
+ return rgb ? _chunkHB4ICNNAcjs.effectColorHex.call(void 0, rgb) : fallback;
10694
10694
  }
10695
10695
  case "LbCl": {
10696
10696
  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]);
10697
- return rgb ? _chunkB46UQUDCcjs.effectColorHex.call(void 0, rgb) : fallback;
10697
+ return rgb ? _chunkHB4ICNNAcjs.effectColorHex.call(void 0, rgb) : fallback;
10698
10698
  }
10699
10699
  case "Grsc": {
10700
10700
  const v = 1 - (_nullishCoalesce(g("Gry "), () => ( 0))) / 100;
10701
- return _chunkB46UQUDCcjs.effectColorHex.call(void 0, [v, v, v]);
10701
+ return _chunkHB4ICNNAcjs.effectColorHex.call(void 0, [v, v, v]);
10702
10702
  }
10703
10703
  }
10704
10704
  const r = g("Rd ");
10705
10705
  const gr = g("Grn ");
10706
10706
  const b = g("Bl ");
10707
10707
  if (r === void 0 || gr === void 0 || b === void 0) return fallback;
10708
- return _chunkB46UQUDCcjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
10708
+ return _chunkHB4ICNNAcjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
10709
10709
  }
10710
10710
  function colorDesc(hex) {
10711
- const [r, g, b] = _nullishCoalesce(_chunkB46UQUDCcjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
10711
+ const [r, g, b] = _nullishCoalesce(_chunkHB4ICNNAcjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
10712
10712
  return descriptor("RGBC", [
10713
10713
  ["Rd ", dbl3(r * 255)],
10714
10714
  ["Grn ", dbl3(g * 255)],
@@ -10791,9 +10791,9 @@ function gradientOf(d, notes) {
10791
10791
  raw.forEach((s, i) => {
10792
10792
  if (i > 0 && Math.abs(s.mid - 0.5) > 1e-3) {
10793
10793
  const a = raw[i - 1];
10794
- const ca = _chunkB46UQUDCcjs.parseEffectColor.call(void 0, a.color);
10795
- const cb = _chunkB46UQUDCcjs.parseEffectColor.call(void 0, s.color);
10796
- 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)) });
10794
+ const ca = _chunkHB4ICNNAcjs.parseEffectColor.call(void 0, a.color);
10795
+ const cb = _chunkHB4ICNNAcjs.parseEffectColor.call(void 0, s.color);
10796
+ stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkHB4ICNNAcjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
10797
10797
  notes.add("gradient midpoints are drawn as straight segments");
10798
10798
  }
10799
10799
  stops.push({ position: s.position, color: s.color });
@@ -10905,8 +10905,8 @@ var KINDS = [
10905
10905
  ["FrFX", "frameFXMulti", "stroke"]
10906
10906
  ];
10907
10907
  function common(d, kind, notes) {
10908
- const def = _chunkB46UQUDCcjs.defaultLayerEffect.call(void 0, kind, "x");
10909
- 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) };
10908
+ const def = _chunkHB4ICNNAcjs.defaultLayerEffect.call(void 0, kind, "x");
10909
+ return { id: _chunkHB4ICNNAcjs.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) };
10910
10910
  }
10911
10911
  function readOne(kind, d, notes) {
10912
10912
  const size = (key, fallback) => clamp3(num3(d, key, fallback), 0, 250);
@@ -10949,7 +10949,7 @@ function readOne(kind, d, notes) {
10949
10949
  case "bevel-emboss": {
10950
10950
  const styles = { OtrB: "outer-bevel", InrB: "inner-bevel", Embs: "emboss", PlEb: "pillow-emboss", strokeEmboss: "stroke-emboss" };
10951
10951
  const out = {
10952
- id: _chunkB46UQUDCcjs.newEffectId.call(void 0, ),
10952
+ id: _chunkHB4ICNNAcjs.newEffectId.call(void 0, ),
10953
10953
  enabled: descBool(d, "enab") !== false,
10954
10954
  kind,
10955
10955
  style: _nullishCoalesce(styles[_nullishCoalesce(enumOf3(d, "bvlS"), () => ( ""))], () => ( "inner-bevel")),
@@ -11160,10 +11160,10 @@ function writeLfx2(effects) {
11160
11160
  ["Scl ", unit3("#Prc", 100)],
11161
11161
  ["masterFXSwitch", boolV3(effects.enabled)]
11162
11162
  ];
11163
- const scale = _chunkB46UQUDCcjs.effectsScale.call(void 0, effects);
11163
+ const scale = _chunkHB4ICNNAcjs.effectsScale.call(void 0, effects);
11164
11164
  let dropped = 0;
11165
11165
  for (const [single, multi, kind] of KINDS) {
11166
- const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkB46UQUDCcjs.scaleLayerEffect.call(void 0, e, scale)));
11166
+ const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkHB4ICNNAcjs.scaleLayerEffect.call(void 0, e, scale)));
11167
11167
  if (!of.length) continue;
11168
11168
  if (of.length === 1) items.push([single, obj3(of[0])]);
11169
11169
  else if (multi) items.push([multi, { type: "VlLs", items: of.map(obj3) }]);
@@ -11195,7 +11195,7 @@ function parseLrfx(data) {
11195
11195
  const colorAt = (rd) => {
11196
11196
  rd.u16();
11197
11197
  const c = [rd.u16(), rd.u16(), rd.u16(), rd.u16()];
11198
- return _chunkB46UQUDCcjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
11198
+ return _chunkHB4ICNNAcjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
11199
11199
  };
11200
11200
  const blendAt = (rd) => {
11201
11201
  rd.skip(4);
@@ -11214,7 +11214,7 @@ function parseLrfx(data) {
11214
11214
  const enabled = b.u8() !== 0;
11215
11215
  const useGlobalLight = b.u8() !== 0;
11216
11216
  const opacity = b.u8() / 255;
11217
- 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 };
11217
+ const base = { id: _chunkHB4ICNNAcjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
11218
11218
  items.push(key === "dsdw" ? { ...base, kind: "drop-shadow", spread: 0, knocksOut: true } : { ...base, kind: "inner-shadow", choke: 0 });
11219
11219
  } else if (key === "oglw" || key === "iglw") {
11220
11220
  b.u32();
@@ -11224,7 +11224,7 @@ function parseLrfx(data) {
11224
11224
  const blend = blendAt(b);
11225
11225
  const enabled = b.u8() !== 0;
11226
11226
  const opacity = b.u8() / 255;
11227
- 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 };
11227
+ const base = { id: _chunkHB4ICNNAcjs.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 };
11228
11228
  items.push(key === "oglw" ? { ...base, kind: "outer-glow", spread: 0 } : { ...base, kind: "inner-glow", choke: 0, source: "edge" });
11229
11229
  } else if (key === "sofi") {
11230
11230
  b.u32();
@@ -11232,7 +11232,7 @@ function parseLrfx(data) {
11232
11232
  const color = colorAt(b);
11233
11233
  const opacity = b.u8() / 255;
11234
11234
  const enabled = b.u8() !== 0;
11235
- items.push({ id: _chunkB46UQUDCcjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
11235
+ items.push({ id: _chunkHB4ICNNAcjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
11236
11236
  } else if (key === "bevl") notes.add("legacy bevels are not read");
11237
11237
  }
11238
11238
  return { effects: { enabled: true, items }, notes: [...notes] };
@@ -11425,7 +11425,7 @@ function exportPsd(input) {
11425
11425
  const key = layer.type === "group" ? "lfxs" : "lfx2";
11426
11426
  if (fx.psd) {
11427
11427
  const original = parseLfx2(fx.psd.data);
11428
- 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) };
11428
+ if (original ? _chunkHB4ICNNAcjs.effectsFingerprint.call(void 0, original.effects) === _chunkHB4ICNNAcjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
11429
11429
  }
11430
11430
  if (!fx.items.length && fx.enabled && (_nullishCoalesce(fx.scale, () => ( 1))) === 1) return null;
11431
11431
  const { data, dropped } = writeLfx2(fx);
@@ -11677,7 +11677,7 @@ function exportPsd(input) {
11677
11677
  const byId = new Map((_nullishCoalesce(input.patterns, () => ( []))).map((p) => [p.id, p]));
11678
11678
  const embed = [];
11679
11679
  for (const id of patternIds2) {
11680
- const p = _nullishCoalesce(byId.get(id), () => ( _chunkB46UQUDCcjs.builtinPattern.call(void 0, id)));
11680
+ const p = _nullishCoalesce(byId.get(id), () => ( _chunkHB4ICNNAcjs.builtinPattern.call(void 0, id)));
11681
11681
  if (p) embed.push(p);
11682
11682
  else note(`Pattern "${id}" is not in the document and was not embedded`, id);
11683
11683
  }