@tscircuit/cli 0.1.2261 → 0.1.2262

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.
@@ -887,6 +887,336 @@ var require_svgson_cjs = __commonJS(function(exports) {
887
887
  exports.stringify = stringify;
888
888
  });
889
889
 
890
+ // node_modules/color-name/index.js
891
+ var colors, color_name_default;
892
+ var init_color_name = __esm(() => {
893
+ colors = {
894
+ aliceblue: [240, 248, 255],
895
+ antiquewhite: [250, 235, 215],
896
+ aqua: [0, 255, 255],
897
+ aquamarine: [127, 255, 212],
898
+ azure: [240, 255, 255],
899
+ beige: [245, 245, 220],
900
+ bisque: [255, 228, 196],
901
+ black: [0, 0, 0],
902
+ blanchedalmond: [255, 235, 205],
903
+ blue: [0, 0, 255],
904
+ blueviolet: [138, 43, 226],
905
+ brown: [165, 42, 42],
906
+ burlywood: [222, 184, 135],
907
+ cadetblue: [95, 158, 160],
908
+ chartreuse: [127, 255, 0],
909
+ chocolate: [210, 105, 30],
910
+ coral: [255, 127, 80],
911
+ cornflowerblue: [100, 149, 237],
912
+ cornsilk: [255, 248, 220],
913
+ crimson: [220, 20, 60],
914
+ cyan: [0, 255, 255],
915
+ darkblue: [0, 0, 139],
916
+ darkcyan: [0, 139, 139],
917
+ darkgoldenrod: [184, 134, 11],
918
+ darkgray: [169, 169, 169],
919
+ darkgreen: [0, 100, 0],
920
+ darkgrey: [169, 169, 169],
921
+ darkkhaki: [189, 183, 107],
922
+ darkmagenta: [139, 0, 139],
923
+ darkolivegreen: [85, 107, 47],
924
+ darkorange: [255, 140, 0],
925
+ darkorchid: [153, 50, 204],
926
+ darkred: [139, 0, 0],
927
+ darksalmon: [233, 150, 122],
928
+ darkseagreen: [143, 188, 143],
929
+ darkslateblue: [72, 61, 139],
930
+ darkslategray: [47, 79, 79],
931
+ darkslategrey: [47, 79, 79],
932
+ darkturquoise: [0, 206, 209],
933
+ darkviolet: [148, 0, 211],
934
+ deeppink: [255, 20, 147],
935
+ deepskyblue: [0, 191, 255],
936
+ dimgray: [105, 105, 105],
937
+ dimgrey: [105, 105, 105],
938
+ dodgerblue: [30, 144, 255],
939
+ firebrick: [178, 34, 34],
940
+ floralwhite: [255, 250, 240],
941
+ forestgreen: [34, 139, 34],
942
+ fuchsia: [255, 0, 255],
943
+ gainsboro: [220, 220, 220],
944
+ ghostwhite: [248, 248, 255],
945
+ gold: [255, 215, 0],
946
+ goldenrod: [218, 165, 32],
947
+ gray: [128, 128, 128],
948
+ green: [0, 128, 0],
949
+ greenyellow: [173, 255, 47],
950
+ grey: [128, 128, 128],
951
+ honeydew: [240, 255, 240],
952
+ hotpink: [255, 105, 180],
953
+ indianred: [205, 92, 92],
954
+ indigo: [75, 0, 130],
955
+ ivory: [255, 255, 240],
956
+ khaki: [240, 230, 140],
957
+ lavender: [230, 230, 250],
958
+ lavenderblush: [255, 240, 245],
959
+ lawngreen: [124, 252, 0],
960
+ lemonchiffon: [255, 250, 205],
961
+ lightblue: [173, 216, 230],
962
+ lightcoral: [240, 128, 128],
963
+ lightcyan: [224, 255, 255],
964
+ lightgoldenrodyellow: [250, 250, 210],
965
+ lightgray: [211, 211, 211],
966
+ lightgreen: [144, 238, 144],
967
+ lightgrey: [211, 211, 211],
968
+ lightpink: [255, 182, 193],
969
+ lightsalmon: [255, 160, 122],
970
+ lightseagreen: [32, 178, 170],
971
+ lightskyblue: [135, 206, 250],
972
+ lightslategray: [119, 136, 153],
973
+ lightslategrey: [119, 136, 153],
974
+ lightsteelblue: [176, 196, 222],
975
+ lightyellow: [255, 255, 224],
976
+ lime: [0, 255, 0],
977
+ limegreen: [50, 205, 50],
978
+ linen: [250, 240, 230],
979
+ magenta: [255, 0, 255],
980
+ maroon: [128, 0, 0],
981
+ mediumaquamarine: [102, 205, 170],
982
+ mediumblue: [0, 0, 205],
983
+ mediumorchid: [186, 85, 211],
984
+ mediumpurple: [147, 112, 219],
985
+ mediumseagreen: [60, 179, 113],
986
+ mediumslateblue: [123, 104, 238],
987
+ mediumspringgreen: [0, 250, 154],
988
+ mediumturquoise: [72, 209, 204],
989
+ mediumvioletred: [199, 21, 133],
990
+ midnightblue: [25, 25, 112],
991
+ mintcream: [245, 255, 250],
992
+ mistyrose: [255, 228, 225],
993
+ moccasin: [255, 228, 181],
994
+ navajowhite: [255, 222, 173],
995
+ navy: [0, 0, 128],
996
+ oldlace: [253, 245, 230],
997
+ olive: [128, 128, 0],
998
+ olivedrab: [107, 142, 35],
999
+ orange: [255, 165, 0],
1000
+ orangered: [255, 69, 0],
1001
+ orchid: [218, 112, 214],
1002
+ palegoldenrod: [238, 232, 170],
1003
+ palegreen: [152, 251, 152],
1004
+ paleturquoise: [175, 238, 238],
1005
+ palevioletred: [219, 112, 147],
1006
+ papayawhip: [255, 239, 213],
1007
+ peachpuff: [255, 218, 185],
1008
+ peru: [205, 133, 63],
1009
+ pink: [255, 192, 203],
1010
+ plum: [221, 160, 221],
1011
+ powderblue: [176, 224, 230],
1012
+ purple: [128, 0, 128],
1013
+ rebeccapurple: [102, 51, 153],
1014
+ red: [255, 0, 0],
1015
+ rosybrown: [188, 143, 143],
1016
+ royalblue: [65, 105, 225],
1017
+ saddlebrown: [139, 69, 19],
1018
+ salmon: [250, 128, 114],
1019
+ sandybrown: [244, 164, 96],
1020
+ seagreen: [46, 139, 87],
1021
+ seashell: [255, 245, 238],
1022
+ sienna: [160, 82, 45],
1023
+ silver: [192, 192, 192],
1024
+ skyblue: [135, 206, 235],
1025
+ slateblue: [106, 90, 205],
1026
+ slategray: [112, 128, 144],
1027
+ slategrey: [112, 128, 144],
1028
+ snow: [255, 250, 250],
1029
+ springgreen: [0, 255, 127],
1030
+ steelblue: [70, 130, 180],
1031
+ tan: [210, 180, 140],
1032
+ teal: [0, 128, 128],
1033
+ thistle: [216, 191, 216],
1034
+ tomato: [255, 99, 71],
1035
+ turquoise: [64, 224, 208],
1036
+ violet: [238, 130, 238],
1037
+ wheat: [245, 222, 179],
1038
+ white: [255, 255, 255],
1039
+ whitesmoke: [245, 245, 245],
1040
+ yellow: [255, 255, 0],
1041
+ yellowgreen: [154, 205, 50]
1042
+ };
1043
+ for (const key in colors)
1044
+ Object.freeze(colors[key]);
1045
+ color_name_default = Object.freeze(colors);
1046
+ });
1047
+
1048
+ // node_modules/color-string/index.js
1049
+ function clamp(number_, min, max) {
1050
+ return Math.min(Math.max(min, number_), max);
1051
+ }
1052
+ function hexDouble(number_) {
1053
+ const string_ = Math.round(number_).toString(16).toUpperCase();
1054
+ return string_.length < 2 ? "0" + string_ : string_;
1055
+ }
1056
+ var reverseNames, cs, color_string_default;
1057
+ var init_color_string = __esm(() => {
1058
+ init_color_name();
1059
+ reverseNames = Object.create(null);
1060
+ for (const name in color_name_default) {
1061
+ if (Object.hasOwn(color_name_default, name)) {
1062
+ reverseNames[color_name_default[name]] = name;
1063
+ }
1064
+ }
1065
+ cs = {
1066
+ to: {},
1067
+ get: {}
1068
+ };
1069
+ cs.get = function(string) {
1070
+ const prefix = string.slice(0, 3).toLowerCase();
1071
+ let value;
1072
+ let model;
1073
+ switch (prefix) {
1074
+ case "hsl": {
1075
+ value = cs.get.hsl(string);
1076
+ model = "hsl";
1077
+ break;
1078
+ }
1079
+ case "hwb": {
1080
+ value = cs.get.hwb(string);
1081
+ model = "hwb";
1082
+ break;
1083
+ }
1084
+ default: {
1085
+ value = cs.get.rgb(string);
1086
+ model = "rgb";
1087
+ break;
1088
+ }
1089
+ }
1090
+ if (!value) {
1091
+ return null;
1092
+ }
1093
+ return { model, value };
1094
+ };
1095
+ cs.get.rgb = function(string) {
1096
+ if (!string) {
1097
+ return null;
1098
+ }
1099
+ const abbr = /^#([a-f\d]{3,4})$/i;
1100
+ const hex = /^#([a-f\d]{6})([a-f\d]{2})?$/i;
1101
+ const rgba = /^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i;
1102
+ const per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i;
1103
+ const keyword = /^(\w+)$/;
1104
+ let rgb = [0, 0, 0, 1];
1105
+ let match;
1106
+ let i;
1107
+ let hexAlpha;
1108
+ if (match = string.match(hex)) {
1109
+ hexAlpha = match[2];
1110
+ match = match[1];
1111
+ for (i = 0;i < 3; i++) {
1112
+ const i2 = i * 2;
1113
+ rgb[i] = Number.parseInt(match.slice(i2, i2 + 2), 16);
1114
+ }
1115
+ if (hexAlpha) {
1116
+ rgb[3] = Number.parseInt(hexAlpha, 16) / 255;
1117
+ }
1118
+ } else if (match = string.match(abbr)) {
1119
+ match = match[1];
1120
+ hexAlpha = match[3];
1121
+ for (i = 0;i < 3; i++) {
1122
+ rgb[i] = Number.parseInt(match[i] + match[i], 16);
1123
+ }
1124
+ if (hexAlpha) {
1125
+ rgb[3] = Number.parseInt(hexAlpha + hexAlpha, 16) / 255;
1126
+ }
1127
+ } else if (match = string.match(rgba)) {
1128
+ for (i = 0;i < 3; i++) {
1129
+ rgb[i] = Number.parseFloat(match[i + 1]);
1130
+ }
1131
+ if (match[4]) {
1132
+ rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
1133
+ }
1134
+ } else if (match = string.match(per)) {
1135
+ for (i = 0;i < 3; i++) {
1136
+ rgb[i] = Math.round(Number.parseFloat(match[i + 1]) * 2.55);
1137
+ }
1138
+ if (match[4]) {
1139
+ rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
1140
+ }
1141
+ } else if (match = string.toLowerCase().match(keyword)) {
1142
+ if (match[1] === "transparent") {
1143
+ return [0, 0, 0, 0];
1144
+ }
1145
+ if (!Object.hasOwn(color_name_default, match[1])) {
1146
+ return null;
1147
+ }
1148
+ rgb = color_name_default[match[1]].slice();
1149
+ rgb[3] = 1;
1150
+ return rgb;
1151
+ } else {
1152
+ return null;
1153
+ }
1154
+ for (i = 0;i < 3; i++) {
1155
+ rgb[i] = clamp(rgb[i], 0, 255);
1156
+ }
1157
+ rgb[3] = clamp(rgb[3], 0, 1);
1158
+ return rgb;
1159
+ };
1160
+ cs.get.hsl = function(string) {
1161
+ if (!string) {
1162
+ return null;
1163
+ }
1164
+ const hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i;
1165
+ const match = string.match(hsl);
1166
+ if (match) {
1167
+ const alpha = Number.parseFloat(match[4]);
1168
+ const h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
1169
+ const s = clamp(Number.parseFloat(match[2]), 0, 100);
1170
+ const l = clamp(Number.parseFloat(match[3]), 0, 100);
1171
+ const a = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
1172
+ return [h, s, l, a];
1173
+ }
1174
+ return null;
1175
+ };
1176
+ cs.get.hwb = function(string) {
1177
+ if (!string) {
1178
+ return null;
1179
+ }
1180
+ const hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i;
1181
+ const match = string.match(hwb);
1182
+ if (match) {
1183
+ const alpha = Number.parseFloat(match[4]);
1184
+ const h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
1185
+ const w = clamp(Number.parseFloat(match[2]), 0, 100);
1186
+ const b = clamp(Number.parseFloat(match[3]), 0, 100);
1187
+ const a = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
1188
+ return [h, w, b, a];
1189
+ }
1190
+ return null;
1191
+ };
1192
+ cs.to.hex = function(...rgba) {
1193
+ return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
1194
+ };
1195
+ cs.to.rgb = function(...rgba) {
1196
+ return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ")" : "rgba(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ", " + rgba[3] + ")";
1197
+ };
1198
+ cs.to.rgb.percent = function(...rgba) {
1199
+ const r = Math.round(rgba[0] / 255 * 100);
1200
+ const g = Math.round(rgba[1] / 255 * 100);
1201
+ const b = Math.round(rgba[2] / 255 * 100);
1202
+ return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r + "%, " + g + "%, " + b + "%)" : "rgba(" + r + "%, " + g + "%, " + b + "%, " + rgba[3] + ")";
1203
+ };
1204
+ cs.to.hsl = function(...hsla) {
1205
+ return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
1206
+ };
1207
+ cs.to.hwb = function(...hwba) {
1208
+ let a = "";
1209
+ if (hwba.length >= 4 && hwba[3] !== 1) {
1210
+ a = ", " + hwba[3];
1211
+ }
1212
+ return "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a + ")";
1213
+ };
1214
+ cs.to.keyword = function(...rgb) {
1215
+ return reverseNames[rgb.slice(0, 3)];
1216
+ };
1217
+ color_string_default = cs;
1218
+ });
1219
+
890
1220
  // node_modules/gl-matrix/cjs/common.js
