UNPKG

@senx/discovery-widgets

Version:

Discovery Widgets Elements

921 lines (913 loc) 29 kB
const aliceblue$1 = "#f0f8ff"; const antiquewhite$1 = "#faebd7"; const aqua$1 = "#00ffff"; const aquamarine$1 = "#7fffd4"; const azure$1 = "#f0ffff"; const beige$1 = "#f5f5dc"; const bisque$1 = "#ffe4c4"; const black$1 = "#000000"; const blanchedalmond$1 = "#ffebcd"; const blue$1 = "#0000ff"; const blueviolet$1 = "#8a2be2"; const brown$1 = "#a52a2a"; const burlywood$1 = "#deb887"; const cadetblue$1 = "#5f9ea0"; const chartreuse$1 = "#7fff00"; const chocolate$1 = "#d2691e"; const coral$1 = "#ff7f50"; const cornflowerblue$1 = "#6495ed"; const cornsilk$1 = "#fff8dc"; const crimson$1 = "#dc143c"; const cyan$1 = "#00ffff"; const darkblue$1 = "#00008b"; const darkcyan$1 = "#008b8b"; const darkgoldenrod$1 = "#b8860b"; const darkgray$1 = "#a9a9a9"; const darkgreen$1 = "#006400"; const darkgrey$1 = "#a9a9a9"; const darkkhaki$1 = "#bdb76b"; const darkmagenta$1 = "#8b008b"; const darkolivegreen$1 = "#556b2f"; const darkorange$1 = "#ff8c00"; const darkorchid$1 = "#9932cc"; const darkred$1 = "#8b0000"; const darksalmon$1 = "#e9967a"; const darkseagreen$1 = "#8fbc8f"; const darkslateblue$1 = "#483d8b"; const darkslategray$1 = "#2f4f4f"; const darkslategrey$1 = "#2f4f4f"; const darkturquoise$1 = "#00ced1"; const darkviolet$1 = "#9400d3"; const deeppink$1 = "#ff1493"; const deepskyblue$1 = "#00bfff"; const dimgray$1 = "#696969"; const dimgrey$1 = "#696969"; const dodgerblue$1 = "#1e90ff"; const firebrick$1 = "#b22222"; const floralwhite$1 = "#fffaf0"; const forestgreen$1 = "#228b22"; const fuchsia$1 = "#ff00ff"; const gainsboro$1 = "#dcdcdc"; const ghostwhite$1 = "#f8f8ff"; const goldenrod$1 = "#daa520"; const gold$1 = "#ffd700"; const gray$1 = "#808080"; const green$1 = "#008000"; const greenyellow$1 = "#adff2f"; const grey$1 = "#808080"; const honeydew$1 = "#f0fff0"; const hotpink$1 = "#ff69b4"; const indianred$1 = "#cd5c5c"; const indigo$1 = "#4b0082"; const ivory$1 = "#fffff0"; const khaki$1 = "#f0e68c"; const lavenderblush$1 = "#fff0f5"; const lavender$1 = "#e6e6fa"; const lawngreen$1 = "#7cfc00"; const lemonchiffon$1 = "#fffacd"; const lightblue$1 = "#add8e6"; const lightcoral$1 = "#f08080"; const lightcyan$1 = "#e0ffff"; const lightgoldenrodyellow$1 = "#fafad2"; const lightgray$1 = "#d3d3d3"; const lightgreen$1 = "#90ee90"; const lightgrey$1 = "#d3d3d3"; const lightpink$1 = "#ffb6c1"; const lightsalmon$1 = "#ffa07a"; const lightseagreen$1 = "#20b2aa"; const lightskyblue$1 = "#87cefa"; const lightslategray$1 = "#778899"; const lightslategrey$1 = "#778899"; const lightsteelblue$1 = "#b0c4de"; const lightyellow$1 = "#ffffe0"; const lime$1 = "#00ff00"; const limegreen$1 = "#32cd32"; const linen$1 = "#faf0e6"; const magenta$1 = "#ff00ff"; const maroon$1 = "#800000"; const mediumaquamarine$1 = "#66cdaa"; const mediumblue$1 = "#0000cd"; const mediumorchid$1 = "#ba55d3"; const mediumpurple$1 = "#9370db"; const mediumseagreen$1 = "#3cb371"; const mediumslateblue$1 = "#7b68ee"; const mediumspringgreen$1 = "#00fa9a"; const mediumturquoise$1 = "#48d1cc"; const mediumvioletred$1 = "#c71585"; const midnightblue$1 = "#191970"; const mintcream$1 = "#f5fffa"; const mistyrose$1 = "#ffe4e1"; const moccasin$1 = "#ffe4b5"; const navajowhite$1 = "#ffdead"; const navy$1 = "#000080"; const oldlace$1 = "#fdf5e6"; const olive$1 = "#808000"; const olivedrab$1 = "#6b8e23"; const orange$1 = "#ffa500"; const orangered$1 = "#ff4500"; const orchid$1 = "#da70d6"; const palegoldenrod$1 = "#eee8aa"; const palegreen$1 = "#98fb98"; const paleturquoise$1 = "#afeeee"; const palevioletred$1 = "#db7093"; const papayawhip$1 = "#ffefd5"; const peachpuff$1 = "#ffdab9"; const peru$1 = "#cd853f"; const pink$1 = "#ffc0cb"; const plum$1 = "#dda0dd"; const powderblue$1 = "#b0e0e6"; const purple$1 = "#800080"; const rebeccapurple$1 = "#663399"; const red$1 = "#ff0000"; const rosybrown$1 = "#bc8f8f"; const royalblue$1 = "#4169e1"; const saddlebrown$1 = "#8b4513"; const salmon$1 = "#fa8072"; const sandybrown$1 = "#f4a460"; const seagreen$1 = "#2e8b57"; const seashell$1 = "#fff5ee"; const sienna$1 = "#a0522d"; const silver$1 = "#c0c0c0"; const skyblue$1 = "#87ceeb"; const slateblue$1 = "#6a5acd"; const slategray$1 = "#708090"; const slategrey$1 = "#708090"; const snow$1 = "#fffafa"; const springgreen$1 = "#00ff7f"; const steelblue$1 = "#4682b4"; const tan$1 = "#d2b48c"; const teal$1 = "#008080"; const thistle$1 = "#d8bfd8"; const tomato$1 = "#ff6347"; const turquoise$1 = "#40e0d0"; const violet$1 = "#ee82ee"; const wheat$1 = "#f5deb3"; const white$1 = "#ffffff"; const whitesmoke$1 = "#f5f5f5"; const yellow$1 = "#ffff00"; const yellowgreen$1 = "#9acd32"; const cssColorNames = { aliceblue: aliceblue$1, antiquewhite: antiquewhite$1, aqua: aqua$1, aquamarine: aquamarine$1, azure: azure$1, beige: beige$1, bisque: bisque$1, black: black$1, blanchedalmond: blanchedalmond$1, blue: blue$1, blueviolet: blueviolet$1, brown: brown$1, burlywood: burlywood$1, cadetblue: cadetblue$1, chartreuse: chartreuse$1, chocolate: chocolate$1, coral: coral$1, cornflowerblue: cornflowerblue$1, cornsilk: cornsilk$1, crimson: crimson$1, cyan: cyan$1, darkblue: darkblue$1, darkcyan: darkcyan$1, darkgoldenrod: darkgoldenrod$1, darkgray: darkgray$1, darkgreen: darkgreen$1, darkgrey: darkgrey$1, darkkhaki: darkkhaki$1, darkmagenta: darkmagenta$1, darkolivegreen: darkolivegreen$1, darkorange: darkorange$1, darkorchid: darkorchid$1, darkred: darkred$1, darksalmon: darksalmon$1, darkseagreen: darkseagreen$1, darkslateblue: darkslateblue$1, darkslategray: darkslategray$1, darkslategrey: darkslategrey$1, darkturquoise: darkturquoise$1, darkviolet: darkviolet$1, deeppink: deeppink$1, deepskyblue: deepskyblue$1, dimgray: dimgray$1, dimgrey: dimgrey$1, dodgerblue: dodgerblue$1, firebrick: firebrick$1, floralwhite: floralwhite$1, forestgreen: forestgreen$1, fuchsia: fuchsia$1, gainsboro: gainsboro$1, ghostwhite: ghostwhite$1, goldenrod: goldenrod$1, gold: gold$1, gray: gray$1, green: green$1, greenyellow: greenyellow$1, grey: grey$1, honeydew: honeydew$1, hotpink: hotpink$1, indianred: indianred$1, indigo: indigo$1, ivory: ivory$1, khaki: khaki$1, lavenderblush: lavenderblush$1, lavender: lavender$1, lawngreen: lawngreen$1, lemonchiffon: lemonchiffon$1, lightblue: lightblue$1, lightcoral: lightcoral$1, lightcyan: lightcyan$1, lightgoldenrodyellow: lightgoldenrodyellow$1, lightgray: lightgray$1, lightgreen: lightgreen$1, lightgrey: lightgrey$1, lightpink: lightpink$1, lightsalmon: lightsalmon$1, lightseagreen: lightseagreen$1, lightskyblue: lightskyblue$1, lightslategray: lightslategray$1, lightslategrey: lightslategrey$1, lightsteelblue: lightsteelblue$1, lightyellow: lightyellow$1, lime: lime$1, limegreen: limegreen$1, linen: linen$1, magenta: magenta$1, maroon: maroon$1, mediumaquamarine: mediumaquamarine$1, mediumblue: mediumblue$1, mediumorchid: mediumorchid$1, mediumpurple: mediumpurple$1, mediumseagreen: mediumseagreen$1, mediumslateblue: mediumslateblue$1, mediumspringgreen: mediumspringgreen$1, mediumturquoise: mediumturquoise$1, mediumvioletred: mediumvioletred$1, midnightblue: midnightblue$1, mintcream: mintcream$1, mistyrose: mistyrose$1, moccasin: moccasin$1, navajowhite: navajowhite$1, navy: navy$1, oldlace: oldlace$1, olive: olive$1, olivedrab: olivedrab$1, orange: orange$1, orangered: orangered$1, orchid: orchid$1, palegoldenrod: palegoldenrod$1, palegreen: palegreen$1, paleturquoise: paleturquoise$1, palevioletred: palevioletred$1, papayawhip: papayawhip$1, peachpuff: peachpuff$1, peru: peru$1, pink: pink$1, plum: plum$1, powderblue: powderblue$1, purple: purple$1, rebeccapurple: rebeccapurple$1, red: red$1, rosybrown: rosybrown$1, royalblue: royalblue$1, saddlebrown: saddlebrown$1, salmon: salmon$1, sandybrown: sandybrown$1, seagreen: seagreen$1, seashell: seashell$1, sienna: sienna$1, silver: silver$1, skyblue: skyblue$1, slateblue: slateblue$1, slategray: slategray$1, slategrey: slategrey$1, snow: snow$1, springgreen: springgreen$1, steelblue: steelblue$1, tan: tan$1, teal: teal$1, thistle: thistle$1, tomato: tomato$1, turquoise: turquoise$1, violet: violet$1, wheat: wheat$1, white: white$1, whitesmoke: whitesmoke$1, yellow: yellow$1, yellowgreen: yellowgreen$1 }; const aqua = "#00ffff"; const aliceblue = "#f0f8ff"; const antiquewhite = "#faebd7"; const black = "#000000"; const blue = "#0000ff"; const cyan = "#00ffff"; const darkblue = "#00008b"; const darkcyan = "#008b8b"; const darkgreen = "#006400"; const darkturquoise = "#00ced1"; const deepskyblue = "#00bfff"; const green = "#008000"; const lime = "#00ff00"; const mediumblue = "#0000cd"; const mediumspringgreen = "#00fa9a"; const navy = "#000080"; const springgreen = "#00ff7f"; const teal = "#008080"; const midnightblue = "#191970"; const dodgerblue = "#1e90ff"; const lightseagreen = "#20b2aa"; const forestgreen = "#228b22"; const seagreen = "#2e8b57"; const darkslategray = "#2f4f4f"; const darkslategrey = "#2f4f4f"; const limegreen = "#32cd32"; const mediumseagreen = "#3cb371"; const turquoise = "#40e0d0"; const royalblue = "#4169e1"; const steelblue = "#4682b4"; const darkslateblue = "#483d8b"; const mediumturquoise = "#48d1cc"; const indigo = "#4b0082"; const darkolivegreen = "#556b2f"; const cadetblue = "#5f9ea0"; const cornflowerblue = "#6495ed"; const mediumaquamarine = "#66cdaa"; const dimgray = "#696969"; const dimgrey = "#696969"; const slateblue = "#6a5acd"; const olivedrab = "#6b8e23"; const slategray = "#708090"; const slategrey = "#708090"; const lightslategray = "#778899"; const lightslategrey = "#778899"; const mediumslateblue = "#7b68ee"; const lawngreen = "#7cfc00"; const aquamarine = "#7fffd4"; const chartreuse = "#7fff00"; const gray = "#808080"; const grey = "#808080"; const maroon = "#800000"; const olive = "#808000"; const purple = "#800080"; const lightskyblue = "#87cefa"; const skyblue = "#87ceeb"; const blueviolet = "#8a2be2"; const darkmagenta = "#8b008b"; const darkred = "#8b0000"; const saddlebrown = "#8b4513"; const darkseagreen = "#8fbc8f"; const lightgreen = "#90ee90"; const mediumpurple = "#9370db"; const darkviolet = "#9400d3"; const palegreen = "#98fb98"; const darkorchid = "#9932cc"; const yellowgreen = "#9acd32"; const sienna = "#a0522d"; const brown = "#a52a2a"; const darkgray = "#a9a9a9"; const darkgrey = "#a9a9a9"; const greenyellow = "#adff2f"; const lightblue = "#add8e6"; const paleturquoise = "#afeeee"; const lightsteelblue = "#b0c4de"; const powderblue = "#b0e0e6"; const firebrick = "#b22222"; const darkgoldenrod = "#b8860b"; const mediumorchid = "#ba55d3"; const rosybrown = "#bc8f8f"; const darkkhaki = "#bdb76b"; const silver = "#c0c0c0"; const mediumvioletred = "#c71585"; const indianred = "#cd5c5c"; const peru = "#cd853f"; const chocolate = "#d2691e"; const tan = "#d2b48c"; const lightgray = "#d3d3d3"; const lightgrey = "#d3d3d3"; const thistle = "#d8bfd8"; const goldenrod = "#daa520"; const orchid = "#da70d6"; const palevioletred = "#db7093"; const crimson = "#dc143c"; const gainsboro = "#dcdcdc"; const plum = "#dda0dd"; const burlywood = "#deb887"; const lightcyan = "#e0ffff"; const lavender = "#e6e6fa"; const darksalmon = "#e9967a"; const palegoldenrod = "#eee8aa"; const violet = "#ee82ee"; const azure = "#f0ffff"; const honeydew = "#f0fff0"; const khaki = "#f0e68c"; const lightcoral = "#f08080"; const sandybrown = "#f4a460"; const beige = "#f5f5dc"; const mintcream = "#f5fffa"; const wheat = "#f5deb3"; const whitesmoke = "#f5f5f5"; const ghostwhite = "#f8f8ff"; const lightgoldenrodyellow = "#fafad2"; const linen = "#faf0e6"; const salmon = "#fa8072"; const oldlace = "#fdf5e6"; const bisque = "#ffe4c4"; const blanchedalmond = "#ffebcd"; const coral = "#ff7f50"; const cornsilk = "#fff8dc"; const darkorange = "#ff8c00"; const deeppink = "#ff1493"; const floralwhite = "#fffaf0"; const fuchsia = "#ff00ff"; const gold = "#ffd700"; const hotpink = "#ff69b4"; const ivory = "#fffff0"; const lavenderblush = "#fff0f5"; const lemonchiffon = "#fffacd"; const lightpink = "#ffb6c1"; const lightsalmon = "#ffa07a"; const lightyellow = "#ffffe0"; const magenta = "#ff00ff"; const mistyrose = "#ffe4e1"; const moccasin = "#ffe4b5"; const navajowhite = "#ffdead"; const orange = "#ffa500"; const orangered = "#ff4500"; const papayawhip = "#ffefd5"; const peachpuff = "#ffdab9"; const pink = "#ffc0cb"; const red = "#ff0000"; const seashell = "#fff5ee"; const snow = "#fffafa"; const tomato = "#ff6347"; const white = "#ffffff"; const yellow = "#ffff00"; const rebeccapurple = "#663399"; const require$$0 = { aqua: aqua, aliceblue: aliceblue, antiquewhite: antiquewhite, black: black, blue: blue, cyan: cyan, darkblue: darkblue, darkcyan: darkcyan, darkgreen: darkgreen, darkturquoise: darkturquoise, deepskyblue: deepskyblue, green: green, lime: lime, mediumblue: mediumblue, mediumspringgreen: mediumspringgreen, navy: navy, springgreen: springgreen, teal: teal, midnightblue: midnightblue, dodgerblue: dodgerblue, lightseagreen: lightseagreen, forestgreen: forestgreen, seagreen: seagreen, darkslategray: darkslategray, darkslategrey: darkslategrey, limegreen: limegreen, mediumseagreen: mediumseagreen, turquoise: turquoise, royalblue: royalblue, steelblue: steelblue, darkslateblue: darkslateblue, mediumturquoise: mediumturquoise, indigo: indigo, darkolivegreen: darkolivegreen, cadetblue: cadetblue, cornflowerblue: cornflowerblue, mediumaquamarine: mediumaquamarine, dimgray: dimgray, dimgrey: dimgrey, slateblue: slateblue, olivedrab: olivedrab, slategray: slategray, slategrey: slategrey, lightslategray: lightslategray, lightslategrey: lightslategrey, mediumslateblue: mediumslateblue, lawngreen: lawngreen, aquamarine: aquamarine, chartreuse: chartreuse, gray: gray, grey: grey, maroon: maroon, olive: olive, purple: purple, lightskyblue: lightskyblue, skyblue: skyblue, blueviolet: blueviolet, darkmagenta: darkmagenta, darkred: darkred, saddlebrown: saddlebrown, darkseagreen: darkseagreen, lightgreen: lightgreen, mediumpurple: mediumpurple, darkviolet: darkviolet, palegreen: palegreen, darkorchid: darkorchid, yellowgreen: yellowgreen, sienna: sienna, brown: brown, darkgray: darkgray, darkgrey: darkgrey, greenyellow: greenyellow, lightblue: lightblue, paleturquoise: paleturquoise, lightsteelblue: lightsteelblue, powderblue: powderblue, firebrick: firebrick, darkgoldenrod: darkgoldenrod, mediumorchid: mediumorchid, rosybrown: rosybrown, darkkhaki: darkkhaki, silver: silver, mediumvioletred: mediumvioletred, indianred: indianred, peru: peru, chocolate: chocolate, tan: tan, lightgray: lightgray, lightgrey: lightgrey, thistle: thistle, goldenrod: goldenrod, orchid: orchid, palevioletred: palevioletred, crimson: crimson, gainsboro: gainsboro, plum: plum, burlywood: burlywood, lightcyan: lightcyan, lavender: lavender, darksalmon: darksalmon, palegoldenrod: palegoldenrod, violet: violet, azure: azure, honeydew: honeydew, khaki: khaki, lightcoral: lightcoral, sandybrown: sandybrown, beige: beige, mintcream: mintcream, wheat: wheat, whitesmoke: whitesmoke, ghostwhite: ghostwhite, lightgoldenrodyellow: lightgoldenrodyellow, linen: linen, salmon: salmon, oldlace: oldlace, bisque: bisque, blanchedalmond: blanchedalmond, coral: coral, cornsilk: cornsilk, darkorange: darkorange, deeppink: deeppink, floralwhite: floralwhite, fuchsia: fuchsia, gold: gold, hotpink: hotpink, ivory: ivory, lavenderblush: lavenderblush, lemonchiffon: lemonchiffon, lightpink: lightpink, lightsalmon: lightsalmon, lightyellow: lightyellow, magenta: magenta, mistyrose: mistyrose, moccasin: moccasin, navajowhite: navajowhite, orange: orange, orangered: orangered, papayawhip: papayawhip, peachpuff: peachpuff, pink: pink, red: red, seashell: seashell, snow: snow, tomato: tomato, white: white, yellow: yellow, rebeccapurple: rebeccapurple }; var _cssColorNames = require$$0; var _cssColorNames2 = _interopRequireDefault(_cssColorNames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Determine if name is a valid CSS color name * @param {String} name - name to determine if is valid CSS color name * @return {Boolean} - is name a valid CSS color name? */ var lib = function (name) { return typeof name === 'string' ? !!_cssColorNames2.default[name.toLowerCase()] : false; }; /* * Copyright 2022-2025 SenX S.A.S. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var Colors; (function (Colors) { // noinspection JSUnusedGlobalSymbols Colors["COHESIVE"] = "COHESIVE"; Colors["COHESIVE_2"] = "COHESIVE_2"; Colors["BELIZE"] = "BELIZE"; Colors["VIRIDIS"] = "VIRIDIS"; Colors["MAGMA"] = "MAGMA"; Colors["INFERNO"] = "INFERNO"; Colors["PLASMA"] = "PLASMA"; Colors["YL_OR_RD"] = "YL_OR_RD"; Colors["YL_GN_BU"] = "YL_GN_BU"; Colors["BU_GN"] = "BU_GN"; Colors["WARP10"] = "WARP10"; Colors["NINETEEN_EIGHTY_FOUR"] = "NINETEEN_EIGHTY_FOUR"; Colors["ATLANTIS"] = "ATLANTIS"; Colors["DO_ANDROIDS_DREAM"] = "DO_ANDROIDS_DREAM"; Colors["DELOREAN"] = "DELOREAN"; Colors["CTHULHU"] = "CTHULHU"; Colors["ECTOPLASM"] = "ECTOPLASM"; Colors["T_MAX_400_FILM"] = "T_MAX_400_FILM"; Colors["MATRIX"] = "MATRIX"; Colors["CHARTANA"] = "CHARTANA"; Colors["VINTAGE"] = "VINTAGE"; Colors["CHALK"] = "CHALK"; })(Colors || (Colors = {})); // noinspection JSUnusedGlobalSymbols var HeatMaps; (function (HeatMaps) { HeatMaps["COHESIVE"] = "COHESIVE"; HeatMaps["COHESIVE_2"] = "COHESIVE_2"; HeatMaps["BELIZE"] = "BELIZE"; HeatMaps["VIRIDIS"] = "VIRIDIS"; HeatMaps["MAGMA"] = "MAGMA"; HeatMaps["INFERNO"] = "INFERNO"; HeatMaps["PLASMA"] = "PLASMA"; HeatMaps["YL_OR_RD"] = "YL_OR_RD"; HeatMaps["YL_GN_BU"] = "YL_GN_BU"; HeatMaps["BU_GN"] = "BU_GN"; HeatMaps["NINETEEN_EIGHTY_FOUR"] = "NINETEEN_EIGHTY_FOUR"; HeatMaps["ATLANTIS"] = "ATLANTIS"; HeatMaps["DO_ANDROIDS_DREAM"] = "DO_ANDROIDS_DREAM"; HeatMaps["DELOREAN"] = "DELOREAN"; HeatMaps["CTHULHU"] = "CTHULHU"; HeatMaps["ECTOPLASM"] = "ECTOPLASM"; HeatMaps["T_MAX_400_FILM"] = "T_MAX_400_FILM"; HeatMaps["MATRIX"] = "MATRIX"; HeatMaps["CHALK"] = "CHALK"; HeatMaps["VINTAGE"] = "VINTAGE"; HeatMaps["DEFAULT"] = "DEFAULT"; })(HeatMaps || (HeatMaps = {})); class ColorLib { static getHeatMap(scheme) { return ColorLib.heatMaps[scheme] || ColorLib.heatMaps.DEFAULT; } static getColor(i, scheme) { if (typeof scheme === 'string') { if (!ColorLib.color[scheme]) { scheme = 'WARP10'; } return ColorLib.color[scheme][i % 2 === 0 ? i % ColorLib.color[scheme].length : ColorLib.color[scheme].length - i % ColorLib.color[scheme].length]; } else { return scheme[i % 2 === 0 ? i % scheme.length : scheme.length - i % scheme.length]; } } static sanitizeColor(color) { if ((color !== null && color !== void 0 ? color : '').startsWith('#')) { return color; } else if ((color !== null && color !== void 0 ? color : '').startsWith('rgb(')) { const rex = /^rgb\((\d+), ?(\d+), ?(\d+)\)/gi; const res = rex.exec(color); if (!res || res.length < 4) return color; return ColorLib.rgb2hex(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10)); } else if ((color !== null && color !== void 0 ? color : '').startsWith('rgba(')) { const rex = /^rgba\((\d+), ?(\d+), ?(\d+), ?\d\)/gi; const res = rex.exec(color); if (!res || res.length < 4) return color; return ColorLib.rgb2hex(res[1], res[2], res[3]); } else { return lib(color !== null && color !== void 0 ? color : '') ? cssColorNames[color.toLowerCase()] : color === 'transparent' ? '#ffffffff' : color; } } static hexToRgb(hex) { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? [ parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16) ] : null; } static transparentize(color, alpha = 0.5) { color = ColorLib.sanitizeColor(color !== null && color !== void 0 ? color : ''); return 'rgba(' + ColorLib.hexToRgb(color !== null && color !== void 0 ? color : '').concat(alpha).join(',') + ')'; } static hsvGradientFromRgbColors(c1, c2, steps) { const c1hsv = ColorLib.rgb2hsv(c1.r, c1.g, c1.b); const c2hsv = ColorLib.rgb2hsv(c2.r, c2.g, c2.b); c1.h = c1hsv[0]; c1.s = c1hsv[1]; c1.v = c1hsv[2]; c2.h = c2hsv[0]; c2.s = c2hsv[1]; c2.v = c2hsv[2]; const gradient = ColorLib.hsvGradient(c1, c2, steps); for (const item of gradient) { if (item) { item.rgb = ColorLib.hsv2rgb(item.h, item.s, item.v); item.r = Math.floor(item.rgb[0]); item.g = Math.floor(item.rgb[1]); item.b = Math.floor(item.rgb[2]); } } return gradient; } static rgb2hsv(r, g, b) { // Normalize const normR = r / 255.0; const normG = g / 255.0; const normB = b / 255.0; const M = Math.max(normR, normG, normB); const m = Math.min(normR, normG, normB); const d = M - m; let h; let s; const v = M; if (d === 0) { h = 0; s = 0; } else { s = d / v; switch (M) { case normR: h = ((normG - normB) + d * (normG < normB ? 6 : 0)) / 6 * d; break; case normG: h = ((normB - normR) + d * 2) / 6 * d; break; case normB: h = ((normR - normG) + d * 4) / 6 * d; break; } } return [h, s, v]; } static hsvGradient(c1, c2, steps) { const gradient = new Array(steps); // determine clockwise and counter-clockwise distance between hues const distCCW = (c1.h >= c2.h) ? c1.h - c2.h : 1 + c1.h - c2.h; const distCW = (c1.h >= c2.h) ? 1 + c2.h - c1.h : c2.h - c1.h; // make gradient for this part for (let i = 0; i < steps; i++) { // interpolate h, s, b let h = (distCW <= distCCW) ? c1.h + (distCW * i / (steps - 1)) : c1.h - (distCCW * i / (steps - 1)); if (h < 0) { h = 1 + h; } if (h > 1) { h = h - 1; } const s = (1 - i / (steps - 1)) * c1.s + i / (steps - 1) * c2.s; const v = (1 - i / (steps - 1)) * c1.v + i / (steps - 1) * c2.v; // add to gradient array gradient[i] = { h, s, v }; } return gradient; } static hsv2rgb(h, s, v) { let r; let g; let b; const i = Math.floor(h * 6); const f = h * 6 - i; const p = v * (1 - s); const q = v * (1 - f * s); const t = v * (1 - (1 - f) * s); switch (i % 6) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; case 5: r = v; g = p; b = q; break; } return [r * 255, g * 255, b * 255]; } static rgb2hex(r, g, b) { const componentToHex = (c) => { // noinspection TypeScriptValidateJSTypes const hex = c.toString(16); return hex.length === 1 ? `0${hex}` : hex; }; return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`; } } ColorLib.color = { COHESIVE: ['#F2D354', '#E4612F', '#D32C2E', '#6D2627', '#6C7F55', '#934FC6', '#F07A5D', '#ED8371', '#94E751', '#C457F7', '#973AF7', '#B6FF7A', '#C7FFD5', '#90E4D0', '#E09234', '#D2FF91', '#17B201'], COHESIVE_2: ['#6F694E', '#65D0B2', '#D8F546', '#FF724B', '#D6523E', '#F9F470', '#F4BC78', '#B1D637', '#FFCFC8', '#56CDAB', '#CFDD22', '#B3F5D2', '#97DB29', '#9DC5EE', '#CFC0F5', '#EDEA29', '#5EC027', '#386C94'], BELIZE: ['#5899DA', '#E8743B', '#19A979', '#ED4A7B', '#945ECF', '#13A4B4', '#525DF4', '#BF399E', '#6C8893', '#EE6868', '#2F6497'], VIRIDIS: ['#440154', '#481f70', '#443983', '#3b528b', '#31688e', '#287c8e', '#21918c', '#20a486', '#35b779', '#5ec962', '#90d743', '#c8e020',], MAGMA: ['#000004', '#100b2d', '#2c115f', '#51127c', '#721f81', '#932b80', '#b73779', '#d8456c', '#f1605d', '#fc8961', '#feb078', '#fed799',], INFERNO: ['#000004', '#110a30', '#320a5e', '#57106e', '#781c6d', '#9a2865', '#bc3754', '#d84c3e', '#ed6925', '#f98e09', '#fbb61a', '#f4df53',], PLASMA: ['#0d0887', '#3a049a', '#5c01a6', '#7e03a8', '#9c179e', '#b52f8c', '#cc4778', '#de5f65', '#ed7953', '#f89540', '#fdb42f', '#fbd524',], YL_OR_RD: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026',], YL_GN_BU: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58',], BU_GN: ['#f7fcfd', '#ebf7fa', '#dcf2f2', '#c8eae4', '#aadfd2', '#88d1bc', '#68c2a3', '#4eb485', '#37a266', '#228c49', '#0d7635', '#025f27',], WARP10: [ '#ff9900', '#E53935', '#F4511E', '#D81B60', '#00ACC1', '#1E88E5', '#43A047', '#FFB300', '#6D4C41', '#FDD835', '#00897B', '#3949AB', '#5E35B1', '#8E24AA', '#C0CA33', '#039BE5', '#7CB342', '#004eff' ], NINETEEN_EIGHTY_FOUR: ['#fc9ca2', '#fb747d', '#fa4c58', '#f92432', '#e30613', '#c70512', '#9f040e', '#77030b', '#500207'], ATLANTIS: ['#edf2fb', '#e2eafc', '#d7e3fc', '#ccdbfd', '#c1d3fe', '#b6ccfe', '#abc4ff'], DO_ANDROIDS_DREAM: ['#d8f3dc', '#b7e4c7', '#95d5b2', '#74c69d', '#52b788', '#40916c', '#2d6a4f', '#1b4332', '#081c15'], DELOREAN: ['#b98b73', '#cb997e', '#ddbea9', '#ffe8d6', '#d4c7b0', '#b7b7a4', '#a5a58d', '#6b705c', '#3f4238'], CTHULHU: ['#004c6d', '#006083', '#007599', '#008bad', '#00a1c1', '#00b8d3', '#00cfe3', '#00e7f2', '#00ffff'], ECTOPLASM: ['#006466', '#065a60', '#0b525b', '#144552', '#1b3a4b', '#212f45', '#272640', '#312244', '#3e1f47', '#4d194d'], T_MAX_400_FILM: ['#f8f9fa', '#e9ecef', '#dee2e6', '#ced4da', '#adb5bd', '#6c757d', '#495057', '#343a40', '#212529'], MATRIX: ['#025f27', '#025f27', '#0d7635', '#228c49', '#37a266', '#4eb485', '#68c2a3', '#88d1bc'], CHARTANA: ['#77BE69', '#FADE2B', '#F24865', '#5694F2', '#FF9830', '#B876D9'], CHALK: ['#fc97af', '#87f7cf', '#f7f494', '#72ccff', '#f7c5a0', '#d4a4eb', '#d2f5a6', '#76f2f2'], VINTAGE: ['#d87c7c', '#919e8b', '#d7ab82', '#6e7074', '#61a0a8', '#efa18d', '#787464', '#cc7e63', '#724e58', '#4b565b' ] }; ColorLib.heatMaps = { COHESIVE: ColorLib.color.COHESIVE, COHESIVE_2: ColorLib.color.COHESIVE_2, VIRIDIS: ColorLib.color.VIRIDIS, MAGMA: ColorLib.color.MAGMA, INFERNO: ColorLib.color.INFERNO, PLASMA: ColorLib.color.PLASMA, YL_OR_RD: ColorLib.color.YL_OR_RD, YL_GN_BU: ColorLib.color.YL_GN_BU, BU_GN: ColorLib.color.BU_GN, NINETEEN_EIGHTY_FOUR: ColorLib.color.NINETEEN_EIGHTY_FOUR, ATLANTIS: ColorLib.color.ATLANTIS, DO_ANDROIDS_DREAM: ColorLib.color.DO_ANDROIDS_DREAM, DELOREAN: ColorLib.color.DELOREAN, CTHULHU: ColorLib.color.CTHULHU, ECTOPLASM: ColorLib.color.ECTOPLASM, T_MAX_400_FILM: ColorLib.color.T_MAX_400_FILM, MATRIX: ColorLib.color.MATRIX, DEFAULT: ['#bf444c', '#d88273', '#f6efa6'] }; export { ColorLib as C, HeatMaps as H, Colors as a }; //# sourceMappingURL=color-lib.js.map