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