891
1221
  var require_common = __commonJS(function(exports) {
892
1222
  Object.defineProperty(exports, "__esModule", {
@@ -19113,13 +19443,13 @@ function drawInfiniteGrid(software_renderer, params) {
19113
19443
  let out_g = final_g;
19114
19444
  let out_b = final_b;
19115
19445
  if (gamma_out) {
19116
- out_r = srgbEncodeLinear01(clamp(out_r, 0, 1));
19117
- out_g = srgbEncodeLinear01(clamp(out_g, 0, 1));
19118
- out_b = srgbEncodeLinear01(clamp(out_b, 0, 1));
19446
+ out_r = srgbEncodeLinear01(clamp2(out_r, 0, 1));
19447
+ out_g = srgbEncodeLinear01(clamp2(out_g, 0, 1));
19448
+ out_b = srgbEncodeLinear01(clamp2(out_b, 0, 1));
19119
19449
  } else {
19120
- out_r = clamp(out_r, 0, 1);
19121
- out_g = clamp(out_g, 0, 1);
19122
- out_b = clamp(out_b, 0, 1);
19450
+ out_r = clamp2(out_r, 0, 1);
19451
+ out_g = clamp2(out_g, 0, 1);
19452
+ out_b = clamp2(out_b, 0, 1);
19123
19453
  }
19124
19454
  const dst_idx = (y * software_renderer.width + x) * 4;
19125
19455
  const dst_r = (software_renderer.buffer[dst_idx + 0] ?? 0) / 255;
@@ -19131,7 +19461,7 @@ function drawInfiniteGrid(software_renderer, params) {
19131
19461
  const blend_g = out_g * final_alpha + dst_g * one_minus_a;
19132
19462
  const blend_b = out_b * final_alpha + dst_b * one_minus_a;
19133
19463
  const blend_a = final_alpha + dst_a * one_minus_a;
19134
- software_renderer.setPixel(x, y, clamp(blend_r, 0, 1) * 255 | 0, clamp(blend_g, 0, 1) * 255 | 0, clamp(blend_b, 0, 1) * 255 | 0, clamp(blend_a, 0, 1) * 255 | 0);
19464
+ software_renderer.setPixel(x, y, clamp2(blend_r, 0, 1) * 255 | 0, clamp2(blend_g, 0, 1) * 255 | 0, clamp2(blend_b, 0, 1) * 255 | 0, clamp2(blend_a, 0, 1) * 255 | 0);
19135
19465
  }
19136
19466
  }
19137
19467
  }
@@ -19984,7 +20314,7 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
19984
20314
  width,
19985
20315
  height,
19986
20316
  data: new Uint8ClampedArray(width * height * 4)
19987
- }), DEFAULT_LIGHT_DIR, DEFAULT_RENDER_OPTIONS, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), GeometryDenoiser = class {
20317
+ }), DEFAULT_LIGHT_DIR, DEFAULT_RENDER_OPTIONS, clamp2 = (value, min, max) => Math.max(min, Math.min(max, value)), GeometryDenoiser = class {
19988
20318
  constructor(width, height) {
19989
20319
  this.width = width;
19990
20320
  this.height = height;
@@ -20149,19 +20479,19 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
20149
20479
  }
20150
20480
  let [r, g, b, a] = material.baseColorFactor;
20151
20481
  if (gammaOut) {
20152
- r = srgbEncodeLinear01(clamp(r, 0, 1));
20153
- g = srgbEncodeLinear01(clamp(g, 0, 1));
20154
- b = srgbEncodeLinear01(clamp(b, 0, 1));
20482
+ r = srgbEncodeLinear01(clamp2(r, 0, 1));
20483
+ g = srgbEncodeLinear01(clamp2(g, 0, 1));
20484
+ b = srgbEncodeLinear01(clamp2(b, 0, 1));
20155
20485
  } else {
20156
- r = clamp(r, 0, 1);
20157
- g = clamp(g, 0, 1);
20158
- b = clamp(b, 0, 1);
20486
+ r = clamp2(r, 0, 1);
20487
+ g = clamp2(g, 0, 1);
20488
+ b = clamp2(b, 0, 1);
20159
20489
  }
20160
20490
  const r255 = r * 255 | 0;
20161
20491
  const g255 = g * 255 | 0;
20162
20492
  const b255 = b * 255 | 0;
20163
- const opacity = clamp(options.opacity ?? 1, 0, 1);
20164
- const sourceAlpha = clamp(a, 0, 1) * opacity;
20493
+ const opacity = clamp2(options.opacity ?? 1, 0, 1);
20494
+ const sourceAlpha = clamp2(a, 0, 1) * opacity;
20165
20495
  const depthCompare = options.depthCompare ?? "less";
20166
20496
  const depthWrite = options.depthWrite ?? true;
20167
20497
  const depthBias = options.depthBias ?? 0;
@@ -20229,8 +20559,8 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
20229
20559
  sampleTextureNearest(img, u, v) {
20230
20560
  if (!img)
20231
20561
  return [1, 1, 1, 1];
20232
- const x = clamp(Math.floor(u * (img.width - 1)), 0, img.width - 1);
20233
- const y = clamp(Math.floor(v * (img.height - 1)), 0, img.height - 1);
20562
+ const x = clamp2(Math.floor(u * (img.width - 1)), 0, img.width - 1);
20563
+ const y = clamp2(Math.floor(v * (img.height - 1)), 0, img.height - 1);
20234
20564
  const idx = (y * img.width + x) * 4;
20235
20565
  const d = img.data;
20236
20566
  return [
@@ -20256,7 +20586,7 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
20256
20586
  let { positions, normals, uvs, indices, model, colors } = mesh;
20257
20587
  const materialId = this.denoiser?.materialId(material) ?? 0;
20258
20588
  const lightDir = light.dir ?? DEFAULT_LIGHT_DIR;
20259
- const ambient = clamp(light.ambient ?? DEFAULT_RENDER_OPTIONS.ambient, 0, 1);
20589
+ const ambient = clamp2(light.ambient ?? DEFAULT_RENDER_OPTIONS.ambient, 0, 1);
20260
20590
  const L = studio ? null : import_gl_matrix5.vec3.normalize(import_gl_matrix5.vec3.create(), import_gl_matrix5.vec3.fromValues(lightDir[0], lightDir[1], lightDir[2]));
20261
20591
  const view = camera.view;
20262
20592
  const proj = camera.proj;
@@ -20461,13 +20791,13 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
20461
20791
  depth[di] = z01;
20462
20792
  }
20463
20793
  if (gammaOut) {
20464
- r = srgbEncodeLinear01(clamp(r, 0, 1));
20465
- g = srgbEncodeLinear01(clamp(g, 0, 1));
20466
- b = srgbEncodeLinear01(clamp(b, 0, 1));
20794
+ r = srgbEncodeLinear01(clamp2(r, 0, 1));
20795
+ g = srgbEncodeLinear01(clamp2(g, 0, 1));
20796
+ b = srgbEncodeLinear01(clamp2(b, 0, 1));
20467
20797
  } else {
20468
- r = clamp(r, 0, 1);
20469
- g = clamp(g, 0, 1);
20470
- b = clamp(b, 0, 1);
20798
+ r = clamp2(r, 0, 1);
20799
+ g = clamp2(g, 0, 1);
20800
+ b = clamp2(b, 0, 1);
20471
20801
  }
20472
20802
  const dstIdx = (y * this.width + x) * 4;
20473
20803
  const dstR = (this.buffer[dstIdx + 0] ?? 0) / 255;
@@ -20485,7 +20815,7 @@ var import_gl_matrix, import_gl_matrix2, import_gl_matrix3, import_gl_matrix4, i
20485
20815
  outB = b * a + dstB * oneMinusA;
20486
20816
  outA = a + dstA * oneMinusA;
20487
20817
  }
20488
- this.setPixel(x, y, clamp(outR, 0, 1) * 255 | 0, clamp(outG, 0, 1) * 255 | 0, clamp(outB, 0, 1) * 255 | 0, clamp(outA, 0, 1) * 255 | 0, true);
20818
+ this.setPixel(x, y, clamp2(outR, 0, 1) * 255 | 0, clamp2(outG, 0, 1) * 255 | 0, clamp2(outB, 0, 1) * 255 | 0, clamp2(outA, 0, 1) * 255 | 0, true);
20489
20819
  if (this.denoiser) {
20490
20820
  if (alphaMode !== "BLEND") {
20491
20821
  const distance = 1 / (l0 * invW[0] + l1 * invW[1] + l2 * invW[2]);
@@ -23594,6 +23924,1251 @@ import { applyToPoint as applyToPoint5 } from "transformation-matrix";
23594
23924
  import { applyToPoint as applyToPoint6 } from "transformation-matrix";
23595
23925
  import { applyToPoint as applyToPoint7 } from "transformation-matrix";
23596
23926
  import { applyToPoint as applyToPoint8 } from "transformation-matrix";
23927
+
23928
+ // node_modules/color/index.js
23929
+ init_color_string();
23930
+
23931
+ // node_modules/color-convert/conversions.js
23932
+ init_color_name();
23933
+ var reverseKeywords = {};
23934
+ for (const key of Object.keys(color_name_default)) {
23935
+ reverseKeywords[color_name_default[key]] = key;
23936
+ }
23937
+ var convert = {
23938
+ rgb: { channels: 3, labels: "rgb" },
23939
+ hsl: { channels: 3, labels: "hsl" },
23940
+ hsv: { channels: 3, labels: "hsv" },
23941
+ hwb: { channels: 3, labels: "hwb" },
23942
+ cmyk: { channels: 4, labels: "cmyk" },
23943
+ xyz: { channels: 3, labels: "xyz" },
23944
+ lab: { channels: 3, labels: "lab" },
23945
+ oklab: { channels: 3, labels: ["okl", "oka", "okb"] },
23946
+ lch: { channels: 3, labels: "lch" },
23947
+ oklch: { channels: 3, labels: ["okl", "okc", "okh"] },
23948
+ hex: { channels: 1, labels: ["hex"] },
23949
+ keyword: { channels: 1, labels: ["keyword"] },
23950
+ ansi16: { channels: 1, labels: ["ansi16"] },
23951
+ ansi256: { channels: 1, labels: ["ansi256"] },
23952
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
23953
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
23954
+ gray: { channels: 1, labels: ["gray"] }
23955
+ };
23956
+ var conversions_default = convert;
23957
+ var LAB_FT = (6 / 29) ** 3;
23958
+ function srgbNonlinearTransform(c) {
23959
+ const cc = c > 0.0031308 ? 1.055 * c ** (1 / 2.4) - 0.055 : c * 12.92;
23960
+ return Math.min(Math.max(0, cc), 1);
23961
+ }
23962
+ function srgbNonlinearTransformInv(c) {
23963
+ return c > 0.04045 ? ((c + 0.055) / 1.055) ** 2.4 : c / 12.92;
23964
+ }
23965
+ for (const model of Object.keys(convert)) {
23966
+ if (!("channels" in convert[model])) {
23967
+ throw new Error("missing channels property: " + model);
23968
+ }
23969
+ if (!("labels" in convert[model])) {
23970
+ throw new Error("missing channel labels property: " + model);
23971
+ }
23972
+ if (convert[model].labels.length !== convert[model].channels) {
23973
+ throw new Error("channel and label counts mismatch: " + model);
23974
+ }
23975
+ const { channels, labels } = convert[model];
23976
+ delete convert[model].channels;
23977
+ delete convert[model].labels;
23978
+ Object.defineProperty(convert[model], "channels", { value: channels });
23979
+ Object.defineProperty(convert[model], "labels", { value: labels });
23980
+ }
23981
+ convert.rgb.hsl = function(rgb) {
23982
+ const r = rgb[0] / 255;
23983
+ const g = rgb[1] / 255;
23984
+ const b = rgb[2] / 255;
23985
+ const min = Math.min(r, g, b);
23986
+ const max = Math.max(r, g, b);
23987
+ const delta = max - min;
23988
+ let h;
23989
+ let s;
23990
+ switch (max) {
23991
+ case min: {
23992
+ h = 0;
23993
+ break;
23994
+ }
23995
+ case r: {
23996
+ h = (g - b) / delta;
23997
+ break;
23998
+ }
23999
+ case g: {
24000
+ h = 2 + (b - r) / delta;
24001
+ break;
24002
+ }
24003
+ case b: {
24004
+ h = 4 + (r - g) / delta;
24005
+ break;
24006
+ }
24007
+ }
24008
+ h = Math.min(h * 60, 360);
24009
+ if (h < 0) {
24010
+ h += 360;
24011
+ }
24012
+ const l = (min + max) / 2;
24013
+ if (max === min) {
24014
+ s = 0;
24015
+ } else if (l <= 0.5) {
24016
+ s = delta / (max + min);
24017
+ } else {
24018
+ s = delta / (2 - max - min);
24019
+ }
24020
+ return [h, s * 100, l * 100];
24021
+ };
24022
+ convert.rgb.hsv = function(rgb) {
24023
+ let rdif;
24024
+ let gdif;
24025
+ let bdif;
24026
+ let h;
24027
+ let s;
24028
+ const r = rgb[0] / 255;
24029
+ const g = rgb[1] / 255;
24030
+ const b = rgb[2] / 255;
24031
+ const v = Math.max(r, g, b);
24032
+ const diff = v - Math.min(r, g, b);
24033
+ const diffc = function(c) {
24034
+ return (v - c) / 6 / diff + 1 / 2;
24035
+ };
24036
+ if (diff === 0) {
24037
+ h = 0;
24038
+ s = 0;
24039
+ } else {
24040
+ s = diff / v;
24041
+ rdif = diffc(r);
24042
+ gdif = diffc(g);
24043
+ bdif = diffc(b);
24044
+ switch (v) {
24045
+ case r: {
24046
+ h = bdif - gdif;
24047
+ break;
24048
+ }
24049
+ case g: {
24050
+ h = 1 / 3 + rdif - bdif;
24051
+ break;
24052
+ }
24053
+ case b: {
24054
+ h = 2 / 3 + gdif - rdif;
24055
+ break;
24056
+ }
24057
+ }
24058
+ if (h < 0) {
24059
+ h += 1;
24060
+ } else if (h > 1) {
24061
+ h -= 1;
24062
+ }
24063
+ }
24064
+ return [
24065
+ h * 360,
24066
+ s * 100,
24067
+ v * 100
24068
+ ];
24069
+ };
24070
+ convert.rgb.hwb = function(rgb) {
24071
+ const r = rgb[0];
24072
+ const g = rgb[1];
24073
+ let b = rgb[2];
24074
+ const h = convert.rgb.hsl(rgb)[0];
24075
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
24076
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
24077
+ return [h, w * 100, b * 100];
24078
+ };
24079
+ convert.rgb.oklab = function(rgb) {
24080
+ const r = srgbNonlinearTransformInv(rgb[0] / 255);
24081
+ const g = srgbNonlinearTransformInv(rgb[1] / 255);
24082
+ const b = srgbNonlinearTransformInv(rgb[2] / 255);
24083
+ const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
24084
+ const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
24085
+ const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
24086
+ const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
24087
+ const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
24088
+ const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
24089
+ return [l * 100, aa * 100, bb * 100];
24090
+ };
24091
+ convert.rgb.cmyk = function(rgb) {
24092
+ const r = rgb[0] / 255;
24093
+ const g = rgb[1] / 255;
24094
+ const b = rgb[2] / 255;
24095
+ const k = Math.min(1 - r, 1 - g, 1 - b);
24096
+ const c = (1 - r - k) / (1 - k) || 0;
24097
+ const m = (1 - g - k) / (1 - k) || 0;
24098
+ const y = (1 - b - k) / (1 - k) || 0;
24099
+ return [c * 100, m * 100, y * 100, k * 100];
24100
+ };
24101
+ function comparativeDistance(x, y) {
24102
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
24103
+ }
24104
+ convert.rgb.keyword = function(rgb) {
24105
+ const reversed = reverseKeywords[rgb];
24106
+ if (reversed) {
24107
+ return reversed;
24108
+ }
24109
+ let currentClosestDistance = Number.POSITIVE_INFINITY;
24110
+ let currentClosestKeyword;
24111
+ for (const keyword of Object.keys(color_name_default)) {
24112
+ const value = color_name_default[keyword];
24113
+ const distance = comparativeDistance(rgb, value);
24114
+ if (distance < currentClosestDistance) {
24115
+ currentClosestDistance = distance;
24116
+ currentClosestKeyword = keyword;
24117
+ }
24118
+ }
24119
+ return currentClosestKeyword;
24120
+ };
24121
+ convert.keyword.rgb = function(keyword) {
24122
+ return [...color_name_default[keyword]];
24123
+ };
24124
+ convert.rgb.xyz = function(rgb) {
24125
+ const r = srgbNonlinearTransformInv(rgb[0] / 255);
24126
+ const g = srgbNonlinearTransformInv(rgb[1] / 255);
24127
+ const b = srgbNonlinearTransformInv(rgb[2] / 255);
24128
+ const x = r * 0.4124564 + g * 0.3575761 + b * 0.1804375;
24129
+ const y = r * 0.2126729 + g * 0.7151522 + b * 0.072175;
24130
+ const z = r * 0.0193339 + g * 0.119192 + b * 0.9503041;
24131
+ return [x * 100, y * 100, z * 100];
24132
+ };
24133
+ convert.rgb.lab = function(rgb) {
24134
+ const xyz = convert.rgb.xyz(rgb);
24135
+ let x = xyz[0];
24136
+ let y = xyz[1];
24137
+ let z = xyz[2];
24138
+ x /= 95.047;
24139
+ y /= 100;
24140
+ z /= 108.883;
24141
+ x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
24142
+ y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
24143
+ z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
24144
+ const l = 116 * y - 16;
24145
+ const a = 500 * (x - y);
24146
+ const b = 200 * (y - z);
24147
+ return [l, a, b];
24148
+ };
24149
+ convert.hsl.rgb = function(hsl) {
24150
+ const h = hsl[0] / 360;
24151
+ const s = hsl[1] / 100;
24152
+ const l = hsl[2] / 100;
24153
+ let t3;
24154
+ let value;
24155
+ if (s === 0) {
24156
+ value = l * 255;
24157
+ return [value, value, value];
24158
+ }
24159
+ const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
24160
+ const t1 = 2 * l - t2;
24161
+ const rgb = [0, 0, 0];
24162
+ for (let i = 0;i < 3; i++) {
24163
+ t3 = h + 1 / 3 * -(i - 1);
24164
+ if (t3 < 0) {
24165
+ t3++;
24166
+ }
24167
+ if (t3 > 1) {
24168
+ t3--;
24169
+ }
24170
+ if (6 * t3 < 1) {
24171
+ value = t1 + (t2 - t1) * 6 * t3;
24172
+ } else if (2 * t3 < 1) {
24173
+ value = t2;
24174
+ } else if (3 * t3 < 2) {
24175
+ value = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
24176
+ } else {
24177
+ value = t1;
24178
+ }
24179
+ rgb[i] = value * 255;
24180
+ }
24181
+ return rgb;
24182
+ };
24183
+ convert.hsl.hsv = function(hsl) {
24184
+ const h = hsl[0];
24185
+ let s = hsl[1] / 100;
24186
+ let l = hsl[2] / 100;
24187
+ let smin = s;
24188
+ const lmin = Math.max(l, 0.01);
24189
+ l *= 2;
24190
+ s *= l <= 1 ? l : 2 - l;
24191
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
24192
+ const v = (l + s) / 2;
24193
+ const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
24194
+ return [h, sv * 100, v * 100];
24195
+ };
24196
+ convert.hsv.rgb = function(hsv) {
24197
+ const h = hsv[0] / 60;
24198
+ const s = hsv[1] / 100;
24199
+ let v = hsv[2] / 100;
24200
+ const hi = Math.floor(h) % 6;
24201
+ const f = h - Math.floor(h);
24202
+ const p = 255 * v * (1 - s);
24203
+ const q = 255 * v * (1 - s * f);
24204
+ const t = 255 * v * (1 - s * (1 - f));
24205
+ v *= 255;
24206
+ switch (hi) {
24207
+ case 0: {
24208
+ return [v, t, p];
24209
+ }
24210
+ case 1: {
24211
+ return [q, v, p];
24212
+ }
24213
+ case 2: {
24214
+ return [p, v, t];
24215
+ }
24216
+ case 3: {
24217
+ return [p, q, v];
24218
+ }
24219
+ case 4: {
24220
+ return [t, p, v];
24221
+ }
24222
+ case 5: {
24223
+ return [v, p, q];
24224
+ }
24225
+ }
24226
+ };
24227
+ convert.hsv.hsl = function(hsv) {
24228
+ const h = hsv[0];
24229
+ const s = hsv[1] / 100;
24230
+ const v = hsv[2] / 100;
24231
+ const vmin = Math.max(v, 0.01);
24232
+ let sl;
24233
+ let l;
24234
+ l = (2 - s) * v;
24235
+ const lmin = (2 - s) * vmin;
24236
+ sl = s * vmin;
24237
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
24238
+ sl = sl || 0;
24239
+ l /= 2;
24240
+ return [h, sl * 100, l * 100];
24241
+ };
24242
+ convert.hwb.rgb = function(hwb) {
24243
+ const h = hwb[0] / 360;
24244
+ let wh = hwb[1] / 100;
24245
+ let bl = hwb[2] / 100;
24246
+ const ratio = wh + bl;
24247
+ let f;
24248
+ if (ratio > 1) {
24249
+ wh /= ratio;
24250
+ bl /= ratio;
24251
+ }
24252
+ const i = Math.floor(6 * h);
24253
+ const v = 1 - bl;
24254
+ f = 6 * h - i;
24255
+ if ((i & 1) !== 0) {
24256
+ f = 1 - f;
24257
+ }
24258
+ const n = wh + f * (v - wh);
24259
+ let r;
24260
+ let g;
24261
+ let b;
24262
+ switch (i) {
24263
+ default:
24264
+ case 6:
24265
+ case 0: {
24266
+ r = v;
24267
+ g = n;
24268
+ b = wh;
24269
+ break;
24270
+ }
24271
+ case 1: {
24272
+ r = n;
24273
+ g = v;
24274
+ b = wh;
24275
+ break;
24276
+ }
24277
+ case 2: {
24278
+ r = wh;
24279
+ g = v;
24280
+ b = n;
24281
+ break;
24282
+ }
24283
+ case 3: {
24284
+ r = wh;
24285
+ g = n;
24286
+ b = v;
24287
+ break;
24288
+ }
24289
+ case 4: {
24290
+ r = n;
24291
+ g = wh;
24292
+ b = v;
24293
+ break;
24294
+ }
24295
+ case 5: {
24296
+ r = v;
24297
+ g = wh;
24298
+ b = n;
24299
+ break;
24300
+ }
24301
+ }
24302
+ return [r * 255, g * 255, b * 255];
24303
+ };
24304
+ convert.cmyk.rgb = function(cmyk) {
24305
+ const c = cmyk[0] / 100;
24306
+ const m = cmyk[1] / 100;
24307
+ const y = cmyk[2] / 100;
24308
+ const k = cmyk[3] / 100;
24309
+ const r = 1 - Math.min(1, c * (1 - k) + k);
24310
+ const g = 1 - Math.min(1, m * (1 - k) + k);
24311
+ const b = 1 - Math.min(1, y * (1 - k) + k);
24312
+ return [r * 255, g * 255, b * 255];
24313
+ };
24314
+ convert.xyz.rgb = function(xyz) {
24315
+ const x = xyz[0] / 100;
24316
+ const y = xyz[1] / 100;
24317
+ const z = xyz[2] / 100;
24318
+ let r;
24319
+ let g;
24320
+ let b;
24321
+ r = x * 3.2404542 + y * -1.5371385 + z * -0.4985314;
24322
+ g = x * -0.969266 + y * 1.8760108 + z * 0.041556;
24323
+ b = x * 0.0556434 + y * -0.2040259 + z * 1.0572252;
24324
+ r = srgbNonlinearTransform(r);
24325
+ g = srgbNonlinearTransform(g);
24326
+ b = srgbNonlinearTransform(b);
24327
+ return [r * 255, g * 255, b * 255];
24328
+ };
24329
+ convert.xyz.lab = function(xyz) {
24330
+ let x = xyz[0];
24331
+ let y = xyz[1];
24332
+ let z = xyz[2];
24333
+ x /= 95.047;
24334
+ y /= 100;
24335
+ z /= 108.883;
24336
+ x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
24337
+ y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
24338
+ z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
24339
+ const l = 116 * y - 16;
24340
+ const a = 500 * (x - y);
24341
+ const b = 200 * (y - z);
24342
+ return [l, a, b];
24343
+ };
24344
+ convert.xyz.oklab = function(xyz) {
24345
+ const x = xyz[0] / 100;
24346
+ const y = xyz[1] / 100;
24347
+ const z = xyz[2] / 100;
24348
+ const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z);
24349
+ const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z);
24350
+ const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z);
24351
+ const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
24352
+ const a = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
24353
+ const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
24354
+ return [l * 100, a * 100, b * 100];
24355
+ };
24356
+ convert.oklab.oklch = function(oklab) {
24357
+ return convert.lab.lch(oklab);
24358
+ };
24359
+ convert.oklab.xyz = function(oklab) {
24360
+ const ll = oklab[0] / 100;
24361
+ const a = oklab[1] / 100;
24362
+ const b = oklab[2] / 100;
24363
+ const l = (0.999999998 * ll + 0.396337792 * a + 0.215803758 * b) ** 3;
24364
+ const m = (1.000000008 * ll - 0.105561342 * a - 0.063854175 * b) ** 3;
24365
+ const s = (1.000000055 * ll - 0.089484182 * a - 1.291485538 * b) ** 3;
24366
+ const x = 1.227013851 * l - 0.55779998 * m + 0.281256149 * s;
24367
+ const y = -0.040580178 * l + 1.11225687 * m - 0.071676679 * s;
24368
+ const z = -0.076381285 * l - 0.421481978 * m + 1.58616322 * s;
24369
+ return [x * 100, y * 100, z * 100];
24370
+ };
24371
+ convert.oklab.rgb = function(oklab) {
24372
+ const ll = oklab[0] / 100;
24373
+ const aa = oklab[1] / 100;
24374
+ const bb = oklab[2] / 100;
24375
+ const l = (ll + 0.3963377774 * aa + 0.2158037573 * bb) ** 3;
24376
+ const m = (ll - 0.1055613458 * aa - 0.0638541728 * bb) ** 3;
24377
+ const s = (ll - 0.0894841775 * aa - 1.291485548 * bb) ** 3;
24378
+ const r = srgbNonlinearTransform(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s);
24379
+ const g = srgbNonlinearTransform(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s);
24380
+ const b = srgbNonlinearTransform(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s);
24381
+ return [r * 255, g * 255, b * 255];
24382
+ };
24383
+ convert.oklch.oklab = function(oklch) {
24384
+ return convert.lch.lab(oklch);
24385
+ };
24386
+ convert.lab.xyz = function(lab) {
24387
+ const l = lab[0];
24388
+ const a = lab[1];
24389
+ const b = lab[2];
24390
+ let x;
24391
+ let y;
24392
+ let z;
24393
+ y = (l + 16) / 116;
24394
+ x = a / 500 + y;
24395
+ z = y - b / 200;
24396
+ const y2 = y ** 3;
24397
+ const x2 = x ** 3;
24398
+ const z2 = z ** 3;
24399
+ y = y2 > LAB_FT ? y2 : (y - 16 / 116) / 7.787;
24400
+ x = x2 > LAB_FT ? x2 : (x - 16 / 116) / 7.787;
24401
+ z = z2 > LAB_FT ? z2 : (z - 16 / 116) / 7.787;
24402
+ x *= 95.047;
24403
+ y *= 100;
24404
+ z *= 108.883;
24405
+ return [x, y, z];
24406
+ };
24407
+ convert.lab.lch = function(lab) {
24408
+ const l = lab[0];
24409
+ const a = lab[1];
24410
+ const b = lab[2];
24411
+ let h;
24412
+ const hr = Math.atan2(b, a);
24413
+ h = hr * 360 / 2 / Math.PI;
24414
+ if (h < 0) {
24415
+ h += 360;
24416
+ }
24417
+ const c = Math.sqrt(a * a + b * b);
24418
+ return [l, c, h];
24419
+ };
24420
+ convert.lch.lab = function(lch) {
24421
+ const l = lch[0];
24422
+ const c = lch[1];
24423
+ const h = lch[2];
24424
+ const hr = h / 360 * 2 * Math.PI;
24425
+ const a = c * Math.cos(hr);
24426
+ const b = c * Math.sin(hr);
24427
+ return [l, a, b];
24428
+ };
24429
+ convert.rgb.ansi16 = function(args, saturation = null) {
24430
+ const [r, g, b] = args;
24431
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
24432
+ value = Math.round(value / 50);
24433
+ if (value === 0) {
24434
+ return 30;
24435
+ }
24436
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
24437
+ if (value === 2) {
24438
+ ansi += 60;
24439
+ }
24440
+ return ansi;
24441
+ };
24442
+ convert.hsv.ansi16 = function(args) {
24443
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
24444
+ };
24445
+ convert.rgb.ansi256 = function(args) {
24446
+ const r = args[0];
24447
+ const g = args[1];
24448
+ const b = args[2];
24449
+ if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
24450
+ if (r < 8) {
24451
+ return 16;
24452
+ }
24453
+ if (r > 248) {
24454
+ return 231;
24455
+ }
24456
+ return Math.round((r - 8) / 247 * 24) + 232;
24457
+ }
24458
+ const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
24459
+ return ansi;
24460
+ };
24461
+ convert.ansi16.rgb = function(args) {
24462
+ args = args[0];
24463
+ let color = args % 10;
24464
+ if (color === 0 || color === 7) {
24465
+ if (args > 50) {
24466
+ color += 3.5;
24467
+ }
24468
+ color = color / 10.5 * 255;
24469
+ return [color, color, color];
24470
+ }
24471
+ const mult = (Math.trunc(args > 50) + 1) * 0.5;
24472
+ const r = (color & 1) * mult * 255;
24473
+ const g = (color >> 1 & 1) * mult * 255;
24474
+ const b = (color >> 2 & 1) * mult * 255;
24475
+ return [r, g, b];
24476
+ };
24477
+ convert.ansi256.rgb = function(args) {
24478
+ args = args[0];
24479
+ if (args >= 232) {
24480
+ const c = (args - 232) * 10 + 8;
24481
+ return [c, c, c];
24482
+ }
24483
+ args -= 16;
24484
+ let rem;
24485
+ const r = Math.floor(args / 36) / 5 * 255;
24486
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
24487
+ const b = rem % 6 / 5 * 255;
24488
+ return [r, g, b];
24489
+ };
24490
+ convert.rgb.hex = function(args) {
24491
+ const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
24492
+ const string = integer.toString(16).toUpperCase();
24493
+ return "000000".slice(string.length) + string;
24494
+ };
24495
+ convert.hex.rgb = function(args) {
24496
+ const match = args.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
24497
+ if (!match) {
24498
+ return [0, 0, 0];
24499
+ }
24500
+ let colorString = match[0];
24501
+ if (match[0].length === 3) {
24502
+ colorString = [...colorString].map((char) => char + char).join("");
24503
+ }
24504
+ const integer = Number.parseInt(colorString, 16);
24505
+ const r = integer >> 16 & 255;
24506
+ const g = integer >> 8 & 255;
24507
+ const b = integer & 255;
24508
+ return [r, g, b];
24509
+ };
24510
+ convert.rgb.hcg = function(rgb) {
24511
+ const r = rgb[0] / 255;
24512
+ const g = rgb[1] / 255;
24513
+ const b = rgb[2] / 255;
24514
+ const max = Math.max(Math.max(r, g), b);
24515
+ const min = Math.min(Math.min(r, g), b);
24516
+ const chroma = max - min;
24517
+ let hue;
24518
+ const grayscale = chroma < 1 ? min / (1 - chroma) : 0;
24519
+ if (chroma <= 0) {
24520
+ hue = 0;
24521
+ } else if (max === r) {
24522
+ hue = (g - b) / chroma % 6;
24523
+ } else if (max === g) {
24524
+ hue = 2 + (b - r) / chroma;
24525
+ } else {
24526
+ hue = 4 + (r - g) / chroma;
24527
+ }
24528
+ hue /= 6;
24529
+ hue %= 1;
24530
+ return [hue * 360, chroma * 100, grayscale * 100];
24531
+ };
24532
+ convert.hsl.hcg = function(hsl) {
24533
+ const s = hsl[1] / 100;
24534
+ const l = hsl[2] / 100;
24535
+ const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
24536
+ let f = 0;
24537
+ if (c < 1) {
24538
+ f = (l - 0.5 * c) / (1 - c);
24539
+ }
24540
+ return [hsl[0], c * 100, f * 100];
24541
+ };
24542
+ convert.hsv.hcg = function(hsv) {
24543
+ const s = hsv[1] / 100;
24544
+ const v = hsv[2] / 100;
24545
+ const c = s * v;
24546
+ let f = 0;
24547
+ if (c < 1) {
24548
+ f = (v - c) / (1 - c);
24549
+ }
24550
+ return [hsv[0], c * 100, f * 100];
24551
+ };
24552
+ convert.hcg.rgb = function(hcg) {
24553
+ const h = hcg[0] / 360;
24554
+ const c = hcg[1] / 100;
24555
+ const g = hcg[2] / 100;
24556
+ if (c === 0) {
24557
+ return [g * 255, g * 255, g * 255];
24558
+ }
24559
+ const pure = [0, 0, 0];
24560
+ const hi = h % 1 * 6;
24561
+ const v = hi % 1;
24562
+ const w = 1 - v;
24563
+ let mg = 0;
24564
+ switch (Math.floor(hi)) {
24565
+ case 0: {
24566
+ pure[0] = 1;
24567
+ pure[1] = v;
24568
+ pure[2] = 0;
24569
+ break;
24570
+ }
24571
+ case 1: {
24572
+ pure[0] = w;
24573
+ pure[1] = 1;
24574
+ pure[2] = 0;
24575
+ break;
24576
+ }
24577
+ case 2: {
24578
+ pure[0] = 0;
24579
+ pure[1] = 1;
24580
+ pure[2] = v;
24581
+ break;
24582
+ }
24583
+ case 3: {
24584
+ pure[0] = 0;
24585
+ pure[1] = w;
24586
+ pure[2] = 1;
24587
+ break;
24588
+ }
24589
+ case 4: {
24590
+ pure[0] = v;
24591
+ pure[1] = 0;
24592
+ pure[2] = 1;
24593
+ break;
24594
+ }
24595
+ default: {
24596
+ pure[0] = 1;
24597
+ pure[1] = 0;
24598
+ pure[2] = w;
24599
+ }
24600
+ }
24601
+ mg = (1 - c) * g;
24602
+ return [
24603
+ (c * pure[0] + mg) * 255,
24604
+ (c * pure[1] + mg) * 255,
24605
+ (c * pure[2] + mg) * 255
24606
+ ];
24607
+ };
24608
+ convert.hcg.hsv = function(hcg) {
24609
+ const c = hcg[1] / 100;
24610
+ const g = hcg[2] / 100;
24611
+ const v = c + g * (1 - c);
24612
+ let f = 0;
24613
+ if (v > 0) {
24614
+ f = c / v;
24615
+ }
24616
+ return [hcg[0], f * 100, v * 100];
24617
+ };
24618
+ convert.hcg.hsl = function(hcg) {
24619
+ const c = hcg[1] / 100;
24620
+ const g = hcg[2] / 100;
24621
+ const l = g * (1 - c) + 0.5 * c;
24622
+ let s = 0;
24623
+ if (l > 0 && l < 0.5) {
24624
+ s = c / (2 * l);
24625
+ } else if (l >= 0.5 && l < 1) {
24626
+ s = c / (2 * (1 - l));
24627
+ }
24628
+ return [hcg[0], s * 100, l * 100];
24629
+ };
24630
+ convert.hcg.hwb = function(hcg) {
24631
+ const c = hcg[1] / 100;
24632
+ const g = hcg[2] / 100;
24633
+ const v = c + g * (1 - c);
24634
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
24635
+ };
24636
+ convert.hwb.hcg = function(hwb) {
24637
+ const w = hwb[1] / 100;
24638
+ const b = hwb[2] / 100;
24639
+ const v = 1 - b;
24640
+ const c = v - w;
24641
+ let g = 0;
24642
+ if (c < 1) {
24643
+ g = (v - c) / (1 - c);
24644
+ }
24645
+ return [hwb[0], c * 100, g * 100];
24646
+ };
24647
+ convert.apple.rgb = function(apple) {
24648
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
24649
+ };
24650
+ convert.rgb.apple = function(rgb) {
24651
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
24652
+ };
24653
+ convert.gray.rgb = function(args) {
24654
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
24655
+ };
24656
+ convert.gray.hsl = function(args) {
24657
+ return [0, 0, args[0]];
24658
+ };
24659
+ convert.gray.hsv = convert.gray.hsl;
24660
+ convert.gray.hwb = function(gray) {
24661
+ return [0, 100, gray[0]];
24662
+ };
24663
+ convert.gray.cmyk = function(gray) {
24664
+ return [0, 0, 0, gray[0]];
24665
+ };
24666
+ convert.gray.lab = function(gray) {
24667
+ return [gray[0], 0, 0];
24668
+ };
24669
+ convert.gray.hex = function(gray) {
24670
+ const value = Math.round(gray[0] / 100 * 255) & 255;
24671
+ const integer = (value << 16) + (value << 8) + value;
24672
+ const string = integer.toString(16).toUpperCase();
24673
+ return "000000".slice(string.length) + string;
24674
+ };
24675
+ convert.rgb.gray = function(rgb) {
24676
+ const value = (rgb[0] + rgb[1] + rgb[2]) / 3;
24677
+ return [value / 255 * 100];
24678
+ };
24679
+
24680
+ // node_modules/color-convert/route.js
24681
+ function buildGraph() {
24682
+ const graph = {};
24683
+ const models = Object.keys(conversions_default);
24684
+ for (let { length } = models, i = 0;i < length; i++) {
24685
+ graph[models[i]] = {
24686
+ distance: -1,
24687
+ parent: null
24688
+ };
24689
+ }
24690
+ return graph;
24691
+ }
24692
+ function deriveBFS(fromModel) {
24693
+ const graph = buildGraph();
24694
+ const queue = [fromModel];
24695
+ graph[fromModel].distance = 0;
24696
+ while (queue.length > 0) {
24697
+ const current = queue.pop();
24698
+ const adjacents = Object.keys(conversions_default[current]);
24699
+ for (let { length } = adjacents, i = 0;i < length; i++) {
24700
+ const adjacent = adjacents[i];
24701
+ const node = graph[adjacent];
24702
+ if (node.distance === -1) {
24703
+ node.distance = graph[current].distance + 1;
24704
+ node.parent = current;
24705
+ queue.unshift(adjacent);
24706
+ }
24707
+ }
24708
+ }
24709
+ return graph;
24710
+ }
24711
+ function link(from, to) {
24712
+ return function(args) {
24713
+ return to(from(args));
24714
+ };
24715
+ }
24716
+ function wrapConversion(toModel, graph) {
24717
+ const path = [graph[toModel].parent, toModel];
24718
+ let fn = conversions_default[graph[toModel].parent][toModel];
24719
+ let cur = graph[toModel].parent;
24720
+ while (graph[cur].parent) {
24721
+ path.unshift(graph[cur].parent);
24722
+ fn = link(conversions_default[graph[cur].parent][cur], fn);
24723
+ cur = graph[cur].parent;
24724
+ }
24725
+ fn.conversion = path;
24726
+ return fn;
24727
+ }
24728
+ function route(fromModel) {
24729
+ const graph = deriveBFS(fromModel);
24730
+ const conversion = {};
24731
+ const models = Object.keys(graph);
24732
+ for (let { length } = models, i = 0;i < length; i++) {
24733
+ const toModel = models[i];
24734
+ const node = graph[toModel];
24735
+ if (node.parent === null) {
24736
+ continue;
24737
+ }
24738
+ conversion[toModel] = wrapConversion(toModel, graph);
24739
+ }
24740
+ return conversion;
24741
+ }
24742
+ var route_default = route;
24743
+
24744
+ // node_modules/color-convert/index.js
24745
+ var convert2 = {};
24746
+ var models = Object.keys(conversions_default);
24747
+ function wrapRaw(fn) {
24748
+ const wrappedFn = function(...args) {
24749
+ const arg0 = args[0];
24750
+ if (arg0 === undefined || arg0 === null) {
24751
+ return arg0;
24752
+ }
24753
+ if (arg0.length > 1) {
24754
+ args = arg0;
24755
+ }
24756
+ return fn(args);
24757
+ };
24758
+ if ("conversion" in fn) {
24759
+ wrappedFn.conversion = fn.conversion;
24760
+ }
24761
+ return wrappedFn;
24762
+ }
24763
+ function wrapRounded(fn) {
24764
+ const wrappedFn = function(...args) {
24765
+ const arg0 = args[0];
24766
+ if (arg0 === undefined || arg0 === null) {
24767
+ return arg0;
24768
+ }
24769
+ if (arg0.length > 1) {
24770
+ args = arg0;
24771
+ }
24772
+ const result = fn(args);
24773
+ if (typeof result === "object") {
24774
+ for (let { length } = result, i = 0;i < length; i++) {
24775
+ result[i] = Math.round(result[i]);
24776
+ }
24777
+ }
24778
+ return result;
24779
+ };
24780
+ if ("conversion" in fn) {
24781
+ wrappedFn.conversion = fn.conversion;
24782
+ }
24783
+ return wrappedFn;
24784
+ }
24785
+ for (const fromModel of models) {
24786
+ convert2[fromModel] = {};
24787
+ Object.defineProperty(convert2[fromModel], "channels", { value: conversions_default[fromModel].channels });
24788
+ Object.defineProperty(convert2[fromModel], "labels", { value: conversions_default[fromModel].labels });
24789
+ const routes = route_default(fromModel);
24790
+ const routeModels = Object.keys(routes);
24791
+ for (const toModel of routeModels) {
24792
+ const fn = routes[toModel];
24793
+ convert2[fromModel][toModel] = wrapRounded(fn);
24794
+ convert2[fromModel][toModel].raw = wrapRaw(fn);
24795
+ }
24796
+ }
24797
+ var color_convert_default = convert2;
24798
+
24799
+ // node_modules/color/index.js
24800
+ var skippedModels = [
24801
+ "keyword",
24802
+ "gray",
24803
+ "hex"
24804
+ ];
24805
+ var hashedModelKeys = {};
24806
+ for (const model of Object.keys(color_convert_default)) {
24807
+ hashedModelKeys[[...color_convert_default[model].labels].sort().join("")] = model;
24808
+ }
24809
+ var limiters = {};
24810
+ function Color(object, model) {
24811
+ if (!(this instanceof Color)) {
24812
+ return new Color(object, model);
24813
+ }
24814
+ if (model && model in skippedModels) {
24815
+ model = null;
24816
+ }
24817
+ if (model && !(model in color_convert_default)) {
24818
+ throw new Error("Unknown model: " + model);
24819
+ }
24820
+ let i;
24821
+ let channels;
24822
+ if (object == null) {
24823
+ this.model = "rgb";
24824
+ this.color = [0, 0, 0];
24825
+ this.valpha = 1;
24826
+ } else if (object instanceof Color) {
24827
+ this.model = object.model;
24828
+ this.color = [...object.color];
24829
+ this.valpha = object.valpha;
24830
+ } else if (typeof object === "string") {
24831
+ const result = color_string_default.get(object);
24832
+ if (result === null) {
24833
+ throw new Error("Unable to parse color from string: " + object);
24834
+ }
24835
+ this.model = result.model;
24836
+ channels = color_convert_default[this.model].channels;
24837
+ this.color = result.value.slice(0, channels);
24838
+ this.valpha = typeof result.value[channels] === "number" ? result.value[channels] : 1;
24839
+ } else if (object.length > 0) {
24840
+ this.model = model || "rgb";
24841
+ channels = color_convert_default[this.model].channels;
24842
+ const newArray = Array.prototype.slice.call(object, 0, channels);
24843
+ this.color = zeroArray(newArray, channels);
24844
+ this.valpha = typeof object[channels] === "number" ? object[channels] : 1;
24845
+ } else if (typeof object === "number") {
24846
+ this.model = "rgb";
24847
+ this.color = [
24848
+ object >> 16 & 255,
24849
+ object >> 8 & 255,
24850
+ object & 255
24851
+ ];
24852
+ this.valpha = 1;
24853
+ } else {
24854
+ this.valpha = 1;
24855
+ const keys = Object.keys(object);
24856
+ if ("alpha" in object) {
24857
+ keys.splice(keys.indexOf("alpha"), 1);
24858
+ this.valpha = typeof object.alpha === "number" ? object.alpha : 0;
24859
+ }
24860
+ const hashedKeys = keys.sort().join("");
24861
+ if (!(hashedKeys in hashedModelKeys)) {
24862
+ throw new Error("Unable to parse color from object: " + JSON.stringify(object));
24863
+ }
24864
+ this.model = hashedModelKeys[hashedKeys];
24865
+ const { labels } = color_convert_default[this.model];
24866
+ const color = [];
24867
+ for (i = 0;i < labels.length; i++) {
24868
+ color.push(object[labels[i]]);
24869
+ }
24870
+ this.color = zeroArray(color);
24871
+ }
24872
+ if (limiters[this.model]) {
24873
+ channels = color_convert_default[this.model].channels;
24874
+ for (i = 0;i < channels; i++) {
24875
+ const limit = limiters[this.model][i];
24876
+ if (limit) {
24877
+ this.color[i] = limit(this.color[i]);
24878
+ }
24879
+ }
24880
+ }
24881
+ this.valpha = Math.max(0, Math.min(1, this.valpha));
24882
+ if (Object.freeze) {
24883
+ Object.freeze(this);
24884
+ }
24885
+ }
24886
+ Color.prototype = {
24887
+ toString() {
24888
+ return this.string();
24889
+ },
24890
+ toJSON() {
24891
+ return this[this.model]();
24892
+ },
24893
+ string(places) {
24894
+ let self = this.model in color_string_default.to ? this : this.rgb();
24895
+ self = self.round(typeof places === "number" ? places : 1);
24896
+ const arguments_ = self.valpha === 1 ? self.color : [...self.color, this.valpha];
24897
+ return color_string_default.to[self.model](...arguments_);
24898
+ },
24899
+ percentString(places) {
24900
+ const self = this.rgb().round(typeof places === "number" ? places : 1);
24901
+ const arguments_ = self.valpha === 1 ? self.color : [...self.color, this.valpha];
24902
+ return color_string_default.to.rgb.percent(...arguments_);
24903
+ },
24904
+ array() {
24905
+ return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
24906
+ },
24907
+ object() {
24908
+ const result = {};
24909
+ const { channels } = color_convert_default[this.model];
24910
+ const { labels } = color_convert_default[this.model];
24911
+ for (let i = 0;i < channels; i++) {
24912
+ result[labels[i]] = this.color[i];
24913
+ }
24914
+ if (this.valpha !== 1) {
24915
+ result.alpha = this.valpha;
24916
+ }
24917
+ return result;
24918
+ },
24919
+ unitArray() {
24920
+ const rgb = this.rgb().color;
24921
+ rgb[0] /= 255;
24922
+ rgb[1] /= 255;
24923
+ rgb[2] /= 255;
24924
+ if (this.valpha !== 1) {
24925
+ rgb.push(this.valpha);
24926
+ }
24927
+ return rgb;
24928
+ },
24929
+ unitObject() {
24930
+ const rgb = this.rgb().object();
24931
+ rgb.r /= 255;
24932
+ rgb.g /= 255;
24933
+ rgb.b /= 255;
24934
+ if (this.valpha !== 1) {
24935
+ rgb.alpha = this.valpha;
24936
+ }
24937
+ return rgb;
24938
+ },
24939
+ round(places) {
24940
+ places = Math.max(places || 0, 0);
24941
+ return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
24942
+ },
24943
+ alpha(value) {
24944
+ if (value !== undefined) {
24945
+ return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
24946
+ }
24947
+ return this.valpha;
24948
+ },
24949
+ red: getset("rgb", 0, maxfn(255)),
24950
+ green: getset("rgb", 1, maxfn(255)),
24951
+ blue: getset("rgb", 2, maxfn(255)),
24952
+ hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (value) => (value % 360 + 360) % 360),
24953
+ saturationl: getset("hsl", 1, maxfn(100)),
24954
+ lightness: getset("hsl", 2, maxfn(100)),
24955
+ saturationv: getset("hsv", 1, maxfn(100)),
24956
+ value: getset("hsv", 2, maxfn(100)),
24957
+ chroma: getset("hcg", 1, maxfn(100)),
24958
+ gray: getset("hcg", 2, maxfn(100)),
24959
+ white: getset("hwb", 1, maxfn(100)),
24960
+ wblack: getset("hwb", 2, maxfn(100)),
24961
+ cyan: getset("cmyk", 0, maxfn(100)),
24962
+ magenta: getset("cmyk", 1, maxfn(100)),
24963
+ yellow: getset("cmyk", 2, maxfn(100)),
24964
+ black: getset("cmyk", 3, maxfn(100)),
24965
+ x: getset("xyz", 0, maxfn(95.047)),
24966
+ y: getset("xyz", 1, maxfn(100)),
24967
+ z: getset("xyz", 2, maxfn(108.833)),
24968
+ l: getset("lab", 0, maxfn(100)),
24969
+ a: getset("lab", 1),
24970
+ b: getset("lab", 2),
24971
+ keyword(value) {
24972
+ if (value !== undefined) {
24973
+ return new Color(value);
24974
+ }
24975
+ return color_convert_default[this.model].keyword(this.color);
24976
+ },
24977
+ hex(value) {
24978
+ if (value !== undefined) {
24979
+ return new Color(value);
24980
+ }
24981
+ return color_string_default.to.hex(...this.rgb().round().color);
24982
+ },
24983
+ hexa(value) {
24984
+ if (value !== undefined) {
24985
+ return new Color(value);
24986
+ }
24987
+ const rgbArray = this.rgb().round().color;
24988
+ let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
24989
+ if (alphaHex.length === 1) {
24990
+ alphaHex = "0" + alphaHex;
24991
+ }
24992
+ return color_string_default.to.hex(...rgbArray) + alphaHex;
24993
+ },
24994
+ rgbNumber() {
24995
+ const rgb = this.rgb().color;
24996
+ return (rgb[0] & 255) << 16 | (rgb[1] & 255) << 8 | rgb[2] & 255;
24997
+ },
24998
+ luminosity() {
24999
+ const rgb = this.rgb().color;
25000
+ const lum = [];
25001
+ for (const [i, element] of rgb.entries()) {
25002
+ const chan = element / 255;
25003
+ lum[i] = chan <= 0.04045 ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
25004
+ }
25005
+ return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
25006
+ },
25007
+ contrast(color2) {
25008
+ const lum1 = this.luminosity();
25009
+ const lum2 = color2.luminosity();
25010
+ if (lum1 > lum2) {
25011
+ return (lum1 + 0.05) / (lum2 + 0.05);
25012
+ }
25013
+ return (lum2 + 0.05) / (lum1 + 0.05);
25014
+ },
25015
+ level(color2) {
25016
+ const contrastRatio = this.contrast(color2);
25017
+ if (contrastRatio >= 7) {
25018
+ return "AAA";
25019
+ }
25020
+ return contrastRatio >= 4.5 ? "AA" : "";
25021
+ },
25022
+ isDark() {
25023
+ const rgb = this.rgb().color;
25024
+ const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 1e4;
25025
+ return yiq < 128;
25026
+ },
25027
+ isLight() {
25028
+ return !this.isDark();
25029
+ },
25030
+ negate() {
25031
+ const rgb = this.rgb();
25032
+ for (let i = 0;i < 3; i++) {
25033
+ rgb.color[i] = 255 - rgb.color[i];
25034
+ }
25035
+ return rgb;
25036
+ },
25037
+ lighten(ratio) {
25038
+ const hsl = this.hsl();
25039
+ hsl.color[2] += hsl.color[2] * ratio;
25040
+ return hsl;
25041
+ },
25042
+ darken(ratio) {
25043
+ const hsl = this.hsl();
25044
+ hsl.color[2] -= hsl.color[2] * ratio;
25045
+ return hsl;
25046
+ },
25047
+ saturate(ratio) {
25048
+ const hsl = this.hsl();
25049
+ hsl.color[1] += hsl.color[1] * ratio;
25050
+ return hsl;
25051
+ },
25052
+ desaturate(ratio) {
25053
+ const hsl = this.hsl();
25054
+ hsl.color[1] -= hsl.color[1] * ratio;
25055
+ return hsl;
25056
+ },
25057
+ whiten(ratio) {
25058
+ const hwb = this.hwb();
25059
+ hwb.color[1] += hwb.color[1] * ratio;
25060
+ return hwb;
25061
+ },
25062
+ blacken(ratio) {
25063
+ const hwb = this.hwb();
25064
+ hwb.color[2] += hwb.color[2] * ratio;
25065
+ return hwb;
25066
+ },
25067
+ grayscale() {
25068
+ const rgb = this.rgb().color;
25069
+ const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
25070
+ return Color.rgb(value, value, value);
25071
+ },
25072
+ fade(ratio) {
25073
+ return this.alpha(this.valpha - this.valpha * ratio);
25074
+ },
25075
+ opaquer(ratio) {
25076
+ return this.alpha(this.valpha + this.valpha * ratio);
25077
+ },
25078
+ rotate(degrees) {
25079
+ const hsl = this.hsl();
25080
+ let hue = hsl.color[0];
25081
+ hue = (hue + degrees) % 360;
25082
+ hue = hue < 0 ? 360 + hue : hue;
25083
+ hsl.color[0] = hue;
25084
+ return hsl;
25085
+ },
25086
+ mix(mixinColor, weight) {
25087
+ if (!mixinColor || !mixinColor.rgb) {
25088
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
25089
+ }
25090
+ const color1 = mixinColor.rgb();
25091
+ const color2 = this.rgb();
25092
+ const p = weight === undefined ? 0.5 : weight;
25093
+ const w = 2 * p - 1;
25094
+ const a = color1.alpha() - color2.alpha();
25095
+ const w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2;
25096
+ const w2 = 1 - w1;
25097
+ return Color.rgb(w1 * color1.red() + w2 * color2.red(), w1 * color1.green() + w2 * color2.green(), w1 * color1.blue() + w2 * color2.blue(), color1.alpha() * p + color2.alpha() * (1 - p));
25098
+ }
25099
+ };
25100
+ for (const model of Object.keys(color_convert_default)) {
25101
+ if (skippedModels.includes(model)) {
25102
+ continue;
25103
+ }
25104
+ const { channels } = color_convert_default[model];
25105
+ Color.prototype[model] = function(...arguments_) {
25106
+ if (this.model === model) {
25107
+ return new Color(this);
25108
+ }
25109
+ if (arguments_.length > 0) {
25110
+ return new Color(arguments_, model);
25111
+ }
25112
+ return new Color([...assertArray(color_convert_default[this.model][model].raw(this.color)), this.valpha], model);
25113
+ };
25114
+ Color[model] = function(...arguments_) {
25115
+ let color = arguments_[0];
25116
+ if (typeof color === "number") {
25117
+ color = zeroArray(arguments_, channels);
25118
+ }
25119
+ return new Color(color, model);
25120
+ };
25121
+ }
25122
+ function roundTo(number, places) {
25123
+ return Number(number.toFixed(places));
25124
+ }
25125
+ function roundToPlace(places) {
25126
+ return function(number) {
25127
+ return roundTo(number, places);
25128
+ };
25129
+ }
25130
+ function getset(model, channel, modifier) {
25131
+ model = Array.isArray(model) ? model : [model];
25132
+ for (const m of model) {
25133
+ (limiters[m] ||= [])[channel] = modifier;
25134
+ }
25135
+ model = model[0];
25136
+ return function(value) {
25137
+ let result;
25138
+ if (value !== undefined) {
25139
+ if (modifier) {
25140
+ value = modifier(value);
25141
+ }
25142
+ result = this[model]();
25143
+ result.color[channel] = value;
25144
+ return result;
25145
+ }
25146
+ result = this[model]().color[channel];
25147
+ if (modifier) {
25148
+ result = modifier(result);
25149
+ }
25150
+ return result;
25151
+ };
25152
+ }
25153
+ function maxfn(max) {
25154
+ return function(v) {
25155
+ return Math.max(0, Math.min(max, v));
25156
+ };
25157
+ }
25158
+ function assertArray(value) {
25159
+ return Array.isArray(value) ? value : [value];
25160
+ }
25161
+ function zeroArray(array, length) {
25162
+ for (let i = 0;i < length; i++) {
25163
+ if (typeof array[i] !== "number") {
25164
+ array[i] = 0;
25165
+ }
25166
+ }
25167
+ return array;
25168
+ }
25169
+ var color_default = Color;
25170
+
25171
+ // node_modules/circuit-to-svg-xray/dist/index.js
23597
25172
  import { applyToPoint as applyToPoint9 } from "transformation-matrix";
