@blazediff/cli 2.1.4 → 3.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.
- package/README.md +9 -8
- package/dist/cli.js +1178 -804
- package/dist/commands/core.js +841 -479
- package/dist/commands/gmsd.js +831 -469
- package/dist/commands/hitchhikers-ssim.js +819 -457
- package/dist/commands/msssim.js +839 -475
- package/dist/commands/ssim.js +853 -489
- package/dist/index.d.ts +6 -6
- package/package.json +2 -1
package/dist/commands/core.js
CHANGED
|
@@ -219,8 +219,8 @@ var require_interlace = __commonJS({
|
|
|
219
219
|
let yLeftOver = height % 8;
|
|
220
220
|
let xRepeats = (width - xLeftOver) / 8;
|
|
221
221
|
let yRepeats = (height - yLeftOver) / 8;
|
|
222
|
-
for (let
|
|
223
|
-
let pass = imagePasses[
|
|
222
|
+
for (let i3 = 0; i3 < imagePasses.length; i3++) {
|
|
223
|
+
let pass = imagePasses[i3];
|
|
224
224
|
let passWidth = xRepeats * pass.x.length;
|
|
225
225
|
let passHeight = yRepeats * pass.y.length;
|
|
226
226
|
for (let j2 = 0; j2 < pass.x.length; j2++) {
|
|
@@ -238,7 +238,7 @@ var require_interlace = __commonJS({
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
if (passWidth > 0 && passHeight > 0) {
|
|
241
|
-
images.push({ width: passWidth, height: passHeight, index:
|
|
241
|
+
images.push({ width: passWidth, height: passHeight, index: i3 });
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
return images;
|
|
@@ -301,10 +301,10 @@ var require_filter_parse = __commonJS({
|
|
|
301
301
|
this._images = [];
|
|
302
302
|
if (interlace) {
|
|
303
303
|
let passes = interlaceUtils.getImagePasses(width, height);
|
|
304
|
-
for (let
|
|
304
|
+
for (let i3 = 0; i3 < passes.length; i3++) {
|
|
305
305
|
this._images.push({
|
|
306
|
-
byteWidth: getByteWidth(passes[
|
|
307
|
-
height: passes[
|
|
306
|
+
byteWidth: getByteWidth(passes[i3].width, bpp, depth),
|
|
307
|
+
height: passes[i3].height,
|
|
308
308
|
lineIndex: 0
|
|
309
309
|
});
|
|
310
310
|
}
|
|
@@ -483,8 +483,8 @@ var require_crc = __commonJS({
|
|
|
483
483
|
"use strict";
|
|
484
484
|
var crcTable = [];
|
|
485
485
|
(function() {
|
|
486
|
-
for (let
|
|
487
|
-
let currentCrc =
|
|
486
|
+
for (let i3 = 0; i3 < 256; i3++) {
|
|
487
|
+
let currentCrc = i3;
|
|
488
488
|
for (let j2 = 0; j2 < 8; j2++) {
|
|
489
489
|
if (currentCrc & 1) {
|
|
490
490
|
currentCrc = 3988292384 ^ currentCrc >>> 1;
|
|
@@ -492,15 +492,15 @@ var require_crc = __commonJS({
|
|
|
492
492
|
currentCrc = currentCrc >>> 1;
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
-
crcTable[
|
|
495
|
+
crcTable[i3] = currentCrc;
|
|
496
496
|
}
|
|
497
497
|
})();
|
|
498
498
|
var CrcCalculator = module2.exports = function() {
|
|
499
499
|
this._crc = -1;
|
|
500
500
|
};
|
|
501
501
|
CrcCalculator.prototype.write = function(data) {
|
|
502
|
-
for (let
|
|
503
|
-
this._crc = crcTable[(this._crc ^ data[
|
|
502
|
+
for (let i3 = 0; i3 < data.length; i3++) {
|
|
503
|
+
this._crc = crcTable[(this._crc ^ data[i3]) & 255] ^ this._crc >>> 8;
|
|
504
504
|
}
|
|
505
505
|
return true;
|
|
506
506
|
};
|
|
@@ -509,8 +509,8 @@ var require_crc = __commonJS({
|
|
|
509
509
|
};
|
|
510
510
|
CrcCalculator.crc32 = function(buf) {
|
|
511
511
|
let crc = -1;
|
|
512
|
-
for (let
|
|
513
|
-
crc = crcTable[(crc ^ buf[
|
|
512
|
+
for (let i3 = 0; i3 < buf.length; i3++) {
|
|
513
|
+
crc = crcTable[(crc ^ buf[i3]) & 255] ^ crc >>> 8;
|
|
514
514
|
}
|
|
515
515
|
return crc ^ -1;
|
|
516
516
|
};
|
|
@@ -556,8 +556,8 @@ var require_parser = __commonJS({
|
|
|
556
556
|
};
|
|
557
557
|
Parser.prototype._parseSignature = function(data) {
|
|
558
558
|
let signature = constants.PNG_SIGNATURE;
|
|
559
|
-
for (let
|
|
560
|
-
if (data[
|
|
559
|
+
for (let i3 = 0; i3 < signature.length; i3++) {
|
|
560
|
+
if (data[i3] !== signature[i3]) {
|
|
561
561
|
this.error(new Error("Invalid file signature"));
|
|
562
562
|
return;
|
|
563
563
|
}
|
|
@@ -568,8 +568,8 @@ var require_parser = __commonJS({
|
|
|
568
568
|
let length = data.readUInt32BE(0);
|
|
569
569
|
let type = data.readUInt32BE(4);
|
|
570
570
|
let name = "";
|
|
571
|
-
for (let
|
|
572
|
-
name += String.fromCharCode(data[
|
|
571
|
+
for (let i3 = 4; i3 < 8; i3++) {
|
|
572
|
+
name += String.fromCharCode(data[i3]);
|
|
573
573
|
}
|
|
574
574
|
let ancillary = Boolean(data[4] & 32);
|
|
575
575
|
if (!this._hasIHDR && type !== constants.TYPE_IHDR) {
|
|
@@ -658,8 +658,8 @@ var require_parser = __commonJS({
|
|
|
658
658
|
Parser.prototype._parsePLTE = function(data) {
|
|
659
659
|
this._crc.write(data);
|
|
660
660
|
let entries = Math.floor(data.length / 3);
|
|
661
|
-
for (let
|
|
662
|
-
this._palette.push([data[
|
|
661
|
+
for (let i3 = 0; i3 < entries; i3++) {
|
|
662
|
+
this._palette.push([data[i3 * 3], data[i3 * 3 + 1], data[i3 * 3 + 2], 255]);
|
|
663
663
|
}
|
|
664
664
|
this.palette(this._palette);
|
|
665
665
|
this._handleChunkEnd();
|
|
@@ -679,8 +679,8 @@ var require_parser = __commonJS({
|
|
|
679
679
|
this.error(new Error("More transparent colors than palette size"));
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
682
|
-
for (let
|
|
683
|
-
this._palette[
|
|
682
|
+
for (let i3 = 0; i3 < data.length; i3++) {
|
|
683
|
+
this._palette[i3][3] = data[i3];
|
|
684
684
|
}
|
|
685
685
|
this.palette(this._palette);
|
|
686
686
|
}
|
|
@@ -835,20 +835,20 @@ var require_bitmapper = __commonJS({
|
|
|
835
835
|
];
|
|
836
836
|
function bitRetriever(data, depth) {
|
|
837
837
|
let leftOver = [];
|
|
838
|
-
let
|
|
838
|
+
let i3 = 0;
|
|
839
839
|
function split() {
|
|
840
|
-
if (
|
|
840
|
+
if (i3 === data.length) {
|
|
841
841
|
throw new Error("Ran out of data");
|
|
842
842
|
}
|
|
843
|
-
let byte = data[
|
|
844
|
-
|
|
843
|
+
let byte = data[i3];
|
|
844
|
+
i3++;
|
|
845
845
|
let byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1;
|
|
846
846
|
switch (depth) {
|
|
847
847
|
default:
|
|
848
848
|
throw new Error("unrecognised depth");
|
|
849
849
|
case 16:
|
|
850
|
-
byte2 = data[
|
|
851
|
-
|
|
850
|
+
byte2 = data[i3];
|
|
851
|
+
i3++;
|
|
852
852
|
leftOver.push((byte << 8) + byte2);
|
|
853
853
|
break;
|
|
854
854
|
case 4:
|
|
@@ -889,7 +889,7 @@ var require_bitmapper = __commonJS({
|
|
|
889
889
|
leftOver.length = 0;
|
|
890
890
|
},
|
|
891
891
|
end: function() {
|
|
892
|
-
if (
|
|
892
|
+
if (i3 !== data.length) {
|
|
893
893
|
throw new Error("extra data found");
|
|
894
894
|
}
|
|
895
895
|
}
|
|
@@ -998,8 +998,8 @@ var require_format_normaliser = __commonJS({
|
|
|
998
998
|
if (!color) {
|
|
999
999
|
throw new Error("index " + indata[pxPos] + " not in palette");
|
|
1000
1000
|
}
|
|
1001
|
-
for (let
|
|
1002
|
-
outdata[pxPos +
|
|
1001
|
+
for (let i3 = 0; i3 < 4; i3++) {
|
|
1002
|
+
outdata[pxPos + i3] = color[i3];
|
|
1003
1003
|
}
|
|
1004
1004
|
pxPos += 4;
|
|
1005
1005
|
}
|
|
@@ -1018,8 +1018,8 @@ var require_format_normaliser = __commonJS({
|
|
|
1018
1018
|
makeTrans = true;
|
|
1019
1019
|
}
|
|
1020
1020
|
if (makeTrans) {
|
|
1021
|
-
for (let
|
|
1022
|
-
outdata[pxPos +
|
|
1021
|
+
for (let i3 = 0; i3 < 4; i3++) {
|
|
1022
|
+
outdata[pxPos + i3] = 0;
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
pxPos += 4;
|
|
@@ -1032,9 +1032,9 @@ var require_format_normaliser = __commonJS({
|
|
|
1032
1032
|
let pxPos = 0;
|
|
1033
1033
|
for (let y = 0; y < height; y++) {
|
|
1034
1034
|
for (let x = 0; x < width; x++) {
|
|
1035
|
-
for (let
|
|
1036
|
-
outdata[pxPos +
|
|
1037
|
-
indata[pxPos +
|
|
1035
|
+
for (let i3 = 0; i3 < 4; i3++) {
|
|
1036
|
+
outdata[pxPos + i3] = Math.floor(
|
|
1037
|
+
indata[pxPos + i3] * maxOutSample / maxInSample + 0.5
|
|
1038
1038
|
);
|
|
1039
1039
|
}
|
|
1040
1040
|
pxPos += 4;
|
|
@@ -1360,8 +1360,8 @@ var require_filter_pack = __commonJS({
|
|
|
1360
1360
|
function filterSumNone(pxData, pxPos, byteWidth) {
|
|
1361
1361
|
let sum = 0;
|
|
1362
1362
|
let length = pxPos + byteWidth;
|
|
1363
|
-
for (let
|
|
1364
|
-
sum += Math.abs(pxData[
|
|
1363
|
+
for (let i3 = pxPos; i3 < length; i3++) {
|
|
1364
|
+
sum += Math.abs(pxData[i3]);
|
|
1365
1365
|
}
|
|
1366
1366
|
return sum;
|
|
1367
1367
|
}
|
|
@@ -1470,10 +1470,10 @@ var require_filter_pack = __commonJS({
|
|
|
1470
1470
|
for (let y = 0; y < height; y++) {
|
|
1471
1471
|
if (filterTypes.length > 1) {
|
|
1472
1472
|
let min = Infinity;
|
|
1473
|
-
for (let
|
|
1474
|
-
let sum = filterSums[filterTypes[
|
|
1473
|
+
for (let i3 = 0; i3 < filterTypes.length; i3++) {
|
|
1474
|
+
let sum = filterSums[filterTypes[i3]](pxData, pxPos, byteWidth, bpp);
|
|
1475
1475
|
if (sum < min) {
|
|
1476
|
-
sel = filterTypes[
|
|
1476
|
+
sel = filterTypes[i3];
|
|
1477
1477
|
min = sum;
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
@@ -1670,7 +1670,7 @@ var require_sync_inflate = __commonJS({
|
|
|
1670
1670
|
if (typeof asyncCb === "function") {
|
|
1671
1671
|
return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb);
|
|
1672
1672
|
}
|
|
1673
|
-
let
|
|
1673
|
+
let self2 = this;
|
|
1674
1674
|
let availInBefore = chunk && chunk.length;
|
|
1675
1675
|
let availOutBefore = this._chunkSize - this._offset;
|
|
1676
1676
|
let leftToInflate = this._maxLength;
|
|
@@ -1682,14 +1682,14 @@ var require_sync_inflate = __commonJS({
|
|
|
1682
1682
|
error = err;
|
|
1683
1683
|
});
|
|
1684
1684
|
function handleChunk(availInAfter, availOutAfter) {
|
|
1685
|
-
if (
|
|
1685
|
+
if (self2._hadError) {
|
|
1686
1686
|
return;
|
|
1687
1687
|
}
|
|
1688
1688
|
let have = availOutBefore - availOutAfter;
|
|
1689
1689
|
assert(have >= 0, "have should not go down");
|
|
1690
1690
|
if (have > 0) {
|
|
1691
|
-
let out =
|
|
1692
|
-
|
|
1691
|
+
let out = self2._buffer.slice(self2._offset, self2._offset + have);
|
|
1692
|
+
self2._offset += have;
|
|
1693
1693
|
if (out.length > leftToInflate) {
|
|
1694
1694
|
out = out.slice(0, leftToInflate);
|
|
1695
1695
|
}
|
|
@@ -1700,10 +1700,10 @@ var require_sync_inflate = __commonJS({
|
|
|
1700
1700
|
return false;
|
|
1701
1701
|
}
|
|
1702
1702
|
}
|
|
1703
|
-
if (availOutAfter === 0 ||
|
|
1704
|
-
availOutBefore =
|
|
1705
|
-
|
|
1706
|
-
|
|
1703
|
+
if (availOutAfter === 0 || self2._offset >= self2._chunkSize) {
|
|
1704
|
+
availOutBefore = self2._chunkSize;
|
|
1705
|
+
self2._offset = 0;
|
|
1706
|
+
self2._buffer = Buffer.allocUnsafe(self2._chunkSize);
|
|
1707
1707
|
}
|
|
1708
1708
|
if (availOutAfter === 0) {
|
|
1709
1709
|
inOff += availInBefore - availInAfter;
|
|
@@ -2106,10 +2106,10 @@ var require_png = __commonJS({
|
|
|
2106
2106
|
for (let y = 0; y < src.height; y++) {
|
|
2107
2107
|
for (let x = 0; x < src.width; x++) {
|
|
2108
2108
|
let idx = src.width * y + x << 2;
|
|
2109
|
-
for (let
|
|
2110
|
-
let sample = src.data[idx +
|
|
2109
|
+
for (let i3 = 0; i3 < 3; i3++) {
|
|
2110
|
+
let sample = src.data[idx + i3] / 255;
|
|
2111
2111
|
sample = Math.pow(sample, 1 / 2.2 / src.gamma);
|
|
2112
|
-
src.data[idx +
|
|
2112
|
+
src.data[idx + i3] = Math.round(sample * 255);
|
|
2113
2113
|
}
|
|
2114
2114
|
}
|
|
2115
2115
|
}
|
|
@@ -2125,37 +2125,37 @@ var require_png = __commonJS({
|
|
|
2125
2125
|
// ../codec-pngjs/dist/index.mjs
|
|
2126
2126
|
var dist_exports = {};
|
|
2127
2127
|
__export(dist_exports, {
|
|
2128
|
-
|
|
2129
|
-
|
|
2128
|
+
codecPngjs: () => h,
|
|
2129
|
+
default: () => m
|
|
2130
2130
|
});
|
|
2131
2131
|
async function d(r) {
|
|
2132
|
-
return new Promise((
|
|
2132
|
+
return new Promise((i3, n3) => {
|
|
2133
2133
|
try {
|
|
2134
2134
|
let t = typeof r == "string" ? (0, import_fs.readFileSync)(r) : r, e = import_pngjs.PNG.sync.read(t);
|
|
2135
|
-
|
|
2135
|
+
i3({ data: e.data, width: e.width, height: e.height });
|
|
2136
2136
|
} catch (t) {
|
|
2137
|
-
|
|
2137
|
+
n3(new Error(`Failed to read PNG file ${r}: ${t}`));
|
|
2138
2138
|
}
|
|
2139
2139
|
});
|
|
2140
2140
|
}
|
|
2141
|
-
async function
|
|
2142
|
-
return new Promise((
|
|
2141
|
+
async function c(r, i3) {
|
|
2142
|
+
return new Promise((n3, t) => {
|
|
2143
2143
|
try {
|
|
2144
2144
|
let e = new import_pngjs.PNG({ width: r.width, height: r.height });
|
|
2145
|
-
e.data = Buffer.isBuffer(r.data) ? r.data : Buffer.from(r.data.buffer), (0, import_fs.writeFileSync)(
|
|
2145
|
+
e.data = Buffer.isBuffer(r.data) ? r.data : Buffer.from(r.data.buffer), (0, import_fs.writeFileSync)(i3, import_pngjs.PNG.sync.write(e)), n3();
|
|
2146
2146
|
} catch (e) {
|
|
2147
|
-
t(new Error(`Failed to write PNG file ${
|
|
2147
|
+
t(new Error(`Failed to write PNG file ${i3}: ${e}`));
|
|
2148
2148
|
}
|
|
2149
2149
|
});
|
|
2150
2150
|
}
|
|
2151
|
-
var import_fs, import_pngjs,
|
|
2151
|
+
var import_fs, import_pngjs, h, m;
|
|
2152
2152
|
var init_dist = __esm({
|
|
2153
2153
|
"../codec-pngjs/dist/index.mjs"() {
|
|
2154
2154
|
"use strict";
|
|
2155
2155
|
import_fs = require("fs");
|
|
2156
2156
|
import_pngjs = __toESM(require_png(), 1);
|
|
2157
|
-
|
|
2158
|
-
m =
|
|
2157
|
+
h = { read: d, write: c };
|
|
2158
|
+
m = h;
|
|
2159
2159
|
}
|
|
2160
2160
|
});
|
|
2161
2161
|
|
|
@@ -2250,7 +2250,7 @@ var require_filesystem = __commonJS({
|
|
|
2250
2250
|
var LDD_PATH = "/usr/bin/ldd";
|
|
2251
2251
|
var SELF_PATH = "/proc/self/exe";
|
|
2252
2252
|
var MAX_LENGTH = 2048;
|
|
2253
|
-
var
|
|
2253
|
+
var readFileSync3 = (path) => {
|
|
2254
2254
|
const fd = fs.openSync(path, "r");
|
|
2255
2255
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
2256
2256
|
const bytesRead = fs.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
@@ -2275,7 +2275,7 @@ var require_filesystem = __commonJS({
|
|
|
2275
2275
|
module2.exports = {
|
|
2276
2276
|
LDD_PATH,
|
|
2277
2277
|
SELF_PATH,
|
|
2278
|
-
readFileSync:
|
|
2278
|
+
readFileSync: readFileSync3,
|
|
2279
2279
|
readFile
|
|
2280
2280
|
};
|
|
2281
2281
|
}
|
|
@@ -2301,8 +2301,8 @@ var require_elf = __commonJS({
|
|
|
2301
2301
|
const offset = elf.readUInt32LE(32);
|
|
2302
2302
|
const size = elf.readUInt16LE(54);
|
|
2303
2303
|
const count = elf.readUInt16LE(56);
|
|
2304
|
-
for (let
|
|
2305
|
-
const headerOffset = offset +
|
|
2304
|
+
for (let i3 = 0; i3 < count; i3++) {
|
|
2305
|
+
const headerOffset = offset + i3 * size;
|
|
2306
2306
|
const type = elf.readUInt32LE(headerOffset);
|
|
2307
2307
|
if (type === 3) {
|
|
2308
2308
|
const fileOffset = elf.readUInt32LE(headerOffset + 8);
|
|
@@ -2324,7 +2324,7 @@ var require_detect_libc = __commonJS({
|
|
|
2324
2324
|
"use strict";
|
|
2325
2325
|
var childProcess = require("child_process");
|
|
2326
2326
|
var { isLinux, getReport } = require_process();
|
|
2327
|
-
var { LDD_PATH, SELF_PATH, readFile, readFileSync:
|
|
2327
|
+
var { LDD_PATH, SELF_PATH, readFile, readFileSync: readFileSync3 } = require_filesystem();
|
|
2328
2328
|
var { interpreterPath } = require_elf();
|
|
2329
2329
|
var cachedFamilyInterpreter;
|
|
2330
2330
|
var cachedFamilyFilesystem;
|
|
@@ -2416,7 +2416,7 @@ var require_detect_libc = __commonJS({
|
|
|
2416
2416
|
}
|
|
2417
2417
|
cachedFamilyFilesystem = null;
|
|
2418
2418
|
try {
|
|
2419
|
-
const lddContent =
|
|
2419
|
+
const lddContent = readFileSync3(LDD_PATH);
|
|
2420
2420
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
2421
2421
|
} catch (e) {
|
|
2422
2422
|
}
|
|
@@ -2441,7 +2441,7 @@ var require_detect_libc = __commonJS({
|
|
|
2441
2441
|
}
|
|
2442
2442
|
cachedFamilyInterpreter = null;
|
|
2443
2443
|
try {
|
|
2444
|
-
const selfContent =
|
|
2444
|
+
const selfContent = readFileSync3(SELF_PATH);
|
|
2445
2445
|
const path = interpreterPath(selfContent);
|
|
2446
2446
|
cachedFamilyInterpreter = familyFromInterpreterPath(path);
|
|
2447
2447
|
} catch (e) {
|
|
@@ -2505,7 +2505,7 @@ var require_detect_libc = __commonJS({
|
|
|
2505
2505
|
}
|
|
2506
2506
|
cachedVersionFilesystem = null;
|
|
2507
2507
|
try {
|
|
2508
|
-
const lddContent =
|
|
2508
|
+
const lddContent = readFileSync3(LDD_PATH);
|
|
2509
2509
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
2510
2510
|
if (versionMatch) {
|
|
2511
2511
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -2521,7 +2521,7 @@ var require_detect_libc = __commonJS({
|
|
|
2521
2521
|
}
|
|
2522
2522
|
return null;
|
|
2523
2523
|
};
|
|
2524
|
-
var versionSuffix = (
|
|
2524
|
+
var versionSuffix = (s) => s.trim().split(/\s+/)[1];
|
|
2525
2525
|
var versionFromCommand = (out) => {
|
|
2526
2526
|
const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
|
|
2527
2527
|
if (getconf && getconf.includes(GLIBC)) {
|
|
@@ -2777,14 +2777,14 @@ var require_semver = __commonJS({
|
|
|
2777
2777
|
this.options = options;
|
|
2778
2778
|
this.loose = !!options.loose;
|
|
2779
2779
|
this.includePrerelease = !!options.includePrerelease;
|
|
2780
|
-
const
|
|
2781
|
-
if (!
|
|
2780
|
+
const m3 = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
2781
|
+
if (!m3) {
|
|
2782
2782
|
throw new TypeError(`Invalid Version: ${version}`);
|
|
2783
2783
|
}
|
|
2784
2784
|
this.raw = version;
|
|
2785
|
-
this.major = +
|
|
2786
|
-
this.minor = +
|
|
2787
|
-
this.patch = +
|
|
2785
|
+
this.major = +m3[1];
|
|
2786
|
+
this.minor = +m3[2];
|
|
2787
|
+
this.patch = +m3[3];
|
|
2788
2788
|
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
2789
2789
|
throw new TypeError("Invalid major version");
|
|
2790
2790
|
}
|
|
@@ -2794,10 +2794,10 @@ var require_semver = __commonJS({
|
|
|
2794
2794
|
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
2795
2795
|
throw new TypeError("Invalid patch version");
|
|
2796
2796
|
}
|
|
2797
|
-
if (!
|
|
2797
|
+
if (!m3[4]) {
|
|
2798
2798
|
this.prerelease = [];
|
|
2799
2799
|
} else {
|
|
2800
|
-
this.prerelease =
|
|
2800
|
+
this.prerelease = m3[4].split(".").map((id) => {
|
|
2801
2801
|
if (/^[0-9]+$/.test(id)) {
|
|
2802
2802
|
const num = +id;
|
|
2803
2803
|
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
@@ -2807,7 +2807,7 @@ var require_semver = __commonJS({
|
|
|
2807
2807
|
return id;
|
|
2808
2808
|
});
|
|
2809
2809
|
}
|
|
2810
|
-
this.build =
|
|
2810
|
+
this.build = m3[5] ? m3[5].split(".") : [];
|
|
2811
2811
|
this.format();
|
|
2812
2812
|
}
|
|
2813
2813
|
format() {
|
|
@@ -2868,11 +2868,11 @@ var require_semver = __commonJS({
|
|
|
2868
2868
|
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
2869
2869
|
return 0;
|
|
2870
2870
|
}
|
|
2871
|
-
let
|
|
2871
|
+
let i3 = 0;
|
|
2872
2872
|
do {
|
|
2873
|
-
const a2 = this.prerelease[
|
|
2874
|
-
const b = other.prerelease[
|
|
2875
|
-
debug("prerelease compare",
|
|
2873
|
+
const a2 = this.prerelease[i3];
|
|
2874
|
+
const b = other.prerelease[i3];
|
|
2875
|
+
debug("prerelease compare", i3, a2, b);
|
|
2876
2876
|
if (a2 === void 0 && b === void 0) {
|
|
2877
2877
|
return 0;
|
|
2878
2878
|
} else if (b === void 0) {
|
|
@@ -2884,17 +2884,17 @@ var require_semver = __commonJS({
|
|
|
2884
2884
|
} else {
|
|
2885
2885
|
return compareIdentifiers(a2, b);
|
|
2886
2886
|
}
|
|
2887
|
-
} while (++
|
|
2887
|
+
} while (++i3);
|
|
2888
2888
|
}
|
|
2889
2889
|
compareBuild(other) {
|
|
2890
2890
|
if (!(other instanceof _SemVer)) {
|
|
2891
2891
|
other = new _SemVer(other, this.options);
|
|
2892
2892
|
}
|
|
2893
|
-
let
|
|
2893
|
+
let i3 = 0;
|
|
2894
2894
|
do {
|
|
2895
|
-
const a2 = this.build[
|
|
2896
|
-
const b = other.build[
|
|
2897
|
-
debug("build compare",
|
|
2895
|
+
const a2 = this.build[i3];
|
|
2896
|
+
const b = other.build[i3];
|
|
2897
|
+
debug("build compare", i3, a2, b);
|
|
2898
2898
|
if (a2 === void 0 && b === void 0) {
|
|
2899
2899
|
return 0;
|
|
2900
2900
|
} else if (b === void 0) {
|
|
@@ -2906,7 +2906,7 @@ var require_semver = __commonJS({
|
|
|
2906
2906
|
} else {
|
|
2907
2907
|
return compareIdentifiers(a2, b);
|
|
2908
2908
|
}
|
|
2909
|
-
} while (++
|
|
2909
|
+
} while (++i3);
|
|
2910
2910
|
}
|
|
2911
2911
|
// preminor will bump the version up to the next minor release, and immediately
|
|
2912
2912
|
// down to pre-release. premajor and prepatch work the same way.
|
|
@@ -2983,14 +2983,14 @@ var require_semver = __commonJS({
|
|
|
2983
2983
|
if (this.prerelease.length === 0) {
|
|
2984
2984
|
this.prerelease = [base];
|
|
2985
2985
|
} else {
|
|
2986
|
-
let
|
|
2987
|
-
while (--
|
|
2988
|
-
if (typeof this.prerelease[
|
|
2989
|
-
this.prerelease[
|
|
2990
|
-
|
|
2986
|
+
let i3 = this.prerelease.length;
|
|
2987
|
+
while (--i3 >= 0) {
|
|
2988
|
+
if (typeof this.prerelease[i3] === "number") {
|
|
2989
|
+
this.prerelease[i3]++;
|
|
2990
|
+
i3 = -2;
|
|
2991
2991
|
}
|
|
2992
2992
|
}
|
|
2993
|
-
if (
|
|
2993
|
+
if (i3 === -1) {
|
|
2994
2994
|
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
2995
2995
|
throw new Error("invalid increment argument: identifier already exists");
|
|
2996
2996
|
}
|
|
@@ -3284,18 +3284,18 @@ var require_comparator = __commonJS({
|
|
|
3284
3284
|
}
|
|
3285
3285
|
parse(comp) {
|
|
3286
3286
|
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
3287
|
-
const
|
|
3288
|
-
if (!
|
|
3287
|
+
const m3 = comp.match(r);
|
|
3288
|
+
if (!m3) {
|
|
3289
3289
|
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
3290
3290
|
}
|
|
3291
|
-
this.operator =
|
|
3291
|
+
this.operator = m3[1] !== void 0 ? m3[1] : "";
|
|
3292
3292
|
if (this.operator === "=") {
|
|
3293
3293
|
this.operator = "";
|
|
3294
3294
|
}
|
|
3295
|
-
if (!
|
|
3295
|
+
if (!m3[2]) {
|
|
3296
3296
|
this.semver = ANY;
|
|
3297
3297
|
} else {
|
|
3298
|
-
this.semver = new SemVer(
|
|
3298
|
+
this.semver = new SemVer(m3[2], this.options.loose);
|
|
3299
3299
|
}
|
|
3300
3300
|
}
|
|
3301
3301
|
toString() {
|
|
@@ -3390,19 +3390,19 @@ var require_range = __commonJS({
|
|
|
3390
3390
|
this.loose = !!options.loose;
|
|
3391
3391
|
this.includePrerelease = !!options.includePrerelease;
|
|
3392
3392
|
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
3393
|
-
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((
|
|
3393
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c3) => c3.length);
|
|
3394
3394
|
if (!this.set.length) {
|
|
3395
3395
|
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
3396
3396
|
}
|
|
3397
3397
|
if (this.set.length > 1) {
|
|
3398
3398
|
const first = this.set[0];
|
|
3399
|
-
this.set = this.set.filter((
|
|
3399
|
+
this.set = this.set.filter((c3) => !isNullSet(c3[0]));
|
|
3400
3400
|
if (this.set.length === 0) {
|
|
3401
3401
|
this.set = [first];
|
|
3402
3402
|
} else if (this.set.length > 1) {
|
|
3403
|
-
for (const
|
|
3404
|
-
if (
|
|
3405
|
-
this.set = [
|
|
3403
|
+
for (const c3 of this.set) {
|
|
3404
|
+
if (c3.length === 1 && isAny(c3[0])) {
|
|
3405
|
+
this.set = [c3];
|
|
3406
3406
|
break;
|
|
3407
3407
|
}
|
|
3408
3408
|
}
|
|
@@ -3413,11 +3413,11 @@ var require_range = __commonJS({
|
|
|
3413
3413
|
get range() {
|
|
3414
3414
|
if (this.formatted === void 0) {
|
|
3415
3415
|
this.formatted = "";
|
|
3416
|
-
for (let
|
|
3417
|
-
if (
|
|
3416
|
+
for (let i3 = 0; i3 < this.set.length; i3++) {
|
|
3417
|
+
if (i3 > 0) {
|
|
3418
3418
|
this.formatted += "||";
|
|
3419
3419
|
}
|
|
3420
|
-
const comps = this.set[
|
|
3420
|
+
const comps = this.set[i3];
|
|
3421
3421
|
for (let k = 0; k < comps.length; k++) {
|
|
3422
3422
|
if (k > 0) {
|
|
3423
3423
|
this.formatted += " ";
|
|
@@ -3500,8 +3500,8 @@ var require_range = __commonJS({
|
|
|
3500
3500
|
return false;
|
|
3501
3501
|
}
|
|
3502
3502
|
}
|
|
3503
|
-
for (let
|
|
3504
|
-
if (testSet(this.set[
|
|
3503
|
+
for (let i3 = 0; i3 < this.set.length; i3++) {
|
|
3504
|
+
if (testSet(this.set[i3], version, this.options)) {
|
|
3505
3505
|
return true;
|
|
3506
3506
|
}
|
|
3507
3507
|
}
|
|
@@ -3523,8 +3523,8 @@ var require_range = __commonJS({
|
|
|
3523
3523
|
caretTrimReplace
|
|
3524
3524
|
} = require_re();
|
|
3525
3525
|
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants2();
|
|
3526
|
-
var isNullSet = (
|
|
3527
|
-
var isAny = (
|
|
3526
|
+
var isNullSet = (c3) => c3.value === "<0.0.0-0";
|
|
3527
|
+
var isAny = (c3) => c3.value === "";
|
|
3528
3528
|
var isSatisfiable = (comparators, options) => {
|
|
3529
3529
|
let result = true;
|
|
3530
3530
|
const remainingComparators = comparators.slice();
|
|
@@ -3552,70 +3552,70 @@ var require_range = __commonJS({
|
|
|
3552
3552
|
};
|
|
3553
3553
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
3554
3554
|
var replaceTildes = (comp, options) => {
|
|
3555
|
-
return comp.trim().split(/\s+/).map((
|
|
3555
|
+
return comp.trim().split(/\s+/).map((c3) => replaceTilde(c3, options)).join(" ");
|
|
3556
3556
|
};
|
|
3557
3557
|
var replaceTilde = (comp, options) => {
|
|
3558
3558
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
3559
|
-
return comp.replace(r, (_2, M,
|
|
3560
|
-
debug("tilde", comp, _2, M,
|
|
3559
|
+
return comp.replace(r, (_2, M, m3, p2, pr) => {
|
|
3560
|
+
debug("tilde", comp, _2, M, m3, p2, pr);
|
|
3561
3561
|
let ret;
|
|
3562
3562
|
if (isX(M)) {
|
|
3563
3563
|
ret = "";
|
|
3564
|
-
} else if (isX(
|
|
3564
|
+
} else if (isX(m3)) {
|
|
3565
3565
|
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
3566
|
-
} else if (isX(
|
|
3567
|
-
ret = `>=${M}.${
|
|
3566
|
+
} else if (isX(p2)) {
|
|
3567
|
+
ret = `>=${M}.${m3}.0 <${M}.${+m3 + 1}.0-0`;
|
|
3568
3568
|
} else if (pr) {
|
|
3569
3569
|
debug("replaceTilde pr", pr);
|
|
3570
|
-
ret = `>=${M}.${
|
|
3570
|
+
ret = `>=${M}.${m3}.${p2}-${pr} <${M}.${+m3 + 1}.0-0`;
|
|
3571
3571
|
} else {
|
|
3572
|
-
ret = `>=${M}.${
|
|
3572
|
+
ret = `>=${M}.${m3}.${p2} <${M}.${+m3 + 1}.0-0`;
|
|
3573
3573
|
}
|
|
3574
3574
|
debug("tilde return", ret);
|
|
3575
3575
|
return ret;
|
|
3576
3576
|
});
|
|
3577
3577
|
};
|
|
3578
3578
|
var replaceCarets = (comp, options) => {
|
|
3579
|
-
return comp.trim().split(/\s+/).map((
|
|
3579
|
+
return comp.trim().split(/\s+/).map((c3) => replaceCaret(c3, options)).join(" ");
|
|
3580
3580
|
};
|
|
3581
3581
|
var replaceCaret = (comp, options) => {
|
|
3582
3582
|
debug("caret", comp, options);
|
|
3583
3583
|
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
3584
3584
|
const z = options.includePrerelease ? "-0" : "";
|
|
3585
|
-
return comp.replace(r, (_2, M,
|
|
3586
|
-
debug("caret", comp, _2, M,
|
|
3585
|
+
return comp.replace(r, (_2, M, m3, p2, pr) => {
|
|
3586
|
+
debug("caret", comp, _2, M, m3, p2, pr);
|
|
3587
3587
|
let ret;
|
|
3588
3588
|
if (isX(M)) {
|
|
3589
3589
|
ret = "";
|
|
3590
|
-
} else if (isX(
|
|
3590
|
+
} else if (isX(m3)) {
|
|
3591
3591
|
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
3592
|
-
} else if (isX(
|
|
3592
|
+
} else if (isX(p2)) {
|
|
3593
3593
|
if (M === "0") {
|
|
3594
|
-
ret = `>=${M}.${
|
|
3594
|
+
ret = `>=${M}.${m3}.0${z} <${M}.${+m3 + 1}.0-0`;
|
|
3595
3595
|
} else {
|
|
3596
|
-
ret = `>=${M}.${
|
|
3596
|
+
ret = `>=${M}.${m3}.0${z} <${+M + 1}.0.0-0`;
|
|
3597
3597
|
}
|
|
3598
3598
|
} else if (pr) {
|
|
3599
3599
|
debug("replaceCaret pr", pr);
|
|
3600
3600
|
if (M === "0") {
|
|
3601
|
-
if (
|
|
3602
|
-
ret = `>=${M}.${
|
|
3601
|
+
if (m3 === "0") {
|
|
3602
|
+
ret = `>=${M}.${m3}.${p2}-${pr} <${M}.${m3}.${+p2 + 1}-0`;
|
|
3603
3603
|
} else {
|
|
3604
|
-
ret = `>=${M}.${
|
|
3604
|
+
ret = `>=${M}.${m3}.${p2}-${pr} <${M}.${+m3 + 1}.0-0`;
|
|
3605
3605
|
}
|
|
3606
3606
|
} else {
|
|
3607
|
-
ret = `>=${M}.${
|
|
3607
|
+
ret = `>=${M}.${m3}.${p2}-${pr} <${+M + 1}.0.0-0`;
|
|
3608
3608
|
}
|
|
3609
3609
|
} else {
|
|
3610
3610
|
debug("no pr");
|
|
3611
3611
|
if (M === "0") {
|
|
3612
|
-
if (
|
|
3613
|
-
ret = `>=${M}.${
|
|
3612
|
+
if (m3 === "0") {
|
|
3613
|
+
ret = `>=${M}.${m3}.${p2}${z} <${M}.${m3}.${+p2 + 1}-0`;
|
|
3614
3614
|
} else {
|
|
3615
|
-
ret = `>=${M}.${
|
|
3615
|
+
ret = `>=${M}.${m3}.${p2}${z} <${M}.${+m3 + 1}.0-0`;
|
|
3616
3616
|
}
|
|
3617
3617
|
} else {
|
|
3618
|
-
ret = `>=${M}.${
|
|
3618
|
+
ret = `>=${M}.${m3}.${p2} <${+M + 1}.0.0-0`;
|
|
3619
3619
|
}
|
|
3620
3620
|
}
|
|
3621
3621
|
debug("caret return", ret);
|
|
@@ -3624,16 +3624,16 @@ var require_range = __commonJS({
|
|
|
3624
3624
|
};
|
|
3625
3625
|
var replaceXRanges = (comp, options) => {
|
|
3626
3626
|
debug("replaceXRanges", comp, options);
|
|
3627
|
-
return comp.split(/\s+/).map((
|
|
3627
|
+
return comp.split(/\s+/).map((c3) => replaceXRange(c3, options)).join(" ");
|
|
3628
3628
|
};
|
|
3629
3629
|
var replaceXRange = (comp, options) => {
|
|
3630
3630
|
comp = comp.trim();
|
|
3631
3631
|
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,
|
|
3632
|
+
return comp.replace(r, (ret, gtlt, M, m3, p2, pr) => {
|
|
3633
|
+
debug("xRange", comp, ret, gtlt, M, m3, p2, pr);
|
|
3634
3634
|
const xM = isX(M);
|
|
3635
|
-
const xm = xM || isX(
|
|
3636
|
-
const xp = xm || isX(
|
|
3635
|
+
const xm = xM || isX(m3);
|
|
3636
|
+
const xp = xm || isX(p2);
|
|
3637
3637
|
const anyX = xp;
|
|
3638
3638
|
if (gtlt === "=" && anyX) {
|
|
3639
3639
|
gtlt = "";
|
|
@@ -3647,35 +3647,35 @@ var require_range = __commonJS({
|
|
|
3647
3647
|
}
|
|
3648
3648
|
} else if (gtlt && anyX) {
|
|
3649
3649
|
if (xm) {
|
|
3650
|
-
|
|
3650
|
+
m3 = 0;
|
|
3651
3651
|
}
|
|
3652
|
-
|
|
3652
|
+
p2 = 0;
|
|
3653
3653
|
if (gtlt === ">") {
|
|
3654
3654
|
gtlt = ">=";
|
|
3655
3655
|
if (xm) {
|
|
3656
3656
|
M = +M + 1;
|
|
3657
|
-
|
|
3658
|
-
|
|
3657
|
+
m3 = 0;
|
|
3658
|
+
p2 = 0;
|
|
3659
3659
|
} else {
|
|
3660
|
-
|
|
3661
|
-
|
|
3660
|
+
m3 = +m3 + 1;
|
|
3661
|
+
p2 = 0;
|
|
3662
3662
|
}
|
|
3663
3663
|
} else if (gtlt === "<=") {
|
|
3664
3664
|
gtlt = "<";
|
|
3665
3665
|
if (xm) {
|
|
3666
3666
|
M = +M + 1;
|
|
3667
3667
|
} else {
|
|
3668
|
-
|
|
3668
|
+
m3 = +m3 + 1;
|
|
3669
3669
|
}
|
|
3670
3670
|
}
|
|
3671
3671
|
if (gtlt === "<") {
|
|
3672
3672
|
pr = "-0";
|
|
3673
3673
|
}
|
|
3674
|
-
ret = `${gtlt + M}.${
|
|
3674
|
+
ret = `${gtlt + M}.${m3}.${p2}${pr}`;
|
|
3675
3675
|
} else if (xm) {
|
|
3676
3676
|
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
3677
3677
|
} else if (xp) {
|
|
3678
|
-
ret = `>=${M}.${
|
|
3678
|
+
ret = `>=${M}.${m3}.0${pr} <${M}.${+m3 + 1}.0-0`;
|
|
3679
3679
|
}
|
|
3680
3680
|
debug("xRange return", ret);
|
|
3681
3681
|
return ret;
|
|
@@ -3717,19 +3717,19 @@ var require_range = __commonJS({
|
|
|
3717
3717
|
return `${from} ${to}`.trim();
|
|
3718
3718
|
};
|
|
3719
3719
|
var testSet = (set, version, options) => {
|
|
3720
|
-
for (let
|
|
3721
|
-
if (!set[
|
|
3720
|
+
for (let i3 = 0; i3 < set.length; i3++) {
|
|
3721
|
+
if (!set[i3].test(version)) {
|
|
3722
3722
|
return false;
|
|
3723
3723
|
}
|
|
3724
3724
|
}
|
|
3725
3725
|
if (version.prerelease.length && !options.includePrerelease) {
|
|
3726
|
-
for (let
|
|
3727
|
-
debug(set[
|
|
3728
|
-
if (set[
|
|
3726
|
+
for (let i3 = 0; i3 < set.length; i3++) {
|
|
3727
|
+
debug(set[i3].semver);
|
|
3728
|
+
if (set[i3].semver === Comparator.ANY) {
|
|
3729
3729
|
continue;
|
|
3730
3730
|
}
|
|
3731
|
-
if (set[
|
|
3732
|
-
const allowed = set[
|
|
3731
|
+
if (set[i3].semver.prerelease.length > 0) {
|
|
3732
|
+
const allowed = set[i3].semver;
|
|
3733
3733
|
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
3734
3734
|
return true;
|
|
3735
3735
|
}
|
|
@@ -4063,7 +4063,7 @@ var require_libvips = __commonJS({
|
|
|
4063
4063
|
}
|
|
4064
4064
|
return false;
|
|
4065
4065
|
};
|
|
4066
|
-
var sha512 = (
|
|
4066
|
+
var sha512 = (s) => createHash("sha512").update(s).digest("hex");
|
|
4067
4067
|
var yarnLocator = () => {
|
|
4068
4068
|
try {
|
|
4069
4069
|
const identHash = sha512(`imgsharp-libvips-${buildPlatformArch()}`);
|
|
@@ -4537,7 +4537,7 @@ var require_input = __commonJS({
|
|
|
4537
4537
|
"tiffSubifd"
|
|
4538
4538
|
];
|
|
4539
4539
|
function _inputOptionsFromObject(obj) {
|
|
4540
|
-
const params = inputStreamParameters.filter((
|
|
4540
|
+
const params = inputStreamParameters.filter((p2) => is.defined(obj[p2])).map((p2) => [p2, obj[p2]]);
|
|
4541
4541
|
return params.length ? Object.fromEntries(params) : void 0;
|
|
4542
4542
|
}
|
|
4543
4543
|
function _createInputDescriptor(input, inputOptions, containerOptions) {
|
|
@@ -4577,7 +4577,7 @@ var require_input = __commonJS({
|
|
|
4577
4577
|
if (input.length > 1) {
|
|
4578
4578
|
if (!this.options.joining) {
|
|
4579
4579
|
this.options.joining = true;
|
|
4580
|
-
this.options.join = input.map((
|
|
4580
|
+
this.options.join = input.map((i3) => this._createInputDescriptor(i3));
|
|
4581
4581
|
} else {
|
|
4582
4582
|
throw new Error("Recursive join is unsupported");
|
|
4583
4583
|
}
|
|
@@ -6179,14 +6179,14 @@ var require_color = __commonJS({
|
|
|
6179
6179
|
const keyword = /^(\w+)$/;
|
|
6180
6180
|
let rgb = [0, 0, 0, 1];
|
|
6181
6181
|
let match;
|
|
6182
|
-
let
|
|
6182
|
+
let i3;
|
|
6183
6183
|
let hexAlpha;
|
|
6184
6184
|
if (match = string.match(hex)) {
|
|
6185
6185
|
hexAlpha = match[2];
|
|
6186
6186
|
match = match[1];
|
|
6187
|
-
for (
|
|
6188
|
-
const i22 =
|
|
6189
|
-
rgb[
|
|
6187
|
+
for (i3 = 0; i3 < 3; i3++) {
|
|
6188
|
+
const i22 = i3 * 2;
|
|
6189
|
+
rgb[i3] = Number.parseInt(match.slice(i22, i22 + 2), 16);
|
|
6190
6190
|
}
|
|
6191
6191
|
if (hexAlpha) {
|
|
6192
6192
|
rgb[3] = Number.parseInt(hexAlpha, 16) / 255;
|
|
@@ -6194,22 +6194,22 @@ var require_color = __commonJS({
|
|
|
6194
6194
|
} else if (match = string.match(abbr)) {
|
|
6195
6195
|
match = match[1];
|
|
6196
6196
|
hexAlpha = match[3];
|
|
6197
|
-
for (
|
|
6198
|
-
rgb[
|
|
6197
|
+
for (i3 = 0; i3 < 3; i3++) {
|
|
6198
|
+
rgb[i3] = Number.parseInt(match[i3] + match[i3], 16);
|
|
6199
6199
|
}
|
|
6200
6200
|
if (hexAlpha) {
|
|
6201
6201
|
rgb[3] = Number.parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
6202
6202
|
}
|
|
6203
6203
|
} else if (match = string.match(rgba)) {
|
|
6204
|
-
for (
|
|
6205
|
-
rgb[
|
|
6204
|
+
for (i3 = 0; i3 < 3; i3++) {
|
|
6205
|
+
rgb[i3] = Number.parseInt(match[i3 + 1], 10);
|
|
6206
6206
|
}
|
|
6207
6207
|
if (match[4]) {
|
|
6208
6208
|
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
6209
6209
|
}
|
|
6210
6210
|
} else if (match = string.match(per)) {
|
|
6211
|
-
for (
|
|
6212
|
-
rgb[
|
|
6211
|
+
for (i3 = 0; i3 < 3; i3++) {
|
|
6212
|
+
rgb[i3] = Math.round(Number.parseFloat(match[i3 + 1]) * 2.55);
|
|
6213
6213
|
}
|
|
6214
6214
|
if (match[4]) {
|
|
6215
6215
|
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
@@ -6227,8 +6227,8 @@ var require_color = __commonJS({
|
|
|
6227
6227
|
} else {
|
|
6228
6228
|
return null;
|
|
6229
6229
|
}
|
|
6230
|
-
for (
|
|
6231
|
-
rgb[
|
|
6230
|
+
for (i3 = 0; i3 < 3; i3++) {
|
|
6231
|
+
rgb[i3] = clamp(rgb[i3], 0, 255);
|
|
6232
6232
|
}
|
|
6233
6233
|
rgb[3] = clamp(rgb[3], 0, 1);
|
|
6234
6234
|
return rgb;
|
|
@@ -6241,11 +6241,11 @@ var require_color = __commonJS({
|
|
|
6241
6241
|
const match = string.match(hsl);
|
|
6242
6242
|
if (match) {
|
|
6243
6243
|
const alpha = Number.parseFloat(match[4]);
|
|
6244
|
-
const
|
|
6245
|
-
const
|
|
6246
|
-
const
|
|
6244
|
+
const h3 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6245
|
+
const s = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
6246
|
+
const l2 = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
6247
6247
|
const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6248
|
-
return [
|
|
6248
|
+
return [h3, s, l2, a2];
|
|
6249
6249
|
}
|
|
6250
6250
|
return null;
|
|
6251
6251
|
};
|
|
@@ -6257,11 +6257,11 @@ var require_color = __commonJS({
|
|
|
6257
6257
|
const match = string.match(hwb);
|
|
6258
6258
|
if (match) {
|
|
6259
6259
|
const alpha = Number.parseFloat(match[4]);
|
|
6260
|
-
const
|
|
6260
|
+
const h3 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6261
6261
|
const w = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
6262
6262
|
const b = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
6263
6263
|
const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6264
|
-
return [
|
|
6264
|
+
return [h3, w, b, a2];
|
|
6265
6265
|
}
|
|
6266
6266
|
return null;
|
|
6267
6267
|
};
|
|
@@ -6323,12 +6323,12 @@ var require_color = __commonJS({
|
|
|
6323
6323
|
};
|
|
6324
6324
|
var conversions_default = convert;
|
|
6325
6325
|
var LAB_FT = (6 / 29) ** 3;
|
|
6326
|
-
function srgbNonlinearTransform(
|
|
6327
|
-
const cc =
|
|
6326
|
+
function srgbNonlinearTransform(c3) {
|
|
6327
|
+
const cc = c3 > 31308e-7 ? 1.055 * c3 ** (1 / 2.4) - 0.055 : c3 * 12.92;
|
|
6328
6328
|
return Math.min(Math.max(0, cc), 1);
|
|
6329
6329
|
}
|
|
6330
|
-
function srgbNonlinearTransformInv(
|
|
6331
|
-
return
|
|
6330
|
+
function srgbNonlinearTransformInv(c3) {
|
|
6331
|
+
return c3 > 0.04045 ? ((c3 + 0.055) / 1.055) ** 2.4 : c3 / 12.92;
|
|
6332
6332
|
}
|
|
6333
6333
|
for (const model of Object.keys(convert)) {
|
|
6334
6334
|
if (!("channels" in convert[model])) {
|
|
@@ -6353,85 +6353,85 @@ var require_color = __commonJS({
|
|
|
6353
6353
|
const min = Math.min(r, g2, b);
|
|
6354
6354
|
const max = Math.max(r, g2, b);
|
|
6355
6355
|
const delta = max - min;
|
|
6356
|
-
let
|
|
6357
|
-
let
|
|
6356
|
+
let h3;
|
|
6357
|
+
let s;
|
|
6358
6358
|
switch (max) {
|
|
6359
6359
|
case min: {
|
|
6360
|
-
|
|
6360
|
+
h3 = 0;
|
|
6361
6361
|
break;
|
|
6362
6362
|
}
|
|
6363
6363
|
case r: {
|
|
6364
|
-
|
|
6364
|
+
h3 = (g2 - b) / delta;
|
|
6365
6365
|
break;
|
|
6366
6366
|
}
|
|
6367
6367
|
case g2: {
|
|
6368
|
-
|
|
6368
|
+
h3 = 2 + (b - r) / delta;
|
|
6369
6369
|
break;
|
|
6370
6370
|
}
|
|
6371
6371
|
case b: {
|
|
6372
|
-
|
|
6372
|
+
h3 = 4 + (r - g2) / delta;
|
|
6373
6373
|
break;
|
|
6374
6374
|
}
|
|
6375
6375
|
}
|
|
6376
|
-
|
|
6377
|
-
if (
|
|
6378
|
-
|
|
6376
|
+
h3 = Math.min(h3 * 60, 360);
|
|
6377
|
+
if (h3 < 0) {
|
|
6378
|
+
h3 += 360;
|
|
6379
6379
|
}
|
|
6380
|
-
const
|
|
6380
|
+
const l2 = (min + max) / 2;
|
|
6381
6381
|
if (max === min) {
|
|
6382
|
-
|
|
6383
|
-
} else if (
|
|
6384
|
-
|
|
6382
|
+
s = 0;
|
|
6383
|
+
} else if (l2 <= 0.5) {
|
|
6384
|
+
s = delta / (max + min);
|
|
6385
6385
|
} else {
|
|
6386
|
-
|
|
6386
|
+
s = delta / (2 - max - min);
|
|
6387
6387
|
}
|
|
6388
|
-
return [
|
|
6388
|
+
return [h3, s * 100, l2 * 100];
|
|
6389
6389
|
};
|
|
6390
6390
|
convert.rgb.hsv = function(rgb) {
|
|
6391
6391
|
let rdif;
|
|
6392
6392
|
let gdif;
|
|
6393
6393
|
let bdif;
|
|
6394
|
-
let
|
|
6395
|
-
let
|
|
6394
|
+
let h3;
|
|
6395
|
+
let s;
|
|
6396
6396
|
const r = rgb[0] / 255;
|
|
6397
6397
|
const g2 = rgb[1] / 255;
|
|
6398
6398
|
const b = rgb[2] / 255;
|
|
6399
6399
|
const v = Math.max(r, g2, b);
|
|
6400
6400
|
const diff = v - Math.min(r, g2, b);
|
|
6401
|
-
const diffc = function(
|
|
6402
|
-
return (v -
|
|
6401
|
+
const diffc = function(c3) {
|
|
6402
|
+
return (v - c3) / 6 / diff + 1 / 2;
|
|
6403
6403
|
};
|
|
6404
6404
|
if (diff === 0) {
|
|
6405
|
-
|
|
6406
|
-
|
|
6405
|
+
h3 = 0;
|
|
6406
|
+
s = 0;
|
|
6407
6407
|
} else {
|
|
6408
|
-
|
|
6408
|
+
s = diff / v;
|
|
6409
6409
|
rdif = diffc(r);
|
|
6410
6410
|
gdif = diffc(g2);
|
|
6411
6411
|
bdif = diffc(b);
|
|
6412
6412
|
switch (v) {
|
|
6413
6413
|
case r: {
|
|
6414
|
-
|
|
6414
|
+
h3 = bdif - gdif;
|
|
6415
6415
|
break;
|
|
6416
6416
|
}
|
|
6417
6417
|
case g2: {
|
|
6418
|
-
|
|
6418
|
+
h3 = 1 / 3 + rdif - bdif;
|
|
6419
6419
|
break;
|
|
6420
6420
|
}
|
|
6421
6421
|
case b: {
|
|
6422
|
-
|
|
6422
|
+
h3 = 2 / 3 + gdif - rdif;
|
|
6423
6423
|
break;
|
|
6424
6424
|
}
|
|
6425
6425
|
}
|
|
6426
|
-
if (
|
|
6427
|
-
|
|
6428
|
-
} else if (
|
|
6429
|
-
|
|
6426
|
+
if (h3 < 0) {
|
|
6427
|
+
h3 += 1;
|
|
6428
|
+
} else if (h3 > 1) {
|
|
6429
|
+
h3 -= 1;
|
|
6430
6430
|
}
|
|
6431
6431
|
}
|
|
6432
6432
|
return [
|
|
6433
|
-
|
|
6434
|
-
|
|
6433
|
+
h3 * 360,
|
|
6434
|
+
s * 100,
|
|
6435
6435
|
v * 100
|
|
6436
6436
|
];
|
|
6437
6437
|
};
|
|
@@ -6439,10 +6439,10 @@ var require_color = __commonJS({
|
|
|
6439
6439
|
const r = rgb[0];
|
|
6440
6440
|
const g2 = rgb[1];
|
|
6441
6441
|
let b = rgb[2];
|
|
6442
|
-
const
|
|
6442
|
+
const h3 = convert.rgb.hsl(rgb)[0];
|
|
6443
6443
|
const w = 1 / 255 * Math.min(r, Math.min(g2, b));
|
|
6444
6444
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g2, b));
|
|
6445
|
-
return [
|
|
6445
|
+
return [h3, w * 100, b * 100];
|
|
6446
6446
|
};
|
|
6447
6447
|
convert.rgb.oklab = function(rgb) {
|
|
6448
6448
|
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
@@ -6451,20 +6451,20 @@ var require_color = __commonJS({
|
|
|
6451
6451
|
const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g2 + 0.0514459929 * b);
|
|
6452
6452
|
const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g2 + 0.1073969566 * b);
|
|
6453
6453
|
const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 * g2 + 0.6299787005 * b);
|
|
6454
|
-
const
|
|
6454
|
+
const l2 = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
6455
6455
|
const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
6456
6456
|
const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
6457
|
-
return [
|
|
6457
|
+
return [l2 * 100, aa * 100, bb * 100];
|
|
6458
6458
|
};
|
|
6459
6459
|
convert.rgb.cmyk = function(rgb) {
|
|
6460
6460
|
const r = rgb[0] / 255;
|
|
6461
6461
|
const g2 = rgb[1] / 255;
|
|
6462
6462
|
const b = rgb[2] / 255;
|
|
6463
6463
|
const k = Math.min(1 - r, 1 - g2, 1 - b);
|
|
6464
|
-
const
|
|
6465
|
-
const
|
|
6464
|
+
const c3 = (1 - r - k) / (1 - k) || 0;
|
|
6465
|
+
const m3 = (1 - g2 - k) / (1 - k) || 0;
|
|
6466
6466
|
const y = (1 - b - k) / (1 - k) || 0;
|
|
6467
|
-
return [
|
|
6467
|
+
return [c3 * 100, m3 * 100, y * 100, k * 100];
|
|
6468
6468
|
};
|
|
6469
6469
|
function comparativeDistance(x, y) {
|
|
6470
6470
|
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
@@ -6509,26 +6509,26 @@ var require_color = __commonJS({
|
|
|
6509
6509
|
x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
6510
6510
|
y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
6511
6511
|
z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
6512
|
-
const
|
|
6512
|
+
const l2 = 116 * y - 16;
|
|
6513
6513
|
const a2 = 500 * (x - y);
|
|
6514
6514
|
const b = 200 * (y - z);
|
|
6515
|
-
return [
|
|
6515
|
+
return [l2, a2, b];
|
|
6516
6516
|
};
|
|
6517
6517
|
convert.hsl.rgb = function(hsl) {
|
|
6518
|
-
const
|
|
6519
|
-
const
|
|
6520
|
-
const
|
|
6518
|
+
const h3 = hsl[0] / 360;
|
|
6519
|
+
const s = hsl[1] / 100;
|
|
6520
|
+
const l2 = hsl[2] / 100;
|
|
6521
6521
|
let t3;
|
|
6522
6522
|
let value;
|
|
6523
|
-
if (
|
|
6524
|
-
value =
|
|
6523
|
+
if (s === 0) {
|
|
6524
|
+
value = l2 * 255;
|
|
6525
6525
|
return [value, value, value];
|
|
6526
6526
|
}
|
|
6527
|
-
const t2 =
|
|
6528
|
-
const t1 = 2 *
|
|
6527
|
+
const t2 = l2 < 0.5 ? l2 * (1 + s) : l2 + s - l2 * s;
|
|
6528
|
+
const t1 = 2 * l2 - t2;
|
|
6529
6529
|
const rgb = [0, 0, 0];
|
|
6530
|
-
for (let
|
|
6531
|
-
t3 =
|
|
6530
|
+
for (let i3 = 0; i3 < 3; i3++) {
|
|
6531
|
+
t3 = h3 + 1 / 3 * -(i3 - 1);
|
|
6532
6532
|
if (t3 < 0) {
|
|
6533
6533
|
t3++;
|
|
6534
6534
|
}
|
|
@@ -6544,71 +6544,71 @@ var require_color = __commonJS({
|
|
|
6544
6544
|
} else {
|
|
6545
6545
|
value = t1;
|
|
6546
6546
|
}
|
|
6547
|
-
rgb[
|
|
6547
|
+
rgb[i3] = value * 255;
|
|
6548
6548
|
}
|
|
6549
6549
|
return rgb;
|
|
6550
6550
|
};
|
|
6551
6551
|
convert.hsl.hsv = function(hsl) {
|
|
6552
|
-
const
|
|
6553
|
-
let
|
|
6554
|
-
let
|
|
6555
|
-
let smin =
|
|
6556
|
-
const lmin = Math.max(
|
|
6557
|
-
|
|
6558
|
-
|
|
6552
|
+
const h3 = hsl[0];
|
|
6553
|
+
let s = hsl[1] / 100;
|
|
6554
|
+
let l2 = hsl[2] / 100;
|
|
6555
|
+
let smin = s;
|
|
6556
|
+
const lmin = Math.max(l2, 0.01);
|
|
6557
|
+
l2 *= 2;
|
|
6558
|
+
s *= l2 <= 1 ? l2 : 2 - l2;
|
|
6559
6559
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
6560
|
-
const v = (
|
|
6561
|
-
const sv =
|
|
6562
|
-
return [
|
|
6560
|
+
const v = (l2 + s) / 2;
|
|
6561
|
+
const sv = l2 === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l2 + s);
|
|
6562
|
+
return [h3, sv * 100, v * 100];
|
|
6563
6563
|
};
|
|
6564
6564
|
convert.hsv.rgb = function(hsv) {
|
|
6565
|
-
const
|
|
6566
|
-
const
|
|
6565
|
+
const h3 = hsv[0] / 60;
|
|
6566
|
+
const s = hsv[1] / 100;
|
|
6567
6567
|
let v = hsv[2] / 100;
|
|
6568
|
-
const hi = Math.floor(
|
|
6569
|
-
const f2 =
|
|
6570
|
-
const
|
|
6571
|
-
const q2 = 255 * v * (1 -
|
|
6572
|
-
const t = 255 * v * (1 -
|
|
6568
|
+
const hi = Math.floor(h3) % 6;
|
|
6569
|
+
const f2 = h3 - Math.floor(h3);
|
|
6570
|
+
const p2 = 255 * v * (1 - s);
|
|
6571
|
+
const q2 = 255 * v * (1 - s * f2);
|
|
6572
|
+
const t = 255 * v * (1 - s * (1 - f2));
|
|
6573
6573
|
v *= 255;
|
|
6574
6574
|
switch (hi) {
|
|
6575
6575
|
case 0: {
|
|
6576
|
-
return [v, t,
|
|
6576
|
+
return [v, t, p2];
|
|
6577
6577
|
}
|
|
6578
6578
|
case 1: {
|
|
6579
|
-
return [q2, v,
|
|
6579
|
+
return [q2, v, p2];
|
|
6580
6580
|
}
|
|
6581
6581
|
case 2: {
|
|
6582
|
-
return [
|
|
6582
|
+
return [p2, v, t];
|
|
6583
6583
|
}
|
|
6584
6584
|
case 3: {
|
|
6585
|
-
return [
|
|
6585
|
+
return [p2, q2, v];
|
|
6586
6586
|
}
|
|
6587
6587
|
case 4: {
|
|
6588
|
-
return [t,
|
|
6588
|
+
return [t, p2, v];
|
|
6589
6589
|
}
|
|
6590
6590
|
case 5: {
|
|
6591
|
-
return [v,
|
|
6591
|
+
return [v, p2, q2];
|
|
6592
6592
|
}
|
|
6593
6593
|
}
|
|
6594
6594
|
};
|
|
6595
6595
|
convert.hsv.hsl = function(hsv) {
|
|
6596
|
-
const
|
|
6597
|
-
const
|
|
6596
|
+
const h3 = hsv[0];
|
|
6597
|
+
const s = hsv[1] / 100;
|
|
6598
6598
|
const v = hsv[2] / 100;
|
|
6599
6599
|
const vmin = Math.max(v, 0.01);
|
|
6600
6600
|
let sl;
|
|
6601
|
-
let
|
|
6602
|
-
|
|
6603
|
-
const lmin = (2 -
|
|
6604
|
-
sl =
|
|
6601
|
+
let l2;
|
|
6602
|
+
l2 = (2 - s) * v;
|
|
6603
|
+
const lmin = (2 - s) * vmin;
|
|
6604
|
+
sl = s * vmin;
|
|
6605
6605
|
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
6606
6606
|
sl = sl || 0;
|
|
6607
|
-
|
|
6608
|
-
return [
|
|
6607
|
+
l2 /= 2;
|
|
6608
|
+
return [h3, sl * 100, l2 * 100];
|
|
6609
6609
|
};
|
|
6610
6610
|
convert.hwb.rgb = function(hwb) {
|
|
6611
|
-
const
|
|
6611
|
+
const h3 = hwb[0] / 360;
|
|
6612
6612
|
let wh = hwb[1] / 100;
|
|
6613
6613
|
let bl = hwb[2] / 100;
|
|
6614
6614
|
const ratio = wh + bl;
|
|
@@ -6617,27 +6617,27 @@ var require_color = __commonJS({
|
|
|
6617
6617
|
wh /= ratio;
|
|
6618
6618
|
bl /= ratio;
|
|
6619
6619
|
}
|
|
6620
|
-
const
|
|
6620
|
+
const i3 = Math.floor(6 * h3);
|
|
6621
6621
|
const v = 1 - bl;
|
|
6622
|
-
f2 = 6 *
|
|
6623
|
-
if ((
|
|
6622
|
+
f2 = 6 * h3 - i3;
|
|
6623
|
+
if ((i3 & 1) !== 0) {
|
|
6624
6624
|
f2 = 1 - f2;
|
|
6625
6625
|
}
|
|
6626
|
-
const
|
|
6626
|
+
const n3 = wh + f2 * (v - wh);
|
|
6627
6627
|
let r;
|
|
6628
6628
|
let g2;
|
|
6629
6629
|
let b;
|
|
6630
|
-
switch (
|
|
6630
|
+
switch (i3) {
|
|
6631
6631
|
default:
|
|
6632
6632
|
case 6:
|
|
6633
6633
|
case 0: {
|
|
6634
6634
|
r = v;
|
|
6635
|
-
g2 =
|
|
6635
|
+
g2 = n3;
|
|
6636
6636
|
b = wh;
|
|
6637
6637
|
break;
|
|
6638
6638
|
}
|
|
6639
6639
|
case 1: {
|
|
6640
|
-
r =
|
|
6640
|
+
r = n3;
|
|
6641
6641
|
g2 = v;
|
|
6642
6642
|
b = wh;
|
|
6643
6643
|
break;
|
|
@@ -6645,17 +6645,17 @@ var require_color = __commonJS({
|
|
|
6645
6645
|
case 2: {
|
|
6646
6646
|
r = wh;
|
|
6647
6647
|
g2 = v;
|
|
6648
|
-
b =
|
|
6648
|
+
b = n3;
|
|
6649
6649
|
break;
|
|
6650
6650
|
}
|
|
6651
6651
|
case 3: {
|
|
6652
6652
|
r = wh;
|
|
6653
|
-
g2 =
|
|
6653
|
+
g2 = n3;
|
|
6654
6654
|
b = v;
|
|
6655
6655
|
break;
|
|
6656
6656
|
}
|
|
6657
6657
|
case 4: {
|
|
6658
|
-
r =
|
|
6658
|
+
r = n3;
|
|
6659
6659
|
g2 = wh;
|
|
6660
6660
|
b = v;
|
|
6661
6661
|
break;
|
|
@@ -6663,19 +6663,19 @@ var require_color = __commonJS({
|
|
|
6663
6663
|
case 5: {
|
|
6664
6664
|
r = v;
|
|
6665
6665
|
g2 = wh;
|
|
6666
|
-
b =
|
|
6666
|
+
b = n3;
|
|
6667
6667
|
break;
|
|
6668
6668
|
}
|
|
6669
6669
|
}
|
|
6670
6670
|
return [r * 255, g2 * 255, b * 255];
|
|
6671
6671
|
};
|
|
6672
6672
|
convert.cmyk.rgb = function(cmyk) {
|
|
6673
|
-
const
|
|
6674
|
-
const
|
|
6673
|
+
const c3 = cmyk[0] / 100;
|
|
6674
|
+
const m3 = cmyk[1] / 100;
|
|
6675
6675
|
const y = cmyk[2] / 100;
|
|
6676
6676
|
const k = cmyk[3] / 100;
|
|
6677
|
-
const r = 1 - Math.min(1,
|
|
6678
|
-
const g2 = 1 - Math.min(1,
|
|
6677
|
+
const r = 1 - Math.min(1, c3 * (1 - k) + k);
|
|
6678
|
+
const g2 = 1 - Math.min(1, m3 * (1 - k) + k);
|
|
6679
6679
|
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
6680
6680
|
return [r * 255, g2 * 255, b * 255];
|
|
6681
6681
|
};
|
|
@@ -6704,10 +6704,10 @@ var require_color = __commonJS({
|
|
|
6704
6704
|
x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
6705
6705
|
y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
6706
6706
|
z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
6707
|
-
const
|
|
6707
|
+
const l2 = 116 * y - 16;
|
|
6708
6708
|
const a2 = 500 * (x - y);
|
|
6709
6709
|
const b = 200 * (y - z);
|
|
6710
|
-
return [
|
|
6710
|
+
return [l2, a2, b];
|
|
6711
6711
|
};
|
|
6712
6712
|
convert.xyz.oklab = function(xyz) {
|
|
6713
6713
|
const x = xyz[0] / 100;
|
|
@@ -6716,10 +6716,10 @@ var require_color = __commonJS({
|
|
|
6716
6716
|
const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z);
|
|
6717
6717
|
const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z);
|
|
6718
6718
|
const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z);
|
|
6719
|
-
const
|
|
6719
|
+
const l2 = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
6720
6720
|
const a2 = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
6721
6721
|
const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
6722
|
-
return [
|
|
6722
|
+
return [l2 * 100, a2 * 100, b * 100];
|
|
6723
6723
|
};
|
|
6724
6724
|
convert.oklab.oklch = function(oklab) {
|
|
6725
6725
|
return convert.lab.lch(oklab);
|
|
@@ -6728,37 +6728,37 @@ var require_color = __commonJS({
|
|
|
6728
6728
|
const ll = oklab[0] / 100;
|
|
6729
6729
|
const a2 = oklab[1] / 100;
|
|
6730
6730
|
const b = oklab[2] / 100;
|
|
6731
|
-
const
|
|
6732
|
-
const
|
|
6733
|
-
const
|
|
6734
|
-
const x = 1.227013851 *
|
|
6735
|
-
const y = -0.040580178 *
|
|
6736
|
-
const z = -0.076381285 *
|
|
6731
|
+
const l2 = (0.999999998 * ll + 0.396337792 * a2 + 0.215803758 * b) ** 3;
|
|
6732
|
+
const m3 = (1.000000008 * ll - 0.105561342 * a2 - 0.063854175 * b) ** 3;
|
|
6733
|
+
const s = (1.000000055 * ll - 0.089484182 * a2 - 1.291485538 * b) ** 3;
|
|
6734
|
+
const x = 1.227013851 * l2 - 0.55779998 * m3 + 0.281256149 * s;
|
|
6735
|
+
const y = -0.040580178 * l2 + 1.11225687 * m3 - 0.071676679 * s;
|
|
6736
|
+
const z = -0.076381285 * l2 - 0.421481978 * m3 + 1.58616322 * s;
|
|
6737
6737
|
return [x * 100, y * 100, z * 100];
|
|
6738
6738
|
};
|
|
6739
6739
|
convert.oklab.rgb = function(oklab) {
|
|
6740
6740
|
const ll = oklab[0] / 100;
|
|
6741
6741
|
const aa = oklab[1] / 100;
|
|
6742
6742
|
const bb = oklab[2] / 100;
|
|
6743
|
-
const
|
|
6744
|
-
const
|
|
6745
|
-
const
|
|
6746
|
-
const r = srgbNonlinearTransform(4.0767416621 *
|
|
6747
|
-
const g2 = srgbNonlinearTransform(-1.2684380046 *
|
|
6748
|
-
const b = srgbNonlinearTransform(-0.0041960863 *
|
|
6743
|
+
const l2 = (ll + 0.3963377774 * aa + 0.2158037573 * bb) ** 3;
|
|
6744
|
+
const m3 = (ll - 0.1055613458 * aa - 0.0638541728 * bb) ** 3;
|
|
6745
|
+
const s = (ll - 0.0894841775 * aa - 1.291485548 * bb) ** 3;
|
|
6746
|
+
const r = srgbNonlinearTransform(4.0767416621 * l2 - 3.3077115913 * m3 + 0.2309699292 * s);
|
|
6747
|
+
const g2 = srgbNonlinearTransform(-1.2684380046 * l2 + 2.6097574011 * m3 - 0.3413193965 * s);
|
|
6748
|
+
const b = srgbNonlinearTransform(-0.0041960863 * l2 - 0.7034186147 * m3 + 1.707614701 * s);
|
|
6749
6749
|
return [r * 255, g2 * 255, b * 255];
|
|
6750
6750
|
};
|
|
6751
6751
|
convert.oklch.oklab = function(oklch) {
|
|
6752
6752
|
return convert.lch.lab(oklch);
|
|
6753
6753
|
};
|
|
6754
6754
|
convert.lab.xyz = function(lab) {
|
|
6755
|
-
const
|
|
6755
|
+
const l2 = lab[0];
|
|
6756
6756
|
const a2 = lab[1];
|
|
6757
6757
|
const b = lab[2];
|
|
6758
6758
|
let x;
|
|
6759
6759
|
let y;
|
|
6760
6760
|
let z;
|
|
6761
|
-
y = (
|
|
6761
|
+
y = (l2 + 16) / 116;
|
|
6762
6762
|
x = a2 / 500 + y;
|
|
6763
6763
|
z = y - b / 200;
|
|
6764
6764
|
const y2 = y ** 3;
|
|
@@ -6773,26 +6773,26 @@ var require_color = __commonJS({
|
|
|
6773
6773
|
return [x, y, z];
|
|
6774
6774
|
};
|
|
6775
6775
|
convert.lab.lch = function(lab) {
|
|
6776
|
-
const
|
|
6776
|
+
const l2 = lab[0];
|
|
6777
6777
|
const a2 = lab[1];
|
|
6778
6778
|
const b = lab[2];
|
|
6779
|
-
let
|
|
6779
|
+
let h3;
|
|
6780
6780
|
const hr = Math.atan2(b, a2);
|
|
6781
|
-
|
|
6782
|
-
if (
|
|
6783
|
-
|
|
6781
|
+
h3 = hr * 360 / 2 / Math.PI;
|
|
6782
|
+
if (h3 < 0) {
|
|
6783
|
+
h3 += 360;
|
|
6784
6784
|
}
|
|
6785
|
-
const
|
|
6786
|
-
return [
|
|
6785
|
+
const c3 = Math.sqrt(a2 * a2 + b * b);
|
|
6786
|
+
return [l2, c3, h3];
|
|
6787
6787
|
};
|
|
6788
6788
|
convert.lch.lab = function(lch) {
|
|
6789
|
-
const
|
|
6790
|
-
const
|
|
6791
|
-
const
|
|
6792
|
-
const hr =
|
|
6793
|
-
const a2 =
|
|
6794
|
-
const b =
|
|
6795
|
-
return [
|
|
6789
|
+
const l2 = lch[0];
|
|
6790
|
+
const c3 = lch[1];
|
|
6791
|
+
const h3 = lch[2];
|
|
6792
|
+
const hr = h3 / 360 * 2 * Math.PI;
|
|
6793
|
+
const a2 = c3 * Math.cos(hr);
|
|
6794
|
+
const b = c3 * Math.sin(hr);
|
|
6795
|
+
return [l2, a2, b];
|
|
6796
6796
|
};
|
|
6797
6797
|
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
6798
6798
|
const [r, g2, b] = args;
|
|
@@ -6845,8 +6845,8 @@ var require_color = __commonJS({
|
|
|
6845
6845
|
convert.ansi256.rgb = function(args) {
|
|
6846
6846
|
args = args[0];
|
|
6847
6847
|
if (args >= 232) {
|
|
6848
|
-
const
|
|
6849
|
-
return [
|
|
6848
|
+
const c3 = (args - 232) * 10 + 8;
|
|
6849
|
+
return [c3, c3, c3];
|
|
6850
6850
|
}
|
|
6851
6851
|
args -= 16;
|
|
6852
6852
|
let rem;
|
|
@@ -6898,34 +6898,34 @@ var require_color = __commonJS({
|
|
|
6898
6898
|
return [hue * 360, chroma * 100, grayscale * 100];
|
|
6899
6899
|
};
|
|
6900
6900
|
convert.hsl.hcg = function(hsl) {
|
|
6901
|
-
const
|
|
6902
|
-
const
|
|
6903
|
-
const
|
|
6901
|
+
const s = hsl[1] / 100;
|
|
6902
|
+
const l2 = hsl[2] / 100;
|
|
6903
|
+
const c3 = l2 < 0.5 ? 2 * s * l2 : 2 * s * (1 - l2);
|
|
6904
6904
|
let f2 = 0;
|
|
6905
|
-
if (
|
|
6906
|
-
f2 = (
|
|
6905
|
+
if (c3 < 1) {
|
|
6906
|
+
f2 = (l2 - 0.5 * c3) / (1 - c3);
|
|
6907
6907
|
}
|
|
6908
|
-
return [hsl[0],
|
|
6908
|
+
return [hsl[0], c3 * 100, f2 * 100];
|
|
6909
6909
|
};
|
|
6910
6910
|
convert.hsv.hcg = function(hsv) {
|
|
6911
|
-
const
|
|
6911
|
+
const s = hsv[1] / 100;
|
|
6912
6912
|
const v = hsv[2] / 100;
|
|
6913
|
-
const
|
|
6913
|
+
const c3 = s * v;
|
|
6914
6914
|
let f2 = 0;
|
|
6915
|
-
if (
|
|
6916
|
-
f2 = (v -
|
|
6915
|
+
if (c3 < 1) {
|
|
6916
|
+
f2 = (v - c3) / (1 - c3);
|
|
6917
6917
|
}
|
|
6918
|
-
return [hsv[0],
|
|
6918
|
+
return [hsv[0], c3 * 100, f2 * 100];
|
|
6919
6919
|
};
|
|
6920
6920
|
convert.hcg.rgb = function(hcg) {
|
|
6921
|
-
const
|
|
6922
|
-
const
|
|
6921
|
+
const h3 = hcg[0] / 360;
|
|
6922
|
+
const c3 = hcg[1] / 100;
|
|
6923
6923
|
const g2 = hcg[2] / 100;
|
|
6924
|
-
if (
|
|
6924
|
+
if (c3 === 0) {
|
|
6925
6925
|
return [g2 * 255, g2 * 255, g2 * 255];
|
|
6926
6926
|
}
|
|
6927
6927
|
const pure = [0, 0, 0];
|
|
6928
|
-
const hi =
|
|
6928
|
+
const hi = h3 % 1 * 6;
|
|
6929
6929
|
const v = hi % 1;
|
|
6930
6930
|
const w = 1 - v;
|
|
6931
6931
|
let mg = 0;
|
|
@@ -6966,51 +6966,51 @@ var require_color = __commonJS({
|
|
|
6966
6966
|
pure[2] = w;
|
|
6967
6967
|
}
|
|
6968
6968
|
}
|
|
6969
|
-
mg = (1 -
|
|
6969
|
+
mg = (1 - c3) * g2;
|
|
6970
6970
|
return [
|
|
6971
|
-
(
|
|
6972
|
-
(
|
|
6973
|
-
(
|
|
6971
|
+
(c3 * pure[0] + mg) * 255,
|
|
6972
|
+
(c3 * pure[1] + mg) * 255,
|
|
6973
|
+
(c3 * pure[2] + mg) * 255
|
|
6974
6974
|
];
|
|
6975
6975
|
};
|
|
6976
6976
|
convert.hcg.hsv = function(hcg) {
|
|
6977
|
-
const
|
|
6977
|
+
const c3 = hcg[1] / 100;
|
|
6978
6978
|
const g2 = hcg[2] / 100;
|
|
6979
|
-
const v =
|
|
6979
|
+
const v = c3 + g2 * (1 - c3);
|
|
6980
6980
|
let f2 = 0;
|
|
6981
6981
|
if (v > 0) {
|
|
6982
|
-
f2 =
|
|
6982
|
+
f2 = c3 / v;
|
|
6983
6983
|
}
|
|
6984
6984
|
return [hcg[0], f2 * 100, v * 100];
|
|
6985
6985
|
};
|
|
6986
6986
|
convert.hcg.hsl = function(hcg) {
|
|
6987
|
-
const
|
|
6987
|
+
const c3 = hcg[1] / 100;
|
|
6988
6988
|
const g2 = hcg[2] / 100;
|
|
6989
|
-
const
|
|
6990
|
-
let
|
|
6991
|
-
if (
|
|
6992
|
-
|
|
6993
|
-
} else if (
|
|
6994
|
-
|
|
6989
|
+
const l2 = g2 * (1 - c3) + 0.5 * c3;
|
|
6990
|
+
let s = 0;
|
|
6991
|
+
if (l2 > 0 && l2 < 0.5) {
|
|
6992
|
+
s = c3 / (2 * l2);
|
|
6993
|
+
} else if (l2 >= 0.5 && l2 < 1) {
|
|
6994
|
+
s = c3 / (2 * (1 - l2));
|
|
6995
6995
|
}
|
|
6996
|
-
return [hcg[0],
|
|
6996
|
+
return [hcg[0], s * 100, l2 * 100];
|
|
6997
6997
|
};
|
|
6998
6998
|
convert.hcg.hwb = function(hcg) {
|
|
6999
|
-
const
|
|
6999
|
+
const c3 = hcg[1] / 100;
|
|
7000
7000
|
const g2 = hcg[2] / 100;
|
|
7001
|
-
const v =
|
|
7002
|
-
return [hcg[0], (v -
|
|
7001
|
+
const v = c3 + g2 * (1 - c3);
|
|
7002
|
+
return [hcg[0], (v - c3) * 100, (1 - v) * 100];
|
|
7003
7003
|
};
|
|
7004
7004
|
convert.hwb.hcg = function(hwb) {
|
|
7005
7005
|
const w = hwb[1] / 100;
|
|
7006
7006
|
const b = hwb[2] / 100;
|
|
7007
7007
|
const v = 1 - b;
|
|
7008
|
-
const
|
|
7008
|
+
const c3 = v - w;
|
|
7009
7009
|
let g2 = 0;
|
|
7010
|
-
if (
|
|
7011
|
-
g2 = (v -
|
|
7010
|
+
if (c3 < 1) {
|
|
7011
|
+
g2 = (v - c3) / (1 - c3);
|
|
7012
7012
|
}
|
|
7013
|
-
return [hwb[0],
|
|
7013
|
+
return [hwb[0], c3 * 100, g2 * 100];
|
|
7014
7014
|
};
|
|
7015
7015
|
convert.apple.rgb = function(apple) {
|
|
7016
7016
|
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
@@ -7047,8 +7047,8 @@ var require_color = __commonJS({
|
|
|
7047
7047
|
function buildGraph() {
|
|
7048
7048
|
const graph = {};
|
|
7049
7049
|
const models2 = Object.keys(conversions_default);
|
|
7050
|
-
for (let { length } = models2,
|
|
7051
|
-
graph[models2[
|
|
7050
|
+
for (let { length } = models2, i3 = 0; i3 < length; i3++) {
|
|
7051
|
+
graph[models2[i3]] = {
|
|
7052
7052
|
// http://jsperf.com/1-vs-infinity
|
|
7053
7053
|
// micro-opt, but this is simple.
|
|
7054
7054
|
distance: -1,
|
|
@@ -7064,8 +7064,8 @@ var require_color = __commonJS({
|
|
|
7064
7064
|
while (queue.length > 0) {
|
|
7065
7065
|
const current = queue.pop();
|
|
7066
7066
|
const adjacents = Object.keys(conversions_default[current]);
|
|
7067
|
-
for (let { length } = adjacents,
|
|
7068
|
-
const adjacent = adjacents[
|
|
7067
|
+
for (let { length } = adjacents, i3 = 0; i3 < length; i3++) {
|
|
7068
|
+
const adjacent = adjacents[i3];
|
|
7069
7069
|
const node = graph[adjacent];
|
|
7070
7070
|
if (node.distance === -1) {
|
|
7071
7071
|
node.distance = graph[current].distance + 1;
|
|
@@ -7097,8 +7097,8 @@ var require_color = __commonJS({
|
|
|
7097
7097
|
const graph = deriveBFS(fromModel);
|
|
7098
7098
|
const conversion = {};
|
|
7099
7099
|
const models2 = Object.keys(graph);
|
|
7100
|
-
for (let { length } = models2,
|
|
7101
|
-
const toModel = models2[
|
|
7100
|
+
for (let { length } = models2, i3 = 0; i3 < length; i3++) {
|
|
7101
|
+
const toModel = models2[i3];
|
|
7102
7102
|
const node = graph[toModel];
|
|
7103
7103
|
if (node.parent === null) {
|
|
7104
7104
|
continue;
|
|
@@ -7137,8 +7137,8 @@ var require_color = __commonJS({
|
|
|
7137
7137
|
}
|
|
7138
7138
|
const result = fn(args);
|
|
7139
7139
|
if (typeof result === "object") {
|
|
7140
|
-
for (let { length } = result,
|
|
7141
|
-
result[
|
|
7140
|
+
for (let { length } = result, i3 = 0; i3 < length; i3++) {
|
|
7141
|
+
result[i3] = Math.round(result[i3]);
|
|
7142
7142
|
}
|
|
7143
7143
|
}
|
|
7144
7144
|
return result;
|
|
@@ -7184,7 +7184,7 @@ var require_color = __commonJS({
|
|
|
7184
7184
|
if (model && !(model in color_convert_default)) {
|
|
7185
7185
|
throw new Error("Unknown model: " + model);
|
|
7186
7186
|
}
|
|
7187
|
-
let
|
|
7187
|
+
let i3;
|
|
7188
7188
|
let channels;
|
|
7189
7189
|
if (object == null) {
|
|
7190
7190
|
this.model = "rgb";
|
|
@@ -7231,17 +7231,17 @@ var require_color = __commonJS({
|
|
|
7231
7231
|
this.model = hashedModelKeys[hashedKeys];
|
|
7232
7232
|
const { labels } = color_convert_default[this.model];
|
|
7233
7233
|
const color = [];
|
|
7234
|
-
for (
|
|
7235
|
-
color.push(object[labels[
|
|
7234
|
+
for (i3 = 0; i3 < labels.length; i3++) {
|
|
7235
|
+
color.push(object[labels[i3]]);
|
|
7236
7236
|
}
|
|
7237
7237
|
this.color = zeroArray(color);
|
|
7238
7238
|
}
|
|
7239
7239
|
if (limiters[this.model]) {
|
|
7240
7240
|
channels = color_convert_default[this.model].channels;
|
|
7241
|
-
for (
|
|
7242
|
-
const limit = limiters[this.model][
|
|
7241
|
+
for (i3 = 0; i3 < channels; i3++) {
|
|
7242
|
+
const limit = limiters[this.model][i3];
|
|
7243
7243
|
if (limit) {
|
|
7244
|
-
this.color[
|
|
7244
|
+
this.color[i3] = limit(this.color[i3]);
|
|
7245
7245
|
}
|
|
7246
7246
|
}
|
|
7247
7247
|
}
|
|
@@ -7258,14 +7258,14 @@ var require_color = __commonJS({
|
|
|
7258
7258
|
return this[this.model]();
|
|
7259
7259
|
},
|
|
7260
7260
|
string(places) {
|
|
7261
|
-
let
|
|
7262
|
-
|
|
7263
|
-
const arguments_ =
|
|
7264
|
-
return color_string_default.to[
|
|
7261
|
+
let self2 = this.model in color_string_default.to ? this : this.rgb();
|
|
7262
|
+
self2 = self2.round(typeof places === "number" ? places : 1);
|
|
7263
|
+
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
7264
|
+
return color_string_default.to[self2.model](...arguments_);
|
|
7265
7265
|
},
|
|
7266
7266
|
percentString(places) {
|
|
7267
|
-
const
|
|
7268
|
-
const arguments_ =
|
|
7267
|
+
const self2 = this.rgb().round(typeof places === "number" ? places : 1);
|
|
7268
|
+
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
7269
7269
|
return color_string_default.to.rgb.percent(...arguments_);
|
|
7270
7270
|
},
|
|
7271
7271
|
array() {
|
|
@@ -7275,8 +7275,8 @@ var require_color = __commonJS({
|
|
|
7275
7275
|
const result = {};
|
|
7276
7276
|
const { channels } = color_convert_default[this.model];
|
|
7277
7277
|
const { labels } = color_convert_default[this.model];
|
|
7278
|
-
for (let
|
|
7279
|
-
result[labels[
|
|
7278
|
+
for (let i3 = 0; i3 < channels; i3++) {
|
|
7279
|
+
result[labels[i3]] = this.color[i3];
|
|
7280
7280
|
}
|
|
7281
7281
|
if (this.valpha !== 1) {
|
|
7282
7282
|
result.alpha = this.valpha;
|
|
@@ -7366,9 +7366,9 @@ var require_color = __commonJS({
|
|
|
7366
7366
|
luminosity() {
|
|
7367
7367
|
const rgb = this.rgb().color;
|
|
7368
7368
|
const lum = [];
|
|
7369
|
-
for (const [
|
|
7369
|
+
for (const [i3, element] of rgb.entries()) {
|
|
7370
7370
|
const chan = element / 255;
|
|
7371
|
-
lum[
|
|
7371
|
+
lum[i3] = chan <= 0.04045 ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
|
|
7372
7372
|
}
|
|
7373
7373
|
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
|
|
7374
7374
|
},
|
|
@@ -7397,8 +7397,8 @@ var require_color = __commonJS({
|
|
|
7397
7397
|
},
|
|
7398
7398
|
negate() {
|
|
7399
7399
|
const rgb = this.rgb();
|
|
7400
|
-
for (let
|
|
7401
|
-
rgb.color[
|
|
7400
|
+
for (let i3 = 0; i3 < 3; i3++) {
|
|
7401
|
+
rgb.color[i3] = 255 - rgb.color[i3];
|
|
7402
7402
|
}
|
|
7403
7403
|
return rgb;
|
|
7404
7404
|
},
|
|
@@ -7457,8 +7457,8 @@ var require_color = __commonJS({
|
|
|
7457
7457
|
}
|
|
7458
7458
|
const color1 = mixinColor.rgb();
|
|
7459
7459
|
const color2 = this.rgb();
|
|
7460
|
-
const
|
|
7461
|
-
const w = 2 *
|
|
7460
|
+
const p2 = weight === void 0 ? 0.5 : weight;
|
|
7461
|
+
const w = 2 * p2 - 1;
|
|
7462
7462
|
const a2 = color1.alpha() - color2.alpha();
|
|
7463
7463
|
const w1 = ((w * a2 === -1 ? w : (w + a2) / (1 + w * a2)) + 1) / 2;
|
|
7464
7464
|
const w2 = 1 - w1;
|
|
@@ -7466,7 +7466,7 @@ var require_color = __commonJS({
|
|
|
7466
7466
|
w1 * color1.red() + w2 * color2.red(),
|
|
7467
7467
|
w1 * color1.green() + w2 * color2.green(),
|
|
7468
7468
|
w1 * color1.blue() + w2 * color2.blue(),
|
|
7469
|
-
color1.alpha() *
|
|
7469
|
+
color1.alpha() * p2 + color2.alpha() * (1 - p2)
|
|
7470
7470
|
);
|
|
7471
7471
|
}
|
|
7472
7472
|
};
|
|
@@ -7502,8 +7502,8 @@ var require_color = __commonJS({
|
|
|
7502
7502
|
}
|
|
7503
7503
|
function getset(model, channel, modifier) {
|
|
7504
7504
|
model = Array.isArray(model) ? model : [model];
|
|
7505
|
-
for (const
|
|
7506
|
-
(limiters[
|
|
7505
|
+
for (const m3 of model) {
|
|
7506
|
+
(limiters[m3] || (limiters[m3] = []))[channel] = modifier;
|
|
7507
7507
|
}
|
|
7508
7508
|
model = model[0];
|
|
7509
7509
|
return function(value) {
|
|
@@ -7532,9 +7532,9 @@ var require_color = __commonJS({
|
|
|
7532
7532
|
return Array.isArray(value) ? value : [value];
|
|
7533
7533
|
}
|
|
7534
7534
|
function zeroArray(array, length) {
|
|
7535
|
-
for (let
|
|
7536
|
-
if (typeof array[
|
|
7537
|
-
array[
|
|
7535
|
+
for (let i3 = 0; i3 < length; i3++) {
|
|
7536
|
+
if (typeof array[i3] !== "number") {
|
|
7537
|
+
array[i3] = 0;
|
|
7538
7538
|
}
|
|
7539
7539
|
}
|
|
7540
7540
|
return array;
|
|
@@ -8723,24 +8723,24 @@ var require_lib = __commonJS({
|
|
|
8723
8723
|
// ../codec-sharp/dist/index.mjs
|
|
8724
8724
|
var dist_exports2 = {};
|
|
8725
8725
|
__export(dist_exports2, {
|
|
8726
|
-
|
|
8727
|
-
|
|
8726
|
+
codecSharp: () => o,
|
|
8727
|
+
default: () => f
|
|
8728
8728
|
});
|
|
8729
|
-
async function a(
|
|
8729
|
+
async function a(r) {
|
|
8730
8730
|
try {
|
|
8731
|
-
let
|
|
8732
|
-
if (!
|
|
8733
|
-
return { data:
|
|
8734
|
-
} catch (
|
|
8735
|
-
throw new Error(`Failed to read image file ${
|
|
8731
|
+
let e = await (0, import_sharp.default)(r).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
8732
|
+
if (!e.info.width || !e.info.height) throw new Error(`Invalid image dimensions: ${r}`);
|
|
8733
|
+
return { data: e.data, width: e.info.width, height: e.info.height };
|
|
8734
|
+
} catch (e) {
|
|
8735
|
+
throw new Error(`Failed to read image file ${r}: ${e}`);
|
|
8736
8736
|
}
|
|
8737
8737
|
}
|
|
8738
|
-
async function n(
|
|
8738
|
+
async function n(r, e) {
|
|
8739
8739
|
try {
|
|
8740
|
-
let t = (0, import_sharp.default)(
|
|
8741
|
-
typeof
|
|
8740
|
+
let t = (0, import_sharp.default)(r.data, { raw: { width: r.width, height: r.height, channels: 4 } });
|
|
8741
|
+
typeof e == "string" ? await t.png().toFile(e) : e.set(await t.png().toBuffer());
|
|
8742
8742
|
} catch (t) {
|
|
8743
|
-
throw new Error(`Failed to write image file ${
|
|
8743
|
+
throw new Error(`Failed to write image file ${e}: ${t}`);
|
|
8744
8744
|
}
|
|
8745
8745
|
}
|
|
8746
8746
|
var import_sharp, o, f;
|
|
@@ -8753,6 +8753,366 @@ var init_dist2 = __esm({
|
|
|
8753
8753
|
}
|
|
8754
8754
|
});
|
|
8755
8755
|
|
|
8756
|
+
// ../../node_modules/.pnpm/@jsquash+png@3.1.1/node_modules/@jsquash/png/codec/pkg/squoosh_png.js
|
|
8757
|
+
function addHeapObject(obj) {
|
|
8758
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
8759
|
+
const idx = heap_next;
|
|
8760
|
+
heap_next = heap[idx];
|
|
8761
|
+
heap[idx] = obj;
|
|
8762
|
+
return idx;
|
|
8763
|
+
}
|
|
8764
|
+
function getObject(idx) {
|
|
8765
|
+
return heap[idx];
|
|
8766
|
+
}
|
|
8767
|
+
function dropObject(idx) {
|
|
8768
|
+
if (idx < 132) return;
|
|
8769
|
+
heap[idx] = heap_next;
|
|
8770
|
+
heap_next = idx;
|
|
8771
|
+
}
|
|
8772
|
+
function takeObject(idx) {
|
|
8773
|
+
const ret = getObject(idx);
|
|
8774
|
+
dropObject(idx);
|
|
8775
|
+
return ret;
|
|
8776
|
+
}
|
|
8777
|
+
function getUint8Memory0() {
|
|
8778
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
8779
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
8780
|
+
}
|
|
8781
|
+
return cachedUint8Memory0;
|
|
8782
|
+
}
|
|
8783
|
+
function getStringFromWasm0(ptr, len) {
|
|
8784
|
+
ptr = ptr >>> 0;
|
|
8785
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
8786
|
+
}
|
|
8787
|
+
function getUint8ClampedMemory0() {
|
|
8788
|
+
if (cachedUint8ClampedMemory0 === null || cachedUint8ClampedMemory0.byteLength === 0) {
|
|
8789
|
+
cachedUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
|
|
8790
|
+
}
|
|
8791
|
+
return cachedUint8ClampedMemory0;
|
|
8792
|
+
}
|
|
8793
|
+
function getClampedArrayU8FromWasm0(ptr, len) {
|
|
8794
|
+
ptr = ptr >>> 0;
|
|
8795
|
+
return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
8796
|
+
}
|
|
8797
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
8798
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
8799
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
8800
|
+
WASM_VECTOR_LEN = arg.length;
|
|
8801
|
+
return ptr;
|
|
8802
|
+
}
|
|
8803
|
+
function getInt32Memory0() {
|
|
8804
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
8805
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
8806
|
+
}
|
|
8807
|
+
return cachedInt32Memory0;
|
|
8808
|
+
}
|
|
8809
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
8810
|
+
ptr = ptr >>> 0;
|
|
8811
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
8812
|
+
}
|
|
8813
|
+
function encode(data, width, height, bit_depth) {
|
|
8814
|
+
try {
|
|
8815
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8816
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
8817
|
+
const len0 = WASM_VECTOR_LEN;
|
|
8818
|
+
wasm.encode(retptr, ptr0, len0, width, height, bit_depth);
|
|
8819
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
8820
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
8821
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
8822
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
8823
|
+
return v2;
|
|
8824
|
+
} finally {
|
|
8825
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
8826
|
+
}
|
|
8827
|
+
}
|
|
8828
|
+
function decode(data) {
|
|
8829
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
8830
|
+
const len0 = WASM_VECTOR_LEN;
|
|
8831
|
+
const ret = wasm.decode(ptr0, len0);
|
|
8832
|
+
return takeObject(ret);
|
|
8833
|
+
}
|
|
8834
|
+
function decode_rgba16(data) {
|
|
8835
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
8836
|
+
const len0 = WASM_VECTOR_LEN;
|
|
8837
|
+
const ret = wasm.decode_rgba16(ptr0, len0);
|
|
8838
|
+
return ImageDataRGBA16.__wrap(ret);
|
|
8839
|
+
}
|
|
8840
|
+
async function __wbg_load(module2, imports) {
|
|
8841
|
+
if (typeof Response === "function" && module2 instanceof Response) {
|
|
8842
|
+
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
8843
|
+
try {
|
|
8844
|
+
return await WebAssembly.instantiateStreaming(module2, imports);
|
|
8845
|
+
} catch (e) {
|
|
8846
|
+
if (module2.headers.get("Content-Type") != "application/wasm") {
|
|
8847
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
8848
|
+
} else {
|
|
8849
|
+
throw e;
|
|
8850
|
+
}
|
|
8851
|
+
}
|
|
8852
|
+
}
|
|
8853
|
+
const bytes = await module2.arrayBuffer();
|
|
8854
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
8855
|
+
} else {
|
|
8856
|
+
const instance = await WebAssembly.instantiate(module2, imports);
|
|
8857
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
8858
|
+
return { instance, module: module2 };
|
|
8859
|
+
} else {
|
|
8860
|
+
return instance;
|
|
8861
|
+
}
|
|
8862
|
+
}
|
|
8863
|
+
}
|
|
8864
|
+
function __wbg_get_imports() {
|
|
8865
|
+
const imports = {};
|
|
8866
|
+
imports.wbg = {};
|
|
8867
|
+
imports.wbg.__wbindgen_memory = function() {
|
|
8868
|
+
const ret = wasm.memory;
|
|
8869
|
+
return addHeapObject(ret);
|
|
8870
|
+
};
|
|
8871
|
+
imports.wbg.__wbg_buffer_a448f833075b71ba = function(arg0) {
|
|
8872
|
+
const ret = getObject(arg0).buffer;
|
|
8873
|
+
return addHeapObject(ret);
|
|
8874
|
+
};
|
|
8875
|
+
imports.wbg.__wbg_newwithbyteoffsetandlength_099217381c451830 = function(arg0, arg1, arg2) {
|
|
8876
|
+
const ret = new Uint16Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
8877
|
+
return addHeapObject(ret);
|
|
8878
|
+
};
|
|
8879
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
8880
|
+
takeObject(arg0);
|
|
8881
|
+
};
|
|
8882
|
+
imports.wbg.__wbg_newwithownedu8clampedarrayandsh_91db5987993a08fb = function(arg0, arg1, arg2, arg3) {
|
|
8883
|
+
var v0 = getClampedArrayU8FromWasm0(arg0, arg1).slice();
|
|
8884
|
+
wasm.__wbindgen_free(arg0, arg1 * 1, 1);
|
|
8885
|
+
const ret = new ImageData(v0, arg2 >>> 0, arg3 >>> 0);
|
|
8886
|
+
return addHeapObject(ret);
|
|
8887
|
+
};
|
|
8888
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
8889
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
8890
|
+
};
|
|
8891
|
+
return imports;
|
|
8892
|
+
}
|
|
8893
|
+
function __wbg_init_memory(imports, maybe_memory) {
|
|
8894
|
+
}
|
|
8895
|
+
function __wbg_finalize_init(instance, module2) {
|
|
8896
|
+
wasm = instance.exports;
|
|
8897
|
+
__wbg_init.__wbindgen_wasm_module = module2;
|
|
8898
|
+
cachedInt32Memory0 = null;
|
|
8899
|
+
cachedUint8Memory0 = null;
|
|
8900
|
+
cachedUint8ClampedMemory0 = null;
|
|
8901
|
+
return wasm;
|
|
8902
|
+
}
|
|
8903
|
+
async function __wbg_init(input) {
|
|
8904
|
+
if (wasm !== void 0) return wasm;
|
|
8905
|
+
if (typeof input === "undefined") {
|
|
8906
|
+
input = new URL("squoosh_png_bg.wasm", import_meta.url);
|
|
8907
|
+
}
|
|
8908
|
+
const imports = __wbg_get_imports();
|
|
8909
|
+
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
|
|
8910
|
+
input = fetch(input);
|
|
8911
|
+
}
|
|
8912
|
+
__wbg_init_memory(imports);
|
|
8913
|
+
const { instance, module: module2 } = await __wbg_load(await input, imports);
|
|
8914
|
+
return __wbg_finalize_init(instance, module2);
|
|
8915
|
+
}
|
|
8916
|
+
var import_meta, wasm, heap, heap_next, cachedTextDecoder, cachedUint8Memory0, cachedUint8ClampedMemory0, WASM_VECTOR_LEN, cachedInt32Memory0, ImageDataRGBA16, squoosh_png_default, isServiceWorker, isRunningInCloudFlareWorkers, isRunningInNode;
|
|
8917
|
+
var init_squoosh_png = __esm({
|
|
8918
|
+
"../../node_modules/.pnpm/@jsquash+png@3.1.1/node_modules/@jsquash/png/codec/pkg/squoosh_png.js"() {
|
|
8919
|
+
"use strict";
|
|
8920
|
+
import_meta = {};
|
|
8921
|
+
heap = new Array(128).fill(void 0);
|
|
8922
|
+
heap.push(void 0, null, true, false);
|
|
8923
|
+
heap_next = heap.length;
|
|
8924
|
+
cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
|
|
8925
|
+
throw Error("TextDecoder not available");
|
|
8926
|
+
} };
|
|
8927
|
+
if (typeof TextDecoder !== "undefined") {
|
|
8928
|
+
cachedTextDecoder.decode();
|
|
8929
|
+
}
|
|
8930
|
+
cachedUint8Memory0 = null;
|
|
8931
|
+
cachedUint8ClampedMemory0 = null;
|
|
8932
|
+
WASM_VECTOR_LEN = 0;
|
|
8933
|
+
cachedInt32Memory0 = null;
|
|
8934
|
+
ImageDataRGBA16 = class _ImageDataRGBA16 {
|
|
8935
|
+
static __wrap(ptr) {
|
|
8936
|
+
ptr = ptr >>> 0;
|
|
8937
|
+
const obj = Object.create(_ImageDataRGBA16.prototype);
|
|
8938
|
+
obj.__wbg_ptr = ptr;
|
|
8939
|
+
return obj;
|
|
8940
|
+
}
|
|
8941
|
+
__destroy_into_raw() {
|
|
8942
|
+
const ptr = this.__wbg_ptr;
|
|
8943
|
+
this.__wbg_ptr = 0;
|
|
8944
|
+
return ptr;
|
|
8945
|
+
}
|
|
8946
|
+
free() {
|
|
8947
|
+
const ptr = this.__destroy_into_raw();
|
|
8948
|
+
wasm.__wbg_imagedatargba16_free(ptr);
|
|
8949
|
+
}
|
|
8950
|
+
/**
|
|
8951
|
+
* @returns {number}
|
|
8952
|
+
*/
|
|
8953
|
+
get width() {
|
|
8954
|
+
const ret = wasm.imagedatargba16_width(this.__wbg_ptr);
|
|
8955
|
+
return ret >>> 0;
|
|
8956
|
+
}
|
|
8957
|
+
/**
|
|
8958
|
+
* @returns {number}
|
|
8959
|
+
*/
|
|
8960
|
+
get height() {
|
|
8961
|
+
const ret = wasm.imagedatargba16_height(this.__wbg_ptr);
|
|
8962
|
+
return ret >>> 0;
|
|
8963
|
+
}
|
|
8964
|
+
/**
|
|
8965
|
+
* @returns {Uint16Array}
|
|
8966
|
+
*/
|
|
8967
|
+
get data() {
|
|
8968
|
+
const ret = wasm.imagedatargba16_data(this.__wbg_ptr);
|
|
8969
|
+
return takeObject(ret);
|
|
8970
|
+
}
|
|
8971
|
+
};
|
|
8972
|
+
squoosh_png_default = __wbg_init;
|
|
8973
|
+
isServiceWorker = globalThis.ServiceWorkerGlobalScope !== void 0;
|
|
8974
|
+
isRunningInCloudFlareWorkers = isServiceWorker && typeof self !== "undefined" && globalThis.caches && globalThis.caches.default !== void 0;
|
|
8975
|
+
isRunningInNode = typeof process === "object" && process.release && process.release.name === "node";
|
|
8976
|
+
if (isRunningInCloudFlareWorkers || isRunningInNode) {
|
|
8977
|
+
if (!globalThis.ImageData) {
|
|
8978
|
+
globalThis.ImageData = class ImageData {
|
|
8979
|
+
constructor(data, width, height) {
|
|
8980
|
+
this.data = data;
|
|
8981
|
+
this.width = width;
|
|
8982
|
+
this.height = height;
|
|
8983
|
+
}
|
|
8984
|
+
};
|
|
8985
|
+
}
|
|
8986
|
+
if (import_meta.url === void 0) {
|
|
8987
|
+
import_meta.url = "https://localhost";
|
|
8988
|
+
}
|
|
8989
|
+
if (typeof self !== "undefined" && self.location === void 0) {
|
|
8990
|
+
self.location = { href: "" };
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
}
|
|
8994
|
+
});
|
|
8995
|
+
|
|
8996
|
+
// ../../node_modules/.pnpm/@jsquash+png@3.1.1/node_modules/@jsquash/png/decode.js
|
|
8997
|
+
var decode_exports = {};
|
|
8998
|
+
__export(decode_exports, {
|
|
8999
|
+
decode: () => decode2,
|
|
9000
|
+
default: () => decode_default,
|
|
9001
|
+
init: () => init
|
|
9002
|
+
});
|
|
9003
|
+
async function init(moduleOrPath) {
|
|
9004
|
+
if (!pngModule) {
|
|
9005
|
+
pngModule = squoosh_png_default(moduleOrPath);
|
|
9006
|
+
}
|
|
9007
|
+
return pngModule;
|
|
9008
|
+
}
|
|
9009
|
+
async function decode2(data, options = {}) {
|
|
9010
|
+
await init();
|
|
9011
|
+
const { bitDepth = 8 } = options;
|
|
9012
|
+
if (bitDepth === 16) {
|
|
9013
|
+
const imageData2 = await decode_rgba16(new Uint8Array(data));
|
|
9014
|
+
if (!imageData2)
|
|
9015
|
+
throw new Error("Encoding error.");
|
|
9016
|
+
return imageData2;
|
|
9017
|
+
}
|
|
9018
|
+
const imageData = await decode(new Uint8Array(data));
|
|
9019
|
+
if (!imageData)
|
|
9020
|
+
throw new Error("Encoding error.");
|
|
9021
|
+
return imageData;
|
|
9022
|
+
}
|
|
9023
|
+
var pngModule, decode_default;
|
|
9024
|
+
var init_decode = __esm({
|
|
9025
|
+
"../../node_modules/.pnpm/@jsquash+png@3.1.1/node_modules/@jsquash/png/decode.js"() {
|
|
9026
|
+
"use strict";
|
|
9027
|
+
init_squoosh_png();
|
|
9028
|
+
decode_default = decode2;
|
|
9029
|
+
}
|
|
9030
|
+
});
|
|
9031
|
+
|
|
9032
|
+
// ../../node_modules/.pnpm/@jsquash+png@3.1.1/node_modules/@jsquash/png/encode.js
|
|
9033
|
+
var encode_exports = {};
|
|
9034
|
+
__export(encode_exports, {
|
|
9035
|
+
default: () => encode2,
|
|
9036
|
+
init: () => init2
|
|
9037
|
+
});
|
|
9038
|
+
async function init2(moduleOrPath) {
|
|
9039
|
+
if (!pngModule2) {
|
|
9040
|
+
pngModule2 = squoosh_png_default(moduleOrPath);
|
|
9041
|
+
}
|
|
9042
|
+
return pngModule2;
|
|
9043
|
+
}
|
|
9044
|
+
async function encode2(data, options = {}) {
|
|
9045
|
+
var _a;
|
|
9046
|
+
await init2();
|
|
9047
|
+
const bitDepth = (_a = options === null || options === void 0 ? void 0 : options.bitDepth) !== null && _a !== void 0 ? _a : 8;
|
|
9048
|
+
if (bitDepth !== 8 && bitDepth !== 16) {
|
|
9049
|
+
throw new Error("Invalid bit depth. Must be either 8 or 16.");
|
|
9050
|
+
}
|
|
9051
|
+
const isUint16Array = data.data instanceof Uint16Array;
|
|
9052
|
+
if (isUint16Array && bitDepth !== 16) {
|
|
9053
|
+
throw new Error("Invalid bit depth, must be 16 for Uint16Array or manually convert to RGB8 values with Uint8Array.");
|
|
9054
|
+
}
|
|
9055
|
+
if (!isUint16Array && bitDepth === 16) {
|
|
9056
|
+
throw new Error("Invalid bit depth, must be 8 for Uint8Array or manually convert to RGB16 values with Uint16Array.");
|
|
9057
|
+
}
|
|
9058
|
+
const encodeData = new Uint8Array(data.data.buffer);
|
|
9059
|
+
const output = await encode(encodeData, data.width, data.height, bitDepth);
|
|
9060
|
+
if (!output)
|
|
9061
|
+
throw new Error("Encoding error.");
|
|
9062
|
+
return output.buffer;
|
|
9063
|
+
}
|
|
9064
|
+
var pngModule2;
|
|
9065
|
+
var init_encode = __esm({
|
|
9066
|
+
"../../node_modules/.pnpm/@jsquash+png@3.1.1/node_modules/@jsquash/png/encode.js"() {
|
|
9067
|
+
"use strict";
|
|
9068
|
+
init_squoosh_png();
|
|
9069
|
+
}
|
|
9070
|
+
});
|
|
9071
|
+
|
|
9072
|
+
// ../codec-jsquash-png/dist/index.mjs
|
|
9073
|
+
var dist_exports3 = {};
|
|
9074
|
+
__export(dist_exports3, {
|
|
9075
|
+
codecJsquashPng: () => l,
|
|
9076
|
+
default: () => p
|
|
9077
|
+
});
|
|
9078
|
+
function c2() {
|
|
9079
|
+
return n2 || (n2 = (async () => {
|
|
9080
|
+
let e = (0, import_path.dirname)(i2.resolve("@jsquash/png")), t = (0, import_path.join)(e, "codec", "pkg", "squoosh_png_bg.wasm"), a2 = (0, import_fs2.readFileSync)(t), o2 = await Promise.resolve().then(() => (init_decode(), decode_exports)), r = await Promise.resolve().then(() => (init_encode(), encode_exports));
|
|
9081
|
+
return await Promise.all([o2.init(a2), r.init(a2)]), { decode: o2.default, encode: r.default };
|
|
9082
|
+
})(), n2);
|
|
9083
|
+
}
|
|
9084
|
+
async function h2(e) {
|
|
9085
|
+
try {
|
|
9086
|
+
let { decode: t } = await c2(), a2 = typeof e == "string" ? (0, import_fs2.readFileSync)(e) : e, o2 = new Uint8Array(a2).buffer, r = await t(o2);
|
|
9087
|
+
return { data: r.data, width: r.width, height: r.height };
|
|
9088
|
+
} catch (t) {
|
|
9089
|
+
throw new Error(`Failed to read PNG file ${e}: ${t}`);
|
|
9090
|
+
}
|
|
9091
|
+
}
|
|
9092
|
+
async function m2(e, t) {
|
|
9093
|
+
try {
|
|
9094
|
+
let { encode: a2 } = await c2(), o2 = { data: new Uint8ClampedArray(e.data.buffer, e.data.byteOffset, e.data.byteLength), width: e.width, height: e.height, colorSpace: "srgb" }, r = await a2(o2);
|
|
9095
|
+
(0, import_fs2.writeFileSync)(t, Buffer.from(r));
|
|
9096
|
+
} catch (a2) {
|
|
9097
|
+
throw new Error(`Failed to write PNG file ${t}: ${a2}`);
|
|
9098
|
+
}
|
|
9099
|
+
}
|
|
9100
|
+
var import_fs2, import_path, i2, n2, l, p;
|
|
9101
|
+
var init_dist3 = __esm({
|
|
9102
|
+
"../codec-jsquash-png/dist/index.mjs"() {
|
|
9103
|
+
"use strict";
|
|
9104
|
+
import_fs2 = require("fs");
|
|
9105
|
+
import_path = require("path");
|
|
9106
|
+
i2 = ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (t, a2) => (typeof require < "u" ? require : t)[a2] }) : e)(function(e) {
|
|
9107
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
9108
|
+
throw Error('Dynamic require of "' + e + '" is not supported');
|
|
9109
|
+
});
|
|
9110
|
+
n2 = null;
|
|
9111
|
+
l = { read: h2, write: m2 };
|
|
9112
|
+
p = l;
|
|
9113
|
+
}
|
|
9114
|
+
});
|
|
9115
|
+
|
|
8756
9116
|
// src/commands/core.ts
|
|
8757
9117
|
var core_exports = {};
|
|
8758
9118
|
__export(core_exports, {
|
|
@@ -8761,120 +9121,120 @@ __export(core_exports, {
|
|
|
8761
9121
|
module.exports = __toCommonJS(core_exports);
|
|
8762
9122
|
|
|
8763
9123
|
// ../core/dist/index.mjs
|
|
8764
|
-
function g(
|
|
8765
|
-
if (!_(
|
|
8766
|
-
if (
|
|
8767
|
-
if (
|
|
8768
|
-
if (y && typeof Buffer < "u" && Buffer.compare &&
|
|
8769
|
-
if (t && !b) for (let A = 0; A < e * o2; A++) L(
|
|
9124
|
+
function g(n3, r, t, e, o2, { threshold: f2 = 0.1, alpha: c3 = 0.1, aaColor: s = [255, 255, 0], diffColor: a2 = [255, 0, 0], includeAA: U, diffColorAlt: O, diffMask: b, fastBufferCheck: y = true } = {}) {
|
|
9125
|
+
if (!_(n3) || !_(r) || t && !_(t)) throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");
|
|
9126
|
+
if (n3.length !== r.length || t && t.length !== n3.length) throw new Error(`Image sizes do not match. Image 1 size: ${n3.length}, image 2 size: ${r.length}`);
|
|
9127
|
+
if (n3.length !== e * o2 * 4) throw new Error(`Image data size does not match width/height. Expecting ${e * o2 * 4}. Got ${n3.length}`);
|
|
9128
|
+
if (y && typeof Buffer < "u" && Buffer.compare && n3 instanceof Uint8Array && r instanceof Uint8Array && Buffer.compare(n3, r) === 0) {
|
|
9129
|
+
if (t && !b) for (let A = 0; A < e * o2; A++) L(n3, A * 4, c3, t);
|
|
8770
9130
|
return 0;
|
|
8771
9131
|
}
|
|
8772
|
-
let
|
|
8773
|
-
for (let A = 0; A < I; A++) for (let R = 0; R <
|
|
8774
|
-
let
|
|
9132
|
+
let m3 = e * o2, u = new Uint32Array(n3.buffer, n3.byteOffset, m3), d2 = new Uint32Array(r.buffer, r.byteOffset, m3), l2 = tn(e, o2), i3 = Math.ceil(e / l2), I = Math.ceil(o2 / l2), z = i3 * I, x = new Uint16Array(z), M = 35215 * f2 * f2, B = 0;
|
|
9133
|
+
for (let A = 0; A < I; A++) for (let R = 0; R < i3; R++) {
|
|
9134
|
+
let p2 = R * l2, v = A * l2, D = Math.min(p2 + l2, e), P = Math.min(v + l2, o2), $ = false;
|
|
8775
9135
|
n: for (let C = v; C < P; C++) {
|
|
8776
9136
|
let Y = C * e;
|
|
8777
|
-
for (let G =
|
|
9137
|
+
for (let G = p2; G < D; G++) {
|
|
8778
9138
|
let E = Y + G;
|
|
8779
9139
|
if (u[E] === d2[E]) continue;
|
|
8780
|
-
let S = E * 4, X = N(
|
|
9140
|
+
let S = E * 4, X = N(n3, r, S, S);
|
|
8781
9141
|
if (Math.abs(X) > M) {
|
|
8782
9142
|
$ = true;
|
|
8783
9143
|
break n;
|
|
8784
9144
|
}
|
|
8785
9145
|
}
|
|
8786
9146
|
}
|
|
8787
|
-
if ($) x[B++] = A *
|
|
9147
|
+
if ($) x[B++] = A * i3 + R;
|
|
8788
9148
|
else if (t && !b) for (let C = v; C < P; C++) {
|
|
8789
9149
|
let Y = C * e;
|
|
8790
|
-
for (let G =
|
|
9150
|
+
for (let G = p2; G < D; G++) {
|
|
8791
9151
|
let E = Y + G;
|
|
8792
|
-
L(
|
|
9152
|
+
L(n3, E * 4, c3, t);
|
|
8793
9153
|
}
|
|
8794
9154
|
}
|
|
8795
9155
|
}
|
|
8796
9156
|
if (B === 0) return 0;
|
|
8797
|
-
let [F, J, K] =
|
|
9157
|
+
let [F, J, K] = s, [Q, W, Z] = a2, [k, w, h3] = O || a2, T = 0;
|
|
8798
9158
|
for (let A = 0; A < B; A++) {
|
|
8799
|
-
let R = x[A],
|
|
9159
|
+
let R = x[A], p2 = R % i3, v = R / i3 | 0, D = p2 * l2, P = v * l2, $ = Math.min(D + l2, e), C = Math.min(P + l2, o2);
|
|
8800
9160
|
for (let Y = P; Y < C; Y++) {
|
|
8801
9161
|
let G = Y * e;
|
|
8802
9162
|
for (let E = D; E < $; E++) {
|
|
8803
9163
|
let S = G + E, X = S * 4;
|
|
8804
9164
|
if (u[S] === d2[S]) {
|
|
8805
|
-
t && !b && L(
|
|
9165
|
+
t && !b && L(n3, X, c3, t);
|
|
8806
9166
|
continue;
|
|
8807
9167
|
}
|
|
8808
|
-
let H = N(
|
|
8809
|
-
Math.abs(H) > M ? !U && (j(
|
|
9168
|
+
let H = N(n3, r, X, X);
|
|
9169
|
+
Math.abs(H) > M ? !U && (j(n3, E, Y, e, o2, u, d2) || j(r, E, Y, e, o2, d2, u)) ? t && !b && V(t, X, F, J, K) : (t && (H < 0 ? V(t, X, k, w, h3) : V(t, X, Q, W, Z)), T++) : t && !b && L(n3, X, c3, t);
|
|
8810
9170
|
}
|
|
8811
9171
|
}
|
|
8812
9172
|
}
|
|
8813
9173
|
return T;
|
|
8814
9174
|
}
|
|
8815
|
-
function _(
|
|
8816
|
-
return ArrayBuffer.isView(
|
|
9175
|
+
function _(n3) {
|
|
9176
|
+
return ArrayBuffer.isView(n3) && n3.BYTES_PER_ELEMENT === 1;
|
|
8817
9177
|
}
|
|
8818
9178
|
var nn = Math.LOG2E;
|
|
8819
|
-
function tn(
|
|
8820
|
-
let t =
|
|
9179
|
+
function tn(n3, r) {
|
|
9180
|
+
let t = n3 * r, e = Math.sqrt(t) / 100, o2 = 16 * Math.sqrt(e), f2 = Math.log(o2) * nn;
|
|
8821
9181
|
return 1 << Math.round(f2);
|
|
8822
9182
|
}
|
|
8823
|
-
function N(
|
|
8824
|
-
let o2 =
|
|
8825
|
-
if (!y && !
|
|
8826
|
-
if (
|
|
9183
|
+
function N(n3, r, t, e) {
|
|
9184
|
+
let o2 = n3[t], f2 = n3[t + 1], c3 = n3[t + 2], s = n3[t + 3], a2 = r[e], U = r[e + 1], O = r[e + 2], b = r[e + 3], y = o2 - a2, m3 = f2 - U, u = c3 - O, d2 = s - b;
|
|
9185
|
+
if (!y && !m3 && !u && !d2) return 0;
|
|
9186
|
+
if (s < 255 || b < 255) {
|
|
8827
9187
|
let x = 48 + 159 * (t % 2), M = 48 + 159 * ((t / 1.618033988749895 | 0) & 1), B = 48 + 159 * ((t / 2.618033988749895 | 0) & 1);
|
|
8828
|
-
y = (o2 *
|
|
9188
|
+
y = (o2 * s - a2 * b - x * d2) / 255, m3 = (f2 * s - U * b - M * d2) / 255, u = (c3 * s - O * b - B * d2) / 255;
|
|
8829
9189
|
}
|
|
8830
|
-
let
|
|
8831
|
-
return
|
|
9190
|
+
let l2 = y * 0.29889531 + m3 * 0.58662247 + u * 0.11448223, i3 = y * 0.59597799 - m3 * 0.2741761 - u * 0.32180189, I = y * 0.21147017 - m3 * 0.52261711 + u * 0.31114694, z = 0.5053 * l2 * l2 + 0.299 * i3 * i3 + 0.1957 * I * I;
|
|
9191
|
+
return l2 > 0 ? -z : z;
|
|
8832
9192
|
}
|
|
8833
|
-
function rn(
|
|
8834
|
-
let o2 =
|
|
8835
|
-
if (!y && !
|
|
8836
|
-
if (
|
|
8837
|
-
let
|
|
8838
|
-
y = (o2 *
|
|
9193
|
+
function rn(n3, r, t, e) {
|
|
9194
|
+
let o2 = n3[t], f2 = n3[t + 1], c3 = n3[t + 2], s = n3[t + 3], a2 = r[e], U = r[e + 1], O = r[e + 2], b = r[e + 3], y = o2 - a2, m3 = f2 - U, u = c3 - O, d2 = s - b;
|
|
9195
|
+
if (!y && !m3 && !u && !d2) return 0;
|
|
9196
|
+
if (s < 255 || b < 255) {
|
|
9197
|
+
let i3 = 48 + 159 * (t % 2), I = 48 + 159 * ((t / 1.618033988749895 | 0) & 1), z = 48 + 159 * ((t / 2.618033988749895 | 0) & 1);
|
|
9198
|
+
y = (o2 * s - a2 * b - i3 * d2) / 255, m3 = (f2 * s - U * b - I * d2) / 255, u = (c3 * s - O * b - z * d2) / 255;
|
|
8839
9199
|
}
|
|
8840
|
-
return y * 0.29889531 +
|
|
9200
|
+
return y * 0.29889531 + m3 * 0.58662247 + u * 0.11448223;
|
|
8841
9201
|
}
|
|
8842
|
-
function j(
|
|
8843
|
-
let
|
|
8844
|
-
for (let x =
|
|
9202
|
+
function j(n3, r, t, e, o2, f2, c3) {
|
|
9203
|
+
let s = Math.max(r - 1, 0), a2 = Math.max(t - 1, 0), U = Math.min(r + 1, e - 1), O = Math.min(t + 1, o2 - 1), y = (t * e + r) * 4, m3 = r === s || r === U || t === a2 || t === O ? 1 : 0, u = 0, d2 = 0, l2 = 0, i3 = 0, I = 0, z = 0;
|
|
9204
|
+
for (let x = s; x <= U; x++) for (let M = a2; M <= O; M++) {
|
|
8845
9205
|
if (x === r && M === t) continue;
|
|
8846
|
-
let B = rn(
|
|
9206
|
+
let B = rn(n3, n3, y, (M * e + x) * 4);
|
|
8847
9207
|
if (B === 0) {
|
|
8848
|
-
if (
|
|
8849
|
-
} else B < u ? (u = B,
|
|
9208
|
+
if (m3++, m3 > 2) return false;
|
|
9209
|
+
} else B < u ? (u = B, l2 = x, i3 = M) : B > d2 && (d2 = B, I = x, z = M);
|
|
8850
9210
|
}
|
|
8851
|
-
return u === 0 || d2 === 0 ? false : q(f2,
|
|
9211
|
+
return u === 0 || d2 === 0 ? false : q(f2, l2, i3, e, o2) && q(c3, l2, i3, e, o2) || q(f2, I, z, e, o2) && q(c3, I, z, e, o2);
|
|
8852
9212
|
}
|
|
8853
|
-
function q(
|
|
8854
|
-
let f2 = t * e + r,
|
|
9213
|
+
function q(n3, r, t, e, o2) {
|
|
9214
|
+
let f2 = t * e + r, c3 = n3[f2], s = r === 0 || r === e - 1 || t === 0 || t === o2 - 1 ? 1 : 0;
|
|
8855
9215
|
if (t > 0) {
|
|
8856
9216
|
let a2 = f2 - e;
|
|
8857
|
-
r > 0 &&
|
|
9217
|
+
r > 0 && n3[a2 - 1] === c3 && s++, n3[a2] === c3 && s++, r < e - 1 && n3[a2 + 1] === c3 && s++;
|
|
8858
9218
|
}
|
|
8859
|
-
if (r > 0 &&
|
|
9219
|
+
if (r > 0 && n3[f2 - 1] === c3 && s++, r < e - 1 && n3[f2 + 1] === c3 && s++, t < o2 - 1) {
|
|
8860
9220
|
let a2 = f2 + e;
|
|
8861
|
-
r > 0 &&
|
|
9221
|
+
r > 0 && n3[a2 - 1] === c3 && s++, n3[a2] === c3 && s++, r < e - 1 && n3[a2 + 1] === c3 && s++;
|
|
8862
9222
|
}
|
|
8863
|
-
return
|
|
9223
|
+
return s > 2;
|
|
8864
9224
|
}
|
|
8865
|
-
function L(
|
|
8866
|
-
let o2 = 255 + (
|
|
9225
|
+
function L(n3, r, t, e) {
|
|
9226
|
+
let o2 = 255 + (n3[r] * 0.29889531 + n3[r + 1] * 0.58662247 + n3[r + 2] * 0.11448223 - 255) * t * n3[r + 3] / 255;
|
|
8867
9227
|
V(e, r, o2, o2, o2);
|
|
8868
9228
|
}
|
|
8869
|
-
function V(
|
|
8870
|
-
|
|
9229
|
+
function V(n3, r, t, e, o2) {
|
|
9230
|
+
n3[r + 0] = t, n3[r + 1] = e, n3[r + 2] = o2, n3[r + 3] = 255;
|
|
8871
9231
|
}
|
|
8872
9232
|
var on = g;
|
|
8873
9233
|
|
|
8874
9234
|
// src/commands/core.ts
|
|
8875
9235
|
function parseRGB(colorStr) {
|
|
8876
|
-
const parts = colorStr.split(",").map((
|
|
8877
|
-
if (parts.length !== 3 || parts.some((
|
|
9236
|
+
const parts = colorStr.split(",").map((s) => parseInt(s.trim(), 10));
|
|
9237
|
+
if (parts.length !== 3 || parts.some((p2) => Number.isNaN(p2) || p2 < 0 || p2 > 255)) {
|
|
8878
9238
|
throw new Error(
|
|
8879
9239
|
`Invalid RGB color format: ${colorStr}. Expected format: r,g,b (e.g., 255,0,0)`
|
|
8880
9240
|
);
|
|
@@ -8898,7 +9258,7 @@ Options:
|
|
|
8898
9258
|
--diff-color-alt <r,g,b> Alternative color for dark differences (default: same as diff-color)
|
|
8899
9259
|
--include-aa Include anti-aliasing detection
|
|
8900
9260
|
--diff-mask Draw diff over transparent background
|
|
8901
|
-
--
|
|
9261
|
+
--codec <name> Specify codec to use (pngjs, sharp, jsquash-png)
|
|
8902
9262
|
-h, --help Show this help message
|
|
8903
9263
|
|
|
8904
9264
|
Examples:
|
|
@@ -8907,16 +9267,20 @@ Examples:
|
|
|
8907
9267
|
blazediff diff image1.png image2.png --threshold 0.2 --alpha 0.3
|
|
8908
9268
|
`);
|
|
8909
9269
|
}
|
|
8910
|
-
var
|
|
8911
|
-
if (!
|
|
8912
|
-
const { default:
|
|
8913
|
-
return
|
|
9270
|
+
var getCodec = async (codec) => {
|
|
9271
|
+
if (!codec || codec === "pngjs") {
|
|
9272
|
+
const { default: c3 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
9273
|
+
return c3;
|
|
8914
9274
|
}
|
|
8915
|
-
if (
|
|
8916
|
-
const { default:
|
|
8917
|
-
return
|
|
9275
|
+
if (codec === "sharp") {
|
|
9276
|
+
const { default: c3 } = await Promise.resolve().then(() => (init_dist2(), dist_exports2));
|
|
9277
|
+
return c3;
|
|
8918
9278
|
}
|
|
8919
|
-
|
|
9279
|
+
if (codec === "jsquash-png") {
|
|
9280
|
+
const { default: c3 } = await Promise.resolve().then(() => (init_dist3(), dist_exports3));
|
|
9281
|
+
return c3;
|
|
9282
|
+
}
|
|
9283
|
+
throw new Error(`Unknown codec: ${codec}`);
|
|
8920
9284
|
};
|
|
8921
9285
|
async function main() {
|
|
8922
9286
|
try {
|
|
@@ -8933,15 +9297,15 @@ async function main() {
|
|
|
8933
9297
|
const image1 = args[0];
|
|
8934
9298
|
const image2 = args[1];
|
|
8935
9299
|
const options = {};
|
|
8936
|
-
for (let
|
|
8937
|
-
const arg = args[
|
|
8938
|
-
const nextArg = args[
|
|
9300
|
+
for (let i3 = 2; i3 < args.length; i3++) {
|
|
9301
|
+
const arg = args[i3];
|
|
9302
|
+
const nextArg = args[i3 + 1];
|
|
8939
9303
|
switch (arg) {
|
|
8940
9304
|
case "-o":
|
|
8941
9305
|
case "--output":
|
|
8942
9306
|
if (nextArg) {
|
|
8943
9307
|
options.outputPath = nextArg;
|
|
8944
|
-
|
|
9308
|
+
i3++;
|
|
8945
9309
|
}
|
|
8946
9310
|
break;
|
|
8947
9311
|
case "-t":
|
|
@@ -8954,7 +9318,7 @@ async function main() {
|
|
|
8954
9318
|
);
|
|
8955
9319
|
}
|
|
8956
9320
|
options.threshold = threshold;
|
|
8957
|
-
|
|
9321
|
+
i3++;
|
|
8958
9322
|
}
|
|
8959
9323
|
break;
|
|
8960
9324
|
case "-a":
|
|
@@ -8967,25 +9331,25 @@ async function main() {
|
|
|
8967
9331
|
);
|
|
8968
9332
|
}
|
|
8969
9333
|
options.alpha = alpha;
|
|
8970
|
-
|
|
9334
|
+
i3++;
|
|
8971
9335
|
}
|
|
8972
9336
|
break;
|
|
8973
9337
|
case "--aa-color":
|
|
8974
9338
|
if (nextArg) {
|
|
8975
9339
|
options.aaColor = parseRGB(nextArg);
|
|
8976
|
-
|
|
9340
|
+
i3++;
|
|
8977
9341
|
}
|
|
8978
9342
|
break;
|
|
8979
9343
|
case "--diff-color":
|
|
8980
9344
|
if (nextArg) {
|
|
8981
9345
|
options.diffColor = parseRGB(nextArg);
|
|
8982
|
-
|
|
9346
|
+
i3++;
|
|
8983
9347
|
}
|
|
8984
9348
|
break;
|
|
8985
9349
|
case "--diff-color-alt":
|
|
8986
9350
|
if (nextArg) {
|
|
8987
9351
|
options.diffColorAlt = parseRGB(nextArg);
|
|
8988
|
-
|
|
9352
|
+
i3++;
|
|
8989
9353
|
}
|
|
8990
9354
|
break;
|
|
8991
9355
|
case "--include-aa":
|
|
@@ -8994,10 +9358,10 @@ async function main() {
|
|
|
8994
9358
|
case "--diff-mask":
|
|
8995
9359
|
options.diffMask = true;
|
|
8996
9360
|
break;
|
|
8997
|
-
case "--
|
|
9361
|
+
case "--codec":
|
|
8998
9362
|
if (nextArg) {
|
|
8999
|
-
options.
|
|
9000
|
-
|
|
9363
|
+
options.codec = nextArg;
|
|
9364
|
+
i3++;
|
|
9001
9365
|
}
|
|
9002
9366
|
break;
|
|
9003
9367
|
default:
|
|
@@ -9006,12 +9370,10 @@ async function main() {
|
|
|
9006
9370
|
process.exit(1);
|
|
9007
9371
|
}
|
|
9008
9372
|
}
|
|
9009
|
-
const
|
|
9010
|
-
options.transformer
|
|
9011
|
-
);
|
|
9373
|
+
const codec = await getCodec(options.codec);
|
|
9012
9374
|
const [img1, img2] = await Promise.all([
|
|
9013
|
-
|
|
9014
|
-
|
|
9375
|
+
codec.read(image1),
|
|
9376
|
+
codec.read(image2)
|
|
9015
9377
|
]);
|
|
9016
9378
|
if (img1.width !== img2.width || img1.height !== img2.height) {
|
|
9017
9379
|
throw new Error(
|
|
@@ -9042,7 +9404,7 @@ async function main() {
|
|
|
9042
9404
|
);
|
|
9043
9405
|
const duration = performance.now() - startTime;
|
|
9044
9406
|
if (diffCount > 0 && options.outputPath && outputData) {
|
|
9045
|
-
await
|
|
9407
|
+
await codec.write(
|
|
9046
9408
|
{
|
|
9047
9409
|
data: outputData,
|
|
9048
9410
|
width: img1.width,
|