@blazediff/cli 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +376 -362
- package/dist/commands/core-wasm.js +213 -199
- package/dist/commands/core.js +268 -254
- package/dist/commands/gmsd.js +230 -216
- package/dist/commands/hitchhikers-ssim.js +234 -220
- package/dist/commands/msssim.js +238 -224
- package/dist/commands/ssim.js +254 -240
- package/package.json +3 -3
package/dist/commands/gmsd.js
CHANGED
|
@@ -2125,37 +2125,51 @@ var require_png = __commonJS({
|
|
|
2125
2125
|
// ../codec-pngjs/dist/index.mjs
|
|
2126
2126
|
var dist_exports = {};
|
|
2127
2127
|
__export(dist_exports, {
|
|
2128
|
-
codecPngjs: () =>
|
|
2129
|
-
default: () =>
|
|
2128
|
+
codecPngjs: () => w,
|
|
2129
|
+
default: () => g
|
|
2130
2130
|
});
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2131
|
+
function h(e) {
|
|
2132
|
+
if (!d) {
|
|
2133
|
+
let r = import_pngjs.PNG.sync.read(e);
|
|
2134
|
+
return Promise.resolve({ data: r.data, width: r.width, height: r.height });
|
|
2135
|
+
}
|
|
2136
|
+
return new Promise((r, a2) => {
|
|
2137
|
+
new import_pngjs.PNG().parse(e, (i3, t) => {
|
|
2138
|
+
if (i3) {
|
|
2139
|
+
a2(i3);
|
|
2140
|
+
return;
|
|
2141
|
+
}
|
|
2142
|
+
r({ data: t.data, width: t.width, height: t.height });
|
|
2143
|
+
});
|
|
2139
2144
|
});
|
|
2140
2145
|
}
|
|
2141
|
-
async function
|
|
2142
|
-
|
|
2146
|
+
async function s(e) {
|
|
2147
|
+
try {
|
|
2148
|
+
let r = typeof e == "string" ? (0, import_fs.readFileSync)(e) : e;
|
|
2149
|
+
return await h(r);
|
|
2150
|
+
} catch (r) {
|
|
2151
|
+
throw new Error(`Failed to read PNG file ${e}: ${r}`);
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
async function c(e, r) {
|
|
2155
|
+
return new Promise((a2, i3) => {
|
|
2143
2156
|
try {
|
|
2144
|
-
let
|
|
2145
|
-
|
|
2146
|
-
} catch (
|
|
2147
|
-
|
|
2157
|
+
let t = new import_pngjs.PNG({ width: e.width, height: e.height });
|
|
2158
|
+
t.data = Buffer.isBuffer(e.data) ? e.data : Buffer.from(e.data.buffer), (0, import_fs.writeFileSync)(r, import_pngjs.PNG.sync.write(t)), a2();
|
|
2159
|
+
} catch (t) {
|
|
2160
|
+
i3(new Error(`Failed to write PNG file ${r}: ${t}`));
|
|
2148
2161
|
}
|
|
2149
2162
|
});
|
|
2150
2163
|
}
|
|
2151
|
-
var import_fs, import_pngjs,
|
|
2164
|
+
var import_fs, import_pngjs, d, w, g;
|
|
2152
2165
|
var init_dist = __esm({
|
|
2153
2166
|
"../codec-pngjs/dist/index.mjs"() {
|
|
2154
2167
|
"use strict";
|
|
2155
2168
|
import_fs = require("fs");
|
|
2156
2169
|
import_pngjs = __toESM(require_png(), 1);
|
|
2157
|
-
|
|
2158
|
-
|
|
2170
|
+
d = typeof globalThis.Deno < "u";
|
|
2171
|
+
w = { read: s, write: c };
|
|
2172
|
+
g = w;
|
|
2159
2173
|
}
|
|
2160
2174
|
});
|
|
2161
2175
|
|
|
@@ -2521,7 +2535,7 @@ var require_detect_libc = __commonJS({
|
|
|
2521
2535
|
}
|
|
2522
2536
|
return null;
|
|
2523
2537
|
};
|
|
2524
|
-
var versionSuffix = (
|
|
2538
|
+
var versionSuffix = (s2) => s2.trim().split(/\s+/)[1];
|
|
2525
2539
|
var versionFromCommand = (out) => {
|
|
2526
2540
|
const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
|
|
2527
2541
|
if (getconf && getconf.includes(GLIBC)) {
|
|
@@ -2777,14 +2791,14 @@ var require_semver = __commonJS({
|
|
|
2777
2791
|
this.options = options;
|
|
2778
2792
|
this.loose = !!options.loose;
|
|
2779
2793
|
this.includePrerelease = !!options.includePrerelease;
|
|
2780
|
-
const
|
|
2781
|
-
if (!
|
|
2794
|
+
const m2 = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
2795
|
+
if (!m2) {
|
|
2782
2796
|
throw new TypeError(`Invalid Version: ${version}`);
|
|
2783
2797
|
}
|
|
2784
2798
|
this.raw = version;
|
|
2785
|
-
this.major = +
|
|
2786
|
-
this.minor = +
|
|
2787
|
-
this.patch = +
|
|
2799
|
+
this.major = +m2[1];
|
|
2800
|
+
this.minor = +m2[2];
|
|
2801
|
+
this.patch = +m2[3];
|
|
2788
2802
|
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
2789
2803
|
throw new TypeError("Invalid major version");
|
|
2790
2804
|
}
|
|
@@ -2794,10 +2808,10 @@ var require_semver = __commonJS({
|
|
|
2794
2808
|
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
2795
2809
|
throw new TypeError("Invalid patch version");
|
|
2796
2810
|
}
|
|
2797
|
-
if (!
|
|
2811
|
+
if (!m2[4]) {
|
|
2798
2812
|
this.prerelease = [];
|
|
2799
2813
|
} else {
|
|
2800
|
-
this.prerelease =
|
|
2814
|
+
this.prerelease = m2[4].split(".").map((id) => {
|
|
2801
2815
|
if (/^[0-9]+$/.test(id)) {
|
|
2802
2816
|
const num = +id;
|
|
2803
2817
|
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
@@ -2807,7 +2821,7 @@ var require_semver = __commonJS({
|
|
|
2807
2821
|
return id;
|
|
2808
2822
|
});
|
|
2809
2823
|
}
|
|
2810
|
-
this.build =
|
|
2824
|
+
this.build = m2[5] ? m2[5].split(".") : [];
|
|
2811
2825
|
this.format();
|
|
2812
2826
|
}
|
|
2813
2827
|
format() {
|
|
@@ -3284,18 +3298,18 @@ var require_comparator = __commonJS({
|
|
|
3284
3298
|
}
|
|
3285
3299
|
parse(comp) {
|
|
3286
3300
|
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
3287
|
-
const
|
|
3288
|
-
if (!
|
|
3301
|
+
const m2 = comp.match(r);
|
|
3302
|
+
if (!m2) {
|
|
3289
3303
|
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
3290
3304
|
}
|
|
3291
|
-
this.operator =
|
|
3305
|
+
this.operator = m2[1] !== void 0 ? m2[1] : "";
|
|
3292
3306
|
if (this.operator === "=") {
|
|
3293
3307
|
this.operator = "";
|
|
3294
3308
|
}
|
|
3295
|
-
if (!
|
|
3309
|
+
if (!m2[2]) {
|
|
3296
3310
|
this.semver = ANY;
|
|
3297
3311
|
} else {
|
|
3298
|
-
this.semver = new SemVer(
|
|
3312
|
+
this.semver = new SemVer(m2[2], this.options.loose);
|
|
3299
3313
|
}
|
|
3300
3314
|
}
|
|
3301
3315
|
toString() {
|
|
@@ -3556,20 +3570,20 @@ var require_range = __commonJS({
|
|
|
3556
3570
|
};
|
|
3557
3571
|
var replaceTilde = (comp, options) => {
|
|
3558
3572
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
3559
|
-
return comp.replace(r, (_, M,
|
|
3560
|
-
debug("tilde", comp, _, M,
|
|
3573
|
+
return comp.replace(r, (_, M, m2, p2, pr) => {
|
|
3574
|
+
debug("tilde", comp, _, M, m2, p2, pr);
|
|
3561
3575
|
let ret;
|
|
3562
3576
|
if (isX(M)) {
|
|
3563
3577
|
ret = "";
|
|
3564
|
-
} else if (isX(
|
|
3578
|
+
} else if (isX(m2)) {
|
|
3565
3579
|
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
3566
3580
|
} else if (isX(p2)) {
|
|
3567
|
-
ret = `>=${M}.${
|
|
3581
|
+
ret = `>=${M}.${m2}.0 <${M}.${+m2 + 1}.0-0`;
|
|
3568
3582
|
} else if (pr) {
|
|
3569
3583
|
debug("replaceTilde pr", pr);
|
|
3570
|
-
ret = `>=${M}.${
|
|
3584
|
+
ret = `>=${M}.${m2}.${p2}-${pr} <${M}.${+m2 + 1}.0-0`;
|
|
3571
3585
|
} else {
|
|
3572
|
-
ret = `>=${M}.${
|
|
3586
|
+
ret = `>=${M}.${m2}.${p2} <${M}.${+m2 + 1}.0-0`;
|
|
3573
3587
|
}
|
|
3574
3588
|
debug("tilde return", ret);
|
|
3575
3589
|
return ret;
|
|
@@ -3582,40 +3596,40 @@ var require_range = __commonJS({
|
|
|
3582
3596
|
debug("caret", comp, options);
|
|
3583
3597
|
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
3584
3598
|
const z = options.includePrerelease ? "-0" : "";
|
|
3585
|
-
return comp.replace(r, (_, M,
|
|
3586
|
-
debug("caret", comp, _, M,
|
|
3599
|
+
return comp.replace(r, (_, M, m2, p2, pr) => {
|
|
3600
|
+
debug("caret", comp, _, M, m2, p2, pr);
|
|
3587
3601
|
let ret;
|
|
3588
3602
|
if (isX(M)) {
|
|
3589
3603
|
ret = "";
|
|
3590
|
-
} else if (isX(
|
|
3604
|
+
} else if (isX(m2)) {
|
|
3591
3605
|
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
3592
3606
|
} else if (isX(p2)) {
|
|
3593
3607
|
if (M === "0") {
|
|
3594
|
-
ret = `>=${M}.${
|
|
3608
|
+
ret = `>=${M}.${m2}.0${z} <${M}.${+m2 + 1}.0-0`;
|
|
3595
3609
|
} else {
|
|
3596
|
-
ret = `>=${M}.${
|
|
3610
|
+
ret = `>=${M}.${m2}.0${z} <${+M + 1}.0.0-0`;
|
|
3597
3611
|
}
|
|
3598
3612
|
} else if (pr) {
|
|
3599
3613
|
debug("replaceCaret pr", pr);
|
|
3600
3614
|
if (M === "0") {
|
|
3601
|
-
if (
|
|
3602
|
-
ret = `>=${M}.${
|
|
3615
|
+
if (m2 === "0") {
|
|
3616
|
+
ret = `>=${M}.${m2}.${p2}-${pr} <${M}.${m2}.${+p2 + 1}-0`;
|
|
3603
3617
|
} else {
|
|
3604
|
-
ret = `>=${M}.${
|
|
3618
|
+
ret = `>=${M}.${m2}.${p2}-${pr} <${M}.${+m2 + 1}.0-0`;
|
|
3605
3619
|
}
|
|
3606
3620
|
} else {
|
|
3607
|
-
ret = `>=${M}.${
|
|
3621
|
+
ret = `>=${M}.${m2}.${p2}-${pr} <${+M + 1}.0.0-0`;
|
|
3608
3622
|
}
|
|
3609
3623
|
} else {
|
|
3610
3624
|
debug("no pr");
|
|
3611
3625
|
if (M === "0") {
|
|
3612
|
-
if (
|
|
3613
|
-
ret = `>=${M}.${
|
|
3626
|
+
if (m2 === "0") {
|
|
3627
|
+
ret = `>=${M}.${m2}.${p2}${z} <${M}.${m2}.${+p2 + 1}-0`;
|
|
3614
3628
|
} else {
|
|
3615
|
-
ret = `>=${M}.${
|
|
3629
|
+
ret = `>=${M}.${m2}.${p2}${z} <${M}.${+m2 + 1}.0-0`;
|
|
3616
3630
|
}
|
|
3617
3631
|
} else {
|
|
3618
|
-
ret = `>=${M}.${
|
|
3632
|
+
ret = `>=${M}.${m2}.${p2} <${+M + 1}.0.0-0`;
|
|
3619
3633
|
}
|
|
3620
3634
|
}
|
|
3621
3635
|
debug("caret return", ret);
|
|
@@ -3629,10 +3643,10 @@ var require_range = __commonJS({
|
|
|
3629
3643
|
var replaceXRange = (comp, options) => {
|
|
3630
3644
|
comp = comp.trim();
|
|
3631
3645
|
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
3632
|
-
return comp.replace(r, (ret, gtlt, M,
|
|
3633
|
-
debug("xRange", comp, ret, gtlt, M,
|
|
3646
|
+
return comp.replace(r, (ret, gtlt, M, m2, p2, pr) => {
|
|
3647
|
+
debug("xRange", comp, ret, gtlt, M, m2, p2, pr);
|
|
3634
3648
|
const xM = isX(M);
|
|
3635
|
-
const xm = xM || isX(
|
|
3649
|
+
const xm = xM || isX(m2);
|
|
3636
3650
|
const xp = xm || isX(p2);
|
|
3637
3651
|
const anyX = xp;
|
|
3638
3652
|
if (gtlt === "=" && anyX) {
|
|
@@ -3647,17 +3661,17 @@ var require_range = __commonJS({
|
|
|
3647
3661
|
}
|
|
3648
3662
|
} else if (gtlt && anyX) {
|
|
3649
3663
|
if (xm) {
|
|
3650
|
-
|
|
3664
|
+
m2 = 0;
|
|
3651
3665
|
}
|
|
3652
3666
|
p2 = 0;
|
|
3653
3667
|
if (gtlt === ">") {
|
|
3654
3668
|
gtlt = ">=";
|
|
3655
3669
|
if (xm) {
|
|
3656
3670
|
M = +M + 1;
|
|
3657
|
-
|
|
3671
|
+
m2 = 0;
|
|
3658
3672
|
p2 = 0;
|
|
3659
3673
|
} else {
|
|
3660
|
-
|
|
3674
|
+
m2 = +m2 + 1;
|
|
3661
3675
|
p2 = 0;
|
|
3662
3676
|
}
|
|
3663
3677
|
} else if (gtlt === "<=") {
|
|
@@ -3665,17 +3679,17 @@ var require_range = __commonJS({
|
|
|
3665
3679
|
if (xm) {
|
|
3666
3680
|
M = +M + 1;
|
|
3667
3681
|
} else {
|
|
3668
|
-
|
|
3682
|
+
m2 = +m2 + 1;
|
|
3669
3683
|
}
|
|
3670
3684
|
}
|
|
3671
3685
|
if (gtlt === "<") {
|
|
3672
3686
|
pr = "-0";
|
|
3673
3687
|
}
|
|
3674
|
-
ret = `${gtlt + M}.${
|
|
3688
|
+
ret = `${gtlt + M}.${m2}.${p2}${pr}`;
|
|
3675
3689
|
} else if (xm) {
|
|
3676
3690
|
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
3677
3691
|
} else if (xp) {
|
|
3678
|
-
ret = `>=${M}.${
|
|
3692
|
+
ret = `>=${M}.${m2}.0${pr} <${M}.${+m2 + 1}.0-0`;
|
|
3679
3693
|
}
|
|
3680
3694
|
debug("xRange return", ret);
|
|
3681
3695
|
return ret;
|
|
@@ -4063,7 +4077,7 @@ var require_libvips = __commonJS({
|
|
|
4063
4077
|
}
|
|
4064
4078
|
return false;
|
|
4065
4079
|
};
|
|
4066
|
-
var sha512 = (
|
|
4080
|
+
var sha512 = (s2) => createHash("sha512").update(s2).digest("hex");
|
|
4067
4081
|
var yarnLocator = () => {
|
|
4068
4082
|
try {
|
|
4069
4083
|
const identHash = sha512(`imgsharp-libvips-${buildPlatformArch()}`);
|
|
@@ -6242,10 +6256,10 @@ var require_color = __commonJS({
|
|
|
6242
6256
|
if (match) {
|
|
6243
6257
|
const alpha = Number.parseFloat(match[4]);
|
|
6244
6258
|
const h4 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6245
|
-
const
|
|
6259
|
+
const s2 = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
6246
6260
|
const l = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
6247
6261
|
const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6248
|
-
return [h4,
|
|
6262
|
+
return [h4, s2, l, a2];
|
|
6249
6263
|
}
|
|
6250
6264
|
return null;
|
|
6251
6265
|
};
|
|
@@ -6258,10 +6272,10 @@ var require_color = __commonJS({
|
|
|
6258
6272
|
if (match) {
|
|
6259
6273
|
const alpha = Number.parseFloat(match[4]);
|
|
6260
6274
|
const h4 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6261
|
-
const
|
|
6275
|
+
const w3 = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
6262
6276
|
const b = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
6263
6277
|
const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6264
|
-
return [h4,
|
|
6278
|
+
return [h4, w3, b, a2];
|
|
6265
6279
|
}
|
|
6266
6280
|
return null;
|
|
6267
6281
|
};
|
|
@@ -6273,9 +6287,9 @@ var require_color = __commonJS({
|
|
|
6273
6287
|
};
|
|
6274
6288
|
cs.to.rgb.percent = function(...rgba) {
|
|
6275
6289
|
const r = Math.round(rgba[0] / 255 * 100);
|
|
6276
|
-
const
|
|
6290
|
+
const g2 = Math.round(rgba[1] / 255 * 100);
|
|
6277
6291
|
const b = Math.round(rgba[2] / 255 * 100);
|
|
6278
|
-
return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r + "%, " +
|
|
6292
|
+
return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r + "%, " + g2 + "%, " + b + "%)" : "rgba(" + r + "%, " + g2 + "%, " + b + "%, " + rgba[3] + ")";
|
|
6279
6293
|
};
|
|
6280
6294
|
cs.to.hsl = function(...hsla) {
|
|
6281
6295
|
return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
|
|
@@ -6348,28 +6362,28 @@ var require_color = __commonJS({
|
|
|
6348
6362
|
}
|
|
6349
6363
|
convert.rgb.hsl = function(rgb) {
|
|
6350
6364
|
const r = rgb[0] / 255;
|
|
6351
|
-
const
|
|
6365
|
+
const g2 = rgb[1] / 255;
|
|
6352
6366
|
const b = rgb[2] / 255;
|
|
6353
|
-
const min = Math.min(r,
|
|
6354
|
-
const max = Math.max(r,
|
|
6367
|
+
const min = Math.min(r, g2, b);
|
|
6368
|
+
const max = Math.max(r, g2, b);
|
|
6355
6369
|
const delta = max - min;
|
|
6356
6370
|
let h4;
|
|
6357
|
-
let
|
|
6371
|
+
let s2;
|
|
6358
6372
|
switch (max) {
|
|
6359
6373
|
case min: {
|
|
6360
6374
|
h4 = 0;
|
|
6361
6375
|
break;
|
|
6362
6376
|
}
|
|
6363
6377
|
case r: {
|
|
6364
|
-
h4 = (
|
|
6378
|
+
h4 = (g2 - b) / delta;
|
|
6365
6379
|
break;
|
|
6366
6380
|
}
|
|
6367
|
-
case
|
|
6381
|
+
case g2: {
|
|
6368
6382
|
h4 = 2 + (b - r) / delta;
|
|
6369
6383
|
break;
|
|
6370
6384
|
}
|
|
6371
6385
|
case b: {
|
|
6372
|
-
h4 = 4 + (r -
|
|
6386
|
+
h4 = 4 + (r - g2) / delta;
|
|
6373
6387
|
break;
|
|
6374
6388
|
}
|
|
6375
6389
|
}
|
|
@@ -6379,42 +6393,42 @@ var require_color = __commonJS({
|
|
|
6379
6393
|
}
|
|
6380
6394
|
const l = (min + max) / 2;
|
|
6381
6395
|
if (max === min) {
|
|
6382
|
-
|
|
6396
|
+
s2 = 0;
|
|
6383
6397
|
} else if (l <= 0.5) {
|
|
6384
|
-
|
|
6398
|
+
s2 = delta / (max + min);
|
|
6385
6399
|
} else {
|
|
6386
|
-
|
|
6400
|
+
s2 = delta / (2 - max - min);
|
|
6387
6401
|
}
|
|
6388
|
-
return [h4,
|
|
6402
|
+
return [h4, s2 * 100, l * 100];
|
|
6389
6403
|
};
|
|
6390
6404
|
convert.rgb.hsv = function(rgb) {
|
|
6391
6405
|
let rdif;
|
|
6392
6406
|
let gdif;
|
|
6393
6407
|
let bdif;
|
|
6394
6408
|
let h4;
|
|
6395
|
-
let
|
|
6409
|
+
let s2;
|
|
6396
6410
|
const r = rgb[0] / 255;
|
|
6397
|
-
const
|
|
6411
|
+
const g2 = rgb[1] / 255;
|
|
6398
6412
|
const b = rgb[2] / 255;
|
|
6399
|
-
const v = Math.max(r,
|
|
6400
|
-
const diff = v - Math.min(r,
|
|
6413
|
+
const v = Math.max(r, g2, b);
|
|
6414
|
+
const diff = v - Math.min(r, g2, b);
|
|
6401
6415
|
const diffc = function(c3) {
|
|
6402
6416
|
return (v - c3) / 6 / diff + 1 / 2;
|
|
6403
6417
|
};
|
|
6404
6418
|
if (diff === 0) {
|
|
6405
6419
|
h4 = 0;
|
|
6406
|
-
|
|
6420
|
+
s2 = 0;
|
|
6407
6421
|
} else {
|
|
6408
|
-
|
|
6422
|
+
s2 = diff / v;
|
|
6409
6423
|
rdif = diffc(r);
|
|
6410
|
-
gdif = diffc(
|
|
6424
|
+
gdif = diffc(g2);
|
|
6411
6425
|
bdif = diffc(b);
|
|
6412
6426
|
switch (v) {
|
|
6413
6427
|
case r: {
|
|
6414
6428
|
h4 = bdif - gdif;
|
|
6415
6429
|
break;
|
|
6416
6430
|
}
|
|
6417
|
-
case
|
|
6431
|
+
case g2: {
|
|
6418
6432
|
h4 = 1 / 3 + rdif - bdif;
|
|
6419
6433
|
break;
|
|
6420
6434
|
}
|
|
@@ -6431,26 +6445,26 @@ var require_color = __commonJS({
|
|
|
6431
6445
|
}
|
|
6432
6446
|
return [
|
|
6433
6447
|
h4 * 360,
|
|
6434
|
-
|
|
6448
|
+
s2 * 100,
|
|
6435
6449
|
v * 100
|
|
6436
6450
|
];
|
|
6437
6451
|
};
|
|
6438
6452
|
convert.rgb.hwb = function(rgb) {
|
|
6439
6453
|
const r = rgb[0];
|
|
6440
|
-
const
|
|
6454
|
+
const g2 = rgb[1];
|
|
6441
6455
|
let b = rgb[2];
|
|
6442
6456
|
const h4 = convert.rgb.hsl(rgb)[0];
|
|
6443
|
-
const
|
|
6444
|
-
b = 1 - 1 / 255 * Math.max(r, Math.max(
|
|
6445
|
-
return [h4,
|
|
6457
|
+
const w3 = 1 / 255 * Math.min(r, Math.min(g2, b));
|
|
6458
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g2, b));
|
|
6459
|
+
return [h4, w3 * 100, b * 100];
|
|
6446
6460
|
};
|
|
6447
6461
|
convert.rgb.oklab = function(rgb) {
|
|
6448
6462
|
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
6449
|
-
const
|
|
6463
|
+
const g2 = srgbNonlinearTransformInv(rgb[1] / 255);
|
|
6450
6464
|
const b = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
6451
|
-
const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 *
|
|
6452
|
-
const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 *
|
|
6453
|
-
const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 *
|
|
6465
|
+
const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g2 + 0.0514459929 * b);
|
|
6466
|
+
const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g2 + 0.1073969566 * b);
|
|
6467
|
+
const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 * g2 + 0.6299787005 * b);
|
|
6454
6468
|
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
6455
6469
|
const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
6456
6470
|
const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
@@ -6458,13 +6472,13 @@ var require_color = __commonJS({
|
|
|
6458
6472
|
};
|
|
6459
6473
|
convert.rgb.cmyk = function(rgb) {
|
|
6460
6474
|
const r = rgb[0] / 255;
|
|
6461
|
-
const
|
|
6475
|
+
const g2 = rgb[1] / 255;
|
|
6462
6476
|
const b = rgb[2] / 255;
|
|
6463
|
-
const k = Math.min(1 - r, 1 -
|
|
6477
|
+
const k = Math.min(1 - r, 1 - g2, 1 - b);
|
|
6464
6478
|
const c3 = (1 - r - k) / (1 - k) || 0;
|
|
6465
|
-
const
|
|
6479
|
+
const m2 = (1 - g2 - k) / (1 - k) || 0;
|
|
6466
6480
|
const y = (1 - b - k) / (1 - k) || 0;
|
|
6467
|
-
return [c3 * 100,
|
|
6481
|
+
return [c3 * 100, m2 * 100, y * 100, k * 100];
|
|
6468
6482
|
};
|
|
6469
6483
|
function comparativeDistance(x, y) {
|
|
6470
6484
|
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
@@ -6491,11 +6505,11 @@ var require_color = __commonJS({
|
|
|
6491
6505
|
};
|
|
6492
6506
|
convert.rgb.xyz = function(rgb) {
|
|
6493
6507
|
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
6494
|
-
const
|
|
6508
|
+
const g2 = srgbNonlinearTransformInv(rgb[1] / 255);
|
|
6495
6509
|
const b = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
6496
|
-
const x = r * 0.4124564 +
|
|
6497
|
-
const y = r * 0.2126729 +
|
|
6498
|
-
const z = r * 0.0193339 +
|
|
6510
|
+
const x = r * 0.4124564 + g2 * 0.3575761 + b * 0.1804375;
|
|
6511
|
+
const y = r * 0.2126729 + g2 * 0.7151522 + b * 0.072175;
|
|
6512
|
+
const z = r * 0.0193339 + g2 * 0.119192 + b * 0.9503041;
|
|
6499
6513
|
return [x * 100, y * 100, z * 100];
|
|
6500
6514
|
};
|
|
6501
6515
|
convert.rgb.lab = function(rgb) {
|
|
@@ -6516,15 +6530,15 @@ var require_color = __commonJS({
|
|
|
6516
6530
|
};
|
|
6517
6531
|
convert.hsl.rgb = function(hsl) {
|
|
6518
6532
|
const h4 = hsl[0] / 360;
|
|
6519
|
-
const
|
|
6533
|
+
const s2 = hsl[1] / 100;
|
|
6520
6534
|
const l = hsl[2] / 100;
|
|
6521
6535
|
let t3;
|
|
6522
6536
|
let value;
|
|
6523
|
-
if (
|
|
6537
|
+
if (s2 === 0) {
|
|
6524
6538
|
value = l * 255;
|
|
6525
6539
|
return [value, value, value];
|
|
6526
6540
|
}
|
|
6527
|
-
const t2 = l < 0.5 ? l * (1 +
|
|
6541
|
+
const t2 = l < 0.5 ? l * (1 + s2) : l + s2 - l * s2;
|
|
6528
6542
|
const t1 = 2 * l - t2;
|
|
6529
6543
|
const rgb = [0, 0, 0];
|
|
6530
6544
|
for (let i3 = 0; i3 < 3; i3++) {
|
|
@@ -6550,26 +6564,26 @@ var require_color = __commonJS({
|
|
|
6550
6564
|
};
|
|
6551
6565
|
convert.hsl.hsv = function(hsl) {
|
|
6552
6566
|
const h4 = hsl[0];
|
|
6553
|
-
let
|
|
6567
|
+
let s2 = hsl[1] / 100;
|
|
6554
6568
|
let l = hsl[2] / 100;
|
|
6555
|
-
let smin =
|
|
6569
|
+
let smin = s2;
|
|
6556
6570
|
const lmin = Math.max(l, 0.01);
|
|
6557
6571
|
l *= 2;
|
|
6558
|
-
|
|
6572
|
+
s2 *= l <= 1 ? l : 2 - l;
|
|
6559
6573
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
6560
|
-
const v = (l +
|
|
6561
|
-
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 *
|
|
6574
|
+
const v = (l + s2) / 2;
|
|
6575
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s2 / (l + s2);
|
|
6562
6576
|
return [h4, sv * 100, v * 100];
|
|
6563
6577
|
};
|
|
6564
6578
|
convert.hsv.rgb = function(hsv) {
|
|
6565
6579
|
const h4 = hsv[0] / 60;
|
|
6566
|
-
const
|
|
6580
|
+
const s2 = hsv[1] / 100;
|
|
6567
6581
|
let v = hsv[2] / 100;
|
|
6568
6582
|
const hi = Math.floor(h4) % 6;
|
|
6569
6583
|
const f = h4 - Math.floor(h4);
|
|
6570
|
-
const p2 = 255 * v * (1 -
|
|
6571
|
-
const q2 = 255 * v * (1 -
|
|
6572
|
-
const t = 255 * v * (1 -
|
|
6584
|
+
const p2 = 255 * v * (1 - s2);
|
|
6585
|
+
const q2 = 255 * v * (1 - s2 * f);
|
|
6586
|
+
const t = 255 * v * (1 - s2 * (1 - f));
|
|
6573
6587
|
v *= 255;
|
|
6574
6588
|
switch (hi) {
|
|
6575
6589
|
case 0: {
|
|
@@ -6594,14 +6608,14 @@ var require_color = __commonJS({
|
|
|
6594
6608
|
};
|
|
6595
6609
|
convert.hsv.hsl = function(hsv) {
|
|
6596
6610
|
const h4 = hsv[0];
|
|
6597
|
-
const
|
|
6611
|
+
const s2 = hsv[1] / 100;
|
|
6598
6612
|
const v = hsv[2] / 100;
|
|
6599
6613
|
const vmin = Math.max(v, 0.01);
|
|
6600
6614
|
let sl;
|
|
6601
6615
|
let l;
|
|
6602
|
-
l = (2 -
|
|
6603
|
-
const lmin = (2 -
|
|
6604
|
-
sl =
|
|
6616
|
+
l = (2 - s2) * v;
|
|
6617
|
+
const lmin = (2 - s2) * vmin;
|
|
6618
|
+
sl = s2 * vmin;
|
|
6605
6619
|
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
6606
6620
|
sl = sl || 0;
|
|
6607
6621
|
l /= 2;
|
|
@@ -6625,74 +6639,74 @@ var require_color = __commonJS({
|
|
|
6625
6639
|
}
|
|
6626
6640
|
const n2 = wh + f * (v - wh);
|
|
6627
6641
|
let r;
|
|
6628
|
-
let
|
|
6642
|
+
let g2;
|
|
6629
6643
|
let b;
|
|
6630
6644
|
switch (i3) {
|
|
6631
6645
|
default:
|
|
6632
6646
|
case 6:
|
|
6633
6647
|
case 0: {
|
|
6634
6648
|
r = v;
|
|
6635
|
-
|
|
6649
|
+
g2 = n2;
|
|
6636
6650
|
b = wh;
|
|
6637
6651
|
break;
|
|
6638
6652
|
}
|
|
6639
6653
|
case 1: {
|
|
6640
6654
|
r = n2;
|
|
6641
|
-
|
|
6655
|
+
g2 = v;
|
|
6642
6656
|
b = wh;
|
|
6643
6657
|
break;
|
|
6644
6658
|
}
|
|
6645
6659
|
case 2: {
|
|
6646
6660
|
r = wh;
|
|
6647
|
-
|
|
6661
|
+
g2 = v;
|
|
6648
6662
|
b = n2;
|
|
6649
6663
|
break;
|
|
6650
6664
|
}
|
|
6651
6665
|
case 3: {
|
|
6652
6666
|
r = wh;
|
|
6653
|
-
|
|
6667
|
+
g2 = n2;
|
|
6654
6668
|
b = v;
|
|
6655
6669
|
break;
|
|
6656
6670
|
}
|
|
6657
6671
|
case 4: {
|
|
6658
6672
|
r = n2;
|
|
6659
|
-
|
|
6673
|
+
g2 = wh;
|
|
6660
6674
|
b = v;
|
|
6661
6675
|
break;
|
|
6662
6676
|
}
|
|
6663
6677
|
case 5: {
|
|
6664
6678
|
r = v;
|
|
6665
|
-
|
|
6679
|
+
g2 = wh;
|
|
6666
6680
|
b = n2;
|
|
6667
6681
|
break;
|
|
6668
6682
|
}
|
|
6669
6683
|
}
|
|
6670
|
-
return [r * 255,
|
|
6684
|
+
return [r * 255, g2 * 255, b * 255];
|
|
6671
6685
|
};
|
|
6672
6686
|
convert.cmyk.rgb = function(cmyk) {
|
|
6673
6687
|
const c3 = cmyk[0] / 100;
|
|
6674
|
-
const
|
|
6688
|
+
const m2 = cmyk[1] / 100;
|
|
6675
6689
|
const y = cmyk[2] / 100;
|
|
6676
6690
|
const k = cmyk[3] / 100;
|
|
6677
6691
|
const r = 1 - Math.min(1, c3 * (1 - k) + k);
|
|
6678
|
-
const
|
|
6692
|
+
const g2 = 1 - Math.min(1, m2 * (1 - k) + k);
|
|
6679
6693
|
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
6680
|
-
return [r * 255,
|
|
6694
|
+
return [r * 255, g2 * 255, b * 255];
|
|
6681
6695
|
};
|
|
6682
6696
|
convert.xyz.rgb = function(xyz) {
|
|
6683
6697
|
const x = xyz[0] / 100;
|
|
6684
6698
|
const y = xyz[1] / 100;
|
|
6685
6699
|
const z = xyz[2] / 100;
|
|
6686
6700
|
let r;
|
|
6687
|
-
let
|
|
6701
|
+
let g2;
|
|
6688
6702
|
let b;
|
|
6689
6703
|
r = x * 3.2404542 + y * -1.5371385 + z * -0.4985314;
|
|
6690
|
-
|
|
6704
|
+
g2 = x * -0.969266 + y * 1.8760108 + z * 0.041556;
|
|
6691
6705
|
b = x * 0.0556434 + y * -0.2040259 + z * 1.0572252;
|
|
6692
6706
|
r = srgbNonlinearTransform(r);
|
|
6693
|
-
|
|
6707
|
+
g2 = srgbNonlinearTransform(g2);
|
|
6694
6708
|
b = srgbNonlinearTransform(b);
|
|
6695
|
-
return [r * 255,
|
|
6709
|
+
return [r * 255, g2 * 255, b * 255];
|
|
6696
6710
|
};
|
|
6697
6711
|
convert.xyz.lab = function(xyz) {
|
|
6698
6712
|
let x = xyz[0];
|
|
@@ -6729,11 +6743,11 @@ var require_color = __commonJS({
|
|
|
6729
6743
|
const a2 = oklab[1] / 100;
|
|
6730
6744
|
const b = oklab[2] / 100;
|
|
6731
6745
|
const l = (0.999999998 * ll + 0.396337792 * a2 + 0.215803758 * b) ** 3;
|
|
6732
|
-
const
|
|
6733
|
-
const
|
|
6734
|
-
const x = 1.227013851 * l - 0.55779998 *
|
|
6735
|
-
const y = -0.040580178 * l + 1.11225687 *
|
|
6736
|
-
const z = -0.076381285 * l - 0.421481978 *
|
|
6746
|
+
const m2 = (1.000000008 * ll - 0.105561342 * a2 - 0.063854175 * b) ** 3;
|
|
6747
|
+
const s2 = (1.000000055 * ll - 0.089484182 * a2 - 1.291485538 * b) ** 3;
|
|
6748
|
+
const x = 1.227013851 * l - 0.55779998 * m2 + 0.281256149 * s2;
|
|
6749
|
+
const y = -0.040580178 * l + 1.11225687 * m2 - 0.071676679 * s2;
|
|
6750
|
+
const z = -0.076381285 * l - 0.421481978 * m2 + 1.58616322 * s2;
|
|
6737
6751
|
return [x * 100, y * 100, z * 100];
|
|
6738
6752
|
};
|
|
6739
6753
|
convert.oklab.rgb = function(oklab) {
|
|
@@ -6741,12 +6755,12 @@ var require_color = __commonJS({
|
|
|
6741
6755
|
const aa = oklab[1] / 100;
|
|
6742
6756
|
const bb = oklab[2] / 100;
|
|
6743
6757
|
const l = (ll + 0.3963377774 * aa + 0.2158037573 * bb) ** 3;
|
|
6744
|
-
const
|
|
6745
|
-
const
|
|
6746
|
-
const r = srgbNonlinearTransform(4.0767416621 * l - 3.3077115913 *
|
|
6747
|
-
const
|
|
6748
|
-
const b = srgbNonlinearTransform(-0.0041960863 * l - 0.7034186147 *
|
|
6749
|
-
return [r * 255,
|
|
6758
|
+
const m2 = (ll - 0.1055613458 * aa - 0.0638541728 * bb) ** 3;
|
|
6759
|
+
const s2 = (ll - 0.0894841775 * aa - 1.291485548 * bb) ** 3;
|
|
6760
|
+
const r = srgbNonlinearTransform(4.0767416621 * l - 3.3077115913 * m2 + 0.2309699292 * s2);
|
|
6761
|
+
const g2 = srgbNonlinearTransform(-1.2684380046 * l + 2.6097574011 * m2 - 0.3413193965 * s2);
|
|
6762
|
+
const b = srgbNonlinearTransform(-0.0041960863 * l - 0.7034186147 * m2 + 1.707614701 * s2);
|
|
6763
|
+
return [r * 255, g2 * 255, b * 255];
|
|
6750
6764
|
};
|
|
6751
6765
|
convert.oklch.oklab = function(oklch) {
|
|
6752
6766
|
return convert.lch.lab(oklch);
|
|
@@ -6795,13 +6809,13 @@ var require_color = __commonJS({
|
|
|
6795
6809
|
return [l, a2, b];
|
|
6796
6810
|
};
|
|
6797
6811
|
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
6798
|
-
const [r,
|
|
6812
|
+
const [r, g2, b] = args;
|
|
6799
6813
|
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
6800
6814
|
value = Math.round(value / 50);
|
|
6801
6815
|
if (value === 0) {
|
|
6802
6816
|
return 30;
|
|
6803
6817
|
}
|
|
6804
|
-
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(
|
|
6818
|
+
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r / 255));
|
|
6805
6819
|
if (value === 2) {
|
|
6806
6820
|
ansi += 60;
|
|
6807
6821
|
}
|
|
@@ -6812,9 +6826,9 @@ var require_color = __commonJS({
|
|
|
6812
6826
|
};
|
|
6813
6827
|
convert.rgb.ansi256 = function(args) {
|
|
6814
6828
|
const r = args[0];
|
|
6815
|
-
const
|
|
6829
|
+
const g2 = args[1];
|
|
6816
6830
|
const b = args[2];
|
|
6817
|
-
if (r >> 4 ===
|
|
6831
|
+
if (r >> 4 === g2 >> 4 && g2 >> 4 === b >> 4) {
|
|
6818
6832
|
if (r < 8) {
|
|
6819
6833
|
return 16;
|
|
6820
6834
|
}
|
|
@@ -6823,7 +6837,7 @@ var require_color = __commonJS({
|
|
|
6823
6837
|
}
|
|
6824
6838
|
return Math.round((r - 8) / 247 * 24) + 232;
|
|
6825
6839
|
}
|
|
6826
|
-
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(
|
|
6840
|
+
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g2 / 255 * 5) + Math.round(b / 255 * 5);
|
|
6827
6841
|
return ansi;
|
|
6828
6842
|
};
|
|
6829
6843
|
convert.ansi16.rgb = function(args) {
|
|
@@ -6838,9 +6852,9 @@ var require_color = __commonJS({
|
|
|
6838
6852
|
}
|
|
6839
6853
|
const mult = (Math.trunc(args > 50) + 1) * 0.5;
|
|
6840
6854
|
const r = (color & 1) * mult * 255;
|
|
6841
|
-
const
|
|
6855
|
+
const g2 = (color >> 1 & 1) * mult * 255;
|
|
6842
6856
|
const b = (color >> 2 & 1) * mult * 255;
|
|
6843
|
-
return [r,
|
|
6857
|
+
return [r, g2, b];
|
|
6844
6858
|
};
|
|
6845
6859
|
convert.ansi256.rgb = function(args) {
|
|
6846
6860
|
args = args[0];
|
|
@@ -6851,9 +6865,9 @@ var require_color = __commonJS({
|
|
|
6851
6865
|
args -= 16;
|
|
6852
6866
|
let rem;
|
|
6853
6867
|
const r = Math.floor(args / 36) / 5 * 255;
|
|
6854
|
-
const
|
|
6868
|
+
const g2 = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
6855
6869
|
const b = rem % 6 / 5 * 255;
|
|
6856
|
-
return [r,
|
|
6870
|
+
return [r, g2, b];
|
|
6857
6871
|
};
|
|
6858
6872
|
convert.rgb.hex = function(args) {
|
|
6859
6873
|
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
@@ -6871,36 +6885,36 @@ var require_color = __commonJS({
|
|
|
6871
6885
|
}
|
|
6872
6886
|
const integer = Number.parseInt(colorString, 16);
|
|
6873
6887
|
const r = integer >> 16 & 255;
|
|
6874
|
-
const
|
|
6888
|
+
const g2 = integer >> 8 & 255;
|
|
6875
6889
|
const b = integer & 255;
|
|
6876
|
-
return [r,
|
|
6890
|
+
return [r, g2, b];
|
|
6877
6891
|
};
|
|
6878
6892
|
convert.rgb.hcg = function(rgb) {
|
|
6879
6893
|
const r = rgb[0] / 255;
|
|
6880
|
-
const
|
|
6894
|
+
const g2 = rgb[1] / 255;
|
|
6881
6895
|
const b = rgb[2] / 255;
|
|
6882
|
-
const max = Math.max(Math.max(r,
|
|
6883
|
-
const min = Math.min(Math.min(r,
|
|
6896
|
+
const max = Math.max(Math.max(r, g2), b);
|
|
6897
|
+
const min = Math.min(Math.min(r, g2), b);
|
|
6884
6898
|
const chroma = max - min;
|
|
6885
6899
|
let hue;
|
|
6886
6900
|
const grayscale = chroma < 1 ? min / (1 - chroma) : 0;
|
|
6887
6901
|
if (chroma <= 0) {
|
|
6888
6902
|
hue = 0;
|
|
6889
6903
|
} else if (max === r) {
|
|
6890
|
-
hue = (
|
|
6891
|
-
} else if (max ===
|
|
6904
|
+
hue = (g2 - b) / chroma % 6;
|
|
6905
|
+
} else if (max === g2) {
|
|
6892
6906
|
hue = 2 + (b - r) / chroma;
|
|
6893
6907
|
} else {
|
|
6894
|
-
hue = 4 + (r -
|
|
6908
|
+
hue = 4 + (r - g2) / chroma;
|
|
6895
6909
|
}
|
|
6896
6910
|
hue /= 6;
|
|
6897
6911
|
hue %= 1;
|
|
6898
6912
|
return [hue * 360, chroma * 100, grayscale * 100];
|
|
6899
6913
|
};
|
|
6900
6914
|
convert.hsl.hcg = function(hsl) {
|
|
6901
|
-
const
|
|
6915
|
+
const s2 = hsl[1] / 100;
|
|
6902
6916
|
const l = hsl[2] / 100;
|
|
6903
|
-
const c3 = l < 0.5 ? 2 *
|
|
6917
|
+
const c3 = l < 0.5 ? 2 * s2 * l : 2 * s2 * (1 - l);
|
|
6904
6918
|
let f = 0;
|
|
6905
6919
|
if (c3 < 1) {
|
|
6906
6920
|
f = (l - 0.5 * c3) / (1 - c3);
|
|
@@ -6908,9 +6922,9 @@ var require_color = __commonJS({
|
|
|
6908
6922
|
return [hsl[0], c3 * 100, f * 100];
|
|
6909
6923
|
};
|
|
6910
6924
|
convert.hsv.hcg = function(hsv) {
|
|
6911
|
-
const
|
|
6925
|
+
const s2 = hsv[1] / 100;
|
|
6912
6926
|
const v = hsv[2] / 100;
|
|
6913
|
-
const c3 =
|
|
6927
|
+
const c3 = s2 * v;
|
|
6914
6928
|
let f = 0;
|
|
6915
6929
|
if (c3 < 1) {
|
|
6916
6930
|
f = (v - c3) / (1 - c3);
|
|
@@ -6920,14 +6934,14 @@ var require_color = __commonJS({
|
|
|
6920
6934
|
convert.hcg.rgb = function(hcg) {
|
|
6921
6935
|
const h4 = hcg[0] / 360;
|
|
6922
6936
|
const c3 = hcg[1] / 100;
|
|
6923
|
-
const
|
|
6937
|
+
const g2 = hcg[2] / 100;
|
|
6924
6938
|
if (c3 === 0) {
|
|
6925
|
-
return [
|
|
6939
|
+
return [g2 * 255, g2 * 255, g2 * 255];
|
|
6926
6940
|
}
|
|
6927
6941
|
const pure = [0, 0, 0];
|
|
6928
6942
|
const hi = h4 % 1 * 6;
|
|
6929
6943
|
const v = hi % 1;
|
|
6930
|
-
const
|
|
6944
|
+
const w3 = 1 - v;
|
|
6931
6945
|
let mg = 0;
|
|
6932
6946
|
switch (Math.floor(hi)) {
|
|
6933
6947
|
case 0: {
|
|
@@ -6937,7 +6951,7 @@ var require_color = __commonJS({
|
|
|
6937
6951
|
break;
|
|
6938
6952
|
}
|
|
6939
6953
|
case 1: {
|
|
6940
|
-
pure[0] =
|
|
6954
|
+
pure[0] = w3;
|
|
6941
6955
|
pure[1] = 1;
|
|
6942
6956
|
pure[2] = 0;
|
|
6943
6957
|
break;
|
|
@@ -6950,7 +6964,7 @@ var require_color = __commonJS({
|
|
|
6950
6964
|
}
|
|
6951
6965
|
case 3: {
|
|
6952
6966
|
pure[0] = 0;
|
|
6953
|
-
pure[1] =
|
|
6967
|
+
pure[1] = w3;
|
|
6954
6968
|
pure[2] = 1;
|
|
6955
6969
|
break;
|
|
6956
6970
|
}
|
|
@@ -6963,10 +6977,10 @@ var require_color = __commonJS({
|
|
|
6963
6977
|
default: {
|
|
6964
6978
|
pure[0] = 1;
|
|
6965
6979
|
pure[1] = 0;
|
|
6966
|
-
pure[2] =
|
|
6980
|
+
pure[2] = w3;
|
|
6967
6981
|
}
|
|
6968
6982
|
}
|
|
6969
|
-
mg = (1 - c3) *
|
|
6983
|
+
mg = (1 - c3) * g2;
|
|
6970
6984
|
return [
|
|
6971
6985
|
(c3 * pure[0] + mg) * 255,
|
|
6972
6986
|
(c3 * pure[1] + mg) * 255,
|
|
@@ -6975,8 +6989,8 @@ var require_color = __commonJS({
|
|
|
6975
6989
|
};
|
|
6976
6990
|
convert.hcg.hsv = function(hcg) {
|
|
6977
6991
|
const c3 = hcg[1] / 100;
|
|
6978
|
-
const
|
|
6979
|
-
const v = c3 +
|
|
6992
|
+
const g2 = hcg[2] / 100;
|
|
6993
|
+
const v = c3 + g2 * (1 - c3);
|
|
6980
6994
|
let f = 0;
|
|
6981
6995
|
if (v > 0) {
|
|
6982
6996
|
f = c3 / v;
|
|
@@ -6985,32 +6999,32 @@ var require_color = __commonJS({
|
|
|
6985
6999
|
};
|
|
6986
7000
|
convert.hcg.hsl = function(hcg) {
|
|
6987
7001
|
const c3 = hcg[1] / 100;
|
|
6988
|
-
const
|
|
6989
|
-
const l =
|
|
6990
|
-
let
|
|
7002
|
+
const g2 = hcg[2] / 100;
|
|
7003
|
+
const l = g2 * (1 - c3) + 0.5 * c3;
|
|
7004
|
+
let s2 = 0;
|
|
6991
7005
|
if (l > 0 && l < 0.5) {
|
|
6992
|
-
|
|
7006
|
+
s2 = c3 / (2 * l);
|
|
6993
7007
|
} else if (l >= 0.5 && l < 1) {
|
|
6994
|
-
|
|
7008
|
+
s2 = c3 / (2 * (1 - l));
|
|
6995
7009
|
}
|
|
6996
|
-
return [hcg[0],
|
|
7010
|
+
return [hcg[0], s2 * 100, l * 100];
|
|
6997
7011
|
};
|
|
6998
7012
|
convert.hcg.hwb = function(hcg) {
|
|
6999
7013
|
const c3 = hcg[1] / 100;
|
|
7000
|
-
const
|
|
7001
|
-
const v = c3 +
|
|
7014
|
+
const g2 = hcg[2] / 100;
|
|
7015
|
+
const v = c3 + g2 * (1 - c3);
|
|
7002
7016
|
return [hcg[0], (v - c3) * 100, (1 - v) * 100];
|
|
7003
7017
|
};
|
|
7004
7018
|
convert.hwb.hcg = function(hwb) {
|
|
7005
|
-
const
|
|
7019
|
+
const w3 = hwb[1] / 100;
|
|
7006
7020
|
const b = hwb[2] / 100;
|
|
7007
7021
|
const v = 1 - b;
|
|
7008
|
-
const c3 = v -
|
|
7009
|
-
let
|
|
7022
|
+
const c3 = v - w3;
|
|
7023
|
+
let g2 = 0;
|
|
7010
7024
|
if (c3 < 1) {
|
|
7011
|
-
|
|
7025
|
+
g2 = (v - c3) / (1 - c3);
|
|
7012
7026
|
}
|
|
7013
|
-
return [hwb[0], c3 * 100,
|
|
7027
|
+
return [hwb[0], c3 * 100, g2 * 100];
|
|
7014
7028
|
};
|
|
7015
7029
|
convert.apple.rgb = function(apple) {
|
|
7016
7030
|
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
@@ -7458,9 +7472,9 @@ var require_color = __commonJS({
|
|
|
7458
7472
|
const color1 = mixinColor.rgb();
|
|
7459
7473
|
const color2 = this.rgb();
|
|
7460
7474
|
const p2 = weight === void 0 ? 0.5 : weight;
|
|
7461
|
-
const
|
|
7475
|
+
const w3 = 2 * p2 - 1;
|
|
7462
7476
|
const a2 = color1.alpha() - color2.alpha();
|
|
7463
|
-
const w1 = ((
|
|
7477
|
+
const w1 = ((w3 * a2 === -1 ? w3 : (w3 + a2) / (1 + w3 * a2)) + 1) / 2;
|
|
7464
7478
|
const w22 = 1 - w1;
|
|
7465
7479
|
return Color.rgb(
|
|
7466
7480
|
w1 * color1.red() + w22 * color2.red(),
|
|
@@ -7502,8 +7516,8 @@ var require_color = __commonJS({
|
|
|
7502
7516
|
}
|
|
7503
7517
|
function getset(model, channel, modifier) {
|
|
7504
7518
|
model = Array.isArray(model) ? model : [model];
|
|
7505
|
-
for (const
|
|
7506
|
-
(limiters[
|
|
7519
|
+
for (const m2 of model) {
|
|
7520
|
+
(limiters[m2] || (limiters[m2] = []))[channel] = modifier;
|
|
7507
7521
|
}
|
|
7508
7522
|
model = model[0];
|
|
7509
7523
|
return function(value) {
|
|
@@ -9072,7 +9086,7 @@ var init_encode = __esm({
|
|
|
9072
9086
|
// ../codec-jsquash-png/dist/index.mjs
|
|
9073
9087
|
var dist_exports3 = {};
|
|
9074
9088
|
__export(dist_exports3, {
|
|
9075
|
-
codecJsquashPng: () =>
|
|
9089
|
+
codecJsquashPng: () => w2,
|
|
9076
9090
|
default: () => p
|
|
9077
9091
|
});
|
|
9078
9092
|
function c2() {
|
|
@@ -9089,7 +9103,7 @@ async function h3(e) {
|
|
|
9089
9103
|
throw new Error(`Failed to read PNG file ${e}: ${a2}`);
|
|
9090
9104
|
}
|
|
9091
9105
|
}
|
|
9092
|
-
async function
|
|
9106
|
+
async function m(e, a2) {
|
|
9093
9107
|
try {
|
|
9094
9108
|
let { encode: t } = await c2(), n2 = { data: new Uint8ClampedArray(e.data.buffer, e.data.byteOffset, e.data.byteLength), width: e.width, height: e.height, colorSpace: "srgb" }, r = await t(n2);
|
|
9095
9109
|
(0, import_fs2.writeFileSync)(a2, Buffer.from(r));
|
|
@@ -9097,7 +9111,7 @@ async function m2(e, a2) {
|
|
|
9097
9111
|
throw new Error(`Failed to write PNG file ${a2}: ${t}`);
|
|
9098
9112
|
}
|
|
9099
9113
|
}
|
|
9100
|
-
var import_fs2, import_path, i2, o2,
|
|
9114
|
+
var import_fs2, import_path, i2, o2, w2, p;
|
|
9101
9115
|
var init_dist3 = __esm({
|
|
9102
9116
|
"../codec-jsquash-png/dist/index.mjs"() {
|
|
9103
9117
|
"use strict";
|
|
@@ -9108,8 +9122,8 @@ var init_dist3 = __esm({
|
|
|
9108
9122
|
throw Error('Dynamic require of "' + e + '" is not supported');
|
|
9109
9123
|
});
|
|
9110
9124
|
o2 = null;
|
|
9111
|
-
|
|
9112
|
-
p =
|
|
9125
|
+
w2 = { read: h3, write: m };
|
|
9126
|
+
p = w2;
|
|
9113
9127
|
}
|
|
9114
9128
|
});
|
|
9115
9129
|
|
|
@@ -9122,7 +9136,7 @@ module.exports = __toCommonJS(gmsd_exports);
|
|
|
9122
9136
|
|
|
9123
9137
|
// ../gmsd/dist/index.mjs
|
|
9124
9138
|
function D(e, n2, a2, t, r, o3 = {}) {
|
|
9125
|
-
let { downsample:
|
|
9139
|
+
let { downsample: s2 = 0, c: c3 = 170 } = o3;
|
|
9126
9140
|
if (H(e, n2)) {
|
|
9127
9141
|
if (a2) for (let y = 0; y < t * r * 4; y += 4) a2[y] = 255, a2[y + 1] = 255, a2[y + 2] = 255, a2[y + 3] = 255;
|
|
9128
9142
|
return 0;
|
|
@@ -9133,7 +9147,7 @@ function D(e, n2, a2, t, r, o3 = {}) {
|
|
|
9133
9147
|
l = new Float32Array(t * r), u = new Float32Array(t * r);
|
|
9134
9148
|
for (let y = 0; y < t * r; y++) l[y] = e[y], u[y] = n2[y];
|
|
9135
9149
|
}
|
|
9136
|
-
if (
|
|
9150
|
+
if (s2 === 1) {
|
|
9137
9151
|
let y = P(l, t, r), k = P(u, t, r), d2 = Math.floor(t / 2), I = Math.floor(r / 2), M = new Float32Array(d2 * I), v = new Float32Array(d2 * I);
|
|
9138
9152
|
for (let i3 = 0; i3 < I; i3++) for (let p2 = 0; p2 < d2; p2++) {
|
|
9139
9153
|
let G = i3 * 2 * t + p2 * 2;
|
|
@@ -9141,7 +9155,7 @@ function D(e, n2, a2, t, r, o3 = {}) {
|
|
|
9141
9155
|
}
|
|
9142
9156
|
l = M, u = v, b = d2, x = I;
|
|
9143
9157
|
}
|
|
9144
|
-
let F = B(l, b, x), A = B(u, b, x),
|
|
9158
|
+
let F = B(l, b, x), A = B(u, b, x), g2 = U(F, A, c3, b, x), S = W(g2);
|
|
9145
9159
|
return a2 && O(a2, F, A, c3, b, x), S;
|
|
9146
9160
|
}
|
|
9147
9161
|
function H(e, n2) {
|
|
@@ -9152,41 +9166,41 @@ function H(e, n2) {
|
|
|
9152
9166
|
function P(e, n2, a2) {
|
|
9153
9167
|
let t = new Float32Array(n2 * a2);
|
|
9154
9168
|
for (let r = 0; r < a2; r++) for (let o3 = 0; o3 < n2; o3++) {
|
|
9155
|
-
let
|
|
9156
|
-
for (let c3 = 0; c3 < 2; c3++) for (let
|
|
9157
|
-
let f = r + c3, l = o3 +
|
|
9158
|
-
f < a2 && l < n2 && (
|
|
9169
|
+
let s2 = 0;
|
|
9170
|
+
for (let c3 = 0; c3 < 2; c3++) for (let m2 = 0; m2 < 2; m2++) {
|
|
9171
|
+
let f = r + c3, l = o3 + m2;
|
|
9172
|
+
f < a2 && l < n2 && (s2 += e[f * n2 + l]);
|
|
9159
9173
|
}
|
|
9160
|
-
t[r * n2 + o3] =
|
|
9174
|
+
t[r * n2 + o3] = s2 / 4;
|
|
9161
9175
|
}
|
|
9162
9176
|
return t;
|
|
9163
9177
|
}
|
|
9164
9178
|
function O(e, n2, a2, t, r, o3) {
|
|
9165
9179
|
e.fill(0);
|
|
9166
|
-
for (let
|
|
9167
|
-
let
|
|
9180
|
+
for (let s2 = 1; s2 < o3 - 1; s2++) for (let c3 = 1; c3 < r - 1; c3++) {
|
|
9181
|
+
let m2 = s2 * r + c3, f = n2[m2], l = a2[m2], u = 2 * f * l + t, b = f * f + l * l + t, x = u / b, F = Math.floor(x * 255), A = m2 * 4;
|
|
9168
9182
|
e[A] = F, e[A + 1] = F, e[A + 2] = F, e[A + 3] = 255;
|
|
9169
9183
|
}
|
|
9170
9184
|
}
|
|
9171
9185
|
function q(e, n2, a2, t) {
|
|
9172
9186
|
let r = a2 * t;
|
|
9173
9187
|
for (let o3 = 0; o3 < r; o3++) {
|
|
9174
|
-
let
|
|
9175
|
-
n2[o3] = 0.298936 * c3 + 0.587043 *
|
|
9188
|
+
let s2 = o3 * 4, c3 = e[s2], m2 = e[s2 + 1], f = e[s2 + 2];
|
|
9189
|
+
n2[o3] = 0.298936 * c3 + 0.587043 * m2 + 0.114021 * f;
|
|
9176
9190
|
}
|
|
9177
9191
|
}
|
|
9178
9192
|
function B(e, n2, a2) {
|
|
9179
9193
|
let t = new Float32Array(n2 * a2);
|
|
9180
9194
|
for (let r = 1; r < a2 - 1; r++) for (let o3 = 1; o3 < n2 - 1; o3++) {
|
|
9181
|
-
let
|
|
9182
|
-
t[
|
|
9195
|
+
let s2 = r * n2 + o3, c3 = e[(r - 1) * n2 + (o3 - 1)], m2 = e[(r - 1) * n2 + o3], f = e[(r - 1) * n2 + (o3 + 1)], l = e[r * n2 + (o3 - 1)], u = e[r * n2 + (o3 + 1)], b = e[(r + 1) * n2 + (o3 - 1)], x = e[(r + 1) * n2 + o3], F = e[(r + 1) * n2 + (o3 + 1)], A = (c3 + l + b - f - u - F) / 3, g2 = (c3 + m2 + f - b - x - F) / 3;
|
|
9196
|
+
t[s2] = Math.sqrt(A * A + g2 * g2);
|
|
9183
9197
|
}
|
|
9184
9198
|
return t;
|
|
9185
9199
|
}
|
|
9186
9200
|
function U(e, n2, a2, t, r) {
|
|
9187
9201
|
let o3 = [];
|
|
9188
|
-
for (let
|
|
9189
|
-
let
|
|
9202
|
+
for (let s2 = 1; s2 < r - 1; s2++) for (let c3 = 1; c3 < t - 1; c3++) {
|
|
9203
|
+
let m2 = s2 * t + c3, f = e[m2], l = n2[m2], u = 2 * f * l + a2, b = f * f + l * l + a2;
|
|
9190
9204
|
o3.push(u / b);
|
|
9191
9205
|
}
|
|
9192
9206
|
return new Float32Array(o3);
|
|
@@ -9198,8 +9212,8 @@ function W(e) {
|
|
|
9198
9212
|
for (let o3 = 0; o3 < n2; o3++) a2 += e[o3];
|
|
9199
9213
|
let t = a2 / n2, r = 0;
|
|
9200
9214
|
for (let o3 = 0; o3 < n2; o3++) {
|
|
9201
|
-
let
|
|
9202
|
-
r +=
|
|
9215
|
+
let s2 = e[o3] - t;
|
|
9216
|
+
r += s2 * s2;
|
|
9203
9217
|
}
|
|
9204
9218
|
return r /= n2, Math.sqrt(r);
|
|
9205
9219
|
}
|