@pixerate/editor 0.198.0 → 0.200.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.
@@ -3049,8 +3049,9 @@ var GridGraph = class {
3049
3049
  var WORK_SIZE = 512;
3050
3050
  var workCache = /* @__PURE__ */ new WeakMap();
3051
3051
  function workImage(pixels, maxSide = WORK_SIZE) {
3052
- const cached = workCache.get(pixels.data);
3053
- if (cached && cached.maxSide === maxSide && cached.work.sourceWidth === pixels.width && cached.work.sourceHeight === pixels.height) return cached.work;
3052
+ const sizes = workCache.get(pixels.data);
3053
+ const cached = _optionalChain([sizes, 'optionalAccess', _64 => _64.get, 'call', _65 => _65(maxSide)]);
3054
+ if (cached && cached.sourceWidth === pixels.width && cached.sourceHeight === pixels.height) return cached;
3054
3055
  const { width: W, height: H, data } = pixels;
3055
3056
  const scale = Math.min(1, maxSide / Math.max(W, H));
3056
3057
  const w = Math.max(1, Math.round(W * scale));
@@ -3079,7 +3080,8 @@ function workImage(pixels, maxSide = WORK_SIZE) {
3079
3080
  rgb[i * 3 + 2] = sum[i * 3 + 2] / c;
3080
3081
  }
3081
3082
  const work = { sourceWidth: W, sourceHeight: H, width: w, height: h, scale: w / W, rgb };
3082
- workCache.set(pixels.data, { maxSide, work });
3083
+ if (sizes) sizes.set(maxSide, work);
3084
+ else workCache.set(pixels.data, /* @__PURE__ */ new Map([[maxSide, work]]));
3083
3085
  return work;
3084
3086
  }
3085
3087
  var GAMMA = 50;
@@ -3300,7 +3302,7 @@ function segmentStroke(work, stroke, grown, start) {
3300
3302
  const bin = binOf(rgb, g);
3301
3303
  bgHist[bin]++;
3302
3304
  bgN++;
3303
- if (stroke.mask[g] || _optionalChain([grown, 'optionalAccess', _64 => _64[g]])) {
3305
+ if (stroke.mask[g] || _optionalChain([grown, 'optionalAccess', _66 => _66[g]])) {
3304
3306
  fgHist[bin]++;
3305
3307
  fgN++;
3306
3308
  }
@@ -3382,7 +3384,7 @@ function quickSelectStroke(pixels, stroke, options = {}) {
3382
3384
  const roi = { x: rx, y: ry, width: Math.min(w, Math.ceil(x1 + margin)) - rx, height: Math.min(h, Math.ceil(y1 + margin)) - ry };
3383
3385
  let grown = null;
3384
3386
  const sel = options.grow ? options.selection : null;
3385
- if (_optionalChain([sel, 'optionalAccess', _65 => _65.bounds])) {
3387
+ if (_optionalChain([sel, 'optionalAccess', _67 => _67.bounds])) {
3386
3388
  grown = new Uint8Array(w * h);
3387
3389
  const b = sel.bounds;
3388
3390
  for (let y = Math.max(0, Math.floor(b.y * scale)); y < Math.min(h, Math.ceil((b.y + b.height) * scale)); y++) {
@@ -3554,7 +3556,7 @@ function grabCutLabels(work, setup, iterations) {
3554
3556
  const graph = new GridGraph(rw, rh);
3555
3557
  for (let p = 0; p < n; p++) {
3556
3558
  if (hardBg[p]) graph.addTerminal(p, 0, HARD);
3557
- else if (_optionalChain([hardFg, 'optionalAccess', _66 => _66[p]])) graph.addTerminal(p, HARD, 0);
3559
+ else if (_optionalChain([hardFg, 'optionalAccess', _68 => _68[p]])) graph.addTerminal(p, HARD, 0);
3558
3560
  else {
3559
3561
  const i = global[p] * 3;
3560
3562
  graph.addTerminal(p, Math.round(bg.cost(rgb[i], rgb[i + 1], rgb[i + 2]) * UNITS), Math.round(fg.cost(rgb[i], rgb[i + 1], rgb[i + 2]) * UNITS));
@@ -3672,6 +3674,545 @@ function selectObjectIn(pixels, target, options = {}) {
3672
3674
  }
3673
3675
  }
3674
3676
 
3677
+ // src/image-editor/selection/segment/subject.ts
3678
+ function toLab(r, g, b) {
3679
+ const lin = (v) => {
3680
+ v /= 255;
3681
+ return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
3682
+ };
3683
+ const R = lin(r);
3684
+ const G = lin(g);
3685
+ const B = lin(b);
3686
+ const f = (t) => t > 8856e-6 ? Math.cbrt(t) : 7.787 * t + 16 / 116;
3687
+ const x = f((0.4124 * R + 0.3576 * G + 0.1805 * B) / 0.95047);
3688
+ const y = f(0.2126 * R + 0.7152 * G + 0.0722 * B);
3689
+ const z = f((0.0193 * R + 0.1192 * G + 0.9505 * B) / 1.08883);
3690
+ return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
3691
+ }
3692
+ function slicSuperpixels(work, target = 400, compactness = 10, rounds = 5) {
3693
+ const { width: w, height: h, rgb } = work;
3694
+ const n = w * h;
3695
+ const lab = new Float32Array(n * 3);
3696
+ for (let i = 0; i < n; i++) lab.set(toLab(rgb[i * 3], rgb[i * 3 + 1], rgb[i * 3 + 2]), i * 3);
3697
+ const S = Math.max(2, Math.round(Math.sqrt(n / target)));
3698
+ const seeds = [];
3699
+ for (let y = Math.floor(S / 2); y < h; y += S) {
3700
+ for (let x = Math.floor(S / 2); x < w; x += S) {
3701
+ const i = y * w + x;
3702
+ seeds.push([lab[i * 3], lab[i * 3 + 1], lab[i * 3 + 2], x, y]);
3703
+ }
3704
+ }
3705
+ const k = seeds.length;
3706
+ const label = new Int32Array(n).fill(-1);
3707
+ const best = new Float64Array(n);
3708
+ const m2 = (compactness / S) ** 2;
3709
+ for (let round6 = 0; round6 < rounds; round6++) {
3710
+ best.fill(Infinity);
3711
+ for (let c = 0; c < k; c++) {
3712
+ const [L, A, B, cx, cy] = seeds[c];
3713
+ const x0 = Math.max(0, Math.floor(cx - S));
3714
+ const x1 = Math.min(w - 1, Math.ceil(cx + S));
3715
+ const y0 = Math.max(0, Math.floor(cy - S));
3716
+ const y1 = Math.min(h - 1, Math.ceil(cy + S));
3717
+ for (let y = y0; y <= y1; y++) {
3718
+ for (let x = x0; x <= x1; x++) {
3719
+ const i = y * w + x;
3720
+ const d = (lab[i * 3] - L) ** 2 + (lab[i * 3 + 1] - A) ** 2 + (lab[i * 3 + 2] - B) ** 2 + m2 * ((x - cx) ** 2 + (y - cy) ** 2);
3721
+ if (d < best[i]) {
3722
+ best[i] = d;
3723
+ label[i] = c;
3724
+ }
3725
+ }
3726
+ }
3727
+ }
3728
+ const sum = new Float64Array(k * 6);
3729
+ for (let i = 0; i < n; i++) {
3730
+ const c = label[i];
3731
+ sum[c * 6] += lab[i * 3];
3732
+ sum[c * 6 + 1] += lab[i * 3 + 1];
3733
+ sum[c * 6 + 2] += lab[i * 3 + 2];
3734
+ sum[c * 6 + 3] += i % w;
3735
+ sum[c * 6 + 4] += Math.floor(i / w);
3736
+ sum[c * 6 + 5]++;
3737
+ }
3738
+ for (let c = 0; c < k; c++) {
3739
+ const s = sum[c * 6 + 5];
3740
+ if (s) seeds[c] = [sum[c * 6] / s, sum[c * 6 + 1] / s, sum[c * 6 + 2] / s, sum[c * 6 + 3] / s, sum[c * 6 + 4] / s];
3741
+ }
3742
+ }
3743
+ const remap = new Int32Array(k).fill(-1);
3744
+ let count = 0;
3745
+ for (let i = 0; i < n; i++) if (remap[label[i]] < 0) remap[label[i]] = count++;
3746
+ const meanLab = new Float64Array(count * 3);
3747
+ const centre = new Float64Array(count * 2);
3748
+ const size = new Int32Array(count);
3749
+ for (let i = 0; i < n; i++) {
3750
+ const c = label[i] = remap[label[i]];
3751
+ meanLab[c * 3] += lab[i * 3];
3752
+ meanLab[c * 3 + 1] += lab[i * 3 + 1];
3753
+ meanLab[c * 3 + 2] += lab[i * 3 + 2];
3754
+ centre[c * 2] += i % w;
3755
+ centre[c * 2 + 1] += Math.floor(i / w);
3756
+ size[c]++;
3757
+ }
3758
+ for (let c = 0; c < count; c++) {
3759
+ for (let j = 0; j < 3; j++) meanLab[c * 3 + j] /= size[c];
3760
+ centre[c * 2] /= size[c];
3761
+ centre[c * 2 + 1] /= size[c];
3762
+ }
3763
+ return { label, count, lab: meanLab, centre, size };
3764
+ }
3765
+ function superpixelSaliency(sp, width, height) {
3766
+ const { count, lab, centre, size, label } = sp;
3767
+ const dist = (a, b) => Math.hypot(lab[a * 3] - lab[b * 3], lab[a * 3 + 1] - lab[b * 3 + 1], lab[a * 3 + 2] - lab[b * 3 + 2]);
3768
+ const onBorder = new Uint8Array(count);
3769
+ for (let x = 0; x < width; x++) {
3770
+ onBorder[label[x]] = 1;
3771
+ onBorder[label[(height - 1) * width + x]] = 1;
3772
+ }
3773
+ for (let y = 0; y < height; y++) {
3774
+ onBorder[label[y * width]] = 1;
3775
+ onBorder[label[y * width + width - 1]] = 1;
3776
+ }
3777
+ const border = [];
3778
+ for (let c = 0; c < count; c++) if (onBorder[c]) border.push(c);
3779
+ const diag = Math.hypot(width, height);
3780
+ const unlikeBorder = new Float64Array(count);
3781
+ const contrast = new Float64Array(count);
3782
+ const centreBias = new Float64Array(count);
3783
+ for (let i = 0; i < count; i++) {
3784
+ const ds = border.map((j) => dist(i, j)).sort((a, b) => a - b);
3785
+ unlikeBorder[i] = ds.length ? ds[Math.floor(ds.length * 0.25)] : 0;
3786
+ let s = 0;
3787
+ let wsum = 0;
3788
+ for (let j = 0; j < count; j++) {
3789
+ if (j === i) continue;
3790
+ const dx = (centre[i * 2] - centre[j * 2]) / diag;
3791
+ const dy = (centre[i * 2 + 1] - centre[j * 2 + 1]) / diag;
3792
+ const wgt = size[j] * Math.exp(-(dx * dx + dy * dy) / (2 * 0.25 * 0.25));
3793
+ s += wgt * dist(i, j);
3794
+ wsum += wgt;
3795
+ }
3796
+ contrast[i] = wsum ? s / wsum : 0;
3797
+ const cx = centre[i * 2] / width - 0.5;
3798
+ const cy = centre[i * 2 + 1] / height - 0.5;
3799
+ centreBias[i] = 0.4 + 0.6 * Math.exp(-(cx * cx + cy * cy) / (2 * 0.3 * 0.3));
3800
+ }
3801
+ let farthest = 0;
3802
+ for (const v of unlikeBorder) farthest = Math.max(farthest, v);
3803
+ if (farthest < 6) return new Float64Array(count);
3804
+ const norm = (a) => {
3805
+ let max = 0;
3806
+ for (const v of a) max = Math.max(max, v);
3807
+ if (max > 0) for (let i = 0; i < a.length; i++) a[i] /= max;
3808
+ };
3809
+ norm(unlikeBorder);
3810
+ norm(contrast);
3811
+ const out = new Float64Array(count);
3812
+ for (let i = 0; i < count; i++) out[i] = unlikeBorder[i] * (0.3 + 0.7 * contrast[i]) * centreBias[i];
3813
+ norm(out);
3814
+ return out;
3815
+ }
3816
+ function otsuThreshold(values, weights) {
3817
+ const BINS2 = 64;
3818
+ const hist = new Float64Array(BINS2);
3819
+ let total = 0;
3820
+ for (let i = 0; i < values.length; i++) {
3821
+ hist[Math.min(BINS2 - 1, Math.floor(values[i] * BINS2))] += weights[i];
3822
+ total += weights[i];
3823
+ }
3824
+ let sumAll = 0;
3825
+ for (let b = 0; b < BINS2; b++) sumAll += b * hist[b];
3826
+ let wB = 0;
3827
+ let sumB = 0;
3828
+ let best = 0;
3829
+ let bestT = 0.5;
3830
+ for (let b = 0; b < BINS2 - 1; b++) {
3831
+ wB += hist[b];
3832
+ if (!wB) continue;
3833
+ const wF = total - wB;
3834
+ if (!wF) break;
3835
+ sumB += b * hist[b];
3836
+ const between = wB * wF * (sumB / wB - (sumAll - sumB) / wF) ** 2;
3837
+ if (between > best) {
3838
+ best = between;
3839
+ bestT = (b + 1) / BINS2;
3840
+ }
3841
+ }
3842
+ return bestT;
3843
+ }
3844
+ function findSubject(pixels, options = {}) {
3845
+ const work = workImage(pixels);
3846
+ const { width: w, height: h } = work;
3847
+ const sp = slicSuperpixels(work);
3848
+ const sal = superpixelSaliency(sp, w, h);
3849
+ const t = otsuThreshold(sal, sp.size);
3850
+ const n = w * h;
3851
+ const initial = new Uint8Array(n);
3852
+ const hardBg = new Uint8Array(n);
3853
+ const hardFg = new Uint8Array(n);
3854
+ const strong = t + 0.6 * (1 - t);
3855
+ for (let i = 0; i < n; i++) {
3856
+ const s = sal[sp.label[i]];
3857
+ if (s >= t) initial[i] = 1;
3858
+ if (s >= strong) hardFg[i] = 1;
3859
+ }
3860
+ for (let x = 0; x < w; x++) {
3861
+ for (const y of [0, h - 1]) if (sal[sp.label[y * w + x]] < t * 0.5) hardBg[y * w + x] = 1;
3862
+ }
3863
+ for (let y = 0; y < h; y++) {
3864
+ for (const x of [0, w - 1]) if (sal[sp.label[y * w + x]] < t * 0.5) hardBg[y * w + x] = 1;
3865
+ }
3866
+ const empty = (reason) => ({ selection: _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height), reason });
3867
+ let guessed = 0;
3868
+ for (let i = 0; i < n; i++) guessed += initial[i];
3869
+ if (!guessed || guessed > n * 0.95) return empty("Nothing stands out from the background.");
3870
+ const roi = { x: 0, y: 0, width: w, height: h };
3871
+ const label = grabCutLabels(work, { roi, initial, hardBg, hardFg }, 5);
3872
+ keepMainPieces(label, w, h, null);
3873
+ let kept = 0;
3874
+ for (let i = 0; i < n; i++) kept += label[i];
3875
+ if (kept < n * 2e-3) return empty("Nothing stands out from the background.");
3876
+ if (kept > n * 0.97) return empty("The whole image looks like one subject; select it with select_all instead.");
3877
+ return { selection: upscaleRegion(work, pixels, roi, label, _nullishCoalesce(options.enhanceEdge, () => ( false))) };
3878
+ }
3879
+
3880
+ // src/image-editor/selection/refine.ts
3881
+ var DEFAULT_REFINE_EDGE_PARAMS = {
3882
+ radius: 0,
3883
+ smartRadius: false,
3884
+ smooth: 0,
3885
+ feather: 0,
3886
+ contrast: 0,
3887
+ shiftEdge: 0
3888
+ };
3889
+ var GUIDED_FILTER_EPS = 1e-4;
3890
+ var fin = (v, d) => typeof v === "number" && Number.isFinite(v) ? v : d;
3891
+ function normalizeRefineEdgeParams(p = {}) {
3892
+ return {
3893
+ radius: Math.min(250, Math.max(0, fin(p.radius, 0))),
3894
+ smartRadius: p.smartRadius === true,
3895
+ smooth: Math.min(100, Math.max(0, fin(p.smooth, 0))),
3896
+ feather: Math.min(1e3, Math.max(0, fin(p.feather, 0))),
3897
+ contrast: Math.min(100, Math.max(0, fin(p.contrast, 0))),
3898
+ shiftEdge: Math.min(100, Math.max(-100, fin(p.shiftEdge, 0)))
3899
+ };
3900
+ }
3901
+ var gfRadius = (p) => Math.min(64, Math.max(1, Math.ceil(p.radius)));
3902
+ var smoothSigma = (p) => p.smooth / 100 * 4;
3903
+ var featherSigma = (p) => p.feather / 2;
3904
+ function shiftAmount(p) {
3905
+ const px2 = p.shiftEdge / 100 * Math.max(p.radius, 4);
3906
+ return Number.isFinite(px2) ? Math.min(64, Math.max(-64, px2)) : 0;
3907
+ }
3908
+ function refineEdgeHalo(params = {}) {
3909
+ const p = normalizeRefineEdgeParams(params);
3910
+ const g = gfRadius(p);
3911
+ const edge = p.radius > 0 ? Math.max(Math.ceil(p.radius), 2 * g + (p.smartRadius ? g + 1 : 0)) : 0;
3912
+ return edge + Math.ceil(3 * smoothSigma(p)) + Math.ceil(3 * featherSigma(p)) + Math.ceil(Math.abs(shiftAmount(p))) + 2;
3913
+ }
3914
+ function boxMean(src, w, h, r) {
3915
+ const tmp = new Float32Array(w * h);
3916
+ const pre = new Float64Array(Math.max(w, h) + 1);
3917
+ for (let y = 0; y < h; y++) {
3918
+ const row = y * w;
3919
+ for (let x = 0; x < w; x++) pre[x + 1] = pre[x] + src[row + x];
3920
+ for (let x = 0; x < w; x++) {
3921
+ const lo = Math.max(0, x - r);
3922
+ const hi = Math.min(w, x + r + 1);
3923
+ tmp[row + x] = (pre[hi] - pre[lo]) / (hi - lo);
3924
+ }
3925
+ }
3926
+ const out = new Float32Array(w * h);
3927
+ for (let x = 0; x < w; x++) {
3928
+ for (let y = 0; y < h; y++) pre[y + 1] = pre[y] + tmp[y * w + x];
3929
+ for (let y = 0; y < h; y++) {
3930
+ const lo = Math.max(0, y - r);
3931
+ const hi = Math.min(h, y + r + 1);
3932
+ out[y * w + x] = (pre[hi] - pre[lo]) / (hi - lo);
3933
+ }
3934
+ }
3935
+ return out;
3936
+ }
3937
+ function guidedFilterColor(guide, p, w, h, r, eps = GUIDED_FILTER_EPS) {
3938
+ const n = w * h;
3939
+ const [c0, c1, c2] = guide;
3940
+ const prod = (a, b2) => {
3941
+ const o = new Float32Array(n);
3942
+ for (let i = 0; i < n; i++) o[i] = a[i] * b2[i];
3943
+ return o;
3944
+ };
3945
+ const m0 = boxMean(c0, w, h, r);
3946
+ const m1 = boxMean(c1, w, h, r);
3947
+ const m2 = boxMean(c2, w, h, r);
3948
+ const mp = boxMean(p, w, h, r);
3949
+ const mip0 = boxMean(prod(c0, p), w, h, r);
3950
+ const mip1 = boxMean(prod(c1, p), w, h, r);
3951
+ const mip2 = boxMean(prod(c2, p), w, h, r);
3952
+ const s00 = boxMean(prod(c0, c0), w, h, r);
3953
+ const s01 = boxMean(prod(c0, c1), w, h, r);
3954
+ const s02 = boxMean(prod(c0, c2), w, h, r);
3955
+ const s11 = boxMean(prod(c1, c1), w, h, r);
3956
+ const s12 = boxMean(prod(c1, c2), w, h, r);
3957
+ const s22 = boxMean(prod(c2, c2), w, h, r);
3958
+ const a0 = new Float32Array(n);
3959
+ const a1 = new Float32Array(n);
3960
+ const a2 = new Float32Array(n);
3961
+ const b = new Float32Array(n);
3962
+ for (let i = 0; i < n; i++) {
3963
+ const u0 = m0[i], u1 = m1[i], u2 = m2[i], up = mp[i];
3964
+ const rr = s00[i] - u0 * u0 + eps;
3965
+ const rg = s01[i] - u0 * u1;
3966
+ const rb = s02[i] - u0 * u2;
3967
+ const gg = s11[i] - u1 * u1 + eps;
3968
+ const gb = s12[i] - u1 * u2;
3969
+ const bb = s22[i] - u2 * u2 + eps;
3970
+ const v0 = mip0[i] - u0 * up;
3971
+ const v1 = mip1[i] - u1 * up;
3972
+ const v2 = mip2[i] - u2 * up;
3973
+ const i00 = gg * bb - gb * gb;
3974
+ const i01 = gb * rb - rg * bb;
3975
+ const i02 = rg * gb - gg * rb;
3976
+ const i11 = rr * bb - rb * rb;
3977
+ const i12 = rb * rg - rr * gb;
3978
+ const i22 = rr * gg - rg * rg;
3979
+ const det = rr * i00 + rg * i01 + rb * i02;
3980
+ let x0 = 0, x1 = 0, x2 = 0;
3981
+ if (Math.abs(det) >= 1e-30) {
3982
+ x0 = (i00 * v0 + i01 * v1 + i02 * v2) / det;
3983
+ x1 = (i01 * v0 + i11 * v1 + i12 * v2) / det;
3984
+ x2 = (i02 * v0 + i12 * v1 + i22 * v2) / det;
3985
+ }
3986
+ a0[i] = x0;
3987
+ a1[i] = x1;
3988
+ a2[i] = x2;
3989
+ b[i] = up - x0 * u0 - x1 * u1 - x2 * u2;
3990
+ }
3991
+ const ma0 = boxMean(a0, w, h, r);
3992
+ const ma1 = boxMean(a1, w, h, r);
3993
+ const ma2 = boxMean(a2, w, h, r);
3994
+ const mb = boxMean(b, w, h, r);
3995
+ const out = new Float32Array(n);
3996
+ for (let i = 0; i < n; i++) out[i] = ma0[i] * c0[i] + ma1[i] * c1[i] + ma2[i] * c2[i] + mb[i];
3997
+ return out;
3998
+ }
3999
+ function edgeWidth(guide, w, h, r) {
4000
+ const n = w * h;
4001
+ const y = new Float32Array(n);
4002
+ for (let i = 0; i < n; i++) y[i] = 0.299 * guide[0][i] + 0.587 * guide[1][i] + 0.114 * guide[2][i];
4003
+ const g = new Float32Array(n);
4004
+ for (let yy = 0; yy < h; yy++) {
4005
+ for (let xx = 0; xx < w; xx++) {
4006
+ const gx = (y[yy * w + Math.min(w - 1, xx + 1)] - y[yy * w + Math.max(0, xx - 1)]) / 2;
4007
+ const gy = (y[Math.min(h - 1, yy + 1) * w + xx] - y[Math.max(0, yy - 1) * w + xx]) / 2;
4008
+ g[yy * w + xx] = Math.sqrt(gx * gx + gy * gy);
4009
+ }
4010
+ }
4011
+ const gm = _chunkUYXL6ZWQcjs.greyMorphology.call(void 0, g, w, h, r, true);
4012
+ const hi = _chunkUYXL6ZWQcjs.greyMorphology.call(void 0, y, w, h, r, true);
4013
+ const lo = _chunkUYXL6ZWQcjs.greyMorphology.call(void 0, y, w, h, r, false);
4014
+ const out = new Float32Array(n);
4015
+ for (let i = 0; i < n; i++) out[i] = (hi[i] - lo[i]) / Math.max(gm[i], 1e-4);
4016
+ return out;
4017
+ }
4018
+ function refineCoverage(guide, m, w, h, params = {}) {
4019
+ const p = normalizeRefineEdgeParams(params);
4020
+ let a = Float32Array.from(m);
4021
+ if (p.radius > 0 && guide) {
4022
+ const n = w * h;
4023
+ const boundary = new Uint8Array(n);
4024
+ let any = false;
4025
+ for (let y = 0; y < h; y++) {
4026
+ for (let x = 0; x < w; x++) {
4027
+ const i = y * w + x;
4028
+ const v = m[i] >= 0.5;
4029
+ const diff = x > 0 && m[i - 1] >= 0.5 !== v || x + 1 < w && m[i + 1] >= 0.5 !== v || y > 0 && m[i - w] >= 0.5 !== v || y + 1 < h && m[i + w] >= 0.5 !== v;
4030
+ if (diff) {
4031
+ boundary[i] = 1;
4032
+ any = true;
4033
+ }
4034
+ }
4035
+ }
4036
+ if (any) {
4037
+ const dist = _chunkUYXL6ZWQcjs.distanceTransform.call(void 0, boundary, w, h);
4038
+ const r = gfRadius(p);
4039
+ const q = guidedFilterColor(guide, m, w, h, r);
4040
+ const widths = p.smartRadius ? edgeWidth(guide, w, h, r) : null;
4041
+ for (let i = 0; i < n; i++) {
4042
+ const reff = widths ? Math.min(Math.max(p.radius, 1.5), Math.max(1.5, widths[i])) : p.radius;
4043
+ const wgt = Math.min(1, Math.max(0, reff + 1 - dist[i]));
4044
+ if (wgt > 0) {
4045
+ const qi = Math.min(1, Math.max(0, q[i]));
4046
+ a[i] = m[i] + (qi - m[i]) * wgt;
4047
+ }
4048
+ }
4049
+ }
4050
+ }
4051
+ const ss = smoothSigma(p);
4052
+ if (ss >= 0.3) {
4053
+ a = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, a, w, h, ss, "clamp");
4054
+ const gain = 1 + ss;
4055
+ for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
4056
+ }
4057
+ a = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, a, w, h, featherSigma(p), "clamp");
4058
+ if (p.contrast > 0) {
4059
+ const gain = 1 / (1 - 0.99 * p.contrast / 100);
4060
+ for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
4061
+ }
4062
+ const amount = shiftAmount(p);
4063
+ if (Math.abs(amount) >= 1e-4) a = _chunkUYXL6ZWQcjs.shiftCoverage.call(void 0, a, w, h, amount);
4064
+ return a;
4065
+ }
4066
+ function guidePlanes(pixels, win) {
4067
+ const box = _nullishCoalesce(win, () => ( { x: 0, y: 0, width: pixels.width, height: pixels.height }));
4068
+ const n = box.width * box.height;
4069
+ const r = new Float32Array(n);
4070
+ const g = new Float32Array(n);
4071
+ const b = new Float32Array(n);
4072
+ const d = pixels.data;
4073
+ for (let y = 0; y < box.height; y++) {
4074
+ for (let x = 0; x < box.width; x++) {
4075
+ const i = y * box.width + x;
4076
+ const p = ((box.y + y) * pixels.width + box.x + x) * 4;
4077
+ r[i] = d[p] / 255;
4078
+ g[i] = d[p + 1] / 255;
4079
+ b[i] = d[p + 2] / 255;
4080
+ }
4081
+ }
4082
+ return [r, g, b];
4083
+ }
4084
+ function refineSelection(pixels, mask, params = {}) {
4085
+ const p = normalizeRefineEdgeParams(params);
4086
+ if (pixels && (pixels.width !== mask.width || pixels.height !== mask.height)) {
4087
+ throw new Error("Refine Edge needs pixels the size of the selection");
4088
+ }
4089
+ if (!mask.bounds) return mask;
4090
+ const halo = refineEdgeHalo(p);
4091
+ const x0 = Math.max(0, mask.bounds.x - halo);
4092
+ const y0 = Math.max(0, mask.bounds.y - halo);
4093
+ const x1 = Math.min(mask.width, mask.bounds.x + mask.bounds.width + halo);
4094
+ const y1 = Math.min(mask.height, mask.bounds.y + mask.bounds.height + halo);
4095
+ const ww = x1 - x0;
4096
+ const wh = y1 - y0;
4097
+ const m = new Float32Array(ww * wh);
4098
+ for (let y = 0; y < wh; y++) {
4099
+ const src = (y0 + y) * mask.width + x0;
4100
+ for (let x = 0; x < ww; x++) m[y * ww + x] = mask.data[src + x] / 255;
4101
+ }
4102
+ const guide = pixels && p.radius > 0 ? guidePlanes(pixels, { x: x0, y: y0, width: ww, height: wh }) : null;
4103
+ const refined = refineCoverage(guide, m, ww, wh, p);
4104
+ const out = new Uint8Array(mask.width * mask.height);
4105
+ for (let y = 0; y < wh; y++) {
4106
+ const dst = (y0 + y) * mask.width + x0;
4107
+ for (let x = 0; x < ww; x++) out[dst + x] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, refined[y * ww + x]);
4108
+ }
4109
+ return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, mask.width, mask.height, out);
4110
+ }
4111
+
4112
+ // src/image-editor/selection/segment/guided.ts
4113
+ function workPlanes(work) {
4114
+ const n = work.width * work.height;
4115
+ const planes = [new Float32Array(n), new Float32Array(n), new Float32Array(n)];
4116
+ for (let i = 0; i < n; i++) for (let c = 0; c < 3; c++) planes[c][i] = work.rgb[i * 3 + c] / 255;
4117
+ return planes;
4118
+ }
4119
+ function workLuma(work) {
4120
+ const n = work.width * work.height;
4121
+ const out = new Float32Array(n);
4122
+ const { rgb } = work;
4123
+ for (let i = 0; i < n; i++) out[i] = (0.299 * rgb[i * 3] + 0.587 * rgb[i * 3 + 1] + 0.114 * rgb[i * 3 + 2]) / 255;
4124
+ return out;
4125
+ }
4126
+ function softMaskToSelection(work, mask) {
4127
+ const { sourceWidth: W, sourceHeight: H, width: w, height: h, scale } = work;
4128
+ const out = new Uint8Array(W * H);
4129
+ const col = new Int32Array(W);
4130
+ const fx = new Float32Array(W);
4131
+ for (let X = 0; X < W; X++) {
4132
+ const u = Math.min(w - 1, Math.max(0, (X + 0.5) * scale - 0.5));
4133
+ col[X] = Math.min(w - 2, Math.floor(u));
4134
+ fx[X] = u - col[X];
4135
+ if (w === 1) {
4136
+ col[X] = 0;
4137
+ fx[X] = 0;
4138
+ }
4139
+ }
4140
+ for (let Y = 0; Y < H; Y++) {
4141
+ const v = Math.min(h - 1, Math.max(0, (Y + 0.5) * scale - 0.5));
4142
+ const j = h === 1 ? 0 : Math.min(h - 2, Math.floor(v));
4143
+ const fy = h === 1 ? 0 : v - j;
4144
+ const r0 = j * w;
4145
+ const r1 = h === 1 ? r0 : r0 + w;
4146
+ for (let X = 0; X < W; X++) {
4147
+ const i = col[X];
4148
+ const i1 = w === 1 ? i : i + 1;
4149
+ const t = fx[X];
4150
+ const m = (mask[r0 + i] * (1 - t) + mask[r0 + i1] * t) * (1 - fy) + (mask[r1 + i] * (1 - t) + mask[r1 + i1] * t) * fy;
4151
+ out[Y * W + X] = Math.round(Math.min(1, Math.max(0, m)) * 255);
4152
+ }
4153
+ }
4154
+ return _chunkUYXL6ZWQcjs.selectionFromRegion.call(void 0, W, H, { x: 0, y: 0, width: W, height: H }, out);
4155
+ }
4156
+
4157
+ // src/image-editor/selection/segment/focus.ts
4158
+ var FOCUS_SIZE = 1024;
4159
+ function estimateNoise(luma2, w, h) {
4160
+ if (w < 3 || h < 3) return 0;
4161
+ let sum = 0;
4162
+ for (let y = 1; y < h - 1; y++) {
4163
+ for (let x = 1; x < w - 1; x++) {
4164
+ const i = y * w + x;
4165
+ const v = luma2[i - w - 1] - 2 * luma2[i - w] + luma2[i - w + 1] - 2 * luma2[i - 1] + 4 * luma2[i] - 2 * luma2[i + 1] + luma2[i + w - 1] - 2 * luma2[i + w] + luma2[i + w + 1];
4166
+ sum += Math.abs(v);
4167
+ }
4168
+ }
4169
+ return Math.sqrt(Math.PI / 2) * sum / (6 * (w - 2) * (h - 2));
4170
+ }
4171
+ function focusArea(pixels, options = {}) {
4172
+ const work = workImage(pixels, FOCUS_SIZE);
4173
+ const { width: w, height: h, scale } = work;
4174
+ const n = w * h;
4175
+ const luma2 = workLuma(work);
4176
+ const sigma = estimateNoise(luma2, w, h);
4177
+ const noise = Math.min(100, Math.max(0, _nullishCoalesce(options.noise, () => ( 0))));
4178
+ const floor = 2 * sigma * (1 + noise / 25);
4179
+ const detail = new Float32Array(n);
4180
+ for (let y = 1; y < h - 1; y++) {
4181
+ for (let x = 1; x < w - 1; x++) {
4182
+ const i = y * w + x;
4183
+ const lap = Math.abs(4 * luma2[i] - luma2[i - 1] - luma2[i + 1] - luma2[i - w] - luma2[i + w]);
4184
+ const d = Math.max(0, lap - floor);
4185
+ detail[i] = d * d;
4186
+ }
4187
+ }
4188
+ const r = Math.max(2, Math.round(0.012 * Math.max(w, h)));
4189
+ const energy = boxMean(detail, w, h, r);
4190
+ const sharp = new Float32Array(n);
4191
+ for (let i = 0; i < n; i++) sharp[i] = Math.log1p(Math.sqrt(energy[i]) * 400);
4192
+ const sorted = Float32Array.from(sharp).sort();
4193
+ const top = sorted[Math.floor(n * 0.995)] || 1;
4194
+ for (let i = 0; i < n; i++) sharp[i] = Math.min(1, sharp[i] / top);
4195
+ const ones = new Float32Array(n).fill(1);
4196
+ const otsu = otsuThreshold(sharp, ones);
4197
+ const range = Math.min(100, Math.max(0, _nullishCoalesce(options.range, () => ( 50))));
4198
+ const t = Math.min(0.98, otsu * Math.pow(2, (50 - range) / 25));
4199
+ let mask = new Float32Array(n);
4200
+ for (let i = 0; i < n; i++) mask[i] = sharp[i] >= t ? 1 : 0;
4201
+ const c = 2 * r;
4202
+ const grown = boxMean(mask, w, h, c);
4203
+ for (let i = 0; i < n; i++) grown[i] = grown[i] > 1e-3 ? 1 : 0;
4204
+ const shrunk = boxMean(grown, w, h, c);
4205
+ for (let i = 0; i < n; i++) mask[i] = shrunk[i] >= 0.999 ? 1 : 0;
4206
+ const pulled = boxMean(mask, w, h, Math.max(1, Math.round(r / 2)));
4207
+ for (let i = 0; i < n; i++) mask[i] = pulled[i] >= 0.999 ? 1 : 0;
4208
+ const softness = Math.max(0, _nullishCoalesce(options.softness, () => ( 4))) * scale;
4209
+ if (softness > 0) {
4210
+ const fitted = guidedFilterColor(workPlanes(work), mask, w, h, Math.max(1, Math.round(softness * 2)), 1e-3);
4211
+ for (let i = 0; i < n; i++) mask[i] = Math.min(1, Math.max(0, fitted[i]));
4212
+ }
4213
+ return { selection: softMaskToSelection(work, mask), noiseLevel: Math.round(sigma * 255 * 10) / 10 };
4214
+ }
4215
+
3675
4216
  // src/image-editor/layers/shape-type-ui.ts
3676
4217
  var DEFAULT_SHAPE_TOOL_OPTIONS = {
3677
4218
  kind: "rect",
@@ -3784,11 +4325,11 @@ function applyShapeOptions(controller, layerId, change) {
3784
4325
  const style = {};
3785
4326
  if ("fill" in change) style.fill = _nullishCoalesce(change.fill, () => ( null));
3786
4327
  if ("stroke" in change || "strokeWidth" in change) {
3787
- const color = "stroke" in change ? change.stroke : _optionalChain([info, 'access', _67 => _67.stroke, 'optionalAccess', _68 => _68.paint, 'access', _69 => _69.type]) === "color" ? info.stroke.paint.color : null;
3788
- style.stroke = color ? { width: _nullishCoalesce(_nullishCoalesce(change.strokeWidth, () => ( _optionalChain([info, 'access', _70 => _70.stroke, 'optionalAccess', _71 => _71.width]))), () => ( 2)), paint: color } : null;
4328
+ const color = "stroke" in change ? change.stroke : _optionalChain([info, 'access', _69 => _69.stroke, 'optionalAccess', _70 => _70.paint, 'access', _71 => _71.type]) === "color" ? info.stroke.paint.color : null;
4329
+ style.stroke = color ? { width: _nullishCoalesce(_nullishCoalesce(change.strokeWidth, () => ( _optionalChain([info, 'access', _72 => _72.stroke, 'optionalAccess', _73 => _73.width]))), () => ( 2)), paint: color } : null;
3789
4330
  }
3790
4331
  if (Object.keys(style).length) controller.setShapeStyle(layerId, style);
3791
- const live = _optionalChain([info, 'access', _72 => _72.components, 'access', _73 => _73[0], 'optionalAccess', _74 => _74.live]);
4332
+ const live = _optionalChain([info, 'access', _74 => _74.components, 'access', _75 => _75[0], 'optionalAccess', _76 => _76.live]);
3792
4333
  if (!live) return;
3793
4334
  const shape = {};
3794
4335
  if (live.kind === "rect" && change.radius !== void 0) shape.radius = change.radius;
@@ -3814,7 +4355,7 @@ var TextEditSession = (_class8 = class {
3814
4355
  __init42() {this.listeners = /* @__PURE__ */ new Set()}
3815
4356
  __init43() {this.error = null}
3816
4357
  get layer() {
3817
- const l = _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, this.controller.getLayers(), this.layerId), 'optionalAccess', _75 => _75.layer]);
4358
+ const l = _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, this.controller.getLayers(), this.layerId), 'optionalAccess', _77 => _77.layer]);
3818
4359
  if (!l || l.type !== "type") throw new Error("The type layer being edited is gone.");
3819
4360
  return l;
3820
4361
  }
@@ -3829,7 +4370,7 @@ var TextEditSession = (_class8 = class {
3829
4370
  }
3830
4371
  /** Whether the layer still exists (it can be deleted or undone away while editing). */
3831
4372
  get alive() {
3832
- return _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, this.controller.getLayers(), this.layerId), 'optionalAccess', _76 => _76.layer, 'access', _77 => _77.type]) === "type";
4373
+ return _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, this.controller.getLayers(), this.layerId), 'optionalAccess', _78 => _78.layer, 'access', _79 => _79.type]) === "type";
3833
4374
  }
3834
4375
  subscribe(fn) {
3835
4376
  this.listeners.add(fn);
@@ -3907,926 +4448,694 @@ var TextEditSession = (_class8 = class {
3907
4448
  else if (to === "end") {
3908
4449
  const last = line.chars[line.chars.length - 1];
3909
4450
  f = last ? Math.min(n, last.index + 1) : line.start;
3910
- if (last && this.text[last.index] === " " && c.line < layout.lines.length - 1) f = last.index;
3911
- } else f = _chunkBRKVNXDZcjs.textLineMove.call(void 0, layout, f, to === "up" ? -1 : 1, n);
3912
- }
3913
- }
3914
- this.focus = f;
3915
- if (!extend) this.anchor = f;
3916
- this.emit();
3917
- }
3918
- selectAll() {
3919
- this.anchor = 0;
3920
- this.focus = this.text.length;
3921
- this.emit();
3922
- }
3923
- /** Places the caret at a document point (Shift-click extends). */
3924
- pointAt(p, extend = false) {
3925
- this.focus = this.controller.textIndexAt(this.layerId, p);
3926
- if (!extend) this.anchor = this.focus;
3927
- this.emit();
3928
- }
3929
- /** Handles a key; returns `true` when it was the session's (the caller then prevents the default). */
3930
- handleKey(e) {
3931
- const mod2 = e.metaKey || e.ctrlKey;
3932
- if (mod2 && e.key.toLowerCase() === "a") {
3933
- this.selectAll();
3934
- return true;
3935
- }
3936
- switch (e.key) {
3937
- case "Backspace":
3938
- this.deleteBackward();
3939
- return true;
3940
- case "Delete":
3941
- this.deleteForward();
3942
- return true;
3943
- case "Enter":
3944
- this.insert("\n");
3945
- return true;
3946
- case "ArrowLeft":
3947
- case "ArrowRight":
3948
- case "ArrowUp":
3949
- case "ArrowDown": {
3950
- const step = _chunkBRKVNXDZcjs.textArrowStep.call(void 0, this.layer.orientation, e.key);
3951
- if (step === "previous") this.move(mod2 ? "home" : "left", e.shiftKey);
3952
- else if (step === "next") this.move(mod2 ? "end" : "right", e.shiftKey);
3953
- else if (step === "line-before") this.move(mod2 ? "start" : "up", e.shiftKey);
3954
- else this.move(mod2 ? "finish" : "down", e.shiftKey);
3955
- return true;
3956
- }
3957
- case "Home":
3958
- this.move("home", e.shiftKey);
3959
- return true;
3960
- case "End":
3961
- this.move("end", e.shiftKey);
3962
- return true;
3963
- case "Tab":
3964
- this.insert(" ");
3965
- return true;
3966
- }
3967
- if (!mod2 && !e.altKey && e.key.length >= 1 && [...e.key].length === 1) {
3968
- this.insert(e.key);
3969
- return true;
3970
- }
3971
- return false;
3972
- }
3973
- /** Sets character style fields on the selection, or on the whole text when nothing is selected. */
3974
- setStyle(style) {
3975
- const s = this.start;
3976
- const e = this.end;
3977
- const range = s === e ? {} : { start: s, end: e };
3978
- this.run((commit) => this.controller.setTextStyle(this.layerId, style, range, commit));
3979
- }
3980
- /** Sets paragraph fields on the paragraphs the selection touches. */
3981
- setParagraph(style) {
3982
- const s = this.start;
3983
- const e = this.end;
3984
- this.run((commit) => this.controller.setParagraphStyle(this.layerId, style, { start: s, end: e }, commit));
3985
- }
3986
- /** The style at the caret (or the selection's start), for the options bar. */
3987
- styleHere() {
3988
- const layer = this.layer;
3989
- const at = this.start > 0 && this.start === this.end ? this.start - 1 : this.start;
3990
- return _chunkBRKVNXDZcjs.styleAt.call(void 0, layer.runs, at, _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE);
3991
- }
3992
- info() {
3993
- return this.controller.getTextLayer(this.layerId);
3994
- }
3995
- /** The caret, the selection and the frame in natural pixels, for `RenderOptions.textEdit`. */
3996
- overlay() {
3997
- const layer = this.layer;
3998
- const layout = this.layout();
3999
- const m = _chunkUYXL6ZWQcjs.textMatrix.call(void 0, layer);
4000
- const at = (x, y) => _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, { x, y });
4001
- let frame = null;
4002
- if (layer.frame.kind === "box") frame = [at(0, 0), at(layer.frame.width, 0), at(layer.frame.width, layer.frame.height), at(0, layer.frame.height)];
4003
- else if (layout) {
4004
- const b = layout.bounds;
4005
- frame = [at(b.x, b.y), at(b.x + b.width, b.y), at(b.x + b.width, b.y + b.height), at(b.x, b.y + b.height)];
4006
- }
4007
- if (!layout) return { caret: null, selection: [], frame };
4008
- const selection = _chunkBRKVNXDZcjs.textSelectionQuads.call(void 0, layout, this.start, this.end).map((q) => q.map((p) => at(p.x, p.y)));
4009
- const c = _chunkBRKVNXDZcjs.caretAt.call(void 0, layout, this.focus);
4010
- return { caret: [at(c.from.x, c.from.y), at(c.to.x, c.to.y)], selection, frame };
4011
- }
4012
- /** Ends editing: an empty layer made for this session is deleted (as Photoshop does). Returns whether the layer remains. */
4013
- close() {
4014
- if (!this.alive) return false;
4015
- if (!this.text.trim().length) {
4016
- try {
4017
- this.controller.removeLayer(this.layerId);
4018
- } catch (e17) {
4019
- }
4020
- return false;
4021
- }
4022
- if (this.layer.name === "Text" && this.changed) {
4023
- try {
4024
- this.controller.setLayerProperties(this.layerId, { name: _chunkUYXL6ZWQcjs.typeLayerName.call(void 0, this.text) }, false);
4025
- } catch (e18) {
4026
- }
4027
- }
4028
- return true;
4029
- }
4030
- }, _class8);
4031
- function typeLayerAt(controller, p, slop = 4) {
4032
- const layers = [...flattenTypeLayers(controller.getLayers())].reverse();
4033
- for (const l of layers) {
4034
- if (!l.visible) continue;
4035
- const inv = invert(_chunkUYXL6ZWQcjs.textMatrix.call(void 0, l));
4036
- const q = _chunkBRKVNXDZcjs.applyMatrix.call(void 0, inv, p);
4037
- let b = null;
4038
- if (l.frame.kind === "box") b = { x: 0, y: 0, width: l.frame.width, height: l.frame.height };
4039
- else {
4040
- const layout = controller.getTextLayout(l.id);
4041
- if (layout) b = layout.bounds;
4042
- }
4043
- if (b && q.x >= b.x - slop && q.x <= b.x + b.width + slop && q.y >= b.y - slop && q.y <= b.y + b.height + slop) return l.id;
4044
- }
4045
- return null;
4046
- }
4047
- function flattenTypeLayers(layers) {
4048
- const out = [];
4049
- const walk = (list) => {
4050
- for (const l of list) {
4051
- if (l.type === "type") out.push(l);
4052
- else if (l.type === "group") walk(l.children);
4053
- }
4054
- };
4055
- walk(layers);
4056
- return out;
4057
- }
4058
- function invert(m) {
4059
- const [a, b, c, d, e, f] = m;
4060
- const det = a * d - b * c || 1;
4061
- return [d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det];
4062
- }
4063
- var TypeToolGesture = (_class9 = class {
4064
- constructor(controller, options) {;_class9.prototype.__init44.call(this);_class9.prototype.__init45.call(this);_class9.prototype.__init46.call(this);
4065
- this.controller = controller;
4066
- this.options = options;
4067
- }
4068
-
4069
-
4070
- __init44() {this.session = null}
4071
- __init45() {this.dragStart = null}
4072
- __init46() {this.error = null}
4073
- down(p, mods = {}) {
4074
- this.error = null;
4075
- const hit = typeLayerAt(this.controller, p);
4076
- if (this.session && this.session.alive && hit === this.session.layerId) {
4077
- this.session.pointAt(p, mods.shift);
4078
- this.dragStart = null;
4079
- return;
4080
- }
4081
- this.finish();
4082
- if (hit) {
4083
- this.controller.setActiveLayer(hit);
4084
- this.session = new TextEditSession(this.controller, hit, this.controller.textIndexAt(hit, p));
4085
- this.dragStart = null;
4086
- return;
4087
- }
4088
- this.dragStart = { x: p.x, y: p.y };
4089
- }
4090
- /** Releases a click or drag that did not land on type: adds a new text layer (point text, or a box for a drag). */
4091
- up(p) {
4092
- const start = this.dragStart;
4093
- this.dragStart = null;
4094
- if (!start) return this.session;
4095
- const o = this.options();
4096
- const w = Math.abs(p.x - start.x);
4097
- const h = Math.abs(p.y - start.y);
4098
- try {
4099
- const box = w >= 8 && h >= 8 ? { width: w, height: h } : void 0;
4100
- const id = this.controller.addTextLayer({
4101
- text: "",
4102
- x: box ? Math.min(start.x, p.x) : start.x,
4103
- y: box ? Math.min(start.y, p.y) : start.y,
4104
- ...box ? { box } : {},
4105
- style: { fontFamily: o.fontFamily, fontSize: o.fontSize, fontWeight: o.fontWeight, italic: o.italic, color: o.color },
4106
- paragraph: o.align !== "left" ? { align: o.align } : {},
4107
- ...o.orientation === "vertical" ? { orientation: "vertical" } : {},
4108
- name: "Text"
4109
- });
4110
- this.session = new TextEditSession(this.controller, id, 0);
4111
- } catch (e) {
4112
- this.error = e instanceof Error ? e.message : String(e);
4113
- }
4114
- return this.session;
4115
- }
4116
- /** Ends the open session (an empty new layer is removed). */
4117
- finish() {
4118
- const s = this.session;
4119
- this.session = null;
4120
- _optionalChain([s, 'optionalAccess', _78 => _78.close, 'call', _79 => _79()]);
4121
- }
4122
- }, _class9);
4123
-
4124
- // src/image-editor/selection/shapes.ts
4125
- function polygonCoverage(points, width, height, antiAlias = true) {
4126
- const { box, coverage } = polygonCoverageBox(points, width, height, antiAlias);
4127
- if (!box || box.width === width && box.height === height) return box ? coverage : new Float32Array(width * height);
4128
- const m = new Float32Array(width * height);
4129
- for (let y = 0; y < box.height; y++) m.set(coverage.subarray(y * box.width, (y + 1) * box.width), (box.y + y) * width + box.x);
4130
- return m;
4131
- }
4132
- function polygonCoverageBox(points, width, height, antiAlias = true) {
4133
- const none = { box: null, coverage: new Float32Array(0) };
4134
- if (points.length < 3 || width <= 0 || height <= 0) return none;
4135
- let minX = Infinity;
4136
- let minY = Infinity;
4137
- let maxX = -Infinity;
4138
- let maxY = -Infinity;
4139
- for (const p of points) {
4140
- if (!Number.isFinite(p.x) || !Number.isFinite(p.y)) continue;
4141
- minX = Math.min(minX, p.x);
4142
- minY = Math.min(minY, p.y);
4143
- maxX = Math.max(maxX, p.x);
4144
- maxY = Math.max(maxY, p.y);
4451
+ if (last && this.text[last.index] === " " && c.line < layout.lines.length - 1) f = last.index;
4452
+ } else f = _chunkBRKVNXDZcjs.textLineMove.call(void 0, layout, f, to === "up" ? -1 : 1, n);
4453
+ }
4454
+ }
4455
+ this.focus = f;
4456
+ if (!extend) this.anchor = f;
4457
+ this.emit();
4145
4458
  }
4146
- const bx0 = Math.max(0, Math.floor(minX));
4147
- const by0 = Math.max(0, Math.floor(minY));
4148
- const bx1 = Math.min(width, Math.ceil(maxX));
4149
- const by1 = Math.min(height, Math.ceil(maxY));
4150
- if (!(bx1 > bx0 && by1 > by0)) return none;
4151
- const bw = bx1 - bx0;
4152
- const m = new Float32Array(bw * (by1 - by0));
4153
- const sub2 = antiAlias ? 4 : 1;
4154
- const edges = [];
4155
- for (let i = 0; i < points.length; i++) {
4156
- const a = points[i];
4157
- const b = points[(i + 1) % points.length];
4158
- if (![a.x, a.y, b.x, b.y].every(Number.isFinite)) continue;
4159
- if (a.y < b.y) edges.push({ top: a.y, bottom: b.y, ax: a.x, ay: a.y, bx: b.x, by: b.y });
4160
- else if (b.y < a.y) edges.push({ top: b.y, bottom: a.y, ax: a.x, ay: a.y, bx: b.x, by: b.y });
4459
+ selectAll() {
4460
+ this.anchor = 0;
4461
+ this.focus = this.text.length;
4462
+ this.emit();
4161
4463
  }
4162
- edges.sort((p, q) => p.top - q.top);
4163
- let next = 0;
4164
- let active = [];
4165
- const xs = [];
4166
- for (let py = by0; py < by1; py++) {
4167
- const row = (py - by0) * bw - bx0;
4168
- for (let s = 0; s < sub2; s++) {
4169
- const y = py + (s + 0.5) / sub2;
4170
- while (next < edges.length && edges[next].top <= y) active.push(edges[next++]);
4171
- if (active.length) active = active.filter((e) => e.bottom > y);
4172
- if (!active.length) continue;
4173
- xs.length = 0;
4174
- for (const e of active) {
4175
- if (e.top <= y) xs.push(e.ax + (y - e.ay) / (e.by - e.ay) * (e.bx - e.ax));
4176
- }
4177
- xs.sort((a, b) => a - b);
4178
- for (let k = 0; k + 1 < xs.length; k += 2) {
4179
- const x0 = Math.max(0, xs[k]);
4180
- const x1 = Math.min(width, xs[k + 1]);
4181
- if (x1 <= x0) continue;
4182
- const c0 = Math.floor(x0);
4183
- const c1 = Math.min(width, Math.ceil(x1));
4184
- for (let cx = c0; cx < c1; cx++) {
4185
- let cov;
4186
- if (antiAlias) cov = Math.min(cx + 1, x1) - Math.max(cx, x0);
4187
- else {
4188
- const c = cx + 0.5;
4189
- cov = c >= x0 && c < x1 ? 1 : 0;
4190
- }
4191
- if (cov > 0) m[row + cx] += cov / sub2;
4192
- }
4464
+ /** Places the caret at a document point (Shift-click extends). */
4465
+ pointAt(p, extend = false) {
4466
+ this.focus = this.controller.textIndexAt(this.layerId, p);
4467
+ if (!extend) this.anchor = this.focus;
4468
+ this.emit();
4469
+ }
4470
+ /** Handles a key; returns `true` when it was the session's (the caller then prevents the default). */
4471
+ handleKey(e) {
4472
+ const mod2 = e.metaKey || e.ctrlKey;
4473
+ if (mod2 && e.key.toLowerCase() === "a") {
4474
+ this.selectAll();
4475
+ return true;
4476
+ }
4477
+ switch (e.key) {
4478
+ case "Backspace":
4479
+ this.deleteBackward();
4480
+ return true;
4481
+ case "Delete":
4482
+ this.deleteForward();
4483
+ return true;
4484
+ case "Enter":
4485
+ this.insert("\n");
4486
+ return true;
4487
+ case "ArrowLeft":
4488
+ case "ArrowRight":
4489
+ case "ArrowUp":
4490
+ case "ArrowDown": {
4491
+ const step = _chunkBRKVNXDZcjs.textArrowStep.call(void 0, this.layer.orientation, e.key);
4492
+ if (step === "previous") this.move(mod2 ? "home" : "left", e.shiftKey);
4493
+ else if (step === "next") this.move(mod2 ? "end" : "right", e.shiftKey);
4494
+ else if (step === "line-before") this.move(mod2 ? "start" : "up", e.shiftKey);
4495
+ else this.move(mod2 ? "finish" : "down", e.shiftKey);
4496
+ return true;
4193
4497
  }
4498
+ case "Home":
4499
+ this.move("home", e.shiftKey);
4500
+ return true;
4501
+ case "End":
4502
+ this.move("end", e.shiftKey);
4503
+ return true;
4504
+ case "Tab":
4505
+ this.insert(" ");
4506
+ return true;
4507
+ }
4508
+ if (!mod2 && !e.altKey && e.key.length >= 1 && [...e.key].length === 1) {
4509
+ this.insert(e.key);
4510
+ return true;
4194
4511
  }
4512
+ return false;
4195
4513
  }
4196
- for (let i = 0; i < m.length; i++) if (m[i] > 1) m[i] = 1;
4197
- return { box: { x: bx0, y: by0, width: bw, height: by1 - by0 }, coverage: m };
4198
- }
4199
- function polygonSelection(width, height, points, options = {}) {
4200
- const { box, coverage } = polygonCoverageBox(points, width, height, _nullishCoalesce(options.antiAlias, () => ( true)));
4201
- if (!box) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, width, height);
4202
- const out = new Uint8Array(coverage.length);
4203
- for (let i = 0; i < out.length; i++) out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, coverage[i]);
4204
- return _chunkUYXL6ZWQcjs.selectionFromRegion.call(void 0, width, height, box, out);
4205
- }
4206
- function normalizeRect(rect) {
4207
- const x = rect.width < 0 ? rect.x + rect.width : rect.x;
4208
- const y = rect.height < 0 ? rect.y + rect.height : rect.y;
4209
- return { x, y, width: Math.abs(rect.width), height: Math.abs(rect.height) };
4210
- }
4211
- function rectSelection(width, height, rect, options = {}) {
4212
- const r = normalizeRect(rect);
4213
- const pts = [
4214
- { x: r.x, y: r.y },
4215
- { x: r.x + r.width, y: r.y },
4216
- { x: r.x + r.width, y: r.y + r.height },
4217
- { x: r.x, y: r.y + r.height }
4218
- ];
4219
- return polygonSelection(width, height, pts, options);
4220
- }
4221
- function ellipsePoints(rect) {
4222
- const r = normalizeRect(rect);
4223
- const rx = r.width / 2;
4224
- const ry = r.height / 2;
4225
- const cx = r.x + rx;
4226
- const cy = r.y + ry;
4227
- const rmax = Math.max(rx, ry, 0.5);
4228
- const step = Math.sqrt(0.4 / rmax);
4229
- const n = Math.min(4096, Math.max(16, Math.ceil(2 * Math.PI / step)));
4230
- const pts = [];
4231
- for (let i = 0; i < n; i++) {
4232
- const t = i / n * 2 * Math.PI;
4233
- pts.push({ x: cx + rx * Math.cos(t), y: cy + ry * Math.sin(t) });
4514
+ /** Sets character style fields on the selection, or on the whole text when nothing is selected. */
4515
+ setStyle(style) {
4516
+ const s = this.start;
4517
+ const e = this.end;
4518
+ const range = s === e ? {} : { start: s, end: e };
4519
+ this.run((commit) => this.controller.setTextStyle(this.layerId, style, range, commit));
4234
4520
  }
4235
- return pts;
4236
- }
4237
- function ellipseSelection(width, height, rect, options = {}) {
4238
- return polygonSelection(width, height, ellipsePoints(rect), options);
4239
- }
4240
-
4241
- // src/image-editor/selection/wand.ts
4242
- function checkPixels(p) {
4243
- const n = p.width * p.height;
4244
- if (!Number.isInteger(p.width) || !Number.isInteger(p.height) || p.width < 1 || p.height < 1) {
4245
- throw new Error("Invalid pixel buffer size");
4521
+ /** Sets paragraph fields on the paragraphs the selection touches. */
4522
+ setParagraph(style) {
4523
+ const s = this.start;
4524
+ const e = this.end;
4525
+ this.run((commit) => this.controller.setParagraphStyle(this.layerId, style, { start: s, end: e }, commit));
4246
4526
  }
4247
- if (p.data.length < n * 4) throw new Error("Pixel data is shorter than width \xD7 height \xD7 4");
4248
- return n;
4249
- }
4250
- var SRGB_TO_LINEAR2 = (() => {
4251
- const t = new Float32Array(256);
4252
- for (let i = 0; i < 256; i++) {
4253
- const v = i / 255;
4254
- t[i] = v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
4527
+ /** The style at the caret (or the selection's start), for the options bar. */
4528
+ styleHere() {
4529
+ const layer = this.layer;
4530
+ const at = this.start > 0 && this.start === this.end ? this.start - 1 : this.start;
4531
+ return _chunkBRKVNXDZcjs.styleAt.call(void 0, layer.runs, at, _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE);
4255
4532
  }
4256
- return t;
4257
- })();
4258
- var labF = (t) => t > 216 / 24389 ? Math.cbrt(t) : (24389 / 27 * t + 16) / 116;
4259
- function srgb8ToLab(r, g, b) {
4260
- const rl = SRGB_TO_LINEAR2[r & 255];
4261
- const gl = SRGB_TO_LINEAR2[g & 255];
4262
- const bl = SRGB_TO_LINEAR2[b & 255];
4263
- const x = (0.4124564 * rl + 0.3575761 * gl + 0.1804375 * bl) / 0.95047;
4264
- const y = 0.2126729 * rl + 0.7151522 * gl + 0.072175 * bl;
4265
- const z = (0.0193339 * rl + 0.119192 * gl + 0.9503041 * bl) / 1.08883;
4266
- const fx = labF(x);
4267
- const fy = labF(y);
4268
- const fz = labF(z);
4269
- return [116 * fy - 16, 500 * (fx - fy), 200 * (fy - fz)];
4270
- }
4271
- function similarity(pixels, seed, tolerance, distance) {
4272
- const d = pixels.data;
4273
- const tr = d[seed * 4];
4274
- const tg = d[seed * 4 + 1];
4275
- const tb = d[seed * 4 + 2];
4276
- const ta = d[seed * 4 + 3];
4277
- const tol = Math.max(0, Math.floor(tolerance + 1e-3));
4278
- if (distance === "perceptual") {
4279
- const [tl, taa, tbb] = srgb8ToLab(tr, tg, tb);
4280
- const de = Math.max(0, tolerance) * 100 / 255;
4281
- const de2 = de * de + 1e-6;
4282
- return (i) => {
4283
- const p = i * 4;
4284
- const a = d[p + 3];
4285
- if (ta === 0 && a === 0) return true;
4286
- if (Math.abs(a - ta) > tol) return false;
4287
- const [l, aa, bb] = srgb8ToLab(d[p], d[p + 1], d[p + 2]);
4288
- return (l - tl) ** 2 + (aa - taa) ** 2 + (bb - tbb) ** 2 <= de2;
4289
- };
4533
+ info() {
4534
+ return this.controller.getTextLayer(this.layerId);
4290
4535
  }
4291
- return (i) => {
4292
- const p = i * 4;
4293
- const a = d[p + 3];
4294
- if (ta === 0 && a === 0) return true;
4295
- return Math.abs(d[p] - tr) <= tol && Math.abs(d[p + 1] - tg) <= tol && Math.abs(d[p + 2] - tb) <= tol && Math.abs(a - ta) <= tol;
4296
- };
4297
- }
4298
- function antialiasMarks(marks, w, h, x0, y0, x1, y1) {
4299
- const out = marks.slice();
4300
- for (let y = y0; y < y1; y++) {
4301
- for (let x = x0; x < x1; x++) {
4302
- const i = y * w + x;
4303
- const v = marks[i];
4304
- let sum = 0;
4305
- let edge = false;
4306
- for (let dy = -1; dy <= 1; dy++) {
4307
- const ny = y + dy;
4308
- for (let dx = -1; dx <= 1; dx++) {
4309
- const nx = x + dx;
4310
- const n = nx < 0 || ny < 0 || nx >= w || ny >= h ? v : marks[ny * w + nx];
4311
- if (n !== v) edge = true;
4312
- sum += n;
4313
- }
4314
- }
4315
- if (edge) {
4316
- const avg = sum / (9 * 255);
4317
- out[i] = Math.round((v > 127 ? 0.5 + 0.5 * avg : 0.5 * avg) * 255);
4318
- }
4536
+ /** The caret, the selection and the frame in natural pixels, for `RenderOptions.textEdit`. */
4537
+ overlay() {
4538
+ const layer = this.layer;
4539
+ const layout = this.layout();
4540
+ const m = _chunkUYXL6ZWQcjs.textMatrix.call(void 0, layer);
4541
+ const at = (x, y) => _chunkBRKVNXDZcjs.applyMatrix.call(void 0, m, { x, y });
4542
+ let frame = null;
4543
+ if (layer.frame.kind === "box") frame = [at(0, 0), at(layer.frame.width, 0), at(layer.frame.width, layer.frame.height), at(0, layer.frame.height)];
4544
+ else if (layout) {
4545
+ const b = layout.bounds;
4546
+ frame = [at(b.x, b.y), at(b.x + b.width, b.y), at(b.x + b.width, b.y + b.height), at(b.x, b.y + b.height)];
4319
4547
  }
4548
+ if (!layout) return { caret: null, selection: [], frame };
4549
+ const selection = _chunkBRKVNXDZcjs.textSelectionQuads.call(void 0, layout, this.start, this.end).map((q) => q.map((p) => at(p.x, p.y)));
4550
+ const c = _chunkBRKVNXDZcjs.caretAt.call(void 0, layout, this.focus);
4551
+ return { caret: [at(c.from.x, c.from.y), at(c.to.x, c.to.y)], selection, frame };
4320
4552
  }
4321
- return out;
4322
- }
4323
- function magicWand(pixels, seed, options = {}) {
4324
- const n = checkPixels(pixels);
4325
- const { width: w, height: h } = pixels;
4326
- const sx = Math.floor(seed.x);
4327
- const sy = Math.floor(seed.y);
4328
- if (!(sx >= 0 && sy >= 0 && sx < w && sy < h)) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h);
4329
- const similar = similarity(pixels, sy * w + sx, _nullishCoalesce(options.tolerance, () => ( 32)), _nullishCoalesce(options.distance, () => ( "rgb")));
4330
- const marks = new Uint8Array(n);
4331
- let bx0 = w;
4332
- let by0 = h;
4333
- let bx1 = -1;
4334
- let by1 = -1;
4335
- if (_nullishCoalesce(options.contiguous, () => ( true))) {
4336
- const stack = [sy * w + sx];
4337
- while (stack.length) {
4338
- const idx = stack.pop();
4339
- if (marks[idx]) continue;
4340
- const y = idx / w | 0;
4341
- const row = y * w;
4342
- let l = idx - row;
4343
- let r = l;
4344
- while (l > 0 && !marks[row + l - 1] && similar(row + l - 1)) l--;
4345
- while (r + 1 < w && !marks[row + r + 1] && similar(row + r + 1)) r++;
4346
- marks.fill(255, row + l, row + r + 1);
4347
- if (l < bx0) bx0 = l;
4348
- if (r > bx1) bx1 = r;
4349
- if (y < by0) by0 = y;
4350
- if (y > by1) by1 = y;
4351
- for (const ny of [y - 1, y + 1]) {
4352
- if (ny < 0 || ny >= h) continue;
4353
- const nrow = ny * w;
4354
- let inRun = false;
4355
- for (let nx = l; nx <= r; nx++) {
4356
- const ok = !marks[nrow + nx] && similar(nrow + nx);
4357
- if (ok && !inRun) stack.push(nrow + nx);
4358
- inRun = ok;
4359
- }
4553
+ /** Ends editing: an empty layer made for this session is deleted (as Photoshop does). Returns whether the layer remains. */
4554
+ close() {
4555
+ if (!this.alive) return false;
4556
+ if (!this.text.trim().length) {
4557
+ try {
4558
+ this.controller.removeLayer(this.layerId);
4559
+ } catch (e17) {
4360
4560
  }
4561
+ return false;
4361
4562
  }
4362
- } else {
4363
- for (let y = 0; y < h; y++) {
4364
- const row = y * w;
4365
- for (let x = 0; x < w; x++) {
4366
- if (similar(row + x)) {
4367
- marks[row + x] = 255;
4368
- if (x < bx0) bx0 = x;
4369
- if (x > bx1) bx1 = x;
4370
- if (y < by0) by0 = y;
4371
- if (y > by1) by1 = y;
4372
- }
4563
+ if (this.layer.name === "Text" && this.changed) {
4564
+ try {
4565
+ this.controller.setLayerProperties(this.layerId, { name: _chunkUYXL6ZWQcjs.typeLayerName.call(void 0, this.text) }, false);
4566
+ } catch (e18) {
4373
4567
  }
4374
4568
  }
4569
+ return true;
4375
4570
  }
4376
- if (bx1 < 0) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h);
4377
- if (!(_nullishCoalesce(options.antiAlias, () => ( true)))) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h, marks);
4378
- return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0,
4379
- w,
4380
- h,
4381
- antialiasMarks(marks, w, h, Math.max(0, bx0 - 1), Math.max(0, by0 - 1), Math.min(w, bx1 + 2), Math.min(h, by1 + 2))
4382
- );
4383
- }
4384
- function sampleColor(c) {
4385
- if (typeof c === "string") {
4386
- const m = /^#?([0-9a-f]{6})$/i.exec(c.trim());
4387
- if (!m) throw new Error(`Invalid colour "${c}"`);
4388
- const v = parseInt(m[1], 16);
4389
- return [v >> 16 & 255, v >> 8 & 255, v & 255];
4390
- }
4391
- return [c[0], c[1], c[2]];
4392
- }
4393
- function colorRange(pixels, samples, options = {}) {
4394
- const n = checkPixels(pixels);
4395
- const { width: w, height: h, data } = pixels;
4396
- const f = Math.max(0, _nullishCoalesce(options.fuzziness, () => ( 40))) + 1;
4397
- const parsed = samples.map((s) => ({ c: sampleColor(s.color), at: s.at }));
4398
- const radius = options.localized !== void 0 ? Math.max(1, options.localized) : void 0;
4399
- const out = new Uint8Array(n);
4400
- if (!parsed.length) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h, out);
4401
- for (let i = 0; i < n; i++) {
4402
- const p = i * 4;
4403
- if (data[p + 3] <= 0) continue;
4404
- const x = i % w;
4405
- const y = (i - x) / w;
4406
- let best = 0;
4407
- for (const s of parsed) {
4408
- const d = Math.max(Math.abs(data[p] - s.c[0]), Math.abs(data[p + 1] - s.c[1]), Math.abs(data[p + 2] - s.c[2]));
4409
- let k = Math.min(1, Math.max(0, 1 - d / f));
4410
- if (k > 0 && radius !== void 0 && s.at) {
4411
- const dist = Math.hypot(x - s.at.x, y - s.at.y);
4412
- k *= Math.min(1, Math.max(0, 1 - dist / radius));
4413
- }
4414
- if (k > best) best = k;
4571
+ }, _class8);
4572
+ function typeLayerAt(controller, p, slop = 4) {
4573
+ const layers = [...flattenTypeLayers(controller.getLayers())].reverse();
4574
+ for (const l of layers) {
4575
+ if (!l.visible) continue;
4576
+ const inv = invert(_chunkUYXL6ZWQcjs.textMatrix.call(void 0, l));
4577
+ const q = _chunkBRKVNXDZcjs.applyMatrix.call(void 0, inv, p);
4578
+ let b = null;
4579
+ if (l.frame.kind === "box") b = { x: 0, y: 0, width: l.frame.width, height: l.frame.height };
4580
+ else {
4581
+ const layout = controller.getTextLayout(l.id);
4582
+ if (layout) b = layout.bounds;
4415
4583
  }
4416
- out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, best);
4417
- }
4418
- return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h, out);
4419
- }
4420
- var TONE_RANGE_PRESETS = {
4421
- shadows: [0, 65],
4422
- midtones: [105, 150],
4423
- highlights: [190, 255]
4424
- };
4425
- function toneRange(pixels, range, falloff = 20) {
4426
- const n = checkPixels(pixels);
4427
- const [lo, hi] = typeof range === "string" ? TONE_RANGE_PRESETS[range] : range;
4428
- const ramp2 = Math.max(1e-3, falloff);
4429
- const out = new Uint8Array(n);
4430
- const d = pixels.data;
4431
- for (let i = 0; i < n; i++) {
4432
- const p = i * 4;
4433
- if (d[p + 3] <= 0) continue;
4434
- const l = Math.min(255, Math.max(0, 0.299 * d[p] + 0.587 * d[p + 1] + 0.114 * d[p + 2]));
4435
- const outside = l < lo ? lo - l : l > hi ? l - hi : 0;
4436
- out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, 1 - outside / ramp2);
4437
- }
4438
- return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height, out);
4439
- }
4440
- function hueRange(pixels, center) {
4441
- const n = checkPixels(pixels);
4442
- const out = new Uint8Array(n);
4443
- const d = pixels.data;
4444
- for (let i = 0; i < n; i++) {
4445
- const p = i * 4;
4446
- if (d[p + 3] <= 0) continue;
4447
- const r = d[p] / 255;
4448
- const g = d[p + 1] / 255;
4449
- const b = d[p + 2] / 255;
4450
- const mx = Math.max(r, g, b);
4451
- const mn = Math.min(r, g, b);
4452
- const chroma = mx - mn;
4453
- if (chroma <= 0) continue;
4454
- let hue;
4455
- if (mx === r) hue = ((g - b) / chroma % 6 + 6) % 6;
4456
- else if (mx === g) hue = (b - r) / chroma + 2;
4457
- else hue = (r - g) / chroma + 4;
4458
- hue *= 60;
4459
- let dh = ((hue - center) % 360 + 360) % 360;
4460
- dh = Math.min(dh, 360 - dh);
4461
- out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, Math.min(1, Math.max(0, 1 - dh / 60)) * chroma * (2 - mx));
4584
+ if (b && q.x >= b.x - slop && q.x <= b.x + b.width + slop && q.y >= b.y - slop && q.y <= b.y + b.height + slop) return l.id;
4462
4585
  }
4463
- return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height, out);
4464
- }
4465
- var HUE_RANGE_PRESETS = { reds: 0, yellows: 60, greens: 120, cyans: 180, blues: 240, magentas: 300 };
4466
- var COLOR_RANGE_PRESETS = [
4467
- ...Object.keys(HUE_RANGE_PRESETS),
4468
- "highlights",
4469
- "midtones",
4470
- "shadows",
4471
- "skinTones"
4472
- ];
4473
- function isColorRangePreset(v) {
4474
- return typeof v === "string" && COLOR_RANGE_PRESETS.includes(v);
4586
+ return null;
4475
4587
  }
4476
- var ramp = (v, lo, hi, soft) => v < lo ? Math.max(0, 1 - (lo - v) / soft) : v > hi ? Math.max(0, 1 - (v - hi) / soft) : 1;
4477
- function skinToneRange(pixels) {
4478
- const n = checkPixels(pixels);
4479
- const out = new Uint8Array(n);
4480
- const d = pixels.data;
4481
- for (let i = 0; i < n; i++) {
4482
- const p = i * 4;
4483
- if (d[p + 3] <= 0) continue;
4484
- const r = d[p] / 255;
4485
- const g = d[p + 1] / 255;
4486
- const b = d[p + 2] / 255;
4487
- const mx = Math.max(r, g, b);
4488
- const mn = Math.min(r, g, b);
4489
- const chroma = mx - mn;
4490
- if (chroma <= 0 || mx <= 0) continue;
4491
- let hue;
4492
- if (mx === r) hue = ((g - b) / chroma % 6 + 6) % 6;
4493
- else if (mx === g) hue = (b - r) / chroma + 2;
4494
- else hue = (r - g) / chroma + 4;
4495
- hue *= 60;
4496
- if (hue > 180) hue -= 360;
4497
- const k = ramp(hue, 5, 40, 20) * ramp(chroma / mx, 0.12, 0.8, 0.1) * ramp(mx, 0.3, 1, 0.15);
4498
- out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, k);
4499
- }
4500
- return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height, out);
4588
+ function flattenTypeLayers(layers) {
4589
+ const out = [];
4590
+ const walk = (list) => {
4591
+ for (const l of list) {
4592
+ if (l.type === "type") out.push(l);
4593
+ else if (l.type === "group") walk(l.children);
4594
+ }
4595
+ };
4596
+ walk(layers);
4597
+ return out;
4501
4598
  }
4502
- function colorRangePreset(pixels, preset, options = {}) {
4503
- if (preset === "skinTones") return skinToneRange(pixels);
4504
- if (preset === "highlights" || preset === "midtones" || preset === "shadows") return toneRange(pixels, preset, _nullishCoalesce(options.falloff, () => ( 20)));
4505
- if (preset in HUE_RANGE_PRESETS) return hueRange(pixels, HUE_RANGE_PRESETS[preset]);
4506
- throw new Error(`Unknown Color Range preset "${String(preset)}". Use one of ${COLOR_RANGE_PRESETS.join(", ")}.`);
4599
+ function invert(m) {
4600
+ const [a, b, c, d, e, f] = m;
4601
+ const det = a * d - b * c || 1;
4602
+ return [d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det];
4507
4603
  }
4508
- function selectedColorBins(pixels, sel, tolerance) {
4509
- const S = 64;
4510
- let bins = new Uint8Array(S * S * S);
4511
- const d = pixels.data;
4512
- const n = pixels.width * pixels.height;
4513
- for (let i = 0; i < n; i++) {
4514
- if (sel.data[i] < 128 || d[i * 4 + 3] === 0) continue;
4515
- bins[((d[i * 4] >> 2) * S + (d[i * 4 + 1] >> 2)) * S + (d[i * 4 + 2] >> 2)] = 1;
4604
+ var TypeToolGesture = (_class9 = class {
4605
+ constructor(controller, options) {;_class9.prototype.__init44.call(this);_class9.prototype.__init45.call(this);_class9.prototype.__init46.call(this);
4606
+ this.controller = controller;
4607
+ this.options = options;
4516
4608
  }
4517
- const r = Math.round(Math.max(0, tolerance) / 4);
4518
- if (r === 0) return bins;
4519
- for (const stride of [1, S, S * S]) {
4520
- const out = new Uint8Array(bins.length);
4521
- for (let i = 0; i < bins.length; i++) {
4522
- if (!bins[i]) continue;
4523
- const c = Math.floor(i / stride) % S;
4524
- const lo = Math.max(0, c - r);
4525
- const hi = Math.min(S - 1, c + r);
4526
- const base = i - c * stride;
4527
- for (let k = lo; k <= hi; k++) out[base + k * stride] = 1;
4609
+
4610
+
4611
+ __init44() {this.session = null}
4612
+ __init45() {this.dragStart = null}
4613
+ __init46() {this.error = null}
4614
+ down(p, mods = {}) {
4615
+ this.error = null;
4616
+ const hit = typeLayerAt(this.controller, p);
4617
+ if (this.session && this.session.alive && hit === this.session.layerId) {
4618
+ this.session.pointAt(p, mods.shift);
4619
+ this.dragStart = null;
4620
+ return;
4621
+ }
4622
+ this.finish();
4623
+ if (hit) {
4624
+ this.controller.setActiveLayer(hit);
4625
+ this.session = new TextEditSession(this.controller, hit, this.controller.textIndexAt(hit, p));
4626
+ this.dragStart = null;
4627
+ return;
4528
4628
  }
4529
- bins = out;
4629
+ this.dragStart = { x: p.x, y: p.y };
4530
4630
  }
4531
- return bins;
4532
- }
4533
- function matcher(pixels, sel, options) {
4534
- if (sel.width !== pixels.width || sel.height !== pixels.height) throw new Error("The selection and the pixels differ in size");
4535
- const bins = selectedColorBins(pixels, sel, _nullishCoalesce(options.tolerance, () => ( 32)));
4536
- const d = pixels.data;
4537
- return (i) => d[i * 4 + 3] > 0 && bins[((d[i * 4] >> 2 << 6) + (d[i * 4 + 1] >> 2)) * 64 + (d[i * 4 + 2] >> 2)] === 1;
4538
- }
4539
- function growSelection(pixels, sel, options = {}) {
4540
- checkPixels(pixels);
4541
- const match = matcher(pixels, sel, options);
4542
- const { width: w, height: h } = pixels;
4543
- const out = new Uint8Array(sel.data);
4544
- const stack = [];
4545
- for (let i = 0; i < out.length; i++) if (out[i] >= 128) stack.push(i);
4546
- while (stack.length) {
4547
- const i = stack.pop();
4548
- const x = i % w;
4549
- const y = (i - x) / w;
4550
- const visit = (j) => {
4551
- if (out[j] < 255 && match(j)) {
4552
- out[j] = 255;
4553
- stack.push(j);
4554
- }
4555
- };
4556
- if (x > 0) visit(i - 1);
4557
- if (x < w - 1) visit(i + 1);
4558
- if (y > 0) visit(i - w);
4559
- if (y < h - 1) visit(i + w);
4631
+ /** Releases a click or drag that did not land on type: adds a new text layer (point text, or a box for a drag). */
4632
+ up(p) {
4633
+ const start = this.dragStart;
4634
+ this.dragStart = null;
4635
+ if (!start) return this.session;
4636
+ const o = this.options();
4637
+ const w = Math.abs(p.x - start.x);
4638
+ const h = Math.abs(p.y - start.y);
4639
+ try {
4640
+ const box = w >= 8 && h >= 8 ? { width: w, height: h } : void 0;
4641
+ const id = this.controller.addTextLayer({
4642
+ text: "",
4643
+ x: box ? Math.min(start.x, p.x) : start.x,
4644
+ y: box ? Math.min(start.y, p.y) : start.y,
4645
+ ...box ? { box } : {},
4646
+ style: { fontFamily: o.fontFamily, fontSize: o.fontSize, fontWeight: o.fontWeight, italic: o.italic, color: o.color },
4647
+ paragraph: o.align !== "left" ? { align: o.align } : {},
4648
+ ...o.orientation === "vertical" ? { orientation: "vertical" } : {},
4649
+ name: "Text"
4650
+ });
4651
+ this.session = new TextEditSession(this.controller, id, 0);
4652
+ } catch (e) {
4653
+ this.error = e instanceof Error ? e.message : String(e);
4654
+ }
4655
+ return this.session;
4560
4656
  }
4561
- return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h, out);
4562
- }
4563
- function selectSimilar(pixels, sel, options = {}) {
4564
- const n = checkPixels(pixels);
4565
- const match = matcher(pixels, sel, options);
4566
- const out = new Uint8Array(sel.data);
4567
- for (let i = 0; i < n; i++) if (match(i)) out[i] = 255;
4568
- return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height, out);
4569
- }
4657
+ /** Ends the open session (an empty new layer is removed). */
4658
+ finish() {
4659
+ const s = this.session;
4660
+ this.session = null;
4661
+ _optionalChain([s, 'optionalAccess', _80 => _80.close, 'call', _81 => _81()]);
4662
+ }
4663
+ }, _class9);
4570
4664
 
4571
- // src/image-editor/selection/segmentation.ts
4572
- var isPoint = (p) => !!p && typeof p === "object" && Number.isFinite(p.x) && Number.isFinite(p.y);
4573
- function segmentationOutlines(result) {
4574
- const p = result.polygon;
4575
- if (!Array.isArray(p) || !p.length) return [];
4576
- const rings = Array.isArray(p[0]) ? p : [p];
4577
- return rings.map((ring) => Array.isArray(ring) ? ring.filter(isPoint) : []).filter((ring) => ring.length >= 3);
4665
+ // src/image-editor/selection/shapes.ts
4666
+ function polygonCoverage(points, width, height, antiAlias = true) {
4667
+ const { box, coverage } = polygonCoverageBox(points, width, height, antiAlias);
4668
+ if (!box || box.width === width && box.height === height) return box ? coverage : new Float32Array(width * height);
4669
+ const m = new Float32Array(width * height);
4670
+ for (let y = 0; y < box.height; y++) m.set(coverage.subarray(y * box.width, (y + 1) * box.width), (box.y + y) * width + box.x);
4671
+ return m;
4578
4672
  }
4579
- function segmentToSelection(width, height, result) {
4580
- let out = null;
4581
- for (const ring of segmentationOutlines(result)) {
4582
- out = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, out, polygonSelection(width, height, ring), "add");
4673
+ function polygonCoverageBox(points, width, height, antiAlias = true) {
4674
+ const none = { box: null, coverage: new Float32Array(0) };
4675
+ if (points.length < 3 || width <= 0 || height <= 0) return none;
4676
+ let minX = Infinity;
4677
+ let minY = Infinity;
4678
+ let maxX = -Infinity;
4679
+ let maxY = -Infinity;
4680
+ for (const p of points) {
4681
+ if (!Number.isFinite(p.x) || !Number.isFinite(p.y)) continue;
4682
+ minX = Math.min(minX, p.x);
4683
+ minY = Math.min(minY, p.y);
4684
+ maxX = Math.max(maxX, p.x);
4685
+ maxY = Math.max(maxY, p.y);
4583
4686
  }
4584
- if (result.mask && result.mask.width > 0 && result.mask.height > 0) {
4585
- const raw = _chunkUYXL6ZWQcjs.selectionFromPixels.call(void 0, result.mask, { channel: "luminance" });
4586
- const sized = raw.width === width && raw.height === height ? raw : _chunkUYXL6ZWQcjs.resizeSelection.call(void 0, raw, width, height);
4587
- out = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, out, sized, "add");
4687
+ const bx0 = Math.max(0, Math.floor(minX));
4688
+ const by0 = Math.max(0, Math.floor(minY));
4689
+ const bx1 = Math.min(width, Math.ceil(maxX));
4690
+ const by1 = Math.min(height, Math.ceil(maxY));
4691
+ if (!(bx1 > bx0 && by1 > by0)) return none;
4692
+ const bw = bx1 - bx0;
4693
+ const m = new Float32Array(bw * (by1 - by0));
4694
+ const sub2 = antiAlias ? 4 : 1;
4695
+ const edges = [];
4696
+ for (let i = 0; i < points.length; i++) {
4697
+ const a = points[i];
4698
+ const b = points[(i + 1) % points.length];
4699
+ if (![a.x, a.y, b.x, b.y].every(Number.isFinite)) continue;
4700
+ if (a.y < b.y) edges.push({ top: a.y, bottom: b.y, ax: a.x, ay: a.y, bx: b.x, by: b.y });
4701
+ else if (b.y < a.y) edges.push({ top: b.y, bottom: a.y, ax: a.x, ay: a.y, bx: b.x, by: b.y });
4588
4702
  }
4589
- return _optionalChain([out, 'optionalAccess', _80 => _80.bounds]) ? out : null;
4590
- }
4591
- function segmentsToSelection(width, height, results) {
4592
- let out = null;
4593
- for (const r of results) {
4594
- const sel = segmentToSelection(width, height, r);
4595
- if (sel) out = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, out, sel, "add");
4703
+ edges.sort((p, q) => p.top - q.top);
4704
+ let next = 0;
4705
+ let active = [];
4706
+ const xs = [];
4707
+ for (let py = by0; py < by1; py++) {
4708
+ const row = (py - by0) * bw - bx0;
4709
+ for (let s = 0; s < sub2; s++) {
4710
+ const y = py + (s + 0.5) / sub2;
4711
+ while (next < edges.length && edges[next].top <= y) active.push(edges[next++]);
4712
+ if (active.length) active = active.filter((e) => e.bottom > y);
4713
+ if (!active.length) continue;
4714
+ xs.length = 0;
4715
+ for (const e of active) {
4716
+ if (e.top <= y) xs.push(e.ax + (y - e.ay) / (e.by - e.ay) * (e.bx - e.ax));
4717
+ }
4718
+ xs.sort((a, b) => a - b);
4719
+ for (let k = 0; k + 1 < xs.length; k += 2) {
4720
+ const x0 = Math.max(0, xs[k]);
4721
+ const x1 = Math.min(width, xs[k + 1]);
4722
+ if (x1 <= x0) continue;
4723
+ const c0 = Math.floor(x0);
4724
+ const c1 = Math.min(width, Math.ceil(x1));
4725
+ for (let cx = c0; cx < c1; cx++) {
4726
+ let cov;
4727
+ if (antiAlias) cov = Math.min(cx + 1, x1) - Math.max(cx, x0);
4728
+ else {
4729
+ const c = cx + 0.5;
4730
+ cov = c >= x0 && c < x1 ? 1 : 0;
4731
+ }
4732
+ if (cov > 0) m[row + cx] += cov / sub2;
4733
+ }
4734
+ }
4735
+ }
4596
4736
  }
4597
- return out;
4737
+ for (let i = 0; i < m.length; i++) if (m[i] > 1) m[i] = 1;
4738
+ return { box: { x: bx0, y: by0, width: bw, height: by1 - by0 }, coverage: m };
4598
4739
  }
4599
-
4600
- // src/image-editor/selection/refine.ts
4601
- var DEFAULT_REFINE_EDGE_PARAMS = {
4602
- radius: 0,
4603
- smartRadius: false,
4604
- smooth: 0,
4605
- feather: 0,
4606
- contrast: 0,
4607
- shiftEdge: 0
4608
- };
4609
- var GUIDED_FILTER_EPS = 1e-4;
4610
- var fin = (v, d) => typeof v === "number" && Number.isFinite(v) ? v : d;
4611
- function normalizeRefineEdgeParams(p = {}) {
4612
- return {
4613
- radius: Math.min(250, Math.max(0, fin(p.radius, 0))),
4614
- smartRadius: p.smartRadius === true,
4615
- smooth: Math.min(100, Math.max(0, fin(p.smooth, 0))),
4616
- feather: Math.min(1e3, Math.max(0, fin(p.feather, 0))),
4617
- contrast: Math.min(100, Math.max(0, fin(p.contrast, 0))),
4618
- shiftEdge: Math.min(100, Math.max(-100, fin(p.shiftEdge, 0)))
4619
- };
4740
+ function polygonSelection(width, height, points, options = {}) {
4741
+ const { box, coverage } = polygonCoverageBox(points, width, height, _nullishCoalesce(options.antiAlias, () => ( true)));
4742
+ if (!box) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, width, height);
4743
+ const out = new Uint8Array(coverage.length);
4744
+ for (let i = 0; i < out.length; i++) out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, coverage[i]);
4745
+ return _chunkUYXL6ZWQcjs.selectionFromRegion.call(void 0, width, height, box, out);
4620
4746
  }
4621
- var gfRadius = (p) => Math.min(64, Math.max(1, Math.ceil(p.radius)));
4622
- var smoothSigma = (p) => p.smooth / 100 * 4;
4623
- var featherSigma = (p) => p.feather / 2;
4624
- function shiftAmount(p) {
4625
- const px2 = p.shiftEdge / 100 * Math.max(p.radius, 4);
4626
- return Number.isFinite(px2) ? Math.min(64, Math.max(-64, px2)) : 0;
4747
+ function normalizeRect(rect) {
4748
+ const x = rect.width < 0 ? rect.x + rect.width : rect.x;
4749
+ const y = rect.height < 0 ? rect.y + rect.height : rect.y;
4750
+ return { x, y, width: Math.abs(rect.width), height: Math.abs(rect.height) };
4627
4751
  }
4628
- function refineEdgeHalo(params = {}) {
4629
- const p = normalizeRefineEdgeParams(params);
4630
- const g = gfRadius(p);
4631
- const edge = p.radius > 0 ? Math.max(Math.ceil(p.radius), 2 * g + (p.smartRadius ? g + 1 : 0)) : 0;
4632
- return edge + Math.ceil(3 * smoothSigma(p)) + Math.ceil(3 * featherSigma(p)) + Math.ceil(Math.abs(shiftAmount(p))) + 2;
4752
+ function rectSelection(width, height, rect, options = {}) {
4753
+ const r = normalizeRect(rect);
4754
+ const pts = [
4755
+ { x: r.x, y: r.y },
4756
+ { x: r.x + r.width, y: r.y },
4757
+ { x: r.x + r.width, y: r.y + r.height },
4758
+ { x: r.x, y: r.y + r.height }
4759
+ ];
4760
+ return polygonSelection(width, height, pts, options);
4633
4761
  }
4634
- function boxMean(src, w, h, r) {
4635
- const tmp = new Float32Array(w * h);
4636
- const pre = new Float64Array(Math.max(w, h) + 1);
4637
- for (let y = 0; y < h; y++) {
4638
- const row = y * w;
4639
- for (let x = 0; x < w; x++) pre[x + 1] = pre[x] + src[row + x];
4640
- for (let x = 0; x < w; x++) {
4641
- const lo = Math.max(0, x - r);
4642
- const hi = Math.min(w, x + r + 1);
4643
- tmp[row + x] = (pre[hi] - pre[lo]) / (hi - lo);
4644
- }
4762
+ function ellipsePoints(rect) {
4763
+ const r = normalizeRect(rect);
4764
+ const rx = r.width / 2;
4765
+ const ry = r.height / 2;
4766
+ const cx = r.x + rx;
4767
+ const cy = r.y + ry;
4768
+ const rmax = Math.max(rx, ry, 0.5);
4769
+ const step = Math.sqrt(0.4 / rmax);
4770
+ const n = Math.min(4096, Math.max(16, Math.ceil(2 * Math.PI / step)));
4771
+ const pts = [];
4772
+ for (let i = 0; i < n; i++) {
4773
+ const t = i / n * 2 * Math.PI;
4774
+ pts.push({ x: cx + rx * Math.cos(t), y: cy + ry * Math.sin(t) });
4645
4775
  }
4646
- const out = new Float32Array(w * h);
4647
- for (let x = 0; x < w; x++) {
4648
- for (let y = 0; y < h; y++) pre[y + 1] = pre[y] + tmp[y * w + x];
4649
- for (let y = 0; y < h; y++) {
4650
- const lo = Math.max(0, y - r);
4651
- const hi = Math.min(h, y + r + 1);
4652
- out[y * w + x] = (pre[hi] - pre[lo]) / (hi - lo);
4653
- }
4776
+ return pts;
4777
+ }
4778
+ function ellipseSelection(width, height, rect, options = {}) {
4779
+ return polygonSelection(width, height, ellipsePoints(rect), options);
4780
+ }
4781
+
4782
+ // src/image-editor/selection/wand.ts
4783
+ function checkPixels(p) {
4784
+ const n = p.width * p.height;
4785
+ if (!Number.isInteger(p.width) || !Number.isInteger(p.height) || p.width < 1 || p.height < 1) {
4786
+ throw new Error("Invalid pixel buffer size");
4654
4787
  }
4655
- return out;
4788
+ if (p.data.length < n * 4) throw new Error("Pixel data is shorter than width \xD7 height \xD7 4");
4789
+ return n;
4656
4790
  }
4657
- function guidedFilterColor(guide, p, w, h, r, eps = GUIDED_FILTER_EPS) {
4658
- const n = w * h;
4659
- const [c0, c1, c2] = guide;
4660
- const prod = (a, b2) => {
4661
- const o = new Float32Array(n);
4662
- for (let i = 0; i < n; i++) o[i] = a[i] * b2[i];
4663
- return o;
4664
- };
4665
- const m0 = boxMean(c0, w, h, r);
4666
- const m1 = boxMean(c1, w, h, r);
4667
- const m2 = boxMean(c2, w, h, r);
4668
- const mp = boxMean(p, w, h, r);
4669
- const mip0 = boxMean(prod(c0, p), w, h, r);
4670
- const mip1 = boxMean(prod(c1, p), w, h, r);
4671
- const mip2 = boxMean(prod(c2, p), w, h, r);
4672
- const s00 = boxMean(prod(c0, c0), w, h, r);
4673
- const s01 = boxMean(prod(c0, c1), w, h, r);
4674
- const s02 = boxMean(prod(c0, c2), w, h, r);
4675
- const s11 = boxMean(prod(c1, c1), w, h, r);
4676
- const s12 = boxMean(prod(c1, c2), w, h, r);
4677
- const s22 = boxMean(prod(c2, c2), w, h, r);
4678
- const a0 = new Float32Array(n);
4679
- const a1 = new Float32Array(n);
4680
- const a2 = new Float32Array(n);
4681
- const b = new Float32Array(n);
4682
- for (let i = 0; i < n; i++) {
4683
- const u0 = m0[i], u1 = m1[i], u2 = m2[i], up = mp[i];
4684
- const rr = s00[i] - u0 * u0 + eps;
4685
- const rg = s01[i] - u0 * u1;
4686
- const rb = s02[i] - u0 * u2;
4687
- const gg = s11[i] - u1 * u1 + eps;
4688
- const gb = s12[i] - u1 * u2;
4689
- const bb = s22[i] - u2 * u2 + eps;
4690
- const v0 = mip0[i] - u0 * up;
4691
- const v1 = mip1[i] - u1 * up;
4692
- const v2 = mip2[i] - u2 * up;
4693
- const i00 = gg * bb - gb * gb;
4694
- const i01 = gb * rb - rg * bb;
4695
- const i02 = rg * gb - gg * rb;
4696
- const i11 = rr * bb - rb * rb;
4697
- const i12 = rb * rg - rr * gb;
4698
- const i22 = rr * gg - rg * rg;
4699
- const det = rr * i00 + rg * i01 + rb * i02;
4700
- let x0 = 0, x1 = 0, x2 = 0;
4701
- if (Math.abs(det) >= 1e-30) {
4702
- x0 = (i00 * v0 + i01 * v1 + i02 * v2) / det;
4703
- x1 = (i01 * v0 + i11 * v1 + i12 * v2) / det;
4704
- x2 = (i02 * v0 + i12 * v1 + i22 * v2) / det;
4705
- }
4706
- a0[i] = x0;
4707
- a1[i] = x1;
4708
- a2[i] = x2;
4709
- b[i] = up - x0 * u0 - x1 * u1 - x2 * u2;
4791
+ var SRGB_TO_LINEAR2 = (() => {
4792
+ const t = new Float32Array(256);
4793
+ for (let i = 0; i < 256; i++) {
4794
+ const v = i / 255;
4795
+ t[i] = v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
4710
4796
  }
4711
- const ma0 = boxMean(a0, w, h, r);
4712
- const ma1 = boxMean(a1, w, h, r);
4713
- const ma2 = boxMean(a2, w, h, r);
4714
- const mb = boxMean(b, w, h, r);
4715
- const out = new Float32Array(n);
4716
- for (let i = 0; i < n; i++) out[i] = ma0[i] * c0[i] + ma1[i] * c1[i] + ma2[i] * c2[i] + mb[i];
4717
- return out;
4797
+ return t;
4798
+ })();
4799
+ var labF = (t) => t > 216 / 24389 ? Math.cbrt(t) : (24389 / 27 * t + 16) / 116;
4800
+ function srgb8ToLab(r, g, b) {
4801
+ const rl = SRGB_TO_LINEAR2[r & 255];
4802
+ const gl = SRGB_TO_LINEAR2[g & 255];
4803
+ const bl = SRGB_TO_LINEAR2[b & 255];
4804
+ const x = (0.4124564 * rl + 0.3575761 * gl + 0.1804375 * bl) / 0.95047;
4805
+ const y = 0.2126729 * rl + 0.7151522 * gl + 0.072175 * bl;
4806
+ const z = (0.0193339 * rl + 0.119192 * gl + 0.9503041 * bl) / 1.08883;
4807
+ const fx = labF(x);
4808
+ const fy = labF(y);
4809
+ const fz = labF(z);
4810
+ return [116 * fy - 16, 500 * (fx - fy), 200 * (fy - fz)];
4718
4811
  }
4719
- function edgeWidth(guide, w, h, r) {
4720
- const n = w * h;
4721
- const y = new Float32Array(n);
4722
- for (let i = 0; i < n; i++) y[i] = 0.299 * guide[0][i] + 0.587 * guide[1][i] + 0.114 * guide[2][i];
4723
- const g = new Float32Array(n);
4724
- for (let yy = 0; yy < h; yy++) {
4725
- for (let xx = 0; xx < w; xx++) {
4726
- const gx = (y[yy * w + Math.min(w - 1, xx + 1)] - y[yy * w + Math.max(0, xx - 1)]) / 2;
4727
- const gy = (y[Math.min(h - 1, yy + 1) * w + xx] - y[Math.max(0, yy - 1) * w + xx]) / 2;
4728
- g[yy * w + xx] = Math.sqrt(gx * gx + gy * gy);
4812
+ function similarity(pixels, seed, tolerance, distance) {
4813
+ const d = pixels.data;
4814
+ const tr = d[seed * 4];
4815
+ const tg = d[seed * 4 + 1];
4816
+ const tb = d[seed * 4 + 2];
4817
+ const ta = d[seed * 4 + 3];
4818
+ const tol = Math.max(0, Math.floor(tolerance + 1e-3));
4819
+ if (distance === "perceptual") {
4820
+ const [tl, taa, tbb] = srgb8ToLab(tr, tg, tb);
4821
+ const de = Math.max(0, tolerance) * 100 / 255;
4822
+ const de2 = de * de + 1e-6;
4823
+ return (i) => {
4824
+ const p = i * 4;
4825
+ const a = d[p + 3];
4826
+ if (ta === 0 && a === 0) return true;
4827
+ if (Math.abs(a - ta) > tol) return false;
4828
+ const [l, aa, bb] = srgb8ToLab(d[p], d[p + 1], d[p + 2]);
4829
+ return (l - tl) ** 2 + (aa - taa) ** 2 + (bb - tbb) ** 2 <= de2;
4830
+ };
4831
+ }
4832
+ return (i) => {
4833
+ const p = i * 4;
4834
+ const a = d[p + 3];
4835
+ if (ta === 0 && a === 0) return true;
4836
+ return Math.abs(d[p] - tr) <= tol && Math.abs(d[p + 1] - tg) <= tol && Math.abs(d[p + 2] - tb) <= tol && Math.abs(a - ta) <= tol;
4837
+ };
4838
+ }
4839
+ function antialiasMarks(marks, w, h, x0, y0, x1, y1) {
4840
+ const out = marks.slice();
4841
+ for (let y = y0; y < y1; y++) {
4842
+ for (let x = x0; x < x1; x++) {
4843
+ const i = y * w + x;
4844
+ const v = marks[i];
4845
+ let sum = 0;
4846
+ let edge = false;
4847
+ for (let dy = -1; dy <= 1; dy++) {
4848
+ const ny = y + dy;
4849
+ for (let dx = -1; dx <= 1; dx++) {
4850
+ const nx = x + dx;
4851
+ const n = nx < 0 || ny < 0 || nx >= w || ny >= h ? v : marks[ny * w + nx];
4852
+ if (n !== v) edge = true;
4853
+ sum += n;
4854
+ }
4855
+ }
4856
+ if (edge) {
4857
+ const avg = sum / (9 * 255);
4858
+ out[i] = Math.round((v > 127 ? 0.5 + 0.5 * avg : 0.5 * avg) * 255);
4859
+ }
4729
4860
  }
4730
4861
  }
4731
- const gm = _chunkUYXL6ZWQcjs.greyMorphology.call(void 0, g, w, h, r, true);
4732
- const hi = _chunkUYXL6ZWQcjs.greyMorphology.call(void 0, y, w, h, r, true);
4733
- const lo = _chunkUYXL6ZWQcjs.greyMorphology.call(void 0, y, w, h, r, false);
4734
- const out = new Float32Array(n);
4735
- for (let i = 0; i < n; i++) out[i] = (hi[i] - lo[i]) / Math.max(gm[i], 1e-4);
4736
4862
  return out;
4737
4863
  }
4738
- function refineCoverage(guide, m, w, h, params = {}) {
4739
- const p = normalizeRefineEdgeParams(params);
4740
- let a = Float32Array.from(m);
4741
- if (p.radius > 0 && guide) {
4742
- const n = w * h;
4743
- const boundary = new Uint8Array(n);
4744
- let any = false;
4864
+ function magicWand(pixels, seed, options = {}) {
4865
+ const n = checkPixels(pixels);
4866
+ const { width: w, height: h } = pixels;
4867
+ const sx = Math.floor(seed.x);
4868
+ const sy = Math.floor(seed.y);
4869
+ if (!(sx >= 0 && sy >= 0 && sx < w && sy < h)) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h);
4870
+ const similar = similarity(pixels, sy * w + sx, _nullishCoalesce(options.tolerance, () => ( 32)), _nullishCoalesce(options.distance, () => ( "rgb")));
4871
+ const marks = new Uint8Array(n);
4872
+ let bx0 = w;
4873
+ let by0 = h;
4874
+ let bx1 = -1;
4875
+ let by1 = -1;
4876
+ if (_nullishCoalesce(options.contiguous, () => ( true))) {
4877
+ const stack = [sy * w + sx];
4878
+ while (stack.length) {
4879
+ const idx = stack.pop();
4880
+ if (marks[idx]) continue;
4881
+ const y = idx / w | 0;
4882
+ const row = y * w;
4883
+ let l = idx - row;
4884
+ let r = l;
4885
+ while (l > 0 && !marks[row + l - 1] && similar(row + l - 1)) l--;
4886
+ while (r + 1 < w && !marks[row + r + 1] && similar(row + r + 1)) r++;
4887
+ marks.fill(255, row + l, row + r + 1);
4888
+ if (l < bx0) bx0 = l;
4889
+ if (r > bx1) bx1 = r;
4890
+ if (y < by0) by0 = y;
4891
+ if (y > by1) by1 = y;
4892
+ for (const ny of [y - 1, y + 1]) {
4893
+ if (ny < 0 || ny >= h) continue;
4894
+ const nrow = ny * w;
4895
+ let inRun = false;
4896
+ for (let nx = l; nx <= r; nx++) {
4897
+ const ok = !marks[nrow + nx] && similar(nrow + nx);
4898
+ if (ok && !inRun) stack.push(nrow + nx);
4899
+ inRun = ok;
4900
+ }
4901
+ }
4902
+ }
4903
+ } else {
4745
4904
  for (let y = 0; y < h; y++) {
4905
+ const row = y * w;
4746
4906
  for (let x = 0; x < w; x++) {
4747
- const i = y * w + x;
4748
- const v = m[i] >= 0.5;
4749
- const diff = x > 0 && m[i - 1] >= 0.5 !== v || x + 1 < w && m[i + 1] >= 0.5 !== v || y > 0 && m[i - w] >= 0.5 !== v || y + 1 < h && m[i + w] >= 0.5 !== v;
4750
- if (diff) {
4751
- boundary[i] = 1;
4752
- any = true;
4907
+ if (similar(row + x)) {
4908
+ marks[row + x] = 255;
4909
+ if (x < bx0) bx0 = x;
4910
+ if (x > bx1) bx1 = x;
4911
+ if (y < by0) by0 = y;
4912
+ if (y > by1) by1 = y;
4753
4913
  }
4754
4914
  }
4755
4915
  }
4756
- if (any) {
4757
- const dist = _chunkUYXL6ZWQcjs.distanceTransform.call(void 0, boundary, w, h);
4758
- const r = gfRadius(p);
4759
- const q = guidedFilterColor(guide, m, w, h, r);
4760
- const widths = p.smartRadius ? edgeWidth(guide, w, h, r) : null;
4761
- for (let i = 0; i < n; i++) {
4762
- const reff = widths ? Math.min(Math.max(p.radius, 1.5), Math.max(1.5, widths[i])) : p.radius;
4763
- const wgt = Math.min(1, Math.max(0, reff + 1 - dist[i]));
4764
- if (wgt > 0) {
4765
- const qi = Math.min(1, Math.max(0, q[i]));
4766
- a[i] = m[i] + (qi - m[i]) * wgt;
4767
- }
4916
+ }
4917
+ if (bx1 < 0) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h);
4918
+ if (!(_nullishCoalesce(options.antiAlias, () => ( true)))) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h, marks);
4919
+ return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0,
4920
+ w,
4921
+ h,
4922
+ antialiasMarks(marks, w, h, Math.max(0, bx0 - 1), Math.max(0, by0 - 1), Math.min(w, bx1 + 2), Math.min(h, by1 + 2))
4923
+ );
4924
+ }
4925
+ function sampleColor(c) {
4926
+ if (typeof c === "string") {
4927
+ const m = /^#?([0-9a-f]{6})$/i.exec(c.trim());
4928
+ if (!m) throw new Error(`Invalid colour "${c}"`);
4929
+ const v = parseInt(m[1], 16);
4930
+ return [v >> 16 & 255, v >> 8 & 255, v & 255];
4931
+ }
4932
+ return [c[0], c[1], c[2]];
4933
+ }
4934
+ function colorRange(pixels, samples, options = {}) {
4935
+ const n = checkPixels(pixels);
4936
+ const { width: w, height: h, data } = pixels;
4937
+ const f = Math.max(0, _nullishCoalesce(options.fuzziness, () => ( 40))) + 1;
4938
+ const parsed = samples.map((s) => ({ c: sampleColor(s.color), at: s.at }));
4939
+ const radius = options.localized !== void 0 ? Math.max(1, options.localized) : void 0;
4940
+ const out = new Uint8Array(n);
4941
+ if (!parsed.length) return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h, out);
4942
+ for (let i = 0; i < n; i++) {
4943
+ const p = i * 4;
4944
+ if (data[p + 3] <= 0) continue;
4945
+ const x = i % w;
4946
+ const y = (i - x) / w;
4947
+ let best = 0;
4948
+ for (const s of parsed) {
4949
+ const d = Math.max(Math.abs(data[p] - s.c[0]), Math.abs(data[p + 1] - s.c[1]), Math.abs(data[p + 2] - s.c[2]));
4950
+ let k = Math.min(1, Math.max(0, 1 - d / f));
4951
+ if (k > 0 && radius !== void 0 && s.at) {
4952
+ const dist = Math.hypot(x - s.at.x, y - s.at.y);
4953
+ k *= Math.min(1, Math.max(0, 1 - dist / radius));
4768
4954
  }
4955
+ if (k > best) best = k;
4769
4956
  }
4957
+ out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, best);
4770
4958
  }
4771
- const ss = smoothSigma(p);
4772
- if (ss >= 0.3) {
4773
- a = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, a, w, h, ss, "clamp");
4774
- const gain = 1 + ss;
4775
- for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
4959
+ return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h, out);
4960
+ }
4961
+ var TONE_RANGE_PRESETS = {
4962
+ shadows: [0, 65],
4963
+ midtones: [105, 150],
4964
+ highlights: [190, 255]
4965
+ };
4966
+ function toneRange(pixels, range, falloff = 20) {
4967
+ const n = checkPixels(pixels);
4968
+ const [lo, hi] = typeof range === "string" ? TONE_RANGE_PRESETS[range] : range;
4969
+ const ramp2 = Math.max(1e-3, falloff);
4970
+ const out = new Uint8Array(n);
4971
+ const d = pixels.data;
4972
+ for (let i = 0; i < n; i++) {
4973
+ const p = i * 4;
4974
+ if (d[p + 3] <= 0) continue;
4975
+ const l = Math.min(255, Math.max(0, 0.299 * d[p] + 0.587 * d[p + 1] + 0.114 * d[p + 2]));
4976
+ const outside = l < lo ? lo - l : l > hi ? l - hi : 0;
4977
+ out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, 1 - outside / ramp2);
4776
4978
  }
4777
- a = _chunkHGTDMKNEcjs.gaussianBlur.call(void 0, a, w, h, featherSigma(p), "clamp");
4778
- if (p.contrast > 0) {
4779
- const gain = 1 / (1 - 0.99 * p.contrast / 100);
4780
- for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
4979
+ return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height, out);
4980
+ }
4981
+ function hueRange(pixels, center) {
4982
+ const n = checkPixels(pixels);
4983
+ const out = new Uint8Array(n);
4984
+ const d = pixels.data;
4985
+ for (let i = 0; i < n; i++) {
4986
+ const p = i * 4;
4987
+ if (d[p + 3] <= 0) continue;
4988
+ const r = d[p] / 255;
4989
+ const g = d[p + 1] / 255;
4990
+ const b = d[p + 2] / 255;
4991
+ const mx = Math.max(r, g, b);
4992
+ const mn = Math.min(r, g, b);
4993
+ const chroma = mx - mn;
4994
+ if (chroma <= 0) continue;
4995
+ let hue;
4996
+ if (mx === r) hue = ((g - b) / chroma % 6 + 6) % 6;
4997
+ else if (mx === g) hue = (b - r) / chroma + 2;
4998
+ else hue = (r - g) / chroma + 4;
4999
+ hue *= 60;
5000
+ let dh = ((hue - center) % 360 + 360) % 360;
5001
+ dh = Math.min(dh, 360 - dh);
5002
+ out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, Math.min(1, Math.max(0, 1 - dh / 60)) * chroma * (2 - mx));
4781
5003
  }
4782
- const amount = shiftAmount(p);
4783
- if (Math.abs(amount) >= 1e-4) a = _chunkUYXL6ZWQcjs.shiftCoverage.call(void 0, a, w, h, amount);
4784
- return a;
5004
+ return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height, out);
4785
5005
  }
4786
- function guidePlanes(pixels, win) {
4787
- const box = _nullishCoalesce(win, () => ( { x: 0, y: 0, width: pixels.width, height: pixels.height }));
4788
- const n = box.width * box.height;
4789
- const r = new Float32Array(n);
4790
- const g = new Float32Array(n);
4791
- const b = new Float32Array(n);
5006
+ var HUE_RANGE_PRESETS = { reds: 0, yellows: 60, greens: 120, cyans: 180, blues: 240, magentas: 300 };
5007
+ var COLOR_RANGE_PRESETS = [
5008
+ ...Object.keys(HUE_RANGE_PRESETS),
5009
+ "highlights",
5010
+ "midtones",
5011
+ "shadows",
5012
+ "skinTones"
5013
+ ];
5014
+ function isColorRangePreset(v) {
5015
+ return typeof v === "string" && COLOR_RANGE_PRESETS.includes(v);
5016
+ }
5017
+ var ramp = (v, lo, hi, soft) => v < lo ? Math.max(0, 1 - (lo - v) / soft) : v > hi ? Math.max(0, 1 - (v - hi) / soft) : 1;
5018
+ function skinToneRange(pixels) {
5019
+ const n = checkPixels(pixels);
5020
+ const out = new Uint8Array(n);
4792
5021
  const d = pixels.data;
4793
- for (let y = 0; y < box.height; y++) {
4794
- for (let x = 0; x < box.width; x++) {
4795
- const i = y * box.width + x;
4796
- const p = ((box.y + y) * pixels.width + box.x + x) * 4;
4797
- r[i] = d[p] / 255;
4798
- g[i] = d[p + 1] / 255;
4799
- b[i] = d[p + 2] / 255;
5022
+ for (let i = 0; i < n; i++) {
5023
+ const p = i * 4;
5024
+ if (d[p + 3] <= 0) continue;
5025
+ const r = d[p] / 255;
5026
+ const g = d[p + 1] / 255;
5027
+ const b = d[p + 2] / 255;
5028
+ const mx = Math.max(r, g, b);
5029
+ const mn = Math.min(r, g, b);
5030
+ const chroma = mx - mn;
5031
+ if (chroma <= 0 || mx <= 0) continue;
5032
+ let hue;
5033
+ if (mx === r) hue = ((g - b) / chroma % 6 + 6) % 6;
5034
+ else if (mx === g) hue = (b - r) / chroma + 2;
5035
+ else hue = (r - g) / chroma + 4;
5036
+ hue *= 60;
5037
+ if (hue > 180) hue -= 360;
5038
+ const k = ramp(hue, 5, 40, 20) * ramp(chroma / mx, 0.12, 0.8, 0.1) * ramp(mx, 0.3, 1, 0.15);
5039
+ out[i] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, k);
5040
+ }
5041
+ return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height, out);
5042
+ }
5043
+ function colorRangePreset(pixels, preset, options = {}) {
5044
+ if (preset === "skinTones") return skinToneRange(pixels);
5045
+ if (preset === "highlights" || preset === "midtones" || preset === "shadows") return toneRange(pixels, preset, _nullishCoalesce(options.falloff, () => ( 20)));
5046
+ if (preset in HUE_RANGE_PRESETS) return hueRange(pixels, HUE_RANGE_PRESETS[preset]);
5047
+ throw new Error(`Unknown Color Range preset "${String(preset)}". Use one of ${COLOR_RANGE_PRESETS.join(", ")}.`);
5048
+ }
5049
+ function selectedColorBins(pixels, sel, tolerance) {
5050
+ const S = 64;
5051
+ let bins = new Uint8Array(S * S * S);
5052
+ const d = pixels.data;
5053
+ const n = pixels.width * pixels.height;
5054
+ for (let i = 0; i < n; i++) {
5055
+ if (sel.data[i] < 128 || d[i * 4 + 3] === 0) continue;
5056
+ bins[((d[i * 4] >> 2) * S + (d[i * 4 + 1] >> 2)) * S + (d[i * 4 + 2] >> 2)] = 1;
5057
+ }
5058
+ const r = Math.round(Math.max(0, tolerance) / 4);
5059
+ if (r === 0) return bins;
5060
+ for (const stride of [1, S, S * S]) {
5061
+ const out = new Uint8Array(bins.length);
5062
+ for (let i = 0; i < bins.length; i++) {
5063
+ if (!bins[i]) continue;
5064
+ const c = Math.floor(i / stride) % S;
5065
+ const lo = Math.max(0, c - r);
5066
+ const hi = Math.min(S - 1, c + r);
5067
+ const base = i - c * stride;
5068
+ for (let k = lo; k <= hi; k++) out[base + k * stride] = 1;
4800
5069
  }
5070
+ bins = out;
4801
5071
  }
4802
- return [r, g, b];
5072
+ return bins;
4803
5073
  }
4804
- function refineSelection(pixels, mask, params = {}) {
4805
- const p = normalizeRefineEdgeParams(params);
4806
- if (pixels && (pixels.width !== mask.width || pixels.height !== mask.height)) {
4807
- throw new Error("Refine Edge needs pixels the size of the selection");
5074
+ function matcher(pixels, sel, options) {
5075
+ if (sel.width !== pixels.width || sel.height !== pixels.height) throw new Error("The selection and the pixels differ in size");
5076
+ const bins = selectedColorBins(pixels, sel, _nullishCoalesce(options.tolerance, () => ( 32)));
5077
+ const d = pixels.data;
5078
+ return (i) => d[i * 4 + 3] > 0 && bins[((d[i * 4] >> 2 << 6) + (d[i * 4 + 1] >> 2)) * 64 + (d[i * 4 + 2] >> 2)] === 1;
5079
+ }
5080
+ function growSelection(pixels, sel, options = {}) {
5081
+ checkPixels(pixels);
5082
+ const match = matcher(pixels, sel, options);
5083
+ const { width: w, height: h } = pixels;
5084
+ const out = new Uint8Array(sel.data);
5085
+ const stack = [];
5086
+ for (let i = 0; i < out.length; i++) if (out[i] >= 128) stack.push(i);
5087
+ while (stack.length) {
5088
+ const i = stack.pop();
5089
+ const x = i % w;
5090
+ const y = (i - x) / w;
5091
+ const visit = (j) => {
5092
+ if (out[j] < 255 && match(j)) {
5093
+ out[j] = 255;
5094
+ stack.push(j);
5095
+ }
5096
+ };
5097
+ if (x > 0) visit(i - 1);
5098
+ if (x < w - 1) visit(i + 1);
5099
+ if (y > 0) visit(i - w);
5100
+ if (y < h - 1) visit(i + w);
4808
5101
  }
4809
- if (!mask.bounds) return mask;
4810
- const halo = refineEdgeHalo(p);
4811
- const x0 = Math.max(0, mask.bounds.x - halo);
4812
- const y0 = Math.max(0, mask.bounds.y - halo);
4813
- const x1 = Math.min(mask.width, mask.bounds.x + mask.bounds.width + halo);
4814
- const y1 = Math.min(mask.height, mask.bounds.y + mask.bounds.height + halo);
4815
- const ww = x1 - x0;
4816
- const wh = y1 - y0;
4817
- const m = new Float32Array(ww * wh);
4818
- for (let y = 0; y < wh; y++) {
4819
- const src = (y0 + y) * mask.width + x0;
4820
- for (let x = 0; x < ww; x++) m[y * ww + x] = mask.data[src + x] / 255;
5102
+ return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, w, h, out);
5103
+ }
5104
+ function selectSimilar(pixels, sel, options = {}) {
5105
+ const n = checkPixels(pixels);
5106
+ const match = matcher(pixels, sel, options);
5107
+ const out = new Uint8Array(sel.data);
5108
+ for (let i = 0; i < n; i++) if (match(i)) out[i] = 255;
5109
+ return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, pixels.width, pixels.height, out);
5110
+ }
5111
+
5112
+ // src/image-editor/selection/segmentation.ts
5113
+ var isPoint = (p) => !!p && typeof p === "object" && Number.isFinite(p.x) && Number.isFinite(p.y);
5114
+ function segmentationOutlines(result) {
5115
+ const p = result.polygon;
5116
+ if (!Array.isArray(p) || !p.length) return [];
5117
+ const rings = Array.isArray(p[0]) ? p : [p];
5118
+ return rings.map((ring) => Array.isArray(ring) ? ring.filter(isPoint) : []).filter((ring) => ring.length >= 3);
5119
+ }
5120
+ function segmentToSelection(width, height, result) {
5121
+ let out = null;
5122
+ for (const ring of segmentationOutlines(result)) {
5123
+ out = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, out, polygonSelection(width, height, ring), "add");
4821
5124
  }
4822
- const guide = pixels && p.radius > 0 ? guidePlanes(pixels, { x: x0, y: y0, width: ww, height: wh }) : null;
4823
- const refined = refineCoverage(guide, m, ww, wh, p);
4824
- const out = new Uint8Array(mask.width * mask.height);
4825
- for (let y = 0; y < wh; y++) {
4826
- const dst = (y0 + y) * mask.width + x0;
4827
- for (let x = 0; x < ww; x++) out[dst + x] = _chunkUYXL6ZWQcjs.coverageToByte.call(void 0, refined[y * ww + x]);
5125
+ if (result.mask && result.mask.width > 0 && result.mask.height > 0) {
5126
+ const raw = _chunkUYXL6ZWQcjs.selectionFromPixels.call(void 0, result.mask, { channel: "luminance" });
5127
+ const sized = raw.width === width && raw.height === height ? raw : _chunkUYXL6ZWQcjs.resizeSelection.call(void 0, raw, width, height);
5128
+ out = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, out, sized, "add");
4828
5129
  }
4829
- return _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, mask.width, mask.height, out);
5130
+ return _optionalChain([out, 'optionalAccess', _82 => _82.bounds]) ? out : null;
5131
+ }
5132
+ function segmentsToSelection(width, height, results) {
5133
+ let out = null;
5134
+ for (const r of results) {
5135
+ const sel = segmentToSelection(width, height, r);
5136
+ if (sel) out = _chunkUYXL6ZWQcjs.combineSelections.call(void 0, out, sel, "add");
5137
+ }
5138
+ return out;
4830
5139
  }
4831
5140
 
4832
5141
  // src/image-editor/selection/stroke.ts
@@ -4867,7 +5176,7 @@ function deserializeChannels(value, size, problems = []) {
4867
5176
  visible: v.visible === true
4868
5177
  });
4869
5178
  } catch (err) {
4870
- problems.push(`Alpha channel "${String(_nullishCoalesce(_optionalChain([v, 'optionalAccess', _81 => _81.name]), () => ( "?")))}" could not be read: ${err instanceof Error ? err.message : String(err)}.`);
5179
+ problems.push(`Alpha channel "${String(_nullishCoalesce(_optionalChain([v, 'optionalAccess', _83 => _83.name]), () => ( "?")))}" could not be read: ${err instanceof Error ? err.message : String(err)}.`);
4871
5180
  }
4872
5181
  }
4873
5182
  return out;
@@ -4905,16 +5214,16 @@ function checkEffectTime(time) {
4905
5214
  return time;
4906
5215
  }
4907
5216
  function checkEffectAnimation(animate) {
4908
- const duration = _optionalChain([animate, 'optionalAccess', _82 => _82.duration]);
5217
+ const duration = _optionalChain([animate, 'optionalAccess', _84 => _84.duration]);
4909
5218
  if (!(typeof duration === "number" && Number.isFinite(duration) && duration > 0 && duration <= _chunkUYXL6ZWQcjs.MAX_EFFECT_ANIMATION_MS)) {
4910
5219
  throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`animate.duration must be more than 0 and at most ${_chunkUYXL6ZWQcjs.MAX_EFFECT_ANIMATION_MS} ms.`);
4911
5220
  }
4912
5221
  return { duration: Math.round(duration) };
4913
5222
  }
4914
5223
  function effectLayerTiming(g, d) {
4915
- if (!_optionalChain([d, 'optionalAccess', _83 => _83.duration])) return null;
5224
+ if (!_optionalChain([d, 'optionalAccess', _85 => _85.duration])) return null;
4916
5225
  const time = _nullishCoalesce(g.time, () => ( 0));
4917
- return { mode: g.animate ? "animate" : "still", time, range: Math.max(d.duration, time), duration: _nullishCoalesce(_optionalChain([g, 'access', _84 => _84.animate, 'optionalAccess', _85 => _85.duration]), () => ( d.duration)), loops: d.loop };
5226
+ return { mode: g.animate ? "animate" : "still", time, range: Math.max(d.duration, time), duration: _nullishCoalesce(_optionalChain([g, 'access', _86 => _86.animate, 'optionalAccess', _87 => _87.duration]), () => ( d.duration)), loops: d.loop };
4918
5227
  }
4919
5228
 
4920
5229
  // src/image-editor/effects.ts
@@ -5167,14 +5476,14 @@ var FreeTransformSession = (_class11 = class {
5167
5476
  if (init.interpolation !== void 0 && !_chunkHGTDMKNEcjs.isInterpolation.call(void 0, init.interpolation)) fail(`Unknown interpolation "${String(init.interpolation)}"; use nearest, bilinear or bicubic.`);
5168
5477
  this.interp = _nullishCoalesce(init.interpolation, () => ( "bicubic"));
5169
5478
  const sel = host.selection();
5170
- const selected = Boolean(_optionalChain([sel, 'optionalAccess', _86 => _86.bounds]));
5479
+ const selected = Boolean(_optionalChain([sel, 'optionalAccess', _88 => _88.bounds]));
5171
5480
  let content = _nullishCoalesce(init.content, () => ( "auto"));
5172
5481
  if (!["auto", "layer", "selection", "selection-copy", "selection-outline"].includes(content)) {
5173
5482
  fail(`Unknown content "${String(content)}"; use auto, layer, selection, selection-copy or selection-outline.`);
5174
5483
  }
5175
5484
  const targetId = _nullishCoalesce(init.layerId, () => ( host.activeLayerId()));
5176
- const target = targetId && content !== "selection-outline" ? _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, host.layers(), targetId), 'optionalAccess', _87 => _87.layer]) : void 0;
5177
- const smartTarget = (_optionalChain([target, 'optionalAccess', _88 => _88.type]) === "smart" || _optionalChain([target, 'optionalAccess', _89 => _89.type]) === "shape" || _optionalChain([target, 'optionalAccess', _90 => _90.type]) === "type") && (_nullishCoalesce(init.channel, () => ( (target.id === host.activeLayerId() ? host.activeTarget() : "pixels")))) !== "mask";
5485
+ const target = targetId && content !== "selection-outline" ? _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, host.layers(), targetId), 'optionalAccess', _89 => _89.layer]) : void 0;
5486
+ const smartTarget = (_optionalChain([target, 'optionalAccess', _90 => _90.type]) === "smart" || _optionalChain([target, 'optionalAccess', _91 => _91.type]) === "shape" || _optionalChain([target, 'optionalAccess', _92 => _92.type]) === "type") && (_nullishCoalesce(init.channel, () => ( (target.id === host.activeLayerId() ? host.activeTarget() : "pixels")))) !== "mask";
5178
5487
  if (content === "auto") content = selected && !smartTarget ? "selection" : "layer";
5179
5488
  this.content = content;
5180
5489
  if (content !== "layer" && !selected) fail(`Nothing is selected; ${content} needs a selection. Select first, or use content layer.`);
@@ -5198,9 +5507,9 @@ var FreeTransformSession = (_class11 = class {
5198
5507
  const mask = layer.mask && !layer.mask.source ? layer.mask : void 0;
5199
5508
  const channel = _nullishCoalesce(init.channel, () => ( (layer.id === host.activeLayerId() ? host.activeTarget() : "pixels")));
5200
5509
  if (channel !== "pixels" && channel !== "mask") fail(`Unknown channel "${String(channel)}"; use pixels or mask.`);
5201
- const linked = _optionalChain([mask, 'optionalAccess', _91 => _91.linked]) !== false;
5510
+ const linked = _optionalChain([mask, 'optionalAccess', _93 => _93.linked]) !== false;
5202
5511
  const maskAlone = channel === "mask" && (!linked || layer.type !== "pixel");
5203
- if (channel === "mask" && !mask) fail(_optionalChain([layer, 'access', _92 => _92.mask, 'optionalAccess', _93 => _93.source]) ? `Layer "${layer.name || id}" has a depth mask, which is generated, not transformed.` : `Layer "${layer.name || id}" has no mask to transform; add one with add_layer_mask, or transform its pixels.`);
5512
+ if (channel === "mask" && !mask) fail(_optionalChain([layer, 'access', _94 => _94.mask, 'optionalAccess', _95 => _95.source]) ? `Layer "${layer.name || id}" has a depth mask, which is generated, not transformed.` : `Layer "${layer.name || id}" has no mask to transform; add one with add_layer_mask, or transform its pixels.`);
5204
5513
  if (!maskAlone && layer.type !== "pixel" && layer.type !== "smart" && layer.type !== "shape" && layer.type !== "type") fail(`Layer "${layer.name || id}" is a ${layer.type} layer; Free Transform works on pixel, shape, type and smart object layers, layer masks (channel mask) and selections.`);
5205
5514
  if (!layer.visible && content !== "selection-copy") fail(`Layer "${layer.name || id}" is hidden; show it before you transform it.`);
5206
5515
  if (content !== "selection-copy") {
@@ -5303,7 +5612,7 @@ var FreeTransformSession = (_class11 = class {
5303
5612
  };
5304
5613
  this.copyId = copy.id;
5305
5614
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, layers, layer.id);
5306
- this.startLayers = _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _94 => _94.parent, 'optionalAccess', _95 => _95.id]), () => ( null)), loc.index + 1);
5615
+ this.startLayers = _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _96 => _96.parent, 'optionalAccess', _97 => _97.id]), () => ( null)), loc.index + 1);
5307
5616
  this.parts.push({ what: "pixels", offset: o, moving: lifted, base: null, reduced: /* @__PURE__ */ new Map() });
5308
5617
  moves.push("pixels");
5309
5618
  }
@@ -5412,7 +5721,7 @@ var FreeTransformSession = (_class11 = class {
5412
5721
  moveVectorMask(layers) {
5413
5722
  const g = this.geometryValue;
5414
5723
  if (!this.layerId || this.copyId || !this.moves.includes("pixels") || _chunkUYXL6ZWQcjs.isIdentityTransform.call(void 0, g)) return layers;
5415
- const vm = _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, layers, this.layerId), 'optionalAccess', _96 => _96.layer, 'access', _97 => _97.vectorMask]);
5724
+ const vm = _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, layers, this.layerId), 'optionalAccess', _98 => _98.layer, 'access', _99 => _99.vectorMask]);
5416
5725
  if (!vm || vm.linked === false) return layers;
5417
5726
  const warp = _chunkUYXL6ZWQcjs.hasWarp.call(void 0, g);
5418
5727
  const f = warp ? _chunkUYXL6ZWQcjs.transformMap.call(void 0, g) : null;
@@ -5583,11 +5892,11 @@ var FreeTransformSession = (_class11 = class {
5583
5892
  result(changed, layers, selection) {
5584
5893
  let bounds = null;
5585
5894
  const id = _nullishCoalesce(this.copyId, () => ( this.layerId));
5586
- const layer = id ? _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _98 => _98.layer]) : void 0;
5587
- if (this.moves.includes("pixels") && _optionalChain([layer, 'optionalAccess', _99 => _99.type]) === "pixel") bounds = toDoc(_chunkCWM3CUUXcjs.contentBounds.call(void 0, this.host.pixelsOf(layer)), layer.offset);
5588
- else if (this.moves.includes("pixels") && (_optionalChain([layer, 'optionalAccess', _100 => _100.type]) === "smart" || _optionalChain([layer, 'optionalAccess', _101 => _101.type]) === "shape" || _optionalChain([layer, 'optionalAccess', _102 => _102.type]) === "type")) bounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
5589
- else if (this.moves.includes("mask") && _optionalChain([layer, 'optionalAccess', _103 => _103.mask])) bounds = toDoc(_chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.mask.surface), layer.type === "pixel" ? layer.offset : { x: 0, y: 0 });
5590
- else if (this.moves.includes("selection")) bounds = _optionalChain([selection, 'optionalAccess', _104 => _104.bounds]) ? { ...selection.bounds } : null;
5895
+ const layer = id ? _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _100 => _100.layer]) : void 0;
5896
+ if (this.moves.includes("pixels") && _optionalChain([layer, 'optionalAccess', _101 => _101.type]) === "pixel") bounds = toDoc(_chunkCWM3CUUXcjs.contentBounds.call(void 0, this.host.pixelsOf(layer)), layer.offset);
5897
+ else if (this.moves.includes("pixels") && (_optionalChain([layer, 'optionalAccess', _102 => _102.type]) === "smart" || _optionalChain([layer, 'optionalAccess', _103 => _103.type]) === "shape" || _optionalChain([layer, 'optionalAccess', _104 => _104.type]) === "type")) bounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
5898
+ else if (this.moves.includes("mask") && _optionalChain([layer, 'optionalAccess', _105 => _105.mask])) bounds = toDoc(_chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.mask.surface), layer.type === "pixel" ? layer.offset : { x: 0, y: 0 });
5899
+ else if (this.moves.includes("selection")) bounds = _optionalChain([selection, 'optionalAccess', _106 => _106.bounds]) ? { ...selection.bounds } : null;
5591
5900
  return {
5592
5901
  layerId: _nullishCoalesce(this.copyId, () => ( this.layerId)),
5593
5902
  content: this.content,
@@ -5616,7 +5925,7 @@ function deserializeColorMode(raw, problems) {
5616
5925
  }
5617
5926
  function effectiveProof(proof, mode) {
5618
5927
  if (proof) return proof;
5619
- if (_optionalChain([mode, 'optionalAccess', _105 => _105.mode]) === "cmyk") return { ...DEFAULT_PROOF, profile: mode.profile, intent: mode.intent };
5928
+ if (_optionalChain([mode, 'optionalAccess', _107 => _107.mode]) === "cmyk") return { ...DEFAULT_PROOF, profile: mode.profile, intent: mode.intent };
5620
5929
  return null;
5621
5930
  }
5622
5931
  function colorModePlanes(doc, mode) {
@@ -5671,7 +5980,7 @@ function resolveProfile(doc) {
5671
5980
  return p;
5672
5981
  }
5673
5982
  function profileBytes(doc) {
5674
- if (_optionalChain([doc, 'optionalAccess', _106 => _106.icc])) return doc.icc;
5983
+ if (_optionalChain([doc, 'optionalAccess', _108 => _108.icc])) return doc.icc;
5675
5984
  const p = resolveProfile(doc);
5676
5985
  return _nullishCoalesce(p.bytes, () => ( _chunkBROJYMWUcjs.encodeProfile.call(void 0, p)));
5677
5986
  }
@@ -5833,7 +6142,7 @@ function paintCoverageInto(base, coverage, apply, rects, depth = null) {
5833
6142
  else tiles.delete(key);
5834
6143
  continue;
5835
6144
  }
5836
- const src = _nullishCoalesce(_optionalChain([base, 'access', _107 => _107.tiles, 'access', _108 => _108.get, 'call', _109 => _109(key), 'optionalAccess', _110 => _110.data]), () => ( defaultTile(base)));
6145
+ const src = _nullishCoalesce(_optionalChain([base, 'access', _109 => _109.tiles, 'access', _110 => _110.get, 'call', _111 => _111(key), 'optionalAccess', _112 => _112.data]), () => ( defaultTile(base)));
5837
6146
  const data = _chunkEBDCRTZIcjs.applyStrokeToTile.call(void 0, coverage, src, base.channels, t.tx, t.ty, apply);
5838
6147
  const tile = _chunkCWM3CUUXcjs.finishTile.call(void 0, data, base.channels, base.defaultValue);
5839
6148
  if (tile) tiles.set(key, tile);
@@ -5946,7 +6255,7 @@ var PaintStrokeSession = (_class12 = class {
5946
6255
  writeTile: (tx, ty) => {
5947
6256
  const key = _chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty);
5948
6257
  if (!this.touched.has(key)) {
5949
- this.work.set(key, _nullishCoalesce(_optionalChain([read, 'call', _111 => _111(key), 'optionalAccess', _112 => _112.slice, 'call', _113 => _113()]), () => ( new Float32Array(_chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE * 4))));
6258
+ this.work.set(key, _nullishCoalesce(_optionalChain([read, 'call', _113 => _113(key), 'optionalAccess', _114 => _114.slice, 'call', _115 => _115()]), () => ( new Float32Array(_chunkCWM3CUUXcjs.TILE * _chunkCWM3CUUXcjs.TILE * 4))));
5950
6259
  this.touched.add(key);
5951
6260
  }
5952
6261
  this.fresh.add(key);
@@ -5958,11 +6267,11 @@ var PaintStrokeSession = (_class12 = class {
5958
6267
  offset: a.offset,
5959
6268
  lockTransparency: a.lockTransparency,
5960
6269
  selection: a.selection,
5961
- readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _114 => _114.live, 'access', _115 => _115.get, 'call', _116 => _116(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _117 => _117.data]), () => ( (this.base.defaultValue ? defaultTile(this.base) : null))),
6270
+ readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _116 => _116.live, 'access', _117 => _117.get, 'call', _118 => _118(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _119 => _119.data]), () => ( (this.base.defaultValue ? defaultTile(this.base) : null))),
5962
6271
  writeTile: (tx, ty) => {
5963
6272
  const key = _chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty);
5964
6273
  if (!this.touched.has(key)) {
5965
- const src = _nullishCoalesce(_optionalChain([this, 'access', _118 => _118.base, 'access', _119 => _119.tiles, 'access', _120 => _120.get, 'call', _121 => _121(key), 'optionalAccess', _122 => _122.data]), () => ( defaultTile(this.base)));
6274
+ const src = _nullishCoalesce(_optionalChain([this, 'access', _120 => _120.base, 'access', _121 => _121.tiles, 'access', _122 => _122.get, 'call', _123 => _123(key), 'optionalAccess', _124 => _124.data]), () => ( defaultTile(this.base)));
5966
6275
  this.live.set(key, { data: new Uint8ClampedArray(src), uniform: null });
5967
6276
  this.touched.add(key);
5968
6277
  }
@@ -5979,11 +6288,11 @@ var PaintStrokeSession = (_class12 = class {
5979
6288
  if (this.closed || !points.length) return;
5980
6289
  if (!this.started) {
5981
6290
  this.started = true;
5982
- if (_optionalChain([this, 'access', _123 => _123.retouch, 'optionalAccess', _124 => _124.kind]) === "coverage") this.retouch.start(points[0]);
6291
+ if (_optionalChain([this, 'access', _125 => _125.retouch, 'optionalAccess', _126 => _126.kind]) === "coverage") this.retouch.start(points[0]);
5983
6292
  }
5984
6293
  this.last = points[points.length - 1];
5985
6294
  const rects = this.mixer ? this.mixer.push(points) : this.stroke.push(points);
5986
- _optionalChain([this, 'access', _125 => _125.flushView, 'optionalCall', _126 => _126()]);
6295
+ _optionalChain([this, 'access', _127 => _127.flushView, 'optionalCall', _128 => _128()]);
5987
6296
  this.update(rects);
5988
6297
  }
5989
6298
  update(rects) {
@@ -6013,7 +6322,7 @@ var PaintStrokeSession = (_class12 = class {
6013
6322
  for (const [key, { tx, ty, r }] of regions) {
6014
6323
  if (this.deep) {
6015
6324
  const rt = this.retouch;
6016
- const paint = _optionalChain([rt, 'optionalAccess', _127 => _127.kind]) === "coverage" ? rt.paint() : null;
6325
+ const paint = _optionalChain([rt, 'optionalAccess', _129 => _129.kind]) === "coverage" ? rt.paint() : null;
6017
6326
  if (paint && paint.kind !== "tone") {
6018
6327
  const prevWork = this.touched.has(key) ? this.work.get(key) : void 0;
6019
6328
  this.touched.add(key);
@@ -6024,13 +6333,13 @@ var PaintStrokeSession = (_class12 = class {
6024
6333
  const prev2 = this.touched.has(key) ? this.liveDeep.get(key) : void 0;
6025
6334
  this.touched.add(key);
6026
6335
  const opts = prev2 ? { into: prev2, region: r, channels: ch } : { channels: ch };
6027
- const d = _optionalChain([rt, 'optionalAccess', _128 => _128.kind]) === "coverage" && _optionalChain([paint, 'optionalAccess', _129 => _129.kind]) === "tone" ? _chunk7NW46N7Icjs.applyToneToDeepTile.call(void 0, stroke.coverage, src2, tx, ty, paint.tone, rt.apply, opts) : _chunkEBDCRTZIcjs.applyStrokeToDeepTile.call(void 0, stroke.coverage, src2, tx, ty, this.apply, opts);
6336
+ const d = _optionalChain([rt, 'optionalAccess', _130 => _130.kind]) === "coverage" && _optionalChain([paint, 'optionalAccess', _131 => _131.kind]) === "tone" ? _chunk7NW46N7Icjs.applyToneToDeepTile.call(void 0, stroke.coverage, src2, tx, ty, paint.tone, rt.apply, opts) : _chunkEBDCRTZIcjs.applyStrokeToDeepTile.call(void 0, stroke.coverage, src2, tx, ty, this.apply, opts);
6028
6337
  this.liveDeep.set(key, d);
6029
6338
  this.live.set(key, { data: _chunkCWM3CUUXcjs.proxyOf.call(void 0, d, ch), uniform: null, deep: d });
6030
6339
  continue;
6031
6340
  }
6032
- const src = _nullishCoalesce(_optionalChain([this, 'access', _130 => _130.base, 'access', _131 => _131.tiles, 'access', _132 => _132.get, 'call', _133 => _133(key), 'optionalAccess', _134 => _134.data]), () => ( defaultTile(this.base)));
6033
- const prev = this.touched.has(key) ? _optionalChain([this, 'access', _135 => _135.live, 'access', _136 => _136.get, 'call', _137 => _137(key), 'optionalAccess', _138 => _138.data]) : void 0;
6341
+ const src = _nullishCoalesce(_optionalChain([this, 'access', _132 => _132.base, 'access', _133 => _133.tiles, 'access', _134 => _134.get, 'call', _135 => _135(key), 'optionalAccess', _136 => _136.data]), () => ( defaultTile(this.base)));
6342
+ const prev = this.touched.has(key) ? _optionalChain([this, 'access', _137 => _137.live, 'access', _138 => _138.get, 'call', _139 => _139(key), 'optionalAccess', _140 => _140.data]) : void 0;
6034
6343
  this.touched.add(key);
6035
6344
  const data = this.compositeTile(src, tx, ty, prev ? { into: prev, region: r } : {});
6036
6345
  this.live.set(key, { data, uniform: null });
@@ -6042,12 +6351,12 @@ var PaintStrokeSession = (_class12 = class {
6042
6351
  if (this.closed) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("This stroke has already ended.");
6043
6352
  const last = _nullishCoalesce(this.last, () => ( void 0));
6044
6353
  const rects = this.mixer ? this.mixer.finish(last) : this.stroke.finish(last);
6045
- _optionalChain([this, 'access', _139 => _139.flushView, 'optionalCall', _140 => _140()]);
6354
+ _optionalChain([this, 'access', _141 => _141.flushView, 'optionalCall', _142 => _142()]);
6046
6355
  this.update(rects);
6047
6356
  this.closed = true;
6048
6357
  const ch = this.base.channels;
6049
6358
  const r = this.retouch;
6050
- if (_optionalChain([r, 'optionalAccess', _141 => _141.kind]) === "coverage" && r.finalPaint) {
6359
+ if (_optionalChain([r, 'optionalAccess', _143 => _143.kind]) === "coverage" && r.finalPaint) {
6051
6360
  const final = r.finalPaint(this.stroke.coverage);
6052
6361
  if (final) {
6053
6362
  for (const key of this.touched) {
@@ -6056,7 +6365,7 @@ var PaintStrokeSession = (_class12 = class {
6056
6365
  this.retouchDeepTile(key, tx, ty, final, {});
6057
6366
  continue;
6058
6367
  }
6059
- const src = _nullishCoalesce(_optionalChain([this, 'access', _142 => _142.base, 'access', _143 => _143.tiles, 'access', _144 => _144.get, 'call', _145 => _145(key), 'optionalAccess', _146 => _146.data]), () => ( defaultTile(this.base)));
6368
+ const src = _nullishCoalesce(_optionalChain([this, 'access', _144 => _144.base, 'access', _145 => _145.tiles, 'access', _146 => _146.get, 'call', _147 => _147(key), 'optionalAccess', _148 => _148.data]), () => ( defaultTile(this.base)));
6060
6369
  this.live.set(key, { data: this.compositeTile(src, tx, ty, {}, final), uniform: null });
6061
6370
  }
6062
6371
  }
@@ -6078,7 +6387,7 @@ var PaintStrokeSession = (_class12 = class {
6078
6387
  const b = this.mixer ? this.mixer.bounds : this.stroke.coverage.bounds;
6079
6388
  const result = { layerId: this.target.id, channel: this.target.channel, bounds: changed ? b : null, dabs: (_nullishCoalesce(this.mixer, () => ( this.stroke))).dabCount };
6080
6389
  if (mixerLoad) result.mixerLoad = mixerLoad;
6081
- if (_optionalChain([r, 'optionalAccess', _147 => _147.result])) Object.assign(result, r.result());
6390
+ if (_optionalChain([r, 'optionalAccess', _149 => _149.result])) Object.assign(result, r.result());
6082
6391
  return result;
6083
6392
  }
6084
6393
  /** Abandons the stroke and restores the layer. */
@@ -6204,14 +6513,14 @@ function migrateSerializedImageEditorState(data) {
6204
6513
  const legacy = data;
6205
6514
  const adjustments = normalizeStoredAdjustments(legacy.adjustments);
6206
6515
  return {
6207
- version: _optionalChain([adjustments, 'access', _148 => _148.layers, 'optionalAccess', _149 => _149.length]) ? 2 : 1,
6516
+ version: _optionalChain([adjustments, 'access', _150 => _150.layers, 'optionalAccess', _151 => _151.length]) ? 2 : 1,
6208
6517
  crop: legacy.crop ? { ...legacy.crop } : null,
6209
6518
  transform: { ...DEFAULT_TRANSFORM, ...legacy.transform },
6210
6519
  adjustments: serializeAdjustments(adjustments),
6211
6520
  depthMask: {
6212
6521
  ...DEFAULT_DEPTH_MASK,
6213
6522
  ...legacy.depthMask,
6214
- depthRange: [..._nullishCoalesce(_optionalChain([legacy, 'access', _150 => _150.depthMask, 'optionalAccess', _151 => _151.depthRange]), () => ( DEFAULT_DEPTH_MASK.depthRange))]
6523
+ depthRange: [..._nullishCoalesce(_optionalChain([legacy, 'access', _152 => _152.depthMask, 'optionalAccess', _153 => _153.depthRange]), () => ( DEFAULT_DEPTH_MASK.depthRange))]
6215
6524
  },
6216
6525
  annotations: JSON.parse(JSON.stringify(_nullishCoalesce(legacy.annotations, () => ( [])))),
6217
6526
  ...legacy.selection ? { selection: { ...legacy.selection } } : {}
@@ -6287,7 +6596,7 @@ var ImageEditorController = (_class13 = class {
6287
6596
  sourceIsOpaque: () => this.sourceIsOpaque(),
6288
6597
  version: () => `${this.sourceVersion()}:${this.patternsVersion()}`,
6289
6598
  globalLight: () => this.state.globalLight,
6290
- pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _152 => _152.state, 'access', _153 => _153.patterns, 'optionalAccess', _154 => _154.find, 'call', _155 => _155((p) => p.id === id)]), () => ( null))
6599
+ pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _154 => _154.state, 'access', _155 => _155.patterns, 'optionalAccess', _156 => _156.find, 'call', _157 => _157((p) => p.id === id)]), () => ( null))
6291
6600
  };
6292
6601
  this.state = {
6293
6602
  sourceUrl: typeof options.image === "string" ? options.image : null,
@@ -6320,13 +6629,13 @@ var ImageEditorController = (_class13 = class {
6320
6629
  };
6321
6630
  }
6322
6631
  this.applyStored(_nullishCoalesce(options.initialState, () => ( {})));
6323
- if (_optionalChain([options, 'access', _156 => _156.initialState, 'optionalAccess', _157 => _157.selection])) {
6632
+ if (_optionalChain([options, 'access', _158 => _158.initialState, 'optionalAccess', _159 => _159.selection])) {
6324
6633
  try {
6325
6634
  this.state.selection = normalizeSelection(_chunkUYXL6ZWQcjs.deserializeSelection.call(void 0, options.initialState.selection));
6326
6635
  } catch (e20) {
6327
6636
  }
6328
6637
  }
6329
- if (_optionalChain([options, 'access', _158 => _158.initialState, 'optionalAccess', _159 => _159.channels])) {
6638
+ if (_optionalChain([options, 'access', _160 => _160.initialState, 'optionalAccess', _161 => _161.channels])) {
6330
6639
  const channels = deserializeChannels(options.initialState.channels, this.naturalSize, this.lastLoadProblems);
6331
6640
  if (channels.length) this.state.channels = channels;
6332
6641
  }
@@ -6410,7 +6719,7 @@ var ImageEditorController = (_class13 = class {
6410
6719
  this.syncViews();
6411
6720
  this.syncDisplay();
6412
6721
  const currentState = { ...this.state };
6413
- _optionalChain([this, 'access', _160 => _160.onStateChange, 'optionalCall', _161 => _161(currentState)]);
6722
+ _optionalChain([this, 'access', _162 => _162.onStateChange, 'optionalCall', _163 => _163(currentState)]);
6414
6723
  this.listeners.forEach((l) => l(currentState));
6415
6724
  if (this.effects.provider) this.queueEffectRefresh("incomplete");
6416
6725
  }
@@ -6439,7 +6748,7 @@ var ImageEditorController = (_class13 = class {
6439
6748
  if (l.type === "group") {
6440
6749
  const children = walk(l.children);
6441
6750
  if (children !== l.children) next2 = { ...l, children };
6442
- } else if (l.type === "smart" && _optionalChain([l, 'access', _162 => _162.smartFilters, 'optionalAccess', _163 => _163.filters, 'access', _164 => _164.some, 'call', _165 => _165((f) => f.kind === "effect")]) && (all || _chunkUYXL6ZWQcjs.isSmartSurfaceIncomplete.call(void 0, l.surface))) {
6751
+ } else if (l.type === "smart" && _optionalChain([l, 'access', _164 => _164.smartFilters, 'optionalAccess', _165 => _165.filters, 'access', _166 => _166.some, 'call', _167 => _167((f) => f.kind === "effect")]) && (all || _chunkUYXL6ZWQcjs.isSmartSurfaceIncomplete.call(void 0, l.surface))) {
6443
6752
  try {
6444
6753
  const r = _chunkUYXL6ZWQcjs.rerender.call(void 0, l, canvas);
6445
6754
  if (all || !_chunkUYXL6ZWQcjs.isSmartSurfaceIncomplete.call(void 0, r.surface)) next2 = r;
@@ -6459,7 +6768,7 @@ var ImageEditorController = (_class13 = class {
6459
6768
  this.state.layers = next;
6460
6769
  this.notify();
6461
6770
  }
6462
- /** The registered segmentation provider, or `null` (then `selectSubject` is unavailable). */
6771
+ /** The registered segmentation provider, or `null` (then `selectSubject` finds the most salient subject without a model). */
6463
6772
  get segmentationProvider() {
6464
6773
  return this.segmentation;
6465
6774
  }
@@ -6535,8 +6844,8 @@ var ImageEditorController = (_class13 = class {
6535
6844
  */
6536
6845
  async updateEffectFilter(layerId, filterId, changes, commitToHistory = true) {
6537
6846
  const layer = _chunkUYXL6ZWQcjs.requireSmartObject.call(void 0, this.state.layers, layerId);
6538
- const was = _optionalChain([layer, 'access', _166 => _166.smartFilters, 'optionalAccess', _167 => _167.filters, 'access', _168 => _168.find, 'call', _169 => _169((f) => f.id === filterId)]);
6539
- if (!was || was.kind !== "effect") throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Smart object "${layer.name || layerId}" has no effect filter "${filterId}"; its filters are ${(_nullishCoalesce(_optionalChain([layer, 'access', _170 => _170.smartFilters, 'optionalAccess', _171 => _171.filters]), () => ( []))).map((f) => `${f.id} (${f.kind === "effect" ? _nullishCoalesce(f.name, () => ( f.effect)) : f.kind})`).join(", ") || "none"}.`);
6847
+ const was = _optionalChain([layer, 'access', _168 => _168.smartFilters, 'optionalAccess', _169 => _169.filters, 'access', _170 => _170.find, 'call', _171 => _171((f) => f.id === filterId)]);
6848
+ if (!was || was.kind !== "effect") throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Smart object "${layer.name || layerId}" has no effect filter "${filterId}"; its filters are ${(_nullishCoalesce(_optionalChain([layer, 'access', _172 => _172.smartFilters, 'optionalAccess', _173 => _173.filters]), () => ( []))).map((f) => `${f.id} (${f.kind === "effect" ? _nullishCoalesce(f.name, () => ( f.effect)) : f.kind})`).join(", ") || "none"}.`);
6540
6849
  const update = {};
6541
6850
  if (changes.values) {
6542
6851
  const d = await this.describeEffect(was.effect);
@@ -6578,7 +6887,7 @@ var ImageEditorController = (_class13 = class {
6578
6887
  const layer = {
6579
6888
  type: "pixel",
6580
6889
  id,
6581
- name: _optionalChain([options, 'access', _172 => _172.name, 'optionalAccess', _173 => _173.trim, 'call', _174 => _174()]) || d.name,
6890
+ name: _optionalChain([options, 'access', _174 => _174.name, 'optionalAccess', _175 => _175.trim, 'call', _176 => _176()]) || d.name,
6582
6891
  visible: true,
6583
6892
  opacity: _nullishCoalesce(options.opacity, () => ( 1)),
6584
6893
  blend: _nullishCoalesce(blend, () => ( "normal")),
@@ -6603,7 +6912,7 @@ var ImageEditorController = (_class13 = class {
6603
6912
  */
6604
6913
  async updateEffectLayer(layerId, changes, commitToHistory = true) {
6605
6914
  const found = _chunkHGTDMKNEcjs.findLayer.call(void 0, this.state.layers, layerId);
6606
- const layer = _optionalChain([found, 'optionalAccess', _175 => _175.layer]);
6915
+ const layer = _optionalChain([found, 'optionalAccess', _177 => _177.layer]);
6607
6916
  if (!layer || layer.type !== "pixel" || !layer.generator) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`"${layerId}" is not an effect layer; add one with add_effect_layer.`);
6608
6917
  _chunkUYXL6ZWQcjs.requireUnlocked.call(void 0, layer, "pixels", "draw its effect again");
6609
6918
  const g = layer.generator;
@@ -6632,7 +6941,7 @@ var ImageEditorController = (_class13 = class {
6632
6941
  * and how long it runs, the longest of theirs (ms). Null when none animates.
6633
6942
  */
6634
6943
  getAnimation() {
6635
- const layers = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => l.type === "pixel" && l.visible && !!_optionalChain([l, 'access', _176 => _176.generator, 'optionalAccess', _177 => _177.animate]));
6944
+ const layers = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => l.type === "pixel" && l.visible && !!_optionalChain([l, 'access', _178 => _178.generator, 'optionalAccess', _179 => _179.animate]));
6636
6945
  if (!layers.length) return null;
6637
6946
  return { duration: Math.max(...layers.map((l) => l.generator.animate.duration)), layerIds: layers.map((l) => l.id) };
6638
6947
  }
@@ -6649,7 +6958,7 @@ var ImageEditorController = (_class13 = class {
6649
6958
  const { width, height } = this.naturalSize;
6650
6959
  const surfaces = /* @__PURE__ */ new Map();
6651
6960
  for (const l of _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers)) {
6652
- if (l.type !== "pixel" || !l.visible || !_optionalChain([l, 'access', _178 => _178.generator, 'optionalAccess', _179 => _179.animate])) continue;
6961
+ if (l.type !== "pixel" || !l.visible || !_optionalChain([l, 'access', _180 => _180.generator, 'optionalAccess', _181 => _181.animate])) continue;
6653
6962
  const g = l.generator;
6654
6963
  const pixels = await this.effectsEngine.renderLayer(g.effect, g.values, { width, height, depth: this.bitDepth, time: (_nullishCoalesce(g.time, () => ( 0))) + time });
6655
6964
  surfaces.set(l.id, effectPixelsToSurface(pixels, this.bitDepth));
@@ -6710,7 +7019,7 @@ var ImageEditorController = (_class13 = class {
6710
7019
  transform: { ...s.transform },
6711
7020
  outputOpacity: s.outputOpacity,
6712
7021
  selection: _nullishCoalesce(s.selection, () => ( null)),
6713
- ..._optionalChain([s, 'access', _180 => _180.channels, 'optionalAccess', _181 => _181.length]) ? { channels: s.channels } : {},
7022
+ ..._optionalChain([s, 'access', _182 => _182.channels, 'optionalAccess', _183 => _183.length]) ? { channels: s.channels } : {},
6714
7023
  source: {
6715
7024
  sourceUrl: s.sourceUrl,
6716
7025
  element: this.imageElement,
@@ -6746,7 +7055,7 @@ var ImageEditorController = (_class13 = class {
6746
7055
  if (entry.colorMode) s.colorMode = entry.colorMode;
6747
7056
  else delete s.colorMode;
6748
7057
  s.selection = entry.selection;
6749
- if (_optionalChain([entry, 'access', _182 => _182.channels, 'optionalAccess', _183 => _183.length])) s.channels = entry.channels;
7058
+ if (_optionalChain([entry, 'access', _184 => _184.channels, 'optionalAccess', _185 => _185.length])) s.channels = entry.channels;
6750
7059
  else delete s.channels;
6751
7060
  if (this.imageElement !== entry.source.element && !this.samplePixelsOverride) this.samplePixels = null;
6752
7061
  this.imageElement = entry.source.element;
@@ -6953,7 +7262,7 @@ var ImageEditorController = (_class13 = class {
6953
7262
  return this.state.layers;
6954
7263
  }
6955
7264
  getLayer(id) {
6956
- return _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, this.state.layers, id), 'optionalAccess', _184 => _184.layer]);
7265
+ return _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, this.state.layers, id), 'optionalAccess', _186 => _186.layer]);
6957
7266
  }
6958
7267
  /** The active layer, or `undefined`. */
6959
7268
  getActiveLayer() {
@@ -6966,7 +7275,7 @@ var ImageEditorController = (_class13 = class {
6966
7275
  setActiveLayer(id, target = "pixels") {
6967
7276
  if (id !== null && !this.getLayer(id)) return false;
6968
7277
  const layer = id ? this.getLayer(id) : void 0;
6969
- const t = target === "mask" && _optionalChain([layer, 'optionalAccess', _185 => _185.mask]) ? "mask" : target === "filter-mask" && _optionalChain([layer, 'optionalAccess', _186 => _186.type]) === "smart" && _optionalChain([layer, 'access', _187 => _187.smartFilters, 'optionalAccess', _188 => _188.mask]) ? "filter-mask" : "pixels";
7278
+ const t = target === "mask" && _optionalChain([layer, 'optionalAccess', _187 => _187.mask]) ? "mask" : target === "filter-mask" && _optionalChain([layer, 'optionalAccess', _188 => _188.type]) === "smart" && _optionalChain([layer, 'access', _189 => _189.smartFilters, 'optionalAccess', _190 => _190.mask]) ? "filter-mask" : "pixels";
6970
7279
  if (this.state.activeLayerId === id && this.state.activeTarget === t) return true;
6971
7280
  this.state.activeLayerId = id;
6972
7281
  this.state.activeTarget = t;
@@ -7128,7 +7437,7 @@ var ImageEditorController = (_class13 = class {
7128
7437
  surfaceOf: (l) => this.surfaceOf(l),
7129
7438
  version: `${this.sourceVersion()}:${this.patternsVersion()}`,
7130
7439
  globalLight: this.state.globalLight,
7131
- pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _189 => _189.state, 'access', _190 => _190.patterns, 'optionalAccess', _191 => _191.find, 'call', _192 => _192((p) => p.id === id)]), () => ( null))
7440
+ pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _191 => _191.state, 'access', _192 => _192.patterns, 'optionalAccess', _193 => _193.find, 'call', _194 => _194((p) => p.id === id)]), () => ( null))
7132
7441
  };
7133
7442
  }
7134
7443
  __init95() {this.sourceIds = /* @__PURE__ */ new WeakMap()}
@@ -7205,7 +7514,7 @@ var ImageEditorController = (_class13 = class {
7205
7514
  if (!ctx || typeof ctx.getImageData !== "function") return null;
7206
7515
  ctx.drawImage(el, 0, 0, width, height);
7207
7516
  const data = ctx.getImageData(0, 0, width, height);
7208
- if (!_optionalChain([data, 'optionalAccess', _193 => _193.data]) || data.data.length < width * height * 4) return null;
7517
+ if (!_optionalChain([data, 'optionalAccess', _195 => _195.data]) || data.data.length < width * height * 4) return null;
7209
7518
  return { width, height, data: data.data };
7210
7519
  } catch (e24) {
7211
7520
  return null;
@@ -7218,7 +7527,7 @@ var ImageEditorController = (_class13 = class {
7218
7527
  const prev = this.state.layers;
7219
7528
  const depth = this.bitDepth;
7220
7529
  this.state.layers = next;
7221
- _optionalChain([extra, 'optionalCall', _194 => _194()]);
7530
+ _optionalChain([extra, 'optionalCall', _196 => _196()]);
7222
7531
  if (depth !== 8 && this.bitDepth === depth) this.state.layers = keepDeepLayers(prev, this.state.layers);
7223
7532
  if (this.state.activeLayerId && !_chunkHGTDMKNEcjs.findLayer.call(void 0, this.state.layers, this.state.activeLayerId)) {
7224
7533
  this.state.activeLayerId = _chunkUYXL6ZWQcjs.activeLayerAfterRemoval.call(void 0, prev, this.state.layers, this.state.activeLayerId);
@@ -7256,7 +7565,7 @@ var ImageEditorController = (_class13 = class {
7256
7565
  const layer = {
7257
7566
  type: "pixel",
7258
7567
  id: init.id && !ids.has(init.id) ? init.id : _chunkUYXL6ZWQcjs.newLayerId.call(void 0, ),
7259
- name: _optionalChain([init, 'access', _195 => _195.name, 'optionalAccess', _196 => _196.trim, 'call', _197 => _197()]) || this.nextLayerName(),
7568
+ name: _optionalChain([init, 'access', _197 => _197.name, 'optionalAccess', _198 => _198.trim, 'call', _199 => _199()]) || this.nextLayerName(),
7260
7569
  visible: _nullishCoalesce(init.visible, () => ( true)),
7261
7570
  opacity: _nullishCoalesce(init.opacity, () => ( 1)),
7262
7571
  blend: _nullishCoalesce(blend, () => ( "normal")),
@@ -7283,7 +7592,7 @@ var ImageEditorController = (_class13 = class {
7283
7592
  async decodeImage(image) {
7284
7593
  const trimmed = image.trim();
7285
7594
  let png = null;
7286
- if (/^data:image\/png/i.test(trimmed)) png = _nullishCoalesce(_optionalChain([_chunkCWM3CUUXcjs.parseDataUrl.call(void 0, trimmed), 'optionalAccess', _198 => _198.bytes]), () => ( null));
7595
+ if (/^data:image\/png/i.test(trimmed)) png = _nullishCoalesce(_optionalChain([_chunkCWM3CUUXcjs.parseDataUrl.call(void 0, trimmed), 'optionalAccess', _200 => _200.bytes]), () => ( null));
7287
7596
  else if (/^[A-Za-z0-9+/=\s]+$/.test(trimmed) && trimmed.length > 16) {
7288
7597
  try {
7289
7598
  const bytes = _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, trimmed);
@@ -7332,7 +7641,7 @@ var ImageEditorController = (_class13 = class {
7332
7641
  removeLayer(id) {
7333
7642
  const next = _chunkUYXL6ZWQcjs.removeLayer.call(void 0, this.state.layers, id);
7334
7643
  this.commitLayers(next, () => {
7335
- if (this.state.selectedAnnotationId && !_chunkHGTDMKNEcjs.flattenLayers.call(void 0, next).some((l) => _optionalChain([_chunkUYXL6ZWQcjs.annotationOfLayer.call(void 0, l), 'optionalAccess', _199 => _199.id]) === this.state.selectedAnnotationId)) {
7644
+ if (this.state.selectedAnnotationId && !_chunkHGTDMKNEcjs.flattenLayers.call(void 0, next).some((l) => _optionalChain([_chunkUYXL6ZWQcjs.annotationOfLayer.call(void 0, l), 'optionalAccess', _201 => _201.id]) === this.state.selectedAnnotationId)) {
7336
7645
  this.state.selectedAnnotationId = null;
7337
7646
  }
7338
7647
  });
@@ -7341,9 +7650,9 @@ var ImageEditorController = (_class13 = class {
7341
7650
  moveLayer(id, placement) {
7342
7651
  const next = _chunkUYXL6ZWQcjs.moveLayer.call(void 0, this.state.layers, id, placement);
7343
7652
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, next, id);
7344
- if (next === this.state.layers) return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _200 => _200.parent, 'optionalAccess', _201 => _201.id]), () => ( null)), index: loc.index };
7653
+ if (next === this.state.layers) return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _202 => _202.parent, 'optionalAccess', _203 => _203.id]), () => ( null)), index: loc.index };
7345
7654
  this.commitLayers(next);
7346
- return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _202 => _202.parent, 'optionalAccess', _203 => _203.id]), () => ( null)), index: loc.index };
7655
+ return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _204 => _204.parent, 'optionalAccess', _205 => _205.id]), () => ( null)), index: loc.index };
7347
7656
  }
7348
7657
  /**
7349
7658
  * Changes name, visibility, opacity, fill, blend, clipping, locks or (groups) collapsed state, as
@@ -7360,7 +7669,7 @@ var ImageEditorController = (_class13 = class {
7360
7669
  const group = {
7361
7670
  type: "group",
7362
7671
  id: _chunkUYXL6ZWQcjs.newLayerId.call(void 0, "group"),
7363
- name: _optionalChain([init, 'access', _204 => _204.name, 'optionalAccess', _205 => _205.trim, 'call', _206 => _206()]) || "Group",
7672
+ name: _optionalChain([init, 'access', _206 => _206.name, 'optionalAccess', _207 => _207.trim, 'call', _208 => _208()]) || "Group",
7364
7673
  visible: true,
7365
7674
  opacity: 1,
7366
7675
  blend,
@@ -7453,7 +7762,7 @@ var ImageEditorController = (_class13 = class {
7453
7762
  sel = this.layerTransparency(id);
7454
7763
  } else {
7455
7764
  const current = this.state.selection;
7456
- if (!_optionalChain([current, 'optionalAccess', _207 => _207.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, or use reveal-all / hide-all / transparency.");
7765
+ if (!_optionalChain([current, 'optionalAccess', _209 => _209.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, or use reveal-all / hide-all / transparency.");
7457
7766
  sel = from === "hide-selection" ? _chunkUYXL6ZWQcjs.invertSelection.call(void 0, current) : current;
7458
7767
  }
7459
7768
  mask = this.maskFromSelection(sel, props);
@@ -7484,7 +7793,7 @@ var ImageEditorController = (_class13 = class {
7484
7793
  const layer = _chunkUYXL6ZWQcjs.requireLayer.call(void 0, this.state.layers, id).layer;
7485
7794
  const name = layer.name || id;
7486
7795
  if (layer.type === "shape") throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${name}" is a shape layer, whose path already is its vector mask; change it with set_shape_component, or rasterize the layer first.`);
7487
- if (_optionalChain([layer, 'access', _208 => _208.mask, 'optionalAccess', _209 => _209.source])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${name}" has a depth mask, which cannot be combined with a vector mask; remove the depth mask first.`);
7796
+ if (_optionalChain([layer, 'access', _210 => _210.mask, 'optionalAccess', _211 => _211.source])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${name}" has a depth mask, which cannot be combined with a vector mask; remove the depth mask first.`);
7488
7797
  return layer;
7489
7798
  }
7490
7799
  requireVectorMask(id) {
@@ -7494,10 +7803,10 @@ var ImageEditorController = (_class13 = class {
7494
7803
  }
7495
7804
  /** Components from a path spec: `components`, or one `shape` / `subpaths`. */
7496
7805
  vectorMaskComponents(path) {
7497
- if (_optionalChain([path, 'access', _210 => _210.components, 'optionalAccess', _211 => _211.length]) && (path.shape !== void 0 || path.subpaths !== void 0)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Give components, or shape / subpaths, not both.");
7806
+ if (_optionalChain([path, 'access', _212 => _212.components, 'optionalAccess', _213 => _213.length]) && (path.shape !== void 0 || path.subpaths !== void 0)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Give components, or shape / subpaths, not both.");
7498
7807
  if (path.fillRule !== void 0 && path.fillRule !== "nonzero" && path.fillRule !== "evenodd") throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("fillRule must be nonzero or evenodd.");
7499
- const specs = _optionalChain([path, 'access', _212 => _212.components, 'optionalAccess', _213 => _213.length]) ? path.components : [path];
7500
- return specs.map((c, i) => this.componentFrom(c, _optionalChain([path, 'access', _214 => _214.components, 'optionalAccess', _215 => _215.length]) ? `components[${i}].` : ""));
7808
+ const specs = _optionalChain([path, 'access', _214 => _214.components, 'optionalAccess', _215 => _215.length]) ? path.components : [path];
7809
+ return specs.map((c, i) => this.componentFrom(c, _optionalChain([path, 'access', _216 => _216.components, 'optionalAccess', _217 => _217.length]) ? `components[${i}].` : ""));
7501
7810
  }
7502
7811
  /**
7503
7812
  * Layer › Vector Mask: `reveal-all` (an empty path showing everything), `hide-all` (an empty path
@@ -7514,7 +7823,7 @@ var ImageEditorController = (_class13 = class {
7514
7823
  vm = { components: this.vectorMaskComponents(path) };
7515
7824
  if (path.fillRule === "evenodd") vm.fillRule = "evenodd";
7516
7825
  } else if (from === "reveal-all" || from === "hide-all") {
7517
- if (_optionalChain([path, 'access', _216 => _216.components, 'optionalAccess', _217 => _217.length]) || path.shape !== void 0 || path.subpaths !== void 0) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`A ${from} vector mask starts empty; use from path to give a path.`);
7826
+ if (_optionalChain([path, 'access', _218 => _218.components, 'optionalAccess', _219 => _219.length]) || path.shape !== void 0 || path.subpaths !== void 0) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`A ${from} vector mask starts empty; use from path to give a path.`);
7518
7827
  vm = { components: [], ...from === "reveal-all" ? { inverted: true } : {} };
7519
7828
  } else {
7520
7829
  throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Unknown vector mask source "${String(from)}". Use reveal-all, hide-all, path or selection.`);
@@ -7525,7 +7834,7 @@ var ImageEditorController = (_class13 = class {
7525
7834
  /** The selection's outline as subpaths; throws when nothing is selected or nothing is left to trace. */
7526
7835
  traceSelection(options) {
7527
7836
  const sel = this.state.selection;
7528
- if (!_optionalChain([sel, 'optionalAccess', _218 => _218.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, then make a path from the selection.");
7837
+ if (!_optionalChain([sel, 'optionalAccess', _220 => _220.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, then make a path from the selection.");
7529
7838
  if (options.tolerance !== void 0 && !(options.tolerance >= 0.1 && options.tolerance <= 10)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("tolerance must be from 0.1 to 10 px.");
7530
7839
  const subpaths = selectionToSubpaths(sel, options);
7531
7840
  if (!subpaths.length) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("The selection is too small or too faint to trace (below minArea, or under half selected); lower minArea or threshold.");
@@ -7706,7 +8015,7 @@ var ImageEditorController = (_class13 = class {
7706
8015
  const layer = loc.layer;
7707
8016
  if (layer.type !== "pixel") throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer via copy needs a pixel layer; "${id}" is a ${layer.type} layer.`);
7708
8017
  const sel = this.state.selection;
7709
- if (!_optionalChain([sel, 'optionalAccess', _219 => _219.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select the pixels to copy first.");
8018
+ if (!_optionalChain([sel, 'optionalAccess', _221 => _221.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select the pixels to copy first.");
7710
8019
  if (options.cut) _chunkUYXL6ZWQcjs.requireUnlocked.call(void 0, layer, "pixels", "cut from it");
7711
8020
  const surface = this.surfaceOf(layer);
7712
8021
  const sb = sel.bounds;
@@ -7724,14 +8033,14 @@ var ImageEditorController = (_class13 = class {
7724
8033
  const copy = {
7725
8034
  type: "pixel",
7726
8035
  id: _chunkUYXL6ZWQcjs.newLayerId.call(void 0, ),
7727
- name: _optionalChain([options, 'access', _220 => _220.name, 'optionalAccess', _221 => _221.trim, 'call', _222 => _222()]) || `${layer.name || "Layer"} ${options.cut ? "cut" : "copy"}`,
8036
+ name: _optionalChain([options, 'access', _222 => _222.name, 'optionalAccess', _223 => _223.trim, 'call', _224 => _224()]) || `${layer.name || "Layer"} ${options.cut ? "cut" : "copy"}`,
7728
8037
  visible: true,
7729
8038
  opacity: 1,
7730
8039
  blend: "normal",
7731
8040
  surface: _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width: src.width, height: src.height, data: px2 }, 4, src.x, src.y),
7732
8041
  offset: { ...layer.offset }
7733
8042
  };
7734
- let next = _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _223 => _223.parent, 'optionalAccess', _224 => _224.id]), () => ( null)), loc.index + 1);
8043
+ let next = _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _225 => _225.parent, 'optionalAccess', _226 => _226.id]), () => ( null)), loc.index + 1);
7735
8044
  if (kept) {
7736
8045
  const cutLayer = { ...layer, surface: _chunkCWM3CUUXcjs.writeRegion.call(void 0, surface, src, kept) };
7737
8046
  delete cutLayer.source;
@@ -7755,7 +8064,7 @@ var ImageEditorController = (_class13 = class {
7755
8064
  layers: () => this.state.layers,
7756
8065
  activeLayerId: () => this.state.activeLayerId,
7757
8066
  activeTarget: () => this.state.activeTarget,
7758
- selection: () => _optionalChain([this, 'access', _225 => _225.state, 'access', _226 => _226.selection, 'optionalAccess', _227 => _227.bounds]) ? this.state.selection : null,
8067
+ selection: () => _optionalChain([this, 'access', _227 => _227.state, 'access', _228 => _228.selection, 'optionalAccess', _229 => _229.bounds]) ? this.state.selection : null,
7759
8068
  canvas: () => this.naturalSize,
7760
8069
  pixelsOf: (layer) => this.surfaceOf(layer),
7761
8070
  shapeEnv: () => this.shapeEnv(),
@@ -7903,7 +8212,7 @@ var ImageEditorController = (_class13 = class {
7903
8212
  * anything else nests as a layer document. Returns the smart object's id.
7904
8213
  */
7905
8214
  convertToSmartObject(ids, options = {}) {
7906
- const list = _optionalChain([ids, 'optionalAccess', _228 => _228.length]) ? ids : this.state.activeLayerId ? [this.state.activeLayerId] : [];
8215
+ const list = _optionalChain([ids, 'optionalAccess', _230 => _230.length]) ? ids : this.state.activeLayerId ? [this.state.activeLayerId] : [];
7907
8216
  if (!list.length) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("No layers given and none is active; pass layerIds (see list_layers).");
7908
8217
  const res = _chunkUYXL6ZWQcjs.convertToSmartObject.call(void 0, this.state.layers, list, this.canvasSize, { surfaceOf: (l) => this.surfaceOf(l), name: options.name });
7909
8218
  this.commitLayers(res.layers, () => {
@@ -7936,8 +8245,8 @@ var ImageEditorController = (_class13 = class {
7936
8245
  width: c.width,
7937
8246
  height: c.height,
7938
8247
  decoded: _chunkUYXL6ZWQcjs.isContentsDecoded.call(void 0, c),
7939
- fileType: _nullishCoalesce(_optionalChain([c, 'access', _229 => _229.file, 'optionalAccess', _230 => _230.type]), () => ( null)),
7940
- linkedPath: _nullishCoalesce(_optionalChain([c, 'access', _231 => _231.linked, 'optionalAccess', _232 => _232.path]), () => ( null)),
8248
+ fileType: _nullishCoalesce(_optionalChain([c, 'access', _231 => _231.file, 'optionalAccess', _232 => _232.type]), () => ( null)),
8249
+ linkedPath: _nullishCoalesce(_optionalChain([c, 'access', _233 => _233.linked, 'optionalAccess', _234 => _234.path]), () => ( null)),
7941
8250
  instances: _chunkUYXL6ZWQcjs.instancesOf.call(void 0, this.state.layers, c.id),
7942
8251
  layerCount: c.document ? _chunkHGTDMKNEcjs.flattenLayers.call(void 0, c.document.layers).length : 0
7943
8252
  },
@@ -7954,9 +8263,9 @@ var ImageEditorController = (_class13 = class {
7954
8263
  bounds: _chunkUYXL6ZWQcjs.transformedBox.call(void 0, g)
7955
8264
  },
7956
8265
  smartFilters: {
7957
- enabled: _nullishCoalesce(_optionalChain([stack, 'optionalAccess', _233 => _233.enabled]), () => ( true)),
7958
- filters: (_nullishCoalesce(_optionalChain([stack, 'optionalAccess', _234 => _234.filters]), () => ( []))).map((f) => f.kind === "psd" ? { id: f.id, kind: "psd", name: f.name, enabled: f.enabled, blend: f.blend, opacity: f.opacity } : { ...f }),
7959
- mask: _optionalChain([stack, 'optionalAccess', _235 => _235.mask]) ? { enabled: stack.mask.enabled !== false, linked: stack.mask.linked !== false, density: _nullishCoalesce(stack.mask.density, () => ( 1)), feather: _nullishCoalesce(stack.mask.feather, () => ( 0)), bounds: _chunkCWM3CUUXcjs.contentBounds.call(void 0, stack.mask.surface), defaultValue: stack.mask.defaultValue } : null
8266
+ enabled: _nullishCoalesce(_optionalChain([stack, 'optionalAccess', _235 => _235.enabled]), () => ( true)),
8267
+ filters: (_nullishCoalesce(_optionalChain([stack, 'optionalAccess', _236 => _236.filters]), () => ( []))).map((f) => f.kind === "psd" ? { id: f.id, kind: "psd", name: f.name, enabled: f.enabled, blend: f.blend, opacity: f.opacity } : { ...f }),
8268
+ mask: _optionalChain([stack, 'optionalAccess', _237 => _237.mask]) ? { enabled: stack.mask.enabled !== false, linked: stack.mask.linked !== false, density: _nullishCoalesce(stack.mask.density, () => ( 1)), feather: _nullishCoalesce(stack.mask.feather, () => ( 0)), bounds: _chunkCWM3CUUXcjs.contentBounds.call(void 0, stack.mask.surface), defaultValue: stack.mask.defaultValue } : null
7960
8269
  },
7961
8270
  bounds: this.getLayerBounds(id)
7962
8271
  };
@@ -8095,7 +8404,7 @@ var ImageEditorController = (_class13 = class {
8095
8404
  * it in the same undo step (Photoshop limits a filter to the selection). Returns whether it did.
8096
8405
  */
8097
8406
  maskFiltersWithSelection(id, useSelection) {
8098
- if (!useSelection || !_optionalChain([this, 'access', _236 => _236.state, 'access', _237 => _237.selection, 'optionalAccess', _238 => _238.bounds])) return false;
8407
+ if (!useSelection || !_optionalChain([this, 'access', _238 => _238.state, 'access', _239 => _239.selection, 'optionalAccess', _240 => _240.bounds])) return false;
8099
8408
  this.setSmartFilterMask(id, "selection", {}, false);
8100
8409
  return true;
8101
8410
  }
@@ -8109,19 +8418,19 @@ var ImageEditorController = (_class13 = class {
8109
8418
  removeSmartFilter(id, filterId) {
8110
8419
  const res = _chunkUYXL6ZWQcjs.removeSmartFilter.call(void 0, this.state.layers, id, filterId, this.canvasSize);
8111
8420
  this.commitLayers(res.layers);
8112
- return _nullishCoalesce(_optionalChain([res, 'access', _239 => _239.layer, 'access', _240 => _240.smartFilters, 'optionalAccess', _241 => _241.filters]), () => ( []));
8421
+ return _nullishCoalesce(_optionalChain([res, 'access', _241 => _241.layer, 'access', _242 => _242.smartFilters, 'optionalAccess', _243 => _243.filters]), () => ( []));
8113
8422
  }
8114
8423
  /** Moves one smart filter to `index` (0 = bottom, applied first), as one undo step. Returns the filters. */
8115
8424
  moveSmartFilter(id, filterId, index) {
8116
8425
  const res = _chunkUYXL6ZWQcjs.moveSmartFilter.call(void 0, this.state.layers, id, filterId, index, this.canvasSize);
8117
8426
  this.commitLayers(res.layers);
8118
- return _nullishCoalesce(_optionalChain([res, 'access', _242 => _242.layer, 'access', _243 => _243.smartFilters, 'optionalAccess', _244 => _244.filters]), () => ( []));
8427
+ return _nullishCoalesce(_optionalChain([res, 'access', _244 => _244.layer, 'access', _245 => _245.smartFilters, 'optionalAccess', _246 => _246.filters]), () => ( []));
8119
8428
  }
8120
8429
  /** Turns a smart object's whole filter stack on or off (one undo step). */
8121
8430
  setSmartFiltersEnabled(id, enabled) {
8122
8431
  const res = _chunkUYXL6ZWQcjs.setSmartFiltersEnabled.call(void 0, this.state.layers, id, enabled, this.canvasSize);
8123
8432
  this.commitLayers(res.layers);
8124
- return _nullishCoalesce(_optionalChain([res, 'access', _245 => _245.layer, 'access', _246 => _246.smartFilters, 'optionalAccess', _247 => _247.enabled]), () => ( true));
8433
+ return _nullishCoalesce(_optionalChain([res, 'access', _247 => _247.layer, 'access', _248 => _248.smartFilters, 'optionalAccess', _249 => _249.enabled]), () => ( true));
8125
8434
  }
8126
8435
  /**
8127
8436
  * Sets the smart filter mask (one undo step): `reveal-all`, `hide-all`, `selection` (the
@@ -8133,11 +8442,11 @@ var ImageEditorController = (_class13 = class {
8133
8442
  let mask;
8134
8443
  if (from === "none") mask = null;
8135
8444
  else if (from === "keep") {
8136
- if (!_optionalChain([layer, 'access', _248 => _248.smartFilters, 'optionalAccess', _249 => _249.mask])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Smart object "${layer.name || id}" has no filter mask; add one with from reveal-all, hide-all or selection.`);
8445
+ if (!_optionalChain([layer, 'access', _250 => _250.smartFilters, 'optionalAccess', _251 => _251.mask])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Smart object "${layer.name || id}" has no filter mask; add one with from reveal-all, hide-all or selection.`);
8137
8446
  mask = withMaskProps(layer.smartFilters.mask, props);
8138
8447
  } else if (from === "selection") {
8139
8448
  const sel = this.state.selection;
8140
- if (!_optionalChain([sel, 'optionalAccess', _250 => _250.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, or use reveal-all / hide-all.");
8449
+ if (!_optionalChain([sel, 'optionalAccess', _252 => _252.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, or use reveal-all / hide-all.");
8141
8450
  mask = this.maskFromSelection(sel, props);
8142
8451
  } else {
8143
8452
  const v = from === "reveal-all" ? 255 : 0;
@@ -8149,7 +8458,7 @@ var ImageEditorController = (_class13 = class {
8149
8458
  if (mask && from !== "keep") this.state.activeTarget = "filter-mask";
8150
8459
  else if (!mask && this.state.activeTarget === "filter-mask") this.state.activeTarget = "pixels";
8151
8460
  }, commitToHistory);
8152
- return _nullishCoalesce(_optionalChain([res, 'access', _251 => _251.layer, 'access', _252 => _252.smartFilters, 'optionalAccess', _253 => _253.mask]), () => ( null));
8461
+ return _nullishCoalesce(_optionalChain([res, 'access', _253 => _253.layer, 'access', _254 => _254.smartFilters, 'optionalAccess', _255 => _255.mask]), () => ( null));
8153
8462
  }
8154
8463
  /**
8155
8464
  * Decodes smart object contents that came as files the synchronous decoders cannot read (a JPEG
@@ -8197,7 +8506,7 @@ var ImageEditorController = (_class13 = class {
8197
8506
  if (this.getFreeTransform()) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("A Free Transform is open; commit or cancel it first.");
8198
8507
  const layer = _chunkUYXL6ZWQcjs.requireSmartObject.call(void 0, this.state.layers, id);
8199
8508
  const c = layer.contents;
8200
- if (!_chunkUYXL6ZWQcjs.isContentsDecoded.call(void 0, c)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`The contents of "${layer.name || id}" are a ${_nullishCoalesce(_optionalChain([c, 'access', _254 => _254.file, 'optionalAccess', _255 => _255.type]), () => ( "file"))} that could not be decoded here; run prepareSmartObjects() in a browser first.`);
8509
+ if (!_chunkUYXL6ZWQcjs.isContentsDecoded.call(void 0, c)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`The contents of "${layer.name || id}" are a ${_nullishCoalesce(_optionalChain([c, 'access', _256 => _256.file, 'optionalAccess', _257 => _257.type]), () => ( "file"))} that could not be decoded here; run prepareSmartObjects() in a browser first.`);
8201
8510
  const saved = {
8202
8511
  state: { ...this.state },
8203
8512
  undo: this.undoStack,
@@ -8228,9 +8537,9 @@ var ImageEditorController = (_class13 = class {
8228
8537
  editingContents: this.getEditingContents()
8229
8538
  };
8230
8539
  delete this.state.legacyOutputBlur;
8231
- if (_optionalChain([c, 'access', _256 => _256.document, 'optionalAccess', _257 => _257.globalLight])) this.state.globalLight = c.document.globalLight;
8540
+ if (_optionalChain([c, 'access', _258 => _258.document, 'optionalAccess', _259 => _259.globalLight])) this.state.globalLight = c.document.globalLight;
8232
8541
  else delete this.state.globalLight;
8233
- if (_optionalChain([c, 'access', _258 => _258.document, 'optionalAccess', _259 => _259.patterns, 'optionalAccess', _260 => _260.length])) this.state.patterns = c.document.patterns;
8542
+ if (_optionalChain([c, 'access', _260 => _260.document, 'optionalAccess', _261 => _261.patterns, 'optionalAccess', _262 => _262.length])) this.state.patterns = c.document.patterns;
8234
8543
  else delete this.state.patterns;
8235
8544
  this.imageElement = null;
8236
8545
  this.samplePixels = null;
@@ -8250,23 +8559,23 @@ var ImageEditorController = (_class13 = class {
8250
8559
  closeSmartObjectContents(save = true) {
8251
8560
  const top = this.contentsStack.pop();
8252
8561
  if (!top) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("No smart object contents are open; open them with edit_smart_object_contents.");
8253
- if (_optionalChain([this, 'access', _261 => _261.openTransform, 'optionalAccess', _262 => _262.isOpen])) this.openTransform.cancel();
8562
+ if (_optionalChain([this, 'access', _263 => _263.openTransform, 'optionalAccess', _264 => _264.isOpen])) this.openTransform.cancel();
8254
8563
  this.openTransform = null;
8255
8564
  const edited = this.state;
8256
8565
  const changed = save && this.undoStack.length > 0;
8257
8566
  let next = null;
8258
8567
  if (changed) {
8259
- const layer = _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, top.saved.state.layers, top.layerId), 'optionalAccess', _263 => _263.layer]);
8260
- const old = _optionalChain([layer, 'optionalAccess', _264 => _264.contents]);
8568
+ const layer = _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, top.saved.state.layers, top.layerId), 'optionalAccess', _265 => _265.layer]);
8569
+ const old = _optionalChain([layer, 'optionalAccess', _266 => _266.contents]);
8261
8570
  const { width, height } = edited.imageDimensions;
8262
8571
  const only = edited.layers.length === 1 ? edited.layers[0] : null;
8263
- const plain3 = _optionalChain([only, 'optionalAccess', _265 => _265.type]) === "pixel" && only.visible && only.opacity === 1 && only.blend === "normal" && !only.mask && !only.effects && !_optionalChain([only, 'access', _266 => _266.filters, 'optionalAccess', _267 => _267.length]) && !only.clipped && (_nullishCoalesce(only.fillOpacity, () => ( 1))) === 1 && only.source !== "document";
8264
- if (_optionalChain([old, 'optionalAccess', _268 => _268.kind]) === "raster" && plain3) {
8572
+ const plain3 = _optionalChain([only, 'optionalAccess', _267 => _267.type]) === "pixel" && only.visible && only.opacity === 1 && only.blend === "normal" && !only.mask && !only.effects && !_optionalChain([only, 'access', _268 => _268.filters, 'optionalAccess', _269 => _269.length]) && !only.clipped && (_nullishCoalesce(only.fillOpacity, () => ( 1))) === 1 && only.source !== "document";
8573
+ if (_optionalChain([old, 'optionalAccess', _270 => _270.kind]) === "raster" && plain3) {
8265
8574
  const px2 = _chunkCWM3CUUXcjs.readRegion.call(void 0, only.surface, { x: -only.offset.x, y: -only.offset.y, width, height });
8266
8575
  next = _chunkUYXL6ZWQcjs.rasterContents.call(void 0, { width, height, data: px2 }, old.name, old.id);
8267
8576
  } else {
8268
8577
  const doc = { layers: edited.layers, globalLight: edited.globalLight, patterns: edited.patterns };
8269
- next = _chunkUYXL6ZWQcjs.documentContents.call(void 0, doc, width, height, _optionalChain([old, 'optionalAccess', _269 => _269.kind]) === "document" ? old.name : `${(_nullishCoalesce(_optionalChain([old, 'optionalAccess', _270 => _270.name]), () => ( "Contents"))).replace(/\.\w+$/, "")}.psb`, top.contentsId);
8578
+ next = _chunkUYXL6ZWQcjs.documentContents.call(void 0, doc, width, height, _optionalChain([old, 'optionalAccess', _271 => _271.kind]) === "document" ? old.name : `${(_nullishCoalesce(_optionalChain([old, 'optionalAccess', _272 => _272.name]), () => ( "Contents"))).replace(/\.\w+$/, "")}.psb`, top.contentsId);
8270
8579
  }
8271
8580
  }
8272
8581
  const saved = top.saved;
@@ -8291,7 +8600,7 @@ var ImageEditorController = (_class13 = class {
8291
8600
  }
8292
8601
  /** The document's own layers (not the contents open for editing). */
8293
8602
  rootLayers() {
8294
- return _nullishCoalesce(_optionalChain([this, 'access', _271 => _271.contentsStack, 'access', _272 => _272[0], 'optionalAccess', _273 => _273.saved, 'access', _274 => _274.state, 'access', _275 => _275.layers]), () => ( this.state.layers));
8603
+ return _nullishCoalesce(_optionalChain([this, 'access', _273 => _273.contentsStack, 'access', _274 => _274[0], 'optionalAccess', _275 => _275.saved, 'access', _276 => _276.state, 'access', _277 => _277.layers]), () => ( this.state.layers));
8295
8604
  }
8296
8605
  /** Drops every open contents edit (loading another document). */
8297
8606
  abandonContents() {
@@ -8512,7 +8821,7 @@ var ImageEditorController = (_class13 = class {
8512
8821
  const oy = layer.type === "pixel" ? layer.offset.y : 0;
8513
8822
  const key = `${tw}x${th}:${ox},${oy}`;
8514
8823
  let byKey = this.thumbCache.get(surface);
8515
- const hit = _optionalChain([byKey, 'optionalAccess', _276 => _276.get, 'call', _277 => _277(key)]);
8824
+ const hit = _optionalChain([byKey, 'optionalAccess', _278 => _278.get, 'call', _279 => _279(key)]);
8516
8825
  if (hit) return hit;
8517
8826
  const out = new Uint8ClampedArray(tw * th * 4);
8518
8827
  for (let y = 0; y < th; y++) {
@@ -8653,7 +8962,7 @@ var ImageEditorController = (_class13 = class {
8653
8962
  if (layer.mask.source) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${name}" has a depth mask, which is generated, not painted.`);
8654
8963
  _chunkUYXL6ZWQcjs.requireUnlocked.call(void 0, layer, "all", action);
8655
8964
  } else if (ch === "filter-mask") {
8656
- if (layer.type !== "smart" || !_optionalChain([layer, 'access', _278 => _278.smartFilters, 'optionalAccess', _279 => _279.mask])) {
8965
+ if (layer.type !== "smart" || !_optionalChain([layer, 'access', _280 => _280.smartFilters, 'optionalAccess', _281 => _281.mask])) {
8657
8966
  throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${name}" has no smart filter mask to ${action}; add one with set_smart_filter_mask, or target pixels or mask.`, `Layer "${name}" has no smart filter mask to ${action}.`);
8658
8967
  }
8659
8968
  if (!_chunkUYXL6ZWQcjs.isContentsDecoded.call(void 0, layer.contents)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`The contents of "${name}" are not decoded here, so its filter mask cannot be painted; run prepareSmartObjects() first.`, `The smart object "${name}" is still loading; try again in a moment.`);
@@ -8668,7 +8977,7 @@ var ImageEditorController = (_class13 = class {
8668
8977
  if (!layer.visible) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${name}" is hidden; show it before you ${action}.`);
8669
8978
  const offset = layer.type === "pixel" ? layer.offset : { x: 0, y: 0 };
8670
8979
  const surface = ch === "mask" ? layer.mask.surface : ch === "filter-mask" ? layer.smartFilters.mask.surface : this.surfaceOf(layer);
8671
- const lockTransparency = ch === "pixels" && Boolean(_optionalChain([layer, 'access', _280 => _280.locks, 'optionalAccess', _281 => _281.transparency]));
8980
+ const lockTransparency = ch === "pixels" && Boolean(_optionalChain([layer, 'access', _282 => _282.locks, 'optionalAccess', _283 => _283.transparency]));
8672
8981
  return { id, layer, channel: ch, offset, surface, lockTransparency };
8673
8982
  }
8674
8983
  /** The layer with its pixels (or mask) replaced by `surface`. */
@@ -8712,13 +9021,13 @@ var ImageEditorController = (_class13 = class {
8712
9021
  blend: target.channel !== "pixels" ? "normal" : brush.blend,
8713
9022
  lockTransparency: target.lockTransparency,
8714
9023
  // In Quick Mask mode the selection is what is painted, so it does not limit the stroke.
8715
- selection: target.channel !== "quick-mask" && _optionalChain([this, 'access', _282 => _282.state, 'access', _283 => _283.selection, 'optionalAccess', _284 => _284.bounds]) ? this.state.selection : null,
9024
+ selection: target.channel !== "quick-mask" && _optionalChain([this, 'access', _284 => _284.state, 'access', _285 => _285.selection, 'optionalAccess', _286 => _286.bounds]) ? this.state.selection : null,
8716
9025
  offset: target.offset
8717
9026
  };
8718
9027
  const depth = target.channel !== "filter-mask" && target.channel !== "quick-mask" && this.bitDepth !== 8 ? this.bitDepth : null;
8719
9028
  if (tool === "mixer") return new PaintStrokeSession(this, target, this.mixerStroke(init, brush), apply, depth);
8720
9029
  if (isRetouchTool(tool)) return new PaintStrokeSession(this, target, this.retouchStroke(tool, init, brush, target, apply), apply, depth);
8721
- const gradient = tool === "brush" && _optionalChain([strokePaint, 'optionalAccess', _285 => _285.type]) === "gradient" ? _chunkEBDCRTZIcjs.resolvePaintGradient.call(void 0, strokePaint, { paint: toHex(color), secondary: toHex(background) }) : null;
9030
+ const gradient = tool === "brush" && _optionalChain([strokePaint, 'optionalAccess', _287 => _287.type]) === "gradient" ? _chunkEBDCRTZIcjs.resolvePaintGradient.call(void 0, strokePaint, { paint: toHex(color), secondary: toHex(background) }) : null;
8722
9031
  return new PaintStrokeSession(this, target, new (0, _chunkEBDCRTZIcjs.StrokeCoverage)(brush, gradient, _nullishCoalesce(init.seed, () => ( 0))), apply, depth);
8723
9032
  }
8724
9033
  /** A retouching stroke's start: its settings, what it samples and how it composites. */
@@ -8765,9 +9074,9 @@ var ImageEditorController = (_class13 = class {
8765
9074
  const steps = settings.historySteps;
8766
9075
  const entry = steps > 0 ? _nullishCoalesce(this.undoStack[this.undoStack.length - steps], () => ( this.undoStack[0])) : this.undoStack[0];
8767
9076
  if (!entry) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("There is no earlier state to paint from yet: the History Brush paints a layer as it was some undo steps back. Make a change first.");
8768
- const then = _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, entry.layers, target.id), 'optionalAccess', _286 => _286.layer]);
9077
+ const then = _optionalChain([_chunkHGTDMKNEcjs.findLayer.call(void 0, entry.layers, target.id), 'optionalAccess', _288 => _288.layer]);
8769
9078
  if (!then) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${target.id}" did not exist ${steps > 0 ? `${steps} steps back` : "in the oldest state"}; choose fewer history steps (historySteps).`);
8770
- const surface = target.channel === "mask" ? _optionalChain([then, 'access', _287 => _287.mask, 'optionalAccess', _288 => _288.surface]) : then.type === "pixel" ? then.surface : void 0;
9079
+ const surface = target.channel === "mask" ? _optionalChain([then, 'access', _289 => _289.mask, 'optionalAccess', _290 => _290.surface]) : then.type === "pixel" ? then.surface : void 0;
8771
9080
  if (!surface) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${target.id}" had no ${target.channel === "mask" ? "mask" : "pixels"} in that state.`);
8772
9081
  const offset2 = then.type === "pixel" ? then.offset : { x: 0, y: 0 };
8773
9082
  const depth = !mask && this.bitDepth !== 8 ? this.bitDepth : null;
@@ -8841,7 +9150,7 @@ var ImageEditorController = (_class13 = class {
8841
9150
  }
8842
9151
  /** A pixel source over a surface (layer pixels or a mask) in layer space at `offset`. */
8843
9152
  surfaceSource(surface, offset) {
8844
- return new (0, _chunk7NW46N7Icjs.TilePixelSource)((tx, ty) => _nullishCoalesce(_optionalChain([surface, 'access', _289 => _289.tiles, 'access', _290 => _290.get, 'call', _291 => _291(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _292 => _292.data]), () => ( (surface.defaultValue ? defaultTile(surface) : null))), surface.channels, offset);
9153
+ return new (0, _chunk7NW46N7Icjs.TilePixelSource)((tx, ty) => _nullishCoalesce(_optionalChain([surface, 'access', _291 => _291.tiles, 'access', _292 => _292.get, 'call', _293 => _293(_chunkCWM3CUUXcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _294 => _294.data]), () => ( (surface.defaultValue ? defaultTile(surface) : null))), surface.channels, offset);
8845
9154
  }
8846
9155
  /** A pixel source over the composite of the current layers (through `throughId` and below, or all of them), as it is now. */
8847
9156
  compositeSource(throughId, depth = null) {
@@ -8917,7 +9226,7 @@ var ImageEditorController = (_class13 = class {
8917
9226
  paintStroke(init) {
8918
9227
  if (!Array.isArray(init.points) || !init.points.length) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("points must hold at least one { x, y } point.");
8919
9228
  for (const p of init.points) {
8920
- if (!Number.isFinite(_optionalChain([p, 'optionalAccess', _293 => _293.x])) || !Number.isFinite(_optionalChain([p, 'optionalAccess', _294 => _294.y]))) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Every point needs finite x and y (document pixels).");
9229
+ if (!Number.isFinite(_optionalChain([p, 'optionalAccess', _295 => _295.x])) || !Number.isFinite(_optionalChain([p, 'optionalAccess', _296 => _296.y]))) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Every point needs finite x and y (document pixels).");
8921
9230
  }
8922
9231
  const session = this.beginStroke(init);
8923
9232
  session.push(init.points);
@@ -8946,7 +9255,7 @@ var ImageEditorController = (_class13 = class {
8946
9255
  */
8947
9256
  strokeSelection(options) {
8948
9257
  const sel = this.state.selection;
8949
- if (!_optionalChain([sel, 'optionalAccess', _295 => _295.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, then stroke the selection.");
9258
+ if (!_optionalChain([sel, 'optionalAccess', _297 => _297.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, then stroke the selection.");
8950
9259
  const width = options.width;
8951
9260
  if (!(width > 0 && width <= 250)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("width must be greater than 0 and at most 250 px.");
8952
9261
  const location = _nullishCoalesce(options.location, () => ( "outside"));
@@ -8963,7 +9272,7 @@ var ImageEditorController = (_class13 = class {
8963
9272
  */
8964
9273
  cropToSelection() {
8965
9274
  const sel = this.state.selection;
8966
- if (!_optionalChain([sel, 'optionalAccess', _296 => _296.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select the area to keep, then crop to it.");
9275
+ if (!_optionalChain([sel, 'optionalAccess', _298 => _298.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select the area to keep, then crop to it.");
8967
9276
  const crop = { ...sel.bounds };
8968
9277
  this.setCrop(crop);
8969
9278
  return crop;
@@ -8977,7 +9286,7 @@ var ImageEditorController = (_class13 = class {
8977
9286
  */
8978
9287
  contentAwareFill(options = {}) {
8979
9288
  const sel = this.state.selection;
8980
- if (!_optionalChain([sel, 'optionalAccess', _297 => _297.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select what to remove, then fill it.");
9289
+ if (!_optionalChain([sel, 'optionalAccess', _299 => _299.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select what to remove, then fill it.");
8981
9290
  if (this.bitDepth !== 8) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Content-Aware Fill works on 8-bit documents for now; set_bit_depth 8 first, or use spot_heal.");
8982
9291
  const output = _nullishCoalesce(options.output, () => ( "current"));
8983
9292
  if (output !== "current" && output !== "new-layer") throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Unknown output "${String(output)}"; use current or new-layer.`);
@@ -9042,8 +9351,8 @@ var ImageEditorController = (_class13 = class {
9042
9351
  */
9043
9352
  copyPixels(options = {}) {
9044
9353
  const { width, height } = this.naturalSize;
9045
- const sel = _optionalChain([this, 'access', _298 => _298.state, 'access', _299 => _299.selection, 'optionalAccess', _300 => _300.bounds]) ? this.state.selection : null;
9046
- const rect = _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _301 => _301.bounds]), () => ( { x: 0, y: 0, width, height }));
9354
+ const sel = _optionalChain([this, 'access', _300 => _300.state, 'access', _301 => _301.selection, 'optionalAccess', _302 => _302.bounds]) ? this.state.selection : null;
9355
+ const rect = _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _303 => _303.bounds]), () => ( { x: 0, y: 0, width, height }));
9047
9356
  let data;
9048
9357
  if (options.merged) {
9049
9358
  data = new Uint8ClampedArray(this.compositePixels(rect).data);
@@ -9083,7 +9392,7 @@ var ImageEditorController = (_class13 = class {
9083
9392
  pastePixels(mode = "new-layer", image = this.clipboard) {
9084
9393
  if (!image) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("The clipboard is empty; copy_pixels first.");
9085
9394
  if (!PASTE_MODES.includes(mode)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Unknown paste mode "${String(mode)}"; use ${PASTE_MODES.join(", ")}.`);
9086
- const sel = _optionalChain([this, 'access', _302 => _302.state, 'access', _303 => _303.selection, 'optionalAccess', _304 => _304.bounds]) ? this.state.selection : null;
9395
+ const sel = _optionalChain([this, 'access', _304 => _304.state, 'access', _305 => _305.selection, 'optionalAccess', _306 => _306.bounds]) ? this.state.selection : null;
9087
9396
  if ((mode === "into" || mode === "outside") && !sel) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Paste ${mode === "into" ? "Into" : "Outside"} needs a selection; select where it goes first.`);
9088
9397
  const { width, height } = this.naturalSize;
9089
9398
  let x;
@@ -9092,7 +9401,7 @@ var ImageEditorController = (_class13 = class {
9092
9401
  x = image.x;
9093
9402
  y = image.y;
9094
9403
  } else {
9095
- const frame = _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _305 => _305.bounds]), () => ( { x: 0, y: 0, width, height }));
9404
+ const frame = _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _307 => _307.bounds]), () => ( { x: 0, y: 0, width, height }));
9096
9405
  x = Math.round(frame.x + (frame.width - image.width) / 2);
9097
9406
  y = Math.round(frame.y + (frame.height - image.height) / 2);
9098
9407
  }
@@ -9109,8 +9418,8 @@ var ImageEditorController = (_class13 = class {
9109
9418
  if (!(opacity >= 0 && opacity <= 1)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("opacity must be from 0 to 1.");
9110
9419
  const blend = _nullishCoalesce(_chunkUYXL6ZWQcjs.parseBlend.call(void 0, options.blend), () => ( "normal"));
9111
9420
  const quickMask = target.channel === "quick-mask";
9112
- const sel = _nullishCoalesce(coverageMask, () => ( (!quickMask && options.useSelection !== false && _optionalChain([this, 'access', _306 => _306.state, 'access', _307 => _307.selection, 'optionalAccess', _308 => _308.bounds]) ? this.state.selection : null)));
9113
- const region = _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _309 => _309.bounds]), () => ( { x: 0, y: 0, width, height }));
9421
+ const sel = _nullishCoalesce(coverageMask, () => ( (!quickMask && options.useSelection !== false && _optionalChain([this, 'access', _308 => _308.state, 'access', _309 => _309.selection, 'optionalAccess', _310 => _310.bounds]) ? this.state.selection : null)));
9422
+ const region = _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _311 => _311.bounds]), () => ( { x: 0, y: 0, width, height }));
9114
9423
  const coverage = new (0, _chunkEBDCRTZIcjs.CoverageMap)();
9115
9424
  const ones = new Float32Array(region.width * region.height);
9116
9425
  if (sel) {
@@ -9235,7 +9544,7 @@ var ImageEditorController = (_class13 = class {
9235
9544
  placeLayer(layers, node, where) {
9236
9545
  if (where.aboveId) {
9237
9546
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, layers, where.aboveId);
9238
- if (loc) return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _310 => _310.parent, 'optionalAccess', _311 => _311.id]), () => ( null)), loc.index + 1);
9547
+ if (loc) return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _312 => _312.parent, 'optionalAccess', _313 => _313.id]), () => ( null)), loc.index + 1);
9239
9548
  }
9240
9549
  if (where.parentId) {
9241
9550
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, layers, where.parentId);
@@ -9246,11 +9555,11 @@ var ImageEditorController = (_class13 = class {
9246
9555
  const at = Math.max(0, Math.min(nodes.length, Math.round(where.adjustmentIndex)));
9247
9556
  if (at < nodes.length) {
9248
9557
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, layers, nodes[at].id);
9249
- return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _312 => _312.parent, 'optionalAccess', _313 => _313.id]), () => ( null)), loc.index);
9558
+ return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _314 => _314.parent, 'optionalAccess', _315 => _315.id]), () => ( null)), loc.index);
9250
9559
  }
9251
9560
  if (nodes.length) {
9252
9561
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, layers, nodes[nodes.length - 1].id);
9253
- return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _314 => _314.parent, 'optionalAccess', _315 => _315.id]), () => ( null)), loc.index + 1);
9562
+ return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _316 => _316.parent, 'optionalAccess', _317 => _317.id]), () => ( null)), loc.index + 1);
9254
9563
  }
9255
9564
  }
9256
9565
  return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, node, null, this.defaultInsertIndex(layers));
@@ -9289,7 +9598,7 @@ var ImageEditorController = (_class13 = class {
9289
9598
  enabled: spec.enabled,
9290
9599
  opacity: spec.opacity,
9291
9600
  blend: spec.blend,
9292
- mask: _nullishCoalesce(spec.mask, () => ( (spec.useSelection && _optionalChain([this, 'access', _316 => _316.state, 'access', _317 => _317.selection, 'optionalAccess', _318 => _318.bounds]) ? _chunkUYXL6ZWQcjs.layerMaskFromSelection.call(void 0, this.state.selection) : void 0)))
9601
+ mask: _nullishCoalesce(spec.mask, () => ( (spec.useSelection && _optionalChain([this, 'access', _318 => _318.state, 'access', _319 => _319.selection, 'optionalAccess', _320 => _320.bounds]) ? _chunkUYXL6ZWQcjs.layerMaskFromSelection.call(void 0, this.state.selection) : void 0)))
9293
9602
  });
9294
9603
  while (ids.has(layer.id)) layer.id = _chunkUYXL6ZWQcjs.newLayerId.call(void 0, "adj");
9295
9604
  const { width, height } = this.naturalSize;
@@ -9366,7 +9675,7 @@ var ImageEditorController = (_class13 = class {
9366
9675
  const anchor = nodes[to];
9367
9676
  const without = _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => null);
9368
9677
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, without, anchor.id);
9369
- return _chunkHGTDMKNEcjs.insertLayer.call(void 0, without, node, _nullishCoalesce(_optionalChain([loc, 'access', _319 => _319.parent, 'optionalAccess', _320 => _320.id]), () => ( null)), to > from ? loc.index + 1 : loc.index);
9678
+ return _chunkHGTDMKNEcjs.insertLayer.call(void 0, without, node, _nullishCoalesce(_optionalChain([loc, 'access', _321 => _321.parent, 'optionalAccess', _322 => _322.id]), () => ( null)), to > from ? loc.index + 1 : loc.index);
9370
9679
  }
9371
9680
  /** Moves a layer to `toIndex` among the adjustment layers (0 = bottom) as one undo step. Returns false if nothing moved. */
9372
9681
  moveAdjustmentLayer(id, toIndex) {
@@ -9407,7 +9716,7 @@ var ImageEditorController = (_class13 = class {
9407
9716
  return _nullishCoalesce(this.state.selection, () => ( null));
9408
9717
  }
9409
9718
  get hasSelection() {
9410
- return Boolean(_optionalChain([this, 'access', _321 => _321.state, 'access', _322 => _322.selection, 'optionalAccess', _323 => _323.bounds]));
9719
+ return Boolean(_optionalChain([this, 'access', _323 => _323.state, 'access', _324 => _324.selection, 'optionalAccess', _325 => _325.bounds]));
9411
9720
  }
9412
9721
  /** Returns the current canvas (composition) dimensions. */
9413
9722
  getCanvasSize() {
@@ -9499,7 +9808,7 @@ var ImageEditorController = (_class13 = class {
9499
9808
  const prev = normalizeSelection(_nullishCoalesce(this.state.selection, () => ( null)));
9500
9809
  if (prev === next || prev && next && sameSelection(prev, next)) return false;
9501
9810
  this.recordHistory();
9502
- if (!next && _optionalChain([prev, 'optionalAccess', _324 => _324.bounds])) this.lastSelection = prev;
9811
+ if (!next && _optionalChain([prev, 'optionalAccess', _326 => _326.bounds])) this.lastSelection = prev;
9503
9812
  this.state.selection = next;
9504
9813
  this.notify();
9505
9814
  return true;
@@ -9542,14 +9851,14 @@ var ImageEditorController = (_class13 = class {
9542
9851
  /** Select › Grow: adds connected pixels within `tolerance` of a selected colour (one undo step). */
9543
9852
  async growSelection(options = {}) {
9544
9853
  const sel = this.state.selection;
9545
- if (!_optionalChain([sel, 'optionalAccess', _325 => _325.bounds])) return false;
9854
+ if (!_optionalChain([sel, 'optionalAccess', _327 => _327.bounds])) return false;
9546
9855
  const pixels = await this.requirePixels(options);
9547
9856
  return this.setSelection(growSelection(pixels, sel, options));
9548
9857
  }
9549
9858
  /** Select › Similar: adds every pixel within `tolerance` of a selected colour (one undo step). */
9550
9859
  async selectSimilar(options = {}) {
9551
9860
  const sel = this.state.selection;
9552
- if (!_optionalChain([sel, 'optionalAccess', _326 => _326.bounds])) return false;
9861
+ if (!_optionalChain([sel, 'optionalAccess', _328 => _328.bounds])) return false;
9553
9862
  const pixels = await this.requirePixels(options);
9554
9863
  return this.setSelection(selectSimilar(pixels, sel, options));
9555
9864
  }
@@ -9663,6 +9972,17 @@ var ImageEditorController = (_class13 = class {
9663
9972
  this.setSelection(region, _nullishCoalesce(options.mode, () => ( "replace")));
9664
9973
  return _nullishCoalesce(this.state.selection, () => ( null));
9665
9974
  }
9975
+ /**
9976
+ * Select › Focus Area: selects the parts of the image that are in focus (fine detail above the
9977
+ * image's noise), fitted to its edges, combined with the selection by `mode` as one undo step.
9978
+ * Resolves to the selection and the noise level measured (σ of luminance in levels).
9979
+ */
9980
+ async selectFocusArea(options = {}) {
9981
+ const pixels = await this.requirePixels({ sample: options.sampleAllLayers === false ? "active-layer" : "composite" });
9982
+ const { selection, noiseLevel } = focusArea(pixels, options);
9983
+ this.setSelection(selection, _nullishCoalesce(options.mode, () => ( "replace")));
9984
+ return { selection: _nullishCoalesce(this.state.selection, () => ( null)), noiseLevel };
9985
+ }
9666
9986
  /**
9667
9987
  * Supplies the pixels the selection tools sample (natural size RGBA), e.g. decoded in a worker
9668
9988
  * or in a test; `null` goes back to reading the source image. Without a canvas (Node, workers)
@@ -9684,7 +10004,7 @@ var ImageEditorController = (_class13 = class {
9684
10004
  try {
9685
10005
  const canvas = await this.renderSource();
9686
10006
  const ctx = canvas.getContext("2d");
9687
- const data2 = _optionalChain([ctx, 'optionalAccess', _327 => _327.getImageData, 'optionalCall', _328 => _328(0, 0, width, height)]);
10007
+ const data2 = _optionalChain([ctx, 'optionalAccess', _329 => _329.getImageData, 'optionalCall', _330 => _330(0, 0, width, height)]);
9688
10008
  if (data2 && data2.data && data2.data.length >= width * height * 4) {
9689
10009
  base = { width, height, data: data2.data };
9690
10010
  this.samplePixels = base;
@@ -9759,7 +10079,7 @@ var ImageEditorController = (_class13 = class {
9759
10079
  /** Select › Modify: grow, shrink, feather, border or smooth by `radius` pixels (one undo step). */
9760
10080
  modifySelection(op, radius) {
9761
10081
  const sel = this.state.selection;
9762
- if (!_optionalChain([sel, 'optionalAccess', _329 => _329.bounds])) return false;
10082
+ if (!_optionalChain([sel, 'optionalAccess', _331 => _331.bounds])) return false;
9763
10083
  return this.setSelection(_chunkUYXL6ZWQcjs.modifySelection.call(void 0, sel, op, radius));
9764
10084
  }
9765
10085
  /**
@@ -9768,7 +10088,7 @@ var ImageEditorController = (_class13 = class {
9768
10088
  */
9769
10089
  async refineSelection(params, options = {}) {
9770
10090
  const sel = this.state.selection;
9771
- if (!_optionalChain([sel, 'optionalAccess', _330 => _330.bounds])) return false;
10091
+ if (!_optionalChain([sel, 'optionalAccess', _332 => _332.bounds])) return false;
9772
10092
  const pixels = (_nullishCoalesce(params.radius, () => ( 0))) > 0 ? await this.requirePixels(options) : null;
9773
10093
  return this.setSelection(refineSelection(pixels, sel, params));
9774
10094
  }
@@ -9799,7 +10119,7 @@ var ImageEditorController = (_class13 = class {
9799
10119
  let mask;
9800
10120
  if (source === "selection") {
9801
10121
  const sel = this.state.selection;
9802
- if (!_optionalChain([sel, 'optionalAccess', _331 => _331.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, or export a channel or a layer mask.");
10122
+ if (!_optionalChain([sel, 'optionalAccess', _333 => _333.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, or export a channel or a layer mask.");
9803
10123
  mask = sel;
9804
10124
  } else if ("channelId" in source) {
9805
10125
  mask = this.requireChannel(source.channelId).mask;
@@ -9823,7 +10143,7 @@ var ImageEditorController = (_class13 = class {
9823
10143
  const canvas = this.renderer.createCanvas(w, h);
9824
10144
  const ctx = canvas.getContext("2d");
9825
10145
  if (ctx) ctx.drawImage(img, 0, 0, w, h);
9826
- const data = _optionalChain([ctx, 'optionalAccess', _332 => _332.getImageData, 'optionalCall', _333 => _333(0, 0, w, h)]);
10146
+ const data = _optionalChain([ctx, 'optionalAccess', _334 => _334.getImageData, 'optionalCall', _335 => _335(0, 0, w, h)]);
9827
10147
  if (!data) throw new Error("The mask image pixels are not available (no canvas access); pass pixels.");
9828
10148
  return { width: w, height: h, data: data.data };
9829
10149
  }
@@ -9831,37 +10151,50 @@ var ImageEditorController = (_class13 = class {
9831
10151
  * Select › Subject: asks the segmentation provider for the objects matching `target` ("the
9832
10152
  * dog", "the sky") in the flattened image and selects their shapes, combined with the
9833
10153
  * selection by `mode`, as one undo step. Returns what was found (labels and bounds in natural
9834
- * pixels); an empty list leaves the selection as it was. Throws without a provider.
10154
+ * pixels); an empty list leaves the selection as it was. Without a provider, the subject that
10155
+ * stands out most is found classically (superpixels, saliency, Otsu, GrabCut): `target` can't
10156
+ * choose it, and `method: 'saliency'` and a `note` say so.
9835
10157
  */
9836
- async selectSubject(target, options = {}) {
10158
+ async selectSubject(target = "", options = {}) {
9837
10159
  const provider = this.segmentation;
9838
- if (!provider) throw new Error("Select Subject needs a segmentation provider (setSegmentationProvider).");
10160
+ if (!provider) {
10161
+ const pixels = await this.requirePixels({});
10162
+ _optionalChain([options, 'access', _336 => _336.signal, 'optionalAccess', _337 => _337.throwIfAborted, 'call', _338 => _338()]);
10163
+ const { selection, reason } = findSubject(pixels, { enhanceEdge: options.enhanceEdge });
10164
+ if (selection.bounds) this.shapeCommand(selection, options);
10165
+ const unused = target.trim() ? ` "${target.trim()}" was not used to choose it.` : "";
10166
+ return {
10167
+ segments: selection.bounds ? [{ label: "subject", bounds: selection.bounds }] : [],
10168
+ method: "saliency",
10169
+ note: _nullishCoalesce(reason, () => ( `No segmentation model is set, so the subject that stands out most was selected.${unused}`))
10170
+ };
10171
+ }
9839
10172
  const description = target.trim();
9840
10173
  if (!description) throw new Error("Describe the subject to select.");
9841
10174
  const { width, height } = this.naturalSize;
9842
10175
  const image = await this.toDataURL({ format: "image/png" });
9843
10176
  const results = await provider.segment({ image, width, height, target: description, maxSegments: options.maxSegments, signal: options.signal });
9844
- _optionalChain([options, 'access', _334 => _334.signal, 'optionalAccess', _335 => _335.throwIfAborted, 'call', _336 => _336()]);
10177
+ _optionalChain([options, 'access', _339 => _339.signal, 'optionalAccess', _340 => _340.throwIfAborted, 'call', _341 => _341()]);
9845
10178
  const decoded = [];
9846
10179
  for (const r of _nullishCoalesce(results, () => ( []))) {
9847
10180
  decoded.push({ ...r, mask: r.mask !== void 0 ? await this.decodeMaskImage(r.mask) : void 0 });
9848
10181
  }
9849
10182
  const segments = decoded.map((r) => {
9850
10183
  const one = segmentsToSelection(width, height, [r]);
9851
- return { label: r.label || description, bounds: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _337 => _337.bounds]), () => ( null)), ...r.score !== void 0 ? { score: r.score } : {} };
10184
+ return { label: r.label || description, bounds: _nullishCoalesce(_optionalChain([one, 'optionalAccess', _342 => _342.bounds]), () => ( null)), ...r.score !== void 0 ? { score: r.score } : {} };
9852
10185
  });
9853
10186
  const mask = segmentsToSelection(width, height, decoded);
9854
10187
  if (mask && options.beforeApply) {
9855
10188
  const outlines = decoded.flatMap((r, i) => {
9856
10189
  const rings = segmentationOutlines(r);
9857
- const b = _optionalChain([segments, 'access', _338 => _338[i], 'optionalAccess', _339 => _339.bounds]);
10190
+ const b = _optionalChain([segments, 'access', _343 => _343[i], 'optionalAccess', _344 => _344.bounds]);
9858
10191
  return rings.length ? rings : b ? [[{ x: b.x, y: b.y }, { x: b.x + b.width, y: b.y }, { x: b.x + b.width, y: b.y + b.height }, { x: b.x, y: b.y + b.height }]] : [];
9859
10192
  });
9860
10193
  await options.beforeApply(outlines);
9861
- _optionalChain([options, 'access', _340 => _340.signal, 'optionalAccess', _341 => _341.throwIfAborted, 'call', _342 => _342()]);
10194
+ _optionalChain([options, 'access', _345 => _345.signal, 'optionalAccess', _346 => _346.throwIfAborted, 'call', _347 => _347()]);
9862
10195
  }
9863
10196
  if (mask) this.shapeCommand(mask, options);
9864
- return { segments: segments.filter((s) => s.bounds) };
10197
+ return { segments: segments.filter((s) => s.bounds), method: "model" };
9865
10198
  }
9866
10199
  /** Quick Mask view (tints the unselected area). View state: no undo step. */
9867
10200
  setQuickMask(on) {
@@ -9891,7 +10224,7 @@ var ImageEditorController = (_class13 = class {
9891
10224
  const view = this.state.maskView;
9892
10225
  if (!view) return null;
9893
10226
  const layer = this.getLayer(view.layerId);
9894
- return _optionalChain([layer, 'optionalAccess', _343 => _343.mask]) && !layer.mask.source ? view : null;
10227
+ return _optionalChain([layer, 'optionalAccess', _348 => _348.mask]) && !layer.mask.source ? view : null;
9895
10228
  }
9896
10229
  /**
9897
10230
  * Shows a layer's mask on the canvas: `gray` alone in grey (Alt-click the mask thumbnail),
@@ -9914,7 +10247,7 @@ var ImageEditorController = (_class13 = class {
9914
10247
  if (!layer.mask) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${layer.name || id}" has no mask to show; add one with add_layer_mask.`);
9915
10248
  if (layer.mask.source) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${layer.name || id}" has a depth mask, which is computed, not painted, so it has no mask view.`);
9916
10249
  const cur = this.state.maskView;
9917
- if (_optionalChain([cur, 'optionalAccess', _344 => _344.layerId]) !== id || cur.mode !== mode) {
10250
+ if (_optionalChain([cur, 'optionalAccess', _349 => _349.layerId]) !== id || cur.mode !== mode) {
9918
10251
  this.state.maskView = { layerId: id, mode };
9919
10252
  this.notify();
9920
10253
  }
@@ -9926,7 +10259,7 @@ var ImageEditorController = (_class13 = class {
9926
10259
  return _nullishCoalesce(this.state.channels, () => ( []));
9927
10260
  }
9928
10261
  getChannel(id) {
9929
- return _nullishCoalesce(_optionalChain([this, 'access', _345 => _345.state, 'access', _346 => _346.channels, 'optionalAccess', _347 => _347.find, 'call', _348 => _348((c) => c.id === id)]), () => ( null));
10262
+ return _nullishCoalesce(_optionalChain([this, 'access', _350 => _350.state, 'access', _351 => _351.channels, 'optionalAccess', _352 => _352.find, 'call', _353 => _353((c) => c.id === id)]), () => ( null));
9930
10263
  }
9931
10264
  requireChannel(id) {
9932
10265
  const channel = this.getChannel(id);
@@ -9955,14 +10288,14 @@ var ImageEditorController = (_class13 = class {
9955
10288
  */
9956
10289
  saveSelection(options = {}) {
9957
10290
  const sel = this.state.selection;
9958
- if (!_optionalChain([sel, 'optionalAccess', _349 => _349.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, then save the selection to a channel.");
10291
+ if (!_optionalChain([sel, 'optionalAccess', _354 => _354.bounds])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Nothing is selected; select first, then save the selection to a channel.");
9959
10292
  const { width, height } = this.naturalSize;
9960
10293
  const sized = sel.width === width && sel.height === height ? sel : _chunkUYXL6ZWQcjs.resizeSelection.call(void 0, sel, width, height);
9961
10294
  const channels = [...this.getChannels()];
9962
10295
  if (options.channelId !== void 0) {
9963
10296
  const existing = this.requireChannel(options.channelId);
9964
10297
  const mask = _nullishCoalesce(_chunkUYXL6ZWQcjs.combineSelections.call(void 0, existing.mask.bounds ? existing.mask : null, sized, _nullishCoalesce(options.mode, () => ( "replace"))), () => ( _chunkUYXL6ZWQcjs.createSelectionMask.call(void 0, width, height)));
9965
- const next = { ...existing, mask, ..._optionalChain([options, 'access', _350 => _350.name, 'optionalAccess', _351 => _351.trim, 'call', _352 => _352()]) ? { name: options.name.trim() } : {} };
10298
+ const next = { ...existing, mask, ..._optionalChain([options, 'access', _355 => _355.name, 'optionalAccess', _356 => _356.trim, 'call', _357 => _357()]) ? { name: options.name.trim() } : {} };
9966
10299
  this.setChannels(channels.map((c) => c.id === existing.id ? next : c));
9967
10300
  return next;
9968
10301
  }
@@ -9973,7 +10306,7 @@ var ImageEditorController = (_class13 = class {
9973
10306
  const channels = this.getChannels();
9974
10307
  const channel = {
9975
10308
  id: this.newChannelId(),
9976
- name: _optionalChain([name, 'optionalAccess', _353 => _353.trim, 'call', _354 => _354()]) || `Alpha ${channels.length + 1}`,
10309
+ name: _optionalChain([name, 'optionalAccess', _358 => _358.trim, 'call', _359 => _359()]) || `Alpha ${channels.length + 1}`,
9977
10310
  mask,
9978
10311
  color: DEFAULT_CHANNEL_COLOR,
9979
10312
  opacity: 0.5,
@@ -10018,7 +10351,7 @@ var ImageEditorController = (_class13 = class {
10018
10351
  /** Duplicates an alpha channel just after it (one undo step). Returns the copy. */
10019
10352
  duplicateChannel(id, name) {
10020
10353
  const channel = this.requireChannel(id);
10021
- const copy = { ...channel, id: this.newChannelId(), name: _optionalChain([name, 'optionalAccess', _355 => _355.trim, 'call', _356 => _356()]) || `${channel.name} copy` };
10354
+ const copy = { ...channel, id: this.newChannelId(), name: _optionalChain([name, 'optionalAccess', _360 => _360.trim, 'call', _361 => _361()]) || `${channel.name} copy` };
10022
10355
  const channels = [...this.getChannels()];
10023
10356
  channels.splice(channels.findIndex((c) => c.id === id) + 1, 0, copy);
10024
10357
  this.setChannels(channels);
@@ -10049,7 +10382,7 @@ var ImageEditorController = (_class13 = class {
10049
10382
  quickMaskSurface() {
10050
10383
  const { width, height } = this.naturalSize;
10051
10384
  const sel = this.state.selection;
10052
- if (!_optionalChain([sel, 'optionalAccess', _357 => _357.bounds])) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 1, 0);
10385
+ if (!_optionalChain([sel, 'optionalAccess', _362 => _362.bounds])) return _chunkCWM3CUUXcjs.emptySurface.call(void 0, 1, 0);
10053
10386
  return (sel.width === width && sel.height === height ? sel : _chunkUYXL6ZWQcjs.resizeSelection.call(void 0, sel, width, height)).surface;
10054
10387
  }
10055
10388
  /** The selection a painted Quick Mask surface stands for (it shares the surface's tiles). */
@@ -10070,7 +10403,7 @@ var ImageEditorController = (_class13 = class {
10070
10403
  */
10071
10404
  applySelectionAsLayerMask(layerId, props = {}) {
10072
10405
  const sel = this.state.selection;
10073
- if (!_optionalChain([sel, 'optionalAccess', _358 => _358.bounds]) || !this.getAdjustmentLayer(layerId)) return false;
10406
+ if (!_optionalChain([sel, 'optionalAccess', _363 => _363.bounds]) || !this.getAdjustmentLayer(layerId)) return false;
10074
10407
  return this.setLayerMask(layerId, this.maskFromSelection(sel, props));
10075
10408
  }
10076
10409
  setLayerMask(layerId, mask, commitToHistory = true) {
@@ -10110,7 +10443,7 @@ var ImageEditorController = (_class13 = class {
10110
10443
  /** A layer's painted mask over the canvas as a selection mask; null without one (or for a depth mask). */
10111
10444
  layerMaskCoverage(layerId) {
10112
10445
  const layer = this.getLayer(layerId);
10113
- if (!_optionalChain([layer, 'optionalAccess', _359 => _359.mask]) || layer.mask.source) return null;
10446
+ if (!_optionalChain([layer, 'optionalAccess', _364 => _364.mask]) || layer.mask.source) return null;
10114
10447
  const { width, height } = this.naturalSize;
10115
10448
  const ox = layer.type === "pixel" ? layer.offset.x : 0;
10116
10449
  const oy = layer.type === "pixel" ? layer.offset.y : 0;
@@ -10145,7 +10478,7 @@ var ImageEditorController = (_class13 = class {
10145
10478
  this.state.layers = _chunkHGTDMKNEcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
10146
10479
  const next = { ...l };
10147
10480
  if (_chunkUYXL6ZWQcjs.isDefaultDepthMask.call(void 0, merged)) {
10148
- if (_optionalChain([next, 'access', _360 => _360.mask, 'optionalAccess', _361 => _361.source])) delete next.mask;
10481
+ if (_optionalChain([next, 'access', _365 => _365.mask, 'optionalAccess', _366 => _366.source])) delete next.mask;
10149
10482
  } else next.mask = _chunkUYXL6ZWQcjs.depthRasterMask.call(void 0, merged);
10150
10483
  return next;
10151
10484
  });
@@ -10155,7 +10488,7 @@ var ImageEditorController = (_class13 = class {
10155
10488
  resetDepthMask() {
10156
10489
  this.recordHistory();
10157
10490
  const target = this.developLayer();
10158
- if (_optionalChain([target, 'optionalAccess', _362 => _362.mask, 'optionalAccess', _363 => _363.source])) {
10491
+ if (_optionalChain([target, 'optionalAccess', _367 => _367.mask, 'optionalAccess', _368 => _368.source])) {
10159
10492
  this.state.layers = _chunkHGTDMKNEcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
10160
10493
  const next = { ...l };
10161
10494
  delete next.mask;
@@ -10167,7 +10500,7 @@ var ImageEditorController = (_class13 = class {
10167
10500
  // --- Annotations & Layers ---
10168
10501
  /** The layer showing annotation `id`: an annotation layer, or a shape layer migrated from it. */
10169
10502
  annotationLayer(id) {
10170
- return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers).find((l) => (l.type === "annotation" || l.type === "shape" || l.type === "type") && _optionalChain([_chunkUYXL6ZWQcjs.annotationOfLayer.call(void 0, l), 'optionalAccess', _364 => _364.id]) === id);
10503
+ return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers).find((l) => (l.type === "annotation" || l.type === "shape" || l.type === "type") && _optionalChain([_chunkUYXL6ZWQcjs.annotationOfLayer.call(void 0, l), 'optionalAccess', _369 => _369.id]) === id);
10171
10504
  }
10172
10505
  /** What migrating an annotation needs: the canvas size, patterns and the text shaper. */
10173
10506
  annotationEnv() {
@@ -10185,7 +10518,7 @@ var ImageEditorController = (_class13 = class {
10185
10518
  const fullAnnotation = { ...annotation, id };
10186
10519
  const layer = _chunkUYXL6ZWQcjs.annotationLayerFor.call(void 0, fullAnnotation, this.annotationEnv());
10187
10520
  const loc = placement.aboveId ? _chunkHGTDMKNEcjs.findLayer.call(void 0, this.state.layers, placement.aboveId) : null;
10188
- this.state.layers = loc ? _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, layer, _nullishCoalesce(_optionalChain([loc, 'access', _365 => _365.parent, 'optionalAccess', _366 => _366.id]), () => ( null)), loc.index + 1) : _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, layer, null);
10521
+ this.state.layers = loc ? _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, layer, _nullishCoalesce(_optionalChain([loc, 'access', _370 => _370.parent, 'optionalAccess', _371 => _371.id]), () => ( null)), loc.index + 1) : _chunkHGTDMKNEcjs.insertLayer.call(void 0, this.state.layers, layer, null);
10189
10522
  this.state.selectedAnnotationId = id;
10190
10523
  this.notify();
10191
10524
  return id;
@@ -10308,7 +10641,7 @@ var ImageEditorController = (_class13 = class {
10308
10641
  await this.renderer.renderToCanvas(targetCanvas, source, this.state, {
10309
10642
  ...options,
10310
10643
  // The clone source follows the brush cursor (both editors pass it).
10311
- cloneSourceMarker: _optionalChain([options, 'optionalAccess', _367 => _367.cloneSourceMarker]) !== void 0 ? options.cloneSourceMarker : _optionalChain([options, 'optionalAccess', _368 => _368.brushCursor]) ? this.cloneSourceMarker(options.brushCursor) : null,
10644
+ cloneSourceMarker: _optionalChain([options, 'optionalAccess', _372 => _372.cloneSourceMarker]) !== void 0 ? options.cloneSourceMarker : _optionalChain([options, 'optionalAccess', _373 => _373.brushCursor]) ? this.cloneSourceMarker(options.brushCursor) : null,
10312
10645
  dirty: dirty === "all" ? void 0 : dirty,
10313
10646
  checkpointLayerId: this.state.activeLayerId
10314
10647
  });
@@ -10321,7 +10654,7 @@ var ImageEditorController = (_class13 = class {
10321
10654
  return this.renderer.createCanvas(1, 1);
10322
10655
  }
10323
10656
  this.syncViews();
10324
- if (_optionalChain([options, 'optionalAccess', _369 => _369.layerIds])) {
10657
+ if (_optionalChain([options, 'optionalAccess', _374 => _374.layerIds])) {
10325
10658
  const keep = new Set(options.layerIds);
10326
10659
  const layers = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => keep.has(l.id));
10327
10660
  return this.renderer.renderExport(source, { ...this.state, layers }, options);
@@ -10475,7 +10808,7 @@ var ImageEditorController = (_class13 = class {
10475
10808
  let px2 = await this.decodeImage(newDataUrl);
10476
10809
  if (px2.width !== width || px2.height !== height) px2 = resizePixels(px2, width, height);
10477
10810
  const data = new Uint8ClampedArray(px2.data);
10478
- const sel = _optionalChain([this, 'access', _370 => _370.state, 'access', _371 => _371.selection, 'optionalAccess', _372 => _372.bounds]) ? this.state.selection : null;
10811
+ const sel = _optionalChain([this, 'access', _375 => _375.state, 'access', _376 => _376.selection, 'optionalAccess', _377 => _377.bounds]) ? this.state.selection : null;
10479
10812
  if (sel) for (let p = 0, i = 3; p < width * height; p++, i += 4) data[i] = Math.round(data[i] * sel.data[p] / 255);
10480
10813
  return this.addPixelLayer({ name: "Inpaint", pixels: { width, height, data } });
10481
10814
  }
@@ -10522,7 +10855,7 @@ var ImageEditorController = (_class13 = class {
10522
10855
  }
10523
10856
  /** Font families the shaper offers (generic families at least). */
10524
10857
  listFonts() {
10525
- return _nullishCoalesce(_optionalChain([this, 'access', _373 => _373.getTextShaper, 'call', _374 => _374(), 'optionalAccess', _375 => _375.families, 'optionalCall', _376 => _376()]), () => ( ["sans-serif", "serif", "monospace"]));
10858
+ return _nullishCoalesce(_optionalChain([this, 'access', _378 => _378.getTextShaper, 'call', _379 => _379(), 'optionalAccess', _380 => _380.families, 'optionalCall', _381 => _381()]), () => ( ["sans-serif", "serif", "monospace"]));
10526
10859
  }
10527
10860
  typeInfo(id) {
10528
10861
  const layer = _chunkUYXL6ZWQcjs.requireTypeLayer.call(void 0, this.state.layers, id);
@@ -10596,8 +10929,8 @@ var ImageEditorController = (_class13 = class {
10596
10929
  const layer = this.layoutTypeLayer({ ...init, text, orientation: vertical ? "vertical" : "horizontal" });
10597
10930
  const { width, height } = this.naturalSize;
10598
10931
  const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
10599
- const x0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess', _377 => _377.x]), () => ( 0)));
10600
- const y0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess', _378 => _378.y]), () => ( 0)));
10932
+ const x0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess', _382 => _382.x]), () => ( 0)));
10933
+ const y0 = Math.max(0, _nullishCoalesce(_optionalChain([b, 'optionalAccess', _383 => _383.y]), () => ( 0)));
10601
10934
  const x1 = Math.min(width, b ? b.x + b.width : 0);
10602
10935
  const y1 = Math.min(height, b ? b.y + b.height : 0);
10603
10936
  let mask;
@@ -10774,7 +11107,7 @@ var ImageEditorController = (_class13 = class {
10774
11107
  if (colors.size > 1) warnings.push("The text had several colours; the shape takes the first one.");
10775
11108
  const missing = _chunkBRKVNXDZcjs.layoutText.call(void 0, layer, shaper).missingFonts;
10776
11109
  if (missing.length) warnings.push(`Missing fonts were drawn with a fallback: ${missing.join(", ")}.`);
10777
- const first = _nullishCoalesce(_optionalChain([layer, 'access', _379 => _379.runs, 'access', _380 => _380.find, 'call', _381 => _381((r) => r.length > 0), 'optionalAccess', _382 => _382.style]), () => ( _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE));
11110
+ const first = _nullishCoalesce(_optionalChain([layer, 'access', _384 => _384.runs, 'access', _385 => _385.find, 'call', _386 => _386((r) => r.length > 0), 'optionalAccess', _387 => _387.style]), () => ( _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE));
10778
11111
  const fill = first.opacity !== void 0 && first.opacity !== 1 ? { type: "color", color: first.color, opacity: first.opacity } : { type: "color", color: first.color };
10779
11112
  const shape = _chunkUYXL6ZWQcjs.createShapeLayer.call(void 0, { components: [{ op: "combine", subpaths }], fill, stroke: null, name: layer.name }, this.shapeEnv(), layer.id);
10780
11113
  const keep = { visible: layer.visible, opacity: layer.opacity, blend: layer.blend };
@@ -10807,7 +11140,7 @@ var ImageEditorController = (_class13 = class {
10807
11140
  // --- Shape layers ---
10808
11141
  /** What shape rendering needs: the canvas size and the document's patterns. */
10809
11142
  shapeEnv() {
10810
- return { ...this.naturalSize, pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _383 => _383.state, 'access', _384 => _384.patterns, 'optionalAccess', _385 => _385.find, 'call', _386 => _386((p) => p.id === id)]), () => ( null)) };
11143
+ return { ...this.naturalSize, pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _388 => _388.state, 'access', _389 => _389.patterns, 'optionalAccess', _390 => _390.find, 'call', _391 => _391((p) => p.id === id)]), () => ( null)) };
10811
11144
  }
10812
11145
  /** One component from tool or UI input (validated). */
10813
11146
  componentFrom(spec, path) {
@@ -10850,9 +11183,9 @@ var ImageEditorController = (_class13 = class {
10850
11183
  * open path) and stroked with `stroke`. Goes above the active layer unless placed. Returns its id.
10851
11184
  */
10852
11185
  addShapeLayer(init) {
10853
- const specs = _optionalChain([init, 'access', _387 => _387.components, 'optionalAccess', _388 => _388.length]) ? init.components : [init];
10854
- if (_optionalChain([init, 'access', _389 => _389.components, 'optionalAccess', _390 => _390.length]) && (init.shape !== void 0 || init.subpaths !== void 0)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Give components, or shape / subpaths, not both.");
10855
- const components = specs.map((c, i) => this.componentFrom(c, _optionalChain([init, 'access', _391 => _391.components, 'optionalAccess', _392 => _392.length]) ? `components[${i}].` : ""));
11186
+ const specs = _optionalChain([init, 'access', _392 => _392.components, 'optionalAccess', _393 => _393.length]) ? init.components : [init];
11187
+ if (_optionalChain([init, 'access', _394 => _394.components, 'optionalAccess', _395 => _395.length]) && (init.shape !== void 0 || init.subpaths !== void 0)) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Give components, or shape / subpaths, not both.");
11188
+ const components = specs.map((c, i) => this.componentFrom(c, _optionalChain([init, 'access', _396 => _396.components, 'optionalAccess', _397 => _397.length]) ? `components[${i}].` : ""));
10856
11189
  const stroke = init.stroke ? _chunkUYXL6ZWQcjs.normalizeShapeStroke.call(void 0, init.stroke, "stroke") : null;
10857
11190
  const openOnly = components.every((c) => !c.live && c.subpaths.every((sp) => !sp.closed));
10858
11191
  const fill = init.fill === void 0 ? stroke && openOnly ? null : _chunkUYXL6ZWQcjs.normalizeShapePaint.call(void 0, this.state.paint.foreground, "fill") : init.fill === null ? null : _chunkUYXL6ZWQcjs.normalizeShapePaint.call(void 0, init.fill, "fill");
@@ -10963,7 +11296,7 @@ var ImageEditorController = (_class13 = class {
10963
11296
  if (layer.locks) next.locks = layer.locks;
10964
11297
  if (this.state.selectedAnnotationId === layer.annotation.id) this.state.selectedAnnotationId = null;
10965
11298
  } else if (layer.type === "pixel") {
10966
- if (!_optionalChain([layer, 'access', _393 => _393.filters, 'optionalAccess', _394 => _394.length])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${layer.name || id}" is already pixels with no filters to bake.`);
11299
+ if (!_optionalChain([layer, 'access', _398 => _398.filters, 'optionalAccess', _399 => _399.length])) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Layer "${layer.name || id}" is already pixels with no filters to bake.`);
10967
11300
  _chunkUYXL6ZWQcjs.requireUnlocked.call(void 0, layer, "pixels", "rasterize it");
10968
11301
  const spatial = layer.filters.some((f) => f.enabled && f.kind === "blur");
10969
11302
  const content = { ...layer, visible: true, opacity: 1, blend: "normal" };
@@ -10982,7 +11315,7 @@ var ImageEditorController = (_class13 = class {
10982
11315
  return this.rasterizeSmartObject(id);
10983
11316
  } else if (layer.type === "shape" || layer.type === "type") {
10984
11317
  next = layer.type === "shape" ? _chunkUYXL6ZWQcjs.shapeAsPixelLayer.call(void 0, layer) : _chunkUYXL6ZWQcjs.typeAsPixelLayer.call(void 0, layer);
10985
- if (this.state.selectedAnnotationId && this.state.selectedAnnotationId === _optionalChain([layer, 'access', _395 => _395.annotation, 'optionalAccess', _396 => _396.id])) this.state.selectedAnnotationId = null;
11318
+ if (this.state.selectedAnnotationId && this.state.selectedAnnotationId === _optionalChain([layer, 'access', _400 => _400.annotation, 'optionalAccess', _401 => _401.id])) this.state.selectedAnnotationId = null;
10986
11319
  } else {
10987
11320
  throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Only shape, type and annotation layers, smart objects and pixel layers with filters rasterize; "${layer.name || id}" is a ${layer.type} layer. Merge it down or flatten instead.`);
10988
11321
  }
@@ -10996,8 +11329,8 @@ var ImageEditorController = (_class13 = class {
10996
11329
  const doc = this.state.colorProfile;
10997
11330
  const p = resolveProfile(doc);
10998
11331
  const m = this.state.colorMode;
10999
- const out = { name: _nullishCoalesce(_optionalChain([doc, 'optionalAccess', _397 => _397.name]), () => ( p.description)), builtin: doc ? _nullishCoalesce(doc.builtin, () => ( null)) : "srgb", colorSpace: p.colorSpace, srgb: isSrgb(doc), mode: _nullishCoalesce(_optionalChain([m, 'optionalAccess', _398 => _398.mode]), () => ( "rgb")) };
11000
- if (_optionalChain([m, 'optionalAccess', _399 => _399.mode]) === "cmyk") out.cmykProfile = { name: m.profile.name, builtin: _nullishCoalesce(m.profile.builtin, () => ( null)), intent: m.intent };
11332
+ const out = { name: _nullishCoalesce(_optionalChain([doc, 'optionalAccess', _402 => _402.name]), () => ( p.description)), builtin: doc ? _nullishCoalesce(doc.builtin, () => ( null)) : "srgb", colorSpace: p.colorSpace, srgb: isSrgb(doc), mode: _nullishCoalesce(_optionalChain([m, 'optionalAccess', _403 => _403.mode]), () => ( "rgb")) };
11333
+ if (_optionalChain([m, 'optionalAccess', _404 => _404.mode]) === "cmyk") out.cmykProfile = { name: m.profile.name, builtin: _nullishCoalesce(m.profile.builtin, () => ( null)), intent: m.intent };
11001
11334
  return out;
11002
11335
  }
11003
11336
  /**
@@ -11087,7 +11420,7 @@ var ImageEditorController = (_class13 = class {
11087
11420
  const textEnv = this.textEnv();
11088
11421
  const walk = (layers) => layers.map((l) => {
11089
11422
  let next2 = l;
11090
- if (_optionalChain([l, 'access', _400 => _400.effects, 'optionalAccess', _401 => _401.items, 'access', _402 => _402.length])) next2 = { ...next2, effects: convertColorFields(l.effects, hex) };
11423
+ if (_optionalChain([l, 'access', _405 => _405.effects, 'optionalAccess', _406 => _406.items, 'access', _407 => _407.length])) next2 = { ...next2, effects: convertColorFields(l.effects, hex) };
11091
11424
  if (l.type === "group") {
11092
11425
  if (next2 !== l) converted.push(l.id);
11093
11426
  return { ...next2, children: walk(l.children) };
@@ -11156,7 +11489,7 @@ var ImageEditorController = (_class13 = class {
11156
11489
  }
11157
11490
  if (src.colorSpace !== "rgb") throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)("Colours are given as #rrggbb, so the source profile must be RGB.");
11158
11491
  const t = _chunkBROJYMWUcjs.Transform.create(src, dst, { intent: _nullishCoalesce(options.intent, () => ( "relative")), bpc: _nullishCoalesce(options.bpc, () => ( true)) });
11159
- const toLab = _chunkBROJYMWUcjs.Transform.create(src, _chunkBROJYMWUcjs.builtinProfile.call(void 0, "lab-d50"), { intent: "relative", bpc: false });
11492
+ const toLab2 = _chunkBROJYMWUcjs.Transform.create(src, _chunkBROJYMWUcjs.builtinProfile.call(void 0, "lab-d50"), { intent: "relative", bpc: false });
11160
11493
  return colors.map((input) => {
11161
11494
  const m = /^#?([0-9a-f]{6})$/i.exec(input.trim());
11162
11495
  if (!m) throw new (0, _chunkUYXL6ZWQcjs.LayerOperationError)(`Invalid colour "${input}"; use #rrggbb.`);
@@ -11166,7 +11499,7 @@ var ImageEditorController = (_class13 = class {
11166
11499
  t.eval(rgb, out);
11167
11500
  const values = Array.from(out.subarray(0, t.outputs), (v) => Math.round(Math.min(1, Math.max(0, v)) * 1e4) / 1e4);
11168
11501
  const l = new Float32Array(3);
11169
- toLab.eval(rgb, l);
11502
+ toLab2.eval(rgb, l);
11170
11503
  const lab = [Math.round(l[0] * 1e4) / 100, Math.round((l[1] * 255 - 128) * 100) / 100, Math.round((l[2] * 255 - 128) * 100) / 100];
11171
11504
  const res = { input, values, lab };
11172
11505
  if (dst.colorSpace === "rgb") res.hex = `#${values.map((v) => Math.round(v * 255).toString(16).padStart(2, "0")).join("")}`;
@@ -11271,8 +11604,8 @@ var ImageEditorController = (_class13 = class {
11271
11604
  else delete s.bitDepth;
11272
11605
  delete s.colorProfile;
11273
11606
  delete s.colorMode;
11274
- if (_optionalChain([result, 'access', _403 => _403.sourceMode, 'optionalAccess', _404 => _404.mode]) === "cmyk") s.colorMode = { mode: "cmyk", profile: result.sourceMode.profile, intent: "relative" };
11275
- else if (_optionalChain([result, 'access', _405 => _405.sourceMode, 'optionalAccess', _406 => _406.mode]) === "lab") s.colorMode = { mode: "lab" };
11607
+ if (_optionalChain([result, 'access', _408 => _408.sourceMode, 'optionalAccess', _409 => _409.mode]) === "cmyk") s.colorMode = { mode: "cmyk", profile: result.sourceMode.profile, intent: "relative" };
11608
+ else if (_optionalChain([result, 'access', _410 => _410.sourceMode, 'optionalAccess', _411 => _411.mode]) === "lab") s.colorMode = { mode: "lab" };
11276
11609
  else if (result.iccProfile) {
11277
11610
  try {
11278
11611
  const doc = documentProfile(result.iccProfile);
@@ -11336,7 +11669,7 @@ var ImageEditorController = (_class13 = class {
11336
11669
  const compositor = new (0, _chunkUYXL6ZWQcjs.LayerCompositor)();
11337
11670
  const bakeMask = (layer) => {
11338
11671
  const mask = layer.mask;
11339
- if (!_optionalChain([mask, 'optionalAccess', _407 => _407.source])) return mask;
11672
+ if (!_optionalChain([mask, 'optionalAccess', _412 => _412.source])) return mask;
11340
11673
  add2("Parametric (depth) masks were baked into pixel masks", layer.name);
11341
11674
  const plain3 = { ...layer, mask: { ...mask, density: 1, feather: 0, enabled: true } };
11342
11675
  const ox = layer.type === "pixel" ? layer.offset.x : 0;
@@ -11353,7 +11686,7 @@ var ImageEditorController = (_class13 = class {
11353
11686
  };
11354
11687
  const prepare = async (layer) => {
11355
11688
  const p = await prepareLayer(layer);
11356
- if (_optionalChain([p, 'optionalAccess', _408 => _408.blend]) === "pigment") add2("The Pigment blend mode has no PSD equivalent and was written as Normal", layer.name);
11689
+ if (_optionalChain([p, 'optionalAccess', _413 => _413.blend]) === "pigment") add2("The Pigment blend mode has no PSD equivalent and was written as Normal", layer.name);
11357
11690
  return p;
11358
11691
  };
11359
11692
  const prepareLayer = async (layer) => {
@@ -11396,7 +11729,7 @@ var ImageEditorController = (_class13 = class {
11396
11729
  return out2;
11397
11730
  }
11398
11731
  if (layer.type === "shape" || layer.type === "type") {
11399
- if (layer.type === "type" && _optionalChain([layer, 'access', _409 => _409.missingFonts, 'optionalAccess', _410 => _410.length])) add2(`Type layers drawn with a fallback for missing fonts (${layer.missingFonts.join(", ")}) keep the font names, so Photoshop may draw them differently`, layer.name);
11732
+ if (layer.type === "type" && _optionalChain([layer, 'access', _414 => _414.missingFonts, 'optionalAccess', _415 => _415.length])) add2(`Type layers drawn with a fallback for missing fonts (${layer.missingFonts.join(", ")}) keep the font names, so Photoshop may draw them differently`, layer.name);
11400
11733
  const out2 = { ...layer };
11401
11734
  const mask2 = bakeMask(layer);
11402
11735
  if (mask2) out2.mask = mask2;
@@ -11415,7 +11748,7 @@ var ImageEditorController = (_class13 = class {
11415
11748
  out.surface = this.surfaceOf(layer);
11416
11749
  delete out.source;
11417
11750
  }
11418
- const active = _nullishCoalesce(_optionalChain([layer, 'access', _411 => _411.filters, 'optionalAccess', _412 => _412.filter, 'call', _413 => _413(_chunkUYXL6ZWQcjs.isActiveFilter)]), () => ( []));
11751
+ const active = _nullishCoalesce(_optionalChain([layer, 'access', _416 => _416.filters, 'optionalAccess', _417 => _417.filter, 'call', _418 => _418(_chunkUYXL6ZWQcjs.isActiveFilter)]), () => ( []));
11419
11752
  if (active.length) {
11420
11753
  add2("Layer filters (develop, blur) were baked into the pixels", layer.name);
11421
11754
  const content = { ...out, visible: true, opacity: 1, blend: "normal" };
@@ -11426,7 +11759,7 @@ var ImageEditorController = (_class13 = class {
11426
11759
  const data = compositor.composite([content], canvas, sources);
11427
11760
  out = { ...out, surface: _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, -layer.offset.x, -layer.offset.y) };
11428
11761
  }
11429
- if (_optionalChain([layer, 'access', _414 => _414.filters, 'optionalAccess', _415 => _415.some, 'call', _416 => _416((f) => !f.enabled)])) add2("Disabled layer filters were left out", layer.name);
11762
+ if (_optionalChain([layer, 'access', _419 => _419.filters, 'optionalAccess', _420 => _420.some, 'call', _421 => _421((f) => !f.enabled)])) add2("Disabled layer filters were left out", layer.name);
11430
11763
  delete out.filters;
11431
11764
  const mask = bakeMask(layer);
11432
11765
  if (mask) out.mask = mask;
@@ -11490,7 +11823,7 @@ var ImageEditorController = (_class13 = class {
11490
11823
  );
11491
11824
  }
11492
11825
  layers = resizeLegacyMasks(layers, prev, next.dimensions);
11493
- const env = { ...next.dimensions, pattern: (pid) => _nullishCoalesce(_optionalChain([this, 'access', _417 => _417.state, 'access', _418 => _418.patterns, 'optionalAccess', _419 => _419.find, 'call', _420 => _420((p) => p.id === pid)]), () => ( null)) };
11826
+ const env = { ...next.dimensions, pattern: (pid) => _nullishCoalesce(_optionalChain([this, 'access', _422 => _422.state, 'access', _423 => _423.patterns, 'optionalAccess', _424 => _424.find, 'call', _425 => _425((p) => p.id === pid)]), () => ( null)) };
11494
11827
  for (const l of _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers)) {
11495
11828
  if (l.type === "annotation") {
11496
11829
  layers = _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, l.id, () => ({ ...l, annotation: scaleAnnotation(l.annotation, sx, sy) }));
@@ -11499,7 +11832,7 @@ var ImageEditorController = (_class13 = class {
11499
11832
  const scaled = a ? scaleAnnotation(a, sx, sy) : null;
11500
11833
  const fromAnnotation = scaled ? _chunkUYXL6ZWQcjs.shapeFromAnnotation.call(void 0, scaled) : null;
11501
11834
  const m = [sx, 0, 0, sy, 0, 0];
11502
- const components = _nullishCoalesce(_optionalChain([fromAnnotation, 'optionalAccess', _421 => _421.components]), () => ( _chunkUYXL6ZWQcjs.transformShapeComponents.call(void 0, l.components, (p) => ({ x: p.x * sx, y: p.y * sy }), m)));
11835
+ const components = _nullishCoalesce(_optionalChain([fromAnnotation, 'optionalAccess', _426 => _426.components]), () => ( _chunkUYXL6ZWQcjs.transformShapeComponents.call(void 0, l.components, (p) => ({ x: p.x * sx, y: p.y * sy }), m)));
11503
11836
  const moved = { ...l, components, ...fromAnnotation ? { fill: fromAnnotation.fill, stroke: fromAnnotation.stroke } : {} };
11504
11837
  if (scaled && fromAnnotation) moved.annotation = scaled;
11505
11838
  else delete moved.annotation;
@@ -11517,7 +11850,7 @@ var ImageEditorController = (_class13 = class {
11517
11850
  this.notify();
11518
11851
  }
11519
11852
  toJSON(options) {
11520
- const root = _optionalChain([this, 'access', _422 => _422.contentsStack, 'access', _423 => _423[0], 'optionalAccess', _424 => _424.saved]);
11853
+ const root = _optionalChain([this, 'access', _427 => _427.contentsStack, 'access', _428 => _428[0], 'optionalAccess', _429 => _429.saved]);
11521
11854
  const current = this.state;
11522
11855
  const element = this.imageElement;
11523
11856
  if (root) {
@@ -11528,8 +11861,8 @@ var ImageEditorController = (_class13 = class {
11528
11861
  let out;
11529
11862
  try {
11530
11863
  out = this.serializeState();
11531
- if (_optionalChain([this, 'access', _425 => _425.state, 'access', _426 => _426.selection, 'optionalAccess', _427 => _427.bounds])) out.selection = _chunkUYXL6ZWQcjs.serializeSelection.call(void 0, this.state.selection);
11532
- if (_optionalChain([this, 'access', _428 => _428.state, 'access', _429 => _429.channels, 'optionalAccess', _430 => _430.length])) out.channels = serializeChannels(this.state.channels);
11864
+ if (_optionalChain([this, 'access', _430 => _430.state, 'access', _431 => _431.selection, 'optionalAccess', _432 => _432.bounds])) out.selection = _chunkUYXL6ZWQcjs.serializeSelection.call(void 0, this.state.selection);
11865
+ if (_optionalChain([this, 'access', _433 => _433.state, 'access', _434 => _434.channels, 'optionalAccess', _435 => _435.length])) out.channels = serializeChannels(this.state.channels);
11533
11866
  } finally {
11534
11867
  if (root) {
11535
11868
  this.state = current;
@@ -11643,10 +11976,10 @@ var ImageEditorController = (_class13 = class {
11643
11976
  serializeState() {
11644
11977
  const { width, height } = this.naturalSize;
11645
11978
  const view = _chunkUYXL6ZWQcjs.legacyView.call(void 0, this.stack(), width, height, null);
11646
- if (view.exact && !this.state.globalLight && !_optionalChain([this, 'access', _431 => _431.state, 'access', _432 => _432.patterns, 'optionalAccess', _433 => _433.length]) && this.bitDepth === 8 && !this.state.colorProfile && !this.state.colorMode) {
11979
+ if (view.exact && !this.state.globalLight && !_optionalChain([this, 'access', _436 => _436.state, 'access', _437 => _437.patterns, 'optionalAccess', _438 => _438.length]) && this.bitDepth === 8 && !this.state.colorProfile && !this.state.colorMode) {
11647
11980
  return {
11648
11981
  // States without adjustment layers keep schema 1, so they round-trip unchanged.
11649
- version: _optionalChain([view, 'access', _434 => _434.adjustments, 'access', _435 => _435.layers, 'optionalAccess', _436 => _436.length]) ? 2 : 1,
11982
+ version: _optionalChain([view, 'access', _439 => _439.adjustments, 'access', _440 => _440.layers, 'optionalAccess', _441 => _441.length]) ? 2 : 1,
11650
11983
  crop: this.state.crop ? { ...this.state.crop } : null,
11651
11984
  transform: { ...this.state.transform },
11652
11985
  adjustments: serializeAdjustments(view.adjustments),
@@ -11671,7 +12004,7 @@ var ImageEditorController = (_class13 = class {
11671
12004
  };
11672
12005
  if (this.state.legacyOutputBlur !== void 0) out.legacyOutputBlur = this.state.legacyOutputBlur;
11673
12006
  if (this.state.globalLight) out.globalLight = { ...this.state.globalLight };
11674
- if (_optionalChain([this, 'access', _437 => _437.state, 'access', _438 => _438.patterns, 'optionalAccess', _439 => _439.length])) out.patterns = _chunkUYXL6ZWQcjs.serializePatterns.call(void 0, this.state.patterns);
12007
+ if (_optionalChain([this, 'access', _442 => _442.state, 'access', _443 => _443.patterns, 'optionalAccess', _444 => _444.length])) out.patterns = _chunkUYXL6ZWQcjs.serializePatterns.call(void 0, this.state.patterns);
11675
12008
  if (smartContents) out.smartContents = smartContents;
11676
12009
  if (this.state.bitDepth === 16 || this.state.bitDepth === 32) out.bitDepth = this.state.bitDepth;
11677
12010
  if (this.state.colorProfile) out.colorProfile = serializeColorProfile(this.state.colorProfile);
@@ -11681,7 +12014,7 @@ var ImageEditorController = (_class13 = class {
11681
12014
  }, _class13);
11682
12015
  function serializeAdjustments(adjustments) {
11683
12016
  const out = { ...adjustments };
11684
- if (_optionalChain([out, 'access', _440 => _440.layers, 'optionalAccess', _441 => _441.length])) out.layers = JSON.parse(JSON.stringify(out.layers));
12017
+ if (_optionalChain([out, 'access', _445 => _445.layers, 'optionalAccess', _446 => _446.length])) out.layers = JSON.parse(JSON.stringify(out.layers));
11685
12018
  else delete out.layers;
11686
12019
  if (_chunkUYXL6ZWQcjs.normalizeProcessVersion.call(void 0, out.process) === _chunkUYXL6ZWQcjs.LEGACY_PROCESS_VERSION) {
11687
12020
  delete out.process;
@@ -11717,11 +12050,11 @@ function withDevelop(layer, partial) {
11717
12050
  return { ...layer, filters };
11718
12051
  }
11719
12052
  function withBlur(layer, radius) {
11720
- const existing = _optionalChain([layer, 'access', _442 => _442.filters, 'optionalAccess', _443 => _443.find, 'call', _444 => _444((f) => f.kind === "blur")]);
12053
+ const existing = _optionalChain([layer, 'access', _447 => _447.filters, 'optionalAccess', _448 => _448.find, 'call', _449 => _449((f) => f.kind === "blur")]);
11721
12054
  const filters = (_nullishCoalesce(layer.filters, () => ( []))).filter((f) => f.kind !== "blur");
11722
12055
  if (radius > 0) {
11723
12056
  filters.push({
11724
- id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _445 => _445.id]), () => ( (layer.source === "document" ? _chunkUYXL6ZWQcjs.BLUR_FILTER_ID : _chunkUYXL6ZWQcjs.newLayerId.call(void 0, "flt")))),
12057
+ id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _450 => _450.id]), () => ( (layer.source === "document" ? _chunkUYXL6ZWQcjs.BLUR_FILTER_ID : _chunkUYXL6ZWQcjs.newLayerId.call(void 0, "flt")))),
11725
12058
  kind: "blur",
11726
12059
  enabled: true,
11727
12060
  radius
@@ -11817,7 +12150,7 @@ function collectStateTiles(layers, into) {
11817
12150
  if (l.type === "shape" || l.type === "type") _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.surface, into);
11818
12151
  if (l.type === "smart") {
11819
12152
  _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.surface, into);
11820
- if (_optionalChain([l, 'access', _446 => _446.smartFilters, 'optionalAccess', _447 => _447.mask])) _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.smartFilters.mask.surface, into);
12153
+ if (_optionalChain([l, 'access', _451 => _451.smartFilters, 'optionalAccess', _452 => _452.mask])) _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.smartFilters.mask.surface, into);
11821
12154
  if (l.contents.raster) _chunkCWM3CUUXcjs.collectTiles.call(void 0, l.contents.raster, into);
11822
12155
  if (l.contents.document) collectStateTiles(l.contents.document.layers, into);
11823
12156
  }
@@ -11849,7 +12182,7 @@ function pixelsOnly(layers) {
11849
12182
  for (const l of layers) {
11850
12183
  if (l.type === "adjustment") continue;
11851
12184
  if (l.type === "group") out.push({ ...l, children: pixelsOnly(l.children) });
11852
- else if (l.type === "pixel" && _optionalChain([l, 'access', _448 => _448.filters, 'optionalAccess', _449 => _449.length])) {
12185
+ else if (l.type === "pixel" && _optionalChain([l, 'access', _453 => _453.filters, 'optionalAccess', _454 => _454.length])) {
11853
12186
  const p = { ...l };
11854
12187
  delete p.filters;
11855
12188
  out.push(p);
@@ -11915,7 +12248,7 @@ function toHex(c) {
11915
12248
  return "#" + [c[0], c[1], c[2]].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("");
11916
12249
  }
11917
12250
  function normalizeSelection(mask) {
11918
- return _optionalChain([mask, 'optionalAccess', _450 => _450.bounds]) ? mask : null;
12251
+ return _optionalChain([mask, 'optionalAccess', _455 => _455.bounds]) ? mask : null;
11919
12252
  }
11920
12253
  function sameSelection(a, b) {
11921
12254
  if (a.width !== b.width || a.height !== b.height) return false;
@@ -12125,7 +12458,7 @@ function loadImageEditorDocument(input) {
12125
12458
  }
12126
12459
  const state = { version: 1, ...result.value };
12127
12460
  if (isV2) {
12128
- if (_optionalChain([state, 'access', _451 => _451.adjustments, 'access', _452 => _452.layers, 'optionalAccess', _453 => _453.length])) state.version = 2;
12461
+ if (_optionalChain([state, 'access', _456 => _456.adjustments, 'access', _457 => _457.layers, 'optionalAccess', _458 => _458.length])) state.version = 2;
12129
12462
  result.report.version = 2;
12130
12463
  }
12131
12464
  if (state.selection === void 0) delete state.selection;
@@ -12333,7 +12666,7 @@ function findAdjustmentControl(id) {
12333
12666
  }
12334
12667
  function findLayerControl(kind, id) {
12335
12668
  if (id === "opacity") return ADJUSTMENT_LAYER_OPACITY_CONTROL;
12336
- return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access', _454 => _454[kind], 'optionalAccess', _455 => _455.find, 'call', _456 => _456((c) => c.id === id)]);
12669
+ return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access', _459 => _459[kind], 'optionalAccess', _460 => _460.find, 'call', _461 => _461((c) => c.id === id)]);
12337
12670
  }
12338
12671
  function clampControlValue(spec, v) {
12339
12672
  if (typeof v !== "number" || !Number.isFinite(v)) return spec.default;
@@ -12550,7 +12883,7 @@ var DEPTH_MASK_CONTROLS = [
12550
12883
  // src/image-editor/playback.ts
12551
12884
  var IMAGE_PLAYBACK_KIND = "layer";
12552
12885
  var PAINT = /^(paint_stroke|clone_stamp|heal_brush|spot_heal|dodge|burn|sponge|smudge|blur_stroke|sharpen_stroke|history_brush|set_clone_source|set_clone_transform|fill_pixels|clear_pixels|set_paint|set_retouch_options|load_mixer_brush|clean_mixer_brush)$/;
12553
- var SELECT = /^(select_region|select_subject|select_by_color|select_all|deselect|invert_selection|select_rect|select_ellipse|select_polygon|quick_select|select_object|select_line|magic_wand|grow_selection|select_similar|reselect|select_layer_transparency|select_color_range|load_selection_from_image|load_selection_from_mask|set_selection_display|modify_selection|refine_selection|transform_selection|apply_selection_as_mask|layer_via_copy|stroke_selection|content_aware_fill|copy_pixels|cut_pixels|paste_pixels|save_selection|load_selection_from_channel|set_channel_properties|duplicate_channel|delete_channel|load_channel_from_image|set_quick_mask|path_to_selection|select_text_shape)$/;
12886
+ var SELECT = /^(select_region|select_subject|select_by_color|select_all|deselect|invert_selection|select_rect|select_ellipse|select_polygon|quick_select|select_object|select_focus_area|select_line|magic_wand|grow_selection|select_similar|reselect|select_layer_transparency|select_color_range|load_selection_from_image|load_selection_from_mask|set_selection_display|modify_selection|refine_selection|transform_selection|apply_selection_as_mask|layer_via_copy|stroke_selection|content_aware_fill|copy_pixels|cut_pixels|paste_pixels|save_selection|load_selection_from_channel|set_channel_properties|duplicate_channel|delete_channel|load_channel_from_image|set_quick_mask|path_to_selection|select_text_shape)$/;
12554
12887
  var ANNOTATE = /^(add_shape_layer|update_shape|add_shape_component|set_shape_component|remove_shape_component|merge_shape_components|add_text_layer|set_text|set_text_style|set_paragraph_style|set_text_frame|set_text_orientation|convert_text_to_shape)$/;
12555
12888
  var CROP = /^(set_crop|crop_to_selection|reset_crop|set_rotation|flip_image|transform_layer|warp_layer|flip_layer|offset_layer)$/;
12556
12889
  var ADJUST = /^(set_adjustments|add_adjustment_layer|update_adjustment_layer|remove_adjustment_layer|move_adjustment_layer)$/;
@@ -12716,6 +13049,9 @@ var DEFAULT_SELECTION_TOOL_OPTIONS = {
12716
13049
  quickEnhance: false,
12717
13050
  objectSampleAll: true,
12718
13051
  objectEnhance: false,
13052
+ focusRange: 50,
13053
+ focusNoise: 0,
13054
+ focusSoftness: 4,
12719
13055
  typeText: "Type",
12720
13056
  typeSize: 72,
12721
13057
  typeFamily: "sans-serif"
@@ -12788,7 +13124,7 @@ function summary(controller) {
12788
13124
  const area = _chunkUYXL6ZWQcjs.selectionArea.call(void 0, sel);
12789
13125
  return {
12790
13126
  empty: !sel,
12791
- bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _457 => _457.bounds]), () => ( null)),
13127
+ bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _462 => _462.bounds]), () => ( null)),
12792
13128
  /** Σ coverage in pixels. */
12793
13129
  area: Math.round(area),
12794
13130
  percent: Math.round(area / Math.max(1, width * height) * 1e4) / 100,
@@ -12864,7 +13200,7 @@ function createImageSelectionTools(controller) {
12864
13200
  break;
12865
13201
  }
12866
13202
  case "polygon": {
12867
- const list = Array.isArray(points) ? points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _458 => _458.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _459 => _459.y]), NaN) })) : [];
13203
+ const list = Array.isArray(points) ? points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _463 => _463.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _464 => _464.y]), NaN) })) : [];
12868
13204
  if (list.length < 3 || !list.every((p) => Number.isFinite(p.x) && Number.isFinite(p.y))) {
12869
13205
  throw new Error("polygon needs points: at least 3 { x, y } vertices.");
12870
13206
  }
@@ -13101,7 +13437,7 @@ function createImageSelectionTools(controller) {
13101
13437
  },
13102
13438
  annotations: writeAnnotations("Select a polygon (lasso)", true),
13103
13439
  handler: async (args) => {
13104
- const list = Array.isArray(args.points) ? args.points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _460 => _460.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _461 => _461.y]), NaN) })) : [];
13440
+ const list = Array.isArray(args.points) ? args.points.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _465 => _465.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _466 => _466.y]), NaN) })) : [];
13105
13441
  if (list.length < 3 || !list.every((p) => Number.isFinite(p.x) && Number.isFinite(p.y))) {
13106
13442
  throw new Error("points needs at least 3 { x, y } vertices in natural image pixels.");
13107
13443
  }
@@ -13138,7 +13474,7 @@ function createImageSelectionTools(controller) {
13138
13474
  },
13139
13475
  annotations: writeAnnotations("Quick Selection"),
13140
13476
  handler: async (args) => {
13141
- const strokes = Array.isArray(args.strokes) ? args.strokes.map((s) => Array.isArray(s) ? s.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _462 => _462.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _463 => _463.y]), NaN) })) : []) : [];
13477
+ const strokes = Array.isArray(args.strokes) ? args.strokes.map((s) => Array.isArray(s) ? s.map((p) => ({ x: num2(_optionalChain([p, 'optionalAccess', _467 => _467.x]), NaN), y: num2(_optionalChain([p, 'optionalAccess', _468 => _468.y]), NaN) })) : []) : [];
13142
13478
  if (!strokes.length || strokes.some((s) => !s.length || !s.every((p) => Number.isFinite(p.x) && Number.isFinite(p.y)))) {
13143
13479
  throw new Error("strokes needs at least one stroke of { x, y } points in natural image pixels.");
13144
13480
  }
@@ -13184,6 +13520,33 @@ function createImageSelectionTools(controller) {
13184
13520
  return summary(controller);
13185
13521
  }
13186
13522
  };
13523
+ const selectFocusAreaTool = {
13524
+ name: "select_focus_area",
13525
+ title: "Select the focus area",
13526
+ description: "Select \u203A Focus Area: selects the parts of the image that are in focus (sharp detail, above the image noise), with the edge fitted to the image, combined with the selection by mode. Use it to separate a sharp subject from a blurred background (shallow depth of field), e.g. before blurring or darkening the background. Raise range to take in less sharp areas, raise noise if grain in the background gets selected. One undoable step. Returns the selection and noiseLevel (\u03C3 of the image noise in levels of 255).",
13527
+ inputSchema: {
13528
+ type: "object",
13529
+ properties: {
13530
+ range: { type: "number", minimum: 0, maximum: 100, description: "In-Focus Range 0..100 (default 50): higher takes in less sharp areas too." },
13531
+ noise: { type: "number", minimum: 0, maximum: 100, description: "Image Noise Level 0..100 (default 0): raise it when grain is selected as detail." },
13532
+ softness: { type: "number", minimum: 0, maximum: 100, description: "Soften the edge over this many natural pixels (default 4; 0 for a hard edge)." },
13533
+ mode: modeSchema,
13534
+ sampleAllLayers: { type: "boolean", description: "Read every layer (default true); false reads only the active pixel layer." }
13535
+ },
13536
+ additionalProperties: false
13537
+ },
13538
+ annotations: writeAnnotations("Select the focus area", true),
13539
+ handler: async (args) => {
13540
+ const { noiseLevel } = await controller.selectFocusArea({
13541
+ range: args.range === void 0 ? void 0 : num2(args.range, 50),
13542
+ noise: args.noise === void 0 ? void 0 : num2(args.noise, 0),
13543
+ softness: args.softness === void 0 ? void 0 : num2(args.softness, 4),
13544
+ mode: _chunkUYXL6ZWQcjs.parseSelectionMode.call(void 0, args.mode),
13545
+ sampleAllLayers: args.sampleAllLayers
13546
+ });
13547
+ return { ...summary(controller), noiseLevel };
13548
+ }
13549
+ };
13187
13550
  const magicWandTool = {
13188
13551
  name: "magic_wand",
13189
13552
  title: "Magic wand",
@@ -13277,7 +13640,7 @@ function createImageSelectionTools(controller) {
13277
13640
  await controller.selectColorRangePreset(args.preset, { ...common, falloff: num2(args.fuzziness, 20) });
13278
13641
  } else {
13279
13642
  const samples = args.samples.map((s, i) => {
13280
- if (typeof _optionalChain([s, 'optionalAccess', _464 => _464.color]) !== "string" || !/^#?[0-9a-f]{6}$/i.test(s.color.trim())) throw new Error(`samples[${i}].color must be #rrggbb.`);
13643
+ if (typeof _optionalChain([s, 'optionalAccess', _469 => _469.color]) !== "string" || !/^#?[0-9a-f]{6}$/i.test(s.color.trim())) throw new Error(`samples[${i}].color must be #rrggbb.`);
13281
13644
  const at = typeof s.x === "number" && typeof s.y === "number" ? { x: s.x, y: s.y } : void 0;
13282
13645
  return at ? { color: s.color, at } : { color: s.color };
13283
13646
  });
@@ -13738,6 +14101,8 @@ function createImageSelectionTools(controller) {
13738
14101
  selectPolygonTool,
13739
14102
  quickSelectTool,
13740
14103
  selectObjectTool,
14104
+ createImageSubjectSelectionTool(controller),
14105
+ selectFocusAreaTool,
13741
14106
  lineTool,
13742
14107
  magicWandTool,
13743
14108
  colorRangeTool,
@@ -13774,49 +14139,50 @@ function createImageSubjectSelectionTool(controller) {
13774
14139
  return {
13775
14140
  name: "select_subject",
13776
14141
  title: "Select a subject",
13777
- description: 'Select \u203A Subject: an AI segmentation model finds the objects matching target (a description such as "the dog", "the house", "the sky") in the flattened image and selects their outlines, combined with the selection by mode. Use it to cut a subject out by its contour (then layer_via_copy for a layer of just that subject); describe one object precisely to get only that one. One undoable step. Returns the selection and the objects found (label, bounds); none found leaves the selection unchanged.',
14142
+ description: 'Select \u203A Subject: selects the main subject of the flattened image, combined with the selection by mode. With a segmentation model set by the host, target (a description such as "the dog" or "the house") chooses which objects; describe one object precisely to get only that one. Without a model, the subject that stands out most from the background is found classically (superpixel saliency and GrabCut): target cannot choose it, and method "saliency" and a note say so. Then check it with capture_view and fix it with quick_select or select_object. One undoable step. Returns the selection, the objects found (label, bounds), method ("model" or "saliency") and any note; none found leaves the selection unchanged.',
13778
14143
  inputSchema: {
13779
14144
  type: "object",
13780
14145
  properties: {
13781
- target: { type: "string", minLength: 1, description: "What to select, in words." },
14146
+ target: { type: "string", description: "What to select, in words. Needed with a model; ignored without one." },
13782
14147
  maxSegments: {
13783
14148
  type: "integer",
13784
14149
  minimum: 1,
13785
14150
  maximum: 32,
13786
- description: "Select at most this many matching objects (default the model\u2019s; 1 for a single subject)."
14151
+ description: "With a model: select at most this many matching objects (default the model\u2019s; 1 for a single subject)."
13787
14152
  },
13788
14153
  mode: modeSchema,
13789
- feather: { type: "number", minimum: 0, description: "Feather radius in pixels (default 0)." }
14154
+ feather: { type: "number", minimum: 0, description: "Feather radius in pixels (default 0)." },
14155
+ enhanceEdge: { type: "boolean", description: "Without a model: smoother, less blocky edges (Auto-Enhance; default false)." }
13790
14156
  },
13791
- required: ["target"],
13792
14157
  additionalProperties: false
13793
14158
  },
13794
14159
  annotations: { ...writeAnnotations("Select a subject"), openWorldHint: true },
13795
- handler: async ({ target, maxSegments, mode, feather }, context) => {
13796
- if (typeof target !== "string" || !target.trim()) throw new Error("target must describe what to select.");
13797
- const perform = _optionalChain([context, 'optionalAccess', _465 => _465.perform]);
13798
- const { segments } = await controller.selectSubject(target, {
14160
+ handler: async ({ target, maxSegments, mode, feather, enhanceEdge }, context) => {
14161
+ if (target !== void 0 && typeof target !== "string") throw new Error("target must be a description in words.");
14162
+ if (controller.segmentationProvider && !String(_nullishCoalesce(target, () => ( ""))).trim()) throw new Error("target must describe what to select (a model is set, and it selects by description).");
14163
+ const perform = _optionalChain([context, 'optionalAccess', _470 => _470.perform]);
14164
+ const { segments, method, note } = await controller.selectSubject(String(_nullishCoalesce(target, () => ( ""))), {
13799
14165
  mode: _chunkUYXL6ZWQcjs.parseSelectionMode.call(void 0, mode),
13800
14166
  feather: num2(feather, 0),
13801
14167
  maxSegments: typeof maxSegments === "number" ? Math.max(1, Math.round(maxSegments)) : void 0,
13802
- signal: _optionalChain([context, 'optionalAccess', _466 => _466.signal]),
14168
+ enhanceEdge: enhanceEdge === true,
14169
+ signal: _optionalChain([context, 'optionalAccess', _471 => _471.signal]),
13803
14170
  // Under playback the cursor traces what the model found, as a lasso, before it is selected.
13804
14171
  beforeApply: perform ? (outlines) => perform(planOutlineTrace(outlines)) : void 0
13805
14172
  });
13806
- return { ...summary(controller), found: segments };
14173
+ return { ...summary(controller), found: segments, method, ...note ? { note } : {} };
13807
14174
  }
13808
14175
  };
13809
14176
  }
13810
14177
  function createImageSegmentationToolProvider(controller, options = {}) {
13811
- const tool = createImageSubjectSelectionTool(controller);
13812
14178
  return withImagePlayback(
13813
14179
  {
13814
14180
  id: _nullishCoalesce(options.id, () => ( "image-segmentation")),
13815
14181
  namespace: options.namespace,
13816
14182
  title: "Image segmentation",
13817
- description: "Select \u203A Subject: select objects in the image by description through an AI segmentation model.",
14183
+ description: "Deprecated: select_subject is in the image editor tool provider.",
13818
14184
  skill: "pixerate-image-editor",
13819
- tools: () => controller.segmentationProvider ? [tool] : []
14185
+ tools: () => []
13820
14186
  },
13821
14187
  options.playbackSurface
13822
14188
  );
@@ -13878,7 +14244,7 @@ async function renderImageRegion(controller, request) {
13878
14244
  const maskView = maskViewCanvas(controller, document);
13879
14245
  if (maskView) context.drawImage(maskView, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
13880
14246
  const selection = state.selection;
13881
- if (_optionalChain([selection, 'optionalAccess', _467 => _467.bounds]) && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
14247
+ if (_optionalChain([selection, 'optionalAccess', _472 => _472.bounds]) && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
13882
14248
  const shade = selectionShade(selection, document);
13883
14249
  if (shade) context.drawImage(shade, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
13884
14250
  }
@@ -13903,7 +14269,7 @@ function createImageCaptureSurface(controller) {
13903
14269
  return {
13904
14270
  units: "image pixels",
13905
14271
  content: whole,
13906
- selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access', _468 => _468.getState, 'call', _469 => _469(), 'access', _470 => _470.selection, 'optionalAccess', _471 => _471.bounds]), () => ( null)) }),
14272
+ selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access', _473 => _473.getState, 'call', _474 => _474(), 'access', _475 => _475.selection, 'optionalAccess', _476 => _476.bounds]), () => ( null)) }),
13907
14273
  overlays: "a shade over unselected pixels, the crop box outline and a layer mask view (set_mask_view)",
13908
14274
  maxScale: 8,
13909
14275
  render: (request) => renderImageRegion(controller, request)
@@ -14237,7 +14603,7 @@ function describeLayer(layer, activeId, boundsOf) {
14237
14603
  out.bounds = boundsOf(layer);
14238
14604
  out.fillOpacity = round3(_nullishCoalesce(layer.fillOpacity, () => ( 1)));
14239
14605
  out.shape = {
14240
- components: layer.components.map((c) => ({ op: c.op, kind: _nullishCoalesce(_optionalChain([c, 'access', _472 => _472.live, 'optionalAccess', _473 => _473.kind]), () => ( "path")) })),
14606
+ components: layer.components.map((c) => ({ op: c.op, kind: _nullishCoalesce(_optionalChain([c, 'access', _477 => _477.live, 'optionalAccess', _478 => _478.kind]), () => ( "path")) })),
14241
14607
  fill: layer.fill ? layer.fill.type : null,
14242
14608
  stroke: layer.stroke ? { width: layer.stroke.width, paint: layer.stroke.paint.type } : null
14243
14609
  };
@@ -14260,8 +14626,8 @@ function describeLayer(layer, activeId, boundsOf) {
14260
14626
  out.bounds = boundsOf(layer);
14261
14627
  out.fillOpacity = round3(_nullishCoalesce(layer.fillOpacity, () => ( 1)));
14262
14628
  out.contents = { id: layer.contents.id, name: layer.contents.name, kind: layer.contents.kind, width: layer.contents.width, height: layer.contents.height };
14263
- out.smartFilters = (_nullishCoalesce(_optionalChain([layer, 'access', _474 => _474.smartFilters, 'optionalAccess', _475 => _475.filters]), () => ( []))).map((f) => ({ id: f.id, kind: f.kind, enabled: f.enabled }));
14264
- out.filterMask = maskSummary(_optionalChain([layer, 'access', _476 => _476.smartFilters, 'optionalAccess', _477 => _477.mask]));
14629
+ out.smartFilters = (_nullishCoalesce(_optionalChain([layer, 'access', _479 => _479.smartFilters, 'optionalAccess', _480 => _480.filters]), () => ( []))).map((f) => ({ id: f.id, kind: f.kind, enabled: f.enabled }));
14630
+ out.filterMask = maskSummary(_optionalChain([layer, 'access', _481 => _481.smartFilters, 'optionalAccess', _482 => _482.mask]));
14265
14631
  break;
14266
14632
  }
14267
14633
  return out;
@@ -14289,7 +14655,7 @@ function createImageLayerTools(controller) {
14289
14655
  if (!loc) return null;
14290
14656
  return {
14291
14657
  ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)),
14292
- parentId: _nullishCoalesce(_optionalChain([loc, 'access', _478 => _478.parent, 'optionalAccess', _479 => _479.id]), () => ( null)),
14658
+ parentId: _nullishCoalesce(_optionalChain([loc, 'access', _483 => _483.parent, 'optionalAccess', _484 => _484.id]), () => ( null)),
14293
14659
  index: loc.index
14294
14660
  };
14295
14661
  };
@@ -14612,7 +14978,7 @@ function createImageLayerTools(controller) {
14612
14978
  if (view !== "gray" && view !== "overlay" && view !== "off") throw new Error(`Unknown view "${String(view)}". Use gray, overlay or off.`);
14613
14979
  const id = view === "off" || layerId === void 0 ? void 0 : exists(layerId);
14614
14980
  const shown = controller.setMaskView(view, id);
14615
- return { view: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _480 => _480.mode]), () => ( "off")), layerId: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _481 => _481.layerId]), () => ( null)) };
14981
+ return { view: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _485 => _485.mode]), () => ( "off")), layerId: _nullishCoalesce(_optionalChain([shown, 'optionalAccess', _486 => _486.layerId]), () => ( null)) };
14616
14982
  }
14617
14983
  };
14618
14984
  const maskProps = {
@@ -15474,7 +15840,7 @@ function handleSelectionShortcut(controller, e, onError) {
15474
15840
  try {
15475
15841
  fn();
15476
15842
  } catch (err) {
15477
- _optionalChain([onError, 'optionalCall', _482 => _482(err instanceof Error ? err.message : String(err))]);
15843
+ _optionalChain([onError, 'optionalCall', _487 => _487(err instanceof Error ? err.message : String(err))]);
15478
15844
  }
15479
15845
  return true;
15480
15846
  };
@@ -15489,9 +15855,9 @@ function handleMaskViewKey(controller, e) {
15489
15855
  if (e.ctrlKey || e.metaKey || e.altKey || e.key !== "\\") return false;
15490
15856
  const id = controller.getState().activeLayerId;
15491
15857
  const layer = id ? controller.getLayer(id) : null;
15492
- if (!_optionalChain([layer, 'optionalAccess', _483 => _483.mask]) || layer.mask.source) return false;
15858
+ if (!_optionalChain([layer, 'optionalAccess', _488 => _488.mask]) || layer.mask.source) return false;
15493
15859
  const view = controller.getMaskView();
15494
- controller.setMaskView(_optionalChain([view, 'optionalAccess', _484 => _484.layerId]) === layer.id && view.mode === "overlay" ? "off" : "overlay", layer.id);
15860
+ controller.setMaskView(_optionalChain([view, 'optionalAccess', _489 => _489.layerId]) === layer.id && view.mode === "overlay" ? "off" : "overlay", layer.id);
15495
15861
  return true;
15496
15862
  }
15497
15863
  function handleQuickMaskKey(controller, e) {
@@ -15705,7 +16071,7 @@ var PaintGesture = (_class15 = class {
15705
16071
  const layer = this.controller.getActiveLayer();
15706
16072
  if (!layer) throw new Error("Select a layer to move in the Layers panel.");
15707
16073
  if (layer.type !== "pixel" && layer.type !== "shape" && layer.type !== "smart") throw new Error(`Only pixel, shape and smart object layers move; "${layer.name}" is a ${layer.type} layer.`);
15708
- if (_optionalChain([layer, 'access', _485 => _485.locks, 'optionalAccess', _486 => _486.all]) || _optionalChain([layer, 'access', _487 => _487.locks, 'optionalAccess', _488 => _488.position])) throw new Error(`Layer "${layer.name}" has its position locked.`);
16074
+ if (_optionalChain([layer, 'access', _490 => _490.locks, 'optionalAccess', _491 => _491.all]) || _optionalChain([layer, 'access', _492 => _492.locks, 'optionalAccess', _493 => _493.position])) throw new Error(`Layer "${layer.name}" has its position locked.`);
15709
16075
  const origin = layer.type === "pixel" ? { ...layer.offset } : layer.type === "smart" ? { ...layer.placement.corners[0] } : (() => {
15710
16076
  const b = _chunkUYXL6ZWQcjs.shapeGeometryBounds.call(void 0, layer);
15711
16077
  return b ? { x: b.x, y: b.y } : { x: 0, y: 0 };
@@ -15762,7 +16128,7 @@ var PaintGesture = (_class15 = class {
15762
16128
  this.move = null;
15763
16129
  }
15764
16130
  cancel() {
15765
- _optionalChain([this, 'access', _489 => _489.stroke, 'optionalAccess', _490 => _490.cancel, 'call', _491 => _491()]);
16131
+ _optionalChain([this, 'access', _494 => _494.stroke, 'optionalAccess', _495 => _495.cancel, 'call', _496 => _496()]);
15766
16132
  this.stroke = null;
15767
16133
  this.move = null;
15768
16134
  }
@@ -16843,7 +17209,7 @@ function createImageSmartObjectTools(controller) {
16843
17209
  const layerSummary = (id) => {
16844
17210
  const s = controller.getState();
16845
17211
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
16846
- return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _492 => _492.parent, 'optionalAccess', _493 => _493.id]), () => ( null)), index: loc.index } : null;
17212
+ return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _497 => _497.parent, 'optionalAccess', _498 => _498.id]), () => ( null)), index: loc.index } : null;
16847
17213
  };
16848
17214
  const getSmart = {
16849
17215
  name: "get_smart_object",
@@ -17400,7 +17766,7 @@ function createImageShapeTools(controller) {
17400
17766
  const layerSummary = (id) => {
17401
17767
  const s = controller.getState();
17402
17768
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
17403
- return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _494 => _494.parent, 'optionalAccess', _495 => _495.id]), () => ( null)), index: loc.index } : null;
17769
+ return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _499 => _499.parent, 'optionalAccess', _500 => _500.id]), () => ( null)), index: loc.index } : null;
17404
17770
  };
17405
17771
  const get = {
17406
17772
  name: "get_shape_layer",
@@ -17617,7 +17983,7 @@ function createImageShapeTools(controller) {
17617
17983
  const mode = args.mode;
17618
17984
  controller.pathToSelection(pathSpec(args), { feather: args.feather, antiAlias: args.antiAlias, mode });
17619
17985
  const sel = controller.getSelection();
17620
- return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _496 => _496.bounds]), () => ( null)), area: Math.round(sel ? _chunkUYXL6ZWQcjs.selectionArea.call(void 0, sel) : 0) };
17986
+ return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _501 => _501.bounds]), () => ( null)), area: Math.round(sel ? _chunkUYXL6ZWQcjs.selectionArea.call(void 0, sel) : 0) };
17621
17987
  }
17622
17988
  };
17623
17989
  const getVectorMask = {
@@ -17648,7 +18014,7 @@ function createImageShapeTools(controller) {
17648
18014
  handler: (args) => {
17649
18015
  const id = layerArg(args.layerId);
17650
18016
  const spec = pathSpec(args);
17651
- const hasPath = _optionalChain([spec, 'access', _497 => _497.components, 'optionalAccess', _498 => _498.length]) || spec.shape !== void 0 || spec.subpaths !== void 0;
18017
+ const hasPath = _optionalChain([spec, 'access', _502 => _502.components, 'optionalAccess', _503 => _503.length]) || spec.shape !== void 0 || spec.subpaths !== void 0;
17652
18018
  const from = _nullishCoalesce(args.from, () => ( (hasPath ? "path" : "reveal-all")));
17653
18019
  if (from !== "selection" && TRACE_KEYS.some((k) => args[k] !== void 0)) throw new Error("tolerance, cornerRoundness and minArea apply only to from selection.");
17654
18020
  controller.addVectorMask(id, from, spec, traceOptions(args));
@@ -17768,7 +18134,7 @@ function createImageTypeTools(controller) {
17768
18134
  const layerSummary = (id) => {
17769
18135
  const s = controller.getState();
17770
18136
  const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, s.layers, id);
17771
- return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _499 => _499.parent, 'optionalAccess', _500 => _500.id]), () => ( null)), index: loc.index } : null;
18137
+ return loc ? { ...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)), parentId: _nullishCoalesce(_optionalChain([loc, 'access', _504 => _504.parent, 'optionalAccess', _505 => _505.id]), () => ( null)), index: loc.index } : null;
17772
18138
  };
17773
18139
  const range = (args) => ({ start: args.start, end: args.end });
17774
18140
  const listFonts = {
@@ -17777,7 +18143,7 @@ function createImageTypeTools(controller) {
17777
18143
  description: "Returns the font families type layers can use here (generic families such as sans-serif always work). Changes nothing.",
17778
18144
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
17779
18145
  annotations: { title: "List fonts", ...READ11 },
17780
- handler: () => ({ families: controller.listFonts(), shaper: _nullishCoalesce(_optionalChain([controller, 'access', _501 => _501.getTextShaper, 'call', _502 => _502(), 'optionalAccess', _503 => _503.id]), () => ( null)) })
18146
+ handler: () => ({ families: controller.listFonts(), shaper: _nullishCoalesce(_optionalChain([controller, 'access', _506 => _506.getTextShaper, 'call', _507 => _507(), 'optionalAccess', _508 => _508.id]), () => ( null)) })
17781
18147
  };
17782
18148
  const get = {
17783
18149
  name: "get_text_layer",
@@ -17933,7 +18299,7 @@ function createImageTypeTools(controller) {
17933
18299
  const init = pick2(args, ["text", "x", "y", "orientation", "box", "style", "paragraph", "rotation", "mode", "feather", "antiAlias"]);
17934
18300
  controller.selectTextShape(init);
17935
18301
  const sel = controller.getSelection();
17936
- return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _504 => _504.bounds]), () => ( null)), area: Math.round(sel ? _chunkUYXL6ZWQcjs.selectionArea.call(void 0, sel) : 0) };
18302
+ return { empty: !sel, bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _509 => _509.bounds]), () => ( null)), area: Math.round(sel ? _chunkUYXL6ZWQcjs.selectionArea.call(void 0, sel) : 0) };
17937
18303
  }
17938
18304
  };
17939
18305
  return [listFonts, get, add2, setText, setStyle, setParagraph, setFrame, setOrientation, toShape, typeMask];
@@ -18112,7 +18478,7 @@ function createImageEditorToolProvider(controller, options = {}) {
18112
18478
  for (const ref of [aboveId, parentId]) {
18113
18479
  if (ref !== void 0 && !controller.getLayer(ref)) throw new Error(`Unknown layer "${ref}". Call list_layers for ids.`);
18114
18480
  }
18115
- if (parentId !== void 0 && _optionalChain([controller, 'access', _505 => _505.getLayer, 'call', _506 => _506(parentId), 'optionalAccess', _507 => _507.type]) !== "group") throw new Error(`Layer "${parentId}" is not a group.`);
18481
+ if (parentId !== void 0 && _optionalChain([controller, 'access', _510 => _510.getLayer, 'call', _511 => _511(parentId), 'optionalAccess', _512 => _512.type]) !== "group") throw new Error(`Layer "${parentId}" is not a group.`);
18116
18482
  const id = controller.addAdjustmentLayer({ kind, params, opacity, blend, name, aboveId, parentId, useSelection: useSelection !== false });
18117
18483
  const layer = controller.getAdjustmentLayer(id);
18118
18484
  return { layer: JSON.parse(JSON.stringify(layer)), index: controller.getAdjustmentLayers().findIndex((l) => l.id === id), masked: Boolean(layer.mask) };
@@ -18426,7 +18792,7 @@ function maskThumbnailClick(controller, layer, e) {
18426
18792
  } else if (e.altKey && !layer.mask.source) {
18427
18793
  const mode = e.shiftKey ? "overlay" : "gray";
18428
18794
  const view = controller.getMaskView();
18429
- controller.setMaskView(_optionalChain([view, 'optionalAccess', _508 => _508.layerId]) === layer.id && view.mode === mode ? "off" : mode, layer.id);
18795
+ controller.setMaskView(_optionalChain([view, 'optionalAccess', _513 => _513.layerId]) === layer.id && view.mode === mode ? "off" : mode, layer.id);
18430
18796
  } else if (e.shiftKey) {
18431
18797
  controller.setLayerMaskProps(layer.id, { enabled: layer.mask.enabled === false });
18432
18798
  } else {
@@ -18490,7 +18856,7 @@ function layerHasThumbnail(layer) {
18490
18856
  return layer.type === "pixel" || layer.type === "shape" || layer.type === "type";
18491
18857
  }
18492
18858
  function layerWarning(layer) {
18493
- if (layer.type === "type" && _optionalChain([layer, 'access', _509 => _509.missingFonts, 'optionalAccess', _510 => _510.length])) {
18859
+ if (layer.type === "type" && _optionalChain([layer, 'access', _514 => _514.missingFonts, 'optionalAccess', _515 => _515.length])) {
18494
18860
  return `Missing ${layer.missingFonts.length === 1 ? "font" : "fonts"}: ${layer.missingFonts.join(", ")}. ${layer.rendering === "stored" ? "Showing the saved pixels until the text is edited." : "Drawn with a fallback font."}`;
18495
18861
  }
18496
18862
  return null;
@@ -18513,16 +18879,16 @@ function layerMenu(controller) {
18513
18879
  const siblings = loc ? loc.parent ? loc.parent.children : s.layers : [];
18514
18880
  const below = loc ? siblings[loc.index - 1] : void 0;
18515
18881
  const hasSel = controller.hasSelection;
18516
- const isPixel = _optionalChain([active, 'optionalAccess', _511 => _511.type]) === "pixel";
18517
- const hasOwnPixels = _optionalChain([active, 'optionalAccess', _512 => _512.type]) === "pixel" || _optionalChain([active, 'optionalAccess', _513 => _513.type]) === "shape" || _optionalChain([active, 'optionalAccess', _514 => _514.type]) === "type" || _optionalChain([active, 'optionalAccess', _515 => _515.type]) === "smart";
18882
+ const isPixel = _optionalChain([active, 'optionalAccess', _516 => _516.type]) === "pixel";
18883
+ const hasOwnPixels = _optionalChain([active, 'optionalAccess', _517 => _517.type]) === "pixel" || _optionalChain([active, 'optionalAccess', _518 => _518.type]) === "shape" || _optionalChain([active, 'optionalAccess', _519 => _519.type]) === "type" || _optionalChain([active, 'optionalAccess', _520 => _520.type]) === "smart";
18518
18884
  return [
18519
18885
  { action: "new-layer", label: "New Layer", enabled: true },
18520
18886
  { action: "new-group", label: "New Group", enabled: true },
18521
18887
  { action: "duplicate", label: "Duplicate Layer", enabled: Boolean(active) },
18522
18888
  { action: "delete", label: "Delete Layer", enabled: Boolean(active) },
18523
18889
  { action: "group-selected", label: "Group Layer", enabled: Boolean(active) },
18524
- { action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess', _516 => _516.type]) === "group" },
18525
- { action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess', _517 => _517.visible]) && _optionalChain([below, 'optionalAccess', _518 => _518.type]) === "pixel") },
18890
+ { action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess', _521 => _521.type]) === "group" },
18891
+ { action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess', _522 => _522.visible]) && _optionalChain([below, 'optionalAccess', _523 => _523.type]) === "pixel") },
18526
18892
  { action: "merge-visible", label: "Merge Visible", enabled: s.layers.some((l) => l.visible) },
18527
18893
  { action: "flatten", label: "Flatten Image", enabled: s.layers.length > 0 },
18528
18894
  { action: "via-copy", label: "Layer via Copy", enabled: isPixel && hasSel },
@@ -18532,27 +18898,27 @@ function layerMenu(controller) {
18532
18898
  { action: "add-mask-hide-selection", label: "Add Mask Hiding Selection", enabled: Boolean(active) && hasSel },
18533
18899
  { action: "add-mask-transparency", label: "Add Mask from Transparency", enabled: hasOwnPixels },
18534
18900
  { action: "select-transparency", label: "Select Layer Pixels", enabled: hasOwnPixels },
18535
- { action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess', _519 => _519.mask])) },
18536
- { action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _520 => _520.mask])) },
18537
- { action: "toggle-mask", label: _optionalChain([active, 'optionalAccess', _521 => _521.mask, 'optionalAccess', _522 => _522.enabled]) === false ? "Enable Layer Mask" : "Disable Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _523 => _523.mask])) },
18538
- { action: "toggle-mask-link", label: _optionalChain([active, 'optionalAccess', _524 => _524.mask, 'optionalAccess', _525 => _525.linked]) === false ? "Link Layer Mask" : "Unlink Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _526 => _526.mask]) && !active.mask.source) },
18539
- { action: "add-vector-mask", label: "Add Vector Mask (Reveal All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _527 => _527.mask, 'optionalAccess', _528 => _528.source])) },
18540
- { action: "add-vector-mask-hide", label: "Add Vector Mask (Hide All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _529 => _529.mask, 'optionalAccess', _530 => _530.source])) },
18541
- { action: "add-vector-mask-selection", label: "Add Vector Mask from Selection", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _531 => _531.mask, 'optionalAccess', _532 => _532.source])) && hasSel },
18542
- { action: "delete-vector-mask", label: "Delete Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _533 => _533.vectorMask])) },
18543
- { action: "toggle-vector-mask", label: _optionalChain([active, 'optionalAccess', _534 => _534.vectorMask, 'optionalAccess', _535 => _535.enabled]) === false ? "Enable Vector Mask" : "Disable Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _536 => _536.vectorMask])) },
18544
- { action: "rasterize-vector-mask", label: "Rasterize Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _537 => _537.vectorMask])) },
18545
- { action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess', _538 => _538.type]) === "annotation" || _optionalChain([active, 'optionalAccess', _539 => _539.type]) === "smart" || _optionalChain([active, 'optionalAccess', _540 => _540.type]) === "shape" || _optionalChain([active, 'optionalAccess', _541 => _541.type]) === "type" || isPixel && Boolean(_optionalChain([active, 'optionalAccess', _542 => _542.type]) === "pixel" && _optionalChain([active, 'access', _543 => _543.filters, 'optionalAccess', _544 => _544.length])) },
18901
+ { action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess', _524 => _524.mask])) },
18902
+ { action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _525 => _525.mask])) },
18903
+ { action: "toggle-mask", label: _optionalChain([active, 'optionalAccess', _526 => _526.mask, 'optionalAccess', _527 => _527.enabled]) === false ? "Enable Layer Mask" : "Disable Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _528 => _528.mask])) },
18904
+ { action: "toggle-mask-link", label: _optionalChain([active, 'optionalAccess', _529 => _529.mask, 'optionalAccess', _530 => _530.linked]) === false ? "Link Layer Mask" : "Unlink Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _531 => _531.mask]) && !active.mask.source) },
18905
+ { action: "add-vector-mask", label: "Add Vector Mask (Reveal All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _532 => _532.mask, 'optionalAccess', _533 => _533.source])) },
18906
+ { action: "add-vector-mask-hide", label: "Add Vector Mask (Hide All)", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _534 => _534.mask, 'optionalAccess', _535 => _535.source])) },
18907
+ { action: "add-vector-mask-selection", label: "Add Vector Mask from Selection", enabled: Boolean(active && active.type !== "shape" && !_optionalChain([active, 'access', _536 => _536.mask, 'optionalAccess', _537 => _537.source])) && hasSel },
18908
+ { action: "delete-vector-mask", label: "Delete Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _538 => _538.vectorMask])) },
18909
+ { action: "toggle-vector-mask", label: _optionalChain([active, 'optionalAccess', _539 => _539.vectorMask, 'optionalAccess', _540 => _540.enabled]) === false ? "Enable Vector Mask" : "Disable Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _541 => _541.vectorMask])) },
18910
+ { action: "rasterize-vector-mask", label: "Rasterize Vector Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _542 => _542.vectorMask])) },
18911
+ { action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess', _543 => _543.type]) === "annotation" || _optionalChain([active, 'optionalAccess', _544 => _544.type]) === "smart" || _optionalChain([active, 'optionalAccess', _545 => _545.type]) === "shape" || _optionalChain([active, 'optionalAccess', _546 => _546.type]) === "type" || isPixel && Boolean(_optionalChain([active, 'optionalAccess', _547 => _547.type]) === "pixel" && _optionalChain([active, 'access', _548 => _548.filters, 'optionalAccess', _549 => _549.length])) },
18546
18912
  { action: "convert-smart", label: "Convert to Smart Object", enabled: Boolean(active && active.type !== "annotation") },
18547
- { action: "edit-contents", label: "Edit Contents", enabled: _optionalChain([active, 'optionalAccess', _545 => _545.type]) === "smart" },
18548
- { action: "smart-via-copy", label: "New Smart Object via Copy", enabled: _optionalChain([active, 'optionalAccess', _546 => _546.type]) === "smart" },
18549
- { action: "add-filter-mask", label: "Add Smart Filter Mask", enabled: _optionalChain([active, 'optionalAccess', _547 => _547.type]) === "smart" && !_optionalChain([active, 'access', _548 => _548.smartFilters, 'optionalAccess', _549 => _549.mask]) },
18550
- { action: "toggle-clip", label: _optionalChain([active, 'optionalAccess', _550 => _550.clipped]) ? "Release Clipping Mask" : "Create Clipping Mask", enabled: Boolean(loc && loc.index > 0) }
18913
+ { action: "edit-contents", label: "Edit Contents", enabled: _optionalChain([active, 'optionalAccess', _550 => _550.type]) === "smart" },
18914
+ { action: "smart-via-copy", label: "New Smart Object via Copy", enabled: _optionalChain([active, 'optionalAccess', _551 => _551.type]) === "smart" },
18915
+ { action: "add-filter-mask", label: "Add Smart Filter Mask", enabled: _optionalChain([active, 'optionalAccess', _552 => _552.type]) === "smart" && !_optionalChain([active, 'access', _553 => _553.smartFilters, 'optionalAccess', _554 => _554.mask]) },
18916
+ { action: "toggle-clip", label: _optionalChain([active, 'optionalAccess', _555 => _555.clipped]) ? "Release Clipping Mask" : "Create Clipping Mask", enabled: Boolean(loc && loc.index > 0) }
18551
18917
  ];
18552
18918
  }
18553
18919
  async function runLayerMenuAction(controller, action) {
18554
18920
  const active = controller.getActiveLayer();
18555
- const id = _optionalChain([active, 'optionalAccess', _551 => _551.id]);
18921
+ const id = _optionalChain([active, 'optionalAccess', _556 => _556.id]);
18556
18922
  try {
18557
18923
  switch (action) {
18558
18924
  case "new-layer":
@@ -18608,10 +18974,10 @@ async function runLayerMenuAction(controller, action) {
18608
18974
  if (id) controller.removeLayerMask(id);
18609
18975
  break;
18610
18976
  case "toggle-mask":
18611
- if (id && _optionalChain([active, 'optionalAccess', _552 => _552.mask])) controller.setLayerMaskProps(id, { enabled: active.mask.enabled === false });
18977
+ if (id && _optionalChain([active, 'optionalAccess', _557 => _557.mask])) controller.setLayerMaskProps(id, { enabled: active.mask.enabled === false });
18612
18978
  break;
18613
18979
  case "toggle-mask-link":
18614
- if (id && _optionalChain([active, 'optionalAccess', _553 => _553.mask])) controller.setLayerMaskProps(id, { linked: active.mask.linked === false });
18980
+ if (id && _optionalChain([active, 'optionalAccess', _558 => _558.mask])) controller.setLayerMaskProps(id, { linked: active.mask.linked === false });
18615
18981
  break;
18616
18982
  case "add-vector-mask":
18617
18983
  case "add-vector-mask-hide":
@@ -18624,7 +18990,7 @@ async function runLayerMenuAction(controller, action) {
18624
18990
  if (id) controller.removeVectorMask(id);
18625
18991
  break;
18626
18992
  case "toggle-vector-mask":
18627
- if (id && _optionalChain([active, 'optionalAccess', _554 => _554.vectorMask])) controller.setVectorMaskProps(id, { enabled: active.vectorMask.enabled === false });
18993
+ if (id && _optionalChain([active, 'optionalAccess', _559 => _559.vectorMask])) controller.setVectorMaskProps(id, { enabled: active.vectorMask.enabled === false });
18628
18994
  break;
18629
18995
  case "rasterize-vector-mask":
18630
18996
  if (id) controller.rasterizeVectorMask(id);
@@ -18645,7 +19011,7 @@ async function runLayerMenuAction(controller, action) {
18645
19011
  if (id) controller.setSmartFilterMask(id, "reveal-all");
18646
19012
  break;
18647
19013
  case "toggle-clip":
18648
- if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess', _555 => _555.clipped]) });
19014
+ if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess', _560 => _560.clipped]) });
18649
19015
  break;
18650
19016
  }
18651
19017
  return null;
@@ -18655,7 +19021,7 @@ async function runLayerMenuAction(controller, action) {
18655
19021
  }
18656
19022
  function smartFilterRows(layer) {
18657
19023
  if (layer.type !== "smart") return [];
18658
- const list = _nullishCoalesce(_optionalChain([layer, 'access', _556 => _556.smartFilters, 'optionalAccess', _557 => _557.filters]), () => ( []));
19024
+ const list = _nullishCoalesce(_optionalChain([layer, 'access', _561 => _561.smartFilters, 'optionalAccess', _562 => _562.filters]), () => ( []));
18659
19025
  const rows = list.map((f, index) => ({
18660
19026
  filter: f,
18661
19027
  index,
@@ -18681,8 +19047,8 @@ function extractNormalizedLayerItems(controller, fallbackImageUrl = "") {
18681
19047
  };
18682
19048
  collectSerialized(_nullishCoalesce(serialized.layers, () => ( [])));
18683
19049
  const sLayerMap = new Map(allSerializedLayers.map((sl) => [sl.id, sl]));
18684
- const imgW = _optionalChain([state, 'access', _558 => _558.imageDimensions, 'optionalAccess', _559 => _559.width]) || 1;
18685
- const imgH = _optionalChain([state, 'access', _560 => _560.imageDimensions, 'optionalAccess', _561 => _561.height]) || 1;
19050
+ const imgW = _optionalChain([state, 'access', _563 => _563.imageDimensions, 'optionalAccess', _564 => _564.width]) || 1;
19051
+ const imgH = _optionalChain([state, 'access', _565 => _565.imageDimensions, 'optionalAccess', _566 => _566.height]) || 1;
18686
19052
  return ctrlLayers.map((l) => {
18687
19053
  const bounds = controller.getLayerBounds(l.id) || {
18688
19054
  x: 0,
@@ -18691,8 +19057,8 @@ function extractNormalizedLayerItems(controller, fallbackImageUrl = "") {
18691
19057
  height: imgH
18692
19058
  };
18693
19059
  const sLayer = sLayerMap.get(l.id);
18694
- const assetKey = _optionalChain([sLayer, 'optionalAccess', _562 => _562.asset]);
18695
- const layerDataUrl = assetKey && assets[assetKey] || assets[l.id] || (_optionalChain([sLayer, 'optionalAccess', _563 => _563.source]) === "document" ? fallbackImageUrl : "");
19060
+ const assetKey = _optionalChain([sLayer, 'optionalAccess', _567 => _567.asset]);
19061
+ const layerDataUrl = assetKey && assets[assetKey] || assets[l.id] || (_optionalChain([sLayer, 'optionalAccess', _568 => _568.source]) === "document" ? fallbackImageUrl : "");
18696
19062
  return {
18697
19063
  id: l.id,
18698
19064
  name: l.name || "Untitled Layer",
@@ -18746,9 +19112,9 @@ async function addLayerOfKind(controller, id, init) {
18746
19112
  const cx = Math.round(canvas.width / 2);
18747
19113
  const cy = Math.round(canvas.height / 2);
18748
19114
  return controller.addTextLayer({
18749
- text: _optionalChain([init, 'optionalAccess', _564 => _564.text]) || "New Text",
18750
- x: typeof _optionalChain([init, 'optionalAccess', _565 => _565.x]) === "number" ? init.x : cx - 100,
18751
- y: typeof _optionalChain([init, 'optionalAccess', _566 => _566.y]) === "number" ? init.y : cy,
19115
+ text: _optionalChain([init, 'optionalAccess', _569 => _569.text]) || "New Text",
19116
+ x: typeof _optionalChain([init, 'optionalAccess', _570 => _570.x]) === "number" ? init.x : cx - 100,
19117
+ y: typeof _optionalChain([init, 'optionalAccess', _571 => _571.y]) === "number" ? init.y : cy,
18752
19118
  ...init
18753
19119
  });
18754
19120
  }
@@ -18761,10 +19127,10 @@ async function addLayerOfKind(controller, id, init) {
18761
19127
  return controller.addShapeLayer({
18762
19128
  shape: {
18763
19129
  kind: "rect",
18764
- x: typeof _optionalChain([init, 'optionalAccess', _567 => _567.x]) === "number" ? init.x : cx - Math.round(w / 2),
18765
- y: typeof _optionalChain([init, 'optionalAccess', _568 => _568.y]) === "number" ? init.y : cy - Math.round(h / 2),
18766
- width: typeof _optionalChain([init, 'optionalAccess', _569 => _569.width]) === "number" ? init.width : w,
18767
- height: typeof _optionalChain([init, 'optionalAccess', _570 => _570.height]) === "number" ? init.height : h
19130
+ x: typeof _optionalChain([init, 'optionalAccess', _572 => _572.x]) === "number" ? init.x : cx - Math.round(w / 2),
19131
+ y: typeof _optionalChain([init, 'optionalAccess', _573 => _573.y]) === "number" ? init.y : cy - Math.round(h / 2),
19132
+ width: typeof _optionalChain([init, 'optionalAccess', _574 => _574.width]) === "number" ? init.width : w,
19133
+ height: typeof _optionalChain([init, 'optionalAccess', _575 => _575.height]) === "number" ? init.height : h
18768
19134
  },
18769
19135
  name: "Rectangle",
18770
19136
  ...init
@@ -18779,10 +19145,10 @@ async function addLayerOfKind(controller, id, init) {
18779
19145
  return controller.addShapeLayer({
18780
19146
  shape: {
18781
19147
  kind: "ellipse",
18782
- x: typeof _optionalChain([init, 'optionalAccess', _571 => _571.x]) === "number" ? init.x : cx - Math.round(w / 2),
18783
- y: typeof _optionalChain([init, 'optionalAccess', _572 => _572.y]) === "number" ? init.y : cy - Math.round(h / 2),
18784
- width: typeof _optionalChain([init, 'optionalAccess', _573 => _573.width]) === "number" ? init.width : w,
18785
- height: typeof _optionalChain([init, 'optionalAccess', _574 => _574.height]) === "number" ? init.height : h
19148
+ x: typeof _optionalChain([init, 'optionalAccess', _576 => _576.x]) === "number" ? init.x : cx - Math.round(w / 2),
19149
+ y: typeof _optionalChain([init, 'optionalAccess', _577 => _577.y]) === "number" ? init.y : cy - Math.round(h / 2),
19150
+ width: typeof _optionalChain([init, 'optionalAccess', _578 => _578.width]) === "number" ? init.width : w,
19151
+ height: typeof _optionalChain([init, 'optionalAccess', _579 => _579.height]) === "number" ? init.height : h
18786
19152
  },
18787
19153
  name: "Ellipse",
18788
19154
  ...init
@@ -18843,18 +19209,18 @@ function layerEffectsPanel(layer) {
18843
19209
  if (!layer) return { ...empty, available: false, reason: "Select a layer to add a layer style." };
18844
19210
  if (layer.type === "adjustment") return { ...empty, available: false, reason: "Adjustment layers cannot have a layer style." };
18845
19211
  const fx = layer.effects;
18846
- const readOnly = Boolean(_optionalChain([layer, 'access', _575 => _575.locks, 'optionalAccess', _576 => _576.all]));
19212
+ const readOnly = Boolean(_optionalChain([layer, 'access', _580 => _580.locks, 'optionalAccess', _581 => _581.all]));
18847
19213
  return {
18848
19214
  available: true,
18849
19215
  readOnly,
18850
19216
  reason: readOnly ? "The layer is locked; unlock it to change its layer style." : void 0,
18851
- enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _577 => _577.enabled]), () => ( true)),
18852
- scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _578 => _578.scale]), () => ( 1)),
18853
- rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess', _579 => _579.items]), () => ( []))).map((e) => ({ id: e.id, kind: e.kind, label: _chunkHGTDMKNEcjs.layerEffectLabel.call(void 0, e.kind), enabled: e.enabled }))
19217
+ enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _582 => _582.enabled]), () => ( true)),
19218
+ scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _583 => _583.scale]), () => ( 1)),
19219
+ rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess', _584 => _584.items]), () => ( []))).map((e) => ({ id: e.id, kind: e.kind, label: _chunkHGTDMKNEcjs.layerEffectLabel.call(void 0, e.kind), enabled: e.enabled }))
18854
19220
  };
18855
19221
  }
18856
19222
  function layerEffectsBadge(layer) {
18857
- if (!_optionalChain([layer, 'access', _580 => _580.effects, 'optionalAccess', _581 => _581.items, 'access', _582 => _582.length])) return null;
19223
+ if (!_optionalChain([layer, 'access', _585 => _585.effects, 'optionalAccess', _586 => _586.items, 'access', _587 => _587.length])) return null;
18858
19224
  return _chunkHGTDMKNEcjs.hasActiveEffects.call(void 0, layer.effects) ? "on" : "off";
18859
19225
  }
18860
19226
  var LAYER_EFFECT_MENU = _chunkHGTDMKNEcjs.LAYER_EFFECT_KINDS.map((kind) => ({ kind, label: _chunkHGTDMKNEcjs.layerEffectLabel.call(void 0, kind) }));
@@ -18899,8 +19265,8 @@ function fillControls(f, allowPattern, patterns) {
18899
19265
  }
18900
19266
  function gradientControls(prefix, g) {
18901
19267
  return [
18902
- { key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _583 => _583.stops, 'access', _584 => _584[0], 'optionalAccess', _585 => _585.color]), () => ( "#000000")) },
18903
- { key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _586 => _586.stops, 'access', _587 => _587[g.stops.length - 1], 'optionalAccess', _588 => _588.color]), () => ( "#ffffff")) },
19268
+ { key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _588 => _588.stops, 'access', _589 => _589[0], 'optionalAccess', _590 => _590.color]), () => ( "#000000")) },
19269
+ { key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _591 => _591.stops, 'access', _592 => _592[g.stops.length - 1], 'optionalAccess', _593 => _593.color]), () => ( "#ffffff")) },
18904
19270
  { key: `${prefix}.style`, label: "Style", type: "select", value: g.style, options: opt(["linear", "Linear"], ["radial", "Radial"], ["angle", "Angle"], ["reflected", "Reflected"], ["diamond", "Diamond"]) },
18905
19271
  { key: `${prefix}.angle`, label: "Angle", type: "range", min: -180, max: 180, step: 1, value: g.angle, unit: "\xB0" },
18906
19272
  { key: `${prefix}.scale`, label: "Scale", type: "range", min: 0.1, max: 1.5, step: 0.01, value: g.scale, percent: true, unit: "%" },
@@ -18992,19 +19358,19 @@ function layerEffectControls(e, patterns = []) {
18992
19358
  }
18993
19359
  function fillOfType(current, type, patterns) {
18994
19360
  if (type === "gradient") return { type: "gradient", gradient: _chunkHGTDMKNEcjs.defaultEffectGradient.call(void 0, ) };
18995
- if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access', _589 => _589[0], 'optionalAccess', _590 => _590.id]), () => ( "checker")), scale: 1 };
19361
+ if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access', _594 => _594[0], 'optionalAccess', _595 => _595.id]), () => ( "checker")), scale: 1 };
18996
19362
  return { type: "color", color: current.type === "color" ? current.color : "#000000" };
18997
19363
  }
18998
19364
  function effectControlChange(effect, key, value, patterns = []) {
18999
19365
  const [top, ...rest] = key.split(".");
19000
19366
  if (top === "fill" && rest[0] === "type") return { fill: fillOfType(effect.fill, String(value), patterns) };
19001
19367
  if (top === "patternId" && !rest.length) {
19002
- const name = _optionalChain([patternOptions, 'call', _591 => _591(patterns), 'access', _592 => _592.find, 'call', _593 => _593((o) => o.value === value), 'optionalAccess', _594 => _594.label]);
19368
+ const name = _optionalChain([patternOptions, 'call', _596 => _596(patterns), 'access', _597 => _597.find, 'call', _598 => _598((o) => o.value === value), 'optionalAccess', _599 => _599.label]);
19003
19369
  return name ? { patternId: value, name } : { patternId: value };
19004
19370
  }
19005
19371
  if (!rest.length) return { [top]: value };
19006
19372
  if (top === "fill" && rest[0] === "patternId") {
19007
- const name = _optionalChain([patternOptions, 'call', _595 => _595(patterns), 'access', _596 => _596.find, 'call', _597 => _597((o) => o.value === value), 'optionalAccess', _598 => _598.label]);
19373
+ const name = _optionalChain([patternOptions, 'call', _600 => _600(patterns), 'access', _601 => _601.find, 'call', _602 => _602((o) => o.value === value), 'optionalAccess', _603 => _603.label]);
19008
19374
  return { fill: { ...effect.fill, patternId: value, ...name ? { name } : {} } };
19009
19375
  }
19010
19376
  return { [top]: setPath(getPath(effect, top), rest, value) };
@@ -19031,7 +19397,7 @@ function colorPanelView(controller) {
19031
19397
  profileName: profile.name,
19032
19398
  workingSpace: profile.builtin,
19033
19399
  mode: profile.mode,
19034
- cmykProfileName: _nullishCoalesce(_optionalChain([profile, 'access', _599 => _599.cmykProfile, 'optionalAccess', _600 => _600.name]), () => ( null)),
19400
+ cmykProfileName: _nullishCoalesce(_optionalChain([profile, 'access', _604 => _604.cmykProfile, 'optionalAccess', _605 => _605.name]), () => ( null)),
19035
19401
  proof: proof ? { id: _nullishCoalesce(proof.profile.builtin, () => ( null)), name: proof.profile.name, intent: proof.intent, simulatePaper: proof.simulatePaper, gamutWarning: proof.gamutWarning, bpc: proof.bpc } : null
19036
19402
  };
19037
19403
  }
@@ -19239,7 +19605,7 @@ var FreeTransformTool = (_class16 = class {
19239
19605
  __init131() {this.error = null}
19240
19606
  __init132() {this.lastResult = null}
19241
19607
  get active() {
19242
- return Boolean(_optionalChain([this, 'access', _601 => _601.sessionRef, 'optionalAccess', _602 => _602.isOpen]));
19608
+ return Boolean(_optionalChain([this, 'access', _606 => _606.sessionRef, 'optionalAccess', _607 => _607.isOpen]));
19243
19609
  }
19244
19610
  get session() {
19245
19611
  return this.active ? this.sessionRef : null;
@@ -19248,7 +19614,7 @@ var FreeTransformTool = (_class16 = class {
19248
19614
  return this.modeValue;
19249
19615
  }
19250
19616
  get interpolation() {
19251
- return _nullishCoalesce(_optionalChain([this, 'access', _603 => _603.sessionRef, 'optionalAccess', _604 => _604.interpolation]), () => ( "bicubic"));
19617
+ return _nullishCoalesce(_optionalChain([this, 'access', _608 => _608.sessionRef, 'optionalAccess', _609 => _609.interpolation]), () => ( "bicubic"));
19252
19618
  }
19253
19619
  /** Whether the open transform has changed anything yet (a commit would add an undo step). */
19254
19620
  get modified() {
@@ -19267,7 +19633,7 @@ var FreeTransformTool = (_class16 = class {
19267
19633
  };
19268
19634
  }
19269
19635
  changed() {
19270
- _optionalChain([this, 'access', _605 => _605.options, 'access', _606 => _606.onChange, 'optionalCall', _607 => _607()]);
19636
+ _optionalChain([this, 'access', _610 => _610.options, 'access', _611 => _611.onChange, 'optionalCall', _612 => _612()]);
19271
19637
  for (const l of this.listeners) l();
19272
19638
  }
19273
19639
  /** Opens a Free Transform (default: the selected pixels of the active layer, or the whole layer). Returns an error message or `null`. */
@@ -19660,7 +20026,7 @@ var FreeTransformTool = (_class16 = class {
19660
20026
  }
19661
20027
  /** Abandons the transform and restores everything. */
19662
20028
  cancel() {
19663
- _optionalChain([this, 'access', _608 => _608.sessionRef, 'optionalAccess', _609 => _609.cancel, 'call', _610 => _610()]);
20029
+ _optionalChain([this, 'access', _613 => _613.sessionRef, 'optionalAccess', _614 => _614.cancel, 'call', _615 => _615()]);
19664
20030
  this.sessionRef = null;
19665
20031
  this.corners = null;
19666
20032
  this.mesh = null;
@@ -19716,7 +20082,7 @@ function imageLayerAppliedEffects(layer) {
19716
20082
  const ref = (r) => ({ effect: r.effect, ...r.name ? { name: r.name } : {}, ...r.provider ? { provider: r.provider } : {} });
19717
20083
  if (layer.type === "pixel" && layer.generator) out.push({ id: "generator", ...ref(layer.generator), role: "effect layer", enabled: true, values: layer.generator.values, ...layer.generator.time ? { time: layer.generator.time } : {}, ...layer.generator.animate ? { animate: layer.generator.animate } : {} });
19718
20084
  if (layer.type === "smart")
19719
- (_nullishCoalesce(_optionalChain([layer, 'access', _611 => _611.smartFilters, 'optionalAccess', _612 => _612.filters]), () => ( []))).forEach((f, index) => {
20085
+ (_nullishCoalesce(_optionalChain([layer, 'access', _616 => _616.smartFilters, 'optionalAccess', _617 => _617.filters]), () => ( []))).forEach((f, index) => {
19720
20086
  if (f.kind === "effect") out.push({ id: f.id, ...ref(f), role: "smart filter", enabled: f.enabled && layer.smartFilters.enabled, opacity: f.opacity, blend: f.blend, values: f.values, index });
19721
20087
  });
19722
20088
  return out;
@@ -19868,7 +20234,7 @@ var OTHER_TOOL_LABELS = {
19868
20234
  watermark: "Watermark"
19869
20235
  };
19870
20236
  function imageToolLabel(tool) {
19871
- return _nullishCoalesce(_nullishCoalesce(_optionalChain([PAINT_TOOLS, 'access', _613 => _613.find, 'call', _614 => _614((t) => t.id === tool), 'optionalAccess', _615 => _615.label]), () => ( OTHER_TOOL_LABELS[tool])), () => ( tool));
20237
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([PAINT_TOOLS, 'access', _618 => _618.find, 'call', _619 => _619((t) => t.id === tool), 'optionalAccess', _620 => _620.label]), () => ( OTHER_TOOL_LABELS[tool])), () => ( tool));
19872
20238
  }
19873
20239
  var IMAGE_TOOL_SHORTCUTS = {
19874
20240
  ...Object.fromEntries(PAINT_TOOLS.filter((t) => t.shortcut).map((t) => [t.id, t.shortcut])),
@@ -20993,4 +21359,14 @@ function createImageEditorDocument(controller, options = {}) {
20993
21359
 
20994
21360
 
20995
21361
 
20996
- exports.ADJUSTMENT_KEYS = _chunkUYXL6ZWQcjs.ADJUSTMENT_KEYS; exports.ADJUSTMENT_KINDS = _chunkUYXL6ZWQcjs.ADJUSTMENT_KINDS; exports.ADJUSTMENT_LAYER_CONTROLS = ADJUSTMENT_LAYER_CONTROLS; exports.ADJUSTMENT_LAYER_OPACITY_CONTROL = ADJUSTMENT_LAYER_OPACITY_CONTROL; exports.ADJUSTMENT_LUT_SIZE = _chunkUYXL6ZWQcjs.ADJUSTMENT_LUT_SIZE; exports.ANCHOR_FRACTION = _chunkUYXL6ZWQcjs.ANCHOR_FRACTION; exports.AS_SHOT_KELVIN = _chunkUYXL6ZWQcjs.AS_SHOT_KELVIN; exports.BACKGROUND_LAYER_ID = _chunkUYXL6ZWQcjs.BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = _chunkUYXL6ZWQcjs.BACKGROUND_LAYER_NAME; exports.BIT_DEPTHS = _chunkCWM3CUUXcjs.BIT_DEPTHS; exports.BIT_DEPTH_OPTIONS = BIT_DEPTH_OPTIONS; exports.BLEND_MODES = _chunkCWM3CUUXcjs.BLEND_MODES; exports.BLUR_FILTER_ID = _chunkUYXL6ZWQcjs.BLUR_FILTER_ID; exports.BODY_SCATTER = _chunkV7GWZIZKcjs.BODY_SCATTER; exports.BRUSHSTROKE_MAX_SCALE = _chunkYQGCPL5Xcjs.BRUSHSTROKE_MAX_SCALE; exports.BRUSHSTROKE_MIN_SCALE = _chunkYQGCPL5Xcjs.BRUSHSTROKE_MIN_SCALE; exports.BRUSH_OPTION_CONTROLS = BRUSH_OPTION_CONTROLS; exports.BUILTIN_PROFILES = _chunkBROJYMWUcjs.BUILTIN_PROFILES; exports.BrushstrokeCache = _chunkEBDCRTZIcjs.BrushstrokeCache; exports.CANVAS_SIZE_PRESETS = CANVAS_SIZE_PRESETS; exports.CLONE_TRANSFORM_CONTROLS = CLONE_TRANSFORM_CONTROLS; exports.COLOR_MODE_OPTIONS = COLOR_MODE_OPTIONS; exports.COLOR_RANGE_PRESETS = COLOR_RANGE_PRESETS; exports.COLOR_RANGE_PRESET_LABELS = COLOR_RANGE_PRESET_LABELS; exports.ColorGmm = ColorGmm; exports.CoverageMap = _chunkEBDCRTZIcjs.CoverageMap; exports.D50 = _chunkUYXL6ZWQcjs.D50; exports.D65 = _chunkUYXL6ZWQcjs.D65; exports.DEFAULT_ADJUSTMENTS = DEFAULT_ADJUSTMENTS; exports.DEFAULT_AUTO_LEADING = _chunkBRKVNXDZcjs.DEFAULT_AUTO_LEADING; exports.DEFAULT_BLENDER = _chunkEBDCRTZIcjs.DEFAULT_BLENDER; exports.DEFAULT_BRUSH = _chunkEBDCRTZIcjs.DEFAULT_BRUSH; exports.DEFAULT_CANVAS_VIEWPORT = DEFAULT_CANVAS_VIEWPORT; exports.DEFAULT_CHANNEL_COLOR = DEFAULT_CHANNEL_COLOR; exports.DEFAULT_DEPTH_MASK = DEFAULT_DEPTH_MASK; exports.DEFAULT_FLOW = _chunkV7GWZIZKcjs.DEFAULT_FLOW; exports.DEFAULT_GLOBAL_LIGHT = _chunkHGTDMKNEcjs.DEFAULT_GLOBAL_LIGHT; exports.DEFAULT_MITER_LIMIT = _chunkUYXL6ZWQcjs.DEFAULT_MITER_LIMIT; exports.DEFAULT_MIXER = _chunkEBDCRTZIcjs.DEFAULT_MIXER; exports.DEFAULT_PAINT_GRADIENT = _chunkEBDCRTZIcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkEBDCRTZIcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PROOF = DEFAULT_PROOF; exports.DEFAULT_REFINE_EDGE_PARAMS = DEFAULT_REFINE_EDGE_PARAMS; exports.DEFAULT_RETOUCH = _chunk7NW46N7Icjs.DEFAULT_RETOUCH; exports.DEFAULT_SELECTION_TOOL_OPTIONS = DEFAULT_SELECTION_TOOL_OPTIONS; exports.DEFAULT_SHAPE_TOOL_OPTIONS = DEFAULT_SHAPE_TOOL_OPTIONS; exports.DEFAULT_SMUDGE = _chunkEBDCRTZIcjs.DEFAULT_SMUDGE; exports.DEFAULT_TEXT_STYLE = _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE; exports.DEFAULT_TRANSFORM = DEFAULT_TRANSFORM; exports.DEFAULT_TYPE_TOOL_OPTIONS = DEFAULT_TYPE_TOOL_OPTIONS; exports.DEFAULT_WET_PAPER = _chunkV7GWZIZKcjs.DEFAULT_WET_PAPER; exports.DEFAULT_WET_PARAMS = _chunkV7GWZIZKcjs.DEFAULT_WET_PARAMS; exports.DEPTH_MASK_CONTROLS = DEPTH_MASK_CONTROLS; exports.DEVELOP_FILTER_ID = _chunkUYXL6ZWQcjs.DEVELOP_FILTER_ID; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkHGTDMKNEcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DRY_EPS = _chunkV7GWZIZKcjs.DRY_EPS; exports.DabWalker = _chunkEBDCRTZIcjs.DabWalker; exports.EFFECT_LAYER_USES = EFFECT_LAYER_USES; exports.EMPTY_DISTANCE = _chunkUYXL6ZWQcjs.EMPTY_DISTANCE; exports.EMPTY_MIXER_LOAD = _chunkEBDCRTZIcjs.EMPTY_MIXER_LOAD; exports.EX = _chunkV7GWZIZKcjs.EX; exports.EY = _chunkV7GWZIZKcjs.EY; exports.EdgeMap = EdgeMap; exports.FLAG_ALIVE = _chunkV7GWZIZKcjs.FLAG_ALIVE; exports.FLAG_BOTTOM = _chunkV7GWZIZKcjs.FLAG_BOTTOM; exports.FLAG_LEFT = _chunkV7GWZIZKcjs.FLAG_LEFT; exports.FLAG_RIGHT = _chunkV7GWZIZKcjs.FLAG_RIGHT; exports.FLAG_TOP = _chunkV7GWZIZKcjs.FLAG_TOP; exports.FLAG_WET = _chunkV7GWZIZKcjs.FLAG_WET; exports.FLAT = _chunkV7GWZIZKcjs.FLAT; exports.FREE_INTERVAL = _chunkV7GWZIZKcjs.FREE_INTERVAL; exports.FREE_TRANSFORM_CONTENTS = FREE_TRANSFORM_CONTENTS; exports.FREE_TRANSFORM_FIELDS = FREE_TRANSFORM_FIELDS; exports.FREE_TRANSFORM_MODES = _chunkUYXL6ZWQcjs.FREE_TRANSFORM_MODES; exports.FREE_TRANSFORM_MODE_OPTIONS = FREE_TRANSFORM_MODE_OPTIONS; exports.FreeTransformSession = FreeTransformSession; exports.FreeTransformTool = FreeTransformTool; exports.GAMMA = GAMMA; exports.GRAIN_PATTERNS = _chunkEBDCRTZIcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkEBDCRTZIcjs.GRAIN_TILE; exports.GUIDED_FILTER_EPS = GUIDED_FILTER_EPS; exports.GridGraph = GridGraph; exports.HIDE = _chunkV7GWZIZKcjs.HIDE; exports.HISTOGRAM_BINS = HISTOGRAM_BINS; exports.HUE_RANGE_LABELS = _chunkUYXL6ZWQcjs.HUE_RANGE_LABELS; exports.HUE_RANGE_PRESETS = HUE_RANGE_PRESETS; exports.IDENTITY_CLONE_TRANSFORM = _chunk7NW46N7Icjs.IDENTITY_CLONE_TRANSFORM; exports.IDENTITY_MATRIX3 = _chunkUYXL6ZWQcjs.IDENTITY_MATRIX3; exports.IMAGE_ADJUSTMENT_CONTROLS = IMAGE_ADJUSTMENT_CONTROLS; exports.IMAGE_CROP_PRESETS = IMAGE_CROP_PRESETS; exports.IMAGE_EDITOR_SCHEMA_VERSION = IMAGE_EDITOR_SCHEMA_VERSION; exports.IMAGE_EDITOR_STATE_VERSION = IMAGE_EDITOR_STATE_VERSION; exports.IMAGE_EFFECT_PLACES = IMAGE_EFFECT_PLACES; exports.IMAGE_FILTER_PRESETS = IMAGE_FILTER_PRESETS; exports.IMAGE_PLAYBACK_KIND = IMAGE_PLAYBACK_KIND; exports.IMAGE_TOOL_GROUPS = IMAGE_TOOL_GROUPS; exports.IMAGE_TOOL_SHORTCUTS = IMAGE_TOOL_SHORTCUTS; exports.INTENTS = _chunkBROJYMWUcjs.INTENTS; exports.INTENT_OPTIONS = INTENT_OPTIONS; exports.INTERPOLATIONS = _chunkHGTDMKNEcjs.INTERPOLATIONS; exports.ImageEditorController = ImageEditorController; exports.ImageEditorRenderer = ImageEditorRenderer; exports.ImageEffectsEngine = ImageEffectsEngine; exports.LATEST_PROCESS_VERSION = _chunkUYXL6ZWQcjs.LATEST_PROCESS_VERSION; exports.LAYERED_SCHEMA_VERSION = _chunkUYXL6ZWQcjs.LAYERED_SCHEMA_VERSION; exports.LAYER_EFFECT_KINDS = _chunkHGTDMKNEcjs.LAYER_EFFECT_KINDS; exports.LAYER_EFFECT_MENU = LAYER_EFFECT_MENU; exports.LEGACY_PROCESS_VERSION = _chunkUYXL6ZWQcjs.LEGACY_PROCESS_VERSION; exports.LIVE_SHAPE_KINDS = _chunkUYXL6ZWQcjs.LIVE_SHAPE_KINDS; exports.LUMA_709 = _chunkUYXL6ZWQcjs.LUMA_709; exports.LayerCompositor = _chunkUYXL6ZWQcjs.LayerCompositor; exports.LayerEffectError = _chunkHGTDMKNEcjs.LayerEffectError; exports.LayerOperationError = _chunkUYXL6ZWQcjs.LayerOperationError; exports.MARCHING_ANTS_STEP_MS = MARCHING_ANTS_STEP_MS; exports.MASK_FILE_ACCEPT = MASK_FILE_ACCEPT; exports.MAX_BATCH = _chunkV7GWZIZKcjs.MAX_BATCH; exports.MAX_BRUSH_SIZE = _chunkEBDCRTZIcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_BACKING_SIDE = MAX_CANVAS_BACKING_SIDE; exports.MAX_EFFECT_ANIMATION_MS = _chunkUYXL6ZWQcjs.MAX_EFFECT_ANIMATION_MS; exports.MAX_EFFECT_REACH = _chunkHGTDMKNEcjs.MAX_EFFECT_REACH; exports.MAX_KELVIN = _chunkUYXL6ZWQcjs.MAX_KELVIN; exports.MAX_TILT_ACCEL = _chunkV7GWZIZKcjs.MAX_TILT_ACCEL; exports.MAX_TRANSFORM_PIXELS = _chunkHGTDMKNEcjs.MAX_TRANSFORM_PIXELS; exports.MAX_WET_LANES = _chunkV7GWZIZKcjs.MAX_WET_LANES; exports.MAX_WET_SLOTS = _chunkV7GWZIZKcjs.MAX_WET_SLOTS; exports.MIN_KELVIN = _chunkUYXL6ZWQcjs.MIN_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = _chunkUYXL6ZWQcjs.MIRED_PER_TEMPERATURE_UNIT; exports.MIXER_DRAIN = _chunkEBDCRTZIcjs.MIXER_DRAIN; exports.MIXER_MIXING_OPTIONS = MIXER_MIXING_OPTIONS; exports.MIXER_OPTION_CONTROLS = MIXER_OPTION_CONTROLS; exports.MIXER_PICKUP_RATE = _chunkEBDCRTZIcjs.MIXER_PICKUP_RATE; exports.MIXING_MODELS = _chunkEBDCRTZIcjs.MIXING_MODELS; exports.MixerStroke = _chunkEBDCRTZIcjs.MixerStroke; exports.OPP = _chunkV7GWZIZKcjs.OPP; exports.PAINTERLY_BLEND_MODES = _chunkCWM3CUUXcjs.PAINTERLY_BLEND_MODES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkEBDCRTZIcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_GRADIENT_FULL_SPEED = _chunkEBDCRTZIcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkEBDCRTZIcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkEBDCRTZIcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkEBDCRTZIcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkEBDCRTZIcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_CAPACITY = _chunkV7GWZIZKcjs.PAPER_CAPACITY; exports.PARAGRAPH_STYLE_FIELDS = _chunkUYXL6ZWQcjs.PARAGRAPH_STYLE_FIELDS; exports.PARAM = _chunkV7GWZIZKcjs.PARAM; exports.PARAM_FLOATS = _chunkV7GWZIZKcjs.PARAM_FLOATS; exports.PASTE_MODES = PASTE_MODES; exports.PATTERN_BLOCK_KEYS = _chunkUYXL6ZWQcjs.PATTERN_BLOCK_KEYS; exports.PIGMENT_BANDS = _chunkCWM3CUUXcjs.PIGMENT_BANDS; exports.PIGMENT_CHANNELS = _chunkV7GWZIZKcjs.PIGMENT_CHANNELS; exports.PIGMENT_LAMBDA_MIN = _chunkCWM3CUUXcjs.PIGMENT_LAMBDA_MIN; exports.PIGMENT_LAMBDA_STEP = _chunkCWM3CUUXcjs.PIGMENT_LAMBDA_STEP; exports.PIGMENT_UNIT = _chunkV7GWZIZKcjs.PIGMENT_UNIT; exports.PIGMENT_WAVELENGTHS = _chunkCWM3CUUXcjs.PIGMENT_WAVELENGTHS; exports.PLANE = _chunkV7GWZIZKcjs.PLANE; exports.PLANE_BYTES = _chunkV7GWZIZKcjs.PLANE_BYTES; exports.PROOF_PROFILE_OPTIONS = PROOF_PROFILE_OPTIONS; exports.PSD_BLEND_KEYS = _chunkUYXL6ZWQcjs.PSD_BLEND_KEYS; exports.PSD_FILE_ACCEPT = PSD_FILE_ACCEPT; exports.P_D0 = _chunkV7GWZIZKcjs.P_D0; exports.P_EDGE = _chunkV7GWZIZKcjs.P_EDGE; exports.P_FX = _chunkV7GWZIZKcjs.P_FX; exports.P_FY = _chunkV7GWZIZKcjs.P_FY; exports.P_H = _chunkV7GWZIZKcjs.P_H; exports.P_P0 = _chunkV7GWZIZKcjs.P_P0; exports.P_RHO = _chunkV7GWZIZKcjs.P_RHO; exports.P_SW = _chunkV7GWZIZKcjs.P_SW; exports.P_UX = _chunkV7GWZIZKcjs.P_UX; exports.P_UY = _chunkV7GWZIZKcjs.P_UY; exports.PaintExchange = _chunkEBDCRTZIcjs.PaintExchange; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkEBDCRTZIcjs.PaintGradientSampler; exports.PaintSourceError = _chunkEBDCRTZIcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaperGrain = _chunkEBDCRTZIcjs.PaperGrain; exports.PatternPlacement = _chunkHGTDMKNEcjs.PatternPlacement; exports.PatternTile = _chunkHGTDMKNEcjs.PatternTile; exports.PsdError = _chunkUYXL6ZWQcjs.PsdError; exports.QUICK_MASK_TARGET = QUICK_MASK_TARGET; exports.REFINE_EDGE_CONTROLS = REFINE_EDGE_CONTROLS; exports.RETOUCH_CHOICES = RETOUCH_CHOICES; exports.RETOUCH_OPTION_CONTROLS = RETOUCH_OPTION_CONTROLS; exports.RETOUCH_SAMPLES = _chunk7NW46N7Icjs.RETOUCH_SAMPLES; exports.RETOUCH_TOGGLES = RETOUCH_TOGGLES; exports.RETOUCH_TOOLS = RETOUCH_TOOLS; exports.RegionPixelSource = _chunk7NW46N7Icjs.RegionPixelSource; exports.RetouchDabStroke = _chunk7NW46N7Icjs.RetouchDabStroke; exports.SELECTION_MODES = _chunkUYXL6ZWQcjs.SELECTION_MODES; exports.SELECTION_MODE_LABELS = SELECTION_MODE_LABELS; exports.SELECTION_MODIFY_OPS = _chunkUYXL6ZWQcjs.SELECTION_MODIFY_OPS; exports.SELECTION_TOOLS = SELECTION_TOOLS; exports.SET_PLANES = _chunkV7GWZIZKcjs.SET_PLANES; exports.SHADOW_AMBIENT = _chunkCWM3CUUXcjs.SHADOW_AMBIENT; exports.SHAPE_KIND_LABELS = SHAPE_KIND_LABELS; exports.SHAPE_OPERATIONS = _chunkUYXL6ZWQcjs.SHAPE_OPERATIONS; exports.SHAPE_RENDER_MARGIN = _chunkUYXL6ZWQcjs.SHAPE_RENDER_MARGIN; exports.SLOT_BYTES = _chunkV7GWZIZKcjs.SLOT_BYTES; exports.SLOT_PLANES = _chunkV7GWZIZKcjs.SLOT_PLANES; exports.SLOT_SIDE = _chunkV7GWZIZKcjs.SLOT_SIDE; exports.SMART_RENDER_MARGIN = _chunkUYXL6ZWQcjs.SMART_RENDER_MARGIN; exports.SPOT_HEAL_TYPES = _chunk7NW46N7Icjs.SPOT_HEAL_TYPES; exports.SRGB_TO_LINEAR = _chunkV7GWZIZKcjs.SRGB_TO_LINEAR; exports.STRIP = _chunkV7GWZIZKcjs.STRIP; exports.SUPPORTED_ADJUSTMENT_KEYS = _chunkUYXL6ZWQcjs.SUPPORTED_ADJUSTMENT_KEYS; exports.SelectionGesture = SelectionGesture; exports.ShapeDrawGesture = ShapeDrawGesture; exports.SmudgeTip = _chunkEBDCRTZIcjs.SmudgeTip; exports.StrokeCoverage = _chunkEBDCRTZIcjs.StrokeCoverage; exports.SurfaceDraft = _chunkCWM3CUUXcjs.SurfaceDraft; exports.TEXT_ALIGNS = _chunkUYXL6ZWQcjs.TEXT_ALIGNS; exports.TEXT_ORIENTATIONS = _chunkUYXL6ZWQcjs.TEXT_ORIENTATIONS; exports.TEXT_RENDER_MARGIN = _chunkUYXL6ZWQcjs.TEXT_RENDER_MARGIN; exports.TEXT_STYLE_FIELDS = _chunkUYXL6ZWQcjs.TEXT_STYLE_FIELDS; exports.TILE = _chunkCWM3CUUXcjs.TILE; exports.TILE_SHIFT = _chunkCWM3CUUXcjs.TILE_SHIFT; exports.TINT_SCALE = _chunkUYXL6ZWQcjs.TINT_SCALE; exports.TIP_GRADIENT_STEPS = _chunkEBDCRTZIcjs.TIP_GRADIENT_STEPS; exports.TONE_LUT_SIZE = _chunkUYXL6ZWQcjs.TONE_LUT_SIZE; exports.TONE_RANGES = _chunk7NW46N7Icjs.TONE_RANGES; exports.TONE_RANGE_PRESETS = TONE_RANGE_PRESETS; exports.TRANSFORM_ANCHORS = _chunkUYXL6ZWQcjs.TRANSFORM_ANCHORS; exports.TRANSFORM_ROTATE_HANDLE_OFFSET = TRANSFORM_ROTATE_HANDLE_OFFSET; exports.TextEditSession = TextEditSession; exports.TileMedium = _chunkEBDCRTZIcjs.TileMedium; exports.TilePixelSource = _chunk7NW46N7Icjs.TilePixelSource; exports.TileableNoise = _chunkEBDCRTZIcjs.TileableNoise; exports.TiledSurface = _chunkCWM3CUUXcjs.TiledSurface; exports.TransformTooLargeError = _chunkHGTDMKNEcjs.TransformTooLargeError; exports.TransformedPixelSource = _chunk7NW46N7Icjs.TransformedPixelSource; exports.TypeToolGesture = TypeToolGesture; exports.UNITS = UNITS; exports.U_MAX = _chunkV7GWZIZKcjs.U_MAX; exports.VIBRANCE_GREY = _chunkUYXL6ZWQcjs.VIBRANCE_GREY; exports.W9 = _chunkV7GWZIZKcjs.W9; exports.WARP_GRID_OPTIONS = WARP_GRID_OPTIONS; exports.WARP_STYLES = _chunkBRKVNXDZcjs.WARP_STYLES; exports.WARP_STYLE_LABELS = _chunkBRKVNXDZcjs.WARP_STYLE_LABELS; exports.WARP_STYLE_OPTIONS = WARP_STYLE_OPTIONS; exports.WET_FLOW_KINDS = _chunkV7GWZIZKcjs.WET_FLOW_KINDS; exports.WET_PARAM_KEYS = _chunkV7GWZIZKcjs.WET_PARAM_KEYS; exports.WET_TILE = _chunkV7GWZIZKcjs.WET_TILE; exports.WGSL_HALO = _chunkV7GWZIZKcjs.WGSL_HALO; exports.WGSL_SHADE = _chunkV7GWZIZKcjs.WGSL_SHADE; exports.WGSL_STEP = _chunkV7GWZIZKcjs.WGSL_STEP; exports.WORKING_SPACE_OPTIONS = WORKING_SPACE_OPTIONS; exports.WORK_SIZE = WORK_SIZE; exports.WetGpuEngine = _chunkV7GWZIZKcjs.WetGpuEngine; exports.WetMedium = _chunkV7GWZIZKcjs.WetMedium; exports.WetWorkerPool = _chunkV7GWZIZKcjs.WetWorkerPool; exports.WetWorld = _chunkV7GWZIZKcjs.WetWorld; exports.WetWorldError = _chunkV7GWZIZKcjs.WetWorldError; exports.XYZ_D50_TO_SRGB = _chunkUYXL6ZWQcjs.XYZ_D50_TO_SRGB; exports.ZlibError = _chunkXFM3OCHUcjs.ZlibError; exports.activeAdjustmentLayers = _chunkUYXL6ZWQcjs.activeAdjustmentLayers; exports.activeEffectSmartFilters = _chunkUYXL6ZWQcjs.activeEffectSmartFilters; exports.activeLayerAfterRemoval = _chunkUYXL6ZWQcjs.activeLayerAfterRemoval; exports.activeSmartFilters = _chunkUYXL6ZWQcjs.activeSmartFilters; exports.addLayerEffect = _chunkUYXL6ZWQcjs.addLayerEffect; exports.addLayerFilter = _chunkUYXL6ZWQcjs.addLayerFilter; exports.addLayerOfKind = addLayerOfKind; exports.addPaintGradientStop = _chunkEBDCRTZIcjs.addPaintGradientStop; exports.addSmartFilter = _chunkUYXL6ZWQcjs.addSmartFilter; exports.addToHistogram = addToHistogram; exports.adjustmentKindLabel = _chunkUYXL6ZWQcjs.adjustmentKindLabel; exports.adjustmentLayersKey = _chunkUYXL6ZWQcjs.adjustmentLayersKey; exports.adjustmentNodeAsLayer = _chunkUYXL6ZWQcjs.adjustmentNodeAsLayer; exports.adjustmentNodeFromLegacy = _chunkUYXL6ZWQcjs.adjustmentNodeFromLegacy; exports.adler32 = _chunkXFM3OCHUcjs.adler32; exports.agentDragDraft = agentDragDraft; exports.anchorPoint = _chunkUYXL6ZWQcjs.anchorPoint; exports.annotationBlend = _chunkUYXL6ZWQcjs.annotationBlend; exports.annotationLayerFor = _chunkUYXL6ZWQcjs.annotationLayerFor; exports.annotationLayerName = _chunkUYXL6ZWQcjs.annotationLayerName; exports.annotationOfLayer = _chunkUYXL6ZWQcjs.annotationOfLayer; exports.annotationOfShape = _chunkUYXL6ZWQcjs.annotationOfShape; exports.annotationOfType = _chunkUYXL6ZWQcjs.annotationOfType; exports.applyAdjustmentLayers = _chunkUYXL6ZWQcjs.applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = _chunkUYXL6ZWQcjs.applyAdjustmentLayersFloat; exports.applyAdjustments = _chunkUYXL6ZWQcjs.applyAdjustments; exports.applyBoxBlur = _chunkUYXL6ZWQcjs.applyBoxBlur; exports.applyBoxBlurFloat = _chunkUYXL6ZWQcjs.applyBoxBlurFloat; exports.applyDepthMask = _chunkUYXL6ZWQcjs.applyDepthMask; exports.applyHomography = _chunkQT26RHKKcjs.applyHomography; exports.applyImageProjectionToContext = _chunkUYXL6ZWQcjs.applyImageProjectionToContext; exports.applyLegacyAdjustments = _chunkUYXL6ZWQcjs.applyLegacyAdjustments; exports.applyLegacyFloat = _chunkUYXL6ZWQcjs.applyLegacyFloat; exports.applyMatrix3 = _chunkUYXL6ZWQcjs.applyMatrix3; exports.applyOutputStage = applyOutputStage; exports.applyParams = _chunkUYXL6ZWQcjs.applyParams; exports.applyProcess2Adjustments = _chunkUYXL6ZWQcjs.applyProcess2Adjustments; exports.applyProcess2Float = _chunkUYXL6ZWQcjs.applyProcess2Float; exports.applyRegionBlur = applyRegionBlur; exports.applyRegionMosaic = applyRegionMosaic; exports.applyRetouchToTile = _chunk7NW46N7Icjs.applyRetouchToTile; exports.applyShapeOptions = applyShapeOptions; exports.applySmartFilters = _chunkUYXL6ZWQcjs.applySmartFilters; exports.applyStrokeToDeepTile = _chunkEBDCRTZIcjs.applyStrokeToDeepTile; exports.applyStrokeToTile = _chunkEBDCRTZIcjs.applyStrokeToTile; exports.applyToneToDeepTile = _chunk7NW46N7Icjs.applyToneToDeepTile; exports.backgroundLayer = _chunkUYXL6ZWQcjs.backgroundLayer; exports.base64ToBytes = _chunkCWM3CUUXcjs.base64ToBytes; exports.baseProjection = baseProjection; exports.bestOffset = _chunk7NW46N7Icjs.bestOffset; exports.blackWhiteGray = _chunkUYXL6ZWQcjs.blackWhiteGray; exports.blendChannel = _chunkCWM3CUUXcjs.blendChannel; exports.blendImageData = _chunkCWM3CUUXcjs.blendImageData; exports.blendLum = _chunkCWM3CUUXcjs.blendLum; exports.blendPixel = _chunkCWM3CUUXcjs.blendPixel; exports.blendRadius = _chunkEBDCRTZIcjs.blendRadius; exports.blendRgb = _chunkCWM3CUUXcjs.blendRgb; exports.blendTile = _chunkHGTDMKNEcjs.blendTile; exports.blenderDab = _chunkEBDCRTZIcjs.blenderDab; exports.blurFilter = _chunkUYXL6ZWQcjs.blurFilter; exports.borderCoverage = _chunkUYXL6ZWQcjs.borderCoverage; exports.boxBlur = boxBlur; exports.boxBlurPixels = _chunk7NW46N7Icjs.boxBlurPixels; exports.boxFrameHit = boxFrameHit; exports.boxFrameOverlay = boxFrameOverlay; exports.boxMean = boxMean; exports.boxPointOf = _chunkUYXL6ZWQcjs.boxPointOf; exports.boxQuad = _chunkQT26RHKKcjs.boxQuad; exports.boxToCurvePoint = boxToCurvePoint; exports.bradfordAdaptation = _chunkUYXL6ZWQcjs.bradfordAdaptation; exports.brushstrokeDataUrl = _chunkEBDCRTZIcjs.brushstrokeDataUrl; exports.brushstrokeKey = _chunkEBDCRTZIcjs.brushstrokeKey; exports.brushstrokeSamples = _chunkEBDCRTZIcjs.brushstrokeSamples; exports.brushstrokeScaleBucket = _chunkYQGCPL5Xcjs.brushstrokeScaleBucket; exports.brushstrokeStrokeOptions = _chunkEBDCRTZIcjs.brushstrokeStrokeOptions; exports.brushstrokeToCanvas = _chunkEBDCRTZIcjs.brushstrokeToCanvas; exports.buildLayerMaskPlanes = _chunkUYXL6ZWQcjs.buildLayerMaskPlanes; exports.buildToneLut = _chunkUYXL6ZWQcjs.buildToneLut; exports.builtinPattern = _chunkHGTDMKNEcjs.builtinPattern; exports.builtinPatternIds = _chunkHGTDMKNEcjs.builtinPatternIds; exports.bytesToBase64 = _chunkCWM3CUUXcjs.bytesToBase64; exports.calculateCropDrag = _chunkUYXL6ZWQcjs.calculateCropDrag; exports.canShareMemory = _chunkV7GWZIZKcjs.canShareMemory; exports.canvasCompositeOperation = _chunkCWM3CUUXcjs.canvasCompositeOperation; exports.canvasToImagePoint = _chunkUYXL6ZWQcjs.canvasToImagePoint; exports.caretAt = _chunkBRKVNXDZcjs.caretAt; exports.changedTiles = _chunkHGTDMKNEcjs.changedTiles; exports.channelThumbnail = channelThumbnail; exports.checkEffectAnimation = checkEffectAnimation; exports.checkEffectTime = checkEffectTime; exports.checkImageEffectPlace = checkImageEffectPlace; exports.clampControlValue = clampControlValue; exports.clampCropToImage = _chunkUYXL6ZWQcjs.clampCropToImage; exports.cleanMixer = _chunkEBDCRTZIcjs.cleanMixer; exports.cloneSamplePoint = _chunk7NW46N7Icjs.cloneSamplePoint; exports.cloneSourceLabel = cloneSourceLabel; exports.cloneTransformView = cloneTransformView; exports.collectTiles = _chunkCWM3CUUXcjs.collectTiles; exports.colorBalanceChannel = _chunkUYXL6ZWQcjs.colorBalanceChannel; exports.colorModePlanes = colorModePlanes; exports.colorModePlanes16 = colorModePlanes16; exports.colorPanelView = colorPanelView; exports.colorRange = colorRange; exports.colorRangePreset = colorRangePreset; exports.combineSelections = _chunkUYXL6ZWQcjs.combineSelections; exports.compileAdjustmentLayer = _chunkUYXL6ZWQcjs.compileAdjustmentLayer; exports.componentPath = _chunkUYXL6ZWQcjs.componentPath; exports.componentsCoverage = _chunkUYXL6ZWQcjs.componentsCoverage; exports.compositeDeep = _chunkUYXL6ZWQcjs.compositeDeep; exports.compositeSurfaceOver = _chunkHGTDMKNEcjs.compositeSurfaceOver; exports.computeHistogram = computeHistogram; exports.computeSelectionBounds = _chunkUYXL6ZWQcjs.computeSelectionBounds; exports.contentAwareFill = _chunk7NW46N7Icjs.contentAwareFill; exports.contentBounds = _chunkCWM3CUUXcjs.contentBounds; exports.contentsBox = _chunkUYXL6ZWQcjs.contentsBox; exports.contentsSurface = _chunkUYXL6ZWQcjs.contentsSurface; exports.contractCoverage = _chunkUYXL6ZWQcjs.contractCoverage; exports.controlPosition = controlPosition; exports.controlTrackBackground = controlTrackBackground; exports.convertColorFields = convertColorFields; exports.convertHex = convertHex; exports.convertSurfaceColors = convertSurfaceColors; exports.convertSurfaceDepth = _chunkCWM3CUUXcjs.convertSurfaceDepth; exports.convertToSmartObject = _chunkUYXL6ZWQcjs.convertToSmartObject; exports.copySmartObject = _chunkUYXL6ZWQcjs.copySmartObject; exports.cornersFromMatrix = _chunkUYXL6ZWQcjs.cornersFromMatrix; exports.coverageTileCoord = _chunkEBDCRTZIcjs.coverageTileCoord; exports.coverageToByte = _chunkUYXL6ZWQcjs.coverageToByte; exports.coveringRect = coveringRect; exports.createAdjustmentLayer = _chunkUYXL6ZWQcjs.createAdjustmentLayer; exports.createBlenderScratch = _chunkEBDCRTZIcjs.createBlenderScratch; exports.createCanvasTextShaper = _chunkBRKVNXDZcjs.createCanvasTextShaper; exports.createImageCaptureSurface = createImageCaptureSurface; exports.createImageColorTools = createImageColorTools; exports.createImageEditTools = createImageEditTools; exports.createImageEditorDocument = createImageEditorDocument; exports.createImageEditorToolProvider = createImageEditorToolProvider; exports.createImageEffectTools = createImageEffectTools; exports.createImageEffectsToolProvider = createImageEffectsToolProvider; exports.createImageLayerTools = createImageLayerTools; exports.createImagePaintTools = createImagePaintTools; exports.createImagePlaybackLocator = createImagePlaybackLocator; exports.createImagePsdTools = createImagePsdTools; exports.createImageRetouchTools = createImageRetouchTools; exports.createImageSegmentationToolProvider = createImageSegmentationToolProvider; exports.createImageSelectionTools = createImageSelectionTools; exports.createImageShapeTools = createImageShapeTools; exports.createImageSmartObjectTools = createImageSmartObjectTools; exports.createImageSubjectSelectionTool = createImageSubjectSelectionTool; exports.createImageTransformTools = createImageTransformTools; exports.createImageTypeTools = createImageTypeTools; exports.createMetricTextShaper = _chunkBRKVNXDZcjs.createMetricTextShaper; exports.createOutlineTextShaper = _chunkBRKVNXDZcjs.createOutlineTextShaper; exports.createPigment = _chunkCWM3CUUXcjs.createPigment; exports.createPigmentTools = _chunkV7GWZIZKcjs.createPigmentTools; exports.createSelectionMask = _chunkUYXL6ZWQcjs.createSelectionMask; exports.createShapeLayer = _chunkUYXL6ZWQcjs.createShapeLayer; exports.createTypeLayer = _chunkUYXL6ZWQcjs.createTypeLayer; exports.createWetGpuEngine = _chunkV7GWZIZKcjs.createWetGpuEngine; exports.cssFont = _chunkBRKVNXDZcjs.cssFont; exports.cssFontFamily = _chunkBRKVNXDZcjs.cssFontFamily; exports.curveLut = _chunkHGTDMKNEcjs.curveLut; exports.curveLutFromLevels = _chunkUYXL6ZWQcjs.curveLutFromLevels; exports.curvePointToBox = curvePointToBox; exports.curveSvgPath = curveSvgPath; exports.dabCoverage = _chunkEBDCRTZIcjs.dabCoverage; exports.dabRect = _chunkEBDCRTZIcjs.dabRect; exports.decodeDeepSurface = _chunkUYXL6ZWQcjs.decodeDeepSurface; exports.decodeLayerChannel = _chunkUYXL6ZWQcjs.decodeLayerChannel; exports.decodeLayerMask = _chunkUYXL6ZWQcjs.decodeLayerMask; exports.decodeMergedImage = _chunkUYXL6ZWQcjs.decodeMergedImage; exports.decodePlanes = _chunkUYXL6ZWQcjs.decodePlanes; exports.decodePng = _chunkCWM3CUUXcjs.decodePng; exports.decodePngDataUrl = _chunkUYXL6ZWQcjs.decodePngDataUrl; exports.decodeSelectionRle = _chunkUYXL6ZWQcjs.decodeSelectionRle; exports.deepBytes = _chunkCWM3CUUXcjs.deepBytes; exports.deepTile = _chunkCWM3CUUXcjs.deepTile; exports.defaultActiveLayerId = _chunkUYXL6ZWQcjs.defaultActiveLayerId; exports.defaultAdjustmentParams = _chunkUYXL6ZWQcjs.defaultAdjustmentParams; exports.defaultEffectGradient = _chunkHGTDMKNEcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkHGTDMKNEcjs.defaultLayerEffect; exports.defaultShapeName = _chunkUYXL6ZWQcjs.defaultShapeName; exports.deflate = _chunkXFM3OCHUcjs.deflate; exports.deflateRaw = _chunkXFM3OCHUcjs.deflateRaw; exports.depthMaskAlpha = _chunkUYXL6ZWQcjs.depthMaskAlpha; exports.depthOf = _chunkCWM3CUUXcjs.depthOf; exports.depthRasterMask = _chunkUYXL6ZWQcjs.depthRasterMask; exports.describeChannel = describeChannel; exports.describeLayer = describeLayer; exports.describeLayerEffects = describeLayerEffects; exports.describeSelection = describeSelection; exports.describeTransform = _chunkUYXL6ZWQcjs.describeTransform; exports.deserializeChannels = deserializeChannels; exports.deserializeColorMode = deserializeColorMode; exports.deserializeColorProfile = deserializeColorProfile; exports.deserializeEffects = _chunkUYXL6ZWQcjs.deserializeEffects; exports.deserializeLayer = _chunkUYXL6ZWQcjs.deserializeLayer; exports.deserializeLayers = _chunkUYXL6ZWQcjs.deserializeLayers; exports.deserializePatterns = _chunkUYXL6ZWQcjs.deserializePatterns; exports.deserializeSelection = _chunkUYXL6ZWQcjs.deserializeSelection; exports.developFilter = _chunkUYXL6ZWQcjs.developFilter; exports.developFromAdjustments = _chunkUYXL6ZWQcjs.developFromAdjustments; exports.developTarget = _chunkUYXL6ZWQcjs.developTarget; exports.dexp = _chunkV7GWZIZKcjs.dexp; exports.dilateMask = _chunk7NW46N7Icjs.dilateMask; exports.displayTransform = displayTransform; exports.distanceTransform = _chunkUYXL6ZWQcjs.distanceTransform; exports.dlog = _chunkV7GWZIZKcjs.dlog; exports.documentContents = _chunkUYXL6ZWQcjs.documentContents; exports.documentProfile = documentProfile; exports.dodgeBurn = _chunk7NW46N7Icjs.dodgeBurn; exports.dodgeBurnCurve = _chunk7NW46N7Icjs.dodgeBurnCurve; exports.downloadMaskImage = downloadMaskImage; exports.downloadPsd = downloadPsd; exports.dpow = _chunkV7GWZIZKcjs.dpow; exports.dragWarpMeshPoint = _chunkBRKVNXDZcjs.dragWarpMeshPoint; exports.dropPlacement = dropPlacement; exports.dropZone = dropZone; exports.dsincos = _chunkV7GWZIZKcjs.dsincos; exports.duplicateLayer = _chunkUYXL6ZWQcjs.duplicateLayer; exports.edgeBits = _chunkV7GWZIZKcjs.edgeBits; exports.edgeWidth = edgeWidth; exports.effectColorHex = _chunkHGTDMKNEcjs.effectColorHex; exports.effectControlChange = effectControlChange; exports.effectLayerTiming = effectLayerTiming; exports.effectPixelsToSurface = effectPixelsToSurface; exports.effectReach = _chunkHGTDMKNEcjs.effectReach; exports.effectiveLayerMask = _chunkUYXL6ZWQcjs.effectiveLayerMask; exports.effectiveProof = effectiveProof; exports.effectsFingerprint = _chunkHGTDMKNEcjs.effectsFingerprint; exports.effectsMargin = _chunkHGTDMKNEcjs.effectsMargin; exports.effectsScale = _chunkHGTDMKNEcjs.effectsScale; exports.ellipsePoints = ellipsePoints; exports.ellipseSelection = ellipseSelection; exports.emptyHistogram = emptyHistogram; exports.emptySurface = _chunkCWM3CUUXcjs.emptySurface; exports.encodeDeepSurface = _chunkUYXL6ZWQcjs.encodeDeepSurface; exports.encodePng = _chunkCWM3CUUXcjs.encodePng; exports.encodeRle = _chunkUYXL6ZWQcjs.encodeRle; exports.encodeSelectionRle = _chunkUYXL6ZWQcjs.encodeSelectionRle; exports.encodeSurface = _chunkUYXL6ZWQcjs.encodeSurface; exports.evalWarpMesh = _chunkBRKVNXDZcjs.evalWarpMesh; exports.evaluateAdjustmentLayers = _chunkUYXL6ZWQcjs.evaluateAdjustmentLayers; exports.exchangeRates = _chunkEBDCRTZIcjs.exchangeRates; exports.expNeg = _chunkV7GWZIZKcjs.expNeg; exports.expandCoverage = _chunkUYXL6ZWQcjs.expandCoverage; exports.exportPsd = _chunkUYXL6ZWQcjs.exportPsd; exports.extractNormalizedLayerItems = extractNormalizedLayerItems; exports.featherCoverage = _chunkUYXL6ZWQcjs.featherCoverage; exports.fillRect = _chunkCWM3CUUXcjs.fillRect; exports.filmPixel = _chunkV7GWZIZKcjs.filmPixel; exports.filmReflectance = _chunkV7GWZIZKcjs.filmReflectance; exports.filterMaskCoverage = _chunkUYXL6ZWQcjs.filterMaskCoverage; exports.findAdjustmentControl = findAdjustmentControl; exports.findLayer = _chunkHGTDMKNEcjs.findLayer; exports.findLayerControl = findLayerControl; exports.findWebGpu = _chunkV7GWZIZKcjs.findWebGpu; exports.finishTile = _chunkCWM3CUUXcjs.finishTile; exports.fitParagraphRuns = _chunkBRKVNXDZcjs.fitParagraphRuns; exports.fitRuns = _chunkBRKVNXDZcjs.fitRuns; exports.flattenLayers = _chunkHGTDMKNEcjs.flattenLayers; exports.flattenPath = _chunkUYXL6ZWQcjs.flattenPath; exports.flipCorners = _chunkUYXL6ZWQcjs.flipCorners; exports.flowField = _chunkV7GWZIZKcjs.flowField; exports.followLayerMove = _chunkUYXL6ZWQcjs.followLayerMove; exports.fontOf = _chunkBRKVNXDZcjs.fontOf; exports.formatControlValue = formatControlValue; exports.fullSelection = _chunkUYXL6ZWQcjs.fullSelection; exports.gaussianBlur = _chunkHGTDMKNEcjs.gaussianBlur; exports.geometryHomography = _chunkUYXL6ZWQcjs.geometryHomography; exports.getAnnotationBounds = _chunkUYXL6ZWQcjs.getAnnotationBounds; exports.getControlPath = getControlPath; exports.getCropCursor = _chunkUYXL6ZWQcjs.getCropCursor; exports.getRotatedSize = _chunkUYXL6ZWQcjs.getRotatedSize; exports.getViewportMetrics = _chunkUYXL6ZWQcjs.getViewportMetrics; exports.getViewportProjection = _chunkUYXL6ZWQcjs.getViewportProjection; exports.globalImageCache = globalImageCache; exports.gradientDabColor = _chunkEBDCRTZIcjs.gradientDabColor; exports.grainCatch = _chunkEBDCRTZIcjs.grainCatch; exports.grainHeights = _chunkEBDCRTZIcjs.grainHeights; exports.greyMorphology = _chunkUYXL6ZWQcjs.greyMorphology; exports.groupLayers = _chunkUYXL6ZWQcjs.groupLayers; exports.growSelection = growSelection; exports.guidePlanes = guidePlanes; exports.guidedFilterColor = guidedFilterColor; exports.handleMaskViewKey = handleMaskViewKey; exports.handlePaintShortcut = handlePaintShortcut; exports.handleQuickMaskKey = handleQuickMaskKey; exports.handleSelectionShortcut = handleSelectionShortcut; exports.hasActiveEffects = _chunkHGTDMKNEcjs.hasActiveEffects; exports.hasLayersBelow = hasLayersBelow; exports.hasResampledLegacyMask = _chunkUYXL6ZWQcjs.hasResampledLegacyMask; exports.hasSurface = _chunkUYXL6ZWQcjs.hasSurface; exports.hasWarp = _chunkUYXL6ZWQcjs.hasWarp; exports.hash2 = _chunkEBDCRTZIcjs.hash2; exports.hashMaskContent = _chunkUYXL6ZWQcjs.hashMaskContent; exports.hashNoise = _chunkHGTDMKNEcjs.hashNoise; exports.healPixels = _chunk7NW46N7Icjs.healPixels; exports.hexToPaintRgb = _chunkEBDCRTZIcjs.hexToPaintRgb; exports.hexToRgb = _chunkUYXL6ZWQcjs.hexToRgb; exports.histogramPath = histogramPath; exports.hitTestAnnotation = _chunkUYXL6ZWQcjs.hitTestAnnotation; exports.hitTestCrop = _chunkUYXL6ZWQcjs.hitTestCrop; exports.hitTestCurvePoint = hitTestCurvePoint; exports.homographyFromAffine = _chunkQT26RHKKcjs.homographyFromAffine; exports.homographyFromPoints = _chunkQT26RHKKcjs.homographyFromPoints; exports.hslToRgb = _chunkUYXL6ZWQcjs.hslToRgb; exports.hueRange = hueRange; exports.hueRangeTables = _chunkUYXL6ZWQcjs.hueRangeTables; exports.hueRangeWeight = _chunkUYXL6ZWQcjs.hueRangeWeight; exports.hueSaturation = _chunkUYXL6ZWQcjs.hueSaturation; exports.identityCurve = _chunkUYXL6ZWQcjs.identityCurve; exports.identityLevels = _chunkUYXL6ZWQcjs.identityLevels; exports.identityTransform = _chunkUYXL6ZWQcjs.identityTransform; exports.identityWarpMesh = _chunkBRKVNXDZcjs.identityWarpMesh; exports.imageEditorStateMigrations = imageEditorStateMigrations; exports.imageLayerAppliedEffects = imageLayerAppliedEffects; exports.imagePanelTool = imagePanelTool; exports.imagePlaybackPanel = imagePlaybackPanel; exports.imageToCanvasPoint = _chunkUYXL6ZWQcjs.imageToCanvasPoint; exports.imageToolCanvasMode = imageToolCanvasMode; exports.imageToolForShortcut = imageToolForShortcut; exports.imageToolGroup = imageToolGroup; exports.imageToolLabel = imageToolLabel; exports.imageToolPanel = imageToolPanel; exports.importPsd = _chunkUYXL6ZWQcjs.importPsd; exports.inflate = _chunkXFM3OCHUcjs.inflate; exports.inflateRaw = _chunkXFM3OCHUcjs.inflateRaw; exports.insertCurvePoint = insertCurvePoint; exports.insertLayer = _chunkHGTDMKNEcjs.insertLayer; exports.instancesOf = _chunkUYXL6ZWQcjs.instancesOf; exports.invertHomography = _chunkQT26RHKKcjs.invertHomography; exports.invertMatrix3 = _chunkUYXL6ZWQcjs.invertMatrix3; exports.invertSelection = _chunkUYXL6ZWQcjs.invertSelection; exports.isActiveFilter = _chunkUYXL6ZWQcjs.isActiveFilter; exports.isActiveVectorMask = _chunkUYXL6ZWQcjs.isActiveVectorMask; exports.isAdjustmentKind = _chunkUYXL6ZWQcjs.isAdjustmentKind; exports.isBitDepth = _chunkCWM3CUUXcjs.isBitDepth; exports.isBlendMode = _chunkCWM3CUUXcjs.isBlendMode; exports.isBrushstrokeBrush = _chunkEBDCRTZIcjs.isBrushstrokeBrush; exports.isColorRangePreset = isColorRangePreset; exports.isContentsDecoded = _chunkUYXL6ZWQcjs.isContentsDecoded; exports.isDefaultDepthMask = _chunkUYXL6ZWQcjs.isDefaultDepthMask; exports.isGradientPaint = _chunkEBDCRTZIcjs.isGradientPaint; exports.isIdentityCloneTransform = _chunk7NW46N7Icjs.isIdentityCloneTransform; exports.isIdentityTransform = _chunkUYXL6ZWQcjs.isIdentityTransform; exports.isInterpolation = _chunkHGTDMKNEcjs.isInterpolation; exports.isLayerEffectKind = _chunkHGTDMKNEcjs.isLayerEffectKind; exports.isLayerLocked = _chunkHGTDMKNEcjs.isLayerLocked; exports.isLegacyShape = _chunkUYXL6ZWQcjs.isLegacyShape; exports.isPaintTool = isPaintTool; exports.isPaintableLayer = _chunkUYXL6ZWQcjs.isPaintableLayer; exports.isPainterlyBlendMode = _chunkCWM3CUUXcjs.isPainterlyBlendMode; exports.isPng = _chunkCWM3CUUXcjs.isPng; exports.isQuarterTurn = isQuarterTurn; exports.isQuarterTurnSwapped = _chunkUYXL6ZWQcjs.isQuarterTurnSwapped; exports.isRenderedLayer = _chunkUYXL6ZWQcjs.isRenderedLayer; exports.isRetouchPaintTool = isRetouchPaintTool; exports.isRetouchTool = isRetouchTool; exports.isSelectionEmpty = _chunkUYXL6ZWQcjs.isSelectionEmpty; exports.isSelectionMode = _chunkUYXL6ZWQcjs.isSelectionMode; exports.isSeparableBlendMode = _chunkCWM3CUUXcjs.isSeparableBlendMode; exports.isSmartSurfaceIncomplete = _chunkUYXL6ZWQcjs.isSmartSurfaceIncomplete; exports.isSpatialFilter = _chunkUYXL6ZWQcjs.isSpatialFilter; exports.isSrgb = isSrgb; exports.isTransformAnchor = _chunkUYXL6ZWQcjs.isTransformAnchor; exports.isValidWarp = _chunkUYXL6ZWQcjs.isValidWarp; exports.keepDeepSamples = _chunkCWM3CUUXcjs.keepDeepSamples; exports.kelvinToTemperature = _chunkUYXL6ZWQcjs.kelvinToTemperature; exports.keysWeight = _chunkHGTDMKNEcjs.keysWeight; exports.latticeViscosity = _chunkV7GWZIZKcjs.latticeViscosity; exports.layerBadge = layerBadge; exports.layerEffectControls = layerEffectControls; exports.layerEffectFields = _chunkHGTDMKNEcjs.layerEffectFields; exports.layerEffectLabel = _chunkHGTDMKNEcjs.layerEffectLabel; exports.layerEffectsBadge = layerEffectsBadge; exports.layerEffectsOf = _chunkUYXL6ZWQcjs.layerEffectsOf; exports.layerEffectsPanel = layerEffectsPanel; exports.layerHasThumbnail = layerHasThumbnail; exports.layerLabel = layerLabel; exports.layerMaskCoverage = _chunkUYXL6ZWQcjs.layerMaskCoverage; exports.layerMaskFromSelection = _chunkUYXL6ZWQcjs.layerMaskFromSelection; exports.layerMaskKey = _chunkUYXL6ZWQcjs.layerMaskKey; exports.layerMaskSelection = _chunkUYXL6ZWQcjs.layerMaskSelection; exports.layerMenu = layerMenu; exports.layerName = _chunkUYXL6ZWQcjs.layerName; exports.layerPanelRows = layerPanelRows; exports.layerPanels = layerPanels; exports.layerThumbnailClick = layerThumbnailClick; exports.layerTree = _chunkUYXL6ZWQcjs.layerTree; exports.layerTypeLabel = _chunkUYXL6ZWQcjs.layerTypeLabel; exports.layerWarning = layerWarning; exports.layersFromLegacy = _chunkUYXL6ZWQcjs.layersFromLegacy; exports.layoutText = _chunkBRKVNXDZcjs.layoutText; exports.legacyAdjustmentLayer = _chunkUYXL6ZWQcjs.legacyAdjustmentLayer; exports.legacyMaskOf = _chunkUYXL6ZWQcjs.legacyMaskOf; exports.legacyView = _chunkUYXL6ZWQcjs.legacyView; exports.lerpPigment = _chunkCWM3CUUXcjs.lerpPigment; exports.lerpPigmentInto = _chunkCWM3CUUXcjs.lerpPigmentInto; exports.levelsValue = _chunkUYXL6ZWQcjs.levelsValue; exports.linearSrgbToXy = _chunkUYXL6ZWQcjs.linearSrgbToXy; exports.linearToSrgb = _chunkUYXL6ZWQcjs.linearToSrgb; exports.linearToSrgb8 = _chunkV7GWZIZKcjs.linearToSrgb8; exports.liveComponent = _chunkUYXL6ZWQcjs.liveComponent; exports.liveShapeForDrag = liveShapeForDrag; exports.liveShapeSubpaths = _chunkUYXL6ZWQcjs.liveShapeSubpaths; exports.liveWire = liveWire; exports.loadImageEditorDocument = loadImageEditorDocument; exports.loadMixer = _chunkEBDCRTZIcjs.loadMixer; exports.loadOpenTypeFont = _chunk3T5VCDIVcjs.loadOpenTypeFont; exports.loadWetKernel = _chunkV7GWZIZKcjs.loadWetKernel; exports.luma = _chunk7NW46N7Icjs.luma; exports.magicWand = magicWand; exports.magneticAnchorSpacing = magneticAnchorSpacing; exports.mapCropHandle = _chunkUYXL6ZWQcjs.mapCropHandle; exports.mapLayer = _chunkHGTDMKNEcjs.mapLayer; exports.mapSubpaths = _chunkUYXL6ZWQcjs.mapSubpaths; exports.maskBounds = _chunk7NW46N7Icjs.maskBounds; exports.maskFileName = maskFileName; exports.maskNameFromFile = maskNameFromFile; exports.maskSummary = maskSummary; exports.maskThumbnailClick = maskThumbnailClick; exports.matrixFromCorners = _chunkUYXL6ZWQcjs.matrixFromCorners; exports.matrixFromParams = _chunkUYXL6ZWQcjs.matrixFromParams; exports.measureCanvasViewport = measureCanvasViewport; exports.membraneFill = _chunk7NW46N7Icjs.membraneFill; exports.mergeLayerEffect = _chunkHGTDMKNEcjs.mergeLayerEffect; exports.mergeShapeComponents = _chunkUYXL6ZWQcjs.mergeShapeComponents; exports.migrateSerializedImageEditorState = migrateSerializedImageEditorState; exports.migrateToLayeredState = migrateToLayeredState; exports.mix32 = _chunkEBDCRTZIcjs.mix32; exports.mixPigment8 = _chunkCWM3CUUXcjs.mixPigment8; exports.mixPigmentRgb = _chunkCWM3CUUXcjs.mixPigmentRgb; exports.mixPigments = _chunkCWM3CUUXcjs.mixPigments; exports.mixerLoadResult = mixerLoadResult; exports.mixerRates = _chunkEBDCRTZIcjs.mixerRates; exports.modifySelection = _chunkUYXL6ZWQcjs.modifySelection; exports.moveCurvePoint = moveCurvePoint; exports.moveLayer = _chunkUYXL6ZWQcjs.moveLayer; exports.moveSmartFilter = _chunkUYXL6ZWQcjs.moveSmartFilter; exports.mulMatrix3 = _chunkUYXL6ZWQcjs.mulMatrix3; exports.needsLegacyBase = needsLegacyBase; exports.neutralHueRange = _chunkUYXL6ZWQcjs.neutralHueRange; exports.newContentsId = _chunkUYXL6ZWQcjs.newContentsId; exports.newEffectId = _chunkHGTDMKNEcjs.newEffectId; exports.newLayerId = _chunkUYXL6ZWQcjs.newLayerId; exports.newLayerOptions = newLayerOptions; exports.normalizeAdjustmentLayer = _chunkUYXL6ZWQcjs.normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = _chunkUYXL6ZWQcjs.normalizeAdjustmentLayers; exports.normalizeAngle = _chunkUYXL6ZWQcjs.normalizeAngle; exports.normalizeBlendMode = _chunkCWM3CUUXcjs.normalizeBlendMode; exports.normalizeBlender = _chunkEBDCRTZIcjs.normalizeBlender; exports.normalizeBrush = _chunkEBDCRTZIcjs.normalizeBrush; exports.normalizeFilter = _chunkUYXL6ZWQcjs.normalizeFilter; exports.normalizeFlow = _chunkV7GWZIZKcjs.normalizeFlow; exports.normalizeHexColor = _chunkEBDCRTZIcjs.normalizeHexColor; exports.normalizeLayerEffects = _chunkHGTDMKNEcjs.normalizeLayerEffects; exports.normalizeLayerMask = _chunkUYXL6ZWQcjs.normalizeLayerMask; exports.normalizeLiveShape = _chunkUYXL6ZWQcjs.normalizeLiveShape; exports.normalizeMixer = _chunkEBDCRTZIcjs.normalizeMixer; exports.normalizePlacement = _chunkUYXL6ZWQcjs.normalizePlacement; exports.normalizeProcessVersion = _chunkUYXL6ZWQcjs.normalizeProcessVersion; exports.normalizeRect = normalizeRect; exports.normalizeRefineEdgeParams = normalizeRefineEdgeParams; exports.normalizeRetouch = _chunk7NW46N7Icjs.normalizeRetouch; exports.normalizeShapePaint = _chunkUYXL6ZWQcjs.normalizeShapePaint; exports.normalizeShapeStroke = _chunkUYXL6ZWQcjs.normalizeShapeStroke; exports.normalizeSmartFilter = _chunkUYXL6ZWQcjs.normalizeSmartFilter; exports.normalizeSmudge = _chunkEBDCRTZIcjs.normalizeSmudge; exports.normalizeStoredAdjustments = normalizeStoredAdjustments; exports.normalizeSubpaths = _chunkUYXL6ZWQcjs.normalizeSubpaths; exports.normalizeText = _chunkUYXL6ZWQcjs.normalizeText; exports.normalizeTilt = _chunkV7GWZIZKcjs.normalizeTilt; exports.normalizeWetParams = _chunkV7GWZIZKcjs.normalizeWetParams; exports.offsetLayer = _chunkUYXL6ZWQcjs.offsetLayer; exports.offsetShape = _chunkUYXL6ZWQcjs.offsetShape; exports.offsetSmartObject = _chunkUYXL6ZWQcjs.offsetSmartObject; exports.offsetVectorMask = _chunkUYXL6ZWQcjs.offsetVectorMask; exports.openMaskFile = openMaskFile; exports.openPsdFile = openPsdFile; exports.packRgba = _chunkCWM3CUUXcjs.packRgba; exports.packWetParams = _chunkV7GWZIZKcjs.packWetParams; exports.paintGradientMappingFor = _chunkEBDCRTZIcjs.paintGradientMappingFor; exports.paintPathStroke = _chunkEBDCRTZIcjs.paintPathStroke; exports.paintSourceColor = _chunkEBDCRTZIcjs.paintSourceColor; exports.paintSourceCss = _chunkEBDCRTZIcjs.paintSourceCss; exports.paragraphRanges = _chunkBRKVNXDZcjs.paragraphRanges; exports.parseAdjustmentBlock = _chunkUYXL6ZWQcjs.parseAdjustmentBlock; exports.parseBlend = _chunkUYXL6ZWQcjs.parseBlend; exports.parseColor = parseColor; exports.parseCssColor = _chunkA2IS7EHEcjs.parseCssColor; exports.parseDataUrl = _chunkCWM3CUUXcjs.parseDataUrl; exports.parseEffectColor = _chunkHGTDMKNEcjs.parseEffectColor; exports.parseLfx2 = _chunkUYXL6ZWQcjs.parseLfx2; exports.parseLrfx = _chunkUYXL6ZWQcjs.parseLrfx; exports.parseOpenTypeFont = _chunk3T5VCDIVcjs.parseOpenTypeFont; exports.parsePaintSource = _chunkEBDCRTZIcjs.parsePaintSource; exports.parsePatternBlock = _chunkUYXL6ZWQcjs.parsePatternBlock; exports.parseSelectionMode = _chunkUYXL6ZWQcjs.parseSelectionMode; exports.parseVersionedDescriptor = _chunkUYXL6ZWQcjs.parseVersionedDescriptor; exports.patchParagraphStyle = _chunkUYXL6ZWQcjs.patchParagraphStyle; exports.patchTextStyle = _chunkUYXL6ZWQcjs.patchTextStyle; exports.pathStrokeCoverage = _chunkEBDCRTZIcjs.pathStrokeCoverage; exports.pathStrokeDabs = _chunkEBDCRTZIcjs.pathStrokeDabs; exports.pathToSelection = pathToSelection; exports.perDabStrength = _chunk7NW46N7Icjs.perDabStrength; exports.photoFilterMatrix = _chunkUYXL6ZWQcjs.photoFilterMatrix; exports.pigment8 = _chunkCWM3CUUXcjs.pigment8; exports.pigmentColor = _chunkV7GWZIZKcjs.pigmentColor; exports.pigmentOf = _chunkV7GWZIZKcjs.pigmentOf; exports.pixelLayerBounds = _chunkUYXL6ZWQcjs.pixelLayerBounds; exports.pixelLayers = _chunkUYXL6ZWQcjs.pixelLayers; exports.pixelPigment = _chunkV7GWZIZKcjs.pixelPigment; exports.placeContents = _chunkUYXL6ZWQcjs.placeContents; exports.placeLayer = _chunkUYXL6ZWQcjs.placeLayer; exports.placementAt = _chunkUYXL6ZWQcjs.placementAt; exports.placementBounds = _chunkUYXL6ZWQcjs.placementBounds; exports.placementGeometry = _chunkUYXL6ZWQcjs.placementGeometry; exports.planImageToolPlayback = planImageToolPlayback; exports.planOutlineTrace = planOutlineTrace; exports.pngDataUrl = _chunkCWM3CUUXcjs.pngDataUrl; exports.pointerPressure = _chunkV7GWZIZKcjs.pointerPressure; exports.pointerStrokeSample = _chunkV7GWZIZKcjs.pointerStrokeSample; exports.pointerStrokeSamples = _chunkV7GWZIZKcjs.pointerStrokeSamples; exports.polygonCoverage = polygonCoverage; exports.polygonCoverageBox = polygonCoverageBox; exports.polygonSelection = polygonSelection; exports.posterizeValue = _chunkUYXL6ZWQcjs.posterizeValue; exports.presetWarp = _chunkUYXL6ZWQcjs.presetWarp; exports.previewStep = previewStep; exports.profileBytes = profileBytes; exports.projectImagePoint = _chunkUYXL6ZWQcjs.projectImagePoint; exports.projectImageRect = _chunkUYXL6ZWQcjs.projectImageRect; exports.projectMaskCoverage = _chunkUYXL6ZWQcjs.projectMaskCoverage; exports.projectQuarterTurn = projectQuarterTurn; exports.proxyOf = _chunkCWM3CUUXcjs.proxyOf; exports.psdBytesFromBase64 = psdBytesFromBase64; exports.psdFileName = psdFileName; exports.psdPatternToEffectPattern = _chunkUYXL6ZWQcjs.psdPatternToEffectPattern; exports.psdToLayers = _chunkUYXL6ZWQcjs.psdToLayers; exports.pullWarpMesh = _chunkBRKVNXDZcjs.pullWarpMesh; exports.put255 = _chunkEBDCRTZIcjs.put255; exports.quadFrameOverlay = quadFrameOverlay; exports.quickMaskPixels = quickMaskPixels; exports.quickSelectStroke = quickSelectStroke; exports.rand01 = _chunkEBDCRTZIcjs.rand01; exports.randSigned = _chunkEBDCRTZIcjs.randSigned; exports.rangeLightness = _chunkUYXL6ZWQcjs.rangeLightness; exports.rasterContents = _chunkUYXL6ZWQcjs.rasterContents; exports.rasterMaskFromLegacy = _chunkUYXL6ZWQcjs.rasterMaskFromLegacy; exports.rasterizeCoverage = _chunkUYXL6ZWQcjs.rasterizeCoverage; exports.rasterizeDab = _chunkEBDCRTZIcjs.rasterizeDab; exports.rasterizeSmartObject = _chunkUYXL6ZWQcjs.rasterizeSmartObject; exports.readAdjustmentControls = readAdjustmentControls; exports.readDeepRegion = _chunkCWM3CUUXcjs.readDeepRegion; exports.readPaintSource = _chunkEBDCRTZIcjs.readPaintSource; exports.readPixel = _chunkCWM3CUUXcjs.readPixel; exports.readPsd = _chunkUYXL6ZWQcjs.readPsd; exports.readRegion = _chunkCWM3CUUXcjs.readRegion; exports.readSourceRegion = _chunk7NW46N7Icjs.readSourceRegion; exports.rectSelection = rectSelection; exports.rectToQuad = _chunkQT26RHKKcjs.rectToQuad; exports.reduceSurface = _chunkHGTDMKNEcjs.reduceSurface; exports.referencePoint = _chunkUYXL6ZWQcjs.referencePoint; exports.refineCoverage = refineCoverage; exports.refineEdgeHalo = refineEdgeHalo; exports.refineSelection = refineSelection; exports.reflectanceToRgb = _chunkCWM3CUUXcjs.reflectanceToRgb; exports.removeAlpha = _chunkUYXL6ZWQcjs.removeAlpha; exports.removeCurvePoint = removeCurvePoint; exports.removeLayer = _chunkUYXL6ZWQcjs.removeLayer; exports.removeLayerEffect = _chunkUYXL6ZWQcjs.removeLayerEffect; exports.removeLayerFilter = _chunkUYXL6ZWQcjs.removeLayerFilter; exports.removePaintGradientStop = _chunkEBDCRTZIcjs.removePaintGradientStop; exports.removeSmartFilter = _chunkUYXL6ZWQcjs.removeSmartFilter; exports.renderBrushstroke = _chunkEBDCRTZIcjs.renderBrushstroke; exports.renderLayerEffects = _chunkHGTDMKNEcjs.renderLayerEffects; exports.renderLayeredBase = renderLayeredBase; exports.renderShape = _chunkUYXL6ZWQcjs.renderShape; exports.renderShapeRect = _chunkUYXL6ZWQcjs.renderShapeRect; exports.renderSmartObject = _chunkUYXL6ZWQcjs.renderSmartObject; exports.renderText = _chunkUYXL6ZWQcjs.renderText; exports.replaceContents = _chunkUYXL6ZWQcjs.replaceContents; exports.replaceTextRange = _chunkUYXL6ZWQcjs.replaceTextRange; exports.requireLayer = _chunkUYXL6ZWQcjs.requireLayer; exports.requireOperation = _chunkUYXL6ZWQcjs.requireOperation; exports.requireShapeLayer = _chunkUYXL6ZWQcjs.requireShapeLayer; exports.requireSmartObject = _chunkUYXL6ZWQcjs.requireSmartObject; exports.requireTypeLayer = _chunkUYXL6ZWQcjs.requireTypeLayer; exports.requireUnlocked = _chunkUYXL6ZWQcjs.requireUnlocked; exports.rerender = _chunkUYXL6ZWQcjs.rerender; exports.rerenderShape = _chunkUYXL6ZWQcjs.rerenderShape; exports.rerenderText = _chunkUYXL6ZWQcjs.rerenderText; exports.resizePixels = resizePixels; exports.resizeSelection = _chunkUYXL6ZWQcjs.resizeSelection; exports.resizeWarpMesh = _chunkBRKVNXDZcjs.resizeWarpMesh; exports.resolveExternalAssets = _chunkUYXL6ZWQcjs.resolveExternalAssets; exports.resolveMosaicRegionBounds = resolveMosaicRegionBounds; exports.resolvePaintGradient = _chunkEBDCRTZIcjs.resolvePaintGradient; exports.resolveProfile = resolveProfile; exports.resolveVectorMasks = _chunkUYXL6ZWQcjs.resolveVectorMasks; exports.restyleRange = _chunkBRKVNXDZcjs.restyleRange; exports.retouchFilter = _chunk7NW46N7Icjs.retouchFilter; exports.reversePaintGradient = _chunkEBDCRTZIcjs.reversePaintGradient; exports.rgbToGray = _chunkUYXL6ZWQcjs.rgbToGray; exports.rgbToHsl = _chunkUYXL6ZWQcjs.rgbToHsl; exports.rgbToReflectance = _chunkCWM3CUUXcjs.rgbToReflectance; exports.rgbUnitToHex = rgbUnitToHex; exports.rgbaViewOfGrey = _chunk7NW46N7Icjs.rgbaViewOfGrey; exports.runLayerFilters = _chunkUYXL6ZWQcjs.runLayerFilters; exports.runLayerFiltersFloat = _chunkUYXL6ZWQcjs.runLayerFiltersFloat; exports.runLayerMenuAction = runLayerMenuAction; exports.sameCanvasViewport = sameCanvasViewport; exports.sampleLut = _chunkUYXL6ZWQcjs.sampleLut; exports.sampleToneLut = _chunkUYXL6ZWQcjs.sampleToneLut; exports.saturationOf = _chunk7NW46N7Icjs.saturationOf; exports.scaleLayerEffect = _chunkHGTDMKNEcjs.scaleLayerEffect; exports.scalePaintGradient = _chunkEBDCRTZIcjs.scalePaintGradient; exports.seamlessClone = _chunk7NW46N7Icjs.seamlessClone; exports.seedFromString = _chunkEBDCRTZIcjs.seedFromString; exports.segmentToSelection = segmentToSelection; exports.segmentationOutlines = segmentationOutlines; exports.segmentsToSelection = segmentsToSelection; exports.selectObjectIn = selectObjectIn; exports.selectSimilar = selectSimilar; exports.selectionArea = _chunkUYXL6ZWQcjs.selectionArea; exports.selectionFromCoverage = _chunkUYXL6ZWQcjs.selectionFromCoverage; exports.selectionFromPixels = _chunkUYXL6ZWQcjs.selectionFromPixels; exports.selectionFromRegion = _chunkUYXL6ZWQcjs.selectionFromRegion; exports.selectionFromTiles = _chunkUYXL6ZWQcjs.selectionFromTiles; exports.selectionModeFromModifiers = selectionModeFromModifiers; exports.selectionOutline = selectionOutline; exports.selectionRing = selectionRing; exports.selectionToCoverage = _chunkUYXL6ZWQcjs.selectionToCoverage; exports.selectionToPixels = _chunkUYXL6ZWQcjs.selectionToPixels; exports.selectionToSubpaths = selectionToSubpaths; exports.selectionValueAt = _chunkUYXL6ZWQcjs.selectionValueAt; exports.serializeChannels = serializeChannels; exports.serializeColorMode = serializeColorMode; exports.serializeColorProfile = serializeColorProfile; exports.serializeContents = _chunkUYXL6ZWQcjs.serializeContents; exports.serializeEffects = _chunkUYXL6ZWQcjs.serializeEffects; exports.serializeLayer = _chunkUYXL6ZWQcjs.serializeLayer; exports.serializeLayers = _chunkUYXL6ZWQcjs.serializeLayers; exports.serializeLayersExternal = _chunkUYXL6ZWQcjs.serializeLayersExternal; exports.serializePatterns = _chunkUYXL6ZWQcjs.serializePatterns; exports.serializeSelection = _chunkUYXL6ZWQcjs.serializeSelection; exports.setCloneTransformValue = setCloneTransformValue; exports.setControlPath = setControlPath; exports.setLayerEffects = _chunkUYXL6ZWQcjs.setLayerEffects; exports.setLayerEffectsEnabled = _chunkUYXL6ZWQcjs.setLayerEffectsEnabled; exports.setLayerMask = _chunkUYXL6ZWQcjs.setLayerMask; exports.setLayerProperties = _chunkUYXL6ZWQcjs.setLayerProperties; exports.setLum = _chunkCWM3CUUXcjs.setLum; exports.setPigmentColor = _chunkCWM3CUUXcjs.setPigmentColor; exports.setRetouchChoice = setRetouchChoice; exports.setSmartFilterMask = _chunkUYXL6ZWQcjs.setSmartFilterMask; exports.setSmartFiltersEnabled = _chunkUYXL6ZWQcjs.setSmartFiltersEnabled; exports.setSmartPlacement = _chunkUYXL6ZWQcjs.setSmartPlacement; exports.shadeTile = _chunkV7GWZIZKcjs.shadeTile; exports.shapeAsPixelLayer = _chunkUYXL6ZWQcjs.shapeAsPixelLayer; exports.shapeFromAnnotation = _chunkUYXL6ZWQcjs.shapeFromAnnotation; exports.shapeGeometryBounds = _chunkUYXL6ZWQcjs.shapeGeometryBounds; exports.shapeLayers = _chunkUYXL6ZWQcjs.shapeLayers; exports.shapeOutline = _chunkUYXL6ZWQcjs.shapeOutline; exports.shapeRenderClip = _chunkUYXL6ZWQcjs.shapeRenderClip; exports.shiftCoverage = _chunkUYXL6ZWQcjs.shiftCoverage; exports.simplifyPixelPath = simplifyPixelPath; exports.skinToneRange = skinToneRange; exports.smartFilterRows = smartFilterRows; exports.smartObjectLayers = _chunkUYXL6ZWQcjs.smartObjectLayers; exports.smoothCoverage = _chunkUYXL6ZWQcjs.smoothCoverage; exports.smoothPoints = _chunkEBDCRTZIcjs.smoothPoints; exports.smoothnessWeights = smoothnessWeights; exports.smudgeEffect = _chunk7NW46N7Icjs.smudgeEffect; exports.snapPolygonToEdges = snapPolygonToEdges; exports.snapTo45 = snapTo45; exports.snapToEdge = snapToEdge; exports.solidPaint = _chunkEBDCRTZIcjs.solidPaint; exports.solidSurface = _chunkCWM3CUUXcjs.solidSurface; exports.solveMembrane = _chunk7NW46N7Icjs.solveMembrane; exports.spliceRuns = _chunkBRKVNXDZcjs.spliceRuns; exports.splitOverlayAnnotations = splitOverlayAnnotations; exports.sponge = _chunk7NW46N7Icjs.sponge; exports.spongeEffect = _chunk7NW46N7Icjs.spongeEffect; exports.spotHealPixels = _chunk7NW46N7Icjs.spotHealPixels; exports.spotHealWindow = _chunk7NW46N7Icjs.spotHealWindow; exports.srgb8ToLab = srgb8ToLab; exports.srgbByteToLinear = _chunkV7GWZIZKcjs.srgbByteToLinear; exports.srgbDecode = _chunkCWM3CUUXcjs.srgbDecode; exports.srgbEncode = _chunkCWM3CUUXcjs.srgbEncode; exports.srgbToLinear = _chunkUYXL6ZWQcjs.srgbToLinear; exports.standardBlendMode = _chunkCWM3CUUXcjs.standardBlendMode; exports.startMarchingAnts = startMarchingAnts; exports.stepSlotTs = _chunkV7GWZIZKcjs.stepSlotTs; exports.strokeGrainCatch = _chunkEBDCRTZIcjs.strokeGrainCatch; exports.styleAt = _chunkBRKVNXDZcjs.styleAt; exports.subpathsToSvgPath = subpathsToSvgPath; exports.sumHistograms = sumHistograms; exports.surfaceBytes = _chunkCWM3CUUXcjs.surfaceBytes; exports.surfaceDepth = _chunkCWM3CUUXcjs.surfaceDepth; exports.surfaceFromDeepPixels = _chunkCWM3CUUXcjs.surfaceFromDeepPixels; exports.surfaceFromPixels = _chunkCWM3CUUXcjs.surfaceFromPixels; exports.surfacesEqual = _chunkCWM3CUUXcjs.surfacesEqual; exports.tempTintToXy = _chunkUYXL6ZWQcjs.tempTintToXy; exports.temperatureToKelvin = _chunkUYXL6ZWQcjs.temperatureToKelvin; exports.textIndexAt = _chunkBRKVNXDZcjs.textIndexAt; exports.textMatrix = _chunkUYXL6ZWQcjs.textMatrix; exports.textOrientation = _chunkUYXL6ZWQcjs.textOrientation; exports.textOutlines = _chunkUYXL6ZWQcjs.textOutlines; exports.textRange = _chunkUYXL6ZWQcjs.textRange; exports.tileCoord = _chunkCWM3CUUXcjs.tileCoord; exports.tileKey = _chunkCWM3CUUXcjs.tileKey; exports.tileRect = _chunkCWM3CUUXcjs.tileRect; exports.tileSamples = _chunkCWM3CUUXcjs.tileSamples; exports.tileSamples16 = _chunkCWM3CUUXcjs.tileSamples16; exports.tileSamples32 = _chunkCWM3CUUXcjs.tileSamples32; exports.tilesInRect = _chunkCWM3CUUXcjs.tilesInRect; exports.tipFalloff = _chunkEBDCRTZIcjs.tipFalloff; exports.tipReach = _chunkEBDCRTZIcjs.tipReach; exports.tipShape = _chunkEBDCRTZIcjs.tipShape; exports.to16From32 = _chunkCWM3CUUXcjs.to16From32; exports.to16From8 = _chunkCWM3CUUXcjs.to16From8; exports.to32From16 = _chunkCWM3CUUXcjs.to32From16; exports.to32From8 = _chunkCWM3CUUXcjs.to32From8; exports.to8From16 = _chunkCWM3CUUXcjs.to8From16; exports.to8From32 = _chunkCWM3CUUXcjs.to8From32; exports.toHex = toHex; exports.toTextSpace = _chunkUYXL6ZWQcjs.toTextSpace; exports.toneCurve = _chunkUYXL6ZWQcjs.toneCurve; exports.toneLuts = _chunkUYXL6ZWQcjs.toneLuts; exports.toneOf = _chunk7NW46N7Icjs.toneOf; exports.toneRange = toneRange; exports.transformHomography = _chunkUYXL6ZWQcjs.transformHomography; exports.transformMap = _chunkUYXL6ZWQcjs.transformMap; exports.transformShapeComponents = _chunkUYXL6ZWQcjs.transformShapeComponents; exports.transformSurface = _chunkHGTDMKNEcjs.transformSurface; exports.transformTypeLayer = _chunkUYXL6ZWQcjs.transformTypeLayer; exports.transformVectorMask = _chunkUYXL6ZWQcjs.transformVectorMask; exports.transformedBounds = _chunkHGTDMKNEcjs.transformedBounds; exports.transformedBox = _chunkUYXL6ZWQcjs.transformedBox; exports.transformedPoint = _chunkUYXL6ZWQcjs.transformedPoint; exports.translateLayer = _chunkUYXL6ZWQcjs.translateLayer; exports.translateSurface = _chunkCWM3CUUXcjs.translateSurface; exports.typeAsPixelLayer = _chunkUYXL6ZWQcjs.typeAsPixelLayer; exports.typeFrame = _chunkUYXL6ZWQcjs.typeFrame; exports.typeFromAnnotation = _chunkUYXL6ZWQcjs.typeFromAnnotation; exports.typeLayerAt = typeLayerAt; exports.typeLayerName = _chunkUYXL6ZWQcjs.typeLayerName; exports.ungroupLayer = _chunkUYXL6ZWQcjs.ungroupLayer; exports.uniformTile = _chunkCWM3CUUXcjs.uniformTile; exports.unionRect = _chunkUYXL6ZWQcjs.unionRect; exports.unprojectCanvasPoint = _chunkUYXL6ZWQcjs.unprojectCanvasPoint; exports.updateLayerEffect = _chunkUYXL6ZWQcjs.updateLayerEffect; exports.updateLayerFilter = _chunkUYXL6ZWQcjs.updateLayerFilter; exports.updateLayerMaskProps = _chunkUYXL6ZWQcjs.updateLayerMaskProps; exports.updatePaintGradientStop = _chunkEBDCRTZIcjs.updatePaintGradientStop; exports.updateShapeLayer = _chunkUYXL6ZWQcjs.updateShapeLayer; exports.updateSmartFilter = _chunkUYXL6ZWQcjs.updateSmartFilter; exports.updateTypeLayer = _chunkUYXL6ZWQcjs.updateTypeLayer; exports.upscaleRegion = upscaleRegion; exports.userErrorMessage = _chunkUYXL6ZWQcjs.userErrorMessage; exports.uvToXy = _chunkUYXL6ZWQcjs.uvToXy; exports.validateEffectGradient = _chunkHGTDMKNEcjs.validateEffectGradient; exports.validateLayerEffect = _chunkHGTDMKNEcjs.validateLayerEffect; exports.validateLayerEffects = _chunkHGTDMKNEcjs.validateLayerEffects; exports.vectorMaskBounds = _chunkUYXL6ZWQcjs.vectorMaskBounds; exports.vectorMaskCoverage = _chunkUYXL6ZWQcjs.vectorMaskCoverage; exports.vectorMaskThumbnail = _chunkUYXL6ZWQcjs.vectorMaskThumbnail; exports.vectorMaskThumbnailClick = vectorMaskThumbnailClick; exports.versionedDescriptorBytes = _chunkUYXL6ZWQcjs.versionedDescriptorBytes; exports.vibranceLinear = _chunkUYXL6ZWQcjs.vibranceLinear; exports.vibrancePixel = _chunkUYXL6ZWQcjs.vibrancePixel; exports.walkDabs = _chunkEBDCRTZIcjs.walkDabs; exports.warpMeshEditPoints = _chunkBRKVNXDZcjs.warpMeshEditPoints; exports.warpMeshGridCurves = _chunkBRKVNXDZcjs.warpMeshGridCurves; exports.warpMeshParamAt = _chunkBRKVNXDZcjs.warpMeshParamAt; exports.warpPresetMesh = _chunkBRKVNXDZcjs.warpPresetMesh; exports.warpSurface = _chunkHGTDMKNEcjs.warpSurface; exports.watchCanvasViewport = watchCanvasViewport; exports.wbMatrix = _chunkUYXL6ZWQcjs.wbMatrix; exports.wetGpuSupport = _chunkV7GWZIZKcjs.wetGpuSupport; exports.wetSimdSupported = _chunkV7GWZIZKcjs.wetSimdSupported; exports.wetSupport = _chunkV7GWZIZKcjs.wetSupport; exports.whiteBalanceFromSample = _chunkUYXL6ZWQcjs.whiteBalanceFromSample; exports.whiteBalanceMatrix = _chunkUYXL6ZWQcjs.whiteBalanceMatrix; exports.withBackgroundOpacity = withBackgroundOpacity; exports.withFilterMaskSurface = _chunkUYXL6ZWQcjs.withFilterMaskSurface; exports.withImagePlayback = withImagePlayback; exports.withNewIds = _chunkUYXL6ZWQcjs.withNewIds; exports.workImage = workImage; exports.writeAdjustmentBlock = _chunkUYXL6ZWQcjs.writeAdjustmentBlock; exports.writeDeepRegion = _chunkCWM3CUUXcjs.writeDeepRegion; exports.writeLfx2 = _chunkUYXL6ZWQcjs.writeLfx2; exports.writePatternBlock = _chunkUYXL6ZWQcjs.writePatternBlock; exports.writePsd = _chunkUYXL6ZWQcjs.writePsd; exports.writeRegion = _chunkCWM3CUUXcjs.writeRegion; exports.xyToTempTint = _chunkUYXL6ZWQcjs.xyToTempTint; exports.xyToUv = _chunkUYXL6ZWQcjs.xyToUv;
21362
+
21363
+
21364
+
21365
+
21366
+
21367
+
21368
+
21369
+
21370
+
21371
+
21372
+ exports.ADJUSTMENT_KEYS = _chunkUYXL6ZWQcjs.ADJUSTMENT_KEYS; exports.ADJUSTMENT_KINDS = _chunkUYXL6ZWQcjs.ADJUSTMENT_KINDS; exports.ADJUSTMENT_LAYER_CONTROLS = ADJUSTMENT_LAYER_CONTROLS; exports.ADJUSTMENT_LAYER_OPACITY_CONTROL = ADJUSTMENT_LAYER_OPACITY_CONTROL; exports.ADJUSTMENT_LUT_SIZE = _chunkUYXL6ZWQcjs.ADJUSTMENT_LUT_SIZE; exports.ANCHOR_FRACTION = _chunkUYXL6ZWQcjs.ANCHOR_FRACTION; exports.AS_SHOT_KELVIN = _chunkUYXL6ZWQcjs.AS_SHOT_KELVIN; exports.BACKGROUND_LAYER_ID = _chunkUYXL6ZWQcjs.BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = _chunkUYXL6ZWQcjs.BACKGROUND_LAYER_NAME; exports.BIT_DEPTHS = _chunkCWM3CUUXcjs.BIT_DEPTHS; exports.BIT_DEPTH_OPTIONS = BIT_DEPTH_OPTIONS; exports.BLEND_MODES = _chunkCWM3CUUXcjs.BLEND_MODES; exports.BLUR_FILTER_ID = _chunkUYXL6ZWQcjs.BLUR_FILTER_ID; exports.BODY_SCATTER = _chunkV7GWZIZKcjs.BODY_SCATTER; exports.BRUSHSTROKE_MAX_SCALE = _chunkYQGCPL5Xcjs.BRUSHSTROKE_MAX_SCALE; exports.BRUSHSTROKE_MIN_SCALE = _chunkYQGCPL5Xcjs.BRUSHSTROKE_MIN_SCALE; exports.BRUSH_OPTION_CONTROLS = BRUSH_OPTION_CONTROLS; exports.BUILTIN_PROFILES = _chunkBROJYMWUcjs.BUILTIN_PROFILES; exports.BrushstrokeCache = _chunkEBDCRTZIcjs.BrushstrokeCache; exports.CANVAS_SIZE_PRESETS = CANVAS_SIZE_PRESETS; exports.CLONE_TRANSFORM_CONTROLS = CLONE_TRANSFORM_CONTROLS; exports.COLOR_MODE_OPTIONS = COLOR_MODE_OPTIONS; exports.COLOR_RANGE_PRESETS = COLOR_RANGE_PRESETS; exports.COLOR_RANGE_PRESET_LABELS = COLOR_RANGE_PRESET_LABELS; exports.ColorGmm = ColorGmm; exports.CoverageMap = _chunkEBDCRTZIcjs.CoverageMap; exports.D50 = _chunkUYXL6ZWQcjs.D50; exports.D65 = _chunkUYXL6ZWQcjs.D65; exports.DEFAULT_ADJUSTMENTS = DEFAULT_ADJUSTMENTS; exports.DEFAULT_AUTO_LEADING = _chunkBRKVNXDZcjs.DEFAULT_AUTO_LEADING; exports.DEFAULT_BLENDER = _chunkEBDCRTZIcjs.DEFAULT_BLENDER; exports.DEFAULT_BRUSH = _chunkEBDCRTZIcjs.DEFAULT_BRUSH; exports.DEFAULT_CANVAS_VIEWPORT = DEFAULT_CANVAS_VIEWPORT; exports.DEFAULT_CHANNEL_COLOR = DEFAULT_CHANNEL_COLOR; exports.DEFAULT_DEPTH_MASK = DEFAULT_DEPTH_MASK; exports.DEFAULT_FLOW = _chunkV7GWZIZKcjs.DEFAULT_FLOW; exports.DEFAULT_GLOBAL_LIGHT = _chunkHGTDMKNEcjs.DEFAULT_GLOBAL_LIGHT; exports.DEFAULT_MITER_LIMIT = _chunkUYXL6ZWQcjs.DEFAULT_MITER_LIMIT; exports.DEFAULT_MIXER = _chunkEBDCRTZIcjs.DEFAULT_MIXER; exports.DEFAULT_PAINT_GRADIENT = _chunkEBDCRTZIcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkEBDCRTZIcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PROOF = DEFAULT_PROOF; exports.DEFAULT_REFINE_EDGE_PARAMS = DEFAULT_REFINE_EDGE_PARAMS; exports.DEFAULT_RETOUCH = _chunk7NW46N7Icjs.DEFAULT_RETOUCH; exports.DEFAULT_SELECTION_TOOL_OPTIONS = DEFAULT_SELECTION_TOOL_OPTIONS; exports.DEFAULT_SHAPE_TOOL_OPTIONS = DEFAULT_SHAPE_TOOL_OPTIONS; exports.DEFAULT_SMUDGE = _chunkEBDCRTZIcjs.DEFAULT_SMUDGE; exports.DEFAULT_TEXT_STYLE = _chunkBRKVNXDZcjs.DEFAULT_TEXT_STYLE; exports.DEFAULT_TRANSFORM = DEFAULT_TRANSFORM; exports.DEFAULT_TYPE_TOOL_OPTIONS = DEFAULT_TYPE_TOOL_OPTIONS; exports.DEFAULT_WET_PAPER = _chunkV7GWZIZKcjs.DEFAULT_WET_PAPER; exports.DEFAULT_WET_PARAMS = _chunkV7GWZIZKcjs.DEFAULT_WET_PARAMS; exports.DEPTH_MASK_CONTROLS = DEPTH_MASK_CONTROLS; exports.DEVELOP_FILTER_ID = _chunkUYXL6ZWQcjs.DEVELOP_FILTER_ID; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkHGTDMKNEcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DRY_EPS = _chunkV7GWZIZKcjs.DRY_EPS; exports.DabWalker = _chunkEBDCRTZIcjs.DabWalker; exports.EFFECT_LAYER_USES = EFFECT_LAYER_USES; exports.EMPTY_DISTANCE = _chunkUYXL6ZWQcjs.EMPTY_DISTANCE; exports.EMPTY_MIXER_LOAD = _chunkEBDCRTZIcjs.EMPTY_MIXER_LOAD; exports.EX = _chunkV7GWZIZKcjs.EX; exports.EY = _chunkV7GWZIZKcjs.EY; exports.EdgeMap = EdgeMap; exports.FLAG_ALIVE = _chunkV7GWZIZKcjs.FLAG_ALIVE; exports.FLAG_BOTTOM = _chunkV7GWZIZKcjs.FLAG_BOTTOM; exports.FLAG_LEFT = _chunkV7GWZIZKcjs.FLAG_LEFT; exports.FLAG_RIGHT = _chunkV7GWZIZKcjs.FLAG_RIGHT; exports.FLAG_TOP = _chunkV7GWZIZKcjs.FLAG_TOP; exports.FLAG_WET = _chunkV7GWZIZKcjs.FLAG_WET; exports.FLAT = _chunkV7GWZIZKcjs.FLAT; exports.FREE_INTERVAL = _chunkV7GWZIZKcjs.FREE_INTERVAL; exports.FREE_TRANSFORM_CONTENTS = FREE_TRANSFORM_CONTENTS; exports.FREE_TRANSFORM_FIELDS = FREE_TRANSFORM_FIELDS; exports.FREE_TRANSFORM_MODES = _chunkUYXL6ZWQcjs.FREE_TRANSFORM_MODES; exports.FREE_TRANSFORM_MODE_OPTIONS = FREE_TRANSFORM_MODE_OPTIONS; exports.FreeTransformSession = FreeTransformSession; exports.FreeTransformTool = FreeTransformTool; exports.GAMMA = GAMMA; exports.GRAIN_PATTERNS = _chunkEBDCRTZIcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkEBDCRTZIcjs.GRAIN_TILE; exports.GUIDED_FILTER_EPS = GUIDED_FILTER_EPS; exports.GridGraph = GridGraph; exports.HIDE = _chunkV7GWZIZKcjs.HIDE; exports.HISTOGRAM_BINS = HISTOGRAM_BINS; exports.HUE_RANGE_LABELS = _chunkUYXL6ZWQcjs.HUE_RANGE_LABELS; exports.HUE_RANGE_PRESETS = HUE_RANGE_PRESETS; exports.IDENTITY_CLONE_TRANSFORM = _chunk7NW46N7Icjs.IDENTITY_CLONE_TRANSFORM; exports.IDENTITY_MATRIX3 = _chunkUYXL6ZWQcjs.IDENTITY_MATRIX3; exports.IMAGE_ADJUSTMENT_CONTROLS = IMAGE_ADJUSTMENT_CONTROLS; exports.IMAGE_CROP_PRESETS = IMAGE_CROP_PRESETS; exports.IMAGE_EDITOR_SCHEMA_VERSION = IMAGE_EDITOR_SCHEMA_VERSION; exports.IMAGE_EDITOR_STATE_VERSION = IMAGE_EDITOR_STATE_VERSION; exports.IMAGE_EFFECT_PLACES = IMAGE_EFFECT_PLACES; exports.IMAGE_FILTER_PRESETS = IMAGE_FILTER_PRESETS; exports.IMAGE_PLAYBACK_KIND = IMAGE_PLAYBACK_KIND; exports.IMAGE_TOOL_GROUPS = IMAGE_TOOL_GROUPS; exports.IMAGE_TOOL_SHORTCUTS = IMAGE_TOOL_SHORTCUTS; exports.INTENTS = _chunkBROJYMWUcjs.INTENTS; exports.INTENT_OPTIONS = INTENT_OPTIONS; exports.INTERPOLATIONS = _chunkHGTDMKNEcjs.INTERPOLATIONS; exports.ImageEditorController = ImageEditorController; exports.ImageEditorRenderer = ImageEditorRenderer; exports.ImageEffectsEngine = ImageEffectsEngine; exports.LATEST_PROCESS_VERSION = _chunkUYXL6ZWQcjs.LATEST_PROCESS_VERSION; exports.LAYERED_SCHEMA_VERSION = _chunkUYXL6ZWQcjs.LAYERED_SCHEMA_VERSION; exports.LAYER_EFFECT_KINDS = _chunkHGTDMKNEcjs.LAYER_EFFECT_KINDS; exports.LAYER_EFFECT_MENU = LAYER_EFFECT_MENU; exports.LEGACY_PROCESS_VERSION = _chunkUYXL6ZWQcjs.LEGACY_PROCESS_VERSION; exports.LIVE_SHAPE_KINDS = _chunkUYXL6ZWQcjs.LIVE_SHAPE_KINDS; exports.LUMA_709 = _chunkUYXL6ZWQcjs.LUMA_709; exports.LayerCompositor = _chunkUYXL6ZWQcjs.LayerCompositor; exports.LayerEffectError = _chunkHGTDMKNEcjs.LayerEffectError; exports.LayerOperationError = _chunkUYXL6ZWQcjs.LayerOperationError; exports.MARCHING_ANTS_STEP_MS = MARCHING_ANTS_STEP_MS; exports.MASK_FILE_ACCEPT = MASK_FILE_ACCEPT; exports.MAX_BATCH = _chunkV7GWZIZKcjs.MAX_BATCH; exports.MAX_BRUSH_SIZE = _chunkEBDCRTZIcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_BACKING_SIDE = MAX_CANVAS_BACKING_SIDE; exports.MAX_EFFECT_ANIMATION_MS = _chunkUYXL6ZWQcjs.MAX_EFFECT_ANIMATION_MS; exports.MAX_EFFECT_REACH = _chunkHGTDMKNEcjs.MAX_EFFECT_REACH; exports.MAX_KELVIN = _chunkUYXL6ZWQcjs.MAX_KELVIN; exports.MAX_TILT_ACCEL = _chunkV7GWZIZKcjs.MAX_TILT_ACCEL; exports.MAX_TRANSFORM_PIXELS = _chunkHGTDMKNEcjs.MAX_TRANSFORM_PIXELS; exports.MAX_WET_LANES = _chunkV7GWZIZKcjs.MAX_WET_LANES; exports.MAX_WET_SLOTS = _chunkV7GWZIZKcjs.MAX_WET_SLOTS; exports.MIN_KELVIN = _chunkUYXL6ZWQcjs.MIN_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = _chunkUYXL6ZWQcjs.MIRED_PER_TEMPERATURE_UNIT; exports.MIXER_DRAIN = _chunkEBDCRTZIcjs.MIXER_DRAIN; exports.MIXER_MIXING_OPTIONS = MIXER_MIXING_OPTIONS; exports.MIXER_OPTION_CONTROLS = MIXER_OPTION_CONTROLS; exports.MIXER_PICKUP_RATE = _chunkEBDCRTZIcjs.MIXER_PICKUP_RATE; exports.MIXING_MODELS = _chunkEBDCRTZIcjs.MIXING_MODELS; exports.MixerStroke = _chunkEBDCRTZIcjs.MixerStroke; exports.OPP = _chunkV7GWZIZKcjs.OPP; exports.PAINTERLY_BLEND_MODES = _chunkCWM3CUUXcjs.PAINTERLY_BLEND_MODES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkEBDCRTZIcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_GRADIENT_FULL_SPEED = _chunkEBDCRTZIcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkEBDCRTZIcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkEBDCRTZIcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkEBDCRTZIcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkEBDCRTZIcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkEBDCRTZIcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_CAPACITY = _chunkV7GWZIZKcjs.PAPER_CAPACITY; exports.PARAGRAPH_STYLE_FIELDS = _chunkUYXL6ZWQcjs.PARAGRAPH_STYLE_FIELDS; exports.PARAM = _chunkV7GWZIZKcjs.PARAM; exports.PARAM_FLOATS = _chunkV7GWZIZKcjs.PARAM_FLOATS; exports.PASTE_MODES = PASTE_MODES; exports.PATTERN_BLOCK_KEYS = _chunkUYXL6ZWQcjs.PATTERN_BLOCK_KEYS; exports.PIGMENT_BANDS = _chunkCWM3CUUXcjs.PIGMENT_BANDS; exports.PIGMENT_CHANNELS = _chunkV7GWZIZKcjs.PIGMENT_CHANNELS; exports.PIGMENT_LAMBDA_MIN = _chunkCWM3CUUXcjs.PIGMENT_LAMBDA_MIN; exports.PIGMENT_LAMBDA_STEP = _chunkCWM3CUUXcjs.PIGMENT_LAMBDA_STEP; exports.PIGMENT_UNIT = _chunkV7GWZIZKcjs.PIGMENT_UNIT; exports.PIGMENT_WAVELENGTHS = _chunkCWM3CUUXcjs.PIGMENT_WAVELENGTHS; exports.PLANE = _chunkV7GWZIZKcjs.PLANE; exports.PLANE_BYTES = _chunkV7GWZIZKcjs.PLANE_BYTES; exports.PROOF_PROFILE_OPTIONS = PROOF_PROFILE_OPTIONS; exports.PSD_BLEND_KEYS = _chunkUYXL6ZWQcjs.PSD_BLEND_KEYS; exports.PSD_FILE_ACCEPT = PSD_FILE_ACCEPT; exports.P_D0 = _chunkV7GWZIZKcjs.P_D0; exports.P_EDGE = _chunkV7GWZIZKcjs.P_EDGE; exports.P_FX = _chunkV7GWZIZKcjs.P_FX; exports.P_FY = _chunkV7GWZIZKcjs.P_FY; exports.P_H = _chunkV7GWZIZKcjs.P_H; exports.P_P0 = _chunkV7GWZIZKcjs.P_P0; exports.P_RHO = _chunkV7GWZIZKcjs.P_RHO; exports.P_SW = _chunkV7GWZIZKcjs.P_SW; exports.P_UX = _chunkV7GWZIZKcjs.P_UX; exports.P_UY = _chunkV7GWZIZKcjs.P_UY; exports.PaintExchange = _chunkEBDCRTZIcjs.PaintExchange; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkEBDCRTZIcjs.PaintGradientSampler; exports.PaintSourceError = _chunkEBDCRTZIcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaperGrain = _chunkEBDCRTZIcjs.PaperGrain; exports.PatternPlacement = _chunkHGTDMKNEcjs.PatternPlacement; exports.PatternTile = _chunkHGTDMKNEcjs.PatternTile; exports.PsdError = _chunkUYXL6ZWQcjs.PsdError; exports.QUICK_MASK_TARGET = QUICK_MASK_TARGET; exports.REFINE_EDGE_CONTROLS = REFINE_EDGE_CONTROLS; exports.RETOUCH_CHOICES = RETOUCH_CHOICES; exports.RETOUCH_OPTION_CONTROLS = RETOUCH_OPTION_CONTROLS; exports.RETOUCH_SAMPLES = _chunk7NW46N7Icjs.RETOUCH_SAMPLES; exports.RETOUCH_TOGGLES = RETOUCH_TOGGLES; exports.RETOUCH_TOOLS = RETOUCH_TOOLS; exports.RegionPixelSource = _chunk7NW46N7Icjs.RegionPixelSource; exports.RetouchDabStroke = _chunk7NW46N7Icjs.RetouchDabStroke; exports.SELECTION_MODES = _chunkUYXL6ZWQcjs.SELECTION_MODES; exports.SELECTION_MODE_LABELS = SELECTION_MODE_LABELS; exports.SELECTION_MODIFY_OPS = _chunkUYXL6ZWQcjs.SELECTION_MODIFY_OPS; exports.SELECTION_TOOLS = SELECTION_TOOLS; exports.SET_PLANES = _chunkV7GWZIZKcjs.SET_PLANES; exports.SHADOW_AMBIENT = _chunkCWM3CUUXcjs.SHADOW_AMBIENT; exports.SHAPE_KIND_LABELS = SHAPE_KIND_LABELS; exports.SHAPE_OPERATIONS = _chunkUYXL6ZWQcjs.SHAPE_OPERATIONS; exports.SHAPE_RENDER_MARGIN = _chunkUYXL6ZWQcjs.SHAPE_RENDER_MARGIN; exports.SLOT_BYTES = _chunkV7GWZIZKcjs.SLOT_BYTES; exports.SLOT_PLANES = _chunkV7GWZIZKcjs.SLOT_PLANES; exports.SLOT_SIDE = _chunkV7GWZIZKcjs.SLOT_SIDE; exports.SMART_RENDER_MARGIN = _chunkUYXL6ZWQcjs.SMART_RENDER_MARGIN; exports.SPOT_HEAL_TYPES = _chunk7NW46N7Icjs.SPOT_HEAL_TYPES; exports.SRGB_TO_LINEAR = _chunkV7GWZIZKcjs.SRGB_TO_LINEAR; exports.STRIP = _chunkV7GWZIZKcjs.STRIP; exports.SUPPORTED_ADJUSTMENT_KEYS = _chunkUYXL6ZWQcjs.SUPPORTED_ADJUSTMENT_KEYS; exports.SelectionGesture = SelectionGesture; exports.ShapeDrawGesture = ShapeDrawGesture; exports.SmudgeTip = _chunkEBDCRTZIcjs.SmudgeTip; exports.StrokeCoverage = _chunkEBDCRTZIcjs.StrokeCoverage; exports.SurfaceDraft = _chunkCWM3CUUXcjs.SurfaceDraft; exports.TEXT_ALIGNS = _chunkUYXL6ZWQcjs.TEXT_ALIGNS; exports.TEXT_ORIENTATIONS = _chunkUYXL6ZWQcjs.TEXT_ORIENTATIONS; exports.TEXT_RENDER_MARGIN = _chunkUYXL6ZWQcjs.TEXT_RENDER_MARGIN; exports.TEXT_STYLE_FIELDS = _chunkUYXL6ZWQcjs.TEXT_STYLE_FIELDS; exports.TILE = _chunkCWM3CUUXcjs.TILE; exports.TILE_SHIFT = _chunkCWM3CUUXcjs.TILE_SHIFT; exports.TINT_SCALE = _chunkUYXL6ZWQcjs.TINT_SCALE; exports.TIP_GRADIENT_STEPS = _chunkEBDCRTZIcjs.TIP_GRADIENT_STEPS; exports.TONE_LUT_SIZE = _chunkUYXL6ZWQcjs.TONE_LUT_SIZE; exports.TONE_RANGES = _chunk7NW46N7Icjs.TONE_RANGES; exports.TONE_RANGE_PRESETS = TONE_RANGE_PRESETS; exports.TRANSFORM_ANCHORS = _chunkUYXL6ZWQcjs.TRANSFORM_ANCHORS; exports.TRANSFORM_ROTATE_HANDLE_OFFSET = TRANSFORM_ROTATE_HANDLE_OFFSET; exports.TextEditSession = TextEditSession; exports.TileMedium = _chunkEBDCRTZIcjs.TileMedium; exports.TilePixelSource = _chunk7NW46N7Icjs.TilePixelSource; exports.TileableNoise = _chunkEBDCRTZIcjs.TileableNoise; exports.TiledSurface = _chunkCWM3CUUXcjs.TiledSurface; exports.TransformTooLargeError = _chunkHGTDMKNEcjs.TransformTooLargeError; exports.TransformedPixelSource = _chunk7NW46N7Icjs.TransformedPixelSource; exports.TypeToolGesture = TypeToolGesture; exports.UNITS = UNITS; exports.U_MAX = _chunkV7GWZIZKcjs.U_MAX; exports.VIBRANCE_GREY = _chunkUYXL6ZWQcjs.VIBRANCE_GREY; exports.W9 = _chunkV7GWZIZKcjs.W9; exports.WARP_GRID_OPTIONS = WARP_GRID_OPTIONS; exports.WARP_STYLES = _chunkBRKVNXDZcjs.WARP_STYLES; exports.WARP_STYLE_LABELS = _chunkBRKVNXDZcjs.WARP_STYLE_LABELS; exports.WARP_STYLE_OPTIONS = WARP_STYLE_OPTIONS; exports.WET_FLOW_KINDS = _chunkV7GWZIZKcjs.WET_FLOW_KINDS; exports.WET_PARAM_KEYS = _chunkV7GWZIZKcjs.WET_PARAM_KEYS; exports.WET_TILE = _chunkV7GWZIZKcjs.WET_TILE; exports.WGSL_HALO = _chunkV7GWZIZKcjs.WGSL_HALO; exports.WGSL_SHADE = _chunkV7GWZIZKcjs.WGSL_SHADE; exports.WGSL_STEP = _chunkV7GWZIZKcjs.WGSL_STEP; exports.WORKING_SPACE_OPTIONS = WORKING_SPACE_OPTIONS; exports.WORK_SIZE = WORK_SIZE; exports.WetGpuEngine = _chunkV7GWZIZKcjs.WetGpuEngine; exports.WetMedium = _chunkV7GWZIZKcjs.WetMedium; exports.WetWorkerPool = _chunkV7GWZIZKcjs.WetWorkerPool; exports.WetWorld = _chunkV7GWZIZKcjs.WetWorld; exports.WetWorldError = _chunkV7GWZIZKcjs.WetWorldError; exports.XYZ_D50_TO_SRGB = _chunkUYXL6ZWQcjs.XYZ_D50_TO_SRGB; exports.ZlibError = _chunkXFM3OCHUcjs.ZlibError; exports.activeAdjustmentLayers = _chunkUYXL6ZWQcjs.activeAdjustmentLayers; exports.activeEffectSmartFilters = _chunkUYXL6ZWQcjs.activeEffectSmartFilters; exports.activeLayerAfterRemoval = _chunkUYXL6ZWQcjs.activeLayerAfterRemoval; exports.activeSmartFilters = _chunkUYXL6ZWQcjs.activeSmartFilters; exports.addLayerEffect = _chunkUYXL6ZWQcjs.addLayerEffect; exports.addLayerFilter = _chunkUYXL6ZWQcjs.addLayerFilter; exports.addLayerOfKind = addLayerOfKind; exports.addPaintGradientStop = _chunkEBDCRTZIcjs.addPaintGradientStop; exports.addSmartFilter = _chunkUYXL6ZWQcjs.addSmartFilter; exports.addToHistogram = addToHistogram; exports.adjustmentKindLabel = _chunkUYXL6ZWQcjs.adjustmentKindLabel; exports.adjustmentLayersKey = _chunkUYXL6ZWQcjs.adjustmentLayersKey; exports.adjustmentNodeAsLayer = _chunkUYXL6ZWQcjs.adjustmentNodeAsLayer; exports.adjustmentNodeFromLegacy = _chunkUYXL6ZWQcjs.adjustmentNodeFromLegacy; exports.adler32 = _chunkXFM3OCHUcjs.adler32; exports.agentDragDraft = agentDragDraft; exports.anchorPoint = _chunkUYXL6ZWQcjs.anchorPoint; exports.annotationBlend = _chunkUYXL6ZWQcjs.annotationBlend; exports.annotationLayerFor = _chunkUYXL6ZWQcjs.annotationLayerFor; exports.annotationLayerName = _chunkUYXL6ZWQcjs.annotationLayerName; exports.annotationOfLayer = _chunkUYXL6ZWQcjs.annotationOfLayer; exports.annotationOfShape = _chunkUYXL6ZWQcjs.annotationOfShape; exports.annotationOfType = _chunkUYXL6ZWQcjs.annotationOfType; exports.applyAdjustmentLayers = _chunkUYXL6ZWQcjs.applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = _chunkUYXL6ZWQcjs.applyAdjustmentLayersFloat; exports.applyAdjustments = _chunkUYXL6ZWQcjs.applyAdjustments; exports.applyBoxBlur = _chunkUYXL6ZWQcjs.applyBoxBlur; exports.applyBoxBlurFloat = _chunkUYXL6ZWQcjs.applyBoxBlurFloat; exports.applyDepthMask = _chunkUYXL6ZWQcjs.applyDepthMask; exports.applyHomography = _chunkQT26RHKKcjs.applyHomography; exports.applyImageProjectionToContext = _chunkUYXL6ZWQcjs.applyImageProjectionToContext; exports.applyLegacyAdjustments = _chunkUYXL6ZWQcjs.applyLegacyAdjustments; exports.applyLegacyFloat = _chunkUYXL6ZWQcjs.applyLegacyFloat; exports.applyMatrix3 = _chunkUYXL6ZWQcjs.applyMatrix3; exports.applyOutputStage = applyOutputStage; exports.applyParams = _chunkUYXL6ZWQcjs.applyParams; exports.applyProcess2Adjustments = _chunkUYXL6ZWQcjs.applyProcess2Adjustments; exports.applyProcess2Float = _chunkUYXL6ZWQcjs.applyProcess2Float; exports.applyRegionBlur = applyRegionBlur; exports.applyRegionMosaic = applyRegionMosaic; exports.applyRetouchToTile = _chunk7NW46N7Icjs.applyRetouchToTile; exports.applyShapeOptions = applyShapeOptions; exports.applySmartFilters = _chunkUYXL6ZWQcjs.applySmartFilters; exports.applyStrokeToDeepTile = _chunkEBDCRTZIcjs.applyStrokeToDeepTile; exports.applyStrokeToTile = _chunkEBDCRTZIcjs.applyStrokeToTile; exports.applyToneToDeepTile = _chunk7NW46N7Icjs.applyToneToDeepTile; exports.backgroundLayer = _chunkUYXL6ZWQcjs.backgroundLayer; exports.base64ToBytes = _chunkCWM3CUUXcjs.base64ToBytes; exports.baseProjection = baseProjection; exports.bestOffset = _chunk7NW46N7Icjs.bestOffset; exports.blackWhiteGray = _chunkUYXL6ZWQcjs.blackWhiteGray; exports.blendChannel = _chunkCWM3CUUXcjs.blendChannel; exports.blendImageData = _chunkCWM3CUUXcjs.blendImageData; exports.blendLum = _chunkCWM3CUUXcjs.blendLum; exports.blendPixel = _chunkCWM3CUUXcjs.blendPixel; exports.blendRadius = _chunkEBDCRTZIcjs.blendRadius; exports.blendRgb = _chunkCWM3CUUXcjs.blendRgb; exports.blendTile = _chunkHGTDMKNEcjs.blendTile; exports.blenderDab = _chunkEBDCRTZIcjs.blenderDab; exports.blurFilter = _chunkUYXL6ZWQcjs.blurFilter; exports.borderCoverage = _chunkUYXL6ZWQcjs.borderCoverage; exports.boxBlur = boxBlur; exports.boxBlurPixels = _chunk7NW46N7Icjs.boxBlurPixels; exports.boxFrameHit = boxFrameHit; exports.boxFrameOverlay = boxFrameOverlay; exports.boxMean = boxMean; exports.boxPointOf = _chunkUYXL6ZWQcjs.boxPointOf; exports.boxQuad = _chunkQT26RHKKcjs.boxQuad; exports.boxToCurvePoint = boxToCurvePoint; exports.bradfordAdaptation = _chunkUYXL6ZWQcjs.bradfordAdaptation; exports.brushstrokeDataUrl = _chunkEBDCRTZIcjs.brushstrokeDataUrl; exports.brushstrokeKey = _chunkEBDCRTZIcjs.brushstrokeKey; exports.brushstrokeSamples = _chunkEBDCRTZIcjs.brushstrokeSamples; exports.brushstrokeScaleBucket = _chunkYQGCPL5Xcjs.brushstrokeScaleBucket; exports.brushstrokeStrokeOptions = _chunkEBDCRTZIcjs.brushstrokeStrokeOptions; exports.brushstrokeToCanvas = _chunkEBDCRTZIcjs.brushstrokeToCanvas; exports.buildLayerMaskPlanes = _chunkUYXL6ZWQcjs.buildLayerMaskPlanes; exports.buildToneLut = _chunkUYXL6ZWQcjs.buildToneLut; exports.builtinPattern = _chunkHGTDMKNEcjs.builtinPattern; exports.builtinPatternIds = _chunkHGTDMKNEcjs.builtinPatternIds; exports.bytesToBase64 = _chunkCWM3CUUXcjs.bytesToBase64; exports.calculateCropDrag = _chunkUYXL6ZWQcjs.calculateCropDrag; exports.canShareMemory = _chunkV7GWZIZKcjs.canShareMemory; exports.canvasCompositeOperation = _chunkCWM3CUUXcjs.canvasCompositeOperation; exports.canvasToImagePoint = _chunkUYXL6ZWQcjs.canvasToImagePoint; exports.caretAt = _chunkBRKVNXDZcjs.caretAt; exports.changedTiles = _chunkHGTDMKNEcjs.changedTiles; exports.channelThumbnail = channelThumbnail; exports.checkEffectAnimation = checkEffectAnimation; exports.checkEffectTime = checkEffectTime; exports.checkImageEffectPlace = checkImageEffectPlace; exports.clampControlValue = clampControlValue; exports.clampCropToImage = _chunkUYXL6ZWQcjs.clampCropToImage; exports.cleanMixer = _chunkEBDCRTZIcjs.cleanMixer; exports.cloneSamplePoint = _chunk7NW46N7Icjs.cloneSamplePoint; exports.cloneSourceLabel = cloneSourceLabel; exports.cloneTransformView = cloneTransformView; exports.collectTiles = _chunkCWM3CUUXcjs.collectTiles; exports.colorBalanceChannel = _chunkUYXL6ZWQcjs.colorBalanceChannel; exports.colorModePlanes = colorModePlanes; exports.colorModePlanes16 = colorModePlanes16; exports.colorPanelView = colorPanelView; exports.colorRange = colorRange; exports.colorRangePreset = colorRangePreset; exports.combineSelections = _chunkUYXL6ZWQcjs.combineSelections; exports.compileAdjustmentLayer = _chunkUYXL6ZWQcjs.compileAdjustmentLayer; exports.componentPath = _chunkUYXL6ZWQcjs.componentPath; exports.componentsCoverage = _chunkUYXL6ZWQcjs.componentsCoverage; exports.compositeDeep = _chunkUYXL6ZWQcjs.compositeDeep; exports.compositeSurfaceOver = _chunkHGTDMKNEcjs.compositeSurfaceOver; exports.computeHistogram = computeHistogram; exports.computeSelectionBounds = _chunkUYXL6ZWQcjs.computeSelectionBounds; exports.contentAwareFill = _chunk7NW46N7Icjs.contentAwareFill; exports.contentBounds = _chunkCWM3CUUXcjs.contentBounds; exports.contentsBox = _chunkUYXL6ZWQcjs.contentsBox; exports.contentsSurface = _chunkUYXL6ZWQcjs.contentsSurface; exports.contractCoverage = _chunkUYXL6ZWQcjs.contractCoverage; exports.controlPosition = controlPosition; exports.controlTrackBackground = controlTrackBackground; exports.convertColorFields = convertColorFields; exports.convertHex = convertHex; exports.convertSurfaceColors = convertSurfaceColors; exports.convertSurfaceDepth = _chunkCWM3CUUXcjs.convertSurfaceDepth; exports.convertToSmartObject = _chunkUYXL6ZWQcjs.convertToSmartObject; exports.copySmartObject = _chunkUYXL6ZWQcjs.copySmartObject; exports.cornersFromMatrix = _chunkUYXL6ZWQcjs.cornersFromMatrix; exports.coverageTileCoord = _chunkEBDCRTZIcjs.coverageTileCoord; exports.coverageToByte = _chunkUYXL6ZWQcjs.coverageToByte; exports.coveringRect = coveringRect; exports.createAdjustmentLayer = _chunkUYXL6ZWQcjs.createAdjustmentLayer; exports.createBlenderScratch = _chunkEBDCRTZIcjs.createBlenderScratch; exports.createCanvasTextShaper = _chunkBRKVNXDZcjs.createCanvasTextShaper; exports.createImageCaptureSurface = createImageCaptureSurface; exports.createImageColorTools = createImageColorTools; exports.createImageEditTools = createImageEditTools; exports.createImageEditorDocument = createImageEditorDocument; exports.createImageEditorToolProvider = createImageEditorToolProvider; exports.createImageEffectTools = createImageEffectTools; exports.createImageEffectsToolProvider = createImageEffectsToolProvider; exports.createImageLayerTools = createImageLayerTools; exports.createImagePaintTools = createImagePaintTools; exports.createImagePlaybackLocator = createImagePlaybackLocator; exports.createImagePsdTools = createImagePsdTools; exports.createImageRetouchTools = createImageRetouchTools; exports.createImageSegmentationToolProvider = createImageSegmentationToolProvider; exports.createImageSelectionTools = createImageSelectionTools; exports.createImageShapeTools = createImageShapeTools; exports.createImageSmartObjectTools = createImageSmartObjectTools; exports.createImageSubjectSelectionTool = createImageSubjectSelectionTool; exports.createImageTransformTools = createImageTransformTools; exports.createImageTypeTools = createImageTypeTools; exports.createMetricTextShaper = _chunkBRKVNXDZcjs.createMetricTextShaper; exports.createOutlineTextShaper = _chunkBRKVNXDZcjs.createOutlineTextShaper; exports.createPigment = _chunkCWM3CUUXcjs.createPigment; exports.createPigmentTools = _chunkV7GWZIZKcjs.createPigmentTools; exports.createSelectionMask = _chunkUYXL6ZWQcjs.createSelectionMask; exports.createShapeLayer = _chunkUYXL6ZWQcjs.createShapeLayer; exports.createTypeLayer = _chunkUYXL6ZWQcjs.createTypeLayer; exports.createWetGpuEngine = _chunkV7GWZIZKcjs.createWetGpuEngine; exports.cssFont = _chunkBRKVNXDZcjs.cssFont; exports.cssFontFamily = _chunkBRKVNXDZcjs.cssFontFamily; exports.curveLut = _chunkHGTDMKNEcjs.curveLut; exports.curveLutFromLevels = _chunkUYXL6ZWQcjs.curveLutFromLevels; exports.curvePointToBox = curvePointToBox; exports.curveSvgPath = curveSvgPath; exports.dabCoverage = _chunkEBDCRTZIcjs.dabCoverage; exports.dabRect = _chunkEBDCRTZIcjs.dabRect; exports.decodeDeepSurface = _chunkUYXL6ZWQcjs.decodeDeepSurface; exports.decodeLayerChannel = _chunkUYXL6ZWQcjs.decodeLayerChannel; exports.decodeLayerMask = _chunkUYXL6ZWQcjs.decodeLayerMask; exports.decodeMergedImage = _chunkUYXL6ZWQcjs.decodeMergedImage; exports.decodePlanes = _chunkUYXL6ZWQcjs.decodePlanes; exports.decodePng = _chunkCWM3CUUXcjs.decodePng; exports.decodePngDataUrl = _chunkUYXL6ZWQcjs.decodePngDataUrl; exports.decodeSelectionRle = _chunkUYXL6ZWQcjs.decodeSelectionRle; exports.deepBytes = _chunkCWM3CUUXcjs.deepBytes; exports.deepTile = _chunkCWM3CUUXcjs.deepTile; exports.defaultActiveLayerId = _chunkUYXL6ZWQcjs.defaultActiveLayerId; exports.defaultAdjustmentParams = _chunkUYXL6ZWQcjs.defaultAdjustmentParams; exports.defaultEffectGradient = _chunkHGTDMKNEcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkHGTDMKNEcjs.defaultLayerEffect; exports.defaultShapeName = _chunkUYXL6ZWQcjs.defaultShapeName; exports.deflate = _chunkXFM3OCHUcjs.deflate; exports.deflateRaw = _chunkXFM3OCHUcjs.deflateRaw; exports.depthMaskAlpha = _chunkUYXL6ZWQcjs.depthMaskAlpha; exports.depthOf = _chunkCWM3CUUXcjs.depthOf; exports.depthRasterMask = _chunkUYXL6ZWQcjs.depthRasterMask; exports.describeChannel = describeChannel; exports.describeLayer = describeLayer; exports.describeLayerEffects = describeLayerEffects; exports.describeSelection = describeSelection; exports.describeTransform = _chunkUYXL6ZWQcjs.describeTransform; exports.deserializeChannels = deserializeChannels; exports.deserializeColorMode = deserializeColorMode; exports.deserializeColorProfile = deserializeColorProfile; exports.deserializeEffects = _chunkUYXL6ZWQcjs.deserializeEffects; exports.deserializeLayer = _chunkUYXL6ZWQcjs.deserializeLayer; exports.deserializeLayers = _chunkUYXL6ZWQcjs.deserializeLayers; exports.deserializePatterns = _chunkUYXL6ZWQcjs.deserializePatterns; exports.deserializeSelection = _chunkUYXL6ZWQcjs.deserializeSelection; exports.developFilter = _chunkUYXL6ZWQcjs.developFilter; exports.developFromAdjustments = _chunkUYXL6ZWQcjs.developFromAdjustments; exports.developTarget = _chunkUYXL6ZWQcjs.developTarget; exports.dexp = _chunkV7GWZIZKcjs.dexp; exports.dilateMask = _chunk7NW46N7Icjs.dilateMask; exports.displayTransform = displayTransform; exports.distanceTransform = _chunkUYXL6ZWQcjs.distanceTransform; exports.dlog = _chunkV7GWZIZKcjs.dlog; exports.documentContents = _chunkUYXL6ZWQcjs.documentContents; exports.documentProfile = documentProfile; exports.dodgeBurn = _chunk7NW46N7Icjs.dodgeBurn; exports.dodgeBurnCurve = _chunk7NW46N7Icjs.dodgeBurnCurve; exports.downloadMaskImage = downloadMaskImage; exports.downloadPsd = downloadPsd; exports.dpow = _chunkV7GWZIZKcjs.dpow; exports.dragWarpMeshPoint = _chunkBRKVNXDZcjs.dragWarpMeshPoint; exports.dropPlacement = dropPlacement; exports.dropZone = dropZone; exports.dsincos = _chunkV7GWZIZKcjs.dsincos; exports.duplicateLayer = _chunkUYXL6ZWQcjs.duplicateLayer; exports.edgeBits = _chunkV7GWZIZKcjs.edgeBits; exports.edgeWidth = edgeWidth; exports.effectColorHex = _chunkHGTDMKNEcjs.effectColorHex; exports.effectControlChange = effectControlChange; exports.effectLayerTiming = effectLayerTiming; exports.effectPixelsToSurface = effectPixelsToSurface; exports.effectReach = _chunkHGTDMKNEcjs.effectReach; exports.effectiveLayerMask = _chunkUYXL6ZWQcjs.effectiveLayerMask; exports.effectiveProof = effectiveProof; exports.effectsFingerprint = _chunkHGTDMKNEcjs.effectsFingerprint; exports.effectsMargin = _chunkHGTDMKNEcjs.effectsMargin; exports.effectsScale = _chunkHGTDMKNEcjs.effectsScale; exports.ellipsePoints = ellipsePoints; exports.ellipseSelection = ellipseSelection; exports.emptyHistogram = emptyHistogram; exports.emptySurface = _chunkCWM3CUUXcjs.emptySurface; exports.encodeDeepSurface = _chunkUYXL6ZWQcjs.encodeDeepSurface; exports.encodePng = _chunkCWM3CUUXcjs.encodePng; exports.encodeRle = _chunkUYXL6ZWQcjs.encodeRle; exports.encodeSelectionRle = _chunkUYXL6ZWQcjs.encodeSelectionRle; exports.encodeSurface = _chunkUYXL6ZWQcjs.encodeSurface; exports.evalWarpMesh = _chunkBRKVNXDZcjs.evalWarpMesh; exports.evaluateAdjustmentLayers = _chunkUYXL6ZWQcjs.evaluateAdjustmentLayers; exports.exchangeRates = _chunkEBDCRTZIcjs.exchangeRates; exports.expNeg = _chunkV7GWZIZKcjs.expNeg; exports.expandCoverage = _chunkUYXL6ZWQcjs.expandCoverage; exports.exportPsd = _chunkUYXL6ZWQcjs.exportPsd; exports.extractNormalizedLayerItems = extractNormalizedLayerItems; exports.featherCoverage = _chunkUYXL6ZWQcjs.featherCoverage; exports.fillRect = _chunkCWM3CUUXcjs.fillRect; exports.filmPixel = _chunkV7GWZIZKcjs.filmPixel; exports.filmReflectance = _chunkV7GWZIZKcjs.filmReflectance; exports.filterMaskCoverage = _chunkUYXL6ZWQcjs.filterMaskCoverage; exports.findAdjustmentControl = findAdjustmentControl; exports.findLayer = _chunkHGTDMKNEcjs.findLayer; exports.findLayerControl = findLayerControl; exports.findSubject = findSubject; exports.findWebGpu = _chunkV7GWZIZKcjs.findWebGpu; exports.finishTile = _chunkCWM3CUUXcjs.finishTile; exports.fitParagraphRuns = _chunkBRKVNXDZcjs.fitParagraphRuns; exports.fitRuns = _chunkBRKVNXDZcjs.fitRuns; exports.flattenLayers = _chunkHGTDMKNEcjs.flattenLayers; exports.flattenPath = _chunkUYXL6ZWQcjs.flattenPath; exports.flipCorners = _chunkUYXL6ZWQcjs.flipCorners; exports.flowField = _chunkV7GWZIZKcjs.flowField; exports.focusArea = focusArea; exports.followLayerMove = _chunkUYXL6ZWQcjs.followLayerMove; exports.fontOf = _chunkBRKVNXDZcjs.fontOf; exports.formatControlValue = formatControlValue; exports.fullSelection = _chunkUYXL6ZWQcjs.fullSelection; exports.gaussianBlur = _chunkHGTDMKNEcjs.gaussianBlur; exports.geometryHomography = _chunkUYXL6ZWQcjs.geometryHomography; exports.getAnnotationBounds = _chunkUYXL6ZWQcjs.getAnnotationBounds; exports.getControlPath = getControlPath; exports.getCropCursor = _chunkUYXL6ZWQcjs.getCropCursor; exports.getRotatedSize = _chunkUYXL6ZWQcjs.getRotatedSize; exports.getViewportMetrics = _chunkUYXL6ZWQcjs.getViewportMetrics; exports.getViewportProjection = _chunkUYXL6ZWQcjs.getViewportProjection; exports.globalImageCache = globalImageCache; exports.grabCutLabels = grabCutLabels; exports.gradientDabColor = _chunkEBDCRTZIcjs.gradientDabColor; exports.grainCatch = _chunkEBDCRTZIcjs.grainCatch; exports.grainHeights = _chunkEBDCRTZIcjs.grainHeights; exports.greyMorphology = _chunkUYXL6ZWQcjs.greyMorphology; exports.groupLayers = _chunkUYXL6ZWQcjs.groupLayers; exports.growSelection = growSelection; exports.guidePlanes = guidePlanes; exports.guidedFilterColor = guidedFilterColor; exports.handleMaskViewKey = handleMaskViewKey; exports.handlePaintShortcut = handlePaintShortcut; exports.handleQuickMaskKey = handleQuickMaskKey; exports.handleSelectionShortcut = handleSelectionShortcut; exports.hasActiveEffects = _chunkHGTDMKNEcjs.hasActiveEffects; exports.hasLayersBelow = hasLayersBelow; exports.hasResampledLegacyMask = _chunkUYXL6ZWQcjs.hasResampledLegacyMask; exports.hasSurface = _chunkUYXL6ZWQcjs.hasSurface; exports.hasWarp = _chunkUYXL6ZWQcjs.hasWarp; exports.hash2 = _chunkEBDCRTZIcjs.hash2; exports.hashMaskContent = _chunkUYXL6ZWQcjs.hashMaskContent; exports.hashNoise = _chunkHGTDMKNEcjs.hashNoise; exports.healPixels = _chunk7NW46N7Icjs.healPixels; exports.hexToPaintRgb = _chunkEBDCRTZIcjs.hexToPaintRgb; exports.hexToRgb = _chunkUYXL6ZWQcjs.hexToRgb; exports.histogramPath = histogramPath; exports.hitTestAnnotation = _chunkUYXL6ZWQcjs.hitTestAnnotation; exports.hitTestCrop = _chunkUYXL6ZWQcjs.hitTestCrop; exports.hitTestCurvePoint = hitTestCurvePoint; exports.homographyFromAffine = _chunkQT26RHKKcjs.homographyFromAffine; exports.homographyFromPoints = _chunkQT26RHKKcjs.homographyFromPoints; exports.hslToRgb = _chunkUYXL6ZWQcjs.hslToRgb; exports.hueRange = hueRange; exports.hueRangeTables = _chunkUYXL6ZWQcjs.hueRangeTables; exports.hueRangeWeight = _chunkUYXL6ZWQcjs.hueRangeWeight; exports.hueSaturation = _chunkUYXL6ZWQcjs.hueSaturation; exports.identityCurve = _chunkUYXL6ZWQcjs.identityCurve; exports.identityLevels = _chunkUYXL6ZWQcjs.identityLevels; exports.identityTransform = _chunkUYXL6ZWQcjs.identityTransform; exports.identityWarpMesh = _chunkBRKVNXDZcjs.identityWarpMesh; exports.imageEditorStateMigrations = imageEditorStateMigrations; exports.imageLayerAppliedEffects = imageLayerAppliedEffects; exports.imagePanelTool = imagePanelTool; exports.imagePlaybackPanel = imagePlaybackPanel; exports.imageToCanvasPoint = _chunkUYXL6ZWQcjs.imageToCanvasPoint; exports.imageToolCanvasMode = imageToolCanvasMode; exports.imageToolForShortcut = imageToolForShortcut; exports.imageToolGroup = imageToolGroup; exports.imageToolLabel = imageToolLabel; exports.imageToolPanel = imageToolPanel; exports.importPsd = _chunkUYXL6ZWQcjs.importPsd; exports.inflate = _chunkXFM3OCHUcjs.inflate; exports.inflateRaw = _chunkXFM3OCHUcjs.inflateRaw; exports.insertCurvePoint = insertCurvePoint; exports.insertLayer = _chunkHGTDMKNEcjs.insertLayer; exports.instancesOf = _chunkUYXL6ZWQcjs.instancesOf; exports.invertHomography = _chunkQT26RHKKcjs.invertHomography; exports.invertMatrix3 = _chunkUYXL6ZWQcjs.invertMatrix3; exports.invertSelection = _chunkUYXL6ZWQcjs.invertSelection; exports.isActiveFilter = _chunkUYXL6ZWQcjs.isActiveFilter; exports.isActiveVectorMask = _chunkUYXL6ZWQcjs.isActiveVectorMask; exports.isAdjustmentKind = _chunkUYXL6ZWQcjs.isAdjustmentKind; exports.isBitDepth = _chunkCWM3CUUXcjs.isBitDepth; exports.isBlendMode = _chunkCWM3CUUXcjs.isBlendMode; exports.isBrushstrokeBrush = _chunkEBDCRTZIcjs.isBrushstrokeBrush; exports.isColorRangePreset = isColorRangePreset; exports.isContentsDecoded = _chunkUYXL6ZWQcjs.isContentsDecoded; exports.isDefaultDepthMask = _chunkUYXL6ZWQcjs.isDefaultDepthMask; exports.isGradientPaint = _chunkEBDCRTZIcjs.isGradientPaint; exports.isIdentityCloneTransform = _chunk7NW46N7Icjs.isIdentityCloneTransform; exports.isIdentityTransform = _chunkUYXL6ZWQcjs.isIdentityTransform; exports.isInterpolation = _chunkHGTDMKNEcjs.isInterpolation; exports.isLayerEffectKind = _chunkHGTDMKNEcjs.isLayerEffectKind; exports.isLayerLocked = _chunkHGTDMKNEcjs.isLayerLocked; exports.isLegacyShape = _chunkUYXL6ZWQcjs.isLegacyShape; exports.isPaintTool = isPaintTool; exports.isPaintableLayer = _chunkUYXL6ZWQcjs.isPaintableLayer; exports.isPainterlyBlendMode = _chunkCWM3CUUXcjs.isPainterlyBlendMode; exports.isPng = _chunkCWM3CUUXcjs.isPng; exports.isQuarterTurn = isQuarterTurn; exports.isQuarterTurnSwapped = _chunkUYXL6ZWQcjs.isQuarterTurnSwapped; exports.isRenderedLayer = _chunkUYXL6ZWQcjs.isRenderedLayer; exports.isRetouchPaintTool = isRetouchPaintTool; exports.isRetouchTool = isRetouchTool; exports.isSelectionEmpty = _chunkUYXL6ZWQcjs.isSelectionEmpty; exports.isSelectionMode = _chunkUYXL6ZWQcjs.isSelectionMode; exports.isSeparableBlendMode = _chunkCWM3CUUXcjs.isSeparableBlendMode; exports.isSmartSurfaceIncomplete = _chunkUYXL6ZWQcjs.isSmartSurfaceIncomplete; exports.isSpatialFilter = _chunkUYXL6ZWQcjs.isSpatialFilter; exports.isSrgb = isSrgb; exports.isTransformAnchor = _chunkUYXL6ZWQcjs.isTransformAnchor; exports.isValidWarp = _chunkUYXL6ZWQcjs.isValidWarp; exports.keepDeepSamples = _chunkCWM3CUUXcjs.keepDeepSamples; exports.keepMainPieces = keepMainPieces; exports.kelvinToTemperature = _chunkUYXL6ZWQcjs.kelvinToTemperature; exports.keysWeight = _chunkHGTDMKNEcjs.keysWeight; exports.latticeViscosity = _chunkV7GWZIZKcjs.latticeViscosity; exports.layerBadge = layerBadge; exports.layerEffectControls = layerEffectControls; exports.layerEffectFields = _chunkHGTDMKNEcjs.layerEffectFields; exports.layerEffectLabel = _chunkHGTDMKNEcjs.layerEffectLabel; exports.layerEffectsBadge = layerEffectsBadge; exports.layerEffectsOf = _chunkUYXL6ZWQcjs.layerEffectsOf; exports.layerEffectsPanel = layerEffectsPanel; exports.layerHasThumbnail = layerHasThumbnail; exports.layerLabel = layerLabel; exports.layerMaskCoverage = _chunkUYXL6ZWQcjs.layerMaskCoverage; exports.layerMaskFromSelection = _chunkUYXL6ZWQcjs.layerMaskFromSelection; exports.layerMaskKey = _chunkUYXL6ZWQcjs.layerMaskKey; exports.layerMaskSelection = _chunkUYXL6ZWQcjs.layerMaskSelection; exports.layerMenu = layerMenu; exports.layerName = _chunkUYXL6ZWQcjs.layerName; exports.layerPanelRows = layerPanelRows; exports.layerPanels = layerPanels; exports.layerThumbnailClick = layerThumbnailClick; exports.layerTree = _chunkUYXL6ZWQcjs.layerTree; exports.layerTypeLabel = _chunkUYXL6ZWQcjs.layerTypeLabel; exports.layerWarning = layerWarning; exports.layersFromLegacy = _chunkUYXL6ZWQcjs.layersFromLegacy; exports.layoutText = _chunkBRKVNXDZcjs.layoutText; exports.legacyAdjustmentLayer = _chunkUYXL6ZWQcjs.legacyAdjustmentLayer; exports.legacyMaskOf = _chunkUYXL6ZWQcjs.legacyMaskOf; exports.legacyView = _chunkUYXL6ZWQcjs.legacyView; exports.lerpPigment = _chunkCWM3CUUXcjs.lerpPigment; exports.lerpPigmentInto = _chunkCWM3CUUXcjs.lerpPigmentInto; exports.levelsValue = _chunkUYXL6ZWQcjs.levelsValue; exports.linearSrgbToXy = _chunkUYXL6ZWQcjs.linearSrgbToXy; exports.linearToSrgb = _chunkUYXL6ZWQcjs.linearToSrgb; exports.linearToSrgb8 = _chunkV7GWZIZKcjs.linearToSrgb8; exports.liveComponent = _chunkUYXL6ZWQcjs.liveComponent; exports.liveShapeForDrag = liveShapeForDrag; exports.liveShapeSubpaths = _chunkUYXL6ZWQcjs.liveShapeSubpaths; exports.liveWire = liveWire; exports.loadImageEditorDocument = loadImageEditorDocument; exports.loadMixer = _chunkEBDCRTZIcjs.loadMixer; exports.loadOpenTypeFont = _chunk3T5VCDIVcjs.loadOpenTypeFont; exports.loadWetKernel = _chunkV7GWZIZKcjs.loadWetKernel; exports.luma = _chunk7NW46N7Icjs.luma; exports.magicWand = magicWand; exports.magneticAnchorSpacing = magneticAnchorSpacing; exports.mapCropHandle = _chunkUYXL6ZWQcjs.mapCropHandle; exports.mapLayer = _chunkHGTDMKNEcjs.mapLayer; exports.mapSubpaths = _chunkUYXL6ZWQcjs.mapSubpaths; exports.maskBounds = _chunk7NW46N7Icjs.maskBounds; exports.maskFileName = maskFileName; exports.maskNameFromFile = maskNameFromFile; exports.maskSummary = maskSummary; exports.maskThumbnailClick = maskThumbnailClick; exports.matrixFromCorners = _chunkUYXL6ZWQcjs.matrixFromCorners; exports.matrixFromParams = _chunkUYXL6ZWQcjs.matrixFromParams; exports.measureCanvasViewport = measureCanvasViewport; exports.membraneFill = _chunk7NW46N7Icjs.membraneFill; exports.mergeLayerEffect = _chunkHGTDMKNEcjs.mergeLayerEffect; exports.mergeShapeComponents = _chunkUYXL6ZWQcjs.mergeShapeComponents; exports.migrateSerializedImageEditorState = migrateSerializedImageEditorState; exports.migrateToLayeredState = migrateToLayeredState; exports.mix32 = _chunkEBDCRTZIcjs.mix32; exports.mixPigment8 = _chunkCWM3CUUXcjs.mixPigment8; exports.mixPigmentRgb = _chunkCWM3CUUXcjs.mixPigmentRgb; exports.mixPigments = _chunkCWM3CUUXcjs.mixPigments; exports.mixerLoadResult = mixerLoadResult; exports.mixerRates = _chunkEBDCRTZIcjs.mixerRates; exports.modifySelection = _chunkUYXL6ZWQcjs.modifySelection; exports.moveCurvePoint = moveCurvePoint; exports.moveLayer = _chunkUYXL6ZWQcjs.moveLayer; exports.moveSmartFilter = _chunkUYXL6ZWQcjs.moveSmartFilter; exports.mulMatrix3 = _chunkUYXL6ZWQcjs.mulMatrix3; exports.needsLegacyBase = needsLegacyBase; exports.neutralHueRange = _chunkUYXL6ZWQcjs.neutralHueRange; exports.newContentsId = _chunkUYXL6ZWQcjs.newContentsId; exports.newEffectId = _chunkHGTDMKNEcjs.newEffectId; exports.newLayerId = _chunkUYXL6ZWQcjs.newLayerId; exports.newLayerOptions = newLayerOptions; exports.normalizeAdjustmentLayer = _chunkUYXL6ZWQcjs.normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = _chunkUYXL6ZWQcjs.normalizeAdjustmentLayers; exports.normalizeAngle = _chunkUYXL6ZWQcjs.normalizeAngle; exports.normalizeBlendMode = _chunkCWM3CUUXcjs.normalizeBlendMode; exports.normalizeBlender = _chunkEBDCRTZIcjs.normalizeBlender; exports.normalizeBrush = _chunkEBDCRTZIcjs.normalizeBrush; exports.normalizeFilter = _chunkUYXL6ZWQcjs.normalizeFilter; exports.normalizeFlow = _chunkV7GWZIZKcjs.normalizeFlow; exports.normalizeHexColor = _chunkEBDCRTZIcjs.normalizeHexColor; exports.normalizeLayerEffects = _chunkHGTDMKNEcjs.normalizeLayerEffects; exports.normalizeLayerMask = _chunkUYXL6ZWQcjs.normalizeLayerMask; exports.normalizeLiveShape = _chunkUYXL6ZWQcjs.normalizeLiveShape; exports.normalizeMixer = _chunkEBDCRTZIcjs.normalizeMixer; exports.normalizePlacement = _chunkUYXL6ZWQcjs.normalizePlacement; exports.normalizeProcessVersion = _chunkUYXL6ZWQcjs.normalizeProcessVersion; exports.normalizeRect = normalizeRect; exports.normalizeRefineEdgeParams = normalizeRefineEdgeParams; exports.normalizeRetouch = _chunk7NW46N7Icjs.normalizeRetouch; exports.normalizeShapePaint = _chunkUYXL6ZWQcjs.normalizeShapePaint; exports.normalizeShapeStroke = _chunkUYXL6ZWQcjs.normalizeShapeStroke; exports.normalizeSmartFilter = _chunkUYXL6ZWQcjs.normalizeSmartFilter; exports.normalizeSmudge = _chunkEBDCRTZIcjs.normalizeSmudge; exports.normalizeStoredAdjustments = normalizeStoredAdjustments; exports.normalizeSubpaths = _chunkUYXL6ZWQcjs.normalizeSubpaths; exports.normalizeText = _chunkUYXL6ZWQcjs.normalizeText; exports.normalizeTilt = _chunkV7GWZIZKcjs.normalizeTilt; exports.normalizeWetParams = _chunkV7GWZIZKcjs.normalizeWetParams; exports.offsetLayer = _chunkUYXL6ZWQcjs.offsetLayer; exports.offsetShape = _chunkUYXL6ZWQcjs.offsetShape; exports.offsetSmartObject = _chunkUYXL6ZWQcjs.offsetSmartObject; exports.offsetVectorMask = _chunkUYXL6ZWQcjs.offsetVectorMask; exports.openMaskFile = openMaskFile; exports.openPsdFile = openPsdFile; exports.otsuThreshold = otsuThreshold; exports.packRgba = _chunkCWM3CUUXcjs.packRgba; exports.packWetParams = _chunkV7GWZIZKcjs.packWetParams; exports.paintGradientMappingFor = _chunkEBDCRTZIcjs.paintGradientMappingFor; exports.paintPathStroke = _chunkEBDCRTZIcjs.paintPathStroke; exports.paintSourceColor = _chunkEBDCRTZIcjs.paintSourceColor; exports.paintSourceCss = _chunkEBDCRTZIcjs.paintSourceCss; exports.paragraphRanges = _chunkBRKVNXDZcjs.paragraphRanges; exports.parseAdjustmentBlock = _chunkUYXL6ZWQcjs.parseAdjustmentBlock; exports.parseBlend = _chunkUYXL6ZWQcjs.parseBlend; exports.parseColor = parseColor; exports.parseCssColor = _chunkA2IS7EHEcjs.parseCssColor; exports.parseDataUrl = _chunkCWM3CUUXcjs.parseDataUrl; exports.parseEffectColor = _chunkHGTDMKNEcjs.parseEffectColor; exports.parseLfx2 = _chunkUYXL6ZWQcjs.parseLfx2; exports.parseLrfx = _chunkUYXL6ZWQcjs.parseLrfx; exports.parseOpenTypeFont = _chunk3T5VCDIVcjs.parseOpenTypeFont; exports.parsePaintSource = _chunkEBDCRTZIcjs.parsePaintSource; exports.parsePatternBlock = _chunkUYXL6ZWQcjs.parsePatternBlock; exports.parseSelectionMode = _chunkUYXL6ZWQcjs.parseSelectionMode; exports.parseVersionedDescriptor = _chunkUYXL6ZWQcjs.parseVersionedDescriptor; exports.patchParagraphStyle = _chunkUYXL6ZWQcjs.patchParagraphStyle; exports.patchTextStyle = _chunkUYXL6ZWQcjs.patchTextStyle; exports.pathStrokeCoverage = _chunkEBDCRTZIcjs.pathStrokeCoverage; exports.pathStrokeDabs = _chunkEBDCRTZIcjs.pathStrokeDabs; exports.pathToSelection = pathToSelection; exports.perDabStrength = _chunk7NW46N7Icjs.perDabStrength; exports.photoFilterMatrix = _chunkUYXL6ZWQcjs.photoFilterMatrix; exports.pigment8 = _chunkCWM3CUUXcjs.pigment8; exports.pigmentColor = _chunkV7GWZIZKcjs.pigmentColor; exports.pigmentOf = _chunkV7GWZIZKcjs.pigmentOf; exports.pixelLayerBounds = _chunkUYXL6ZWQcjs.pixelLayerBounds; exports.pixelLayers = _chunkUYXL6ZWQcjs.pixelLayers; exports.pixelPigment = _chunkV7GWZIZKcjs.pixelPigment; exports.placeContents = _chunkUYXL6ZWQcjs.placeContents; exports.placeLayer = _chunkUYXL6ZWQcjs.placeLayer; exports.placementAt = _chunkUYXL6ZWQcjs.placementAt; exports.placementBounds = _chunkUYXL6ZWQcjs.placementBounds; exports.placementGeometry = _chunkUYXL6ZWQcjs.placementGeometry; exports.planImageToolPlayback = planImageToolPlayback; exports.planOutlineTrace = planOutlineTrace; exports.pngDataUrl = _chunkCWM3CUUXcjs.pngDataUrl; exports.pointerPressure = _chunkV7GWZIZKcjs.pointerPressure; exports.pointerStrokeSample = _chunkV7GWZIZKcjs.pointerStrokeSample; exports.pointerStrokeSamples = _chunkV7GWZIZKcjs.pointerStrokeSamples; exports.polygonCoverage = polygonCoverage; exports.polygonCoverageBox = polygonCoverageBox; exports.polygonSelection = polygonSelection; exports.posterizeValue = _chunkUYXL6ZWQcjs.posterizeValue; exports.presetWarp = _chunkUYXL6ZWQcjs.presetWarp; exports.previewStep = previewStep; exports.profileBytes = profileBytes; exports.projectImagePoint = _chunkUYXL6ZWQcjs.projectImagePoint; exports.projectImageRect = _chunkUYXL6ZWQcjs.projectImageRect; exports.projectMaskCoverage = _chunkUYXL6ZWQcjs.projectMaskCoverage; exports.projectQuarterTurn = projectQuarterTurn; exports.proxyOf = _chunkCWM3CUUXcjs.proxyOf; exports.psdBytesFromBase64 = psdBytesFromBase64; exports.psdFileName = psdFileName; exports.psdPatternToEffectPattern = _chunkUYXL6ZWQcjs.psdPatternToEffectPattern; exports.psdToLayers = _chunkUYXL6ZWQcjs.psdToLayers; exports.pullWarpMesh = _chunkBRKVNXDZcjs.pullWarpMesh; exports.put255 = _chunkEBDCRTZIcjs.put255; exports.quadFrameOverlay = quadFrameOverlay; exports.quickMaskPixels = quickMaskPixels; exports.quickSelectStroke = quickSelectStroke; exports.rand01 = _chunkEBDCRTZIcjs.rand01; exports.randSigned = _chunkEBDCRTZIcjs.randSigned; exports.rangeLightness = _chunkUYXL6ZWQcjs.rangeLightness; exports.rasterContents = _chunkUYXL6ZWQcjs.rasterContents; exports.rasterMaskFromLegacy = _chunkUYXL6ZWQcjs.rasterMaskFromLegacy; exports.rasterizeCoverage = _chunkUYXL6ZWQcjs.rasterizeCoverage; exports.rasterizeDab = _chunkEBDCRTZIcjs.rasterizeDab; exports.rasterizeSmartObject = _chunkUYXL6ZWQcjs.rasterizeSmartObject; exports.readAdjustmentControls = readAdjustmentControls; exports.readDeepRegion = _chunkCWM3CUUXcjs.readDeepRegion; exports.readPaintSource = _chunkEBDCRTZIcjs.readPaintSource; exports.readPixel = _chunkCWM3CUUXcjs.readPixel; exports.readPsd = _chunkUYXL6ZWQcjs.readPsd; exports.readRegion = _chunkCWM3CUUXcjs.readRegion; exports.readSourceRegion = _chunk7NW46N7Icjs.readSourceRegion; exports.rectSelection = rectSelection; exports.rectToQuad = _chunkQT26RHKKcjs.rectToQuad; exports.reduceSurface = _chunkHGTDMKNEcjs.reduceSurface; exports.referencePoint = _chunkUYXL6ZWQcjs.referencePoint; exports.refineCoverage = refineCoverage; exports.refineEdgeHalo = refineEdgeHalo; exports.refineSelection = refineSelection; exports.reflectanceToRgb = _chunkCWM3CUUXcjs.reflectanceToRgb; exports.removeAlpha = _chunkUYXL6ZWQcjs.removeAlpha; exports.removeCurvePoint = removeCurvePoint; exports.removeLayer = _chunkUYXL6ZWQcjs.removeLayer; exports.removeLayerEffect = _chunkUYXL6ZWQcjs.removeLayerEffect; exports.removeLayerFilter = _chunkUYXL6ZWQcjs.removeLayerFilter; exports.removePaintGradientStop = _chunkEBDCRTZIcjs.removePaintGradientStop; exports.removeSmartFilter = _chunkUYXL6ZWQcjs.removeSmartFilter; exports.renderBrushstroke = _chunkEBDCRTZIcjs.renderBrushstroke; exports.renderLayerEffects = _chunkHGTDMKNEcjs.renderLayerEffects; exports.renderLayeredBase = renderLayeredBase; exports.renderShape = _chunkUYXL6ZWQcjs.renderShape; exports.renderShapeRect = _chunkUYXL6ZWQcjs.renderShapeRect; exports.renderSmartObject = _chunkUYXL6ZWQcjs.renderSmartObject; exports.renderText = _chunkUYXL6ZWQcjs.renderText; exports.replaceContents = _chunkUYXL6ZWQcjs.replaceContents; exports.replaceTextRange = _chunkUYXL6ZWQcjs.replaceTextRange; exports.requireLayer = _chunkUYXL6ZWQcjs.requireLayer; exports.requireOperation = _chunkUYXL6ZWQcjs.requireOperation; exports.requireShapeLayer = _chunkUYXL6ZWQcjs.requireShapeLayer; exports.requireSmartObject = _chunkUYXL6ZWQcjs.requireSmartObject; exports.requireTypeLayer = _chunkUYXL6ZWQcjs.requireTypeLayer; exports.requireUnlocked = _chunkUYXL6ZWQcjs.requireUnlocked; exports.rerender = _chunkUYXL6ZWQcjs.rerender; exports.rerenderShape = _chunkUYXL6ZWQcjs.rerenderShape; exports.rerenderText = _chunkUYXL6ZWQcjs.rerenderText; exports.resizePixels = resizePixels; exports.resizeSelection = _chunkUYXL6ZWQcjs.resizeSelection; exports.resizeWarpMesh = _chunkBRKVNXDZcjs.resizeWarpMesh; exports.resolveExternalAssets = _chunkUYXL6ZWQcjs.resolveExternalAssets; exports.resolveMosaicRegionBounds = resolveMosaicRegionBounds; exports.resolvePaintGradient = _chunkEBDCRTZIcjs.resolvePaintGradient; exports.resolveProfile = resolveProfile; exports.resolveVectorMasks = _chunkUYXL6ZWQcjs.resolveVectorMasks; exports.restyleRange = _chunkBRKVNXDZcjs.restyleRange; exports.retouchFilter = _chunk7NW46N7Icjs.retouchFilter; exports.reversePaintGradient = _chunkEBDCRTZIcjs.reversePaintGradient; exports.rgbToGray = _chunkUYXL6ZWQcjs.rgbToGray; exports.rgbToHsl = _chunkUYXL6ZWQcjs.rgbToHsl; exports.rgbToReflectance = _chunkCWM3CUUXcjs.rgbToReflectance; exports.rgbUnitToHex = rgbUnitToHex; exports.rgbaViewOfGrey = _chunk7NW46N7Icjs.rgbaViewOfGrey; exports.runLayerFilters = _chunkUYXL6ZWQcjs.runLayerFilters; exports.runLayerFiltersFloat = _chunkUYXL6ZWQcjs.runLayerFiltersFloat; exports.runLayerMenuAction = runLayerMenuAction; exports.sameCanvasViewport = sameCanvasViewport; exports.sampleLut = _chunkUYXL6ZWQcjs.sampleLut; exports.sampleToneLut = _chunkUYXL6ZWQcjs.sampleToneLut; exports.saturationOf = _chunk7NW46N7Icjs.saturationOf; exports.scaleLayerEffect = _chunkHGTDMKNEcjs.scaleLayerEffect; exports.scalePaintGradient = _chunkEBDCRTZIcjs.scalePaintGradient; exports.seamlessClone = _chunk7NW46N7Icjs.seamlessClone; exports.seedFromString = _chunkEBDCRTZIcjs.seedFromString; exports.segmentToSelection = segmentToSelection; exports.segmentationOutlines = segmentationOutlines; exports.segmentsToSelection = segmentsToSelection; exports.selectObjectIn = selectObjectIn; exports.selectSimilar = selectSimilar; exports.selectionArea = _chunkUYXL6ZWQcjs.selectionArea; exports.selectionFromCoverage = _chunkUYXL6ZWQcjs.selectionFromCoverage; exports.selectionFromPixels = _chunkUYXL6ZWQcjs.selectionFromPixels; exports.selectionFromRegion = _chunkUYXL6ZWQcjs.selectionFromRegion; exports.selectionFromTiles = _chunkUYXL6ZWQcjs.selectionFromTiles; exports.selectionModeFromModifiers = selectionModeFromModifiers; exports.selectionOutline = selectionOutline; exports.selectionRing = selectionRing; exports.selectionToCoverage = _chunkUYXL6ZWQcjs.selectionToCoverage; exports.selectionToPixels = _chunkUYXL6ZWQcjs.selectionToPixels; exports.selectionToSubpaths = selectionToSubpaths; exports.selectionValueAt = _chunkUYXL6ZWQcjs.selectionValueAt; exports.serializeChannels = serializeChannels; exports.serializeColorMode = serializeColorMode; exports.serializeColorProfile = serializeColorProfile; exports.serializeContents = _chunkUYXL6ZWQcjs.serializeContents; exports.serializeEffects = _chunkUYXL6ZWQcjs.serializeEffects; exports.serializeLayer = _chunkUYXL6ZWQcjs.serializeLayer; exports.serializeLayers = _chunkUYXL6ZWQcjs.serializeLayers; exports.serializeLayersExternal = _chunkUYXL6ZWQcjs.serializeLayersExternal; exports.serializePatterns = _chunkUYXL6ZWQcjs.serializePatterns; exports.serializeSelection = _chunkUYXL6ZWQcjs.serializeSelection; exports.setCloneTransformValue = setCloneTransformValue; exports.setControlPath = setControlPath; exports.setLayerEffects = _chunkUYXL6ZWQcjs.setLayerEffects; exports.setLayerEffectsEnabled = _chunkUYXL6ZWQcjs.setLayerEffectsEnabled; exports.setLayerMask = _chunkUYXL6ZWQcjs.setLayerMask; exports.setLayerProperties = _chunkUYXL6ZWQcjs.setLayerProperties; exports.setLum = _chunkCWM3CUUXcjs.setLum; exports.setPigmentColor = _chunkCWM3CUUXcjs.setPigmentColor; exports.setRetouchChoice = setRetouchChoice; exports.setSmartFilterMask = _chunkUYXL6ZWQcjs.setSmartFilterMask; exports.setSmartFiltersEnabled = _chunkUYXL6ZWQcjs.setSmartFiltersEnabled; exports.setSmartPlacement = _chunkUYXL6ZWQcjs.setSmartPlacement; exports.shadeTile = _chunkV7GWZIZKcjs.shadeTile; exports.shapeAsPixelLayer = _chunkUYXL6ZWQcjs.shapeAsPixelLayer; exports.shapeFromAnnotation = _chunkUYXL6ZWQcjs.shapeFromAnnotation; exports.shapeGeometryBounds = _chunkUYXL6ZWQcjs.shapeGeometryBounds; exports.shapeLayers = _chunkUYXL6ZWQcjs.shapeLayers; exports.shapeOutline = _chunkUYXL6ZWQcjs.shapeOutline; exports.shapeRenderClip = _chunkUYXL6ZWQcjs.shapeRenderClip; exports.shiftCoverage = _chunkUYXL6ZWQcjs.shiftCoverage; exports.simplifyPixelPath = simplifyPixelPath; exports.skinToneRange = skinToneRange; exports.slicSuperpixels = slicSuperpixels; exports.smartFilterRows = smartFilterRows; exports.smartObjectLayers = _chunkUYXL6ZWQcjs.smartObjectLayers; exports.smoothCoverage = _chunkUYXL6ZWQcjs.smoothCoverage; exports.smoothPoints = _chunkEBDCRTZIcjs.smoothPoints; exports.smoothnessWeights = smoothnessWeights; exports.smudgeEffect = _chunk7NW46N7Icjs.smudgeEffect; exports.snapPolygonToEdges = snapPolygonToEdges; exports.snapTo45 = snapTo45; exports.snapToEdge = snapToEdge; exports.softMaskToSelection = softMaskToSelection; exports.solidPaint = _chunkEBDCRTZIcjs.solidPaint; exports.solidSurface = _chunkCWM3CUUXcjs.solidSurface; exports.solveMembrane = _chunk7NW46N7Icjs.solveMembrane; exports.spliceRuns = _chunkBRKVNXDZcjs.spliceRuns; exports.splitOverlayAnnotations = splitOverlayAnnotations; exports.sponge = _chunk7NW46N7Icjs.sponge; exports.spongeEffect = _chunk7NW46N7Icjs.spongeEffect; exports.spotHealPixels = _chunk7NW46N7Icjs.spotHealPixels; exports.spotHealWindow = _chunk7NW46N7Icjs.spotHealWindow; exports.srgb8ToLab = srgb8ToLab; exports.srgbByteToLinear = _chunkV7GWZIZKcjs.srgbByteToLinear; exports.srgbDecode = _chunkCWM3CUUXcjs.srgbDecode; exports.srgbEncode = _chunkCWM3CUUXcjs.srgbEncode; exports.srgbToLinear = _chunkUYXL6ZWQcjs.srgbToLinear; exports.standardBlendMode = _chunkCWM3CUUXcjs.standardBlendMode; exports.startMarchingAnts = startMarchingAnts; exports.stepSlotTs = _chunkV7GWZIZKcjs.stepSlotTs; exports.strokeGrainCatch = _chunkEBDCRTZIcjs.strokeGrainCatch; exports.styleAt = _chunkBRKVNXDZcjs.styleAt; exports.subpathsToSvgPath = subpathsToSvgPath; exports.sumHistograms = sumHistograms; exports.superpixelSaliency = superpixelSaliency; exports.surfaceBytes = _chunkCWM3CUUXcjs.surfaceBytes; exports.surfaceDepth = _chunkCWM3CUUXcjs.surfaceDepth; exports.surfaceFromDeepPixels = _chunkCWM3CUUXcjs.surfaceFromDeepPixels; exports.surfaceFromPixels = _chunkCWM3CUUXcjs.surfaceFromPixels; exports.surfacesEqual = _chunkCWM3CUUXcjs.surfacesEqual; exports.tempTintToXy = _chunkUYXL6ZWQcjs.tempTintToXy; exports.temperatureToKelvin = _chunkUYXL6ZWQcjs.temperatureToKelvin; exports.textIndexAt = _chunkBRKVNXDZcjs.textIndexAt; exports.textMatrix = _chunkUYXL6ZWQcjs.textMatrix; exports.textOrientation = _chunkUYXL6ZWQcjs.textOrientation; exports.textOutlines = _chunkUYXL6ZWQcjs.textOutlines; exports.textRange = _chunkUYXL6ZWQcjs.textRange; exports.tileCoord = _chunkCWM3CUUXcjs.tileCoord; exports.tileKey = _chunkCWM3CUUXcjs.tileKey; exports.tileRect = _chunkCWM3CUUXcjs.tileRect; exports.tileSamples = _chunkCWM3CUUXcjs.tileSamples; exports.tileSamples16 = _chunkCWM3CUUXcjs.tileSamples16; exports.tileSamples32 = _chunkCWM3CUUXcjs.tileSamples32; exports.tilesInRect = _chunkCWM3CUUXcjs.tilesInRect; exports.tipFalloff = _chunkEBDCRTZIcjs.tipFalloff; exports.tipReach = _chunkEBDCRTZIcjs.tipReach; exports.tipShape = _chunkEBDCRTZIcjs.tipShape; exports.to16From32 = _chunkCWM3CUUXcjs.to16From32; exports.to16From8 = _chunkCWM3CUUXcjs.to16From8; exports.to32From16 = _chunkCWM3CUUXcjs.to32From16; exports.to32From8 = _chunkCWM3CUUXcjs.to32From8; exports.to8From16 = _chunkCWM3CUUXcjs.to8From16; exports.to8From32 = _chunkCWM3CUUXcjs.to8From32; exports.toHex = toHex; exports.toTextSpace = _chunkUYXL6ZWQcjs.toTextSpace; exports.toneCurve = _chunkUYXL6ZWQcjs.toneCurve; exports.toneLuts = _chunkUYXL6ZWQcjs.toneLuts; exports.toneOf = _chunk7NW46N7Icjs.toneOf; exports.toneRange = toneRange; exports.transformHomography = _chunkUYXL6ZWQcjs.transformHomography; exports.transformMap = _chunkUYXL6ZWQcjs.transformMap; exports.transformShapeComponents = _chunkUYXL6ZWQcjs.transformShapeComponents; exports.transformSurface = _chunkHGTDMKNEcjs.transformSurface; exports.transformTypeLayer = _chunkUYXL6ZWQcjs.transformTypeLayer; exports.transformVectorMask = _chunkUYXL6ZWQcjs.transformVectorMask; exports.transformedBounds = _chunkHGTDMKNEcjs.transformedBounds; exports.transformedBox = _chunkUYXL6ZWQcjs.transformedBox; exports.transformedPoint = _chunkUYXL6ZWQcjs.transformedPoint; exports.translateLayer = _chunkUYXL6ZWQcjs.translateLayer; exports.translateSurface = _chunkCWM3CUUXcjs.translateSurface; exports.typeAsPixelLayer = _chunkUYXL6ZWQcjs.typeAsPixelLayer; exports.typeFrame = _chunkUYXL6ZWQcjs.typeFrame; exports.typeFromAnnotation = _chunkUYXL6ZWQcjs.typeFromAnnotation; exports.typeLayerAt = typeLayerAt; exports.typeLayerName = _chunkUYXL6ZWQcjs.typeLayerName; exports.ungroupLayer = _chunkUYXL6ZWQcjs.ungroupLayer; exports.uniformTile = _chunkCWM3CUUXcjs.uniformTile; exports.unionRect = _chunkUYXL6ZWQcjs.unionRect; exports.unprojectCanvasPoint = _chunkUYXL6ZWQcjs.unprojectCanvasPoint; exports.updateLayerEffect = _chunkUYXL6ZWQcjs.updateLayerEffect; exports.updateLayerFilter = _chunkUYXL6ZWQcjs.updateLayerFilter; exports.updateLayerMaskProps = _chunkUYXL6ZWQcjs.updateLayerMaskProps; exports.updatePaintGradientStop = _chunkEBDCRTZIcjs.updatePaintGradientStop; exports.updateShapeLayer = _chunkUYXL6ZWQcjs.updateShapeLayer; exports.updateSmartFilter = _chunkUYXL6ZWQcjs.updateSmartFilter; exports.updateTypeLayer = _chunkUYXL6ZWQcjs.updateTypeLayer; exports.upscaleRegion = upscaleRegion; exports.userErrorMessage = _chunkUYXL6ZWQcjs.userErrorMessage; exports.uvToXy = _chunkUYXL6ZWQcjs.uvToXy; exports.validateEffectGradient = _chunkHGTDMKNEcjs.validateEffectGradient; exports.validateLayerEffect = _chunkHGTDMKNEcjs.validateLayerEffect; exports.validateLayerEffects = _chunkHGTDMKNEcjs.validateLayerEffects; exports.vectorMaskBounds = _chunkUYXL6ZWQcjs.vectorMaskBounds; exports.vectorMaskCoverage = _chunkUYXL6ZWQcjs.vectorMaskCoverage; exports.vectorMaskThumbnail = _chunkUYXL6ZWQcjs.vectorMaskThumbnail; exports.vectorMaskThumbnailClick = vectorMaskThumbnailClick; exports.versionedDescriptorBytes = _chunkUYXL6ZWQcjs.versionedDescriptorBytes; exports.vibranceLinear = _chunkUYXL6ZWQcjs.vibranceLinear; exports.vibrancePixel = _chunkUYXL6ZWQcjs.vibrancePixel; exports.walkDabs = _chunkEBDCRTZIcjs.walkDabs; exports.warpMeshEditPoints = _chunkBRKVNXDZcjs.warpMeshEditPoints; exports.warpMeshGridCurves = _chunkBRKVNXDZcjs.warpMeshGridCurves; exports.warpMeshParamAt = _chunkBRKVNXDZcjs.warpMeshParamAt; exports.warpPresetMesh = _chunkBRKVNXDZcjs.warpPresetMesh; exports.warpSurface = _chunkHGTDMKNEcjs.warpSurface; exports.watchCanvasViewport = watchCanvasViewport; exports.wbMatrix = _chunkUYXL6ZWQcjs.wbMatrix; exports.wetGpuSupport = _chunkV7GWZIZKcjs.wetGpuSupport; exports.wetSimdSupported = _chunkV7GWZIZKcjs.wetSimdSupported; exports.wetSupport = _chunkV7GWZIZKcjs.wetSupport; exports.whiteBalanceFromSample = _chunkUYXL6ZWQcjs.whiteBalanceFromSample; exports.whiteBalanceMatrix = _chunkUYXL6ZWQcjs.whiteBalanceMatrix; exports.withBackgroundOpacity = withBackgroundOpacity; exports.withFilterMaskSurface = _chunkUYXL6ZWQcjs.withFilterMaskSurface; exports.withImagePlayback = withImagePlayback; exports.withNewIds = _chunkUYXL6ZWQcjs.withNewIds; exports.workImage = workImage; exports.workLuma = workLuma; exports.workPlanes = workPlanes; exports.writeAdjustmentBlock = _chunkUYXL6ZWQcjs.writeAdjustmentBlock; exports.writeDeepRegion = _chunkCWM3CUUXcjs.writeDeepRegion; exports.writeLfx2 = _chunkUYXL6ZWQcjs.writeLfx2; exports.writePatternBlock = _chunkUYXL6ZWQcjs.writePatternBlock; exports.writePsd = _chunkUYXL6ZWQcjs.writePsd; exports.writeRegion = _chunkCWM3CUUXcjs.writeRegion; exports.xyToTempTint = _chunkUYXL6ZWQcjs.xyToTempTint; exports.xyToUv = _chunkUYXL6ZWQcjs.xyToUv;