@teselagen/ui 0.8.6-beta.25 → 0.8.6-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MenuBar/index.d.ts +3 -1
- package/Timeline/TimelineEvent.d.ts +7 -4
- package/Timeline/index.d.ts +5 -1
- package/index.cjs.js +1615 -1793
- package/index.d.ts +0 -1
- package/index.es.js +1615 -1793
- package/package.json +3 -3
- package/src/Timeline/TimelineEvent.tsx +36 -0
- package/src/Timeline/index.tsx +21 -0
- package/src/index.js +0 -1
- package/src/utils/browserUtils.ts +3 -0
- package/src/utils/determineBlackOrWhiteTextColor.ts +11 -0
- package/src/utils/getTextFromEl.ts +45 -0
- package/src/utils/handlerHelpers.ts +32 -0
- package/src/utils/hooks/index.ts +1 -0
- package/src/utils/hooks/useDeepEqualMemo.ts +10 -0
- package/src/utils/hooks/useStableReference.ts +9 -0
- package/src/utils/hotkeyUtils.tsx +155 -0
- package/src/utils/isBeingCalledExcessively.ts +37 -0
- package/utils/browserUtils.d.ts +1 -1
- package/utils/determineBlackOrWhiteTextColor.d.ts +1 -1
- package/utils/getTextFromEl.d.ts +8 -1
- package/utils/handlerHelpers.d.ts +7 -7
- package/utils/hooks/useDeepEqualMemo.d.ts +1 -2
- package/utils/hooks/useStableReference.d.ts +1 -1
- package/utils/hotkeyUtils.d.ts +21 -4
- package/utils/isBeingCalledExcessively.d.ts +3 -3
package/index.es.js
CHANGED
|
@@ -1515,10 +1515,10 @@ function debounce$1(fn5, ms) {
|
|
|
1515
1515
|
if (ms === 0) {
|
|
1516
1516
|
return fn5;
|
|
1517
1517
|
}
|
|
1518
|
-
var
|
|
1518
|
+
var timeout2;
|
|
1519
1519
|
return function(arg) {
|
|
1520
|
-
clearTimeout(
|
|
1521
|
-
|
|
1520
|
+
clearTimeout(timeout2);
|
|
1521
|
+
timeout2 = setTimeout(function() {
|
|
1522
1522
|
fn5(arg);
|
|
1523
1523
|
}, ms);
|
|
1524
1524
|
};
|
|
@@ -4639,19 +4639,15 @@ function requireClassnames() {
|
|
|
4639
4639
|
__name(requireClassnames, "requireClassnames");
|
|
4640
4640
|
var classnamesExports = requireClassnames();
|
|
4641
4641
|
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
id +=
|
|
4648
|
-
} else if (byte > 62) {
|
|
4649
|
-
id += "-";
|
|
4650
|
-
} else {
|
|
4651
|
-
id += "_";
|
|
4642
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
4643
|
+
let nanoid = /* @__PURE__ */ __name((size = 21) => {
|
|
4644
|
+
let id = "";
|
|
4645
|
+
let bytes = crypto.getRandomValues(new Uint8Array(size |= 0));
|
|
4646
|
+
while (size--) {
|
|
4647
|
+
id += urlAlphabet[bytes[size] & 63];
|
|
4652
4648
|
}
|
|
4653
4649
|
return id;
|
|
4654
|
-
}, "
|
|
4650
|
+
}, "nanoid");
|
|
4655
4651
|
var papaparse_min$1 = { exports: {} };
|
|
4656
4652
|
/* @license
|
|
4657
4653
|
Papa Parse
|
|
@@ -17057,7 +17053,7 @@ function rowClick(e, rowInfo, entities, {
|
|
|
17057
17053
|
if (noSelect || isEntityDisabled(entity)) return;
|
|
17058
17054
|
const rowId = getIdOrCodeOrIndex(entity, rowInfo.index);
|
|
17059
17055
|
if (rowId === void 0) return;
|
|
17060
|
-
const
|
|
17056
|
+
const ctrl2 = e.metaKey || e.ctrlKey || withCheckboxes && !e.shiftKey;
|
|
17061
17057
|
const oldIdMap = reduxFormSelectedEntityIdMap || {};
|
|
17062
17058
|
const rowSelected = oldIdMap[rowId];
|
|
17063
17059
|
let newIdMap = {
|
|
@@ -17069,12 +17065,12 @@ function rowClick(e, rowInfo, entities, {
|
|
|
17069
17065
|
if (isSingleSelect) {
|
|
17070
17066
|
if (rowSelected) newIdMap = {};
|
|
17071
17067
|
} else if (rowSelected && e.shiftKey) return;
|
|
17072
|
-
else if (rowSelected &&
|
|
17068
|
+
else if (rowSelected && ctrl2) {
|
|
17073
17069
|
newIdMap = __spreadValues({}, oldIdMap);
|
|
17074
17070
|
delete newIdMap[rowId];
|
|
17075
17071
|
} else if (rowSelected) {
|
|
17076
17072
|
newIdMap = {};
|
|
17077
|
-
} else if (
|
|
17073
|
+
} else if (ctrl2) {
|
|
17078
17074
|
newIdMap = __spreadValues(__spreadValues({}, oldIdMap), newIdMap);
|
|
17079
17075
|
} else if (e.shiftKey && !isEmpty$1(oldIdMap)) {
|
|
17080
17076
|
newIdMap = {
|
|
@@ -30237,11 +30233,20 @@ function requireFuzzysearch() {
|
|
|
30237
30233
|
__name(requireFuzzysearch, "requireFuzzysearch");
|
|
30238
30234
|
var fuzzysearchExports = requireFuzzysearch();
|
|
30239
30235
|
const fuzzysearch = /* @__PURE__ */ getDefaultExportFromCjs(fuzzysearchExports);
|
|
30236
|
+
const isReactElement = /* @__PURE__ */ __name((el) => {
|
|
30237
|
+
if (el) {
|
|
30238
|
+
const newEl = el;
|
|
30239
|
+
if (newEl.props && newEl.props.children) {
|
|
30240
|
+
return true;
|
|
30241
|
+
}
|
|
30242
|
+
}
|
|
30243
|
+
return false;
|
|
30244
|
+
}, "isReactElement");
|
|
30240
30245
|
function getTextFromEl(el, options = {}) {
|
|
30241
30246
|
const { lowerCase: lowerCase2 } = options;
|
|
30242
30247
|
if (React__default.isValidElement(el)) {
|
|
30243
|
-
return el && el.props && el.props.children ? (el.props.children
|
|
30244
|
-
if (child
|
|
30248
|
+
return el && el.props && el.props.children ? (Array.isArray(el.props.children) ? el.props.children : [el.props.children]).reduce((acc, child) => {
|
|
30249
|
+
if (isReactElement(child)) {
|
|
30245
30250
|
acc += getTextFromEl(child);
|
|
30246
30251
|
} else if (typeof child === "string") {
|
|
30247
30252
|
if (lowerCase2) {
|
|
@@ -30259,1795 +30264,1578 @@ function getTextFromEl(el, options = {}) {
|
|
|
30259
30264
|
}
|
|
30260
30265
|
}
|
|
30261
30266
|
__name(getTextFromEl, "getTextFromEl");
|
|
30262
|
-
|
|
30263
|
-
|
|
30264
|
-
|
|
30265
|
-
|
|
30266
|
-
|
|
30267
|
-
|
|
30268
|
-
|
|
30269
|
-
|
|
30270
|
-
|
|
30271
|
-
|
|
30272
|
-
|
|
30273
|
-
|
|
30274
|
-
|
|
30275
|
-
|
|
30276
|
-
|
|
30277
|
-
|
|
30278
|
-
|
|
30279
|
-
|
|
30280
|
-
|
|
30281
|
-
|
|
30282
|
-
|
|
30283
|
-
|
|
30284
|
-
|
|
30285
|
-
|
|
30286
|
-
|
|
30287
|
-
|
|
30288
|
-
|
|
30289
|
-
|
|
30290
|
-
|
|
30291
|
-
|
|
30292
|
-
|
|
30293
|
-
|
|
30294
|
-
|
|
30295
|
-
|
|
30296
|
-
|
|
30297
|
-
|
|
30298
|
-
|
|
30299
|
-
|
|
30300
|
-
|
|
30301
|
-
|
|
30302
|
-
|
|
30303
|
-
|
|
30304
|
-
|
|
30305
|
-
|
|
30306
|
-
|
|
30307
|
-
|
|
30308
|
-
|
|
30309
|
-
|
|
30310
|
-
|
|
30311
|
-
|
|
30312
|
-
|
|
30313
|
-
|
|
30314
|
-
|
|
30315
|
-
|
|
30316
|
-
|
|
30317
|
-
|
|
30318
|
-
|
|
30319
|
-
|
|
30320
|
-
|
|
30321
|
-
|
|
30322
|
-
|
|
30323
|
-
|
|
30324
|
-
|
|
30325
|
-
|
|
30326
|
-
|
|
30327
|
-
|
|
30328
|
-
|
|
30329
|
-
|
|
30330
|
-
|
|
30331
|
-
|
|
30332
|
-
|
|
30333
|
-
|
|
30334
|
-
|
|
30335
|
-
|
|
30336
|
-
|
|
30337
|
-
|
|
30338
|
-
|
|
30339
|
-
|
|
30340
|
-
|
|
30341
|
-
|
|
30342
|
-
|
|
30343
|
-
|
|
30344
|
-
|
|
30345
|
-
|
|
30346
|
-
|
|
30347
|
-
|
|
30348
|
-
|
|
30349
|
-
|
|
30350
|
-
|
|
30351
|
-
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30356
|
-
|
|
30357
|
-
|
|
30358
|
-
|
|
30359
|
-
|
|
30360
|
-
|
|
30361
|
-
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
|
|
30369
|
-
|
|
30370
|
-
|
|
30371
|
-
|
|
30372
|
-
|
|
30373
|
-
|
|
30374
|
-
|
|
30375
|
-
|
|
30376
|
-
|
|
30377
|
-
|
|
30378
|
-
|
|
30379
|
-
|
|
30380
|
-
|
|
30381
|
-
|
|
30382
|
-
|
|
30383
|
-
|
|
30384
|
-
|
|
30385
|
-
|
|
30386
|
-
|
|
30387
|
-
|
|
30388
|
-
|
|
30389
|
-
|
|
30390
|
-
|
|
30391
|
-
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30397
|
-
|
|
30398
|
-
|
|
30399
|
-
|
|
30400
|
-
|
|
30401
|
-
|
|
30402
|
-
|
|
30403
|
-
|
|
30404
|
-
|
|
30405
|
-
|
|
30406
|
-
|
|
30407
|
-
|
|
30408
|
-
|
|
30409
|
-
|
|
30410
|
-
|
|
30411
|
-
|
|
30412
|
-
|
|
30413
|
-
|
|
30414
|
-
|
|
30415
|
-
|
|
30416
|
-
|
|
30417
|
-
|
|
30418
|
-
|
|
30419
|
-
}
|
|
30420
|
-
|
|
30421
|
-
|
|
30422
|
-
|
|
30423
|
-
|
|
30424
|
-
|
|
30425
|
-
|
|
30426
|
-
|
|
30427
|
-
|
|
30428
|
-
|
|
30429
|
-
|
|
30267
|
+
const cssKeywords = {
|
|
30268
|
+
aliceblue: [240, 248, 255],
|
|
30269
|
+
antiquewhite: [250, 235, 215],
|
|
30270
|
+
aqua: [0, 255, 255],
|
|
30271
|
+
aquamarine: [127, 255, 212],
|
|
30272
|
+
azure: [240, 255, 255],
|
|
30273
|
+
beige: [245, 245, 220],
|
|
30274
|
+
bisque: [255, 228, 196],
|
|
30275
|
+
black: [0, 0, 0],
|
|
30276
|
+
blanchedalmond: [255, 235, 205],
|
|
30277
|
+
blue: [0, 0, 255],
|
|
30278
|
+
blueviolet: [138, 43, 226],
|
|
30279
|
+
brown: [165, 42, 42],
|
|
30280
|
+
burlywood: [222, 184, 135],
|
|
30281
|
+
cadetblue: [95, 158, 160],
|
|
30282
|
+
chartreuse: [127, 255, 0],
|
|
30283
|
+
chocolate: [210, 105, 30],
|
|
30284
|
+
coral: [255, 127, 80],
|
|
30285
|
+
cornflowerblue: [100, 149, 237],
|
|
30286
|
+
cornsilk: [255, 248, 220],
|
|
30287
|
+
crimson: [220, 20, 60],
|
|
30288
|
+
cyan: [0, 255, 255],
|
|
30289
|
+
darkblue: [0, 0, 139],
|
|
30290
|
+
darkcyan: [0, 139, 139],
|
|
30291
|
+
darkgoldenrod: [184, 134, 11],
|
|
30292
|
+
darkgray: [169, 169, 169],
|
|
30293
|
+
darkgreen: [0, 100, 0],
|
|
30294
|
+
darkgrey: [169, 169, 169],
|
|
30295
|
+
darkkhaki: [189, 183, 107],
|
|
30296
|
+
darkmagenta: [139, 0, 139],
|
|
30297
|
+
darkolivegreen: [85, 107, 47],
|
|
30298
|
+
darkorange: [255, 140, 0],
|
|
30299
|
+
darkorchid: [153, 50, 204],
|
|
30300
|
+
darkred: [139, 0, 0],
|
|
30301
|
+
darksalmon: [233, 150, 122],
|
|
30302
|
+
darkseagreen: [143, 188, 143],
|
|
30303
|
+
darkslateblue: [72, 61, 139],
|
|
30304
|
+
darkslategray: [47, 79, 79],
|
|
30305
|
+
darkslategrey: [47, 79, 79],
|
|
30306
|
+
darkturquoise: [0, 206, 209],
|
|
30307
|
+
darkviolet: [148, 0, 211],
|
|
30308
|
+
deeppink: [255, 20, 147],
|
|
30309
|
+
deepskyblue: [0, 191, 255],
|
|
30310
|
+
dimgray: [105, 105, 105],
|
|
30311
|
+
dimgrey: [105, 105, 105],
|
|
30312
|
+
dodgerblue: [30, 144, 255],
|
|
30313
|
+
firebrick: [178, 34, 34],
|
|
30314
|
+
floralwhite: [255, 250, 240],
|
|
30315
|
+
forestgreen: [34, 139, 34],
|
|
30316
|
+
fuchsia: [255, 0, 255],
|
|
30317
|
+
gainsboro: [220, 220, 220],
|
|
30318
|
+
ghostwhite: [248, 248, 255],
|
|
30319
|
+
gold: [255, 215, 0],
|
|
30320
|
+
goldenrod: [218, 165, 32],
|
|
30321
|
+
gray: [128, 128, 128],
|
|
30322
|
+
green: [0, 128, 0],
|
|
30323
|
+
greenyellow: [173, 255, 47],
|
|
30324
|
+
grey: [128, 128, 128],
|
|
30325
|
+
honeydew: [240, 255, 240],
|
|
30326
|
+
hotpink: [255, 105, 180],
|
|
30327
|
+
indianred: [205, 92, 92],
|
|
30328
|
+
indigo: [75, 0, 130],
|
|
30329
|
+
ivory: [255, 255, 240],
|
|
30330
|
+
khaki: [240, 230, 140],
|
|
30331
|
+
lavender: [230, 230, 250],
|
|
30332
|
+
lavenderblush: [255, 240, 245],
|
|
30333
|
+
lawngreen: [124, 252, 0],
|
|
30334
|
+
lemonchiffon: [255, 250, 205],
|
|
30335
|
+
lightblue: [173, 216, 230],
|
|
30336
|
+
lightcoral: [240, 128, 128],
|
|
30337
|
+
lightcyan: [224, 255, 255],
|
|
30338
|
+
lightgoldenrodyellow: [250, 250, 210],
|
|
30339
|
+
lightgray: [211, 211, 211],
|
|
30340
|
+
lightgreen: [144, 238, 144],
|
|
30341
|
+
lightgrey: [211, 211, 211],
|
|
30342
|
+
lightpink: [255, 182, 193],
|
|
30343
|
+
lightsalmon: [255, 160, 122],
|
|
30344
|
+
lightseagreen: [32, 178, 170],
|
|
30345
|
+
lightskyblue: [135, 206, 250],
|
|
30346
|
+
lightslategray: [119, 136, 153],
|
|
30347
|
+
lightslategrey: [119, 136, 153],
|
|
30348
|
+
lightsteelblue: [176, 196, 222],
|
|
30349
|
+
lightyellow: [255, 255, 224],
|
|
30350
|
+
lime: [0, 255, 0],
|
|
30351
|
+
limegreen: [50, 205, 50],
|
|
30352
|
+
linen: [250, 240, 230],
|
|
30353
|
+
magenta: [255, 0, 255],
|
|
30354
|
+
maroon: [128, 0, 0],
|
|
30355
|
+
mediumaquamarine: [102, 205, 170],
|
|
30356
|
+
mediumblue: [0, 0, 205],
|
|
30357
|
+
mediumorchid: [186, 85, 211],
|
|
30358
|
+
mediumpurple: [147, 112, 219],
|
|
30359
|
+
mediumseagreen: [60, 179, 113],
|
|
30360
|
+
mediumslateblue: [123, 104, 238],
|
|
30361
|
+
mediumspringgreen: [0, 250, 154],
|
|
30362
|
+
mediumturquoise: [72, 209, 204],
|
|
30363
|
+
mediumvioletred: [199, 21, 133],
|
|
30364
|
+
midnightblue: [25, 25, 112],
|
|
30365
|
+
mintcream: [245, 255, 250],
|
|
30366
|
+
mistyrose: [255, 228, 225],
|
|
30367
|
+
moccasin: [255, 228, 181],
|
|
30368
|
+
navajowhite: [255, 222, 173],
|
|
30369
|
+
navy: [0, 0, 128],
|
|
30370
|
+
oldlace: [253, 245, 230],
|
|
30371
|
+
olive: [128, 128, 0],
|
|
30372
|
+
olivedrab: [107, 142, 35],
|
|
30373
|
+
orange: [255, 165, 0],
|
|
30374
|
+
orangered: [255, 69, 0],
|
|
30375
|
+
orchid: [218, 112, 214],
|
|
30376
|
+
palegoldenrod: [238, 232, 170],
|
|
30377
|
+
palegreen: [152, 251, 152],
|
|
30378
|
+
paleturquoise: [175, 238, 238],
|
|
30379
|
+
palevioletred: [219, 112, 147],
|
|
30380
|
+
papayawhip: [255, 239, 213],
|
|
30381
|
+
peachpuff: [255, 218, 185],
|
|
30382
|
+
peru: [205, 133, 63],
|
|
30383
|
+
pink: [255, 192, 203],
|
|
30384
|
+
plum: [221, 160, 221],
|
|
30385
|
+
powderblue: [176, 224, 230],
|
|
30386
|
+
purple: [128, 0, 128],
|
|
30387
|
+
rebeccapurple: [102, 51, 153],
|
|
30388
|
+
red: [255, 0, 0],
|
|
30389
|
+
rosybrown: [188, 143, 143],
|
|
30390
|
+
royalblue: [65, 105, 225],
|
|
30391
|
+
saddlebrown: [139, 69, 19],
|
|
30392
|
+
salmon: [250, 128, 114],
|
|
30393
|
+
sandybrown: [244, 164, 96],
|
|
30394
|
+
seagreen: [46, 139, 87],
|
|
30395
|
+
seashell: [255, 245, 238],
|
|
30396
|
+
sienna: [160, 82, 45],
|
|
30397
|
+
silver: [192, 192, 192],
|
|
30398
|
+
skyblue: [135, 206, 235],
|
|
30399
|
+
slateblue: [106, 90, 205],
|
|
30400
|
+
slategray: [112, 128, 144],
|
|
30401
|
+
slategrey: [112, 128, 144],
|
|
30402
|
+
snow: [255, 250, 250],
|
|
30403
|
+
springgreen: [0, 255, 127],
|
|
30404
|
+
steelblue: [70, 130, 180],
|
|
30405
|
+
tan: [210, 180, 140],
|
|
30406
|
+
teal: [0, 128, 128],
|
|
30407
|
+
thistle: [216, 191, 216],
|
|
30408
|
+
tomato: [255, 99, 71],
|
|
30409
|
+
turquoise: [64, 224, 208],
|
|
30410
|
+
violet: [238, 130, 238],
|
|
30411
|
+
wheat: [245, 222, 179],
|
|
30412
|
+
white: [255, 255, 255],
|
|
30413
|
+
whitesmoke: [245, 245, 245],
|
|
30414
|
+
yellow: [255, 255, 0],
|
|
30415
|
+
yellowgreen: [154, 205, 50]
|
|
30416
|
+
};
|
|
30417
|
+
const reverseNames = /* @__PURE__ */ Object.create(null);
|
|
30418
|
+
for (const name2 in cssKeywords) {
|
|
30419
|
+
if (Object.hasOwn(cssKeywords, name2)) {
|
|
30420
|
+
reverseNames[cssKeywords[name2]] = name2;
|
|
30421
|
+
}
|
|
30422
|
+
}
|
|
30423
|
+
const cs = {
|
|
30424
|
+
to: {},
|
|
30425
|
+
get: {}
|
|
30426
|
+
};
|
|
30427
|
+
cs.get = function(string2) {
|
|
30428
|
+
const prefix2 = string2.slice(0, 3).toLowerCase();
|
|
30429
|
+
let value;
|
|
30430
|
+
let model;
|
|
30431
|
+
switch (prefix2) {
|
|
30432
|
+
case "hsl": {
|
|
30433
|
+
value = cs.get.hsl(string2);
|
|
30434
|
+
model = "hsl";
|
|
30435
|
+
break;
|
|
30430
30436
|
}
|
|
30431
|
-
|
|
30432
|
-
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
__name(requireIsArrayish, "requireIsArrayish");
|
|
30436
|
-
var hasRequiredSimpleSwizzle;
|
|
30437
|
-
function requireSimpleSwizzle() {
|
|
30438
|
-
if (hasRequiredSimpleSwizzle) return simpleSwizzle.exports;
|
|
30439
|
-
hasRequiredSimpleSwizzle = 1;
|
|
30440
|
-
var isArrayish2 = requireIsArrayish();
|
|
30441
|
-
var concat = Array.prototype.concat;
|
|
30442
|
-
var slice = Array.prototype.slice;
|
|
30443
|
-
var swizzle = simpleSwizzle.exports = /* @__PURE__ */ __name(function swizzle2(args) {
|
|
30444
|
-
var results = [];
|
|
30445
|
-
for (var i2 = 0, len = args.length; i2 < len; i2++) {
|
|
30446
|
-
var arg = args[i2];
|
|
30447
|
-
if (isArrayish2(arg)) {
|
|
30448
|
-
results = concat.call(results, slice.call(arg));
|
|
30449
|
-
} else {
|
|
30450
|
-
results.push(arg);
|
|
30451
|
-
}
|
|
30437
|
+
case "hwb": {
|
|
30438
|
+
value = cs.get.hwb(string2);
|
|
30439
|
+
model = "hwb";
|
|
30440
|
+
break;
|
|
30452
30441
|
}
|
|
30453
|
-
|
|
30454
|
-
|
|
30455
|
-
|
|
30456
|
-
|
|
30457
|
-
return fn4(swizzle(arguments));
|
|
30458
|
-
};
|
|
30459
|
-
};
|
|
30460
|
-
return simpleSwizzle.exports;
|
|
30461
|
-
}
|
|
30462
|
-
__name(requireSimpleSwizzle, "requireSimpleSwizzle");
|
|
30463
|
-
var hasRequiredColorString;
|
|
30464
|
-
function requireColorString() {
|
|
30465
|
-
if (hasRequiredColorString) return colorString.exports;
|
|
30466
|
-
hasRequiredColorString = 1;
|
|
30467
|
-
var colorNames = requireColorName$1();
|
|
30468
|
-
var swizzle = requireSimpleSwizzle();
|
|
30469
|
-
var hasOwnProperty2 = Object.hasOwnProperty;
|
|
30470
|
-
var reverseNames = /* @__PURE__ */ Object.create(null);
|
|
30471
|
-
for (var name2 in colorNames) {
|
|
30472
|
-
if (hasOwnProperty2.call(colorNames, name2)) {
|
|
30473
|
-
reverseNames[colorNames[name2]] = name2;
|
|
30474
|
-
}
|
|
30475
|
-
}
|
|
30476
|
-
var cs = colorString.exports = {
|
|
30477
|
-
to: {},
|
|
30478
|
-
get: {}
|
|
30479
|
-
};
|
|
30480
|
-
cs.get = function(string2) {
|
|
30481
|
-
var prefix2 = string2.substring(0, 3).toLowerCase();
|
|
30482
|
-
var val;
|
|
30483
|
-
var model;
|
|
30484
|
-
switch (prefix2) {
|
|
30485
|
-
case "hsl":
|
|
30486
|
-
val = cs.get.hsl(string2);
|
|
30487
|
-
model = "hsl";
|
|
30488
|
-
break;
|
|
30489
|
-
case "hwb":
|
|
30490
|
-
val = cs.get.hwb(string2);
|
|
30491
|
-
model = "hwb";
|
|
30492
|
-
break;
|
|
30493
|
-
default:
|
|
30494
|
-
val = cs.get.rgb(string2);
|
|
30495
|
-
model = "rgb";
|
|
30496
|
-
break;
|
|
30442
|
+
default: {
|
|
30443
|
+
value = cs.get.rgb(string2);
|
|
30444
|
+
model = "rgb";
|
|
30445
|
+
break;
|
|
30497
30446
|
}
|
|
30498
|
-
|
|
30499
|
-
|
|
30447
|
+
}
|
|
30448
|
+
if (!value) {
|
|
30449
|
+
return null;
|
|
30450
|
+
}
|
|
30451
|
+
return { model, value };
|
|
30452
|
+
};
|
|
30453
|
+
cs.get.rgb = function(string2) {
|
|
30454
|
+
if (!string2) {
|
|
30455
|
+
return null;
|
|
30456
|
+
}
|
|
30457
|
+
const abbr = /^#([a-f\d]{3,4})$/i;
|
|
30458
|
+
const hex = /^#([a-f\d]{6})([a-f\d]{2})?$/i;
|
|
30459
|
+
const rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
|
|
30460
|
+
const per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
|
|
30461
|
+
const keyword = /^(\w+)$/;
|
|
30462
|
+
let rgb = [0, 0, 0, 1];
|
|
30463
|
+
let match;
|
|
30464
|
+
let i2;
|
|
30465
|
+
let hexAlpha;
|
|
30466
|
+
if (match = string2.match(hex)) {
|
|
30467
|
+
hexAlpha = match[2];
|
|
30468
|
+
match = match[1];
|
|
30469
|
+
for (i2 = 0; i2 < 3; i2++) {
|
|
30470
|
+
const i22 = i2 * 2;
|
|
30471
|
+
rgb[i2] = Number.parseInt(match.slice(i22, i22 + 2), 16);
|
|
30500
30472
|
}
|
|
30501
|
-
|
|
30502
|
-
|
|
30503
|
-
cs.get.rgb = function(string2) {
|
|
30504
|
-
if (!string2) {
|
|
30505
|
-
return null;
|
|
30473
|
+
if (hexAlpha) {
|
|
30474
|
+
rgb[3] = Number.parseInt(hexAlpha, 16) / 255;
|
|
30506
30475
|
}
|
|
30507
|
-
|
|
30508
|
-
|
|
30509
|
-
|
|
30510
|
-
|
|
30511
|
-
|
|
30512
|
-
var rgb = [0, 0, 0, 1];
|
|
30513
|
-
var match;
|
|
30514
|
-
var i2;
|
|
30515
|
-
var hexAlpha;
|
|
30516
|
-
if (match = string2.match(hex)) {
|
|
30517
|
-
hexAlpha = match[2];
|
|
30518
|
-
match = match[1];
|
|
30519
|
-
for (i2 = 0; i2 < 3; i2++) {
|
|
30520
|
-
var i22 = i2 * 2;
|
|
30521
|
-
rgb[i2] = parseInt(match.slice(i22, i22 + 2), 16);
|
|
30522
|
-
}
|
|
30523
|
-
if (hexAlpha) {
|
|
30524
|
-
rgb[3] = parseInt(hexAlpha, 16) / 255;
|
|
30525
|
-
}
|
|
30526
|
-
} else if (match = string2.match(abbr)) {
|
|
30527
|
-
match = match[1];
|
|
30528
|
-
hexAlpha = match[3];
|
|
30529
|
-
for (i2 = 0; i2 < 3; i2++) {
|
|
30530
|
-
rgb[i2] = parseInt(match[i2] + match[i2], 16);
|
|
30531
|
-
}
|
|
30532
|
-
if (hexAlpha) {
|
|
30533
|
-
rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
30534
|
-
}
|
|
30535
|
-
} else if (match = string2.match(rgba)) {
|
|
30536
|
-
for (i2 = 0; i2 < 3; i2++) {
|
|
30537
|
-
rgb[i2] = parseInt(match[i2 + 1], 0);
|
|
30538
|
-
}
|
|
30539
|
-
if (match[4]) {
|
|
30540
|
-
if (match[5]) {
|
|
30541
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
30542
|
-
} else {
|
|
30543
|
-
rgb[3] = parseFloat(match[4]);
|
|
30544
|
-
}
|
|
30545
|
-
}
|
|
30546
|
-
} else if (match = string2.match(per)) {
|
|
30547
|
-
for (i2 = 0; i2 < 3; i2++) {
|
|
30548
|
-
rgb[i2] = Math.round(parseFloat(match[i2 + 1]) * 2.55);
|
|
30549
|
-
}
|
|
30550
|
-
if (match[4]) {
|
|
30551
|
-
if (match[5]) {
|
|
30552
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
30553
|
-
} else {
|
|
30554
|
-
rgb[3] = parseFloat(match[4]);
|
|
30555
|
-
}
|
|
30556
|
-
}
|
|
30557
|
-
} else if (match = string2.match(keyword)) {
|
|
30558
|
-
if (match[1] === "transparent") {
|
|
30559
|
-
return [0, 0, 0, 0];
|
|
30560
|
-
}
|
|
30561
|
-
if (!hasOwnProperty2.call(colorNames, match[1])) {
|
|
30562
|
-
return null;
|
|
30563
|
-
}
|
|
30564
|
-
rgb = colorNames[match[1]];
|
|
30565
|
-
rgb[3] = 1;
|
|
30566
|
-
return rgb;
|
|
30567
|
-
} else {
|
|
30568
|
-
return null;
|
|
30476
|
+
} else if (match = string2.match(abbr)) {
|
|
30477
|
+
match = match[1];
|
|
30478
|
+
hexAlpha = match[3];
|
|
30479
|
+
for (i2 = 0; i2 < 3; i2++) {
|
|
30480
|
+
rgb[i2] = Number.parseInt(match[i2] + match[i2], 16);
|
|
30569
30481
|
}
|
|
30482
|
+
if (hexAlpha) {
|
|
30483
|
+
rgb[3] = Number.parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
30484
|
+
}
|
|
30485
|
+
} else if (match = string2.match(rgba)) {
|
|
30570
30486
|
for (i2 = 0; i2 < 3; i2++) {
|
|
30571
|
-
rgb[i2] =
|
|
30487
|
+
rgb[i2] = Number.parseInt(match[i2 + 1], 10);
|
|
30572
30488
|
}
|
|
30573
|
-
|
|
30574
|
-
|
|
30575
|
-
};
|
|
30576
|
-
cs.get.hsl = function(string2) {
|
|
30577
|
-
if (!string2) {
|
|
30578
|
-
return null;
|
|
30489
|
+
if (match[4]) {
|
|
30490
|
+
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
30579
30491
|
}
|
|
30580
|
-
|
|
30581
|
-
|
|
30582
|
-
|
|
30583
|
-
var alpha = parseFloat(match[4]);
|
|
30584
|
-
var h2 = (parseFloat(match[1]) % 360 + 360) % 360;
|
|
30585
|
-
var s2 = clamp2(parseFloat(match[2]), 0, 100);
|
|
30586
|
-
var l2 = clamp2(parseFloat(match[3]), 0, 100);
|
|
30587
|
-
var a2 = clamp2(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
30588
|
-
return [h2, s2, l2, a2];
|
|
30492
|
+
} else if (match = string2.match(per)) {
|
|
30493
|
+
for (i2 = 0; i2 < 3; i2++) {
|
|
30494
|
+
rgb[i2] = Math.round(Number.parseFloat(match[i2 + 1]) * 2.55);
|
|
30589
30495
|
}
|
|
30590
|
-
|
|
30591
|
-
|
|
30592
|
-
cs.get.hwb = function(string2) {
|
|
30593
|
-
if (!string2) {
|
|
30594
|
-
return null;
|
|
30496
|
+
if (match[4]) {
|
|
30497
|
+
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
30595
30498
|
}
|
|
30596
|
-
|
|
30597
|
-
|
|
30598
|
-
|
|
30599
|
-
var alpha = parseFloat(match[4]);
|
|
30600
|
-
var h2 = (parseFloat(match[1]) % 360 + 360) % 360;
|
|
30601
|
-
var w2 = clamp2(parseFloat(match[2]), 0, 100);
|
|
30602
|
-
var b2 = clamp2(parseFloat(match[3]), 0, 100);
|
|
30603
|
-
var a2 = clamp2(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
30604
|
-
return [h2, w2, b2, a2];
|
|
30499
|
+
} else if (match = string2.match(keyword)) {
|
|
30500
|
+
if (match[1] === "transparent") {
|
|
30501
|
+
return [0, 0, 0, 0];
|
|
30605
30502
|
}
|
|
30606
|
-
|
|
30607
|
-
|
|
30608
|
-
cs.to.hex = function() {
|
|
30609
|
-
var rgba = swizzle(arguments);
|
|
30610
|
-
return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
|
|
30611
|
-
};
|
|
30612
|
-
cs.to.rgb = function() {
|
|
30613
|
-
var rgba = swizzle(arguments);
|
|
30614
|
-
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] + ")";
|
|
30615
|
-
};
|
|
30616
|
-
cs.to.rgb.percent = function() {
|
|
30617
|
-
var rgba = swizzle(arguments);
|
|
30618
|
-
var r2 = Math.round(rgba[0] / 255 * 100);
|
|
30619
|
-
var g2 = Math.round(rgba[1] / 255 * 100);
|
|
30620
|
-
var b2 = Math.round(rgba[2] / 255 * 100);
|
|
30621
|
-
return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r2 + "%, " + g2 + "%, " + b2 + "%)" : "rgba(" + r2 + "%, " + g2 + "%, " + b2 + "%, " + rgba[3] + ")";
|
|
30622
|
-
};
|
|
30623
|
-
cs.to.hsl = function() {
|
|
30624
|
-
var hsla = swizzle(arguments);
|
|
30625
|
-
return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
|
|
30626
|
-
};
|
|
30627
|
-
cs.to.hwb = function() {
|
|
30628
|
-
var hwba = swizzle(arguments);
|
|
30629
|
-
var a2 = "";
|
|
30630
|
-
if (hwba.length >= 4 && hwba[3] !== 1) {
|
|
30631
|
-
a2 = ", " + hwba[3];
|
|
30503
|
+
if (!Object.hasOwn(cssKeywords, match[1])) {
|
|
30504
|
+
return null;
|
|
30632
30505
|
}
|
|
30633
|
-
|
|
30634
|
-
|
|
30635
|
-
|
|
30636
|
-
|
|
30637
|
-
|
|
30638
|
-
|
|
30639
|
-
|
|
30640
|
-
|
|
30641
|
-
|
|
30642
|
-
|
|
30643
|
-
|
|
30644
|
-
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
|
|
30648
|
-
}
|
|
30649
|
-
|
|
30650
|
-
|
|
30651
|
-
|
|
30652
|
-
|
|
30653
|
-
|
|
30654
|
-
|
|
30655
|
-
|
|
30656
|
-
|
|
30657
|
-
|
|
30658
|
-
|
|
30659
|
-
|
|
30660
|
-
|
|
30661
|
-
|
|
30662
|
-
|
|
30663
|
-
|
|
30664
|
-
|
|
30665
|
-
|
|
30666
|
-
|
|
30667
|
-
|
|
30668
|
-
|
|
30669
|
-
|
|
30670
|
-
|
|
30671
|
-
|
|
30672
|
-
|
|
30673
|
-
|
|
30674
|
-
|
|
30675
|
-
|
|
30676
|
-
|
|
30677
|
-
|
|
30678
|
-
|
|
30679
|
-
|
|
30680
|
-
|
|
30681
|
-
|
|
30682
|
-
|
|
30683
|
-
|
|
30684
|
-
|
|
30685
|
-
|
|
30686
|
-
|
|
30687
|
-
|
|
30688
|
-
|
|
30689
|
-
|
|
30690
|
-
|
|
30691
|
-
|
|
30692
|
-
|
|
30693
|
-
|
|
30694
|
-
|
|
30695
|
-
"
|
|
30696
|
-
|
|
30697
|
-
|
|
30698
|
-
|
|
30699
|
-
|
|
30700
|
-
|
|
30701
|
-
|
|
30702
|
-
|
|
30703
|
-
|
|
30704
|
-
|
|
30705
|
-
|
|
30706
|
-
|
|
30707
|
-
|
|
30708
|
-
|
|
30709
|
-
|
|
30710
|
-
|
|
30711
|
-
|
|
30712
|
-
|
|
30713
|
-
|
|
30714
|
-
|
|
30715
|
-
|
|
30716
|
-
|
|
30717
|
-
|
|
30718
|
-
|
|
30719
|
-
|
|
30720
|
-
|
|
30721
|
-
|
|
30722
|
-
|
|
30723
|
-
|
|
30724
|
-
|
|
30725
|
-
|
|
30726
|
-
|
|
30727
|
-
|
|
30728
|
-
|
|
30729
|
-
|
|
30730
|
-
|
|
30731
|
-
|
|
30732
|
-
|
|
30733
|
-
|
|
30734
|
-
|
|
30735
|
-
|
|
30736
|
-
|
|
30737
|
-
|
|
30738
|
-
|
|
30739
|
-
|
|
30740
|
-
|
|
30741
|
-
|
|
30742
|
-
|
|
30743
|
-
|
|
30744
|
-
|
|
30745
|
-
|
|
30746
|
-
"
|
|
30747
|
-
|
|
30748
|
-
|
|
30749
|
-
"
|
|
30750
|
-
|
|
30751
|
-
|
|
30752
|
-
"
|
|
30753
|
-
|
|
30754
|
-
|
|
30755
|
-
|
|
30756
|
-
|
|
30757
|
-
|
|
30758
|
-
|
|
30759
|
-
|
|
30760
|
-
|
|
30761
|
-
|
|
30762
|
-
|
|
30763
|
-
|
|
30764
|
-
|
|
30765
|
-
|
|
30766
|
-
|
|
30767
|
-
|
|
30768
|
-
|
|
30769
|
-
|
|
30770
|
-
|
|
30771
|
-
"peru": [205, 133, 63],
|
|
30772
|
-
"pink": [255, 192, 203],
|
|
30773
|
-
"plum": [221, 160, 221],
|
|
30774
|
-
"powderblue": [176, 224, 230],
|
|
30775
|
-
"purple": [128, 0, 128],
|
|
30776
|
-
"rebeccapurple": [102, 51, 153],
|
|
30777
|
-
"red": [255, 0, 0],
|
|
30778
|
-
"rosybrown": [188, 143, 143],
|
|
30779
|
-
"royalblue": [65, 105, 225],
|
|
30780
|
-
"saddlebrown": [139, 69, 19],
|
|
30781
|
-
"salmon": [250, 128, 114],
|
|
30782
|
-
"sandybrown": [244, 164, 96],
|
|
30783
|
-
"seagreen": [46, 139, 87],
|
|
30784
|
-
"seashell": [255, 245, 238],
|
|
30785
|
-
"sienna": [160, 82, 45],
|
|
30786
|
-
"silver": [192, 192, 192],
|
|
30787
|
-
"skyblue": [135, 206, 235],
|
|
30788
|
-
"slateblue": [106, 90, 205],
|
|
30789
|
-
"slategray": [112, 128, 144],
|
|
30790
|
-
"slategrey": [112, 128, 144],
|
|
30791
|
-
"snow": [255, 250, 250],
|
|
30792
|
-
"springgreen": [0, 255, 127],
|
|
30793
|
-
"steelblue": [70, 130, 180],
|
|
30794
|
-
"tan": [210, 180, 140],
|
|
30795
|
-
"teal": [0, 128, 128],
|
|
30796
|
-
"thistle": [216, 191, 216],
|
|
30797
|
-
"tomato": [255, 99, 71],
|
|
30798
|
-
"turquoise": [64, 224, 208],
|
|
30799
|
-
"violet": [238, 130, 238],
|
|
30800
|
-
"wheat": [245, 222, 179],
|
|
30801
|
-
"white": [255, 255, 255],
|
|
30802
|
-
"whitesmoke": [245, 245, 245],
|
|
30803
|
-
"yellow": [255, 255, 0],
|
|
30804
|
-
"yellowgreen": [154, 205, 50]
|
|
30805
|
-
};
|
|
30806
|
-
return colorName;
|
|
30807
|
-
}
|
|
30808
|
-
__name(requireColorName, "requireColorName");
|
|
30809
|
-
var hasRequiredConversions;
|
|
30810
|
-
function requireConversions() {
|
|
30811
|
-
if (hasRequiredConversions) return conversions.exports;
|
|
30812
|
-
hasRequiredConversions = 1;
|
|
30813
|
-
var cssKeywords = requireColorName();
|
|
30814
|
-
var reverseKeywords = {};
|
|
30815
|
-
for (var key in cssKeywords) {
|
|
30816
|
-
if (cssKeywords.hasOwnProperty(key)) {
|
|
30817
|
-
reverseKeywords[cssKeywords[key]] = key;
|
|
30818
|
-
}
|
|
30819
|
-
}
|
|
30820
|
-
var convert2 = conversions.exports = {
|
|
30821
|
-
rgb: { channels: 3, labels: "rgb" },
|
|
30822
|
-
hsl: { channels: 3, labels: "hsl" },
|
|
30823
|
-
hsv: { channels: 3, labels: "hsv" },
|
|
30824
|
-
hwb: { channels: 3, labels: "hwb" },
|
|
30825
|
-
cmyk: { channels: 4, labels: "cmyk" },
|
|
30826
|
-
xyz: { channels: 3, labels: "xyz" },
|
|
30827
|
-
lab: { channels: 3, labels: "lab" },
|
|
30828
|
-
lch: { channels: 3, labels: "lch" },
|
|
30829
|
-
hex: { channels: 1, labels: ["hex"] },
|
|
30830
|
-
keyword: { channels: 1, labels: ["keyword"] },
|
|
30831
|
-
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
30832
|
-
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
30833
|
-
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
30834
|
-
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
30835
|
-
gray: { channels: 1, labels: ["gray"] }
|
|
30836
|
-
};
|
|
30837
|
-
for (var model in convert2) {
|
|
30838
|
-
if (convert2.hasOwnProperty(model)) {
|
|
30839
|
-
if (!("channels" in convert2[model])) {
|
|
30840
|
-
throw new Error("missing channels property: " + model);
|
|
30841
|
-
}
|
|
30842
|
-
if (!("labels" in convert2[model])) {
|
|
30843
|
-
throw new Error("missing channel labels property: " + model);
|
|
30844
|
-
}
|
|
30845
|
-
if (convert2[model].labels.length !== convert2[model].channels) {
|
|
30846
|
-
throw new Error("channel and label counts mismatch: " + model);
|
|
30847
|
-
}
|
|
30848
|
-
var channels = convert2[model].channels;
|
|
30849
|
-
var labels = convert2[model].labels;
|
|
30850
|
-
delete convert2[model].channels;
|
|
30851
|
-
delete convert2[model].labels;
|
|
30852
|
-
Object.defineProperty(convert2[model], "channels", { value: channels });
|
|
30853
|
-
Object.defineProperty(convert2[model], "labels", { value: labels });
|
|
30854
|
-
}
|
|
30855
|
-
}
|
|
30856
|
-
convert2.rgb.hsl = function(rgb) {
|
|
30857
|
-
var r2 = rgb[0] / 255;
|
|
30858
|
-
var g2 = rgb[1] / 255;
|
|
30859
|
-
var b2 = rgb[2] / 255;
|
|
30860
|
-
var min2 = Math.min(r2, g2, b2);
|
|
30861
|
-
var max2 = Math.max(r2, g2, b2);
|
|
30862
|
-
var delta = max2 - min2;
|
|
30863
|
-
var h2;
|
|
30864
|
-
var s2;
|
|
30865
|
-
var l2;
|
|
30866
|
-
if (max2 === min2) {
|
|
30506
|
+
rgb = cssKeywords[match[1]];
|
|
30507
|
+
rgb[3] = 1;
|
|
30508
|
+
return rgb;
|
|
30509
|
+
} else {
|
|
30510
|
+
return null;
|
|
30511
|
+
}
|
|
30512
|
+
for (i2 = 0; i2 < 3; i2++) {
|
|
30513
|
+
rgb[i2] = clamp$2(rgb[i2], 0, 255);
|
|
30514
|
+
}
|
|
30515
|
+
rgb[3] = clamp$2(rgb[3], 0, 1);
|
|
30516
|
+
return rgb;
|
|
30517
|
+
};
|
|
30518
|
+
cs.get.hsl = function(string2) {
|
|
30519
|
+
if (!string2) {
|
|
30520
|
+
return null;
|
|
30521
|
+
}
|
|
30522
|
+
const hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
30523
|
+
const match = string2.match(hsl);
|
|
30524
|
+
if (match) {
|
|
30525
|
+
const alpha = Number.parseFloat(match[4]);
|
|
30526
|
+
const h2 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
30527
|
+
const s2 = clamp$2(Number.parseFloat(match[2]), 0, 100);
|
|
30528
|
+
const l2 = clamp$2(Number.parseFloat(match[3]), 0, 100);
|
|
30529
|
+
const a2 = clamp$2(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
30530
|
+
return [h2, s2, l2, a2];
|
|
30531
|
+
}
|
|
30532
|
+
return null;
|
|
30533
|
+
};
|
|
30534
|
+
cs.get.hwb = function(string2) {
|
|
30535
|
+
if (!string2) {
|
|
30536
|
+
return null;
|
|
30537
|
+
}
|
|
30538
|
+
const hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
30539
|
+
const match = string2.match(hwb);
|
|
30540
|
+
if (match) {
|
|
30541
|
+
const alpha = Number.parseFloat(match[4]);
|
|
30542
|
+
const h2 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
30543
|
+
const w2 = clamp$2(Number.parseFloat(match[2]), 0, 100);
|
|
30544
|
+
const b2 = clamp$2(Number.parseFloat(match[3]), 0, 100);
|
|
30545
|
+
const a2 = clamp$2(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
30546
|
+
return [h2, w2, b2, a2];
|
|
30547
|
+
}
|
|
30548
|
+
return null;
|
|
30549
|
+
};
|
|
30550
|
+
cs.to.hex = function(...rgba) {
|
|
30551
|
+
return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
|
|
30552
|
+
};
|
|
30553
|
+
cs.to.rgb = function(...rgba) {
|
|
30554
|
+
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] + ")";
|
|
30555
|
+
};
|
|
30556
|
+
cs.to.rgb.percent = function(...rgba) {
|
|
30557
|
+
const r2 = Math.round(rgba[0] / 255 * 100);
|
|
30558
|
+
const g2 = Math.round(rgba[1] / 255 * 100);
|
|
30559
|
+
const b2 = Math.round(rgba[2] / 255 * 100);
|
|
30560
|
+
return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r2 + "%, " + g2 + "%, " + b2 + "%)" : "rgba(" + r2 + "%, " + g2 + "%, " + b2 + "%, " + rgba[3] + ")";
|
|
30561
|
+
};
|
|
30562
|
+
cs.to.hsl = function(...hsla) {
|
|
30563
|
+
return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
|
|
30564
|
+
};
|
|
30565
|
+
cs.to.hwb = function(...hwba) {
|
|
30566
|
+
let a2 = "";
|
|
30567
|
+
if (hwba.length >= 4 && hwba[3] !== 1) {
|
|
30568
|
+
a2 = ", " + hwba[3];
|
|
30569
|
+
}
|
|
30570
|
+
return "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a2 + ")";
|
|
30571
|
+
};
|
|
30572
|
+
cs.to.keyword = function(...rgb) {
|
|
30573
|
+
return reverseNames[rgb.slice(0, 3)];
|
|
30574
|
+
};
|
|
30575
|
+
function clamp$2(number_, min2, max2) {
|
|
30576
|
+
return Math.min(Math.max(min2, number_), max2);
|
|
30577
|
+
}
|
|
30578
|
+
__name(clamp$2, "clamp$2");
|
|
30579
|
+
function hexDouble(number_) {
|
|
30580
|
+
const string_ = Math.round(number_).toString(16).toUpperCase();
|
|
30581
|
+
return string_.length < 2 ? "0" + string_ : string_;
|
|
30582
|
+
}
|
|
30583
|
+
__name(hexDouble, "hexDouble");
|
|
30584
|
+
const reverseKeywords = {};
|
|
30585
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
30586
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
30587
|
+
}
|
|
30588
|
+
const convert$2 = {
|
|
30589
|
+
rgb: { channels: 3, labels: "rgb" },
|
|
30590
|
+
hsl: { channels: 3, labels: "hsl" },
|
|
30591
|
+
hsv: { channels: 3, labels: "hsv" },
|
|
30592
|
+
hwb: { channels: 3, labels: "hwb" },
|
|
30593
|
+
cmyk: { channels: 4, labels: "cmyk" },
|
|
30594
|
+
xyz: { channels: 3, labels: "xyz" },
|
|
30595
|
+
lab: { channels: 3, labels: "lab" },
|
|
30596
|
+
oklab: { channels: 3, labels: ["okl", "oka", "okb"] },
|
|
30597
|
+
lch: { channels: 3, labels: "lch" },
|
|
30598
|
+
oklch: { channels: 3, labels: ["okl", "okc", "okh"] },
|
|
30599
|
+
hex: { channels: 1, labels: ["hex"] },
|
|
30600
|
+
keyword: { channels: 1, labels: ["keyword"] },
|
|
30601
|
+
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
30602
|
+
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
30603
|
+
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
30604
|
+
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
30605
|
+
gray: { channels: 1, labels: ["gray"] }
|
|
30606
|
+
};
|
|
30607
|
+
const LAB_FT = __pow(6 / 29, 3);
|
|
30608
|
+
function srgbNonlinearTransform(c2) {
|
|
30609
|
+
const cc = c2 > 31308e-7 ? 1.055 * __pow(c2, 1 / 2.4) - 0.055 : c2 * 12.92;
|
|
30610
|
+
return Math.min(Math.max(0, cc), 1);
|
|
30611
|
+
}
|
|
30612
|
+
__name(srgbNonlinearTransform, "srgbNonlinearTransform");
|
|
30613
|
+
function srgbNonlinearTransformInv(c2) {
|
|
30614
|
+
return c2 > 0.04045 ? __pow((c2 + 0.055) / 1.055, 2.4) : c2 / 12.92;
|
|
30615
|
+
}
|
|
30616
|
+
__name(srgbNonlinearTransformInv, "srgbNonlinearTransformInv");
|
|
30617
|
+
for (const model of Object.keys(convert$2)) {
|
|
30618
|
+
if (!("channels" in convert$2[model])) {
|
|
30619
|
+
throw new Error("missing channels property: " + model);
|
|
30620
|
+
}
|
|
30621
|
+
if (!("labels" in convert$2[model])) {
|
|
30622
|
+
throw new Error("missing channel labels property: " + model);
|
|
30623
|
+
}
|
|
30624
|
+
if (convert$2[model].labels.length !== convert$2[model].channels) {
|
|
30625
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
30626
|
+
}
|
|
30627
|
+
const { channels, labels } = convert$2[model];
|
|
30628
|
+
delete convert$2[model].channels;
|
|
30629
|
+
delete convert$2[model].labels;
|
|
30630
|
+
Object.defineProperty(convert$2[model], "channels", { value: channels });
|
|
30631
|
+
Object.defineProperty(convert$2[model], "labels", { value: labels });
|
|
30632
|
+
}
|
|
30633
|
+
convert$2.rgb.hsl = function(rgb) {
|
|
30634
|
+
const r2 = rgb[0] / 255;
|
|
30635
|
+
const g2 = rgb[1] / 255;
|
|
30636
|
+
const b2 = rgb[2] / 255;
|
|
30637
|
+
const min2 = Math.min(r2, g2, b2);
|
|
30638
|
+
const max2 = Math.max(r2, g2, b2);
|
|
30639
|
+
const delta = max2 - min2;
|
|
30640
|
+
let h2;
|
|
30641
|
+
let s2;
|
|
30642
|
+
switch (max2) {
|
|
30643
|
+
case min2: {
|
|
30867
30644
|
h2 = 0;
|
|
30868
|
-
|
|
30645
|
+
break;
|
|
30646
|
+
}
|
|
30647
|
+
case r2: {
|
|
30869
30648
|
h2 = (g2 - b2) / delta;
|
|
30870
|
-
|
|
30871
|
-
h2 = 2 + (b2 - r2) / delta;
|
|
30872
|
-
} else if (b2 === max2) {
|
|
30873
|
-
h2 = 4 + (r2 - g2) / delta;
|
|
30649
|
+
break;
|
|
30874
30650
|
}
|
|
30875
|
-
|
|
30876
|
-
|
|
30877
|
-
|
|
30651
|
+
case g2: {
|
|
30652
|
+
h2 = 2 + (b2 - r2) / delta;
|
|
30653
|
+
break;
|
|
30878
30654
|
}
|
|
30879
|
-
|
|
30880
|
-
|
|
30881
|
-
|
|
30882
|
-
} else if (l2 <= 0.5) {
|
|
30883
|
-
s2 = delta / (max2 + min2);
|
|
30884
|
-
} else {
|
|
30885
|
-
s2 = delta / (2 - max2 - min2);
|
|
30655
|
+
case b2: {
|
|
30656
|
+
h2 = 4 + (r2 - g2) / delta;
|
|
30657
|
+
break;
|
|
30886
30658
|
}
|
|
30887
|
-
|
|
30888
|
-
|
|
30889
|
-
|
|
30890
|
-
|
|
30891
|
-
|
|
30892
|
-
|
|
30893
|
-
|
|
30894
|
-
|
|
30895
|
-
|
|
30896
|
-
|
|
30897
|
-
|
|
30898
|
-
|
|
30899
|
-
|
|
30900
|
-
|
|
30901
|
-
|
|
30902
|
-
|
|
30903
|
-
|
|
30904
|
-
|
|
30905
|
-
|
|
30906
|
-
|
|
30907
|
-
|
|
30908
|
-
|
|
30909
|
-
|
|
30910
|
-
|
|
30659
|
+
}
|
|
30660
|
+
h2 = Math.min(h2 * 60, 360);
|
|
30661
|
+
if (h2 < 0) {
|
|
30662
|
+
h2 += 360;
|
|
30663
|
+
}
|
|
30664
|
+
const l2 = (min2 + max2) / 2;
|
|
30665
|
+
if (max2 === min2) {
|
|
30666
|
+
s2 = 0;
|
|
30667
|
+
} else if (l2 <= 0.5) {
|
|
30668
|
+
s2 = delta / (max2 + min2);
|
|
30669
|
+
} else {
|
|
30670
|
+
s2 = delta / (2 - max2 - min2);
|
|
30671
|
+
}
|
|
30672
|
+
return [h2, s2 * 100, l2 * 100];
|
|
30673
|
+
};
|
|
30674
|
+
convert$2.rgb.hsv = function(rgb) {
|
|
30675
|
+
let rdif;
|
|
30676
|
+
let gdif;
|
|
30677
|
+
let bdif;
|
|
30678
|
+
let h2;
|
|
30679
|
+
let s2;
|
|
30680
|
+
const r2 = rgb[0] / 255;
|
|
30681
|
+
const g2 = rgb[1] / 255;
|
|
30682
|
+
const b2 = rgb[2] / 255;
|
|
30683
|
+
const v2 = Math.max(r2, g2, b2);
|
|
30684
|
+
const diff = v2 - Math.min(r2, g2, b2);
|
|
30685
|
+
const diffc = /* @__PURE__ */ __name(function(c2) {
|
|
30686
|
+
return (v2 - c2) / 6 / diff + 1 / 2;
|
|
30687
|
+
}, "diffc");
|
|
30688
|
+
if (diff === 0) {
|
|
30689
|
+
h2 = 0;
|
|
30690
|
+
s2 = 0;
|
|
30691
|
+
} else {
|
|
30692
|
+
s2 = diff / v2;
|
|
30693
|
+
rdif = diffc(r2);
|
|
30694
|
+
gdif = diffc(g2);
|
|
30695
|
+
bdif = diffc(b2);
|
|
30696
|
+
switch (v2) {
|
|
30697
|
+
case r2: {
|
|
30911
30698
|
h2 = bdif - gdif;
|
|
30912
|
-
|
|
30699
|
+
break;
|
|
30700
|
+
}
|
|
30701
|
+
case g2: {
|
|
30913
30702
|
h2 = 1 / 3 + rdif - bdif;
|
|
30914
|
-
|
|
30915
|
-
h2 = 2 / 3 + gdif - rdif;
|
|
30703
|
+
break;
|
|
30916
30704
|
}
|
|
30917
|
-
|
|
30918
|
-
h2
|
|
30919
|
-
|
|
30920
|
-
h2 -= 1;
|
|
30705
|
+
case b2: {
|
|
30706
|
+
h2 = 2 / 3 + gdif - rdif;
|
|
30707
|
+
break;
|
|
30921
30708
|
}
|
|
30922
30709
|
}
|
|
30923
|
-
|
|
30924
|
-
h2
|
|
30925
|
-
|
|
30926
|
-
|
|
30927
|
-
|
|
30928
|
-
};
|
|
30929
|
-
convert2.rgb.hwb = function(rgb) {
|
|
30930
|
-
var r2 = rgb[0];
|
|
30931
|
-
var g2 = rgb[1];
|
|
30932
|
-
var b2 = rgb[2];
|
|
30933
|
-
var h2 = convert2.rgb.hsl(rgb)[0];
|
|
30934
|
-
var w2 = 1 / 255 * Math.min(r2, Math.min(g2, b2));
|
|
30935
|
-
b2 = 1 - 1 / 255 * Math.max(r2, Math.max(g2, b2));
|
|
30936
|
-
return [h2, w2 * 100, b2 * 100];
|
|
30937
|
-
};
|
|
30938
|
-
convert2.rgb.cmyk = function(rgb) {
|
|
30939
|
-
var r2 = rgb[0] / 255;
|
|
30940
|
-
var g2 = rgb[1] / 255;
|
|
30941
|
-
var b2 = rgb[2] / 255;
|
|
30942
|
-
var c2;
|
|
30943
|
-
var m2;
|
|
30944
|
-
var y2;
|
|
30945
|
-
var k2;
|
|
30946
|
-
k2 = Math.min(1 - r2, 1 - g2, 1 - b2);
|
|
30947
|
-
c2 = (1 - r2 - k2) / (1 - k2) || 0;
|
|
30948
|
-
m2 = (1 - g2 - k2) / (1 - k2) || 0;
|
|
30949
|
-
y2 = (1 - b2 - k2) / (1 - k2) || 0;
|
|
30950
|
-
return [c2 * 100, m2 * 100, y2 * 100, k2 * 100];
|
|
30951
|
-
};
|
|
30952
|
-
function comparativeDistance(x2, y2) {
|
|
30953
|
-
return Math.pow(x2[0] - y2[0], 2) + Math.pow(x2[1] - y2[1], 2) + Math.pow(x2[2] - y2[2], 2);
|
|
30710
|
+
if (h2 < 0) {
|
|
30711
|
+
h2 += 1;
|
|
30712
|
+
} else if (h2 > 1) {
|
|
30713
|
+
h2 -= 1;
|
|
30714
|
+
}
|
|
30954
30715
|
}
|
|
30955
|
-
|
|
30956
|
-
|
|
30957
|
-
|
|
30958
|
-
|
|
30959
|
-
|
|
30716
|
+
return [
|
|
30717
|
+
h2 * 360,
|
|
30718
|
+
s2 * 100,
|
|
30719
|
+
v2 * 100
|
|
30720
|
+
];
|
|
30721
|
+
};
|
|
30722
|
+
convert$2.rgb.hwb = function(rgb) {
|
|
30723
|
+
const r2 = rgb[0];
|
|
30724
|
+
const g2 = rgb[1];
|
|
30725
|
+
let b2 = rgb[2];
|
|
30726
|
+
const h2 = convert$2.rgb.hsl(rgb)[0];
|
|
30727
|
+
const w2 = 1 / 255 * Math.min(r2, Math.min(g2, b2));
|
|
30728
|
+
b2 = 1 - 1 / 255 * Math.max(r2, Math.max(g2, b2));
|
|
30729
|
+
return [h2, w2 * 100, b2 * 100];
|
|
30730
|
+
};
|
|
30731
|
+
convert$2.rgb.oklab = function(rgb) {
|
|
30732
|
+
const r2 = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
30733
|
+
const g2 = srgbNonlinearTransformInv(rgb[1] / 255);
|
|
30734
|
+
const b2 = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
30735
|
+
const lp = Math.cbrt(0.4122214708 * r2 + 0.5363325363 * g2 + 0.0514459929 * b2);
|
|
30736
|
+
const mp = Math.cbrt(0.2119034982 * r2 + 0.6806995451 * g2 + 0.1073969566 * b2);
|
|
30737
|
+
const sp = Math.cbrt(0.0883024619 * r2 + 0.2817188376 * g2 + 0.6299787005 * b2);
|
|
30738
|
+
const l2 = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
30739
|
+
const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
30740
|
+
const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
30741
|
+
return [l2 * 100, aa * 100, bb * 100];
|
|
30742
|
+
};
|
|
30743
|
+
convert$2.rgb.cmyk = function(rgb) {
|
|
30744
|
+
const r2 = rgb[0] / 255;
|
|
30745
|
+
const g2 = rgb[1] / 255;
|
|
30746
|
+
const b2 = rgb[2] / 255;
|
|
30747
|
+
const k2 = Math.min(1 - r2, 1 - g2, 1 - b2);
|
|
30748
|
+
const c2 = (1 - r2 - k2) / (1 - k2) || 0;
|
|
30749
|
+
const m2 = (1 - g2 - k2) / (1 - k2) || 0;
|
|
30750
|
+
const y2 = (1 - b2 - k2) / (1 - k2) || 0;
|
|
30751
|
+
return [c2 * 100, m2 * 100, y2 * 100, k2 * 100];
|
|
30752
|
+
};
|
|
30753
|
+
function comparativeDistance(x2, y2) {
|
|
30754
|
+
return __pow(x2[0] - y2[0], 2) + __pow(x2[1] - y2[1], 2) + __pow(x2[2] - y2[2], 2);
|
|
30755
|
+
}
|
|
30756
|
+
__name(comparativeDistance, "comparativeDistance");
|
|
30757
|
+
convert$2.rgb.keyword = function(rgb) {
|
|
30758
|
+
const reversed = reverseKeywords[rgb];
|
|
30759
|
+
if (reversed) {
|
|
30760
|
+
return reversed;
|
|
30761
|
+
}
|
|
30762
|
+
let currentClosestDistance = Number.POSITIVE_INFINITY;
|
|
30763
|
+
let currentClosestKeyword;
|
|
30764
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
30765
|
+
const value = cssKeywords[keyword];
|
|
30766
|
+
const distance = comparativeDistance(rgb, value);
|
|
30767
|
+
if (distance < currentClosestDistance) {
|
|
30768
|
+
currentClosestDistance = distance;
|
|
30769
|
+
currentClosestKeyword = keyword;
|
|
30770
|
+
}
|
|
30771
|
+
}
|
|
30772
|
+
return currentClosestKeyword;
|
|
30773
|
+
};
|
|
30774
|
+
convert$2.keyword.rgb = function(keyword) {
|
|
30775
|
+
return cssKeywords[keyword];
|
|
30776
|
+
};
|
|
30777
|
+
convert$2.rgb.xyz = function(rgb) {
|
|
30778
|
+
const r2 = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
30779
|
+
const g2 = srgbNonlinearTransformInv(rgb[1] / 255);
|
|
30780
|
+
const b2 = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
30781
|
+
const x2 = r2 * 0.4124564 + g2 * 0.3575761 + b2 * 0.1804375;
|
|
30782
|
+
const y2 = r2 * 0.2126729 + g2 * 0.7151522 + b2 * 0.072175;
|
|
30783
|
+
const z2 = r2 * 0.0193339 + g2 * 0.119192 + b2 * 0.9503041;
|
|
30784
|
+
return [x2 * 100, y2 * 100, z2 * 100];
|
|
30785
|
+
};
|
|
30786
|
+
convert$2.rgb.lab = function(rgb) {
|
|
30787
|
+
const xyz = convert$2.rgb.xyz(rgb);
|
|
30788
|
+
let x2 = xyz[0];
|
|
30789
|
+
let y2 = xyz[1];
|
|
30790
|
+
let z2 = xyz[2];
|
|
30791
|
+
x2 /= 95.047;
|
|
30792
|
+
y2 /= 100;
|
|
30793
|
+
z2 /= 108.883;
|
|
30794
|
+
x2 = x2 > LAB_FT ? __pow(x2, 1 / 3) : 7.787 * x2 + 16 / 116;
|
|
30795
|
+
y2 = y2 > LAB_FT ? __pow(y2, 1 / 3) : 7.787 * y2 + 16 / 116;
|
|
30796
|
+
z2 = z2 > LAB_FT ? __pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
|
|
30797
|
+
const l2 = 116 * y2 - 16;
|
|
30798
|
+
const a2 = 500 * (x2 - y2);
|
|
30799
|
+
const b2 = 200 * (y2 - z2);
|
|
30800
|
+
return [l2, a2, b2];
|
|
30801
|
+
};
|
|
30802
|
+
convert$2.hsl.rgb = function(hsl) {
|
|
30803
|
+
const h2 = hsl[0] / 360;
|
|
30804
|
+
const s2 = hsl[1] / 100;
|
|
30805
|
+
const l2 = hsl[2] / 100;
|
|
30806
|
+
let t3;
|
|
30807
|
+
let value;
|
|
30808
|
+
if (s2 === 0) {
|
|
30809
|
+
value = l2 * 255;
|
|
30810
|
+
return [value, value, value];
|
|
30811
|
+
}
|
|
30812
|
+
const t2 = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
|
|
30813
|
+
const t1 = 2 * l2 - t2;
|
|
30814
|
+
const rgb = [0, 0, 0];
|
|
30815
|
+
for (let i2 = 0; i2 < 3; i2++) {
|
|
30816
|
+
t3 = h2 + 1 / 3 * -(i2 - 1);
|
|
30817
|
+
if (t3 < 0) {
|
|
30818
|
+
t3++;
|
|
30819
|
+
}
|
|
30820
|
+
if (t3 > 1) {
|
|
30821
|
+
t3--;
|
|
30822
|
+
}
|
|
30823
|
+
if (6 * t3 < 1) {
|
|
30824
|
+
value = t1 + (t2 - t1) * 6 * t3;
|
|
30825
|
+
} else if (2 * t3 < 1) {
|
|
30826
|
+
value = t2;
|
|
30827
|
+
} else if (3 * t3 < 2) {
|
|
30828
|
+
value = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
30829
|
+
} else {
|
|
30830
|
+
value = t1;
|
|
30960
30831
|
}
|
|
30961
|
-
|
|
30962
|
-
|
|
30963
|
-
|
|
30964
|
-
|
|
30965
|
-
|
|
30966
|
-
|
|
30967
|
-
|
|
30968
|
-
|
|
30969
|
-
|
|
30970
|
-
|
|
30971
|
-
|
|
30832
|
+
rgb[i2] = value * 255;
|
|
30833
|
+
}
|
|
30834
|
+
return rgb;
|
|
30835
|
+
};
|
|
30836
|
+
convert$2.hsl.hsv = function(hsl) {
|
|
30837
|
+
const h2 = hsl[0];
|
|
30838
|
+
let s2 = hsl[1] / 100;
|
|
30839
|
+
let l2 = hsl[2] / 100;
|
|
30840
|
+
let smin = s2;
|
|
30841
|
+
const lmin = Math.max(l2, 0.01);
|
|
30842
|
+
l2 *= 2;
|
|
30843
|
+
s2 *= l2 <= 1 ? l2 : 2 - l2;
|
|
30844
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
30845
|
+
const v2 = (l2 + s2) / 2;
|
|
30846
|
+
const sv = l2 === 0 ? 2 * smin / (lmin + smin) : 2 * s2 / (l2 + s2);
|
|
30847
|
+
return [h2, sv * 100, v2 * 100];
|
|
30848
|
+
};
|
|
30849
|
+
convert$2.hsv.rgb = function(hsv) {
|
|
30850
|
+
const h2 = hsv[0] / 60;
|
|
30851
|
+
const s2 = hsv[1] / 100;
|
|
30852
|
+
let v2 = hsv[2] / 100;
|
|
30853
|
+
const hi = Math.floor(h2) % 6;
|
|
30854
|
+
const f2 = h2 - Math.floor(h2);
|
|
30855
|
+
const p2 = 255 * v2 * (1 - s2);
|
|
30856
|
+
const q2 = 255 * v2 * (1 - s2 * f2);
|
|
30857
|
+
const t2 = 255 * v2 * (1 - s2 * (1 - f2));
|
|
30858
|
+
v2 *= 255;
|
|
30859
|
+
switch (hi) {
|
|
30860
|
+
case 0: {
|
|
30861
|
+
return [v2, t2, p2];
|
|
30972
30862
|
}
|
|
30973
|
-
|
|
30974
|
-
|
|
30975
|
-
convert2.keyword.rgb = function(keyword) {
|
|
30976
|
-
return cssKeywords[keyword];
|
|
30977
|
-
};
|
|
30978
|
-
convert2.rgb.xyz = function(rgb) {
|
|
30979
|
-
var r2 = rgb[0] / 255;
|
|
30980
|
-
var g2 = rgb[1] / 255;
|
|
30981
|
-
var b2 = rgb[2] / 255;
|
|
30982
|
-
r2 = r2 > 0.04045 ? Math.pow((r2 + 0.055) / 1.055, 2.4) : r2 / 12.92;
|
|
30983
|
-
g2 = g2 > 0.04045 ? Math.pow((g2 + 0.055) / 1.055, 2.4) : g2 / 12.92;
|
|
30984
|
-
b2 = b2 > 0.04045 ? Math.pow((b2 + 0.055) / 1.055, 2.4) : b2 / 12.92;
|
|
30985
|
-
var x2 = r2 * 0.4124 + g2 * 0.3576 + b2 * 0.1805;
|
|
30986
|
-
var y2 = r2 * 0.2126 + g2 * 0.7152 + b2 * 0.0722;
|
|
30987
|
-
var z2 = r2 * 0.0193 + g2 * 0.1192 + b2 * 0.9505;
|
|
30988
|
-
return [x2 * 100, y2 * 100, z2 * 100];
|
|
30989
|
-
};
|
|
30990
|
-
convert2.rgb.lab = function(rgb) {
|
|
30991
|
-
var xyz = convert2.rgb.xyz(rgb);
|
|
30992
|
-
var x2 = xyz[0];
|
|
30993
|
-
var y2 = xyz[1];
|
|
30994
|
-
var z2 = xyz[2];
|
|
30995
|
-
var l2;
|
|
30996
|
-
var a2;
|
|
30997
|
-
var b2;
|
|
30998
|
-
x2 /= 95.047;
|
|
30999
|
-
y2 /= 100;
|
|
31000
|
-
z2 /= 108.883;
|
|
31001
|
-
x2 = x2 > 8856e-6 ? Math.pow(x2, 1 / 3) : 7.787 * x2 + 16 / 116;
|
|
31002
|
-
y2 = y2 > 8856e-6 ? Math.pow(y2, 1 / 3) : 7.787 * y2 + 16 / 116;
|
|
31003
|
-
z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
|
|
31004
|
-
l2 = 116 * y2 - 16;
|
|
31005
|
-
a2 = 500 * (x2 - y2);
|
|
31006
|
-
b2 = 200 * (y2 - z2);
|
|
31007
|
-
return [l2, a2, b2];
|
|
31008
|
-
};
|
|
31009
|
-
convert2.hsl.rgb = function(hsl) {
|
|
31010
|
-
var h2 = hsl[0] / 360;
|
|
31011
|
-
var s2 = hsl[1] / 100;
|
|
31012
|
-
var l2 = hsl[2] / 100;
|
|
31013
|
-
var t1;
|
|
31014
|
-
var t2;
|
|
31015
|
-
var t3;
|
|
31016
|
-
var rgb;
|
|
31017
|
-
var val;
|
|
31018
|
-
if (s2 === 0) {
|
|
31019
|
-
val = l2 * 255;
|
|
31020
|
-
return [val, val, val];
|
|
31021
|
-
}
|
|
31022
|
-
if (l2 < 0.5) {
|
|
31023
|
-
t2 = l2 * (1 + s2);
|
|
31024
|
-
} else {
|
|
31025
|
-
t2 = l2 + s2 - l2 * s2;
|
|
31026
|
-
}
|
|
31027
|
-
t1 = 2 * l2 - t2;
|
|
31028
|
-
rgb = [0, 0, 0];
|
|
31029
|
-
for (var i2 = 0; i2 < 3; i2++) {
|
|
31030
|
-
t3 = h2 + 1 / 3 * -(i2 - 1);
|
|
31031
|
-
if (t3 < 0) {
|
|
31032
|
-
t3++;
|
|
31033
|
-
}
|
|
31034
|
-
if (t3 > 1) {
|
|
31035
|
-
t3--;
|
|
31036
|
-
}
|
|
31037
|
-
if (6 * t3 < 1) {
|
|
31038
|
-
val = t1 + (t2 - t1) * 6 * t3;
|
|
31039
|
-
} else if (2 * t3 < 1) {
|
|
31040
|
-
val = t2;
|
|
31041
|
-
} else if (3 * t3 < 2) {
|
|
31042
|
-
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
31043
|
-
} else {
|
|
31044
|
-
val = t1;
|
|
31045
|
-
}
|
|
31046
|
-
rgb[i2] = val * 255;
|
|
30863
|
+
case 1: {
|
|
30864
|
+
return [q2, v2, p2];
|
|
31047
30865
|
}
|
|
31048
|
-
|
|
31049
|
-
|
|
31050
|
-
convert2.hsl.hsv = function(hsl) {
|
|
31051
|
-
var h2 = hsl[0];
|
|
31052
|
-
var s2 = hsl[1] / 100;
|
|
31053
|
-
var l2 = hsl[2] / 100;
|
|
31054
|
-
var smin = s2;
|
|
31055
|
-
var lmin = Math.max(l2, 0.01);
|
|
31056
|
-
var sv;
|
|
31057
|
-
var v2;
|
|
31058
|
-
l2 *= 2;
|
|
31059
|
-
s2 *= l2 <= 1 ? l2 : 2 - l2;
|
|
31060
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
31061
|
-
v2 = (l2 + s2) / 2;
|
|
31062
|
-
sv = l2 === 0 ? 2 * smin / (lmin + smin) : 2 * s2 / (l2 + s2);
|
|
31063
|
-
return [h2, sv * 100, v2 * 100];
|
|
31064
|
-
};
|
|
31065
|
-
convert2.hsv.rgb = function(hsv) {
|
|
31066
|
-
var h2 = hsv[0] / 60;
|
|
31067
|
-
var s2 = hsv[1] / 100;
|
|
31068
|
-
var v2 = hsv[2] / 100;
|
|
31069
|
-
var hi = Math.floor(h2) % 6;
|
|
31070
|
-
var f2 = h2 - Math.floor(h2);
|
|
31071
|
-
var p2 = 255 * v2 * (1 - s2);
|
|
31072
|
-
var q2 = 255 * v2 * (1 - s2 * f2);
|
|
31073
|
-
var t2 = 255 * v2 * (1 - s2 * (1 - f2));
|
|
31074
|
-
v2 *= 255;
|
|
31075
|
-
switch (hi) {
|
|
31076
|
-
case 0:
|
|
31077
|
-
return [v2, t2, p2];
|
|
31078
|
-
case 1:
|
|
31079
|
-
return [q2, v2, p2];
|
|
31080
|
-
case 2:
|
|
31081
|
-
return [p2, v2, t2];
|
|
31082
|
-
case 3:
|
|
31083
|
-
return [p2, q2, v2];
|
|
31084
|
-
case 4:
|
|
31085
|
-
return [t2, p2, v2];
|
|
31086
|
-
case 5:
|
|
31087
|
-
return [v2, p2, q2];
|
|
30866
|
+
case 2: {
|
|
30867
|
+
return [p2, v2, t2];
|
|
31088
30868
|
}
|
|
31089
|
-
|
|
31090
|
-
|
|
31091
|
-
var h2 = hsv[0];
|
|
31092
|
-
var s2 = hsv[1] / 100;
|
|
31093
|
-
var v2 = hsv[2] / 100;
|
|
31094
|
-
var vmin = Math.max(v2, 0.01);
|
|
31095
|
-
var lmin;
|
|
31096
|
-
var sl;
|
|
31097
|
-
var l2;
|
|
31098
|
-
l2 = (2 - s2) * v2;
|
|
31099
|
-
lmin = (2 - s2) * vmin;
|
|
31100
|
-
sl = s2 * vmin;
|
|
31101
|
-
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
31102
|
-
sl = sl || 0;
|
|
31103
|
-
l2 /= 2;
|
|
31104
|
-
return [h2, sl * 100, l2 * 100];
|
|
31105
|
-
};
|
|
31106
|
-
convert2.hwb.rgb = function(hwb) {
|
|
31107
|
-
var h2 = hwb[0] / 360;
|
|
31108
|
-
var wh = hwb[1] / 100;
|
|
31109
|
-
var bl = hwb[2] / 100;
|
|
31110
|
-
var ratio = wh + bl;
|
|
31111
|
-
var i2;
|
|
31112
|
-
var v2;
|
|
31113
|
-
var f2;
|
|
31114
|
-
var n2;
|
|
31115
|
-
if (ratio > 1) {
|
|
31116
|
-
wh /= ratio;
|
|
31117
|
-
bl /= ratio;
|
|
31118
|
-
}
|
|
31119
|
-
i2 = Math.floor(6 * h2);
|
|
31120
|
-
v2 = 1 - bl;
|
|
31121
|
-
f2 = 6 * h2 - i2;
|
|
31122
|
-
if ((i2 & 1) !== 0) {
|
|
31123
|
-
f2 = 1 - f2;
|
|
31124
|
-
}
|
|
31125
|
-
n2 = wh + f2 * (v2 - wh);
|
|
31126
|
-
var r2;
|
|
31127
|
-
var g2;
|
|
31128
|
-
var b2;
|
|
31129
|
-
switch (i2) {
|
|
31130
|
-
default:
|
|
31131
|
-
case 6:
|
|
31132
|
-
case 0:
|
|
31133
|
-
r2 = v2;
|
|
31134
|
-
g2 = n2;
|
|
31135
|
-
b2 = wh;
|
|
31136
|
-
break;
|
|
31137
|
-
case 1:
|
|
31138
|
-
r2 = n2;
|
|
31139
|
-
g2 = v2;
|
|
31140
|
-
b2 = wh;
|
|
31141
|
-
break;
|
|
31142
|
-
case 2:
|
|
31143
|
-
r2 = wh;
|
|
31144
|
-
g2 = v2;
|
|
31145
|
-
b2 = n2;
|
|
31146
|
-
break;
|
|
31147
|
-
case 3:
|
|
31148
|
-
r2 = wh;
|
|
31149
|
-
g2 = n2;
|
|
31150
|
-
b2 = v2;
|
|
31151
|
-
break;
|
|
31152
|
-
case 4:
|
|
31153
|
-
r2 = n2;
|
|
31154
|
-
g2 = wh;
|
|
31155
|
-
b2 = v2;
|
|
31156
|
-
break;
|
|
31157
|
-
case 5:
|
|
31158
|
-
r2 = v2;
|
|
31159
|
-
g2 = wh;
|
|
31160
|
-
b2 = n2;
|
|
31161
|
-
break;
|
|
30869
|
+
case 3: {
|
|
30870
|
+
return [p2, q2, v2];
|
|
31162
30871
|
}
|
|
31163
|
-
|
|
31164
|
-
|
|
31165
|
-
convert2.cmyk.rgb = function(cmyk) {
|
|
31166
|
-
var c2 = cmyk[0] / 100;
|
|
31167
|
-
var m2 = cmyk[1] / 100;
|
|
31168
|
-
var y2 = cmyk[2] / 100;
|
|
31169
|
-
var k2 = cmyk[3] / 100;
|
|
31170
|
-
var r2;
|
|
31171
|
-
var g2;
|
|
31172
|
-
var b2;
|
|
31173
|
-
r2 = 1 - Math.min(1, c2 * (1 - k2) + k2);
|
|
31174
|
-
g2 = 1 - Math.min(1, m2 * (1 - k2) + k2);
|
|
31175
|
-
b2 = 1 - Math.min(1, y2 * (1 - k2) + k2);
|
|
31176
|
-
return [r2 * 255, g2 * 255, b2 * 255];
|
|
31177
|
-
};
|
|
31178
|
-
convert2.xyz.rgb = function(xyz) {
|
|
31179
|
-
var x2 = xyz[0] / 100;
|
|
31180
|
-
var y2 = xyz[1] / 100;
|
|
31181
|
-
var z2 = xyz[2] / 100;
|
|
31182
|
-
var r2;
|
|
31183
|
-
var g2;
|
|
31184
|
-
var b2;
|
|
31185
|
-
r2 = x2 * 3.2406 + y2 * -1.5372 + z2 * -0.4986;
|
|
31186
|
-
g2 = x2 * -0.9689 + y2 * 1.8758 + z2 * 0.0415;
|
|
31187
|
-
b2 = x2 * 0.0557 + y2 * -0.204 + z2 * 1.057;
|
|
31188
|
-
r2 = r2 > 31308e-7 ? 1.055 * Math.pow(r2, 1 / 2.4) - 0.055 : r2 * 12.92;
|
|
31189
|
-
g2 = g2 > 31308e-7 ? 1.055 * Math.pow(g2, 1 / 2.4) - 0.055 : g2 * 12.92;
|
|
31190
|
-
b2 = b2 > 31308e-7 ? 1.055 * Math.pow(b2, 1 / 2.4) - 0.055 : b2 * 12.92;
|
|
31191
|
-
r2 = Math.min(Math.max(0, r2), 1);
|
|
31192
|
-
g2 = Math.min(Math.max(0, g2), 1);
|
|
31193
|
-
b2 = Math.min(Math.max(0, b2), 1);
|
|
31194
|
-
return [r2 * 255, g2 * 255, b2 * 255];
|
|
31195
|
-
};
|
|
31196
|
-
convert2.xyz.lab = function(xyz) {
|
|
31197
|
-
var x2 = xyz[0];
|
|
31198
|
-
var y2 = xyz[1];
|
|
31199
|
-
var z2 = xyz[2];
|
|
31200
|
-
var l2;
|
|
31201
|
-
var a2;
|
|
31202
|
-
var b2;
|
|
31203
|
-
x2 /= 95.047;
|
|
31204
|
-
y2 /= 100;
|
|
31205
|
-
z2 /= 108.883;
|
|
31206
|
-
x2 = x2 > 8856e-6 ? Math.pow(x2, 1 / 3) : 7.787 * x2 + 16 / 116;
|
|
31207
|
-
y2 = y2 > 8856e-6 ? Math.pow(y2, 1 / 3) : 7.787 * y2 + 16 / 116;
|
|
31208
|
-
z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
|
|
31209
|
-
l2 = 116 * y2 - 16;
|
|
31210
|
-
a2 = 500 * (x2 - y2);
|
|
31211
|
-
b2 = 200 * (y2 - z2);
|
|
31212
|
-
return [l2, a2, b2];
|
|
31213
|
-
};
|
|
31214
|
-
convert2.lab.xyz = function(lab) {
|
|
31215
|
-
var l2 = lab[0];
|
|
31216
|
-
var a2 = lab[1];
|
|
31217
|
-
var b2 = lab[2];
|
|
31218
|
-
var x2;
|
|
31219
|
-
var y2;
|
|
31220
|
-
var z2;
|
|
31221
|
-
y2 = (l2 + 16) / 116;
|
|
31222
|
-
x2 = a2 / 500 + y2;
|
|
31223
|
-
z2 = y2 - b2 / 200;
|
|
31224
|
-
var y22 = Math.pow(y2, 3);
|
|
31225
|
-
var x22 = Math.pow(x2, 3);
|
|
31226
|
-
var z22 = Math.pow(z2, 3);
|
|
31227
|
-
y2 = y22 > 8856e-6 ? y22 : (y2 - 16 / 116) / 7.787;
|
|
31228
|
-
x2 = x22 > 8856e-6 ? x22 : (x2 - 16 / 116) / 7.787;
|
|
31229
|
-
z2 = z22 > 8856e-6 ? z22 : (z2 - 16 / 116) / 7.787;
|
|
31230
|
-
x2 *= 95.047;
|
|
31231
|
-
y2 *= 100;
|
|
31232
|
-
z2 *= 108.883;
|
|
31233
|
-
return [x2, y2, z2];
|
|
31234
|
-
};
|
|
31235
|
-
convert2.lab.lch = function(lab) {
|
|
31236
|
-
var l2 = lab[0];
|
|
31237
|
-
var a2 = lab[1];
|
|
31238
|
-
var b2 = lab[2];
|
|
31239
|
-
var hr;
|
|
31240
|
-
var h2;
|
|
31241
|
-
var c2;
|
|
31242
|
-
hr = Math.atan2(b2, a2);
|
|
31243
|
-
h2 = hr * 360 / 2 / Math.PI;
|
|
31244
|
-
if (h2 < 0) {
|
|
31245
|
-
h2 += 360;
|
|
30872
|
+
case 4: {
|
|
30873
|
+
return [t2, p2, v2];
|
|
31246
30874
|
}
|
|
31247
|
-
|
|
31248
|
-
|
|
31249
|
-
};
|
|
31250
|
-
convert2.lch.lab = function(lch) {
|
|
31251
|
-
var l2 = lch[0];
|
|
31252
|
-
var c2 = lch[1];
|
|
31253
|
-
var h2 = lch[2];
|
|
31254
|
-
var a2;
|
|
31255
|
-
var b2;
|
|
31256
|
-
var hr;
|
|
31257
|
-
hr = h2 / 360 * 2 * Math.PI;
|
|
31258
|
-
a2 = c2 * Math.cos(hr);
|
|
31259
|
-
b2 = c2 * Math.sin(hr);
|
|
31260
|
-
return [l2, a2, b2];
|
|
31261
|
-
};
|
|
31262
|
-
convert2.rgb.ansi16 = function(args) {
|
|
31263
|
-
var r2 = args[0];
|
|
31264
|
-
var g2 = args[1];
|
|
31265
|
-
var b2 = args[2];
|
|
31266
|
-
var value = 1 in arguments ? arguments[1] : convert2.rgb.hsv(args)[2];
|
|
31267
|
-
value = Math.round(value / 50);
|
|
31268
|
-
if (value === 0) {
|
|
31269
|
-
return 30;
|
|
31270
|
-
}
|
|
31271
|
-
var ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r2 / 255));
|
|
31272
|
-
if (value === 2) {
|
|
31273
|
-
ansi += 60;
|
|
31274
|
-
}
|
|
31275
|
-
return ansi;
|
|
31276
|
-
};
|
|
31277
|
-
convert2.hsv.ansi16 = function(args) {
|
|
31278
|
-
return convert2.rgb.ansi16(convert2.hsv.rgb(args), args[2]);
|
|
31279
|
-
};
|
|
31280
|
-
convert2.rgb.ansi256 = function(args) {
|
|
31281
|
-
var r2 = args[0];
|
|
31282
|
-
var g2 = args[1];
|
|
31283
|
-
var b2 = args[2];
|
|
31284
|
-
if (r2 === g2 && g2 === b2) {
|
|
31285
|
-
if (r2 < 8) {
|
|
31286
|
-
return 16;
|
|
31287
|
-
}
|
|
31288
|
-
if (r2 > 248) {
|
|
31289
|
-
return 231;
|
|
31290
|
-
}
|
|
31291
|
-
return Math.round((r2 - 8) / 247 * 24) + 232;
|
|
30875
|
+
case 5: {
|
|
30876
|
+
return [v2, p2, q2];
|
|
31292
30877
|
}
|
|
31293
|
-
|
|
31294
|
-
|
|
31295
|
-
|
|
31296
|
-
|
|
31297
|
-
|
|
31298
|
-
|
|
31299
|
-
|
|
31300
|
-
|
|
31301
|
-
|
|
31302
|
-
|
|
31303
|
-
|
|
31304
|
-
|
|
31305
|
-
|
|
31306
|
-
|
|
31307
|
-
|
|
31308
|
-
|
|
31309
|
-
|
|
31310
|
-
|
|
31311
|
-
|
|
31312
|
-
|
|
31313
|
-
|
|
31314
|
-
|
|
31315
|
-
|
|
31316
|
-
|
|
31317
|
-
|
|
31318
|
-
|
|
31319
|
-
|
|
31320
|
-
|
|
31321
|
-
|
|
31322
|
-
|
|
31323
|
-
|
|
31324
|
-
|
|
31325
|
-
|
|
31326
|
-
|
|
31327
|
-
|
|
31328
|
-
|
|
31329
|
-
|
|
31330
|
-
|
|
31331
|
-
|
|
31332
|
-
|
|
31333
|
-
|
|
31334
|
-
|
|
31335
|
-
|
|
31336
|
-
|
|
31337
|
-
|
|
31338
|
-
}
|
|
31339
|
-
var integer = parseInt(colorString2, 16);
|
|
31340
|
-
var r2 = integer >> 16 & 255;
|
|
31341
|
-
var g2 = integer >> 8 & 255;
|
|
31342
|
-
var b2 = integer & 255;
|
|
31343
|
-
return [r2, g2, b2];
|
|
31344
|
-
};
|
|
31345
|
-
convert2.rgb.hcg = function(rgb) {
|
|
31346
|
-
var r2 = rgb[0] / 255;
|
|
31347
|
-
var g2 = rgb[1] / 255;
|
|
31348
|
-
var b2 = rgb[2] / 255;
|
|
31349
|
-
var max2 = Math.max(Math.max(r2, g2), b2);
|
|
31350
|
-
var min2 = Math.min(Math.min(r2, g2), b2);
|
|
31351
|
-
var chroma = max2 - min2;
|
|
31352
|
-
var grayscale;
|
|
31353
|
-
var hue;
|
|
31354
|
-
if (chroma < 1) {
|
|
31355
|
-
grayscale = min2 / (1 - chroma);
|
|
31356
|
-
} else {
|
|
31357
|
-
grayscale = 0;
|
|
31358
|
-
}
|
|
31359
|
-
if (chroma <= 0) {
|
|
31360
|
-
hue = 0;
|
|
31361
|
-
} else if (max2 === r2) {
|
|
31362
|
-
hue = (g2 - b2) / chroma % 6;
|
|
31363
|
-
} else if (max2 === g2) {
|
|
31364
|
-
hue = 2 + (b2 - r2) / chroma;
|
|
31365
|
-
} else {
|
|
31366
|
-
hue = 4 + (r2 - g2) / chroma + 4;
|
|
30878
|
+
}
|
|
30879
|
+
};
|
|
30880
|
+
convert$2.hsv.hsl = function(hsv) {
|
|
30881
|
+
const h2 = hsv[0];
|
|
30882
|
+
const s2 = hsv[1] / 100;
|
|
30883
|
+
const v2 = hsv[2] / 100;
|
|
30884
|
+
const vmin = Math.max(v2, 0.01);
|
|
30885
|
+
let sl;
|
|
30886
|
+
let l2;
|
|
30887
|
+
l2 = (2 - s2) * v2;
|
|
30888
|
+
const lmin = (2 - s2) * vmin;
|
|
30889
|
+
sl = s2 * vmin;
|
|
30890
|
+
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
30891
|
+
sl = sl || 0;
|
|
30892
|
+
l2 /= 2;
|
|
30893
|
+
return [h2, sl * 100, l2 * 100];
|
|
30894
|
+
};
|
|
30895
|
+
convert$2.hwb.rgb = function(hwb) {
|
|
30896
|
+
const h2 = hwb[0] / 360;
|
|
30897
|
+
let wh = hwb[1] / 100;
|
|
30898
|
+
let bl = hwb[2] / 100;
|
|
30899
|
+
const ratio = wh + bl;
|
|
30900
|
+
let f2;
|
|
30901
|
+
if (ratio > 1) {
|
|
30902
|
+
wh /= ratio;
|
|
30903
|
+
bl /= ratio;
|
|
30904
|
+
}
|
|
30905
|
+
const i2 = Math.floor(6 * h2);
|
|
30906
|
+
const v2 = 1 - bl;
|
|
30907
|
+
f2 = 6 * h2 - i2;
|
|
30908
|
+
if ((i2 & 1) !== 0) {
|
|
30909
|
+
f2 = 1 - f2;
|
|
30910
|
+
}
|
|
30911
|
+
const n2 = wh + f2 * (v2 - wh);
|
|
30912
|
+
let r2;
|
|
30913
|
+
let g2;
|
|
30914
|
+
let b2;
|
|
30915
|
+
switch (i2) {
|
|
30916
|
+
default:
|
|
30917
|
+
case 6:
|
|
30918
|
+
case 0: {
|
|
30919
|
+
r2 = v2;
|
|
30920
|
+
g2 = n2;
|
|
30921
|
+
b2 = wh;
|
|
30922
|
+
break;
|
|
31367
30923
|
}
|
|
31368
|
-
|
|
31369
|
-
|
|
31370
|
-
|
|
31371
|
-
|
|
31372
|
-
|
|
31373
|
-
var s2 = hsl[1] / 100;
|
|
31374
|
-
var l2 = hsl[2] / 100;
|
|
31375
|
-
var c2 = 1;
|
|
31376
|
-
var f2 = 0;
|
|
31377
|
-
if (l2 < 0.5) {
|
|
31378
|
-
c2 = 2 * s2 * l2;
|
|
31379
|
-
} else {
|
|
31380
|
-
c2 = 2 * s2 * (1 - l2);
|
|
30924
|
+
case 1: {
|
|
30925
|
+
r2 = n2;
|
|
30926
|
+
g2 = v2;
|
|
30927
|
+
b2 = wh;
|
|
30928
|
+
break;
|
|
31381
30929
|
}
|
|
31382
|
-
|
|
31383
|
-
|
|
30930
|
+
case 2: {
|
|
30931
|
+
r2 = wh;
|
|
30932
|
+
g2 = v2;
|
|
30933
|
+
b2 = n2;
|
|
30934
|
+
break;
|
|
31384
30935
|
}
|
|
31385
|
-
|
|
31386
|
-
|
|
31387
|
-
|
|
31388
|
-
|
|
31389
|
-
|
|
31390
|
-
var c2 = s2 * v2;
|
|
31391
|
-
var f2 = 0;
|
|
31392
|
-
if (c2 < 1) {
|
|
31393
|
-
f2 = (v2 - c2) / (1 - c2);
|
|
31394
|
-
}
|
|
31395
|
-
return [hsv[0], c2 * 100, f2 * 100];
|
|
31396
|
-
};
|
|
31397
|
-
convert2.hcg.rgb = function(hcg) {
|
|
31398
|
-
var h2 = hcg[0] / 360;
|
|
31399
|
-
var c2 = hcg[1] / 100;
|
|
31400
|
-
var g2 = hcg[2] / 100;
|
|
31401
|
-
if (c2 === 0) {
|
|
31402
|
-
return [g2 * 255, g2 * 255, g2 * 255];
|
|
31403
|
-
}
|
|
31404
|
-
var pure2 = [0, 0, 0];
|
|
31405
|
-
var hi = h2 % 1 * 6;
|
|
31406
|
-
var v2 = hi % 1;
|
|
31407
|
-
var w2 = 1 - v2;
|
|
31408
|
-
var mg = 0;
|
|
31409
|
-
switch (Math.floor(hi)) {
|
|
31410
|
-
case 0:
|
|
31411
|
-
pure2[0] = 1;
|
|
31412
|
-
pure2[1] = v2;
|
|
31413
|
-
pure2[2] = 0;
|
|
31414
|
-
break;
|
|
31415
|
-
case 1:
|
|
31416
|
-
pure2[0] = w2;
|
|
31417
|
-
pure2[1] = 1;
|
|
31418
|
-
pure2[2] = 0;
|
|
31419
|
-
break;
|
|
31420
|
-
case 2:
|
|
31421
|
-
pure2[0] = 0;
|
|
31422
|
-
pure2[1] = 1;
|
|
31423
|
-
pure2[2] = v2;
|
|
31424
|
-
break;
|
|
31425
|
-
case 3:
|
|
31426
|
-
pure2[0] = 0;
|
|
31427
|
-
pure2[1] = w2;
|
|
31428
|
-
pure2[2] = 1;
|
|
31429
|
-
break;
|
|
31430
|
-
case 4:
|
|
31431
|
-
pure2[0] = v2;
|
|
31432
|
-
pure2[1] = 0;
|
|
31433
|
-
pure2[2] = 1;
|
|
31434
|
-
break;
|
|
31435
|
-
default:
|
|
31436
|
-
pure2[0] = 1;
|
|
31437
|
-
pure2[1] = 0;
|
|
31438
|
-
pure2[2] = w2;
|
|
30936
|
+
case 3: {
|
|
30937
|
+
r2 = wh;
|
|
30938
|
+
g2 = n2;
|
|
30939
|
+
b2 = v2;
|
|
30940
|
+
break;
|
|
31439
30941
|
}
|
|
31440
|
-
|
|
31441
|
-
|
|
31442
|
-
|
|
31443
|
-
|
|
31444
|
-
|
|
31445
|
-
|
|
31446
|
-
|
|
31447
|
-
|
|
31448
|
-
|
|
31449
|
-
|
|
31450
|
-
|
|
31451
|
-
var f2 = 0;
|
|
31452
|
-
if (v2 > 0) {
|
|
31453
|
-
f2 = c2 / v2;
|
|
31454
|
-
}
|
|
31455
|
-
return [hcg[0], f2 * 100, v2 * 100];
|
|
31456
|
-
};
|
|
31457
|
-
convert2.hcg.hsl = function(hcg) {
|
|
31458
|
-
var c2 = hcg[1] / 100;
|
|
31459
|
-
var g2 = hcg[2] / 100;
|
|
31460
|
-
var l2 = g2 * (1 - c2) + 0.5 * c2;
|
|
31461
|
-
var s2 = 0;
|
|
31462
|
-
if (l2 > 0 && l2 < 0.5) {
|
|
31463
|
-
s2 = c2 / (2 * l2);
|
|
31464
|
-
} else if (l2 >= 0.5 && l2 < 1) {
|
|
31465
|
-
s2 = c2 / (2 * (1 - l2));
|
|
31466
|
-
}
|
|
31467
|
-
return [hcg[0], s2 * 100, l2 * 100];
|
|
31468
|
-
};
|
|
31469
|
-
convert2.hcg.hwb = function(hcg) {
|
|
31470
|
-
var c2 = hcg[1] / 100;
|
|
31471
|
-
var g2 = hcg[2] / 100;
|
|
31472
|
-
var v2 = c2 + g2 * (1 - c2);
|
|
31473
|
-
return [hcg[0], (v2 - c2) * 100, (1 - v2) * 100];
|
|
31474
|
-
};
|
|
31475
|
-
convert2.hwb.hcg = function(hwb) {
|
|
31476
|
-
var w2 = hwb[1] / 100;
|
|
31477
|
-
var b2 = hwb[2] / 100;
|
|
31478
|
-
var v2 = 1 - b2;
|
|
31479
|
-
var c2 = v2 - w2;
|
|
31480
|
-
var g2 = 0;
|
|
31481
|
-
if (c2 < 1) {
|
|
31482
|
-
g2 = (v2 - c2) / (1 - c2);
|
|
31483
|
-
}
|
|
31484
|
-
return [hwb[0], c2 * 100, g2 * 100];
|
|
31485
|
-
};
|
|
31486
|
-
convert2.apple.rgb = function(apple) {
|
|
31487
|
-
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
31488
|
-
};
|
|
31489
|
-
convert2.rgb.apple = function(rgb) {
|
|
31490
|
-
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
31491
|
-
};
|
|
31492
|
-
convert2.gray.rgb = function(args) {
|
|
31493
|
-
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
31494
|
-
};
|
|
31495
|
-
convert2.gray.hsl = convert2.gray.hsv = function(args) {
|
|
31496
|
-
return [0, 0, args[0]];
|
|
31497
|
-
};
|
|
31498
|
-
convert2.gray.hwb = function(gray) {
|
|
31499
|
-
return [0, 100, gray[0]];
|
|
31500
|
-
};
|
|
31501
|
-
convert2.gray.cmyk = function(gray) {
|
|
31502
|
-
return [0, 0, 0, gray[0]];
|
|
31503
|
-
};
|
|
31504
|
-
convert2.gray.lab = function(gray) {
|
|
31505
|
-
return [gray[0], 0, 0];
|
|
31506
|
-
};
|
|
31507
|
-
convert2.gray.hex = function(gray) {
|
|
31508
|
-
var val = Math.round(gray[0] / 100 * 255) & 255;
|
|
31509
|
-
var integer = (val << 16) + (val << 8) + val;
|
|
31510
|
-
var string2 = integer.toString(16).toUpperCase();
|
|
31511
|
-
return "000000".substring(string2.length) + string2;
|
|
31512
|
-
};
|
|
31513
|
-
convert2.rgb.gray = function(rgb) {
|
|
31514
|
-
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
31515
|
-
return [val / 255 * 100];
|
|
31516
|
-
};
|
|
31517
|
-
return conversions.exports;
|
|
31518
|
-
}
|
|
31519
|
-
__name(requireConversions, "requireConversions");
|
|
31520
|
-
var route;
|
|
31521
|
-
var hasRequiredRoute;
|
|
31522
|
-
function requireRoute() {
|
|
31523
|
-
if (hasRequiredRoute) return route;
|
|
31524
|
-
hasRequiredRoute = 1;
|
|
31525
|
-
var conversions2 = requireConversions();
|
|
31526
|
-
function buildGraph() {
|
|
31527
|
-
var graph = {};
|
|
31528
|
-
var models = Object.keys(conversions2);
|
|
31529
|
-
for (var len = models.length, i2 = 0; i2 < len; i2++) {
|
|
31530
|
-
graph[models[i2]] = {
|
|
31531
|
-
// http://jsperf.com/1-vs-infinity
|
|
31532
|
-
// micro-opt, but this is simple.
|
|
31533
|
-
distance: -1,
|
|
31534
|
-
parent: null
|
|
31535
|
-
};
|
|
30942
|
+
case 4: {
|
|
30943
|
+
r2 = n2;
|
|
30944
|
+
g2 = wh;
|
|
30945
|
+
b2 = v2;
|
|
30946
|
+
break;
|
|
30947
|
+
}
|
|
30948
|
+
case 5: {
|
|
30949
|
+
r2 = v2;
|
|
30950
|
+
g2 = wh;
|
|
30951
|
+
b2 = n2;
|
|
30952
|
+
break;
|
|
31536
30953
|
}
|
|
31537
|
-
return graph;
|
|
31538
30954
|
}
|
|
31539
|
-
|
|
31540
|
-
|
|
31541
|
-
|
|
31542
|
-
|
|
31543
|
-
|
|
31544
|
-
|
|
31545
|
-
|
|
31546
|
-
|
|
31547
|
-
|
|
31548
|
-
|
|
31549
|
-
|
|
31550
|
-
|
|
31551
|
-
|
|
31552
|
-
|
|
31553
|
-
|
|
31554
|
-
|
|
31555
|
-
|
|
30955
|
+
return [r2 * 255, g2 * 255, b2 * 255];
|
|
30956
|
+
};
|
|
30957
|
+
convert$2.cmyk.rgb = function(cmyk) {
|
|
30958
|
+
const c2 = cmyk[0] / 100;
|
|
30959
|
+
const m2 = cmyk[1] / 100;
|
|
30960
|
+
const y2 = cmyk[2] / 100;
|
|
30961
|
+
const k2 = cmyk[3] / 100;
|
|
30962
|
+
const r2 = 1 - Math.min(1, c2 * (1 - k2) + k2);
|
|
30963
|
+
const g2 = 1 - Math.min(1, m2 * (1 - k2) + k2);
|
|
30964
|
+
const b2 = 1 - Math.min(1, y2 * (1 - k2) + k2);
|
|
30965
|
+
return [r2 * 255, g2 * 255, b2 * 255];
|
|
30966
|
+
};
|
|
30967
|
+
convert$2.xyz.rgb = function(xyz) {
|
|
30968
|
+
const x2 = xyz[0] / 100;
|
|
30969
|
+
const y2 = xyz[1] / 100;
|
|
30970
|
+
const z2 = xyz[2] / 100;
|
|
30971
|
+
let r2;
|
|
30972
|
+
let g2;
|
|
30973
|
+
let b2;
|
|
30974
|
+
r2 = x2 * 3.2404542 + y2 * -1.5371385 + z2 * -0.4985314;
|
|
30975
|
+
g2 = x2 * -0.969266 + y2 * 1.8760108 + z2 * 0.041556;
|
|
30976
|
+
b2 = x2 * 0.0556434 + y2 * -0.2040259 + z2 * 1.0572252;
|
|
30977
|
+
r2 = srgbNonlinearTransform(r2);
|
|
30978
|
+
g2 = srgbNonlinearTransform(g2);
|
|
30979
|
+
b2 = srgbNonlinearTransform(b2);
|
|
30980
|
+
return [r2 * 255, g2 * 255, b2 * 255];
|
|
30981
|
+
};
|
|
30982
|
+
convert$2.xyz.lab = function(xyz) {
|
|
30983
|
+
let x2 = xyz[0];
|
|
30984
|
+
let y2 = xyz[1];
|
|
30985
|
+
let z2 = xyz[2];
|
|
30986
|
+
x2 /= 95.047;
|
|
30987
|
+
y2 /= 100;
|
|
30988
|
+
z2 /= 108.883;
|
|
30989
|
+
x2 = x2 > LAB_FT ? __pow(x2, 1 / 3) : 7.787 * x2 + 16 / 116;
|
|
30990
|
+
y2 = y2 > LAB_FT ? __pow(y2, 1 / 3) : 7.787 * y2 + 16 / 116;
|
|
30991
|
+
z2 = z2 > LAB_FT ? __pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
|
|
30992
|
+
const l2 = 116 * y2 - 16;
|
|
30993
|
+
const a2 = 500 * (x2 - y2);
|
|
30994
|
+
const b2 = 200 * (y2 - z2);
|
|
30995
|
+
return [l2, a2, b2];
|
|
30996
|
+
};
|
|
30997
|
+
convert$2.xyz.oklab = function(xyz) {
|
|
30998
|
+
const x2 = xyz[0] / 100;
|
|
30999
|
+
const y2 = xyz[1] / 100;
|
|
31000
|
+
const z2 = xyz[2] / 100;
|
|
31001
|
+
const lp = Math.cbrt(0.8189330101 * x2 + 0.3618667424 * y2 - 0.1288597137 * z2);
|
|
31002
|
+
const mp = Math.cbrt(0.0329845436 * x2 + 0.9293118715 * y2 + 0.0361456387 * z2);
|
|
31003
|
+
const sp = Math.cbrt(0.0482003018 * x2 + 0.2643662691 * y2 + 0.633851707 * z2);
|
|
31004
|
+
const l2 = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
31005
|
+
const a2 = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
31006
|
+
const b2 = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
31007
|
+
return [l2 * 100, a2 * 100, b2 * 100];
|
|
31008
|
+
};
|
|
31009
|
+
convert$2.oklab.oklch = function(oklab) {
|
|
31010
|
+
return convert$2.lab.lch(oklab);
|
|
31011
|
+
};
|
|
31012
|
+
convert$2.oklab.xyz = function(oklab) {
|
|
31013
|
+
const ll = oklab[0] / 100;
|
|
31014
|
+
const a2 = oklab[1] / 100;
|
|
31015
|
+
const b2 = oklab[2] / 100;
|
|
31016
|
+
const l2 = __pow(0.999999998 * ll + 0.396337792 * a2 + 0.215803758 * b2, 3);
|
|
31017
|
+
const m2 = __pow(1.000000008 * ll - 0.105561342 * a2 - 0.063854175 * b2, 3);
|
|
31018
|
+
const s2 = __pow(1.000000055 * ll - 0.089484182 * a2 - 1.291485538 * b2, 3);
|
|
31019
|
+
const x2 = 1.227013851 * l2 - 0.55779998 * m2 + 0.281256149 * s2;
|
|
31020
|
+
const y2 = -0.040580178 * l2 + 1.11225687 * m2 - 0.071676679 * s2;
|
|
31021
|
+
const z2 = -0.076381285 * l2 - 0.421481978 * m2 + 1.58616322 * s2;
|
|
31022
|
+
return [x2 * 100, y2 * 100, z2 * 100];
|
|
31023
|
+
};
|
|
31024
|
+
convert$2.oklab.rgb = function(oklab) {
|
|
31025
|
+
const ll = oklab[0] / 100;
|
|
31026
|
+
const aa = oklab[1] / 100;
|
|
31027
|
+
const bb = oklab[2] / 100;
|
|
31028
|
+
const l2 = __pow(ll + 0.3963377774 * aa + 0.2158037573 * bb, 3);
|
|
31029
|
+
const m2 = __pow(ll - 0.1055613458 * aa - 0.0638541728 * bb, 3);
|
|
31030
|
+
const s2 = __pow(ll - 0.0894841775 * aa - 1.291485548 * bb, 3);
|
|
31031
|
+
const r2 = srgbNonlinearTransform(4.0767416621 * l2 - 3.3077115913 * m2 + 0.2309699292 * s2);
|
|
31032
|
+
const g2 = srgbNonlinearTransform(-1.2684380046 * l2 + 2.6097574011 * m2 - 0.3413193965 * s2);
|
|
31033
|
+
const b2 = srgbNonlinearTransform(-0.0041960863 * l2 - 0.7034186147 * m2 + 1.707614701 * s2);
|
|
31034
|
+
return [r2 * 255, g2 * 255, b2 * 255];
|
|
31035
|
+
};
|
|
31036
|
+
convert$2.oklch.oklab = function(oklch) {
|
|
31037
|
+
return convert$2.lch.lab(oklch);
|
|
31038
|
+
};
|
|
31039
|
+
convert$2.lab.xyz = function(lab) {
|
|
31040
|
+
const l2 = lab[0];
|
|
31041
|
+
const a2 = lab[1];
|
|
31042
|
+
const b2 = lab[2];
|
|
31043
|
+
let x2;
|
|
31044
|
+
let y2;
|
|
31045
|
+
let z2;
|
|
31046
|
+
y2 = (l2 + 16) / 116;
|
|
31047
|
+
x2 = a2 / 500 + y2;
|
|
31048
|
+
z2 = y2 - b2 / 200;
|
|
31049
|
+
const y22 = __pow(y2, 3);
|
|
31050
|
+
const x22 = __pow(x2, 3);
|
|
31051
|
+
const z22 = __pow(z2, 3);
|
|
31052
|
+
y2 = y22 > LAB_FT ? y22 : (y2 - 16 / 116) / 7.787;
|
|
31053
|
+
x2 = x22 > LAB_FT ? x22 : (x2 - 16 / 116) / 7.787;
|
|
31054
|
+
z2 = z22 > LAB_FT ? z22 : (z2 - 16 / 116) / 7.787;
|
|
31055
|
+
x2 *= 95.047;
|
|
31056
|
+
y2 *= 100;
|
|
31057
|
+
z2 *= 108.883;
|
|
31058
|
+
return [x2, y2, z2];
|
|
31059
|
+
};
|
|
31060
|
+
convert$2.lab.lch = function(lab) {
|
|
31061
|
+
const l2 = lab[0];
|
|
31062
|
+
const a2 = lab[1];
|
|
31063
|
+
const b2 = lab[2];
|
|
31064
|
+
let h2;
|
|
31065
|
+
const hr = Math.atan2(b2, a2);
|
|
31066
|
+
h2 = hr * 360 / 2 / Math.PI;
|
|
31067
|
+
if (h2 < 0) {
|
|
31068
|
+
h2 += 360;
|
|
31069
|
+
}
|
|
31070
|
+
const c2 = Math.sqrt(a2 * a2 + b2 * b2);
|
|
31071
|
+
return [l2, c2, h2];
|
|
31072
|
+
};
|
|
31073
|
+
convert$2.lch.lab = function(lch) {
|
|
31074
|
+
const l2 = lch[0];
|
|
31075
|
+
const c2 = lch[1];
|
|
31076
|
+
const h2 = lch[2];
|
|
31077
|
+
const hr = h2 / 360 * 2 * Math.PI;
|
|
31078
|
+
const a2 = c2 * Math.cos(hr);
|
|
31079
|
+
const b2 = c2 * Math.sin(hr);
|
|
31080
|
+
return [l2, a2, b2];
|
|
31081
|
+
};
|
|
31082
|
+
convert$2.rgb.ansi16 = function(args, saturation = null) {
|
|
31083
|
+
const [r2, g2, b2] = args;
|
|
31084
|
+
let value = saturation === null ? convert$2.rgb.hsv(args)[2] : saturation;
|
|
31085
|
+
value = Math.round(value / 50);
|
|
31086
|
+
if (value === 0) {
|
|
31087
|
+
return 30;
|
|
31088
|
+
}
|
|
31089
|
+
let ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r2 / 255));
|
|
31090
|
+
if (value === 2) {
|
|
31091
|
+
ansi += 60;
|
|
31092
|
+
}
|
|
31093
|
+
return ansi;
|
|
31094
|
+
};
|
|
31095
|
+
convert$2.hsv.ansi16 = function(args) {
|
|
31096
|
+
return convert$2.rgb.ansi16(convert$2.hsv.rgb(args), args[2]);
|
|
31097
|
+
};
|
|
31098
|
+
convert$2.rgb.ansi256 = function(args) {
|
|
31099
|
+
const r2 = args[0];
|
|
31100
|
+
const g2 = args[1];
|
|
31101
|
+
const b2 = args[2];
|
|
31102
|
+
if (r2 >> 4 === g2 >> 4 && g2 >> 4 === b2 >> 4) {
|
|
31103
|
+
if (r2 < 8) {
|
|
31104
|
+
return 16;
|
|
31105
|
+
}
|
|
31106
|
+
if (r2 > 248) {
|
|
31107
|
+
return 231;
|
|
31556
31108
|
}
|
|
31557
|
-
return
|
|
31109
|
+
return Math.round((r2 - 8) / 247 * 24) + 232;
|
|
31558
31110
|
}
|
|
31559
|
-
|
|
31560
|
-
|
|
31561
|
-
|
|
31562
|
-
|
|
31563
|
-
|
|
31111
|
+
const ansi = 16 + 36 * Math.round(r2 / 255 * 5) + 6 * Math.round(g2 / 255 * 5) + Math.round(b2 / 255 * 5);
|
|
31112
|
+
return ansi;
|
|
31113
|
+
};
|
|
31114
|
+
convert$2.ansi16.rgb = function(args) {
|
|
31115
|
+
args = args[0];
|
|
31116
|
+
let color2 = args % 10;
|
|
31117
|
+
if (color2 === 0 || color2 === 7) {
|
|
31118
|
+
if (args > 50) {
|
|
31119
|
+
color2 += 3.5;
|
|
31120
|
+
}
|
|
31121
|
+
color2 = color2 / 10.5 * 255;
|
|
31122
|
+
return [color2, color2, color2];
|
|
31123
|
+
}
|
|
31124
|
+
const mult = (Math.trunc(args > 50) + 1) * 0.5;
|
|
31125
|
+
const r2 = (color2 & 1) * mult * 255;
|
|
31126
|
+
const g2 = (color2 >> 1 & 1) * mult * 255;
|
|
31127
|
+
const b2 = (color2 >> 2 & 1) * mult * 255;
|
|
31128
|
+
return [r2, g2, b2];
|
|
31129
|
+
};
|
|
31130
|
+
convert$2.ansi256.rgb = function(args) {
|
|
31131
|
+
args = args[0];
|
|
31132
|
+
if (args >= 232) {
|
|
31133
|
+
const c2 = (args - 232) * 10 + 8;
|
|
31134
|
+
return [c2, c2, c2];
|
|
31135
|
+
}
|
|
31136
|
+
args -= 16;
|
|
31137
|
+
let rem;
|
|
31138
|
+
const r2 = Math.floor(args / 36) / 5 * 255;
|
|
31139
|
+
const g2 = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
31140
|
+
const b2 = rem % 6 / 5 * 255;
|
|
31141
|
+
return [r2, g2, b2];
|
|
31142
|
+
};
|
|
31143
|
+
convert$2.rgb.hex = function(args) {
|
|
31144
|
+
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
31145
|
+
const string2 = integer.toString(16).toUpperCase();
|
|
31146
|
+
return "000000".slice(string2.length) + string2;
|
|
31147
|
+
};
|
|
31148
|
+
convert$2.hex.rgb = function(args) {
|
|
31149
|
+
const match = args.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
|
|
31150
|
+
if (!match) {
|
|
31151
|
+
return [0, 0, 0];
|
|
31152
|
+
}
|
|
31153
|
+
let colorString = match[0];
|
|
31154
|
+
if (match[0].length === 3) {
|
|
31155
|
+
colorString = [...colorString].map((char) => char + char).join("");
|
|
31156
|
+
}
|
|
31157
|
+
const integer = Number.parseInt(colorString, 16);
|
|
31158
|
+
const r2 = integer >> 16 & 255;
|
|
31159
|
+
const g2 = integer >> 8 & 255;
|
|
31160
|
+
const b2 = integer & 255;
|
|
31161
|
+
return [r2, g2, b2];
|
|
31162
|
+
};
|
|
31163
|
+
convert$2.rgb.hcg = function(rgb) {
|
|
31164
|
+
const r2 = rgb[0] / 255;
|
|
31165
|
+
const g2 = rgb[1] / 255;
|
|
31166
|
+
const b2 = rgb[2] / 255;
|
|
31167
|
+
const max2 = Math.max(Math.max(r2, g2), b2);
|
|
31168
|
+
const min2 = Math.min(Math.min(r2, g2), b2);
|
|
31169
|
+
const chroma = max2 - min2;
|
|
31170
|
+
let hue;
|
|
31171
|
+
const grayscale = chroma < 1 ? min2 / (1 - chroma) : 0;
|
|
31172
|
+
if (chroma <= 0) {
|
|
31173
|
+
hue = 0;
|
|
31174
|
+
} else if (max2 === r2) {
|
|
31175
|
+
hue = (g2 - b2) / chroma % 6;
|
|
31176
|
+
} else if (max2 === g2) {
|
|
31177
|
+
hue = 2 + (b2 - r2) / chroma;
|
|
31178
|
+
} else {
|
|
31179
|
+
hue = 4 + (r2 - g2) / chroma;
|
|
31564
31180
|
}
|
|
31565
|
-
|
|
31566
|
-
|
|
31567
|
-
|
|
31568
|
-
|
|
31569
|
-
|
|
31570
|
-
|
|
31571
|
-
|
|
31572
|
-
|
|
31573
|
-
|
|
31574
|
-
|
|
31575
|
-
|
|
31576
|
-
|
|
31181
|
+
hue /= 6;
|
|
31182
|
+
hue %= 1;
|
|
31183
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
31184
|
+
};
|
|
31185
|
+
convert$2.hsl.hcg = function(hsl) {
|
|
31186
|
+
const s2 = hsl[1] / 100;
|
|
31187
|
+
const l2 = hsl[2] / 100;
|
|
31188
|
+
const c2 = l2 < 0.5 ? 2 * s2 * l2 : 2 * s2 * (1 - l2);
|
|
31189
|
+
let f2 = 0;
|
|
31190
|
+
if (c2 < 1) {
|
|
31191
|
+
f2 = (l2 - 0.5 * c2) / (1 - c2);
|
|
31192
|
+
}
|
|
31193
|
+
return [hsl[0], c2 * 100, f2 * 100];
|
|
31194
|
+
};
|
|
31195
|
+
convert$2.hsv.hcg = function(hsv) {
|
|
31196
|
+
const s2 = hsv[1] / 100;
|
|
31197
|
+
const v2 = hsv[2] / 100;
|
|
31198
|
+
const c2 = s2 * v2;
|
|
31199
|
+
let f2 = 0;
|
|
31200
|
+
if (c2 < 1) {
|
|
31201
|
+
f2 = (v2 - c2) / (1 - c2);
|
|
31202
|
+
}
|
|
31203
|
+
return [hsv[0], c2 * 100, f2 * 100];
|
|
31204
|
+
};
|
|
31205
|
+
convert$2.hcg.rgb = function(hcg) {
|
|
31206
|
+
const h2 = hcg[0] / 360;
|
|
31207
|
+
const c2 = hcg[1] / 100;
|
|
31208
|
+
const g2 = hcg[2] / 100;
|
|
31209
|
+
if (c2 === 0) {
|
|
31210
|
+
return [g2 * 255, g2 * 255, g2 * 255];
|
|
31211
|
+
}
|
|
31212
|
+
const pure2 = [0, 0, 0];
|
|
31213
|
+
const hi = h2 % 1 * 6;
|
|
31214
|
+
const v2 = hi % 1;
|
|
31215
|
+
const w2 = 1 - v2;
|
|
31216
|
+
let mg = 0;
|
|
31217
|
+
switch (Math.floor(hi)) {
|
|
31218
|
+
case 0: {
|
|
31219
|
+
pure2[0] = 1;
|
|
31220
|
+
pure2[1] = v2;
|
|
31221
|
+
pure2[2] = 0;
|
|
31222
|
+
break;
|
|
31223
|
+
}
|
|
31224
|
+
case 1: {
|
|
31225
|
+
pure2[0] = w2;
|
|
31226
|
+
pure2[1] = 1;
|
|
31227
|
+
pure2[2] = 0;
|
|
31228
|
+
break;
|
|
31229
|
+
}
|
|
31230
|
+
case 2: {
|
|
31231
|
+
pure2[0] = 0;
|
|
31232
|
+
pure2[1] = 1;
|
|
31233
|
+
pure2[2] = v2;
|
|
31234
|
+
break;
|
|
31235
|
+
}
|
|
31236
|
+
case 3: {
|
|
31237
|
+
pure2[0] = 0;
|
|
31238
|
+
pure2[1] = w2;
|
|
31239
|
+
pure2[2] = 1;
|
|
31240
|
+
break;
|
|
31241
|
+
}
|
|
31242
|
+
case 4: {
|
|
31243
|
+
pure2[0] = v2;
|
|
31244
|
+
pure2[1] = 0;
|
|
31245
|
+
pure2[2] = 1;
|
|
31246
|
+
break;
|
|
31247
|
+
}
|
|
31248
|
+
default: {
|
|
31249
|
+
pure2[0] = 1;
|
|
31250
|
+
pure2[1] = 0;
|
|
31251
|
+
pure2[2] = w2;
|
|
31252
|
+
}
|
|
31577
31253
|
}
|
|
31578
|
-
|
|
31579
|
-
|
|
31580
|
-
|
|
31581
|
-
|
|
31582
|
-
|
|
31583
|
-
|
|
31584
|
-
|
|
31585
|
-
|
|
31586
|
-
|
|
31587
|
-
|
|
31254
|
+
mg = (1 - c2) * g2;
|
|
31255
|
+
return [
|
|
31256
|
+
(c2 * pure2[0] + mg) * 255,
|
|
31257
|
+
(c2 * pure2[1] + mg) * 255,
|
|
31258
|
+
(c2 * pure2[2] + mg) * 255
|
|
31259
|
+
];
|
|
31260
|
+
};
|
|
31261
|
+
convert$2.hcg.hsv = function(hcg) {
|
|
31262
|
+
const c2 = hcg[1] / 100;
|
|
31263
|
+
const g2 = hcg[2] / 100;
|
|
31264
|
+
const v2 = c2 + g2 * (1 - c2);
|
|
31265
|
+
let f2 = 0;
|
|
31266
|
+
if (v2 > 0) {
|
|
31267
|
+
f2 = c2 / v2;
|
|
31268
|
+
}
|
|
31269
|
+
return [hcg[0], f2 * 100, v2 * 100];
|
|
31270
|
+
};
|
|
31271
|
+
convert$2.hcg.hsl = function(hcg) {
|
|
31272
|
+
const c2 = hcg[1] / 100;
|
|
31273
|
+
const g2 = hcg[2] / 100;
|
|
31274
|
+
const l2 = g2 * (1 - c2) + 0.5 * c2;
|
|
31275
|
+
let s2 = 0;
|
|
31276
|
+
if (l2 > 0 && l2 < 0.5) {
|
|
31277
|
+
s2 = c2 / (2 * l2);
|
|
31278
|
+
} else if (l2 >= 0.5 && l2 < 1) {
|
|
31279
|
+
s2 = c2 / (2 * (1 - l2));
|
|
31280
|
+
}
|
|
31281
|
+
return [hcg[0], s2 * 100, l2 * 100];
|
|
31282
|
+
};
|
|
31283
|
+
convert$2.hcg.hwb = function(hcg) {
|
|
31284
|
+
const c2 = hcg[1] / 100;
|
|
31285
|
+
const g2 = hcg[2] / 100;
|
|
31286
|
+
const v2 = c2 + g2 * (1 - c2);
|
|
31287
|
+
return [hcg[0], (v2 - c2) * 100, (1 - v2) * 100];
|
|
31288
|
+
};
|
|
31289
|
+
convert$2.hwb.hcg = function(hwb) {
|
|
31290
|
+
const w2 = hwb[1] / 100;
|
|
31291
|
+
const b2 = hwb[2] / 100;
|
|
31292
|
+
const v2 = 1 - b2;
|
|
31293
|
+
const c2 = v2 - w2;
|
|
31294
|
+
let g2 = 0;
|
|
31295
|
+
if (c2 < 1) {
|
|
31296
|
+
g2 = (v2 - c2) / (1 - c2);
|
|
31297
|
+
}
|
|
31298
|
+
return [hwb[0], c2 * 100, g2 * 100];
|
|
31299
|
+
};
|
|
31300
|
+
convert$2.apple.rgb = function(apple) {
|
|
31301
|
+
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
31302
|
+
};
|
|
31303
|
+
convert$2.rgb.apple = function(rgb) {
|
|
31304
|
+
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
31305
|
+
};
|
|
31306
|
+
convert$2.gray.rgb = function(args) {
|
|
31307
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
31308
|
+
};
|
|
31309
|
+
convert$2.gray.hsl = function(args) {
|
|
31310
|
+
return [0, 0, args[0]];
|
|
31311
|
+
};
|
|
31312
|
+
convert$2.gray.hsv = convert$2.gray.hsl;
|
|
31313
|
+
convert$2.gray.hwb = function(gray) {
|
|
31314
|
+
return [0, 100, gray[0]];
|
|
31315
|
+
};
|
|
31316
|
+
convert$2.gray.cmyk = function(gray) {
|
|
31317
|
+
return [0, 0, 0, gray[0]];
|
|
31318
|
+
};
|
|
31319
|
+
convert$2.gray.lab = function(gray) {
|
|
31320
|
+
return [gray[0], 0, 0];
|
|
31321
|
+
};
|
|
31322
|
+
convert$2.gray.hex = function(gray) {
|
|
31323
|
+
const value = Math.round(gray[0] / 100 * 255) & 255;
|
|
31324
|
+
const integer = (value << 16) + (value << 8) + value;
|
|
31325
|
+
const string2 = integer.toString(16).toUpperCase();
|
|
31326
|
+
return "000000".slice(string2.length) + string2;
|
|
31327
|
+
};
|
|
31328
|
+
convert$2.rgb.gray = function(rgb) {
|
|
31329
|
+
const value = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
31330
|
+
return [value / 255 * 100];
|
|
31331
|
+
};
|
|
31332
|
+
function buildGraph() {
|
|
31333
|
+
const graph = {};
|
|
31334
|
+
const models2 = Object.keys(convert$2);
|
|
31335
|
+
for (let { length } = models2, i2 = 0; i2 < length; i2++) {
|
|
31336
|
+
graph[models2[i2]] = {
|
|
31337
|
+
// http://jsperf.com/1-vs-infinity
|
|
31338
|
+
// micro-opt, but this is simple.
|
|
31339
|
+
distance: -1,
|
|
31340
|
+
parent: null
|
|
31341
|
+
};
|
|
31342
|
+
}
|
|
31343
|
+
return graph;
|
|
31344
|
+
}
|
|
31345
|
+
__name(buildGraph, "buildGraph");
|
|
31346
|
+
function deriveBFS(fromModel) {
|
|
31347
|
+
const graph = buildGraph();
|
|
31348
|
+
const queue = [fromModel];
|
|
31349
|
+
graph[fromModel].distance = 0;
|
|
31350
|
+
while (queue.length > 0) {
|
|
31351
|
+
const current = queue.pop();
|
|
31352
|
+
const adjacents = Object.keys(convert$2[current]);
|
|
31353
|
+
for (let { length } = adjacents, i2 = 0; i2 < length; i2++) {
|
|
31354
|
+
const adjacent = adjacents[i2];
|
|
31355
|
+
const node2 = graph[adjacent];
|
|
31356
|
+
if (node2.distance === -1) {
|
|
31357
|
+
node2.distance = graph[current].distance + 1;
|
|
31358
|
+
node2.parent = current;
|
|
31359
|
+
queue.unshift(adjacent);
|
|
31588
31360
|
}
|
|
31589
|
-
conversion[toModel] = wrapConversion(toModel, graph);
|
|
31590
31361
|
}
|
|
31591
|
-
|
|
31592
|
-
|
|
31593
|
-
return route;
|
|
31362
|
+
}
|
|
31363
|
+
return graph;
|
|
31594
31364
|
}
|
|
31595
|
-
__name(
|
|
31596
|
-
|
|
31597
|
-
|
|
31598
|
-
|
|
31599
|
-
|
|
31600
|
-
|
|
31601
|
-
|
|
31602
|
-
|
|
31603
|
-
|
|
31604
|
-
|
|
31605
|
-
|
|
31606
|
-
|
|
31607
|
-
|
|
31608
|
-
|
|
31609
|
-
|
|
31610
|
-
|
|
31611
|
-
|
|
31612
|
-
|
|
31613
|
-
|
|
31614
|
-
|
|
31615
|
-
|
|
31616
|
-
|
|
31365
|
+
__name(deriveBFS, "deriveBFS");
|
|
31366
|
+
function link$2(from, to) {
|
|
31367
|
+
return function(args) {
|
|
31368
|
+
return to(from(args));
|
|
31369
|
+
};
|
|
31370
|
+
}
|
|
31371
|
+
__name(link$2, "link$2");
|
|
31372
|
+
function wrapConversion(toModel, graph) {
|
|
31373
|
+
const path2 = [graph[toModel].parent, toModel];
|
|
31374
|
+
let fn4 = convert$2[graph[toModel].parent][toModel];
|
|
31375
|
+
let cur = graph[toModel].parent;
|
|
31376
|
+
while (graph[cur].parent) {
|
|
31377
|
+
path2.unshift(graph[cur].parent);
|
|
31378
|
+
fn4 = link$2(convert$2[graph[cur].parent][cur], fn4);
|
|
31379
|
+
cur = graph[cur].parent;
|
|
31380
|
+
}
|
|
31381
|
+
fn4.conversion = path2;
|
|
31382
|
+
return fn4;
|
|
31383
|
+
}
|
|
31384
|
+
__name(wrapConversion, "wrapConversion");
|
|
31385
|
+
function route(fromModel) {
|
|
31386
|
+
const graph = deriveBFS(fromModel);
|
|
31387
|
+
const conversion = {};
|
|
31388
|
+
const models2 = Object.keys(graph);
|
|
31389
|
+
for (let { length } = models2, i2 = 0; i2 < length; i2++) {
|
|
31390
|
+
const toModel = models2[i2];
|
|
31391
|
+
const node2 = graph[toModel];
|
|
31392
|
+
if (node2.parent === null) {
|
|
31393
|
+
continue;
|
|
31617
31394
|
}
|
|
31618
|
-
|
|
31395
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
31619
31396
|
}
|
|
31620
|
-
|
|
31621
|
-
|
|
31622
|
-
|
|
31623
|
-
|
|
31624
|
-
|
|
31625
|
-
|
|
31626
|
-
|
|
31627
|
-
|
|
31628
|
-
|
|
31629
|
-
|
|
31630
|
-
if (typeof result === "object") {
|
|
31631
|
-
for (var len = result.length, i2 = 0; i2 < len; i2++) {
|
|
31632
|
-
result[i2] = Math.round(result[i2]);
|
|
31633
|
-
}
|
|
31634
|
-
}
|
|
31635
|
-
return result;
|
|
31636
|
-
}, "wrappedFn");
|
|
31637
|
-
if ("conversion" in fn4) {
|
|
31638
|
-
wrappedFn.conversion = fn4.conversion;
|
|
31639
|
-
}
|
|
31640
|
-
return wrappedFn;
|
|
31641
|
-
}
|
|
31642
|
-
__name(wrapRounded, "wrapRounded");
|
|
31643
|
-
models.forEach(function(fromModel) {
|
|
31644
|
-
convert2[fromModel] = {};
|
|
31645
|
-
Object.defineProperty(convert2[fromModel], "channels", { value: conversions2[fromModel].channels });
|
|
31646
|
-
Object.defineProperty(convert2[fromModel], "labels", { value: conversions2[fromModel].labels });
|
|
31647
|
-
var routes = route2(fromModel);
|
|
31648
|
-
var routeModels = Object.keys(routes);
|
|
31649
|
-
routeModels.forEach(function(toModel) {
|
|
31650
|
-
var fn4 = routes[toModel];
|
|
31651
|
-
convert2[fromModel][toModel] = wrapRounded(fn4);
|
|
31652
|
-
convert2[fromModel][toModel].raw = wrapRaw(fn4);
|
|
31653
|
-
});
|
|
31654
|
-
});
|
|
31655
|
-
colorConvert = convert2;
|
|
31656
|
-
return colorConvert;
|
|
31657
|
-
}
|
|
31658
|
-
__name(requireColorConvert, "requireColorConvert");
|
|
31659
|
-
var color$1;
|
|
31660
|
-
var hasRequiredColor;
|
|
31661
|
-
function requireColor() {
|
|
31662
|
-
if (hasRequiredColor) return color$1;
|
|
31663
|
-
hasRequiredColor = 1;
|
|
31664
|
-
var colorString2 = requireColorString();
|
|
31665
|
-
var convert2 = requireColorConvert();
|
|
31666
|
-
var _slice = [].slice;
|
|
31667
|
-
var skippedModels = [
|
|
31668
|
-
// to be honest, I don't really feel like keyword belongs in color convert, but eh.
|
|
31669
|
-
"keyword",
|
|
31670
|
-
// gray conflicts with some method names, and has its own method defined.
|
|
31671
|
-
"gray",
|
|
31672
|
-
// shouldn't really be in color-convert either...
|
|
31673
|
-
"hex"
|
|
31674
|
-
];
|
|
31675
|
-
var hashedModelKeys = {};
|
|
31676
|
-
Object.keys(convert2).forEach(function(model) {
|
|
31677
|
-
hashedModelKeys[_slice.call(convert2[model].labels).sort().join("")] = model;
|
|
31678
|
-
});
|
|
31679
|
-
var limiters = {};
|
|
31680
|
-
function Color2(obj, model) {
|
|
31681
|
-
if (!(this instanceof Color2)) {
|
|
31682
|
-
return new Color2(obj, model);
|
|
31397
|
+
return conversion;
|
|
31398
|
+
}
|
|
31399
|
+
__name(route, "route");
|
|
31400
|
+
const convert$1 = {};
|
|
31401
|
+
const models = Object.keys(convert$2);
|
|
31402
|
+
function wrapRaw(fn4) {
|
|
31403
|
+
const wrappedFn = /* @__PURE__ */ __name(function(...args) {
|
|
31404
|
+
const arg0 = args[0];
|
|
31405
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
31406
|
+
return arg0;
|
|
31683
31407
|
}
|
|
31684
|
-
if (
|
|
31685
|
-
|
|
31408
|
+
if (arg0.length > 1) {
|
|
31409
|
+
args = arg0;
|
|
31686
31410
|
}
|
|
31687
|
-
|
|
31688
|
-
|
|
31411
|
+
return fn4(args);
|
|
31412
|
+
}, "wrappedFn");
|
|
31413
|
+
if ("conversion" in fn4) {
|
|
31414
|
+
wrappedFn.conversion = fn4.conversion;
|
|
31415
|
+
}
|
|
31416
|
+
return wrappedFn;
|
|
31417
|
+
}
|
|
31418
|
+
__name(wrapRaw, "wrapRaw");
|
|
31419
|
+
function wrapRounded(fn4) {
|
|
31420
|
+
const wrappedFn = /* @__PURE__ */ __name(function(...args) {
|
|
31421
|
+
const arg0 = args[0];
|
|
31422
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
31423
|
+
return arg0;
|
|
31689
31424
|
}
|
|
31690
|
-
|
|
31691
|
-
|
|
31692
|
-
if (obj == null) {
|
|
31693
|
-
this.model = "rgb";
|
|
31694
|
-
this.color = [0, 0, 0];
|
|
31695
|
-
this.valpha = 1;
|
|
31696
|
-
} else if (obj instanceof Color2) {
|
|
31697
|
-
this.model = obj.model;
|
|
31698
|
-
this.color = obj.color.slice();
|
|
31699
|
-
this.valpha = obj.valpha;
|
|
31700
|
-
} else if (typeof obj === "string") {
|
|
31701
|
-
var result = colorString2.get(obj);
|
|
31702
|
-
if (result === null) {
|
|
31703
|
-
throw new Error("Unable to parse color from string: " + obj);
|
|
31704
|
-
}
|
|
31705
|
-
this.model = result.model;
|
|
31706
|
-
channels = convert2[this.model].channels;
|
|
31707
|
-
this.color = result.value.slice(0, channels);
|
|
31708
|
-
this.valpha = typeof result.value[channels] === "number" ? result.value[channels] : 1;
|
|
31709
|
-
} else if (obj.length) {
|
|
31710
|
-
this.model = model || "rgb";
|
|
31711
|
-
channels = convert2[this.model].channels;
|
|
31712
|
-
var newArr = _slice.call(obj, 0, channels);
|
|
31713
|
-
this.color = zeroArray(newArr, channels);
|
|
31714
|
-
this.valpha = typeof obj[channels] === "number" ? obj[channels] : 1;
|
|
31715
|
-
} else if (typeof obj === "number") {
|
|
31716
|
-
obj &= 16777215;
|
|
31717
|
-
this.model = "rgb";
|
|
31718
|
-
this.color = [
|
|
31719
|
-
obj >> 16 & 255,
|
|
31720
|
-
obj >> 8 & 255,
|
|
31721
|
-
obj & 255
|
|
31722
|
-
];
|
|
31723
|
-
this.valpha = 1;
|
|
31724
|
-
} else {
|
|
31725
|
-
this.valpha = 1;
|
|
31726
|
-
var keys2 = Object.keys(obj);
|
|
31727
|
-
if ("alpha" in obj) {
|
|
31728
|
-
keys2.splice(keys2.indexOf("alpha"), 1);
|
|
31729
|
-
this.valpha = typeof obj.alpha === "number" ? obj.alpha : 0;
|
|
31730
|
-
}
|
|
31731
|
-
var hashedKeys = keys2.sort().join("");
|
|
31732
|
-
if (!(hashedKeys in hashedModelKeys)) {
|
|
31733
|
-
throw new Error("Unable to parse color from object: " + JSON.stringify(obj));
|
|
31734
|
-
}
|
|
31735
|
-
this.model = hashedModelKeys[hashedKeys];
|
|
31736
|
-
var labels = convert2[this.model].labels;
|
|
31737
|
-
var color2 = [];
|
|
31738
|
-
for (i2 = 0; i2 < labels.length; i2++) {
|
|
31739
|
-
color2.push(obj[labels[i2]]);
|
|
31740
|
-
}
|
|
31741
|
-
this.color = zeroArray(color2);
|
|
31742
|
-
}
|
|
31743
|
-
if (limiters[this.model]) {
|
|
31744
|
-
channels = convert2[this.model].channels;
|
|
31745
|
-
for (i2 = 0; i2 < channels; i2++) {
|
|
31746
|
-
var limit = limiters[this.model][i2];
|
|
31747
|
-
if (limit) {
|
|
31748
|
-
this.color[i2] = limit(this.color[i2]);
|
|
31749
|
-
}
|
|
31750
|
-
}
|
|
31751
|
-
}
|
|
31752
|
-
this.valpha = Math.max(0, Math.min(1, this.valpha));
|
|
31753
|
-
if (Object.freeze) {
|
|
31754
|
-
Object.freeze(this);
|
|
31755
|
-
}
|
|
31756
|
-
}
|
|
31757
|
-
__name(Color2, "Color");
|
|
31758
|
-
Color2.prototype = {
|
|
31759
|
-
toString: /* @__PURE__ */ __name(function() {
|
|
31760
|
-
return this.string();
|
|
31761
|
-
}, "toString"),
|
|
31762
|
-
toJSON: /* @__PURE__ */ __name(function() {
|
|
31763
|
-
return this[this.model]();
|
|
31764
|
-
}, "toJSON"),
|
|
31765
|
-
string: /* @__PURE__ */ __name(function(places) {
|
|
31766
|
-
var self2 = this.model in colorString2.to ? this : this.rgb();
|
|
31767
|
-
self2 = self2.round(typeof places === "number" ? places : 1);
|
|
31768
|
-
var args = self2.valpha === 1 ? self2.color : self2.color.concat(this.valpha);
|
|
31769
|
-
return colorString2.to[self2.model](args);
|
|
31770
|
-
}, "string"),
|
|
31771
|
-
percentString: /* @__PURE__ */ __name(function(places) {
|
|
31772
|
-
var self2 = this.rgb().round(typeof places === "number" ? places : 1);
|
|
31773
|
-
var args = self2.valpha === 1 ? self2.color : self2.color.concat(this.valpha);
|
|
31774
|
-
return colorString2.to.rgb.percent(args);
|
|
31775
|
-
}, "percentString"),
|
|
31776
|
-
array: /* @__PURE__ */ __name(function() {
|
|
31777
|
-
return this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);
|
|
31778
|
-
}, "array"),
|
|
31779
|
-
object: /* @__PURE__ */ __name(function() {
|
|
31780
|
-
var result = {};
|
|
31781
|
-
var channels = convert2[this.model].channels;
|
|
31782
|
-
var labels = convert2[this.model].labels;
|
|
31783
|
-
for (var i2 = 0; i2 < channels; i2++) {
|
|
31784
|
-
result[labels[i2]] = this.color[i2];
|
|
31785
|
-
}
|
|
31786
|
-
if (this.valpha !== 1) {
|
|
31787
|
-
result.alpha = this.valpha;
|
|
31788
|
-
}
|
|
31789
|
-
return result;
|
|
31790
|
-
}, "object"),
|
|
31791
|
-
unitArray: /* @__PURE__ */ __name(function() {
|
|
31792
|
-
var rgb = this.rgb().color;
|
|
31793
|
-
rgb[0] /= 255;
|
|
31794
|
-
rgb[1] /= 255;
|
|
31795
|
-
rgb[2] /= 255;
|
|
31796
|
-
if (this.valpha !== 1) {
|
|
31797
|
-
rgb.push(this.valpha);
|
|
31798
|
-
}
|
|
31799
|
-
return rgb;
|
|
31800
|
-
}, "unitArray"),
|
|
31801
|
-
unitObject: /* @__PURE__ */ __name(function() {
|
|
31802
|
-
var rgb = this.rgb().object();
|
|
31803
|
-
rgb.r /= 255;
|
|
31804
|
-
rgb.g /= 255;
|
|
31805
|
-
rgb.b /= 255;
|
|
31806
|
-
if (this.valpha !== 1) {
|
|
31807
|
-
rgb.alpha = this.valpha;
|
|
31808
|
-
}
|
|
31809
|
-
return rgb;
|
|
31810
|
-
}, "unitObject"),
|
|
31811
|
-
round: /* @__PURE__ */ __name(function(places) {
|
|
31812
|
-
places = Math.max(places || 0, 0);
|
|
31813
|
-
return new Color2(this.color.map(roundToPlace(places)).concat(this.valpha), this.model);
|
|
31814
|
-
}, "round"),
|
|
31815
|
-
alpha: /* @__PURE__ */ __name(function(val) {
|
|
31816
|
-
if (arguments.length) {
|
|
31817
|
-
return new Color2(this.color.concat(Math.max(0, Math.min(1, val))), this.model);
|
|
31818
|
-
}
|
|
31819
|
-
return this.valpha;
|
|
31820
|
-
}, "alpha"),
|
|
31821
|
-
// rgb
|
|
31822
|
-
red: getset("rgb", 0, maxfn(255)),
|
|
31823
|
-
green: getset("rgb", 1, maxfn(255)),
|
|
31824
|
-
blue: getset("rgb", 2, maxfn(255)),
|
|
31825
|
-
hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, function(val) {
|
|
31826
|
-
return (val % 360 + 360) % 360;
|
|
31827
|
-
}),
|
|
31828
|
-
// eslint-disable-line brace-style
|
|
31829
|
-
saturationl: getset("hsl", 1, maxfn(100)),
|
|
31830
|
-
lightness: getset("hsl", 2, maxfn(100)),
|
|
31831
|
-
saturationv: getset("hsv", 1, maxfn(100)),
|
|
31832
|
-
value: getset("hsv", 2, maxfn(100)),
|
|
31833
|
-
chroma: getset("hcg", 1, maxfn(100)),
|
|
31834
|
-
gray: getset("hcg", 2, maxfn(100)),
|
|
31835
|
-
white: getset("hwb", 1, maxfn(100)),
|
|
31836
|
-
wblack: getset("hwb", 2, maxfn(100)),
|
|
31837
|
-
cyan: getset("cmyk", 0, maxfn(100)),
|
|
31838
|
-
magenta: getset("cmyk", 1, maxfn(100)),
|
|
31839
|
-
yellow: getset("cmyk", 2, maxfn(100)),
|
|
31840
|
-
black: getset("cmyk", 3, maxfn(100)),
|
|
31841
|
-
x: getset("xyz", 0, maxfn(100)),
|
|
31842
|
-
y: getset("xyz", 1, maxfn(100)),
|
|
31843
|
-
z: getset("xyz", 2, maxfn(100)),
|
|
31844
|
-
l: getset("lab", 0, maxfn(100)),
|
|
31845
|
-
a: getset("lab", 1),
|
|
31846
|
-
b: getset("lab", 2),
|
|
31847
|
-
keyword: /* @__PURE__ */ __name(function(val) {
|
|
31848
|
-
if (arguments.length) {
|
|
31849
|
-
return new Color2(val);
|
|
31850
|
-
}
|
|
31851
|
-
return convert2[this.model].keyword(this.color);
|
|
31852
|
-
}, "keyword"),
|
|
31853
|
-
hex: /* @__PURE__ */ __name(function(val) {
|
|
31854
|
-
if (arguments.length) {
|
|
31855
|
-
return new Color2(val);
|
|
31856
|
-
}
|
|
31857
|
-
return colorString2.to.hex(this.rgb().round().color);
|
|
31858
|
-
}, "hex"),
|
|
31859
|
-
rgbNumber: /* @__PURE__ */ __name(function() {
|
|
31860
|
-
var rgb = this.rgb().color;
|
|
31861
|
-
return (rgb[0] & 255) << 16 | (rgb[1] & 255) << 8 | rgb[2] & 255;
|
|
31862
|
-
}, "rgbNumber"),
|
|
31863
|
-
luminosity: /* @__PURE__ */ __name(function() {
|
|
31864
|
-
var rgb = this.rgb().color;
|
|
31865
|
-
var lum = [];
|
|
31866
|
-
for (var i2 = 0; i2 < rgb.length; i2++) {
|
|
31867
|
-
var chan = rgb[i2] / 255;
|
|
31868
|
-
lum[i2] = chan <= 0.03928 ? chan / 12.92 : Math.pow((chan + 0.055) / 1.055, 2.4);
|
|
31869
|
-
}
|
|
31870
|
-
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
|
|
31871
|
-
}, "luminosity"),
|
|
31872
|
-
contrast: /* @__PURE__ */ __name(function(color2) {
|
|
31873
|
-
var lum1 = this.luminosity();
|
|
31874
|
-
var lum2 = color2.luminosity();
|
|
31875
|
-
if (lum1 > lum2) {
|
|
31876
|
-
return (lum1 + 0.05) / (lum2 + 0.05);
|
|
31877
|
-
}
|
|
31878
|
-
return (lum2 + 0.05) / (lum1 + 0.05);
|
|
31879
|
-
}, "contrast"),
|
|
31880
|
-
level: /* @__PURE__ */ __name(function(color2) {
|
|
31881
|
-
var contrastRatio = this.contrast(color2);
|
|
31882
|
-
if (contrastRatio >= 7.1) {
|
|
31883
|
-
return "AAA";
|
|
31884
|
-
}
|
|
31885
|
-
return contrastRatio >= 4.5 ? "AA" : "";
|
|
31886
|
-
}, "level"),
|
|
31887
|
-
isDark: /* @__PURE__ */ __name(function() {
|
|
31888
|
-
var rgb = this.rgb().color;
|
|
31889
|
-
var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1e3;
|
|
31890
|
-
return yiq < 128;
|
|
31891
|
-
}, "isDark"),
|
|
31892
|
-
isLight: /* @__PURE__ */ __name(function() {
|
|
31893
|
-
return !this.isDark();
|
|
31894
|
-
}, "isLight"),
|
|
31895
|
-
negate: /* @__PURE__ */ __name(function() {
|
|
31896
|
-
var rgb = this.rgb();
|
|
31897
|
-
for (var i2 = 0; i2 < 3; i2++) {
|
|
31898
|
-
rgb.color[i2] = 255 - rgb.color[i2];
|
|
31899
|
-
}
|
|
31900
|
-
return rgb;
|
|
31901
|
-
}, "negate"),
|
|
31902
|
-
lighten: /* @__PURE__ */ __name(function(ratio) {
|
|
31903
|
-
var hsl = this.hsl();
|
|
31904
|
-
hsl.color[2] += hsl.color[2] * ratio;
|
|
31905
|
-
return hsl;
|
|
31906
|
-
}, "lighten"),
|
|
31907
|
-
darken: /* @__PURE__ */ __name(function(ratio) {
|
|
31908
|
-
var hsl = this.hsl();
|
|
31909
|
-
hsl.color[2] -= hsl.color[2] * ratio;
|
|
31910
|
-
return hsl;
|
|
31911
|
-
}, "darken"),
|
|
31912
|
-
saturate: /* @__PURE__ */ __name(function(ratio) {
|
|
31913
|
-
var hsl = this.hsl();
|
|
31914
|
-
hsl.color[1] += hsl.color[1] * ratio;
|
|
31915
|
-
return hsl;
|
|
31916
|
-
}, "saturate"),
|
|
31917
|
-
desaturate: /* @__PURE__ */ __name(function(ratio) {
|
|
31918
|
-
var hsl = this.hsl();
|
|
31919
|
-
hsl.color[1] -= hsl.color[1] * ratio;
|
|
31920
|
-
return hsl;
|
|
31921
|
-
}, "desaturate"),
|
|
31922
|
-
whiten: /* @__PURE__ */ __name(function(ratio) {
|
|
31923
|
-
var hwb = this.hwb();
|
|
31924
|
-
hwb.color[1] += hwb.color[1] * ratio;
|
|
31925
|
-
return hwb;
|
|
31926
|
-
}, "whiten"),
|
|
31927
|
-
blacken: /* @__PURE__ */ __name(function(ratio) {
|
|
31928
|
-
var hwb = this.hwb();
|
|
31929
|
-
hwb.color[2] += hwb.color[2] * ratio;
|
|
31930
|
-
return hwb;
|
|
31931
|
-
}, "blacken"),
|
|
31932
|
-
grayscale: /* @__PURE__ */ __name(function() {
|
|
31933
|
-
var rgb = this.rgb().color;
|
|
31934
|
-
var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
|
|
31935
|
-
return Color2.rgb(val, val, val);
|
|
31936
|
-
}, "grayscale"),
|
|
31937
|
-
fade: /* @__PURE__ */ __name(function(ratio) {
|
|
31938
|
-
return this.alpha(this.valpha - this.valpha * ratio);
|
|
31939
|
-
}, "fade"),
|
|
31940
|
-
opaquer: /* @__PURE__ */ __name(function(ratio) {
|
|
31941
|
-
return this.alpha(this.valpha + this.valpha * ratio);
|
|
31942
|
-
}, "opaquer"),
|
|
31943
|
-
rotate: /* @__PURE__ */ __name(function(degrees) {
|
|
31944
|
-
var hsl = this.hsl();
|
|
31945
|
-
var hue = hsl.color[0];
|
|
31946
|
-
hue = (hue + degrees) % 360;
|
|
31947
|
-
hue = hue < 0 ? 360 + hue : hue;
|
|
31948
|
-
hsl.color[0] = hue;
|
|
31949
|
-
return hsl;
|
|
31950
|
-
}, "rotate"),
|
|
31951
|
-
mix: /* @__PURE__ */ __name(function(mixinColor, weight) {
|
|
31952
|
-
if (!mixinColor || !mixinColor.rgb) {
|
|
31953
|
-
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
|
|
31954
|
-
}
|
|
31955
|
-
var color1 = mixinColor.rgb();
|
|
31956
|
-
var color2 = this.rgb();
|
|
31957
|
-
var p2 = weight === void 0 ? 0.5 : weight;
|
|
31958
|
-
var w2 = 2 * p2 - 1;
|
|
31959
|
-
var a2 = color1.alpha() - color2.alpha();
|
|
31960
|
-
var w1 = ((w2 * a2 === -1 ? w2 : (w2 + a2) / (1 + w2 * a2)) + 1) / 2;
|
|
31961
|
-
var w22 = 1 - w1;
|
|
31962
|
-
return Color2.rgb(
|
|
31963
|
-
w1 * color1.red() + w22 * color2.red(),
|
|
31964
|
-
w1 * color1.green() + w22 * color2.green(),
|
|
31965
|
-
w1 * color1.blue() + w22 * color2.blue(),
|
|
31966
|
-
color1.alpha() * p2 + color2.alpha() * (1 - p2)
|
|
31967
|
-
);
|
|
31968
|
-
}, "mix")
|
|
31969
|
-
};
|
|
31970
|
-
Object.keys(convert2).forEach(function(model) {
|
|
31971
|
-
if (skippedModels.indexOf(model) !== -1) {
|
|
31972
|
-
return;
|
|
31425
|
+
if (arg0.length > 1) {
|
|
31426
|
+
args = arg0;
|
|
31973
31427
|
}
|
|
31974
|
-
|
|
31975
|
-
|
|
31976
|
-
|
|
31977
|
-
|
|
31978
|
-
}
|
|
31979
|
-
if (arguments.length) {
|
|
31980
|
-
return new Color2(arguments, model);
|
|
31981
|
-
}
|
|
31982
|
-
var newAlpha = typeof arguments[channels] === "number" ? channels : this.valpha;
|
|
31983
|
-
return new Color2(assertArray(convert2[this.model][model].raw(this.color)).concat(newAlpha), model);
|
|
31984
|
-
};
|
|
31985
|
-
Color2[model] = function(color2) {
|
|
31986
|
-
if (typeof color2 === "number") {
|
|
31987
|
-
color2 = zeroArray(_slice.call(arguments), channels);
|
|
31428
|
+
const result = fn4(args);
|
|
31429
|
+
if (typeof result === "object") {
|
|
31430
|
+
for (let { length } = result, i2 = 0; i2 < length; i2++) {
|
|
31431
|
+
result[i2] = Math.round(result[i2]);
|
|
31988
31432
|
}
|
|
31989
|
-
|
|
31990
|
-
|
|
31991
|
-
});
|
|
31992
|
-
|
|
31993
|
-
|
|
31433
|
+
}
|
|
31434
|
+
return result;
|
|
31435
|
+
}, "wrappedFn");
|
|
31436
|
+
if ("conversion" in fn4) {
|
|
31437
|
+
wrappedFn.conversion = fn4.conversion;
|
|
31438
|
+
}
|
|
31439
|
+
return wrappedFn;
|
|
31440
|
+
}
|
|
31441
|
+
__name(wrapRounded, "wrapRounded");
|
|
31442
|
+
for (const fromModel of models) {
|
|
31443
|
+
convert$1[fromModel] = {};
|
|
31444
|
+
Object.defineProperty(convert$1[fromModel], "channels", { value: convert$2[fromModel].channels });
|
|
31445
|
+
Object.defineProperty(convert$1[fromModel], "labels", { value: convert$2[fromModel].labels });
|
|
31446
|
+
const routes = route(fromModel);
|
|
31447
|
+
const routeModels = Object.keys(routes);
|
|
31448
|
+
for (const toModel of routeModels) {
|
|
31449
|
+
const fn4 = routes[toModel];
|
|
31450
|
+
convert$1[fromModel][toModel] = wrapRounded(fn4);
|
|
31451
|
+
convert$1[fromModel][toModel].raw = wrapRaw(fn4);
|
|
31452
|
+
}
|
|
31453
|
+
}
|
|
31454
|
+
const skippedModels = [
|
|
31455
|
+
// To be honest, I don't really feel like keyword belongs in color convert, but eh.
|
|
31456
|
+
"keyword",
|
|
31457
|
+
// Gray conflicts with some method names, and has its own method defined.
|
|
31458
|
+
"gray",
|
|
31459
|
+
// Shouldn't really be in color-convert either...
|
|
31460
|
+
"hex"
|
|
31461
|
+
];
|
|
31462
|
+
const hashedModelKeys = {};
|
|
31463
|
+
for (const model of Object.keys(convert$1)) {
|
|
31464
|
+
hashedModelKeys[[...convert$1[model].labels].sort().join("")] = model;
|
|
31465
|
+
}
|
|
31466
|
+
const limiters = {};
|
|
31467
|
+
function Color(object2, model) {
|
|
31468
|
+
if (!(this instanceof Color)) {
|
|
31469
|
+
return new Color(object2, model);
|
|
31994
31470
|
}
|
|
31995
|
-
|
|
31996
|
-
|
|
31997
|
-
return function(num) {
|
|
31998
|
-
return roundTo(num, places);
|
|
31999
|
-
};
|
|
31471
|
+
if (model && model in skippedModels) {
|
|
31472
|
+
model = null;
|
|
32000
31473
|
}
|
|
32001
|
-
|
|
32002
|
-
|
|
32003
|
-
|
|
32004
|
-
|
|
32005
|
-
|
|
32006
|
-
|
|
32007
|
-
model =
|
|
32008
|
-
|
|
32009
|
-
|
|
32010
|
-
|
|
32011
|
-
|
|
32012
|
-
|
|
32013
|
-
|
|
32014
|
-
|
|
32015
|
-
|
|
32016
|
-
|
|
32017
|
-
|
|
32018
|
-
|
|
32019
|
-
|
|
32020
|
-
|
|
31474
|
+
if (model && !(model in convert$1)) {
|
|
31475
|
+
throw new Error("Unknown model: " + model);
|
|
31476
|
+
}
|
|
31477
|
+
let i2;
|
|
31478
|
+
let channels;
|
|
31479
|
+
if (object2 == null) {
|
|
31480
|
+
this.model = "rgb";
|
|
31481
|
+
this.color = [0, 0, 0];
|
|
31482
|
+
this.valpha = 1;
|
|
31483
|
+
} else if (object2 instanceof Color) {
|
|
31484
|
+
this.model = object2.model;
|
|
31485
|
+
this.color = [...object2.color];
|
|
31486
|
+
this.valpha = object2.valpha;
|
|
31487
|
+
} else if (typeof object2 === "string") {
|
|
31488
|
+
const result = cs.get(object2);
|
|
31489
|
+
if (result === null) {
|
|
31490
|
+
throw new Error("Unable to parse color from string: " + object2);
|
|
31491
|
+
}
|
|
31492
|
+
this.model = result.model;
|
|
31493
|
+
channels = convert$1[this.model].channels;
|
|
31494
|
+
this.color = result.value.slice(0, channels);
|
|
31495
|
+
this.valpha = typeof result.value[channels] === "number" ? result.value[channels] : 1;
|
|
31496
|
+
} else if (object2.length > 0) {
|
|
31497
|
+
this.model = model || "rgb";
|
|
31498
|
+
channels = convert$1[this.model].channels;
|
|
31499
|
+
const newArray = Array.prototype.slice.call(object2, 0, channels);
|
|
31500
|
+
this.color = zeroArray(newArray, channels);
|
|
31501
|
+
this.valpha = typeof object2[channels] === "number" ? object2[channels] : 1;
|
|
31502
|
+
} else if (typeof object2 === "number") {
|
|
31503
|
+
this.model = "rgb";
|
|
31504
|
+
this.color = [
|
|
31505
|
+
object2 >> 16 & 255,
|
|
31506
|
+
object2 >> 8 & 255,
|
|
31507
|
+
object2 & 255
|
|
31508
|
+
];
|
|
31509
|
+
this.valpha = 1;
|
|
31510
|
+
} else {
|
|
31511
|
+
this.valpha = 1;
|
|
31512
|
+
const keys2 = Object.keys(object2);
|
|
31513
|
+
if ("alpha" in object2) {
|
|
31514
|
+
keys2.splice(keys2.indexOf("alpha"), 1);
|
|
31515
|
+
this.valpha = typeof object2.alpha === "number" ? object2.alpha : 0;
|
|
31516
|
+
}
|
|
31517
|
+
const hashedKeys = keys2.sort().join("");
|
|
31518
|
+
if (!(hashedKeys in hashedModelKeys)) {
|
|
31519
|
+
throw new Error("Unable to parse color from object: " + JSON.stringify(object2));
|
|
31520
|
+
}
|
|
31521
|
+
this.model = hashedModelKeys[hashedKeys];
|
|
31522
|
+
const { labels } = convert$1[this.model];
|
|
31523
|
+
const color2 = [];
|
|
31524
|
+
for (i2 = 0; i2 < labels.length; i2++) {
|
|
31525
|
+
color2.push(object2[labels[i2]]);
|
|
31526
|
+
}
|
|
31527
|
+
this.color = zeroArray(color2);
|
|
31528
|
+
}
|
|
31529
|
+
if (limiters[this.model]) {
|
|
31530
|
+
channels = convert$1[this.model].channels;
|
|
31531
|
+
for (i2 = 0; i2 < channels; i2++) {
|
|
31532
|
+
const limit = limiters[this.model][i2];
|
|
31533
|
+
if (limit) {
|
|
31534
|
+
this.color[i2] = limit(this.color[i2]);
|
|
32021
31535
|
}
|
|
32022
|
-
|
|
32023
|
-
};
|
|
31536
|
+
}
|
|
32024
31537
|
}
|
|
32025
|
-
|
|
32026
|
-
|
|
32027
|
-
|
|
32028
|
-
|
|
32029
|
-
|
|
31538
|
+
this.valpha = Math.max(0, Math.min(1, this.valpha));
|
|
31539
|
+
if (Object.freeze) {
|
|
31540
|
+
Object.freeze(this);
|
|
31541
|
+
}
|
|
31542
|
+
}
|
|
31543
|
+
__name(Color, "Color");
|
|
31544
|
+
Color.prototype = {
|
|
31545
|
+
toString() {
|
|
31546
|
+
return this.string();
|
|
31547
|
+
},
|
|
31548
|
+
toJSON() {
|
|
31549
|
+
return this[this.model]();
|
|
31550
|
+
},
|
|
31551
|
+
string(places) {
|
|
31552
|
+
let self2 = this.model in cs.to ? this : this.rgb();
|
|
31553
|
+
self2 = self2.round(typeof places === "number" ? places : 1);
|
|
31554
|
+
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
31555
|
+
return cs.to[self2.model](...arguments_);
|
|
31556
|
+
},
|
|
31557
|
+
percentString(places) {
|
|
31558
|
+
const self2 = this.rgb().round(typeof places === "number" ? places : 1);
|
|
31559
|
+
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
31560
|
+
return cs.to.rgb.percent(...arguments_);
|
|
31561
|
+
},
|
|
31562
|
+
array() {
|
|
31563
|
+
return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
|
|
31564
|
+
},
|
|
31565
|
+
object() {
|
|
31566
|
+
const result = {};
|
|
31567
|
+
const { channels } = convert$1[this.model];
|
|
31568
|
+
const { labels } = convert$1[this.model];
|
|
31569
|
+
for (let i2 = 0; i2 < channels; i2++) {
|
|
31570
|
+
result[labels[i2]] = this.color[i2];
|
|
31571
|
+
}
|
|
31572
|
+
if (this.valpha !== 1) {
|
|
31573
|
+
result.alpha = this.valpha;
|
|
31574
|
+
}
|
|
31575
|
+
return result;
|
|
31576
|
+
},
|
|
31577
|
+
unitArray() {
|
|
31578
|
+
const rgb = this.rgb().color;
|
|
31579
|
+
rgb[0] /= 255;
|
|
31580
|
+
rgb[1] /= 255;
|
|
31581
|
+
rgb[2] /= 255;
|
|
31582
|
+
if (this.valpha !== 1) {
|
|
31583
|
+
rgb.push(this.valpha);
|
|
31584
|
+
}
|
|
31585
|
+
return rgb;
|
|
31586
|
+
},
|
|
31587
|
+
unitObject() {
|
|
31588
|
+
const rgb = this.rgb().object();
|
|
31589
|
+
rgb.r /= 255;
|
|
31590
|
+
rgb.g /= 255;
|
|
31591
|
+
rgb.b /= 255;
|
|
31592
|
+
if (this.valpha !== 1) {
|
|
31593
|
+
rgb.alpha = this.valpha;
|
|
31594
|
+
}
|
|
31595
|
+
return rgb;
|
|
31596
|
+
},
|
|
31597
|
+
round(places) {
|
|
31598
|
+
places = Math.max(places || 0, 0);
|
|
31599
|
+
return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
|
|
31600
|
+
},
|
|
31601
|
+
alpha(value) {
|
|
31602
|
+
if (value !== void 0) {
|
|
31603
|
+
return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
|
|
31604
|
+
}
|
|
31605
|
+
return this.valpha;
|
|
31606
|
+
},
|
|
31607
|
+
// Rgb
|
|
31608
|
+
red: getset("rgb", 0, maxfn(255)),
|
|
31609
|
+
green: getset("rgb", 1, maxfn(255)),
|
|
31610
|
+
blue: getset("rgb", 2, maxfn(255)),
|
|
31611
|
+
hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (value) => (value % 360 + 360) % 360),
|
|
31612
|
+
saturationl: getset("hsl", 1, maxfn(100)),
|
|
31613
|
+
lightness: getset("hsl", 2, maxfn(100)),
|
|
31614
|
+
saturationv: getset("hsv", 1, maxfn(100)),
|
|
31615
|
+
value: getset("hsv", 2, maxfn(100)),
|
|
31616
|
+
chroma: getset("hcg", 1, maxfn(100)),
|
|
31617
|
+
gray: getset("hcg", 2, maxfn(100)),
|
|
31618
|
+
white: getset("hwb", 1, maxfn(100)),
|
|
31619
|
+
wblack: getset("hwb", 2, maxfn(100)),
|
|
31620
|
+
cyan: getset("cmyk", 0, maxfn(100)),
|
|
31621
|
+
magenta: getset("cmyk", 1, maxfn(100)),
|
|
31622
|
+
yellow: getset("cmyk", 2, maxfn(100)),
|
|
31623
|
+
black: getset("cmyk", 3, maxfn(100)),
|
|
31624
|
+
x: getset("xyz", 0, maxfn(95.047)),
|
|
31625
|
+
y: getset("xyz", 1, maxfn(100)),
|
|
31626
|
+
z: getset("xyz", 2, maxfn(108.833)),
|
|
31627
|
+
l: getset("lab", 0, maxfn(100)),
|
|
31628
|
+
a: getset("lab", 1),
|
|
31629
|
+
b: getset("lab", 2),
|
|
31630
|
+
keyword(value) {
|
|
31631
|
+
if (value !== void 0) {
|
|
31632
|
+
return new Color(value);
|
|
31633
|
+
}
|
|
31634
|
+
return convert$1[this.model].keyword(this.color);
|
|
31635
|
+
},
|
|
31636
|
+
hex(value) {
|
|
31637
|
+
if (value !== void 0) {
|
|
31638
|
+
return new Color(value);
|
|
31639
|
+
}
|
|
31640
|
+
return cs.to.hex(...this.rgb().round().color);
|
|
31641
|
+
},
|
|
31642
|
+
hexa(value) {
|
|
31643
|
+
if (value !== void 0) {
|
|
31644
|
+
return new Color(value);
|
|
31645
|
+
}
|
|
31646
|
+
const rgbArray = this.rgb().round().color;
|
|
31647
|
+
let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
|
|
31648
|
+
if (alphaHex.length === 1) {
|
|
31649
|
+
alphaHex = "0" + alphaHex;
|
|
31650
|
+
}
|
|
31651
|
+
return cs.to.hex(...rgbArray) + alphaHex;
|
|
31652
|
+
},
|
|
31653
|
+
rgbNumber() {
|
|
31654
|
+
const rgb = this.rgb().color;
|
|
31655
|
+
return (rgb[0] & 255) << 16 | (rgb[1] & 255) << 8 | rgb[2] & 255;
|
|
31656
|
+
},
|
|
31657
|
+
luminosity() {
|
|
31658
|
+
const rgb = this.rgb().color;
|
|
31659
|
+
const lum = [];
|
|
31660
|
+
for (const [i2, element2] of rgb.entries()) {
|
|
31661
|
+
const chan = element2 / 255;
|
|
31662
|
+
lum[i2] = chan <= 0.04045 ? chan / 12.92 : __pow((chan + 0.055) / 1.055, 2.4);
|
|
31663
|
+
}
|
|
31664
|
+
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
|
|
31665
|
+
},
|
|
31666
|
+
contrast(color2) {
|
|
31667
|
+
const lum1 = this.luminosity();
|
|
31668
|
+
const lum2 = color2.luminosity();
|
|
31669
|
+
if (lum1 > lum2) {
|
|
31670
|
+
return (lum1 + 0.05) / (lum2 + 0.05);
|
|
31671
|
+
}
|
|
31672
|
+
return (lum2 + 0.05) / (lum1 + 0.05);
|
|
31673
|
+
},
|
|
31674
|
+
level(color2) {
|
|
31675
|
+
const contrastRatio = this.contrast(color2);
|
|
31676
|
+
if (contrastRatio >= 7) {
|
|
31677
|
+
return "AAA";
|
|
31678
|
+
}
|
|
31679
|
+
return contrastRatio >= 4.5 ? "AA" : "";
|
|
31680
|
+
},
|
|
31681
|
+
isDark() {
|
|
31682
|
+
const rgb = this.rgb().color;
|
|
31683
|
+
const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 1e4;
|
|
31684
|
+
return yiq < 128;
|
|
31685
|
+
},
|
|
31686
|
+
isLight() {
|
|
31687
|
+
return !this.isDark();
|
|
31688
|
+
},
|
|
31689
|
+
negate() {
|
|
31690
|
+
const rgb = this.rgb();
|
|
31691
|
+
for (let i2 = 0; i2 < 3; i2++) {
|
|
31692
|
+
rgb.color[i2] = 255 - rgb.color[i2];
|
|
31693
|
+
}
|
|
31694
|
+
return rgb;
|
|
31695
|
+
},
|
|
31696
|
+
lighten(ratio) {
|
|
31697
|
+
const hsl = this.hsl();
|
|
31698
|
+
hsl.color[2] += hsl.color[2] * ratio;
|
|
31699
|
+
return hsl;
|
|
31700
|
+
},
|
|
31701
|
+
darken(ratio) {
|
|
31702
|
+
const hsl = this.hsl();
|
|
31703
|
+
hsl.color[2] -= hsl.color[2] * ratio;
|
|
31704
|
+
return hsl;
|
|
31705
|
+
},
|
|
31706
|
+
saturate(ratio) {
|
|
31707
|
+
const hsl = this.hsl();
|
|
31708
|
+
hsl.color[1] += hsl.color[1] * ratio;
|
|
31709
|
+
return hsl;
|
|
31710
|
+
},
|
|
31711
|
+
desaturate(ratio) {
|
|
31712
|
+
const hsl = this.hsl();
|
|
31713
|
+
hsl.color[1] -= hsl.color[1] * ratio;
|
|
31714
|
+
return hsl;
|
|
31715
|
+
},
|
|
31716
|
+
whiten(ratio) {
|
|
31717
|
+
const hwb = this.hwb();
|
|
31718
|
+
hwb.color[1] += hwb.color[1] * ratio;
|
|
31719
|
+
return hwb;
|
|
31720
|
+
},
|
|
31721
|
+
blacken(ratio) {
|
|
31722
|
+
const hwb = this.hwb();
|
|
31723
|
+
hwb.color[2] += hwb.color[2] * ratio;
|
|
31724
|
+
return hwb;
|
|
31725
|
+
},
|
|
31726
|
+
grayscale() {
|
|
31727
|
+
const rgb = this.rgb().color;
|
|
31728
|
+
const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
|
|
31729
|
+
return Color.rgb(value, value, value);
|
|
31730
|
+
},
|
|
31731
|
+
fade(ratio) {
|
|
31732
|
+
return this.alpha(this.valpha - this.valpha * ratio);
|
|
31733
|
+
},
|
|
31734
|
+
opaquer(ratio) {
|
|
31735
|
+
return this.alpha(this.valpha + this.valpha * ratio);
|
|
31736
|
+
},
|
|
31737
|
+
rotate(degrees) {
|
|
31738
|
+
const hsl = this.hsl();
|
|
31739
|
+
let hue = hsl.color[0];
|
|
31740
|
+
hue = (hue + degrees) % 360;
|
|
31741
|
+
hue = hue < 0 ? 360 + hue : hue;
|
|
31742
|
+
hsl.color[0] = hue;
|
|
31743
|
+
return hsl;
|
|
31744
|
+
},
|
|
31745
|
+
mix(mixinColor, weight) {
|
|
31746
|
+
if (!mixinColor || !mixinColor.rgb) {
|
|
31747
|
+
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
|
|
31748
|
+
}
|
|
31749
|
+
const color1 = mixinColor.rgb();
|
|
31750
|
+
const color2 = this.rgb();
|
|
31751
|
+
const p2 = weight === void 0 ? 0.5 : weight;
|
|
31752
|
+
const w2 = 2 * p2 - 1;
|
|
31753
|
+
const a2 = color1.alpha() - color2.alpha();
|
|
31754
|
+
const w1 = ((w2 * a2 === -1 ? w2 : (w2 + a2) / (1 + w2 * a2)) + 1) / 2;
|
|
31755
|
+
const w22 = 1 - w1;
|
|
31756
|
+
return Color.rgb(
|
|
31757
|
+
w1 * color1.red() + w22 * color2.red(),
|
|
31758
|
+
w1 * color1.green() + w22 * color2.green(),
|
|
31759
|
+
w1 * color1.blue() + w22 * color2.blue(),
|
|
31760
|
+
color1.alpha() * p2 + color2.alpha() * (1 - p2)
|
|
31761
|
+
);
|
|
32030
31762
|
}
|
|
32031
|
-
|
|
32032
|
-
|
|
32033
|
-
|
|
31763
|
+
};
|
|
31764
|
+
for (const model of Object.keys(convert$1)) {
|
|
31765
|
+
if (skippedModels.includes(model)) {
|
|
31766
|
+
continue;
|
|
32034
31767
|
}
|
|
32035
|
-
|
|
32036
|
-
function
|
|
32037
|
-
|
|
32038
|
-
|
|
32039
|
-
|
|
31768
|
+
const { channels } = convert$1[model];
|
|
31769
|
+
Color.prototype[model] = function(...arguments_) {
|
|
31770
|
+
if (this.model === model) {
|
|
31771
|
+
return new Color(this);
|
|
31772
|
+
}
|
|
31773
|
+
if (arguments_.length > 0) {
|
|
31774
|
+
return new Color(arguments_, model);
|
|
31775
|
+
}
|
|
31776
|
+
return new Color([...assertArray(convert$1[this.model][model].raw(this.color)), this.valpha], model);
|
|
31777
|
+
};
|
|
31778
|
+
Color[model] = function(...arguments_) {
|
|
31779
|
+
let color2 = arguments_[0];
|
|
31780
|
+
if (typeof color2 === "number") {
|
|
31781
|
+
color2 = zeroArray(arguments_, channels);
|
|
31782
|
+
}
|
|
31783
|
+
return new Color(color2, model);
|
|
31784
|
+
};
|
|
31785
|
+
}
|
|
31786
|
+
function roundTo(number2, places) {
|
|
31787
|
+
return Number(number2.toFixed(places));
|
|
31788
|
+
}
|
|
31789
|
+
__name(roundTo, "roundTo");
|
|
31790
|
+
function roundToPlace(places) {
|
|
31791
|
+
return function(number2) {
|
|
31792
|
+
return roundTo(number2, places);
|
|
31793
|
+
};
|
|
31794
|
+
}
|
|
31795
|
+
__name(roundToPlace, "roundToPlace");
|
|
31796
|
+
function getset(model, channel, modifier) {
|
|
31797
|
+
model = Array.isArray(model) ? model : [model];
|
|
31798
|
+
for (const m2 of model) {
|
|
31799
|
+
(limiters[m2] || (limiters[m2] = []))[channel] = modifier;
|
|
31800
|
+
}
|
|
31801
|
+
model = model[0];
|
|
31802
|
+
return function(value) {
|
|
31803
|
+
let result;
|
|
31804
|
+
if (value !== void 0) {
|
|
31805
|
+
if (modifier) {
|
|
31806
|
+
value = modifier(value);
|
|
32040
31807
|
}
|
|
31808
|
+
result = this[model]();
|
|
31809
|
+
result.color[channel] = value;
|
|
31810
|
+
return result;
|
|
31811
|
+
}
|
|
31812
|
+
result = this[model]().color[channel];
|
|
31813
|
+
if (modifier) {
|
|
31814
|
+
result = modifier(result);
|
|
31815
|
+
}
|
|
31816
|
+
return result;
|
|
31817
|
+
};
|
|
31818
|
+
}
|
|
31819
|
+
__name(getset, "getset");
|
|
31820
|
+
function maxfn(max2) {
|
|
31821
|
+
return function(v2) {
|
|
31822
|
+
return Math.max(0, Math.min(max2, v2));
|
|
31823
|
+
};
|
|
31824
|
+
}
|
|
31825
|
+
__name(maxfn, "maxfn");
|
|
31826
|
+
function assertArray(value) {
|
|
31827
|
+
return Array.isArray(value) ? value : [value];
|
|
31828
|
+
}
|
|
31829
|
+
__name(assertArray, "assertArray");
|
|
31830
|
+
function zeroArray(array2, length) {
|
|
31831
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
31832
|
+
if (typeof array2[i2] !== "number") {
|
|
31833
|
+
array2[i2] = 0;
|
|
32041
31834
|
}
|
|
32042
|
-
return arr;
|
|
32043
31835
|
}
|
|
32044
|
-
|
|
32045
|
-
color$1 = Color2;
|
|
32046
|
-
return color$1;
|
|
31836
|
+
return array2;
|
|
32047
31837
|
}
|
|
32048
|
-
__name(
|
|
32049
|
-
var colorExports = requireColor();
|
|
32050
|
-
const Color = /* @__PURE__ */ getDefaultExportFromCjs(colorExports);
|
|
31838
|
+
__name(zeroArray, "zeroArray");
|
|
32051
31839
|
function determineBlackOrWhiteTextColor(c2) {
|
|
32052
31840
|
try {
|
|
32053
31841
|
return Color(c2).isLight() ? "#000000" : "#FFFFFF";
|
|
@@ -40324,10 +40112,10 @@ function tokenizeCodeFenced(effects, ok2, nok) {
|
|
|
40324
40112
|
effects.enter("chunkString", {
|
|
40325
40113
|
contentType: "string"
|
|
40326
40114
|
});
|
|
40327
|
-
return
|
|
40115
|
+
return meta2(code2);
|
|
40328
40116
|
}
|
|
40329
40117
|
__name(metaBefore, "metaBefore");
|
|
40330
|
-
function
|
|
40118
|
+
function meta2(code2) {
|
|
40331
40119
|
if (code2 === null || markdownLineEnding(code2)) {
|
|
40332
40120
|
effects.exit("chunkString");
|
|
40333
40121
|
effects.exit("codeFencedFenceMeta");
|
|
@@ -40337,9 +40125,9 @@ function tokenizeCodeFenced(effects, ok2, nok) {
|
|
|
40337
40125
|
return nok(code2);
|
|
40338
40126
|
}
|
|
40339
40127
|
effects.consume(code2);
|
|
40340
|
-
return
|
|
40128
|
+
return meta2;
|
|
40341
40129
|
}
|
|
40342
|
-
__name(
|
|
40130
|
+
__name(meta2, "meta");
|
|
40343
40131
|
function atNonLazyBreak(code2) {
|
|
40344
40132
|
return effects.attempt(closeStart, after, contentBefore)(code2);
|
|
40345
40133
|
}
|
|
@@ -56256,6 +56044,34 @@ if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") {
|
|
|
56256
56044
|
$mobx
|
|
56257
56045
|
});
|
|
56258
56046
|
}
|
|
56047
|
+
const keyCount = {};
|
|
56048
|
+
const timeout = {};
|
|
56049
|
+
const isBeingCalledExcessively = /* @__PURE__ */ __name(({
|
|
56050
|
+
uniqName
|
|
56051
|
+
}) => {
|
|
56052
|
+
if (process.env["NODE_ENV"] !== "development") {
|
|
56053
|
+
return;
|
|
56054
|
+
}
|
|
56055
|
+
if (!uniqName) {
|
|
56056
|
+
throw new Error("uniqName is required");
|
|
56057
|
+
}
|
|
56058
|
+
keyCount[uniqName] = keyCount[uniqName] || 0;
|
|
56059
|
+
keyCount[uniqName]++;
|
|
56060
|
+
if (!timeout[uniqName]) {
|
|
56061
|
+
timeout[uniqName] = setTimeout(() => {
|
|
56062
|
+
keyCount[uniqName] = 0;
|
|
56063
|
+
timeout[uniqName] = null;
|
|
56064
|
+
}, 2e3);
|
|
56065
|
+
}
|
|
56066
|
+
if (keyCount[uniqName] > 20) {
|
|
56067
|
+
keyCount[uniqName] = 0;
|
|
56068
|
+
if (timeout[uniqName]) {
|
|
56069
|
+
clearTimeout(timeout[uniqName]);
|
|
56070
|
+
timeout[uniqName] = null;
|
|
56071
|
+
}
|
|
56072
|
+
throw new Error(`isBeingCalledExcessively: ${uniqName}`);
|
|
56073
|
+
}
|
|
56074
|
+
}, "isBeingCalledExcessively");
|
|
56259
56075
|
T();
|
|
56260
56076
|
const IS_LINUX = window.navigator.platform.toLowerCase().search("linux") > -1;
|
|
56261
56077
|
const itemSizeEstimators = {
|
|
@@ -56604,6 +56420,7 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
56604
56420
|
const entities = useDeepEqualMemo(_entities);
|
|
56605
56421
|
const entitiesAcrossPages = useDeepEqualMemo(_entitiesAcrossPages);
|
|
56606
56422
|
useEffect(() => {
|
|
56423
|
+
!noExcessiveCheck && isBeingCalledExcessively({ uniqName: `dt_entities_${formName}` });
|
|
56607
56424
|
change$1("allOrderedEntities", entitiesAcrossPages);
|
|
56608
56425
|
if (entities.length === 0 || isEmpty$1(reduxFormSelectedEntityIdMap)) return;
|
|
56609
56426
|
changeSelectedEntities({
|
|
@@ -56626,6 +56443,7 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
|
|
|
56626
56443
|
} else {
|
|
56627
56444
|
newTableConfig = getTableConfigFromStorage(formName);
|
|
56628
56445
|
}
|
|
56446
|
+
!noExcessiveCheck && isBeingCalledExcessively({ uniqName: `dt_setTableConfig_${formName}` });
|
|
56629
56447
|
setTableConfig((prev) => {
|
|
56630
56448
|
if (!newTableConfig) {
|
|
56631
56449
|
newTableConfig = {
|
|
@@ -71841,12 +71659,6 @@ function DropdownButton(_M) {
|
|
|
71841
71659
|
);
|
|
71842
71660
|
}
|
|
71843
71661
|
__name(DropdownButton, "DropdownButton");
|
|
71844
|
-
const adHoc = /* @__PURE__ */ __name((func) => (WrappedComponent) => (props) => {
|
|
71845
|
-
const calledFunc = func(props);
|
|
71846
|
-
const composeArgs = Array.isArray(calledFunc) ? calledFunc : [calledFunc];
|
|
71847
|
-
const ComposedAndWrapped = compose(...composeArgs)(WrappedComponent);
|
|
71848
|
-
return /* @__PURE__ */ React__default.createElement(ComposedAndWrapped, __spreadValues({}, props));
|
|
71849
|
-
}, "adHoc");
|
|
71850
71662
|
const intentToClass = {
|
|
71851
71663
|
danger: Classes.INTENT_DANGER,
|
|
71852
71664
|
warning: Classes.INTENT_WARNING,
|
|
@@ -75685,7 +75497,9 @@ function comboToLabel(def, useSymbols = true) {
|
|
|
75685
75497
|
const combo = typeof def === "string" ? def : def.combo;
|
|
75686
75498
|
if (useSymbols) {
|
|
75687
75499
|
let parts = combo.replace("++", "+plus").split("+");
|
|
75688
|
-
parts = parts.map(
|
|
75500
|
+
parts = parts.map(
|
|
75501
|
+
(p2) => p2 in symbols ? symbols[p2] : startCase(p2) || p2
|
|
75502
|
+
);
|
|
75689
75503
|
return parts.join("");
|
|
75690
75504
|
} else {
|
|
75691
75505
|
return combo.split("+").map((p2) => startCase(p2) || p2).join(" + ").replace("Meta", isMac ? "Cmd" : "Ctrl").replace("Mod", isMac ? "Cmd" : "Ctrl").replace("Alt", isMac ? "Option" : "Alt");
|
|
@@ -75699,7 +75513,7 @@ const hotkeysById = /* @__PURE__ */ __name((hotkeys, mode = "raw") => (id) => {
|
|
|
75699
75513
|
const getHotkeyProps = /* @__PURE__ */ __name((def, id) => {
|
|
75700
75514
|
let out;
|
|
75701
75515
|
if (typeof def === "string") {
|
|
75702
|
-
out = { combo: def };
|
|
75516
|
+
out = { combo: def, label: def };
|
|
75703
75517
|
} else if (def instanceof Array) {
|
|
75704
75518
|
out = __spreadValues({ combo: def[0], label: def[1] }, def[2] || {});
|
|
75705
75519
|
} else {
|
|
@@ -75734,15 +75548,18 @@ const withHotkeys = /* @__PURE__ */ __name((hotkeys, handlers2) => {
|
|
|
75734
75548
|
React__default.cloneElement(children, newProps)
|
|
75735
75549
|
) : (
|
|
75736
75550
|
//if not, then we'll return a div that can be used
|
|
75737
|
-
/* @__PURE__ */
|
|
75551
|
+
/* @__PURE__ */ jsx("div", __spreadValues({ className: "hotkeyHandler" }, newProps))
|
|
75738
75552
|
);
|
|
75739
75553
|
};
|
|
75740
75554
|
}, "withHotkeys");
|
|
75741
75555
|
const isMac = navigator.userAgent.includes("Mac OS X");
|
|
75556
|
+
const cmd = "⌘";
|
|
75557
|
+
const meta = "⌘";
|
|
75558
|
+
const ctrl = "⌃";
|
|
75742
75559
|
const symbols = {
|
|
75743
|
-
cmd
|
|
75744
|
-
meta
|
|
75745
|
-
ctrl
|
|
75560
|
+
cmd,
|
|
75561
|
+
meta,
|
|
75562
|
+
ctrl,
|
|
75746
75563
|
alt: "⌥",
|
|
75747
75564
|
shift: "⇧",
|
|
75748
75565
|
esc: "␛",
|
|
@@ -75760,9 +75577,9 @@ const symbols = {
|
|
|
75760
75577
|
left: "←",
|
|
75761
75578
|
right: "→",
|
|
75762
75579
|
up: "↑",
|
|
75763
|
-
down: "↓"
|
|
75580
|
+
down: "↓",
|
|
75581
|
+
mod: isMac ? cmd : ctrl
|
|
75764
75582
|
};
|
|
75765
|
-
symbols.mod = symbols[isMac ? "meta" : "ctrl"];
|
|
75766
75583
|
const _MenuBar = class _MenuBar extends React__default.Component {
|
|
75767
75584
|
constructor(props) {
|
|
75768
75585
|
super(props);
|
|
@@ -76453,33 +76270,39 @@ var relativeTimeExports = requireRelativeTime();
|
|
|
76453
76270
|
const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
|
|
76454
76271
|
dayjs.extend(relativeTime);
|
|
76455
76272
|
function TimelineEvent({ date, children }) {
|
|
76456
|
-
return /* @__PURE__ */
|
|
76273
|
+
return /* @__PURE__ */ jsx("div", { className: "tg-timeline-event", children: /* @__PURE__ */ jsxs(
|
|
76457
76274
|
"div",
|
|
76458
76275
|
{
|
|
76459
76276
|
style: {
|
|
76460
76277
|
display: "flex",
|
|
76461
76278
|
alignItems: "center"
|
|
76462
|
-
}
|
|
76463
|
-
},
|
|
76464
|
-
/* @__PURE__ */ React__default.createElement("div", { className: "tg-timeline-circle" }),
|
|
76465
|
-
children,
|
|
76466
|
-
/* @__PURE__ */ React__default.createElement(
|
|
76467
|
-
"div",
|
|
76468
|
-
{
|
|
76469
|
-
style: { marginLeft: 5 },
|
|
76470
|
-
className: classNames(Classes.TEXT_SMALL, Classes.TEXT_MUTED)
|
|
76471
76279
|
},
|
|
76472
|
-
|
|
76473
|
-
|
|
76474
|
-
|
|
76475
|
-
|
|
76476
|
-
|
|
76280
|
+
children: [
|
|
76281
|
+
/* @__PURE__ */ jsx("div", { className: "tg-timeline-circle" }),
|
|
76282
|
+
children,
|
|
76283
|
+
/* @__PURE__ */ jsxs(
|
|
76284
|
+
"div",
|
|
76285
|
+
{
|
|
76286
|
+
style: { marginLeft: 5 },
|
|
76287
|
+
className: classNames(Classes.TEXT_SMALL, Classes.TEXT_MUTED),
|
|
76288
|
+
children: [
|
|
76289
|
+
"(",
|
|
76290
|
+
dayjs(date).fromNow(),
|
|
76291
|
+
")"
|
|
76292
|
+
]
|
|
76293
|
+
}
|
|
76294
|
+
)
|
|
76295
|
+
]
|
|
76296
|
+
}
|
|
76297
|
+
) });
|
|
76477
76298
|
}
|
|
76478
76299
|
__name(TimelineEvent, "TimelineEvent");
|
|
76479
|
-
|
|
76480
|
-
return /* @__PURE__ */
|
|
76481
|
-
}
|
|
76482
|
-
|
|
76300
|
+
const Timeline = /* @__PURE__ */ __name((props) => {
|
|
76301
|
+
return /* @__PURE__ */ jsxs("div", { className: "tg-timeline", children: [
|
|
76302
|
+
React__default.Children.count(props.children) > 1 && /* @__PURE__ */ jsx("div", { className: "tg-timeline-line" }),
|
|
76303
|
+
props.children
|
|
76304
|
+
] });
|
|
76305
|
+
}, "Timeline");
|
|
76483
76306
|
const ptIconWrapper = /* @__PURE__ */ __name((path2, viewboxDefault = 24, rest) => {
|
|
76484
76307
|
return /* @__PURE__ */ React__default.createElement("span", { className: "bp3-icon" }, /* @__PURE__ */ React__default.createElement(
|
|
76485
76308
|
"svg",
|
|
@@ -76963,27 +76786,27 @@ function getCommandHotkeyHandlers(commands) {
|
|
|
76963
76786
|
}
|
|
76964
76787
|
__name(getCommandHotkeyHandlers, "getCommandHotkeyHandlers");
|
|
76965
76788
|
const withCommand = /* @__PURE__ */ __name((mappings) => (WrappedComponent) => (_a) => {
|
|
76966
|
-
var _b = _a, { cmd, cmdOptions = {} } = _b, props = __objRest(_b, ["cmd", "cmdOptions"]);
|
|
76789
|
+
var _b = _a, { cmd: cmd2, cmdOptions = {} } = _b, props = __objRest(_b, ["cmd", "cmdOptions"]);
|
|
76967
76790
|
const mappedProps = {};
|
|
76968
76791
|
Object.keys(mappings).forEach((k2) => {
|
|
76969
|
-
mappedProps[k2] = mappings[k2] === "execute" ? (event) =>
|
|
76792
|
+
mappedProps[k2] = mappings[k2] === "execute" ? (event) => cmd2.execute({ event }) : typeof mappings[k2] === "function" ? mappings[k2](cmd2, props) : cmd2[mappings[k2]];
|
|
76970
76793
|
});
|
|
76971
76794
|
let out = /* @__PURE__ */ React__default.createElement(WrappedComponent, __spreadValues(__spreadValues({}, mappedProps), props));
|
|
76972
|
-
const tooltip =
|
|
76795
|
+
const tooltip = cmd2.tooltip || typeof cmd2.isDisabled === "string" && cmd2.isDisabled;
|
|
76973
76796
|
if (tooltip && !cmdOptions.ignoreTooltip) {
|
|
76974
76797
|
out = /* @__PURE__ */ React__default.createElement(Tooltip, { content: tooltip }, out);
|
|
76975
76798
|
}
|
|
76976
|
-
return
|
|
76799
|
+
return cmd2.isHidden && !cmdOptions.ignoreHidden ? null : out;
|
|
76977
76800
|
}, "withCommand");
|
|
76978
76801
|
const CmdCheckbox = withCommand({
|
|
76979
76802
|
onChange: "execute",
|
|
76980
|
-
label: /* @__PURE__ */ __name((
|
|
76803
|
+
label: /* @__PURE__ */ __name((cmd2, props) => props.name || props.prefix && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, props.prefix, cmd2.name) || cmd2.name, "label"),
|
|
76981
76804
|
disabled: "isDisabled",
|
|
76982
76805
|
checked: "isActive"
|
|
76983
76806
|
})(Checkbox);
|
|
76984
76807
|
const CmdSwitch = withCommand({
|
|
76985
76808
|
onChange: "execute",
|
|
76986
|
-
label: /* @__PURE__ */ __name((
|
|
76809
|
+
label: /* @__PURE__ */ __name((cmd2, props) => props.name || props.prefix && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, props.prefix, cmd2.name) || cmd2.name, "label"),
|
|
76987
76810
|
disabled: "isDisabled",
|
|
76988
76811
|
checked: "isActive"
|
|
76989
76812
|
})(Switch);
|
|
@@ -76992,13 +76815,13 @@ const Div = /* @__PURE__ */ __name(({ onChange, children }) => {
|
|
|
76992
76815
|
}, "Div");
|
|
76993
76816
|
const CmdDiv = withCommand({
|
|
76994
76817
|
onChange: "execute",
|
|
76995
|
-
children: /* @__PURE__ */ __name((
|
|
76818
|
+
children: /* @__PURE__ */ __name((cmd2, props) => props.name || props.prefix && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, props.prefix, cmd2.name) || cmd2.name, "children"),
|
|
76996
76819
|
disabled: "isDisabled",
|
|
76997
76820
|
checked: "isActive"
|
|
76998
76821
|
})(Div);
|
|
76999
76822
|
const CmdButton = withCommand({
|
|
77000
76823
|
onClick: "execute",
|
|
77001
|
-
text: /* @__PURE__ */ __name((
|
|
76824
|
+
text: /* @__PURE__ */ __name((cmd2) => cmd2.isActive === false && cmd2.inactiveName || cmd2.name, "text"),
|
|
77002
76825
|
icon: "icon",
|
|
77003
76826
|
disabled: "isDisabled"
|
|
77004
76827
|
})(Button);
|
|
@@ -78154,7 +77977,6 @@ export {
|
|
|
78154
77977
|
TimelineEvent,
|
|
78155
77978
|
Uploader,
|
|
78156
77979
|
WorkflowDefaultParamsContext,
|
|
78157
|
-
adHoc,
|
|
78158
77980
|
basicHandleActionsWithFullState,
|
|
78159
77981
|
bluntFeatureIcon,
|
|
78160
77982
|
cardDetailsIcon,
|