23598
25173
  import Debug from "debug";
23599
25174
  import { toString as matrixToString2 } from "transformation-matrix";
@@ -23625,8 +25200,6 @@ import {
23625
25200
  } from "transformation-matrix";
23626
25201
  import { lineAlphabet } from "@tscircuit/alphabet";
23627
25202
  import { lineAlphabet as lineAlphabet2 } from "@tscircuit/alphabet";
23628
- var import_svgson3 = __toESM(require_svgson_cjs(), 1);
23629
- var import_svgson4 = __toESM(require_svgson_cjs(), 1);
23630
25203
  import { applyToPoint as applyToPoint22 } from "transformation-matrix";
23631
25204
  import {
23632
25205
  applyToPoint as applyToPoint23,
@@ -23653,6 +25226,8 @@ import { distance as distance2 } from "circuit-json";
23653
25226
  import {
23654
25227
  distance as distance3
23655
25228
  } from "circuit-json";
25229
+ var import_svgson3 = __toESM(require_svgson_cjs(), 1);
25230
+ var import_svgson4 = __toESM(require_svgson_cjs(), 1);
23656
25231
  import { applyToPoint as applyToPoint32 } from "transformation-matrix";
23657
25232
  import { applyToPoint as applyToPoint34 } from "transformation-matrix";
23658
25233
  import { applyToPoint as applyToPoint36 } from "transformation-matrix";
@@ -23681,12 +25256,12 @@ import {
23681
25256
  translate as translate7
23682
25257
  } from "transformation-matrix";
23683
25258
  import { applyToPoint as applyToPoint43 } from "transformation-matrix";
23684
- var import_svgson5 = __toESM(require_svgson_cjs(), 1);
23685
- var import_svgson6 = __toESM(require_svgson_cjs(), 1);
23686
25259
  import { applyToPoint as applyToPoint44 } from "transformation-matrix";
23687
25260
  import { applyToPoint as applyToPoint45 } from "transformation-matrix";
23688
25261
  import { distance as distance5 } from "circuit-json";
23689
25262
  import { distance as distance6 } from "circuit-json";
25263
+ var import_svgson5 = __toESM(require_svgson_cjs(), 1);
25264
+ var import_svgson6 = __toESM(require_svgson_cjs(), 1);
23690
25265
  import { applyToPoint as applyToPoint46 } from "transformation-matrix";
23691
25266
  import { applyToPoint as applyToPoint47 } from "transformation-matrix";
23692
25267
  import { applyToPoint as applyToPoint48 } from "transformation-matrix";
@@ -23718,8 +25293,6 @@ import { applyToPoint as applyToPoint61 } from "transformation-matrix";
23718
25293
  import { applyToPoint as applyToPoint62 } from "transformation-matrix";
23719
25294
  import { calculateElbow } from "calculate-elbow";
23720
25295
  import { applyToPoint as applyToPoint63 } from "transformation-matrix";
23721
- var import_svgson7 = __toESM(require_svgson_cjs(), 1);
23722
- var import_svgson8 = __toESM(require_svgson_cjs(), 1);
23723
25296
  import { su as su6 } from "@tscircuit/circuit-json-util";
23724
25297
  import {
23725
25298
  applyToPoint as applyToPoint93,
@@ -23733,6 +25306,10 @@ import"schematic-symbols";
23733
25306
  import { compose as compose11, scale as scale5, translate as translate11 } from "transformation-matrix";
23734
25307
  import { symbols } from "schematic-symbols";
23735
25308
  import { applyToPoint as applyToPoint66 } from "transformation-matrix";
25309
+ var import_svgson7 = __toESM(require_svgson_cjs(), 1);
25310
+ var import_svgson8 = __toESM(require_svgson_cjs(), 1);
25311
+ var import_svgson9 = __toESM(require_svgson_cjs(), 1);
25312
+ var import_svgson10 = __toESM(require_svgson_cjs(), 1);
23736
25313
  import {
23737
25314
  applyToPoint as applyToPoint69,
23738
25315
  compose as compose13,
@@ -23779,13 +25356,11 @@ import { applyToPoint as applyToPoint86 } from "transformation-matrix";
23779
25356
  import { applyToPoint as applyToPoint87 } from "transformation-matrix";
23780
25357
  import { applyToPoint as applyToPoint88 } from "transformation-matrix";
23781
25358
  import { applyToPoint as applyToPoint89 } from "transformation-matrix";
23782
- var import_svgson9 = __toESM(require_svgson_cjs(), 1);
23783
- var import_svgson10 = __toESM(require_svgson_cjs(), 1);
23784
- var import_svgson11 = __toESM(require_svgson_cjs(), 1);
23785
25359
  import { applyToPoint as applyToPoint90 } from "transformation-matrix";
23786
25360
  import { applyToPoint as applyToPoint91 } from "transformation-matrix";
23787
25361
  import { applyToPoint as applyToPoint92 } from "transformation-matrix";
23788
25362
  import { applyToPoint as applyToPoint94, fromString } from "transformation-matrix";
25363
+ var import_svgson11 = __toESM(require_svgson_cjs(), 1);
23789
25364
  import { distance as distance8 } from "circuit-json";
23790
25365
  import {
23791
25366
  applyToPoint as applyToPoint95,
@@ -25170,25 +26745,38 @@ function createSvgObjectsFromPcbTraceClearanceError(error, circuitJson, ctx) {
25170
26745
  return annotateError2(svgObjects, error.type);
25171
26746
  }
25172
26747
  function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
25173
- const { transform, layer: layerFilter } = ctx;
25174
- if (!fabNotePath.route || !Array.isArray(fabNotePath.route))
26748
+ const { transform } = ctx;
26749
+ if (!Array.isArray(fabNotePath.route) || fabNotePath.route.length < 2)
25175
26750
  return [];
25176
26751
  const firstPoint = fabNotePath.route[0];
25177
26752
  const lastPoint = fabNotePath.route[fabNotePath.route.length - 1];
25178
- const isClosed = firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
25179
- const path = fabNotePath.route.slice(0, isClosed ? -1 : undefined).map((point, index) => {
26753
+ const repeatsFirstPoint = firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
26754
+ const path = fabNotePath.route.slice(0, repeatsFirstPoint ? -1 : undefined).map((point, index) => {
25180
26755
  const [x, y] = applyToPoint9(transform, [point.x, point.y]);
25181
26756
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
25182
- }).join(" ") + (isClosed ? " Z" : "");
26757
+ }).join(" ") + (repeatsFirstPoint || fabNotePath.is_filled ? " Z" : "");
26758
+ const color = fabNotePath.color || "rgba(255,255,255,0.5)";
26759
+ let paint = color;
26760
+ let opacity;
26761
+ if (fabNotePath.is_filled && fabNotePath.has_stroke !== false && fabNotePath.stroke_width > 0) {
26762
+ try {
26763
+ const parsedColor = color_default(color);
26764
+ if (parsedColor.alpha() < 1) {
26765
+ paint = parsedColor.alpha(1).rgb().string();
26766
+ opacity = parsedColor.alpha().toString();
26767
+ }
26768
+ } catch {}
26769
+ }
25183
26770
  return [
25184
26771
  {
25185
26772
  name: "path",
25186
26773
  type: "element",
25187
26774
  attributes: {
25188
26775
  class: "pcb-fabrication-note-path",
25189
- stroke: fabNotePath.color || "rgba(255,255,255,0.5)",
25190
- fill: "none",
26776
+ stroke: fabNotePath.has_stroke === false ? "none" : paint,
26777
+ fill: fabNotePath.is_filled ? paint : "none",
25191
26778
  d: path,
26779
+ ...opacity === undefined ? {} : { opacity },
25192
26780
  "stroke-width": (fabNotePath.stroke_width * Math.abs(transform.a)).toString(),
25193
26781
  "data-pcb-component-id": fabNotePath.pcb_component_id,
25194
26782
  "data-pcb-fabrication-note-path-id": fabNotePath.pcb_fabrication_note_path_id,
@@ -31749,7 +33337,7 @@ var package_default = {
31749
33337
  engines: {
31750
33338
  node: "24.x"
31751
33339
  },
31752
- version: "0.0.440",
33340
+ version: "0.0.443",
31753
33341
  repository: {
31754
33342
  type: "git",
31755
33343
  url: "https://github.com/tscircuit/circuit-to-svg.git"
@@ -31781,7 +33369,7 @@ var package_default = {
31781
33369
  "@vitejs/plugin-react": "5.0.0",
31782
33370
  biome: "^0.3.3",
31783
33371
  "bun-match-svg": "^0.0.12",
31784
- "circuit-json": "^0.0.513",
33372
+ "circuit-json": "^0.0.518",
31785
33373
  "circuit-json-to-connectivity-map": "^0.0.23",
31786
33374
  esbuild: "^0.20.2",
31787
33375
  "format-si-unit": "^0.0.12",
@@ -31807,6 +33395,7 @@ var package_default = {
31807
33395
  "@types/node": "^22.5.5",
31808
33396
  "bun-types": "^1.1.40",
31809
33397
  "calculate-elbow": "0.0.12",
33398
+ color: "^5.0.3",
31810
33399
  debug: "^4.4.3",
31811
33400
  "svg-path-commander": "^2.1.11",
31812
33401
  svgson: "^5.3.1",