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