@blazediff/cli 5.0.5 → 6.0.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.
@@ -2128,7 +2128,7 @@ __export(dist_exports, {
2128
2128
  codecPngjs: () => w,
2129
2129
  default: () => g
2130
2130
  });
2131
- function h2(e) {
2131
+ function h(e) {
2132
2132
  if (!d) {
2133
2133
  let r = import_pngjs.PNG.sync.read(e);
2134
2134
  return Promise.resolve({ data: r.data, width: r.width, height: r.height });
@@ -2146,7 +2146,7 @@ function h2(e) {
2146
2146
  async function s(e) {
2147
2147
  try {
2148
2148
  let r = typeof e == "string" ? (0, import_fs.readFileSync)(e) : e;
2149
- return await h2(r);
2149
+ return await h(r);
2150
2150
  } catch (r) {
2151
2151
  throw new Error(`Failed to read PNG file ${e}: ${r}`);
2152
2152
  }
@@ -3201,8 +3201,8 @@ var require_lt = __commonJS({
3201
3201
  "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js"(exports2, module2) {
3202
3202
  "use strict";
3203
3203
  var compare = require_compare();
3204
- var lt = (a2, b, loose) => compare(a2, b, loose) < 0;
3205
- module2.exports = lt;
3204
+ var lt2 = (a2, b, loose) => compare(a2, b, loose) < 0;
3205
+ module2.exports = lt2;
3206
3206
  }
3207
3207
  });
3208
3208
 
@@ -3224,7 +3224,7 @@ var require_cmp = __commonJS({
3224
3224
  var neq = require_neq();
3225
3225
  var gt = require_gt();
3226
3226
  var gte = require_gte();
3227
- var lt = require_lt();
3227
+ var lt2 = require_lt();
3228
3228
  var lte = require_lte();
3229
3229
  var cmp = (a2, op, b, loose) => {
3230
3230
  switch (op) {
@@ -3255,7 +3255,7 @@ var require_cmp = __commonJS({
3255
3255
  case ">=":
3256
3256
  return gte(a2, b, loose);
3257
3257
  case "<":
3258
- return lt(a2, b, loose);
3258
+ return lt2(a2, b, loose);
3259
3259
  case "<=":
3260
3260
  return lte(a2, b, loose);
3261
3261
  default:
@@ -3570,20 +3570,20 @@ var require_range = __commonJS({
3570
3570
  };
3571
3571
  var replaceTilde = (comp, options) => {
3572
3572
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
3573
- return comp.replace(r, (_, M, m2, p3, pr) => {
3574
- debug("tilde", comp, _, M, m2, p3, pr);
3573
+ return comp.replace(r, (_, M, m2, p2, pr) => {
3574
+ debug("tilde", comp, _, M, m2, p2, pr);
3575
3575
  let ret;
3576
3576
  if (isX(M)) {
3577
3577
  ret = "";
3578
3578
  } else if (isX(m2)) {
3579
3579
  ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
3580
- } else if (isX(p3)) {
3580
+ } else if (isX(p2)) {
3581
3581
  ret = `>=${M}.${m2}.0 <${M}.${+m2 + 1}.0-0`;
3582
3582
  } else if (pr) {
3583
3583
  debug("replaceTilde pr", pr);
3584
- ret = `>=${M}.${m2}.${p3}-${pr} <${M}.${+m2 + 1}.0-0`;
3584
+ ret = `>=${M}.${m2}.${p2}-${pr} <${M}.${+m2 + 1}.0-0`;
3585
3585
  } else {
3586
- ret = `>=${M}.${m2}.${p3} <${M}.${+m2 + 1}.0-0`;
3586
+ ret = `>=${M}.${m2}.${p2} <${M}.${+m2 + 1}.0-0`;
3587
3587
  }
3588
3588
  debug("tilde return", ret);
3589
3589
  return ret;
@@ -3596,14 +3596,14 @@ var require_range = __commonJS({
3596
3596
  debug("caret", comp, options);
3597
3597
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
3598
3598
  const z = options.includePrerelease ? "-0" : "";
3599
- return comp.replace(r, (_, M, m2, p3, pr) => {
3600
- debug("caret", comp, _, M, m2, p3, pr);
3599
+ return comp.replace(r, (_, M, m2, p2, pr) => {
3600
+ debug("caret", comp, _, M, m2, p2, pr);
3601
3601
  let ret;
3602
3602
  if (isX(M)) {
3603
3603
  ret = "";
3604
3604
  } else if (isX(m2)) {
3605
3605
  ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
3606
- } else if (isX(p3)) {
3606
+ } else if (isX(p2)) {
3607
3607
  if (M === "0") {
3608
3608
  ret = `>=${M}.${m2}.0${z} <${M}.${+m2 + 1}.0-0`;
3609
3609
  } else {
@@ -3613,23 +3613,23 @@ var require_range = __commonJS({
3613
3613
  debug("replaceCaret pr", pr);
3614
3614
  if (M === "0") {
3615
3615
  if (m2 === "0") {
3616
- ret = `>=${M}.${m2}.${p3}-${pr} <${M}.${m2}.${+p3 + 1}-0`;
3616
+ ret = `>=${M}.${m2}.${p2}-${pr} <${M}.${m2}.${+p2 + 1}-0`;
3617
3617
  } else {
3618
- ret = `>=${M}.${m2}.${p3}-${pr} <${M}.${+m2 + 1}.0-0`;
3618
+ ret = `>=${M}.${m2}.${p2}-${pr} <${M}.${+m2 + 1}.0-0`;
3619
3619
  }
3620
3620
  } else {
3621
- ret = `>=${M}.${m2}.${p3}-${pr} <${+M + 1}.0.0-0`;
3621
+ ret = `>=${M}.${m2}.${p2}-${pr} <${+M + 1}.0.0-0`;
3622
3622
  }
3623
3623
  } else {
3624
3624
  debug("no pr");
3625
3625
  if (M === "0") {
3626
3626
  if (m2 === "0") {
3627
- ret = `>=${M}.${m2}.${p3}${z} <${M}.${m2}.${+p3 + 1}-0`;
3627
+ ret = `>=${M}.${m2}.${p2}${z} <${M}.${m2}.${+p2 + 1}-0`;
3628
3628
  } else {
3629
- ret = `>=${M}.${m2}.${p3}${z} <${M}.${+m2 + 1}.0-0`;
3629
+ ret = `>=${M}.${m2}.${p2}${z} <${M}.${+m2 + 1}.0-0`;
3630
3630
  }
3631
3631
  } else {
3632
- ret = `>=${M}.${m2}.${p3} <${+M + 1}.0.0-0`;
3632
+ ret = `>=${M}.${m2}.${p2} <${+M + 1}.0.0-0`;
3633
3633
  }
3634
3634
  }
3635
3635
  debug("caret return", ret);
@@ -3643,11 +3643,11 @@ var require_range = __commonJS({
3643
3643
  var replaceXRange = (comp, options) => {
3644
3644
  comp = comp.trim();
3645
3645
  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
3646
- return comp.replace(r, (ret, gtlt, M, m2, p3, pr) => {
3647
- debug("xRange", comp, ret, gtlt, M, m2, p3, pr);
3646
+ return comp.replace(r, (ret, gtlt, M, m2, p2, pr) => {
3647
+ debug("xRange", comp, ret, gtlt, M, m2, p2, pr);
3648
3648
  const xM = isX(M);
3649
3649
  const xm = xM || isX(m2);
3650
- const xp = xm || isX(p3);
3650
+ const xp = xm || isX(p2);
3651
3651
  const anyX = xp;
3652
3652
  if (gtlt === "=" && anyX) {
3653
3653
  gtlt = "";
@@ -3663,16 +3663,16 @@ var require_range = __commonJS({
3663
3663
  if (xm) {
3664
3664
  m2 = 0;
3665
3665
  }
3666
- p3 = 0;
3666
+ p2 = 0;
3667
3667
  if (gtlt === ">") {
3668
3668
  gtlt = ">=";
3669
3669
  if (xm) {
3670
3670
  M = +M + 1;
3671
3671
  m2 = 0;
3672
- p3 = 0;
3672
+ p2 = 0;
3673
3673
  } else {
3674
3674
  m2 = +m2 + 1;
3675
- p3 = 0;
3675
+ p2 = 0;
3676
3676
  }
3677
3677
  } else if (gtlt === "<=") {
3678
3678
  gtlt = "<";
@@ -3685,7 +3685,7 @@ var require_range = __commonJS({
3685
3685
  if (gtlt === "<") {
3686
3686
  pr = "-0";
3687
3687
  }
3688
- ret = `${gtlt + M}.${m2}.${p3}${pr}`;
3688
+ ret = `${gtlt + M}.${m2}.${p2}${pr}`;
3689
3689
  } else if (xm) {
3690
3690
  ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
3691
3691
  } else if (xp) {
@@ -4551,7 +4551,7 @@ var require_input = __commonJS({
4551
4551
  "tiffSubifd"
4552
4552
  ];
4553
4553
  function _inputOptionsFromObject(obj) {
4554
- const params = inputStreamParameters.filter((p3) => is.defined(obj[p3])).map((p3) => [p3, obj[p3]]);
4554
+ const params = inputStreamParameters.filter((p2) => is.defined(obj[p2])).map((p2) => [p2, obj[p2]]);
4555
4555
  return params.length ? Object.fromEntries(params) : void 0;
4556
4556
  }
4557
4557
  function _createInputDescriptor(input, inputOptions, containerOptions) {
@@ -6255,11 +6255,11 @@ var require_color = __commonJS({
6255
6255
  const match = string.match(hsl);
6256
6256
  if (match) {
6257
6257
  const alpha = Number.parseFloat(match[4]);
6258
- const h5 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
6258
+ const h4 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
6259
6259
  const s2 = clamp(Number.parseFloat(match[2]), 0, 100);
6260
6260
  const l = clamp(Number.parseFloat(match[3]), 0, 100);
6261
6261
  const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
6262
- return [h5, s2, l, a2];
6262
+ return [h4, s2, l, a2];
6263
6263
  }
6264
6264
  return null;
6265
6265
  };
@@ -6271,11 +6271,11 @@ var require_color = __commonJS({
6271
6271
  const match = string.match(hwb);
6272
6272
  if (match) {
6273
6273
  const alpha = Number.parseFloat(match[4]);
6274
- const h5 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
6274
+ const h4 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
6275
6275
  const w3 = clamp(Number.parseFloat(match[2]), 0, 100);
6276
6276
  const b = clamp(Number.parseFloat(match[3]), 0, 100);
6277
6277
  const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
6278
- return [h5, w3, b, a2];
6278
+ return [h4, w3, b, a2];
6279
6279
  }
6280
6280
  return null;
6281
6281
  };
@@ -6367,29 +6367,29 @@ var require_color = __commonJS({
6367
6367
  const min = Math.min(r, g2, b);
6368
6368
  const max = Math.max(r, g2, b);
6369
6369
  const delta = max - min;
6370
- let h5;
6370
+ let h4;
6371
6371
  let s2;
6372
6372
  switch (max) {
6373
6373
  case min: {
6374
- h5 = 0;
6374
+ h4 = 0;
6375
6375
  break;
6376
6376
  }
6377
6377
  case r: {
6378
- h5 = (g2 - b) / delta;
6378
+ h4 = (g2 - b) / delta;
6379
6379
  break;
6380
6380
  }
6381
6381
  case g2: {
6382
- h5 = 2 + (b - r) / delta;
6382
+ h4 = 2 + (b - r) / delta;
6383
6383
  break;
6384
6384
  }
6385
6385
  case b: {
6386
- h5 = 4 + (r - g2) / delta;
6386
+ h4 = 4 + (r - g2) / delta;
6387
6387
  break;
6388
6388
  }
6389
6389
  }
6390
- h5 = Math.min(h5 * 60, 360);
6391
- if (h5 < 0) {
6392
- h5 += 360;
6390
+ h4 = Math.min(h4 * 60, 360);
6391
+ if (h4 < 0) {
6392
+ h4 += 360;
6393
6393
  }
6394
6394
  const l = (min + max) / 2;
6395
6395
  if (max === min) {
@@ -6399,13 +6399,13 @@ var require_color = __commonJS({
6399
6399
  } else {
6400
6400
  s2 = delta / (2 - max - min);
6401
6401
  }
6402
- return [h5, s2 * 100, l * 100];
6402
+ return [h4, s2 * 100, l * 100];
6403
6403
  };
6404
6404
  convert.rgb.hsv = function(rgb) {
6405
6405
  let rdif;
6406
6406
  let gdif;
6407
6407
  let bdif;
6408
- let h5;
6408
+ let h4;
6409
6409
  let s2;
6410
6410
  const r = rgb[0] / 255;
6411
6411
  const g2 = rgb[1] / 255;
@@ -6416,7 +6416,7 @@ var require_color = __commonJS({
6416
6416
  return (v - c3) / 6 / diff + 1 / 2;
6417
6417
  };
6418
6418
  if (diff === 0) {
6419
- h5 = 0;
6419
+ h4 = 0;
6420
6420
  s2 = 0;
6421
6421
  } else {
6422
6422
  s2 = diff / v;
@@ -6425,26 +6425,26 @@ var require_color = __commonJS({
6425
6425
  bdif = diffc(b);
6426
6426
  switch (v) {
6427
6427
  case r: {
6428
- h5 = bdif - gdif;
6428
+ h4 = bdif - gdif;
6429
6429
  break;
6430
6430
  }
6431
6431
  case g2: {
6432
- h5 = 1 / 3 + rdif - bdif;
6432
+ h4 = 1 / 3 + rdif - bdif;
6433
6433
  break;
6434
6434
  }
6435
6435
  case b: {
6436
- h5 = 2 / 3 + gdif - rdif;
6436
+ h4 = 2 / 3 + gdif - rdif;
6437
6437
  break;
6438
6438
  }
6439
6439
  }
6440
- if (h5 < 0) {
6441
- h5 += 1;
6442
- } else if (h5 > 1) {
6443
- h5 -= 1;
6440
+ if (h4 < 0) {
6441
+ h4 += 1;
6442
+ } else if (h4 > 1) {
6443
+ h4 -= 1;
6444
6444
  }
6445
6445
  }
6446
6446
  return [
6447
- h5 * 360,
6447
+ h4 * 360,
6448
6448
  s2 * 100,
6449
6449
  v * 100
6450
6450
  ];
@@ -6453,10 +6453,10 @@ var require_color = __commonJS({
6453
6453
  const r = rgb[0];
6454
6454
  const g2 = rgb[1];
6455
6455
  let b = rgb[2];
6456
- const h5 = convert.rgb.hsl(rgb)[0];
6456
+ const h4 = convert.rgb.hsl(rgb)[0];
6457
6457
  const w3 = 1 / 255 * Math.min(r, Math.min(g2, b));
6458
6458
  b = 1 - 1 / 255 * Math.max(r, Math.max(g2, b));
6459
- return [h5, w3 * 100, b * 100];
6459
+ return [h4, w3 * 100, b * 100];
6460
6460
  };
6461
6461
  convert.rgb.oklab = function(rgb) {
6462
6462
  const r = srgbNonlinearTransformInv(rgb[0] / 255);
@@ -6529,7 +6529,7 @@ var require_color = __commonJS({
6529
6529
  return [l, a2, b];
6530
6530
  };
6531
6531
  convert.hsl.rgb = function(hsl) {
6532
- const h5 = hsl[0] / 360;
6532
+ const h4 = hsl[0] / 360;
6533
6533
  const s2 = hsl[1] / 100;
6534
6534
  const l = hsl[2] / 100;
6535
6535
  let t3;
@@ -6542,7 +6542,7 @@ var require_color = __commonJS({
6542
6542
  const t1 = 2 * l - t2;
6543
6543
  const rgb = [0, 0, 0];
6544
6544
  for (let i3 = 0; i3 < 3; i3++) {
6545
- t3 = h5 + 1 / 3 * -(i3 - 1);
6545
+ t3 = h4 + 1 / 3 * -(i3 - 1);
6546
6546
  if (t3 < 0) {
6547
6547
  t3++;
6548
6548
  }
@@ -6563,7 +6563,7 @@ var require_color = __commonJS({
6563
6563
  return rgb;
6564
6564
  };
6565
6565
  convert.hsl.hsv = function(hsl) {
6566
- const h5 = hsl[0];
6566
+ const h4 = hsl[0];
6567
6567
  let s2 = hsl[1] / 100;
6568
6568
  let l = hsl[2] / 100;
6569
6569
  let smin = s2;
@@ -6573,41 +6573,41 @@ var require_color = __commonJS({
6573
6573
  smin *= lmin <= 1 ? lmin : 2 - lmin;
6574
6574
  const v = (l + s2) / 2;
6575
6575
  const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s2 / (l + s2);
6576
- return [h5, sv * 100, v * 100];
6576
+ return [h4, sv * 100, v * 100];
6577
6577
  };
6578
6578
  convert.hsv.rgb = function(hsv) {
6579
- const h5 = hsv[0] / 60;
6579
+ const h4 = hsv[0] / 60;
6580
6580
  const s2 = hsv[1] / 100;
6581
6581
  let v = hsv[2] / 100;
6582
- const hi = Math.floor(h5) % 6;
6583
- const f = h5 - Math.floor(h5);
6584
- const p3 = 255 * v * (1 - s2);
6582
+ const hi = Math.floor(h4) % 6;
6583
+ const f = h4 - Math.floor(h4);
6584
+ const p2 = 255 * v * (1 - s2);
6585
6585
  const q = 255 * v * (1 - s2 * f);
6586
6586
  const t = 255 * v * (1 - s2 * (1 - f));
6587
6587
  v *= 255;
6588
6588
  switch (hi) {
6589
6589
  case 0: {
6590
- return [v, t, p3];
6590
+ return [v, t, p2];
6591
6591
  }
6592
6592
  case 1: {
6593
- return [q, v, p3];
6593
+ return [q, v, p2];
6594
6594
  }
6595
6595
  case 2: {
6596
- return [p3, v, t];
6596
+ return [p2, v, t];
6597
6597
  }
6598
6598
  case 3: {
6599
- return [p3, q, v];
6599
+ return [p2, q, v];
6600
6600
  }
6601
6601
  case 4: {
6602
- return [t, p3, v];
6602
+ return [t, p2, v];
6603
6603
  }
6604
6604
  case 5: {
6605
- return [v, p3, q];
6605
+ return [v, p2, q];
6606
6606
  }
6607
6607
  }
6608
6608
  };
6609
6609
  convert.hsv.hsl = function(hsv) {
6610
- const h5 = hsv[0];
6610
+ const h4 = hsv[0];
6611
6611
  const s2 = hsv[1] / 100;
6612
6612
  const v = hsv[2] / 100;
6613
6613
  const vmin = Math.max(v, 0.01);
@@ -6619,10 +6619,10 @@ var require_color = __commonJS({
6619
6619
  sl /= lmin <= 1 ? lmin : 2 - lmin;
6620
6620
  sl = sl || 0;
6621
6621
  l /= 2;
6622
- return [h5, sl * 100, l * 100];
6622
+ return [h4, sl * 100, l * 100];
6623
6623
  };
6624
6624
  convert.hwb.rgb = function(hwb) {
6625
- const h5 = hwb[0] / 360;
6625
+ const h4 = hwb[0] / 360;
6626
6626
  let wh = hwb[1] / 100;
6627
6627
  let bl = hwb[2] / 100;
6628
6628
  const ratio = wh + bl;
@@ -6631,9 +6631,9 @@ var require_color = __commonJS({
6631
6631
  wh /= ratio;
6632
6632
  bl /= ratio;
6633
6633
  }
6634
- const i3 = Math.floor(6 * h5);
6634
+ const i3 = Math.floor(6 * h4);
6635
6635
  const v = 1 - bl;
6636
- f = 6 * h5 - i3;
6636
+ f = 6 * h4 - i3;
6637
6637
  if ((i3 & 1) !== 0) {
6638
6638
  f = 1 - f;
6639
6639
  }
@@ -6790,20 +6790,20 @@ var require_color = __commonJS({
6790
6790
  const l = lab[0];
6791
6791
  const a2 = lab[1];
6792
6792
  const b = lab[2];
6793
- let h5;
6793
+ let h4;
6794
6794
  const hr = Math.atan2(b, a2);
6795
- h5 = hr * 360 / 2 / Math.PI;
6796
- if (h5 < 0) {
6797
- h5 += 360;
6795
+ h4 = hr * 360 / 2 / Math.PI;
6796
+ if (h4 < 0) {
6797
+ h4 += 360;
6798
6798
  }
6799
6799
  const c3 = Math.sqrt(a2 * a2 + b * b);
6800
- return [l, c3, h5];
6800
+ return [l, c3, h4];
6801
6801
  };
6802
6802
  convert.lch.lab = function(lch) {
6803
6803
  const l = lch[0];
6804
6804
  const c3 = lch[1];
6805
- const h5 = lch[2];
6806
- const hr = h5 / 360 * 2 * Math.PI;
6805
+ const h4 = lch[2];
6806
+ const hr = h4 / 360 * 2 * Math.PI;
6807
6807
  const a2 = c3 * Math.cos(hr);
6808
6808
  const b = c3 * Math.sin(hr);
6809
6809
  return [l, a2, b];
@@ -6932,14 +6932,14 @@ var require_color = __commonJS({
6932
6932
  return [hsv[0], c3 * 100, f * 100];
6933
6933
  };
6934
6934
  convert.hcg.rgb = function(hcg) {
6935
- const h5 = hcg[0] / 360;
6935
+ const h4 = hcg[0] / 360;
6936
6936
  const c3 = hcg[1] / 100;
6937
6937
  const g2 = hcg[2] / 100;
6938
6938
  if (c3 === 0) {
6939
6939
  return [g2 * 255, g2 * 255, g2 * 255];
6940
6940
  }
6941
6941
  const pure = [0, 0, 0];
6942
- const hi = h5 % 1 * 6;
6942
+ const hi = h4 % 1 * 6;
6943
6943
  const v = hi % 1;
6944
6944
  const w3 = 1 - v;
6945
6945
  let mg = 0;
@@ -7471,8 +7471,8 @@ var require_color = __commonJS({
7471
7471
  }
7472
7472
  const color1 = mixinColor.rgb();
7473
7473
  const color2 = this.rgb();
7474
- const p3 = weight === void 0 ? 0.5 : weight;
7475
- const w3 = 2 * p3 - 1;
7474
+ const p2 = weight === void 0 ? 0.5 : weight;
7475
+ const w3 = 2 * p2 - 1;
7476
7476
  const a2 = color1.alpha() - color2.alpha();
7477
7477
  const w1 = ((w3 * a2 === -1 ? w3 : (w3 + a2) / (1 + w3 * a2)) + 1) / 2;
7478
7478
  const w22 = 1 - w1;
@@ -7480,7 +7480,7 @@ var require_color = __commonJS({
7480
7480
  w1 * color1.red() + w22 * color2.red(),
7481
7481
  w1 * color1.green() + w22 * color2.green(),
7482
7482
  w1 * color1.blue() + w22 * color2.blue(),
7483
- color1.alpha() * p3 + color2.alpha() * (1 - p3)
7483
+ color1.alpha() * p2 + color2.alpha() * (1 - p2)
7484
7484
  );
7485
7485
  }
7486
7486
  };
@@ -8738,7 +8738,7 @@ var require_lib = __commonJS({
8738
8738
  var dist_exports2 = {};
8739
8739
  __export(dist_exports2, {
8740
8740
  codecSharp: () => n,
8741
- default: () => h3
8741
+ default: () => h2
8742
8742
  });
8743
8743
  async function a(r) {
8744
8744
  try {
@@ -8757,13 +8757,13 @@ async function o(r, e) {
8757
8757
  throw new Error(`Failed to write image file ${e}: ${t}`);
8758
8758
  }
8759
8759
  }
8760
- var import_sharp, n, h3;
8760
+ var import_sharp, n, h2;
8761
8761
  var init_dist2 = __esm({
8762
8762
  "../codec-sharp/dist/index.mjs"() {
8763
8763
  "use strict";
8764
8764
  import_sharp = __toESM(require_lib(), 1);
8765
8765
  n = { read: a, write: o };
8766
- h3 = n;
8766
+ h2 = n;
8767
8767
  }
8768
8768
  });
8769
8769
 
@@ -9087,7 +9087,7 @@ var init_encode = __esm({
9087
9087
  var dist_exports3 = {};
9088
9088
  __export(dist_exports3, {
9089
9089
  codecJsquashPng: () => w2,
9090
- default: () => p2
9090
+ default: () => p
9091
9091
  });
9092
9092
  function c2() {
9093
9093
  return o2 || (o2 = (async () => {
@@ -9095,7 +9095,7 @@ function c2() {
9095
9095
  return await Promise.all([n2.init(t), r.init(t)]), { decode: n2.default, encode: r.default };
9096
9096
  })(), o2);
9097
9097
  }
9098
- async function h4(e) {
9098
+ async function h3(e) {
9099
9099
  try {
9100
9100
  let { decode: a2 } = await c2(), t = typeof e == "string" ? (0, import_fs2.readFileSync)(e) : e, n2 = new Uint8Array(t).buffer, r = await a2(n2);
9101
9101
  return { data: r.data, width: r.width, height: r.height };
@@ -9111,7 +9111,7 @@ async function m(e, a2) {
9111
9111
  throw new Error(`Failed to write PNG file ${a2}: ${t}`);
9112
9112
  }
9113
9113
  }
9114
- var import_fs2, import_path, i2, o2, w2, p2;
9114
+ var import_fs2, import_path, i2, o2, w2, p;
9115
9115
  var init_dist3 = __esm({
9116
9116
  "../codec-jsquash-png/dist/index.mjs"() {
9117
9117
  "use strict";
@@ -9122,8 +9122,8 @@ var init_dist3 = __esm({
9122
9122
  throw Error('Dynamic require of "' + e + '" is not supported');
9123
9123
  });
9124
9124
  o2 = null;
9125
- w2 = { read: h4, write: m };
9126
- p2 = w2;
9125
+ w2 = { read: h3, write: m };
9126
+ p = w2;
9127
9127
  }
9128
9128
  });
9129
9129
 
@@ -9135,66 +9135,81 @@ __export(hitchhikers_ssim_exports, {
9135
9135
  module.exports = __toCommonJS(hitchhikers_ssim_exports);
9136
9136
 
9137
9137
  // ../ssim/dist/hitchhikers-ssim.mjs
9138
- function U(o3, a2, c3) {
9139
- let n2 = new Float32Array(a2 * c3), r = 0;
9140
- for (let s2 = 0; s2 < o3.length; s2 += 4) {
9141
- let t = o3[s2], e = o3[s2 + 1], u = o3[s2 + 2];
9142
- n2[r++] = 0.298936 * t + 0.587043 * e + 0.114021 * u;
9138
+ function E(t, r) {
9139
+ let { data: e, width: n2, height: s2 } = t ?? {};
9140
+ if (!ArrayBuffer.isView(e) || e.BYTES_PER_ELEMENT !== 1) throw new TypeError(`${r}.data must be a Uint8Array, Uint8ClampedArray or Buffer.`);
9141
+ if (!Number.isInteger(n2) || !Number.isInteger(s2) || n2 < 1 || s2 < 1) throw new RangeError(`${r} has an invalid size: ${n2}x${s2}.`);
9142
+ if (e.length !== n2 * s2 * 4) throw new RangeError(`${r}.data is ${e.length} bytes, expected ${n2 * s2 * 4} for ${n2}x${s2}.`);
9143
+ }
9144
+ function N(t, r, e) {
9145
+ if (E(t, "a"), E(r, "b"), t.width !== r.width || t.height !== r.height) return { kind: "dimension-mismatch", a: { width: t.width, height: t.height }, b: { width: r.width, height: r.height } };
9146
+ if (e && (E(e, "output"), e.width !== t.width || e.height !== t.height)) throw new RangeError(`output is ${e.width}x${e.height}, expected ${t.width}x${t.height}.`);
9147
+ return null;
9148
+ }
9149
+ function $(t, r, e) {
9150
+ let n2 = new Float32Array(r * e), s2 = 0;
9151
+ for (let c3 = 0; c3 < t.length; c3 += 4) {
9152
+ let a2 = t[c3], o3 = t[c3 + 1], u = t[c3 + 2];
9153
+ n2[s2++] = 0.298936 * a2 + 0.587043 * o3 + 0.114021 * u;
9143
9154
  }
9144
9155
  return n2;
9145
9156
  }
9146
- function h(o3, a2, c3, n2, r, s2 = {}) {
9147
- let { windowSize: t = 11, windowStride: e = t, k1: u = 0.01, k2: i3 = 0.03, L: d2 = 255, covPooling: v = true } = s2, g2 = U(o3, n2, r), b = U(a2, n2, r), y = (u * d2) ** 2, O = (i3 * d2) ** 2, Y = F(g2, n2, r), z = F(b, n2, r), P = new Float32Array(n2 * r), G = new Float32Array(n2 * r), H = new Float32Array(n2 * r);
9148
- for (let l = 0; l < g2.length; l++) {
9149
- let m2 = g2[l], f = b[l];
9150
- P[l] = m2 * m2, G[l] = f * f, H[l] = m2 * f;
9157
+ function et(t, r, e = {}) {
9158
+ let n2 = N(t, r, e.output);
9159
+ return n2 || { kind: "compared", score: rt(t, r, e) };
9160
+ }
9161
+ function rt(t, r, e) {
9162
+ let { windowSize: n2 = 11, k1: s2 = 0.01, k2: c3 = 0.03, bitDepth: a2 = 8 } = e, { windowStride: o3 = n2, covPooling: u = true } = e.hitchhikers ?? {}, { width: i3, height: m2 } = t, b = e.output?.data, p2 = 2 ** a2 - 1, f = $(t.data, i3, m2), d2 = $(r.data, i3, m2), R = (s2 * p2) ** 2, U = (c3 * p2) ** 2, Y = A(f, i3, m2), D = A(d2, i3, m2), z = new Float32Array(i3 * m2), O = new Float32Array(i3 * m2), P = new Float32Array(i3 * m2);
9163
+ for (let l = 0; l < f.length; l++) {
9164
+ let h4 = f[l], g2 = d2[l];
9165
+ z[l] = h4 * h4, O[l] = g2 * g2, P[l] = h4 * g2;
9151
9166
  }
9152
- let D = F(P, n2, r), V = F(G, n2, r), j = F(H, n2, r), M = Math.floor((n2 - t) / e) + 1, I = Math.floor((r - t) / e) + 1, A = new Float32Array(M * I), x = t * t, E = 0;
9153
- for (let l = 0; l < I; l++) {
9154
- let m2 = l * e, f = m2 + t;
9155
- for (let k = 0; k < M; k++) {
9156
- let S = k * e, q = S + t, J = p(Y, S, m2, q, f, n2), K = p(z, S, m2, q, f, n2), N = p(D, S, m2, q, f, n2), Q = p(V, S, m2, q, f, n2), R = p(j, S, m2, q, f, n2), B = J / x, C = K / x, L = B * B, T = C * C, X = B * C, W = N / x - L, Z = Q / x - T, _ = R / x - X, $ = (2 * X + y) * (2 * _ + O), w3 = (L + T + y) * (W + Z + O);
9157
- A[E++] = $ / w3;
9167
+ let G = A(z, i3, m2), L = A(O, i3, m2), V = A(P, i3, m2), q = Math.floor((i3 - n2) / o3) + 1, F = Math.floor((m2 - n2) / o3) + 1, y = new Float32Array(q * F), S = n2 * n2, X = 0;
9168
+ for (let l = 0; l < F; l++) {
9169
+ let h4 = l * o3, g2 = h4 + n2;
9170
+ for (let k = 0; k < q; k++) {
9171
+ let w3 = k * o3, x = w3 + n2, _ = I(Y, w3, h4, x, g2, i3), H = I(D, w3, h4, x, g2, i3), j = I(G, w3, h4, x, g2, i3), J = I(L, w3, h4, x, g2, i3), K = I(V, w3, h4, x, g2, i3), M = _ / S, v = H / S, T = M * M, B = v * v, C = M * v, Q = j / S - T, W = J / S - B, Z = K / S - C, tt = (2 * C + R) * (2 * Z + U), nt = (T + B + R) * (Q + W + U);
9172
+ y[X++] = tt / nt;
9158
9173
  }
9159
9174
  }
9160
- if (c3 && on(c3, A, M, I, n2, r), v) return nn(A);
9175
+ if (b && it(b, y, q, F, i3, m2), u) return ot(y);
9161
9176
  {
9162
9177
  let l = 0;
9163
- for (let m2 = 0; m2 < A.length; m2++) l += A[m2];
9164
- return l / A.length;
9178
+ for (let h4 = 0; h4 < y.length; h4++) l += y[h4];
9179
+ return l / y.length;
9165
9180
  }
9166
9181
  }
9167
- function F(o3, a2, c3) {
9168
- let n2 = a2 + 1, r = c3 + 1, s2 = new Float64Array(n2 * r);
9169
- for (let t = 1; t <= c3; t++) for (let e = 1; e <= a2; e++) {
9170
- let u = (t - 1) * a2 + (e - 1), i3 = t * n2 + e;
9171
- s2[i3] = o3[u] + s2[(t - 1) * n2 + e] + s2[t * n2 + (e - 1)] - s2[(t - 1) * n2 + (e - 1)];
9182
+ function A(t, r, e) {
9183
+ let n2 = r + 1, s2 = e + 1, c3 = new Float64Array(n2 * s2);
9184
+ for (let a2 = 1; a2 <= e; a2++) for (let o3 = 1; o3 <= r; o3++) {
9185
+ let u = (a2 - 1) * r + (o3 - 1), i3 = a2 * n2 + o3;
9186
+ c3[i3] = t[u] + c3[(a2 - 1) * n2 + o3] + c3[a2 * n2 + (o3 - 1)] - c3[(a2 - 1) * n2 + (o3 - 1)];
9172
9187
  }
9173
- return s2;
9188
+ return c3;
9174
9189
  }
9175
- function p(o3, a2, c3, n2, r, s2) {
9176
- let t = s2 + 1;
9177
- return o3[r * t + n2] - o3[c3 * t + n2] - o3[r * t + a2] + o3[c3 * t + a2];
9190
+ function I(t, r, e, n2, s2, c3) {
9191
+ let a2 = c3 + 1;
9192
+ return t[s2 * a2 + n2] - t[e * a2 + n2] - t[s2 * a2 + r] + t[e * a2 + r];
9178
9193
  }
9179
- function nn(o3) {
9180
- let a2 = 0;
9181
- for (let e = 0; e < o3.length; e++) a2 += o3[e];
9182
- let c3 = a2 / o3.length, n2 = 0;
9183
- for (let e = 0; e < o3.length; e++) {
9184
- let u = o3[e] - c3;
9194
+ function ot(t) {
9195
+ let r = 0;
9196
+ for (let o3 = 0; o3 < t.length; o3++) r += t[o3];
9197
+ let e = r / t.length, n2 = 0;
9198
+ for (let o3 = 0; o3 < t.length; o3++) {
9199
+ let u = t[o3] - e;
9185
9200
  n2 += u * u;
9186
9201
  }
9187
- let r = n2 / o3.length, s2 = Math.sqrt(r);
9188
- return 1 - (c3 > 0 ? s2 / c3 : 0);
9202
+ let s2 = n2 / t.length, c3 = Math.sqrt(s2);
9203
+ return 1 - (e > 0 ? c3 / e : 0);
9189
9204
  }
9190
- function on(o3, a2, c3, n2, r, s2) {
9191
- let t = r / c3, e = s2 / n2;
9192
- for (let u = 0; u < s2; u++) for (let i3 = 0; i3 < r; i3++) {
9193
- let d2 = Math.min(Math.floor(i3 / t), c3 - 1), v = Math.min(Math.floor(u / e), n2 - 1), g2 = a2[v * c3 + d2], b = Math.floor(Math.max(0, Math.min(1, g2)) * 255), y = (u * r + i3) * 4;
9194
- o3[y] = b, o3[y + 1] = b, o3[y + 2] = b, o3[y + 3] = 255;
9205
+ function it(t, r, e, n2, s2, c3) {
9206
+ let a2 = s2 / e, o3 = c3 / n2;
9207
+ for (let u = 0; u < c3; u++) for (let i3 = 0; i3 < s2; i3++) {
9208
+ let m2 = Math.min(Math.floor(i3 / a2), e - 1), b = Math.min(Math.floor(u / o3), n2 - 1), p2 = r[b * e + m2], f = Math.floor(Math.max(0, Math.min(1, p2)) * 255), d2 = (u * s2 + i3) * 4;
9209
+ t[d2] = f, t[d2 + 1] = f, t[d2 + 2] = f, t[d2 + 3] = 255;
9195
9210
  }
9196
9211
  }
9197
- var en = h;
9212
+ var lt = et;
9198
9213
 
9199
9214
  // src/commands/hitchhikers-ssim.ts
9200
9215
  function printUsage() {
@@ -9312,35 +9327,40 @@ async function main() {
9312
9327
  codec.read(image1),
9313
9328
  codec.read(image2)
9314
9329
  ]);
9315
- if (img1.width !== img2.width || img1.height !== img2.height) {
9316
- throw new Error(
9317
- `Image dimensions do not match: ${img1.width}x${img1.height} vs ${img2.width}x${img2.height}`
9318
- );
9319
- }
9320
9330
  let outputData;
9321
9331
  if (options.outputPath) {
9322
9332
  outputData = new Uint8Array(img1.data.length);
9323
9333
  }
9324
- const ssimOptions = {};
9334
+ const output = outputData && {
9335
+ data: outputData,
9336
+ width: img1.width,
9337
+ height: img1.height
9338
+ };
9339
+ const ssimOptions = { hitchhikers: {}, output };
9325
9340
  if (typeof options.windowSize === "number") {
9326
9341
  ssimOptions.windowSize = options.windowSize;
9327
9342
  }
9328
9343
  if (typeof options.windowStride === "number") {
9329
- ssimOptions.windowStride = options.windowStride;
9344
+ ssimOptions.hitchhikers = {
9345
+ ...ssimOptions.hitchhikers,
9346
+ windowStride: options.windowStride
9347
+ };
9330
9348
  }
9331
9349
  if (typeof options.covPooling === "boolean") {
9332
- ssimOptions.covPooling = options.covPooling;
9350
+ ssimOptions.hitchhikers = {
9351
+ ...ssimOptions.hitchhikers,
9352
+ covPooling: options.covPooling
9353
+ };
9333
9354
  }
9334
9355
  const startTime = performance.now();
9335
- const score = en(
9336
- img1.data,
9337
- img2.data,
9338
- outputData,
9339
- img1.width,
9340
- img1.height,
9341
- ssimOptions
9342
- );
9356
+ const comparison = lt(img1, img2, ssimOptions);
9343
9357
  const duration = performance.now() - startTime;
9358
+ if (comparison.kind === "dimension-mismatch") {
9359
+ throw new Error(
9360
+ `Image dimensions do not match: ${img1.width}x${img1.height} vs ${img2.width}x${img2.height}`
9361
+ );
9362
+ }
9363
+ const score = comparison.score;
9344
9364
  if (options.outputPath && outputData) {
9345
9365
  await codec.write(
9346
9366
  {
@@ -9356,9 +9376,9 @@ async function main() {
9356
9376
  width: img1.width,
9357
9377
  height: img1.height,
9358
9378
  duration,
9359
- poolingMethod: ssimOptions.covPooling === false ? "mean" : "CoV",
9379
+ poolingMethod: ssimOptions.hitchhikers?.covPooling === false ? "mean" : "CoV",
9360
9380
  windowSize: ssimOptions.windowSize || 11,
9361
- windowStride: ssimOptions.windowStride || ssimOptions.windowSize || 11
9381
+ windowStride: ssimOptions.hitchhikers?.windowStride || ssimOptions.windowSize || 11
9362
9382
  };
9363
9383
  console.log(`completed in: ${result.duration.toFixed(2)}ms`);
9364
9384
  console.log(`dimensions: ${result.width}x${result.height}`);