create-vision-app
Version:
Create a computer vision endpoint in seconds
1,529 lines (1,517 loc) • 179 kB
JavaScript
#!/usr/bin/env node
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// node_modules/sisteransi/src/index.js
var require_src = __commonJS({
"node_modules/sisteransi/src/index.js"(exports2, module2) {
"use strict";
var ESC = "\x1B";
var CSI = `${ESC}[`;
var beep = "\x07";
var cursor = {
to(x3, y3) {
if (!y3) return `${CSI}${x3 + 1}G`;
return `${CSI}${y3 + 1};${x3 + 1}H`;
},
move(x3, y3) {
let ret = "";
if (x3 < 0) ret += `${CSI}${-x3}D`;
else if (x3 > 0) ret += `${CSI}${x3}C`;
if (y3 < 0) ret += `${CSI}${-y3}A`;
else if (y3 > 0) ret += `${CSI}${y3}B`;
return ret;
},
up: (count = 1) => `${CSI}${count}A`,
down: (count = 1) => `${CSI}${count}B`,
forward: (count = 1) => `${CSI}${count}C`,
backward: (count = 1) => `${CSI}${count}D`,
nextLine: (count = 1) => `${CSI}E`.repeat(count),
prevLine: (count = 1) => `${CSI}F`.repeat(count),
left: `${CSI}G`,
hide: `${CSI}?25l`,
show: `${CSI}?25h`,
save: `${ESC}7`,
restore: `${ESC}8`
};
var scroll = {
up: (count = 1) => `${CSI}S`.repeat(count),
down: (count = 1) => `${CSI}T`.repeat(count)
};
var erase = {
screen: `${CSI}2J`,
up: (count = 1) => `${CSI}1J`.repeat(count),
down: (count = 1) => `${CSI}J`.repeat(count),
line: `${CSI}2K`,
lineEnd: `${CSI}K`,
lineStart: `${CSI}1K`,
lines(count) {
let clear = "";
for (let i = 0; i < count; i++)
clear += this.line + (i < count - 1 ? cursor.up() : "");
if (count)
clear += cursor.left;
return clear;
}
};
module2.exports = { cursor, scroll, erase, beep };
}
});
// node_modules/picocolors/picocolors.js
var require_picocolors = __commonJS({
"node_modules/picocolors/picocolors.js"(exports2, module2) {
var p = process || {};
var argv = p.argv || [];
var env2 = p.env || {};
var isColorSupported = !(!!env2.NO_COLOR || argv.includes("--no-color")) && (!!env2.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
var formatter = (open, close, replace = open) => (input) => {
let string = "" + input, index = string.indexOf(close, open.length);
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
};
var replaceClose = (string, close, replace, index) => {
let result = "", cursor = 0;
do {
result += string.substring(cursor, index) + replace;
cursor = index + close.length;
index = string.indexOf(close, cursor);
} while (~index);
return result + string.substring(cursor);
};
var createColors = (enabled = isColorSupported) => {
let f2 = enabled ? formatter : () => String;
return {
isColorSupported: enabled,
reset: f2("\x1B[0m", "\x1B[0m"),
bold: f2("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
dim: f2("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
italic: f2("\x1B[3m", "\x1B[23m"),
underline: f2("\x1B[4m", "\x1B[24m"),
inverse: f2("\x1B[7m", "\x1B[27m"),
hidden: f2("\x1B[8m", "\x1B[28m"),
strikethrough: f2("\x1B[9m", "\x1B[29m"),
black: f2("\x1B[30m", "\x1B[39m"),
red: f2("\x1B[31m", "\x1B[39m"),
green: f2("\x1B[32m", "\x1B[39m"),
yellow: f2("\x1B[33m", "\x1B[39m"),
blue: f2("\x1B[34m", "\x1B[39m"),
magenta: f2("\x1B[35m", "\x1B[39m"),
cyan: f2("\x1B[36m", "\x1B[39m"),
white: f2("\x1B[37m", "\x1B[39m"),
gray: f2("\x1B[90m", "\x1B[39m"),
bgBlack: f2("\x1B[40m", "\x1B[49m"),
bgRed: f2("\x1B[41m", "\x1B[49m"),
bgGreen: f2("\x1B[42m", "\x1B[49m"),
bgYellow: f2("\x1B[43m", "\x1B[49m"),
bgBlue: f2("\x1B[44m", "\x1B[49m"),
bgMagenta: f2("\x1B[45m", "\x1B[49m"),
bgCyan: f2("\x1B[46m", "\x1B[49m"),
bgWhite: f2("\x1B[47m", "\x1B[49m"),
blackBright: f2("\x1B[90m", "\x1B[39m"),
redBright: f2("\x1B[91m", "\x1B[39m"),
greenBright: f2("\x1B[92m", "\x1B[39m"),
yellowBright: f2("\x1B[93m", "\x1B[39m"),
blueBright: f2("\x1B[94m", "\x1B[39m"),
magentaBright: f2("\x1B[95m", "\x1B[39m"),
cyanBright: f2("\x1B[96m", "\x1B[39m"),
whiteBright: f2("\x1B[97m", "\x1B[39m"),
bgBlackBright: f2("\x1B[100m", "\x1B[49m"),
bgRedBright: f2("\x1B[101m", "\x1B[49m"),
bgGreenBright: f2("\x1B[102m", "\x1B[49m"),
bgYellowBright: f2("\x1B[103m", "\x1B[49m"),
bgBlueBright: f2("\x1B[104m", "\x1B[49m"),
bgMagentaBright: f2("\x1B[105m", "\x1B[49m"),
bgCyanBright: f2("\x1B[106m", "\x1B[49m"),
bgWhiteBright: f2("\x1B[107m", "\x1B[49m")
};
};
module2.exports = createColors();
module2.exports.createColors = createColors;
}
});
// node_modules/color-name/index.js
var require_color_name = __commonJS({
"node_modules/color-name/index.js"(exports2, module2) {
"use strict";
module2.exports = {
"aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255],
"aquamarine": [127, 255, 212],
"azure": [240, 255, 255],
"beige": [245, 245, 220],
"bisque": [255, 228, 196],
"black": [0, 0, 0],
"blanchedalmond": [255, 235, 205],
"blue": [0, 0, 255],
"blueviolet": [138, 43, 226],
"brown": [165, 42, 42],
"burlywood": [222, 184, 135],
"cadetblue": [95, 158, 160],
"chartreuse": [127, 255, 0],
"chocolate": [210, 105, 30],
"coral": [255, 127, 80],
"cornflowerblue": [100, 149, 237],
"cornsilk": [255, 248, 220],
"crimson": [220, 20, 60],
"cyan": [0, 255, 255],
"darkblue": [0, 0, 139],
"darkcyan": [0, 139, 139],
"darkgoldenrod": [184, 134, 11],
"darkgray": [169, 169, 169],
"darkgreen": [0, 100, 0],
"darkgrey": [169, 169, 169],
"darkkhaki": [189, 183, 107],
"darkmagenta": [139, 0, 139],
"darkolivegreen": [85, 107, 47],
"darkorange": [255, 140, 0],
"darkorchid": [153, 50, 204],
"darkred": [139, 0, 0],
"darksalmon": [233, 150, 122],
"darkseagreen": [143, 188, 143],
"darkslateblue": [72, 61, 139],
"darkslategray": [47, 79, 79],
"darkslategrey": [47, 79, 79],
"darkturquoise": [0, 206, 209],
"darkviolet": [148, 0, 211],
"deeppink": [255, 20, 147],
"deepskyblue": [0, 191, 255],
"dimgray": [105, 105, 105],
"dimgrey": [105, 105, 105],
"dodgerblue": [30, 144, 255],
"firebrick": [178, 34, 34],
"floralwhite": [255, 250, 240],
"forestgreen": [34, 139, 34],
"fuchsia": [255, 0, 255],
"gainsboro": [220, 220, 220],
"ghostwhite": [248, 248, 255],
"gold": [255, 215, 0],
"goldenrod": [218, 165, 32],
"gray": [128, 128, 128],
"green": [0, 128, 0],
"greenyellow": [173, 255, 47],
"grey": [128, 128, 128],
"honeydew": [240, 255, 240],
"hotpink": [255, 105, 180],
"indianred": [205, 92, 92],
"indigo": [75, 0, 130],
"ivory": [255, 255, 240],
"khaki": [240, 230, 140],
"lavender": [230, 230, 250],
"lavenderblush": [255, 240, 245],
"lawngreen": [124, 252, 0],
"lemonchiffon": [255, 250, 205],
"lightblue": [173, 216, 230],
"lightcoral": [240, 128, 128],
"lightcyan": [224, 255, 255],
"lightgoldenrodyellow": [250, 250, 210],
"lightgray": [211, 211, 211],
"lightgreen": [144, 238, 144],
"lightgrey": [211, 211, 211],
"lightpink": [255, 182, 193],
"lightsalmon": [255, 160, 122],
"lightseagreen": [32, 178, 170],
"lightskyblue": [135, 206, 250],
"lightslategray": [119, 136, 153],
"lightslategrey": [119, 136, 153],
"lightsteelblue": [176, 196, 222],
"lightyellow": [255, 255, 224],
"lime": [0, 255, 0],
"limegreen": [50, 205, 50],
"linen": [250, 240, 230],
"magenta": [255, 0, 255],
"maroon": [128, 0, 0],
"mediumaquamarine": [102, 205, 170],
"mediumblue": [0, 0, 205],
"mediumorchid": [186, 85, 211],
"mediumpurple": [147, 112, 219],
"mediumseagreen": [60, 179, 113],
"mediumslateblue": [123, 104, 238],
"mediumspringgreen": [0, 250, 154],
"mediumturquoise": [72, 209, 204],
"mediumvioletred": [199, 21, 133],
"midnightblue": [25, 25, 112],
"mintcream": [245, 255, 250],
"mistyrose": [255, 228, 225],
"moccasin": [255, 228, 181],
"navajowhite": [255, 222, 173],
"navy": [0, 0, 128],
"oldlace": [253, 245, 230],
"olive": [128, 128, 0],
"olivedrab": [107, 142, 35],
"orange": [255, 165, 0],
"orangered": [255, 69, 0],
"orchid": [218, 112, 214],
"palegoldenrod": [238, 232, 170],
"palegreen": [152, 251, 152],
"paleturquoise": [175, 238, 238],
"palevioletred": [219, 112, 147],
"papayawhip": [255, 239, 213],
"peachpuff": [255, 218, 185],
"peru": [205, 133, 63],
"pink": [255, 192, 203],
"plum": [221, 160, 221],
"powderblue": [176, 224, 230],
"purple": [128, 0, 128],
"rebeccapurple": [102, 51, 153],
"red": [255, 0, 0],
"rosybrown": [188, 143, 143],
"royalblue": [65, 105, 225],
"saddlebrown": [139, 69, 19],
"salmon": [250, 128, 114],
"sandybrown": [244, 164, 96],
"seagreen": [46, 139, 87],
"seashell": [255, 245, 238],
"sienna": [160, 82, 45],
"silver": [192, 192, 192],
"skyblue": [135, 206, 235],
"slateblue": [106, 90, 205],
"slategray": [112, 128, 144],
"slategrey": [112, 128, 144],
"snow": [255, 250, 250],
"springgreen": [0, 255, 127],
"steelblue": [70, 130, 180],
"tan": [210, 180, 140],
"teal": [0, 128, 128],
"thistle": [216, 191, 216],
"tomato": [255, 99, 71],
"turquoise": [64, 224, 208],
"violet": [238, 130, 238],
"wheat": [245, 222, 179],
"white": [255, 255, 255],
"whitesmoke": [245, 245, 245],
"yellow": [255, 255, 0],
"yellowgreen": [154, 205, 50]
};
}
});
// node_modules/color-convert/conversions.js
var require_conversions = __commonJS({
"node_modules/color-convert/conversions.js"(exports2, module2) {
var cssKeywords = require_color_name();
var reverseKeywords = {};
for (const key of Object.keys(cssKeywords)) {
reverseKeywords[cssKeywords[key]] = key;
}
var convert = {
rgb: { channels: 3, labels: "rgb" },
hsl: { channels: 3, labels: "hsl" },
hsv: { channels: 3, labels: "hsv" },
hwb: { channels: 3, labels: "hwb" },
cmyk: { channels: 4, labels: "cmyk" },
xyz: { channels: 3, labels: "xyz" },
lab: { channels: 3, labels: "lab" },
lch: { channels: 3, labels: "lch" },
hex: { channels: 1, labels: ["hex"] },
keyword: { channels: 1, labels: ["keyword"] },
ansi16: { channels: 1, labels: ["ansi16"] },
ansi256: { channels: 1, labels: ["ansi256"] },
hcg: { channels: 3, labels: ["h", "c", "g"] },
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
gray: { channels: 1, labels: ["gray"] }
};
module2.exports = convert;
for (const model of Object.keys(convert)) {
if (!("channels" in convert[model])) {
throw new Error("missing channels property: " + model);
}
if (!("labels" in convert[model])) {
throw new Error("missing channel labels property: " + model);
}
if (convert[model].labels.length !== convert[model].channels) {
throw new Error("channel and label counts mismatch: " + model);
}
const { channels, labels } = convert[model];
delete convert[model].channels;
delete convert[model].labels;
Object.defineProperty(convert[model], "channels", { value: channels });
Object.defineProperty(convert[model], "labels", { value: labels });
}
convert.rgb.hsl = function(rgb) {
const r2 = rgb[0] / 255;
const g2 = rgb[1] / 255;
const b3 = rgb[2] / 255;
const min = Math.min(r2, g2, b3);
const max = Math.max(r2, g2, b3);
const delta = max - min;
let h2;
let s;
if (max === min) {
h2 = 0;
} else if (r2 === max) {
h2 = (g2 - b3) / delta;
} else if (g2 === max) {
h2 = 2 + (b3 - r2) / delta;
} else if (b3 === max) {
h2 = 4 + (r2 - g2) / delta;
}
h2 = Math.min(h2 * 60, 360);
if (h2 < 0) {
h2 += 360;
}
const l2 = (min + max) / 2;
if (max === min) {
s = 0;
} else if (l2 <= 0.5) {
s = delta / (max + min);
} else {
s = delta / (2 - max - min);
}
return [h2, s * 100, l2 * 100];
};
convert.rgb.hsv = function(rgb) {
let rdif;
let gdif;
let bdif;
let h2;
let s;
const r2 = rgb[0] / 255;
const g2 = rgb[1] / 255;
const b3 = rgb[2] / 255;
const v2 = Math.max(r2, g2, b3);
const diff = v2 - Math.min(r2, g2, b3);
const diffc = function(c2) {
return (v2 - c2) / 6 / diff + 1 / 2;
};
if (diff === 0) {
h2 = 0;
s = 0;
} else {
s = diff / v2;
rdif = diffc(r2);
gdif = diffc(g2);
bdif = diffc(b3);
if (r2 === v2) {
h2 = bdif - gdif;
} else if (g2 === v2) {
h2 = 1 / 3 + rdif - bdif;
} else if (b3 === v2) {
h2 = 2 / 3 + gdif - rdif;
}
if (h2 < 0) {
h2 += 1;
} else if (h2 > 1) {
h2 -= 1;
}
}
return [
h2 * 360,
s * 100,
v2 * 100
];
};
convert.rgb.hwb = function(rgb) {
const r2 = rgb[0];
const g2 = rgb[1];
let b3 = rgb[2];
const h2 = convert.rgb.hsl(rgb)[0];
const w3 = 1 / 255 * Math.min(r2, Math.min(g2, b3));
b3 = 1 - 1 / 255 * Math.max(r2, Math.max(g2, b3));
return [h2, w3 * 100, b3 * 100];
};
convert.rgb.cmyk = function(rgb) {
const r2 = rgb[0] / 255;
const g2 = rgb[1] / 255;
const b3 = rgb[2] / 255;
const k2 = Math.min(1 - r2, 1 - g2, 1 - b3);
const c2 = (1 - r2 - k2) / (1 - k2) || 0;
const m2 = (1 - g2 - k2) / (1 - k2) || 0;
const y3 = (1 - b3 - k2) / (1 - k2) || 0;
return [c2 * 100, m2 * 100, y3 * 100, k2 * 100];
};
function comparativeDistance(x3, y3) {
return (x3[0] - y3[0]) ** 2 + (x3[1] - y3[1]) ** 2 + (x3[2] - y3[2]) ** 2;
}
convert.rgb.keyword = function(rgb) {
const reversed = reverseKeywords[rgb];
if (reversed) {
return reversed;
}
let currentClosestDistance = Infinity;
let currentClosestKeyword;
for (const keyword of Object.keys(cssKeywords)) {
const value = cssKeywords[keyword];
const distance = comparativeDistance(rgb, value);
if (distance < currentClosestDistance) {
currentClosestDistance = distance;
currentClosestKeyword = keyword;
}
}
return currentClosestKeyword;
};
convert.keyword.rgb = function(keyword) {
return cssKeywords[keyword];
};
convert.rgb.xyz = function(rgb) {
let r2 = rgb[0] / 255;
let g2 = rgb[1] / 255;
let b3 = rgb[2] / 255;
r2 = r2 > 0.04045 ? ((r2 + 0.055) / 1.055) ** 2.4 : r2 / 12.92;
g2 = g2 > 0.04045 ? ((g2 + 0.055) / 1.055) ** 2.4 : g2 / 12.92;
b3 = b3 > 0.04045 ? ((b3 + 0.055) / 1.055) ** 2.4 : b3 / 12.92;
const x3 = r2 * 0.4124 + g2 * 0.3576 + b3 * 0.1805;
const y3 = r2 * 0.2126 + g2 * 0.7152 + b3 * 0.0722;
const z3 = r2 * 0.0193 + g2 * 0.1192 + b3 * 0.9505;
return [x3 * 100, y3 * 100, z3 * 100];
};
convert.rgb.lab = function(rgb) {
const xyz = convert.rgb.xyz(rgb);
let x3 = xyz[0];
let y3 = xyz[1];
let z3 = xyz[2];
x3 /= 95.047;
y3 /= 100;
z3 /= 108.883;
x3 = x3 > 8856e-6 ? x3 ** (1 / 3) : 7.787 * x3 + 16 / 116;
y3 = y3 > 8856e-6 ? y3 ** (1 / 3) : 7.787 * y3 + 16 / 116;
z3 = z3 > 8856e-6 ? z3 ** (1 / 3) : 7.787 * z3 + 16 / 116;
const l2 = 116 * y3 - 16;
const a3 = 500 * (x3 - y3);
const b3 = 200 * (y3 - z3);
return [l2, a3, b3];
};
convert.hsl.rgb = function(hsl) {
const h2 = hsl[0] / 360;
const s = hsl[1] / 100;
const l2 = hsl[2] / 100;
let t2;
let t3;
let val;
if (s === 0) {
val = l2 * 255;
return [val, val, val];
}
if (l2 < 0.5) {
t2 = l2 * (1 + s);
} else {
t2 = l2 + s - l2 * s;
}
const t1 = 2 * l2 - t2;
const rgb = [0, 0, 0];
for (let i = 0; i < 3; i++) {
t3 = h2 + 1 / 3 * -(i - 1);
if (t3 < 0) {
t3++;
}
if (t3 > 1) {
t3--;
}
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
} else if (2 * t3 < 1) {
val = t2;
} else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
} else {
val = t1;
}
rgb[i] = val * 255;
}
return rgb;
};
convert.hsl.hsv = function(hsl) {
const h2 = hsl[0];
let s = hsl[1] / 100;
let l2 = hsl[2] / 100;
let smin = s;
const lmin = Math.max(l2, 0.01);
l2 *= 2;
s *= l2 <= 1 ? l2 : 2 - l2;
smin *= lmin <= 1 ? lmin : 2 - lmin;
const v2 = (l2 + s) / 2;
const sv = l2 === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l2 + s);
return [h2, sv * 100, v2 * 100];
};
convert.hsv.rgb = function(hsv) {
const h2 = hsv[0] / 60;
const s = hsv[1] / 100;
let v2 = hsv[2] / 100;
const hi = Math.floor(h2) % 6;
const f2 = h2 - Math.floor(h2);
const p = 255 * v2 * (1 - s);
const q3 = 255 * v2 * (1 - s * f2);
const t = 255 * v2 * (1 - s * (1 - f2));
v2 *= 255;
switch (hi) {
case 0:
return [v2, t, p];
case 1:
return [q3, v2, p];
case 2:
return [p, v2, t];
case 3:
return [p, q3, v2];
case 4:
return [t, p, v2];
case 5:
return [v2, p, q3];
}
};
convert.hsv.hsl = function(hsv) {
const h2 = hsv[0];
const s = hsv[1] / 100;
const v2 = hsv[2] / 100;
const vmin = Math.max(v2, 0.01);
let sl;
let l2;
l2 = (2 - s) * v2;
const lmin = (2 - s) * vmin;
sl = s * vmin;
sl /= lmin <= 1 ? lmin : 2 - lmin;
sl = sl || 0;
l2 /= 2;
return [h2, sl * 100, l2 * 100];
};
convert.hwb.rgb = function(hwb) {
const h2 = hwb[0] / 360;
let wh = hwb[1] / 100;
let bl = hwb[2] / 100;
const ratio = wh + bl;
let f2;
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
const i = Math.floor(6 * h2);
const v2 = 1 - bl;
f2 = 6 * h2 - i;
if ((i & 1) !== 0) {
f2 = 1 - f2;
}
const n = wh + f2 * (v2 - wh);
let r2;
let g2;
let b3;
switch (i) {
default:
case 6:
case 0:
r2 = v2;
g2 = n;
b3 = wh;
break;
case 1:
r2 = n;
g2 = v2;
b3 = wh;
break;
case 2:
r2 = wh;
g2 = v2;
b3 = n;
break;
case 3:
r2 = wh;
g2 = n;
b3 = v2;
break;
case 4:
r2 = n;
g2 = wh;
b3 = v2;
break;
case 5:
r2 = v2;
g2 = wh;
b3 = n;
break;
}
return [r2 * 255, g2 * 255, b3 * 255];
};
convert.cmyk.rgb = function(cmyk) {
const c2 = cmyk[0] / 100;
const m2 = cmyk[1] / 100;
const y3 = cmyk[2] / 100;
const k2 = cmyk[3] / 100;
const r2 = 1 - Math.min(1, c2 * (1 - k2) + k2);
const g2 = 1 - Math.min(1, m2 * (1 - k2) + k2);
const b3 = 1 - Math.min(1, y3 * (1 - k2) + k2);
return [r2 * 255, g2 * 255, b3 * 255];
};
convert.xyz.rgb = function(xyz) {
const x3 = xyz[0] / 100;
const y3 = xyz[1] / 100;
const z3 = xyz[2] / 100;
let r2;
let g2;
let b3;
r2 = x3 * 3.2406 + y3 * -1.5372 + z3 * -0.4986;
g2 = x3 * -0.9689 + y3 * 1.8758 + z3 * 0.0415;
b3 = x3 * 0.0557 + y3 * -0.204 + z3 * 1.057;
r2 = r2 > 31308e-7 ? 1.055 * r2 ** (1 / 2.4) - 0.055 : r2 * 12.92;
g2 = g2 > 31308e-7 ? 1.055 * g2 ** (1 / 2.4) - 0.055 : g2 * 12.92;
b3 = b3 > 31308e-7 ? 1.055 * b3 ** (1 / 2.4) - 0.055 : b3 * 12.92;
r2 = Math.min(Math.max(0, r2), 1);
g2 = Math.min(Math.max(0, g2), 1);
b3 = Math.min(Math.max(0, b3), 1);
return [r2 * 255, g2 * 255, b3 * 255];
};
convert.xyz.lab = function(xyz) {
let x3 = xyz[0];
let y3 = xyz[1];
let z3 = xyz[2];
x3 /= 95.047;
y3 /= 100;
z3 /= 108.883;
x3 = x3 > 8856e-6 ? x3 ** (1 / 3) : 7.787 * x3 + 16 / 116;
y3 = y3 > 8856e-6 ? y3 ** (1 / 3) : 7.787 * y3 + 16 / 116;
z3 = z3 > 8856e-6 ? z3 ** (1 / 3) : 7.787 * z3 + 16 / 116;
const l2 = 116 * y3 - 16;
const a3 = 500 * (x3 - y3);
const b3 = 200 * (y3 - z3);
return [l2, a3, b3];
};
convert.lab.xyz = function(lab) {
const l2 = lab[0];
const a3 = lab[1];
const b3 = lab[2];
let x3;
let y3;
let z3;
y3 = (l2 + 16) / 116;
x3 = a3 / 500 + y3;
z3 = y3 - b3 / 200;
const y22 = y3 ** 3;
const x22 = x3 ** 3;
const z22 = z3 ** 3;
y3 = y22 > 8856e-6 ? y22 : (y3 - 16 / 116) / 7.787;
x3 = x22 > 8856e-6 ? x22 : (x3 - 16 / 116) / 7.787;
z3 = z22 > 8856e-6 ? z22 : (z3 - 16 / 116) / 7.787;
x3 *= 95.047;
y3 *= 100;
z3 *= 108.883;
return [x3, y3, z3];
};
convert.lab.lch = function(lab) {
const l2 = lab[0];
const a3 = lab[1];
const b3 = lab[2];
let h2;
const hr = Math.atan2(b3, a3);
h2 = hr * 360 / 2 / Math.PI;
if (h2 < 0) {
h2 += 360;
}
const c2 = Math.sqrt(a3 * a3 + b3 * b3);
return [l2, c2, h2];
};
convert.lch.lab = function(lch) {
const l2 = lch[0];
const c2 = lch[1];
const h2 = lch[2];
const hr = h2 / 360 * 2 * Math.PI;
const a3 = c2 * Math.cos(hr);
const b3 = c2 * Math.sin(hr);
return [l2, a3, b3];
};
convert.rgb.ansi16 = function(args, saturation = null) {
const [r2, g2, b3] = args;
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
value = Math.round(value / 50);
if (value === 0) {
return 30;
}
let ansi = 30 + (Math.round(b3 / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r2 / 255));
if (value === 2) {
ansi += 60;
}
return ansi;
};
convert.hsv.ansi16 = function(args) {
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
};
convert.rgb.ansi256 = function(args) {
const r2 = args[0];
const g2 = args[1];
const b3 = args[2];
if (r2 === g2 && g2 === b3) {
if (r2 < 8) {
return 16;
}
if (r2 > 248) {
return 231;
}
return Math.round((r2 - 8) / 247 * 24) + 232;
}
const ansi = 16 + 36 * Math.round(r2 / 255 * 5) + 6 * Math.round(g2 / 255 * 5) + Math.round(b3 / 255 * 5);
return ansi;
};
convert.ansi16.rgb = function(args) {
let color = args % 10;
if (color === 0 || color === 7) {
if (args > 50) {
color += 3.5;
}
color = color / 10.5 * 255;
return [color, color, color];
}
const mult = (~~(args > 50) + 1) * 0.5;
const r2 = (color & 1) * mult * 255;
const g2 = (color >> 1 & 1) * mult * 255;
const b3 = (color >> 2 & 1) * mult * 255;
return [r2, g2, b3];
};
convert.ansi256.rgb = function(args) {
if (args >= 232) {
const c2 = (args - 232) * 10 + 8;
return [c2, c2, c2];
}
args -= 16;
let rem;
const r2 = Math.floor(args / 36) / 5 * 255;
const g2 = Math.floor((rem = args % 36) / 6) / 5 * 255;
const b3 = rem % 6 / 5 * 255;
return [r2, g2, b3];
};
convert.rgb.hex = function(args) {
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
const string = integer.toString(16).toUpperCase();
return "000000".substring(string.length) + string;
};
convert.hex.rgb = function(args) {
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) {
return [0, 0, 0];
}
let colorString = match[0];
if (match[0].length === 3) {
colorString = colorString.split("").map((char) => {
return char + char;
}).join("");
}
const integer = parseInt(colorString, 16);
const r2 = integer >> 16 & 255;
const g2 = integer >> 8 & 255;
const b3 = integer & 255;
return [r2, g2, b3];
};
convert.rgb.hcg = function(rgb) {
const r2 = rgb[0] / 255;
const g2 = rgb[1] / 255;
const b3 = rgb[2] / 255;
const max = Math.max(Math.max(r2, g2), b3);
const min = Math.min(Math.min(r2, g2), b3);
const chroma = max - min;
let grayscale;
let hue;
if (chroma < 1) {
grayscale = min / (1 - chroma);
} else {
grayscale = 0;
}
if (chroma <= 0) {
hue = 0;
} else if (max === r2) {
hue = (g2 - b3) / chroma % 6;
} else if (max === g2) {
hue = 2 + (b3 - r2) / chroma;
} else {
hue = 4 + (r2 - g2) / chroma;
}
hue /= 6;
hue %= 1;
return [hue * 360, chroma * 100, grayscale * 100];
};
convert.hsl.hcg = function(hsl) {
const s = hsl[1] / 100;
const l2 = hsl[2] / 100;
const c2 = l2 < 0.5 ? 2 * s * l2 : 2 * s * (1 - l2);
let f2 = 0;
if (c2 < 1) {
f2 = (l2 - 0.5 * c2) / (1 - c2);
}
return [hsl[0], c2 * 100, f2 * 100];
};
convert.hsv.hcg = function(hsv) {
const s = hsv[1] / 100;
const v2 = hsv[2] / 100;
const c2 = s * v2;
let f2 = 0;
if (c2 < 1) {
f2 = (v2 - c2) / (1 - c2);
}
return [hsv[0], c2 * 100, f2 * 100];
};
convert.hcg.rgb = function(hcg) {
const h2 = hcg[0] / 360;
const c2 = hcg[1] / 100;
const g2 = hcg[2] / 100;
if (c2 === 0) {
return [g2 * 255, g2 * 255, g2 * 255];
}
const pure = [0, 0, 0];
const hi = h2 % 1 * 6;
const v2 = hi % 1;
const w3 = 1 - v2;
let mg = 0;
switch (Math.floor(hi)) {
case 0:
pure[0] = 1;
pure[1] = v2;
pure[2] = 0;
break;
case 1:
pure[0] = w3;
pure[1] = 1;
pure[2] = 0;
break;
case 2:
pure[0] = 0;
pure[1] = 1;
pure[2] = v2;
break;
case 3:
pure[0] = 0;
pure[1] = w3;
pure[2] = 1;
break;
case 4:
pure[0] = v2;
pure[1] = 0;
pure[2] = 1;
break;
default:
pure[0] = 1;
pure[1] = 0;
pure[2] = w3;
}
mg = (1 - c2) * g2;
return [
(c2 * pure[0] + mg) * 255,
(c2 * pure[1] + mg) * 255,
(c2 * pure[2] + mg) * 255
];
};
convert.hcg.hsv = function(hcg) {
const c2 = hcg[1] / 100;
const g2 = hcg[2] / 100;
const v2 = c2 + g2 * (1 - c2);
let f2 = 0;
if (v2 > 0) {
f2 = c2 / v2;
}
return [hcg[0], f2 * 100, v2 * 100];
};
convert.hcg.hsl = function(hcg) {
const c2 = hcg[1] / 100;
const g2 = hcg[2] / 100;
const l2 = g2 * (1 - c2) + 0.5 * c2;
let s = 0;
if (l2 > 0 && l2 < 0.5) {
s = c2 / (2 * l2);
} else if (l2 >= 0.5 && l2 < 1) {
s = c2 / (2 * (1 - l2));
}
return [hcg[0], s * 100, l2 * 100];
};
convert.hcg.hwb = function(hcg) {
const c2 = hcg[1] / 100;
const g2 = hcg[2] / 100;
const v2 = c2 + g2 * (1 - c2);
return [hcg[0], (v2 - c2) * 100, (1 - v2) * 100];
};
convert.hwb.hcg = function(hwb) {
const w3 = hwb[1] / 100;
const b3 = hwb[2] / 100;
const v2 = 1 - b3;
const c2 = v2 - w3;
let g2 = 0;
if (c2 < 1) {
g2 = (v2 - c2) / (1 - c2);
}
return [hwb[0], c2 * 100, g2 * 100];
};
convert.apple.rgb = function(apple) {
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
};
convert.rgb.apple = function(rgb) {
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
};
convert.gray.rgb = function(args) {
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
};
convert.gray.hsl = function(args) {
return [0, 0, args[0]];
};
convert.gray.hsv = convert.gray.hsl;
convert.gray.hwb = function(gray) {
return [0, 100, gray[0]];
};
convert.gray.cmyk = function(gray) {
return [0, 0, 0, gray[0]];
};
convert.gray.lab = function(gray) {
return [gray[0], 0, 0];
};
convert.gray.hex = function(gray) {
const val = Math.round(gray[0] / 100 * 255) & 255;
const integer = (val << 16) + (val << 8) + val;
const string = integer.toString(16).toUpperCase();
return "000000".substring(string.length) + string;
};
convert.rgb.gray = function(rgb) {
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
return [val / 255 * 100];
};
}
});
// node_modules/color-convert/route.js
var require_route = __commonJS({
"node_modules/color-convert/route.js"(exports2, module2) {
var conversions = require_conversions();
function buildGraph() {
const graph = {};
const models = Object.keys(conversions);
for (let len = models.length, i = 0; i < len; i++) {
graph[models[i]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
distance: -1,
parent: null
};
}
return graph;
}
function deriveBFS(fromModel) {
const graph = buildGraph();
const queue = [fromModel];
graph[fromModel].distance = 0;
while (queue.length) {
const current = queue.pop();
const adjacents = Object.keys(conversions[current]);
for (let len = adjacents.length, i = 0; i < len; i++) {
const adjacent = adjacents[i];
const node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
node.parent = current;
queue.unshift(adjacent);
}
}
}
return graph;
}
function link(from, to) {
return function(args) {
return to(from(args));
};
}
function wrapConversion(toModel, graph) {
const path = [graph[toModel].parent, toModel];
let fn = conversions[graph[toModel].parent][toModel];
let cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn = link(conversions[graph[cur].parent][cur], fn);
cur = graph[cur].parent;
}
fn.conversion = path;
return fn;
}
module2.exports = function(fromModel) {
const graph = deriveBFS(fromModel);
const conversion = {};
const models = Object.keys(graph);
for (let len = models.length, i = 0; i < len; i++) {
const toModel = models[i];
const node = graph[toModel];
if (node.parent === null) {
continue;
}
conversion[toModel] = wrapConversion(toModel, graph);
}
return conversion;
};
}
});
// node_modules/color-convert/index.js
var require_color_convert = __commonJS({
"node_modules/color-convert/index.js"(exports2, module2) {
var conversions = require_conversions();
var route = require_route();
var convert = {};
var models = Object.keys(conversions);
function wrapRaw(fn) {
const wrappedFn = function(...args) {
const arg0 = args[0];
if (arg0 === void 0 || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
return fn(args);
};
if ("conversion" in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
function wrapRounded(fn) {
const wrappedFn = function(...args) {
const arg0 = args[0];
if (arg0 === void 0 || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
const result = fn(args);
if (typeof result === "object") {
for (let len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
};
if ("conversion" in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
models.forEach((fromModel) => {
convert[fromModel] = {};
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
const routes = route(fromModel);
const routeModels = Object.keys(routes);
routeModels.forEach((toModel) => {
const fn = routes[toModel];
convert[fromModel][toModel] = wrapRounded(fn);
convert[fromModel][toModel].raw = wrapRaw(fn);
});
});
module2.exports = convert;
}
});
// node_modules/ansi-styles/index.js
var require_ansi_styles = __commonJS({
"node_modules/ansi-styles/index.js"(exports2, module2) {
"use strict";
var wrapAnsi162 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\x1B[${code + offset}m`;
};
var wrapAnsi2562 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\x1B[${38 + offset};5;${code}m`;
};
var wrapAnsi16m2 = (fn, offset) => (...args) => {
const rgb = fn(...args);
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
var ansi2ansi = (n) => n;
var rgb2rgb = (r2, g2, b3) => [r2, g2, b3];
var setLazyProperty = (object, property, get) => {
Object.defineProperty(object, property, {
get: () => {
const value = get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
};
var colorConvert;
var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
if (colorConvert === void 0) {
colorConvert = require_color_convert();
}
const offset = isBackground ? 10 : 0;
const styles3 = {};
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
if (sourceSpace === targetSpace) {
styles3[name] = wrap(identity, offset);
} else if (typeof suite === "object") {
styles3[name] = wrap(suite[targetSpace], offset);
}
}
return styles3;
};
function assembleStyles2() {
const codes = /* @__PURE__ */ new Map();
const styles3 = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
styles3.color.gray = styles3.color.blackBright;
styles3.bgColor.bgGray = styles3.bgColor.bgBlackBright;
styles3.color.grey = styles3.color.blackBright;
styles3.bgColor.bgGrey = styles3.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles3)) {
for (const [styleName, style] of Object.entries(group)) {
styles3[styleName] = {
open: `\x1B[${style[0]}m`,
close: `\x1B[${style[1]}m`
};
group[styleName] = styles3[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles3, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles3, "codes", {
value: codes,
enumerable: false
});
styles3.color.close = "\x1B[39m";
styles3.bgColor.close = "\x1B[49m";
setLazyProperty(styles3.color, "ansi", () => makeDynamicStyles(wrapAnsi162, "ansi16", ansi2ansi, false));
setLazyProperty(styles3.color, "ansi256", () => makeDynamicStyles(wrapAnsi2562, "ansi256", ansi2ansi, false));
setLazyProperty(styles3.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m2, "rgb", rgb2rgb, false));
setLazyProperty(styles3.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi162, "ansi16", ansi2ansi, true));
setLazyProperty(styles3.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi2562, "ansi256", ansi2ansi, true));
setLazyProperty(styles3.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m2, "rgb", rgb2rgb, true));
return styles3;
}
Object.defineProperty(module2, "exports", {
enumerable: true,
get: assembleStyles2
});
}
});
// node_modules/has-flag/index.js
var require_has_flag = __commonJS({
"node_modules/has-flag/index.js"(exports2, module2) {
"use strict";
module2.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf("--");
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};
}
});
// node_modules/supports-color/index.js
var require_supports_color = __commonJS({
"node_modules/supports-color/index.js"(exports2, module2) {
"use strict";
var os2 = require("os");
var tty2 = require("tty");
var hasFlag2 = require_has_flag();
var { env: env2 } = process;
var forceColor;
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
forceColor = 0;
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
forceColor = 1;
}
if ("FORCE_COLOR" in env2) {
if (env2.FORCE_COLOR === "true") {
forceColor = 1;
} else if (env2.FORCE_COLOR === "false") {
forceColor = 0;
} else {
forceColor = env2.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env2.FORCE_COLOR, 10), 3);
}
}
function translateLevel2(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function supportsColor2(haveStream, streamIsTTY) {
if (forceColor === 0) {
return 0;
}
if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
return 3;
}
if (hasFlag2("color=256")) {
return 2;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env2.TERM === "dumb") {
return min;
}
if (process.platform === "win32") {
const osRelease = os2.release().split(".");
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ("CI" in env2) {
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
return 1;
}
return min;
}
if ("TEAMCITY_VERSION" in env2) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
}
if (env2.COLORTERM === "truecolor") {
return 3;
}
if ("TERM_PROGRAM" in env2) {
const version = parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (env2.TERM_PROGRAM) {
case "iTerm.app":
return version >= 3 ? 3 : 2;
case "Apple_Terminal":
return 2;
}
}
if (/-256(color)?$/i.test(env2.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
return 1;
}
if ("COLORTERM" in env2) {
return 1;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor2(stream, stream && stream.isTTY);
return translateLevel2(level);
}
module2.exports = {
supportsColor: getSupportLevel,
stdout: translateLevel2(supportsColor2(true, tty2.isatty(1))),
stderr: translateLevel2(supportsColor2(true, tty2.isatty(2)))
};
}
});
// node_modules/gradient-string/node_modules/chalk/source/util.js
var require_util = __commonJS({
"node_modules/gradient-string/node_modules/chalk/source/util.js"(exports2, module2) {
"use strict";
var stringReplaceAll2 = (string, substring, replacer) => {
let index = string.indexOf(substring);
if (index === -1) {
return string;
}
const substringLength = substring.length;
let endIndex = 0;
let returnValue = "";
do {
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
endIndex = index + substringLength;
index = string.indexOf(substring, endIndex);
} while (index !== -1);
returnValue += string.substr(endIndex);
return returnValue;
};
var stringEncaseCRLFWithFirstIndex2 = (string, prefix, postfix, index) => {
let endIndex = 0;
let returnValue = "";
do {
const gotCR = string[index - 1] === "\r";
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
endIndex = index + 1;
index = string.indexOf("\n", endIndex);
} while (index !== -1);
returnValue += string.substr(endIndex);
return returnValue;
};
module2.exports = {
stringReplaceAll: stringReplaceAll2,
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex2
};
}
});
// node_modules/gradient-string/node_modules/chalk/source/templates.js
var require_templates = __commonJS({
"node_modules/gradient-string/node_modules/chalk/source/templates.js"(exports2, module2) {
"use strict";
var TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
var ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
var ESCAPES = /* @__PURE__ */ new Map([
["n", "\n"],
["r", "\r"],
["t", " "],
["b", "\b"],
["f", "\f"],
["v", "\v"],
["0", "\0"],
["\\", "\\"],
["e", "\x1B"],
["a", "\x07"]
]);
function unescape(c2) {
const u = c2[0] === "u";
const bracket = c2[1] === "{";
if (u && !bracket && c2.length === 5 || c2[0] === "x" && c2.length === 3) {
return String.fromCharCode(parseInt(c2.slice(1), 16));
}
if (u && bracket) {
return String.fromCodePoint(parseInt(c2.slice(2, -1), 16));
}
return ESCAPES.get(c2) || c2;
}
function parseArguments(name, arguments_) {
const results = [];
const chunks = arguments_.trim().split(/\s*,\s*/g);
let matches;
for (const chunk of chunks) {
const number = Number(chunk);
if (!Number.isNaN(number)) {
results.push(number);
} else if (matches = chunk.match(STRING_REGEX)) {
results.push(matches[2].replace(ESCAPE_REGEX, (m2, escape, character) => escape ? unescape(escape) : character));
} else {
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
}
}
return results;
}
function parseStyle(style) {
STYLE_REGEX.lastIndex = 0;
const results = [];
let matches;
while ((matches = STYLE_REGEX.exec(style)) !== null) {
const name = matches[1];
if (matches[2]) {
const args = parseArguments(name, matches[2]);
results.push([name].concat(args));
} else {
results.push([name]);
}
}
return results;
}
function buildStyle(chalk2, styles3) {
const enabled = {};
for (const layer of styles3) {
for (const style of layer.styles) {
enabled[style[0]] = layer.inverse ? null : style.slice(1);
}
}
let current = chalk2;
for (const [styleName, styles4] of Object.entries(enabled)) {
if (!Array.isArray(styles4)) {
continue;
}
if (!(styleName in current)) {
throw new Error(`Unknown Chalk style: ${styleName}`);
}
current = styles4.length > 0 ? current[styleName](...styles4) : current[styleName];
}
return current;
}
module2.exports = (chalk2, temporary) => {
const styles3 = [];
const chunks = [];
let chunk = [];
temporary.replace(TEMPLATE_REGEX, (m2, escapeCharacter, inverse, style, close, character) => {
if (escapeCharacter) {
chunk.push(unescape(escapeCharacter));
} else if (style) {
const string = chunk.join("");
chunk = [];
chunks.push(styles3.length === 0 ? string : buildStyle(chalk2, styles3)(string));
styles3.push({ inverse, styles: parseStyle(style) });
} else if (close) {
if (styles3.length === 0) {
throw new Error("Found extraneous } in Chalk template literal");
}
chunks.push(buildStyle(chalk2, styles3)(chunk.join("")));
chunk = [];
styles3.pop();
} else {
chunk.push(character);
}
});
chunks.push(chunk.join(""));
if (styles3.length > 0) {
const errMessage = `Chalk template literal is missing ${styles3.length} closing bracket${styles3.length === 1 ? "" : "s"} (\`}\`)`;
throw new Error(errMessage);
}
return chunks.join("");
};
}
});
// node_modules/gradient-string/node_modules/chalk/source/index.js
var require_source = __commonJS({
"node_modules/gradient-string/node_modules/chalk/source/index.js"(exports2, module2) {
"use strict";
var ansiStyles2 = req