@phun-ky/moebius 2.0.39 → 2.0.40
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/dist/moebius.js +2 -2
- package/dist/moebius.js.map +1 -1
- package/package.json +5 -5
package/dist/moebius.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moebius.js","sources":["../node_modules/chroma-js/src/utils/limit.js","../node_modules/chroma-js/src/utils/clip_rgb.js","../node_modules/chroma-js/src/utils/type.js","../node_modules/chroma-js/src/utils/unpack.js","../node_modules/chroma-js/src/utils/last.js","../node_modules/chroma-js/src/utils/index.js","../node_modules/chroma-js/src/io/input.js","../node_modules/chroma-js/src/Color.js","../node_modules/chroma-js/src/version.js","../node_modules/chroma-js/src/chroma.js","../node_modules/chroma-js/src/colors/w3cx11.js","../node_modules/chroma-js/src/io/hex/hex2rgb.js","../node_modules/chroma-js/src/io/hex/rgb2hex.js","../node_modules/chroma-js/src/io/named/index.js","../node_modules/chroma-js/src/ops/alpha.js","../node_modules/chroma-js/src/ops/clipped.js","../node_modules/chroma-js/src/io/lab/lab-constants.js","../node_modules/chroma-js/src/io/lab/lab2rgb.js","../node_modules/chroma-js/src/io/lab/rgb2lab.js","../node_modules/chroma-js/src/io/lab/index.js","../node_modules/chroma-js/src/ops/darken.js","../node_modules/chroma-js/src/ops/get.js","../node_modules/chroma-js/src/ops/luminance.js","../node_modules/chroma-js/src/interpolator/index.js","../node_modules/chroma-js/src/generator/mix.js","../node_modules/chroma-js/src/ops/mix.js","../node_modules/chroma-js/src/ops/premultiply.js","../node_modules/chroma-js/src/io/lch/lch2lab.js","../node_modules/chroma-js/src/io/lch/lch2rgb.js","../node_modules/chroma-js/src/io/lch/lab2lch.js","../node_modules/chroma-js/src/io/lch/rgb2lch.js","../node_modules/chroma-js/src/io/lch/index.js","../node_modules/chroma-js/src/io/lch/hcl2rgb.js","../node_modules/chroma-js/src/ops/saturate.js","../node_modules/chroma-js/src/ops/set.js","../node_modules/chroma-js/src/ops/shade.js","../node_modules/chroma-js/src/interpolator/rgb.js","../node_modules/chroma-js/src/interpolator/lrgb.js","../node_modules/chroma-js/src/interpolator/lab.js","../node_modules/chroma-js/src/interpolator/_hsx.js","../node_modules/chroma-js/src/interpolator/lch.js","../node_modules/chroma-js/src/io/num/index.js","../node_modules/chroma-js/src/io/num/rgb2num.js","../node_modules/chroma-js/src/io/num/num2rgb.js","../node_modules/chroma-js/src/interpolator/num.js","../node_modules/chroma-js/src/io/hcg/hcg2rgb.js","../node_modules/chroma-js/src/io/hcg/index.js","../node_modules/chroma-js/src/io/hcg/rgb2hcg.js","../node_modules/chroma-js/src/interpolator/hcg.js","../node_modules/chroma-js/src/io/hsi/hsi2rgb.js","../node_modules/chroma-js/src/io/hsi/rgb2hsi.js","../node_modules/chroma-js/src/io/hsi/index.js","../node_modules/chroma-js/src/interpolator/hsi.js","../node_modules/chroma-js/src/io/hsl/hsl2rgb.js","../node_modules/chroma-js/src/io/hsl/rgb2hsl.js","../node_modules/chroma-js/src/io/hsl/index.js","../node_modules/chroma-js/src/interpolator/hsl.js","../node_modules/chroma-js/src/io/hsv/hsv2rgb.js","../node_modules/chroma-js/src/io/hsv/rgb2hsv.js","../node_modules/chroma-js/src/io/hsv/index.js","../node_modules/chroma-js/src/utils/multiply-matrices.js","../node_modules/chroma-js/src/interpolator/hsv.js","../node_modules/chroma-js/src/io/oklab/oklab2rgb.js","../node_modules/chroma-js/src/io/oklab/rgb2oklab.js","../node_modules/chroma-js/src/io/oklab/index.js","../node_modules/chroma-js/src/interpolator/oklab.js","../node_modules/chroma-js/src/interpolator/oklch.js","../node_modules/chroma-js/src/generator/average.js","../node_modules/chroma-js/src/generator/scale.js","../node_modules/chroma-js/src/io/rgb/index.js","../node_modules/chroma-js/src/generator/blend.js","../node_modules/chroma-js/src/generator/cubehelix.js","../node_modules/chroma-js/src/generator/random.js","../node_modules/chroma-js/src/utils/analyze.js","../node_modules/chroma-js/src/utils/contrastAPCA.js","../node_modules/chroma-js/src/utils/delta-e.js","../node_modules/chroma-js/src/utils/valid.js","../node_modules/chroma-js/src/utils/scales.js","../node_modules/chroma-js/src/colors/colorbrewer.js","../node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js","../node_modules/chroma-js/src/io/cmyk/index.js","../node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js","../node_modules/chroma-js/src/io/css/hsl2css.js","../node_modules/chroma-js/src/io/oklch/rgb2oklch.js","../node_modules/chroma-js/src/io/css/rgb2css.js","../node_modules/chroma-js/src/io/css/lab2css.js","../node_modules/chroma-js/src/io/css/lch2css.js","../node_modules/chroma-js/src/io/css/oklab2css.js","../node_modules/chroma-js/src/io/css/oklch2css.js","../node_modules/chroma-js/src/io/oklch/oklch2rgb.js","../node_modules/chroma-js/src/io/css/css2rgb.js","../node_modules/chroma-js/src/io/css/index.js","../node_modules/chroma-js/src/io/gl/index.js","../node_modules/chroma-js/src/io/hex/index.js","../node_modules/chroma-js/src/io/temp/temperature2rgb.js","../node_modules/chroma-js/src/io/temp/rgb2temperature.js","../node_modules/chroma-js/src/io/temp/index.js","../node_modules/chroma-js/src/io/oklch/index.js","../node_modules/chroma-js/index.js","../node_modules/chroma-js/src/generator/bezier.js","../node_modules/chroma-js/src/utils/contrast.js","../node_modules/chroma-js/src/utils/distance.js","../node_modules/nearest-color/nearestColor.js","../src/utils/color-objects/hsl.ts","../src/utils/color-objects/xyz.ts","../src/utils/color-objects/cmyk.ts","../src/utils/color-objects/rgb.ts","../src/utils/color-objects/hwb.ts","../src/utils/color-objects/lab.ts","../src/utils/color-objects/oklab.ts","../src/utils/color-objects/hsv.ts","../src/utils/color-objects/lch.ts","../src/utils/color-objects/oklch.ts","../src/utils/color-objects/hsi.ts","../src/utils/converters/to-float.ts","../src/utils/normalize-color-units.ts","../src/classes/MoebiusColor.ts","../src/utils/converters/to-hex.ts","../src/utils/converters/to-cmyk.ts","../src/utils/converters/to-xyz.ts","../src/utils/converters/to-hsl.ts","../src/utils/converters/to-hwb.ts","../src/utils/converters/to-lab.ts","../src/utils/converters/to-oklab.ts","../src/utils/converters/to-hsv.ts","../src/utils/converters/to-lch.ts","../src/utils/converters/to-oklch.ts","../src/utils/converters/to-hsi.ts","../src/utils/converters/to-rgb.ts","../src/utils/converters/to-object.ts","../src/constants/index.ts","../src/features/harmonize.ts","../src/utils/random.ts","../src/features/monochromatic.ts","../src/features/luminance-shift.ts","../src/utils/range.ts","../src/utils/get-chroma-bezier-scale-colors.ts","../src/utils/get-chroma-scale-colors.ts","../src/classes/MoebiusAccentColors.ts","../src/classes/MoebiusPaletteColors.ts","../src/classes/MoebiusThemeColors.ts","../src/classes/MoebiusPalettes.ts","../src/features/complement.ts","../src/features/dark-mode.ts","../src/features/split.ts","../src/features/triadic.ts","../src/features/tetradic.ts","../src/features/pentadic.ts","../src/features/hexadic.ts","../src/features/analogous.ts","../src/features/interpolate.ts","../src/classes/MoebiusSVGHelper.ts","../src/utils/unique-id.ts","../src/utils/svg/get-start-mask-degree.ts","../src/utils/svg/pie-slice.ts","../src/main.ts","../node_modules/@phun-ky/typeof/dist/typeof.js"],"sourcesContent":["const { min, max } = Math;\n\nexport default (x, low = 0, high = 1) => {\n return min(max(low, x), high);\n};\n","import limit from './limit.js';\n\nexport default (rgb) => {\n rgb._clipped = false;\n rgb._unclipped = rgb.slice(0);\n for (let i = 0; i <= 3; i++) {\n if (i < 3) {\n if (rgb[i] < 0 || rgb[i] > 255) rgb._clipped = true;\n rgb[i] = limit(rgb[i], 0, 255);\n } else if (i === 3) {\n rgb[i] = limit(rgb[i], 0, 1);\n }\n }\n return rgb;\n};\n","// ported from jQuery's $.type\nconst classToType = {};\nfor (let name of [\n 'Boolean',\n 'Number',\n 'String',\n 'Function',\n 'Array',\n 'Date',\n 'RegExp',\n 'Undefined',\n 'Null'\n]) {\n classToType[`[object ${name}]`] = name.toLowerCase();\n}\nexport default function (obj) {\n return classToType[Object.prototype.toString.call(obj)] || 'object';\n}\n","import type from './type.js';\n\nexport default (args, keyOrder = null) => {\n // if called with more than 3 arguments, we return the arguments\n if (args.length >= 3) return Array.prototype.slice.call(args);\n // with less than 3 args we check if first arg is object\n // and use the keyOrder string to extract and sort properties\n if (type(args[0]) == 'object' && keyOrder) {\n return keyOrder\n .split('')\n .filter((k) => args[0][k] !== undefined)\n .map((k) => args[0][k]);\n }\n // otherwise we just return the first argument\n // (which we suppose is an array of args)\n return args[0].slice(0);\n};\n","import type from './type.js';\n\nexport default (args) => {\n if (args.length < 2) return null;\n const l = args.length - 1;\n if (type(args[l]) == 'string') return args[l].toLowerCase();\n return null;\n};\n","const { PI, min, max } = Math;\n\nconst rnd2 = (a) => Math.round(a * 100) / 100;\nconst rnd3 = (a) => Math.round(a * 100) / 100;\n\nexport { default as clip_rgb } from './clip_rgb.js';\nexport { default as limit } from './limit.js';\nexport { default as type } from './type.js';\nexport { default as unpack } from './unpack.js';\nexport { default as last } from './last.js';\n\nconst TWOPI = PI * 2;\nconst PITHIRD = PI / 3;\nconst DEG2RAD = PI / 180;\nconst RAD2DEG = 180 / PI;\n\n/**\n * Reverse the first three elements of an array\n *\n * @param {any[]} arr\n * @returns {any[]}\n */\nfunction reverse3(arr) {\n return [...arr.slice(0, 3).reverse(), ...arr.slice(3)];\n}\n\nexport { PI, TWOPI, PITHIRD, DEG2RAD, RAD2DEG, min, max, rnd2, rnd3, reverse3 };\n","export default {\n format: {},\n autodetect: []\n};\n","import { last, clip_rgb, type } from './utils/index.js';\nimport _input from './io/input.js';\n\nclass Color {\n constructor(...args) {\n const me = this;\n if (\n type(args[0]) === 'object' &&\n args[0].constructor &&\n args[0].constructor === this.constructor\n ) {\n // the argument is already a Color instance\n return args[0];\n }\n // last argument could be the mode\n let mode = last(args);\n let autodetect = false;\n if (!mode) {\n autodetect = true;\n\n if (!_input.sorted) {\n _input.autodetect = _input.autodetect.sort((a, b) => b.p - a.p);\n _input.sorted = true;\n }\n\n // auto-detect format\n for (let chk of _input.autodetect) {\n mode = chk.test(...args);\n if (mode) break;\n }\n }\n if (_input.format[mode]) {\n const rgb = _input.format[mode].apply(\n null,\n autodetect ? args : args.slice(0, -1)\n );\n me._rgb = clip_rgb(rgb);\n } else {\n throw new Error('unknown format: ' + args);\n }\n // add alpha channel\n if (me._rgb.length === 3) me._rgb.push(1);\n }\n toString() {\n if (type(this.hex) == 'function') return this.hex();\n return `[${this._rgb.join(',')}]`;\n }\n}\nexport default Color;\n","// this gets updated automatically\nexport const version = '3.2.0';\n","import Color from './Color.js';\nimport { version } from './version.js';\n\nconst chroma = (...args) => {\n return new Color(...args);\n};\n\nchroma.version = version;\n\nexport default chroma;\n","/**\n\tX11 color names\n\n\thttp://www.w3.org/TR/css3-color/#svg-color\n*/\n\nconst w3cx11 = {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkgrey: '#a9a9a9',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkslategrey: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n grey: '#808080',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n indianred: '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n laserlemon: '#ffff54',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrod: '#fafad2',\n lightgoldenrodyellow: '#fafad2',\n lightgray: '#d3d3d3',\n lightgreen: '#90ee90',\n lightgrey: '#d3d3d3',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n maroon2: '#7f0000',\n maroon3: '#b03060',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370db',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#db7093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n purple2: '#7f007f',\n purple3: '#a020f0',\n rebeccapurple: '#663399',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n slategrey: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32'\n};\n\nexport default w3cx11;\n","const RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;\nconst RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;\n\nconst hex2rgb = (hex) => {\n if (hex.match(RE_HEX)) {\n // remove optional leading #\n if (hex.length === 4 || hex.length === 7) {\n hex = hex.substr(1);\n }\n // expand short-notation to full six-digit\n if (hex.length === 3) {\n hex = hex.split('');\n hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];\n }\n const u = parseInt(hex, 16);\n const r = u >> 16;\n const g = (u >> 8) & 0xff;\n const b = u & 0xff;\n return [r, g, b, 1];\n }\n\n // match rgba hex format, eg #FF000077\n if (hex.match(RE_HEXA)) {\n if (hex.length === 5 || hex.length === 9) {\n // remove optional leading #\n hex = hex.substr(1);\n }\n // expand short-notation to full eight-digit\n if (hex.length === 4) {\n hex = hex.split('');\n hex =\n hex[0] +\n hex[0] +\n hex[1] +\n hex[1] +\n hex[2] +\n hex[2] +\n hex[3] +\n hex[3];\n }\n const u = parseInt(hex, 16);\n const r = (u >> 24) & 0xff;\n const g = (u >> 16) & 0xff;\n const b = (u >> 8) & 0xff;\n const a = Math.round(((u & 0xff) / 0xff) * 100) / 100;\n return [r, g, b, a];\n }\n\n // we used to check for css colors here\n // if _input.css? and rgb = _input.css hex\n // return rgb\n\n throw new Error(`unknown hex color: ${hex}`);\n};\n\nexport default hex2rgb;\n","import { unpack, last } from '../../utils/index.js';\nconst { round } = Math;\n\nconst rgb2hex = (...args) => {\n let [r, g, b, a] = unpack(args, 'rgba');\n let mode = last(args) || 'auto';\n if (a === undefined) a = 1;\n if (mode === 'auto') {\n mode = a < 1 ? 'rgba' : 'rgb';\n }\n r = round(r);\n g = round(g);\n b = round(b);\n const u = (r << 16) | (g << 8) | b;\n let str = '000000' + u.toString(16); //#.toUpperCase();\n str = str.substr(str.length - 6);\n let hxa = '0' + round(a * 255).toString(16);\n hxa = hxa.substr(hxa.length - 2);\n switch (mode.toLowerCase()) {\n case 'rgba':\n return `#${str}${hxa}`;\n case 'argb':\n return `#${hxa}${str}`;\n default:\n return `#${str}`;\n }\n};\n\nexport default rgb2hex;\n","import Color from '../../Color.js';\nimport input from '../input.js';\nimport { type } from '../../utils/index.js';\n\nimport w3cx11 from '../../colors/w3cx11.js';\nimport hex2rgb from '../hex/hex2rgb.js';\nimport rgb2hex from '../hex/rgb2hex.js';\n\nColor.prototype.name = function () {\n const hex = rgb2hex(this._rgb, 'rgb');\n for (let n of Object.keys(w3cx11)) {\n if (w3cx11[n] === hex) return n.toLowerCase();\n }\n return hex;\n};\n\ninput.format.named = (name) => {\n name = name.toLowerCase();\n if (w3cx11[name]) return hex2rgb(w3cx11[name]);\n throw new Error('unknown color name: ' + name);\n};\n\ninput.autodetect.push({\n p: 5,\n test: (h, ...rest) => {\n if (!rest.length && type(h) === 'string' && w3cx11[h.toLowerCase()]) {\n return 'named';\n }\n }\n});\n","import Color from '../Color.js';\nimport { type } from '../utils/index.js';\n\nColor.prototype.alpha = function (a, mutate = false) {\n if (a !== undefined && type(a) === 'number') {\n if (mutate) {\n this._rgb[3] = a;\n return this;\n }\n return new Color([this._rgb[0], this._rgb[1], this._rgb[2], a], 'rgb');\n }\n return this._rgb[3];\n};\n","import Color from '../Color.js';\n\nColor.prototype.clipped = function () {\n return this._rgb._clipped || false;\n};\n","const labConstants = {\n // Corresponds roughly to RGB brighter/darker\n Kn: 18,\n\n // D65 standard referent\n labWhitePoint: 'd65',\n Xn: 0.95047,\n Yn: 1,\n Zn: 1.08883,\n\n t0: 0.137931034, // 4 / 29\n t1: 0.206896552, // 6 / 29\n t2: 0.12841855, // 3 * t1 * t1\n t3: 0.008856452, // t1 * t1 * t1,\n\n kE: 216.0 / 24389.0,\n kKE: 8.0,\n kK: 24389.0 / 27.0,\n\n RefWhiteRGB: {\n // sRGB\n X: 0.95047,\n Y: 1,\n Z: 1.08883\n },\n\n MtxRGB2XYZ: {\n m00: 0.4124564390896922,\n m01: 0.21267285140562253,\n m02: 0.0193338955823293,\n m10: 0.357576077643909,\n m11: 0.715152155287818,\n m12: 0.11919202588130297,\n m20: 0.18043748326639894,\n m21: 0.07217499330655958,\n m22: 0.9503040785363679\n },\n\n MtxXYZ2RGB: {\n m00: 3.2404541621141045,\n m01: -0.9692660305051868,\n m02: 0.055643430959114726,\n m10: -1.5371385127977166,\n m11: 1.8760108454466942,\n m12: -0.2040259135167538,\n m20: -0.498531409556016,\n m21: 0.041556017530349834,\n m22: 1.0572251882231791\n },\n\n // used in rgb2xyz\n As: 0.9414285350000001,\n Bs: 1.040417467,\n Cs: 1.089532651,\n\n MtxAdaptMa: {\n m00: 0.8951,\n m01: -0.7502,\n m02: 0.0389,\n m10: 0.2664,\n m11: 1.7135,\n m12: -0.0685,\n m20: -0.1614,\n m21: 0.0367,\n m22: 1.0296\n },\n\n MtxAdaptMaI: {\n m00: 0.9869929054667123,\n m01: 0.43230526972339456,\n m02: -0.008528664575177328,\n m10: -0.14705425642099013,\n m11: 0.5183602715367776,\n m12: 0.04004282165408487,\n m20: 0.15996265166373125,\n m21: 0.0492912282128556,\n m22: 0.9684866957875502\n }\n};\n\nexport default labConstants;\n\n// taken from https://de.mathworks.com/help/images/ref/whitepoint.html\nconst ILLUMINANTS = new Map([\n // ASTM E308-01\n ['a', [1.0985, 0.35585]],\n // Wyszecki & Stiles, p. 769\n ['b', [1.0985, 0.35585]],\n // C ASTM E308-01\n ['c', [0.98074, 1.18232]],\n // D50 (ASTM E308-01)\n ['d50', [0.96422, 0.82521]],\n // D55 (ASTM E308-01)\n ['d55', [0.95682, 0.92149]],\n // D65 (ASTM E308-01)\n ['d65', [0.95047, 1.08883]],\n // E (ASTM E308-01)\n ['e', [1, 1, 1]],\n // F2 (ASTM E308-01)\n ['f2', [0.99186, 0.67393]],\n // F7 (ASTM E308-01)\n ['f7', [0.95041, 1.08747]],\n // F11 (ASTM E308-01)\n ['f11', [1.00962, 0.6435]],\n ['icc', [0.96422, 0.82521]]\n]);\n\nexport function setLabWhitePoint(name) {\n const ill = ILLUMINANTS.get(String(name).toLowerCase());\n if (!ill) {\n throw new Error('unknown Lab illuminant ' + name);\n }\n labConstants.labWhitePoint = name;\n labConstants.Xn = ill[0];\n labConstants.Zn = ill[1];\n}\n\nexport function getLabWhitePoint() {\n return labConstants.labWhitePoint;\n}\n","import LAB_CONSTANTS from './lab-constants.js';\nimport { unpack } from '../../utils/index.js';\n\n/*\n * L* [0..100]\n * a [-100..100]\n * b [-100..100]\n */\nconst lab2rgb = (...args) => {\n args = unpack(args, 'lab');\n const [L, a, b] = args;\n const [x, y, z] = lab2xyz(L, a, b);\n const [r, g, b_] = xyz2rgb(x, y, z);\n return [r, g, b_, args.length > 3 ? args[3] : 1];\n};\n\nconst lab2xyz = (L, a, b) => {\n const { kE, kK, kKE, Xn, Yn, Zn } = LAB_CONSTANTS;\n\n const fy = (L + 16.0) / 116.0;\n const fx = 0.002 * a + fy;\n const fz = fy - 0.005 * b;\n\n const fx3 = fx * fx * fx;\n const fz3 = fz * fz * fz;\n\n const xr = fx3 > kE ? fx3 : (116.0 * fx - 16.0) / kK;\n const yr = L > kKE ? Math.pow((L + 16.0) / 116.0, 3.0) : L / kK;\n const zr = fz3 > kE ? fz3 : (116.0 * fz - 16.0) / kK;\n\n const x = xr * Xn;\n const y = yr * Yn;\n const z = zr * Zn;\n\n return [x, y, z];\n};\n\nconst compand = (linear) => {\n /* sRGB */\n const sign = Math.sign(linear);\n linear = Math.abs(linear);\n return (\n (linear <= 0.0031308\n ? linear * 12.92\n : 1.055 * Math.pow(linear, 1.0 / 2.4) - 0.055) * sign\n );\n};\n\nconst xyz2rgb = (x, y, z) => {\n const { MtxAdaptMa, MtxAdaptMaI, MtxXYZ2RGB, RefWhiteRGB, Xn, Yn, Zn } =\n LAB_CONSTANTS;\n\n const As = Xn * MtxAdaptMa.m00 + Yn * MtxAdaptMa.m10 + Zn * MtxAdaptMa.m20;\n const Bs = Xn * MtxAdaptMa.m01 + Yn * MtxAdaptMa.m11 + Zn * MtxAdaptMa.m21;\n const Cs = Xn * MtxAdaptMa.m02 + Yn * MtxAdaptMa.m12 + Zn * MtxAdaptMa.m22;\n\n const Ad =\n RefWhiteRGB.X * MtxAdaptMa.m00 +\n RefWhiteRGB.Y * MtxAdaptMa.m10 +\n RefWhiteRGB.Z * MtxAdaptMa.m20;\n const Bd =\n RefWhiteRGB.X * MtxAdaptMa.m01 +\n RefWhiteRGB.Y * MtxAdaptMa.m11 +\n RefWhiteRGB.Z * MtxAdaptMa.m21;\n const Cd =\n RefWhiteRGB.X * MtxAdaptMa.m02 +\n RefWhiteRGB.Y * MtxAdaptMa.m12 +\n RefWhiteRGB.Z * MtxAdaptMa.m22;\n\n const X1 =\n (x * MtxAdaptMa.m00 + y * MtxAdaptMa.m10 + z * MtxAdaptMa.m20) *\n (Ad / As);\n const Y1 =\n (x * MtxAdaptMa.m01 + y * MtxAdaptMa.m11 + z * MtxAdaptMa.m21) *\n (Bd / Bs);\n const Z1 =\n (x * MtxAdaptMa.m02 + y * MtxAdaptMa.m12 + z * MtxAdaptMa.m22) *\n (Cd / Cs);\n\n const X2 =\n X1 * MtxAdaptMaI.m00 + Y1 * MtxAdaptMaI.m10 + Z1 * MtxAdaptMaI.m20;\n const Y2 =\n X1 * MtxAdaptMaI.m01 + Y1 * MtxAdaptMaI.m11 + Z1 * MtxAdaptMaI.m21;\n const Z2 =\n X1 * MtxAdaptMaI.m02 + Y1 * MtxAdaptMaI.m12 + Z1 * MtxAdaptMaI.m22;\n\n const r = compand(\n X2 * MtxXYZ2RGB.m00 + Y2 * MtxXYZ2RGB.m10 + Z2 * MtxXYZ2RGB.m20\n );\n const g = compand(\n X2 * MtxXYZ2RGB.m01 + Y2 * MtxXYZ2RGB.m11 + Z2 * MtxXYZ2RGB.m21\n );\n const b = compand(\n X2 * MtxXYZ2RGB.m02 + Y2 * MtxXYZ2RGB.m12 + Z2 * MtxXYZ2RGB.m22\n );\n\n return [r * 255, g * 255, b * 255];\n};\n\nexport default lab2rgb;\nexport { xyz2rgb };\n","import LAB_CONSTANTS from './lab-constants.js';\nimport { unpack } from '../../utils/index.js';\n\nconst rgb2lab = (...args) => {\n const [r, g, b, ...rest] = unpack(args, 'rgb');\n const [x, y, z] = rgb2xyz(r, g, b);\n const [L, a, b_] = xyz2lab(x, y, z);\n return [L, a, b_, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\nfunction xyz2lab(x, y, z) {\n const { Xn, Yn, Zn, kE, kK } = LAB_CONSTANTS;\n const xr = x / Xn;\n const yr = y / Yn;\n const zr = z / Zn;\n\n const fx = xr > kE ? Math.pow(xr, 1.0 / 3.0) : (kK * xr + 16.0) / 116.0;\n const fy = yr > kE ? Math.pow(yr, 1.0 / 3.0) : (kK * yr + 16.0) / 116.0;\n const fz = zr > kE ? Math.pow(zr, 1.0 / 3.0) : (kK * zr + 16.0) / 116.0;\n\n return [116.0 * fy - 16.0, 500.0 * (fx - fy), 200.0 * (fy - fz)];\n}\n\nfunction gammaAdjustSRGB(companded) {\n const sign = Math.sign(companded);\n companded = Math.abs(companded);\n const linear =\n companded <= 0.04045\n ? companded / 12.92\n : Math.pow((companded + 0.055) / 1.055, 2.4);\n return linear * sign;\n}\n\nconst rgb2xyz = (r, g, b) => {\n // normalize and gamma adjust\n r = gammaAdjustSRGB(r / 255);\n g = gammaAdjustSRGB(g / 255);\n b = gammaAdjustSRGB(b / 255);\n\n const { MtxRGB2XYZ, MtxAdaptMa, MtxAdaptMaI, Xn, Yn, Zn, As, Bs, Cs } =\n LAB_CONSTANTS;\n\n let x = r * MtxRGB2XYZ.m00 + g * MtxRGB2XYZ.m10 + b * MtxRGB2XYZ.m20;\n let y = r * MtxRGB2XYZ.m01 + g * MtxRGB2XYZ.m11 + b * MtxRGB2XYZ.m21;\n let z = r * MtxRGB2XYZ.m02 + g * MtxRGB2XYZ.m12 + b * MtxRGB2XYZ.m22;\n\n const Ad = Xn * MtxAdaptMa.m00 + Yn * MtxAdaptMa.m10 + Zn * MtxAdaptMa.m20;\n const Bd = Xn * MtxAdaptMa.m01 + Yn * MtxAdaptMa.m11 + Zn * MtxAdaptMa.m21;\n const Cd = Xn * MtxAdaptMa.m02 + Yn * MtxAdaptMa.m12 + Zn * MtxAdaptMa.m22;\n\n let X = x * MtxAdaptMa.m00 + y * MtxAdaptMa.m10 + z * MtxAdaptMa.m20;\n let Y = x * MtxAdaptMa.m01 + y * MtxAdaptMa.m11 + z * MtxAdaptMa.m21;\n let Z = x * MtxAdaptMa.m02 + y * MtxAdaptMa.m12 + z * MtxAdaptMa.m22;\n\n X *= Ad / As;\n Y *= Bd / Bs;\n Z *= Cd / Cs;\n\n x = X * MtxAdaptMaI.m00 + Y * MtxAdaptMaI.m10 + Z * MtxAdaptMaI.m20;\n y = X * MtxAdaptMaI.m01 + Y * MtxAdaptMaI.m11 + Z * MtxAdaptMaI.m21;\n z = X * MtxAdaptMaI.m02 + Y * MtxAdaptMaI.m12 + Z * MtxAdaptMaI.m22;\n\n return [x, y, z];\n};\n\nexport default rgb2lab;\nexport { rgb2xyz };\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport lab2rgb from './lab2rgb.js';\nimport rgb2lab from './rgb2lab.js';\nimport { getLabWhitePoint, setLabWhitePoint } from './lab-constants.js';\n\nColor.prototype.lab = function () {\n return rgb2lab(this._rgb);\n};\n\nconst lab = (...args) => new Color(...args, 'lab');\nObject.assign(chroma, { lab, getLabWhitePoint, setLabWhitePoint });\n\ninput.format.lab = lab2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'lab');\n if (type(args) === 'array' && args.length === 3) {\n return 'lab';\n }\n }\n});\n\nexport { lab, getLabWhitePoint, setLabWhitePoint };\n","import '../io/lab/index.js';\nimport Color from '../Color.js';\nimport LAB_CONSTANTS from '../io/lab/lab-constants.js';\n\nColor.prototype.darken = function (amount = 1) {\n const me = this;\n const lab = me.lab();\n lab[0] -= LAB_CONSTANTS.Kn * amount;\n return new Color(lab, 'lab').alpha(me.alpha(), true);\n};\n\nColor.prototype.brighten = function (amount = 1) {\n return this.darken(-amount);\n};\n\nColor.prototype.darker = Color.prototype.darken;\nColor.prototype.brighter = Color.prototype.brighten;\n","import Color from '../Color.js';\n\nColor.prototype.get = function (mc) {\n const [mode, channel] = mc.split('.');\n const src = this[mode]();\n if (channel) {\n const i = mode.indexOf(channel) - (mode.substr(0, 2) === 'ok' ? 2 : 0);\n if (i > -1) return src[i];\n throw new Error(`unknown channel ${channel} in mode ${mode}`);\n } else {\n return src;\n }\n};\n","import Color from '../Color.js';\nimport { type } from '../utils/index.js';\nconst { pow } = Math;\n\nconst EPS = 1e-7;\nconst MAX_ITER = 20;\n\nColor.prototype.luminance = function (lum, mode = 'rgb') {\n if (lum !== undefined && type(lum) === 'number') {\n if (lum === 0) {\n // return pure black\n return new Color([0, 0, 0, this._rgb[3]], 'rgb');\n }\n if (lum === 1) {\n // return pure white\n return new Color([255, 255, 255, this._rgb[3]], 'rgb');\n }\n // compute new color using...\n let cur_lum = this.luminance();\n let max_iter = MAX_ITER;\n\n const test = (low, high) => {\n const mid = low.interpolate(high, 0.5, mode);\n const lm = mid.luminance();\n if (Math.abs(lum - lm) < EPS || !max_iter--) {\n // close enough\n return mid;\n }\n return lm > lum ? test(low, mid) : test(mid, high);\n };\n\n const rgb = (\n cur_lum > lum\n ? test(new Color([0, 0, 0]), this)\n : test(this, new Color([255, 255, 255]))\n ).rgb();\n return new Color([...rgb, this._rgb[3]]);\n }\n return rgb2luminance(...this._rgb.slice(0, 3));\n};\n\nconst rgb2luminance = (r, g, b) => {\n // relative luminance\n // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n r = luminance_x(r);\n g = luminance_x(g);\n b = luminance_x(b);\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nconst luminance_x = (x) => {\n x /= 255;\n return x <= 0.03928 ? x / 12.92 : pow((x + 0.055) / 1.055, 2.4);\n};\n","export default {};\n","import Color from '../Color.js';\nimport { type } from '../utils/index.js';\nimport interpolator from '../interpolator/index.js';\n\nexport default (col1, col2, f = 0.5, ...rest) => {\n let mode = rest[0] || 'lrgb';\n if (!interpolator[mode] && !rest.length) {\n // fall back to the first supported mode\n mode = Object.keys(interpolator)[0];\n }\n if (!interpolator[mode]) {\n throw new Error(`interpolation mode ${mode} is not defined`);\n }\n if (type(col1) !== 'object') col1 = new Color(col1);\n if (type(col2) !== 'object') col2 = new Color(col2);\n return interpolator[mode](col1, col2, f).alpha(\n col1.alpha() + f * (col2.alpha() - col1.alpha())\n );\n};\n","import Color from '../Color.js';\nimport mix from '../generator/mix.js';\n\nColor.prototype.mix = Color.prototype.interpolate = function (\n col2,\n f = 0.5,\n ...rest\n) {\n return mix(this, col2, f, ...rest);\n};\n","import Color from '../Color.js';\n\nColor.prototype.premultiply = function (mutate = false) {\n const rgb = this._rgb;\n const a = rgb[3];\n if (mutate) {\n this._rgb = [rgb[0] * a, rgb[1] * a, rgb[2] * a, a];\n return this;\n } else {\n return new Color([rgb[0] * a, rgb[1] * a, rgb[2] * a, a], 'rgb');\n }\n};\n","import { unpack, DEG2RAD } from '../../utils/index.js';\nconst { sin, cos } = Math;\n\nconst lch2lab = (...args) => {\n /*\n Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel.\n These formulas were invented by David Dalrymple to obtain maximum contrast without going\n out of gamut if the parameters are in the range 0-1.\n\n A saturation multiplier was added by Gregor Aisch\n */\n let [l, c, h] = unpack(args, 'lch');\n if (isNaN(h)) h = 0;\n h = h * DEG2RAD;\n return [l, cos(h) * c, sin(h) * c];\n};\n\nexport default lch2lab;\n","import { unpack } from '../../utils/index.js';\nimport lch2lab from './lch2lab.js';\nimport lab2rgb from '../lab/lab2rgb.js';\n\nconst lch2rgb = (...args) => {\n args = unpack(args, 'lch');\n const [l, c, h] = args;\n const [L, a, b_] = lch2lab(l, c, h);\n const [r, g, b] = lab2rgb(L, a, b_);\n return [r, g, b, args.length > 3 ? args[3] : 1];\n};\n\nexport default lch2rgb;\n","import { unpack, RAD2DEG } from '../../utils/index.js';\nconst { sqrt, atan2, round } = Math;\n\nconst lab2lch = (...args) => {\n const [l, a, b] = unpack(args, 'lab');\n const c = sqrt(a * a + b * b);\n let h = (atan2(b, a) * RAD2DEG + 360) % 360;\n if (round(c * 10000) === 0) h = Number.NaN;\n return [l, c, h];\n};\n\nexport default lab2lch;\n","import { unpack } from '../../utils/index.js';\nimport rgb2lab from '../lab/rgb2lab.js';\nimport lab2lch from './lab2lch.js';\n\nconst rgb2lch = (...args) => {\n const [r, g, b, ...rest] = unpack(args, 'rgb');\n const [l, a, b_] = rgb2lab(r, g, b);\n const [L, c, h] = lab2lch(l, a, b_);\n return [L, c, h, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\nexport default rgb2lch;\n","import { unpack, type, reverse3 } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport lch2rgb from './lch2rgb.js';\nimport hcl2rgb from './hcl2rgb.js';\nimport rgb2lch from './rgb2lch.js';\n\nColor.prototype.lch = function () {\n return rgb2lch(this._rgb);\n};\nColor.prototype.hcl = function () {\n return reverse3(rgb2lch(this._rgb));\n};\n\nconst lch = (...args) => new Color(...args, 'lch');\nconst hcl = (...args) => new Color(...args, 'hcl');\n\nObject.assign(chroma, { lch, hcl });\n\ninput.format.lch = lch2rgb;\ninput.format.hcl = hcl2rgb;\n['lch', 'hcl'].forEach((m) =>\n input.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, m);\n if (type(args) === 'array' && args.length === 3) {\n return m;\n }\n }\n })\n);\n\nexport { lch, hcl };\n","import { unpack, reverse3 } from '../../utils/index.js';\nimport lch2rgb from './lch2rgb.js';\n\nconst hcl2rgb = (...args) => {\n const hcl = reverse3(unpack(args, 'hcl'));\n return lch2rgb(...hcl);\n};\n\nexport default hcl2rgb;\n","import '../io/lch/index.js';\nimport Color from '../Color.js';\nimport LAB_CONSTANTS from '../io/lab/lab-constants.js';\n\nColor.prototype.saturate = function (amount = 1) {\n const me = this;\n const lch = me.lch();\n lch[1] += LAB_CONSTANTS.Kn * amount;\n if (lch[1] < 0) lch[1] = 0;\n return new Color(lch, 'lch').alpha(me.alpha(), true);\n};\n\nColor.prototype.desaturate = function (amount = 1) {\n return this.saturate(-amount);\n};\n","import Color from '../Color.js';\nimport { type } from '../utils/index.js';\n\nColor.prototype.set = function (mc, value, mutate = false) {\n const [mode, channel] = mc.split('.');\n const src = this[mode]();\n if (channel) {\n const i = mode.indexOf(channel) - (mode.substr(0, 2) === 'ok' ? 2 : 0);\n if (i > -1) {\n if (type(value) == 'string') {\n switch (value.charAt(0)) {\n case '+':\n src[i] += +value;\n break;\n case '-':\n src[i] += +value;\n break;\n case '*':\n src[i] *= +value.substr(1);\n break;\n case '/':\n src[i] /= +value.substr(1);\n break;\n default:\n src[i] = +value;\n }\n } else if (type(value) === 'number') {\n src[i] = value;\n } else {\n throw new Error(`unsupported value for Color.set`);\n }\n const out = new Color(src, mode);\n if (mutate) {\n this._rgb = out._rgb;\n return this;\n }\n return out;\n }\n throw new Error(`unknown channel ${channel} in mode ${mode}`);\n } else {\n return src;\n }\n};\n","import '../io/lab/index.js';\nimport Color from '../Color.js';\nimport mix from '../generator/mix.js';\n\nColor.prototype.tint = function (f = 0.5, ...rest) {\n return mix(this, 'white', f, ...rest);\n};\n\nColor.prototype.shade = function (f = 0.5, ...rest) {\n return mix(this, 'black', f, ...rest);\n};\n","import Color from '../Color.js';\nimport index from './index.js';\n\nconst rgb = (col1, col2, f) => {\n const xyz0 = col1._rgb;\n const xyz1 = col2._rgb;\n return new Color(\n xyz0[0] + f * (xyz1[0] - xyz0[0]),\n xyz0[1] + f * (xyz1[1] - xyz0[1]),\n xyz0[2] + f * (xyz1[2] - xyz0[2]),\n 'rgb'\n );\n};\n\n// register interpolator\nindex.rgb = rgb;\n\nexport default rgb;\n","import Color from '../Color.js';\nconst { sqrt, pow } = Math;\nimport index from './index.js';\n\nconst lrgb = (col1, col2, f) => {\n const [x1, y1, z1] = col1._rgb;\n const [x2, y2, z2] = col2._rgb;\n return new Color(\n sqrt(pow(x1, 2) * (1 - f) + pow(x2, 2) * f),\n sqrt(pow(y1, 2) * (1 - f) + pow(y2, 2) * f),\n sqrt(pow(z1, 2) * (1 - f) + pow(z2, 2) * f),\n 'rgb'\n );\n};\n\n// register interpolator\nindex.lrgb = lrgb;\n\nexport default lrgb;\n","import '../io/lab/index.js';\nimport index from './index.js';\nimport Color from '../Color.js';\n\nconst lab = (col1, col2, f) => {\n const xyz0 = col1.lab();\n const xyz1 = col2.lab();\n return new Color(\n xyz0[0] + f * (xyz1[0] - xyz0[0]),\n xyz0[1] + f * (xyz1[1] - xyz0[1]),\n xyz0[2] + f * (xyz1[2] - xyz0[2]),\n 'lab'\n );\n};\n\n// register interpolator\nindex.lab = lab;\n\nexport default lab;\n","import Color from '../Color.js';\n\nexport default (col1, col2, f, m) => {\n let xyz0, xyz1;\n if (m === 'hsl') {\n xyz0 = col1.hsl();\n xyz1 = col2.hsl();\n } else if (m === 'hsv') {\n xyz0 = col1.hsv();\n xyz1 = col2.hsv();\n } else if (m === 'hcg') {\n xyz0 = col1.hcg();\n xyz1 = col2.hcg();\n } else if (m === 'hsi') {\n xyz0 = col1.hsi();\n xyz1 = col2.hsi();\n } else if (m === 'lch' || m === 'hcl') {\n m = 'hcl';\n xyz0 = col1.hcl();\n xyz1 = col2.hcl();\n } else if (m === 'oklch') {\n xyz0 = col1.oklch().reverse();\n xyz1 = col2.oklch().reverse();\n }\n\n let hue0, hue1, sat0, sat1, lbv0, lbv1;\n if (m.substr(0, 1) === 'h' || m === 'oklch') {\n [hue0, sat0, lbv0] = xyz0;\n [hue1, sat1, lbv1] = xyz1;\n }\n\n let sat, hue, lbv, dh;\n\n if (!isNaN(hue0) && !isNaN(hue1)) {\n // both colors have hue\n if (hue1 > hue0 && hue1 - hue0 > 180) {\n dh = hue1 - (hue0 + 360);\n } else if (hue1 < hue0 && hue0 - hue1 > 180) {\n dh = hue1 + 360 - hue0;\n } else {\n dh = hue1 - hue0;\n }\n hue = hue0 + f * dh;\n } else if (!isNaN(hue0)) {\n hue = hue0;\n if ((lbv1 == 1 || lbv1 == 0) && m != 'hsv') sat = sat0;\n } else if (!isNaN(hue1)) {\n hue = hue1;\n if ((lbv0 == 1 || lbv0 == 0) && m != 'hsv') sat = sat1;\n } else {\n hue = Number.NaN;\n }\n\n if (sat === undefined) sat = sat0 + f * (sat1 - sat0);\n lbv = lbv0 + f * (lbv1 - lbv0);\n return m === 'oklch'\n ? new Color([lbv, sat, hue], m)\n : new Color([hue, sat, lbv], m);\n};\n","import '../io/lch/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst lch = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'lch');\n};\n\n// register interpolator\nindex.lch = lch;\nindex.hcl = lch;\n\nexport default lch;\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport { type } from '../../utils/index.js';\nimport num2rgb from './num2rgb.js';\nimport rgb2num from './rgb2num.js';\n\nColor.prototype.num = function () {\n return rgb2num(this._rgb);\n};\n\nconst num = (...args) => new Color(...args, 'num');\n\nObject.assign(chroma, { num });\n\ninput.format.num = num2rgb;\n\ninput.autodetect.push({\n p: 5,\n test: (...args) => {\n if (\n args.length === 1 &&\n type(args[0]) === 'number' &&\n args[0] >= 0 &&\n args[0] <= 0xffffff\n ) {\n return 'num';\n }\n }\n});\n\nexport { num };\n","import { unpack } from '../../utils/index.js';\n\nconst rgb2num = (...args) => {\n const [r, g, b] = unpack(args, 'rgb');\n return (r << 16) + (g << 8) + b;\n};\n\nexport default rgb2num;\n","import { type } from '../../utils/index.js';\n\nconst num2rgb = (num) => {\n if (type(num) == 'number' && num >= 0 && num <= 0xffffff) {\n const r = num >> 16;\n const g = (num >> 8) & 0xff;\n const b = num & 0xff;\n return [r, g, b, 1];\n }\n throw new Error('unknown num color: ' + num);\n};\n\nexport default num2rgb;\n","import '../io/num/index.js';\nimport index from './index.js';\n\nimport Color from '../Color.js';\n\nconst num = (col1, col2, f) => {\n const c1 = col1.num();\n const c2 = col2.num();\n return new Color(c1 + f * (c2 - c1), 'num');\n};\n\n// register interpolator\nindex.num = num;\n\nexport default num;\n","import { unpack } from '../../utils/index.js';\nconst { floor } = Math;\n\n/*\n * this is basically just HSV with some minor tweaks\n *\n * hue.. [0..360]\n * chroma .. [0..1]\n * grayness .. [0..1]\n */\n\nconst hcg2rgb = (...args) => {\n args = unpack(args, 'hcg');\n let [h, c, _g] = args;\n let r, g, b;\n _g = _g * 255;\n const _c = c * 255;\n if (c === 0) {\n r = g = b = _g;\n } else {\n if (h === 360) h = 0;\n if (h > 360) h -= 360;\n if (h < 0) h += 360;\n h /= 60;\n const i = floor(h);\n const f = h - i;\n const p = _g * (1 - c);\n const q = p + _c * (1 - f);\n const t = p + _c * f;\n const v = p + _c;\n switch (i) {\n case 0:\n [r, g, b] = [v, t, p];\n break;\n case 1:\n [r, g, b] = [q, v, p];\n break;\n case 2:\n [r, g, b] = [p, v, t];\n break;\n case 3:\n [r, g, b] = [p, q, v];\n break;\n case 4:\n [r, g, b] = [t, p, v];\n break;\n case 5:\n [r, g, b] = [v, p, q];\n break;\n }\n }\n return [r, g, b, args.length > 3 ? args[3] : 1];\n};\n\nexport default hcg2rgb;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport hcg2rgb from './hcg2rgb.js';\nimport rgb2hcg from './rgb2hcg.js';\n\nColor.prototype.hcg = function () {\n return rgb2hcg(this._rgb);\n};\n\nconst hcg = (...args) => new Color(...args, 'hcg');\nchroma.hcg = hcg;\n\ninput.format.hcg = hcg2rgb;\n\ninput.autodetect.push({\n p: 1,\n test: (...args) => {\n args = unpack(args, 'hcg');\n if (type(args) === 'array' && args.length === 3) {\n return 'hcg';\n }\n }\n});\n\nexport { hcg };\n","import { unpack, max, min } from '../../utils/index.js';\n\nconst rgb2hcg = (...args) => {\n const [r, g, b] = unpack(args, 'rgb');\n const minRgb = min(r, g, b);\n const maxRgb = max(r, g, b);\n const delta = maxRgb - minRgb;\n const c = (delta * 100) / 255;\n const _g = (minRgb / (255 - delta)) * 100;\n let h;\n if (delta === 0) {\n h = Number.NaN;\n } else {\n if (r === maxRgb) h = (g - b) / delta;\n if (g === maxRgb) h = 2 + (b - r) / delta;\n if (b === maxRgb) h = 4 + (r - g) / delta;\n h *= 60;\n if (h < 0) h += 360;\n }\n return [h, c, _g];\n};\n\nexport default rgb2hcg;\n","import '../io/hcg/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst hcg = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'hcg');\n};\n\n// register interpolator\nindex.hcg = hcg;\n\nexport default hcg;\n","import { unpack, limit, TWOPI, PITHIRD } from '../../utils/index.js';\nconst { cos } = Math;\n\n/*\n * hue [0..360]\n * saturation [0..1]\n * intensity [0..1]\n */\nconst hsi2rgb = (...args) => {\n /*\n borrowed from here:\n http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp\n */\n args = unpack(args, 'hsi');\n let [h, s, i] = args;\n let r, g, b;\n\n if (isNaN(h)) h = 0;\n if (isNaN(s)) s = 0;\n // normalize hue\n if (h > 360) h -= 360;\n if (h < 0) h += 360;\n h /= 360;\n if (h < 1 / 3) {\n b = (1 - s) / 3;\n r = (1 + (s * cos(TWOPI * h)) / cos(PITHIRD - TWOPI * h)) / 3;\n g = 1 - (b + r);\n } else if (h < 2 / 3) {\n h -= 1 / 3;\n r = (1 - s) / 3;\n g = (1 + (s * cos(TWOPI * h)) / cos(PITHIRD - TWOPI * h)) / 3;\n b = 1 - (r + g);\n } else {\n h -= 2 / 3;\n g = (1 - s) / 3;\n b = (1 + (s * cos(TWOPI * h)) / cos(PITHIRD - TWOPI * h)) / 3;\n r = 1 - (g + b);\n }\n r = limit(i * r * 3);\n g = limit(i * g * 3);\n b = limit(i * b * 3);\n return [r * 255, g * 255, b * 255, args.length > 3 ? args[3] : 1];\n};\n\nexport default hsi2rgb;\n","import { unpack, TWOPI } from '../../utils/index.js';\nconst { min, sqrt, acos } = Math;\n\nconst rgb2hsi = (...args) => {\n /*\n borrowed from here:\n http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp\n */\n let [r, g, b] = unpack(args, 'rgb');\n r /= 255;\n g /= 255;\n b /= 255;\n let h;\n const min_ = min(r, g, b);\n const i = (r + g + b) / 3;\n const s = i > 0 ? 1 - min_ / i : 0;\n if (s === 0) {\n h = NaN;\n } else {\n h = (r - g + (r - b)) / 2;\n h /= sqrt((r - g) * (r - g) + (r - b) * (g - b));\n h = acos(h);\n if (b > g) {\n h = TWOPI - h;\n }\n h /= TWOPI;\n }\n return [h * 360, s, i];\n};\n\nexport default rgb2hsi;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport hsi2rgb from './hsi2rgb.js';\nimport rgb2hsi from './rgb2hsi.js';\n\nColor.prototype.hsi = function () {\n return rgb2hsi(this._rgb);\n};\n\nconst hsi = (...args) => new Color(...args, 'hsi');\nchroma.hsi = hsi;\n\ninput.format.hsi = hsi2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'hsi');\n if (type(args) === 'array' && args.length === 3) {\n return 'hsi';\n }\n }\n});\n\nexport { hsi };\n","import '../io/hsi/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst hsi = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'hsi');\n};\n\n// register interpolator\nindex.hsi = hsi;\n\nexport default hsi;\n","import { unpack } from '../../utils/index.js';\n\nconst hsl2rgb = (...args) => {\n args = unpack(args, 'hsl');\n const [h, s, l] = args;\n let r, g, b;\n if (s === 0) {\n r = g = b = l * 255;\n } else {\n const t3 = [0, 0, 0];\n const c = [0, 0, 0];\n const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const t1 = 2 * l - t2;\n const h_ = h / 360;\n t3[0] = h_ + 1 / 3;\n t3[1] = h_;\n t3[2] = h_ - 1 / 3;\n for (let i = 0; i < 3; i++) {\n if (t3[i] < 0) t3[i] += 1;\n if (t3[i] > 1) t3[i] -= 1;\n if (6 * t3[i] < 1) c[i] = t1 + (t2 - t1) * 6 * t3[i];\n else if (2 * t3[i] < 1) c[i] = t2;\n else if (3 * t3[i] < 2) c[i] = t1 + (t2 - t1) * (2 / 3 - t3[i]) * 6;\n else c[i] = t1;\n }\n [r, g, b] = [c[0] * 255, c[1] * 255, c[2] * 255];\n }\n if (args.length > 3) {\n // keep alpha channel\n return [r, g, b, args[3]];\n }\n return [r, g, b, 1];\n};\n\nexport default hsl2rgb;\n","import { unpack, min, max } from '../../utils/index.js';\n\n/*\n * supported arguments:\n * - rgb2hsl(r,g,b)\n * - rgb2hsl(r,g,b,a)\n * - rgb2hsl([r,g,b])\n * - rgb2hsl([r,g,b,a])\n * - rgb2hsl({r,g,b,a})\n */\nconst rgb2hsl = (...args) => {\n args = unpack(args, 'rgba');\n let [r, g, b] = args;\n\n r /= 255;\n g /= 255;\n b /= 255;\n\n const minRgb = min(r, g, b);\n const maxRgb = max(r, g, b);\n\n const l = (maxRgb + minRgb) / 2;\n let s, h;\n\n if (maxRgb === minRgb) {\n s = 0;\n h = Number.NaN;\n } else {\n s =\n l < 0.5\n ? (maxRgb - minRgb) / (maxRgb + minRgb)\n : (maxRgb - minRgb) / (2 - maxRgb - minRgb);\n }\n\n if (r == maxRgb) h = (g - b) / (maxRgb - minRgb);\n else if (g == maxRgb) h = 2 + (b - r) / (maxRgb - minRgb);\n else if (b == maxRgb) h = 4 + (r - g) / (maxRgb - minRgb);\n\n h *= 60;\n if (h < 0) h += 360;\n if (args.length > 3 && args[3] !== undefined) return [h, s, l, args[3]];\n return [h, s, l];\n};\n\nexport default rgb2hsl;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport hsl2rgb from './hsl2rgb.js';\nimport rgb2hsl from './rgb2hsl.js';\n\nColor.prototype.hsl = function () {\n return rgb2hsl(this._rgb);\n};\n\nconst hsl = (...args) => new Color(...args, 'hsl');\nchroma.hsl = hsl;\n\ninput.format.hsl = hsl2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'hsl');\n if (type(args) === 'array' && args.length === 3) {\n return 'hsl';\n }\n }\n});\n\nexport { hsl };\n","import '../io/hsl/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst hsl = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'hsl');\n};\n\n// register interpolator\nindex.hsl = hsl;\n\nexport default hsl;\n","import { unpack } from '../../utils/index.js';\nconst { floor } = Math;\n\nconst hsv2rgb = (...args) => {\n args = unpack(args, 'hsv');\n let [h, s, v] = args;\n let r, g, b;\n v *= 255;\n if (s === 0) {\n r = g = b = v;\n } else {\n if (h === 360) h = 0;\n if (h > 360) h -= 360;\n if (h < 0) h += 360;\n h /= 60;\n\n const i = floor(h);\n const f = h - i;\n const p = v * (1 - s);\n const q = v * (1 - s * f);\n const t = v * (1 - s * (1 - f));\n\n switch (i) {\n case 0:\n [r, g, b] = [v, t, p];\n break;\n case 1:\n [r, g, b] = [q, v, p];\n break;\n case 2:\n [r, g, b] = [p, v, t];\n break;\n case 3:\n [r, g, b] = [p, q, v];\n break;\n case 4:\n [r, g, b] = [t, p, v];\n break;\n case 5:\n [r, g, b] = [v, p, q];\n break;\n }\n }\n return [r, g, b, args.length > 3 ? args[3] : 1];\n};\n\nexport default hsv2rgb;\n","import { unpack } from '../../utils/index.js';\nconst { min, max } = Math;\n\n/*\n * supported arguments:\n * - rgb2hsv(r,g,b)\n * - rgb2hsv([r,g,b])\n * - rgb2hsv({r,g,b})\n */\nconst rgb2hsl = (...args) => {\n args = unpack(args, 'rgb');\n let [r, g, b] = args;\n const min_ = min(r, g, b);\n const max_ = max(r, g, b);\n const delta = max_ - min_;\n let h, s, v;\n v = max_ / 255.0;\n if (max_ === 0) {\n h = Number.NaN;\n s = 0;\n } else {\n s = delta / max_;\n if (r === max_) h = (g - b) / delta;\n if (g === max_) h = 2 + (b - r) / delta;\n if (b === max_) h = 4 + (r - g) / delta;\n h *= 60;\n if (h < 0) h += 360;\n }\n return [h, s, v];\n};\n\nexport default rgb2hsl;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport hsv2rgb from './hsv2rgb.js';\nimport rgb2hsv from './rgb2hsv.js';\n\nColor.prototype.hsv = function () {\n return rgb2hsv(this._rgb);\n};\n\nconst hsv = (...args) => new Color(...args, 'hsv');\nchroma.hsv = hsv;\n\ninput.format.hsv = hsv2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'hsv');\n if (type(args) === 'array' && args.length === 3) {\n return 'hsv';\n }\n }\n});\n\nexport { hsv };\n","// from https://www.w3.org/TR/css-color-4/multiply-matrices.js\nexport default function multiplyMatrices(A, B) {\n let m = A.length;\n\n if (!Array.isArray(A[0])) {\n // A is vector, convert to [[a, b, c, ...]]\n A = [A];\n }\n\n if (!Array.isArray(B[0])) {\n // B is vector, convert to [[a], [b], [c], ...]]\n B = B.map((x) => [x]);\n }\n\n let p = B[0].length;\n let B_cols = B[0].map((_, i) => B.map((x) => x[i])); // transpose B\n let product = A.map((row) =>\n B_cols.map((col) => {\n if (!Array.isArray(row)) {\n return col.reduce((a, c) => a + c * row, 0);\n }\n\n return row.reduce((a, c, i) => a + c * (col[i] || 0), 0);\n })\n );\n\n if (m === 1) {\n product = product[0]; // Avoid [[a, b, c, ...]]\n }\n\n if (p === 1) {\n return product.map((x) => x[0]); // Avoid [[a], [b], [c], ...]]\n }\n\n return product;\n}\n","import '../io/hsv/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst hsv = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'hsv');\n};\n\n// register interpolator\nindex.hsv = hsv;\n\nexport default hsv;\n","import { unpack } from '../../utils/index.js';\nimport multiplyMatrices from '../../utils/multiply-matrices.js';\nimport { xyz2rgb } from '../lab/lab2rgb.js';\n\nconst oklab2rgb = (...args) => {\n args = unpack(args, 'lab');\n const [L, a, b, ...rest] = args;\n const [X, Y, Z] = OKLab_to_XYZ([L, a, b]);\n const [r, g, b_] = xyz2rgb(X, Y, Z);\n return [r, g, b_, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\n// from https://www.w3.org/TR/css-color-4/#color-conversion-code\nfunction OKLab_to_XYZ(OKLab) {\n // Given OKLab, convert to XYZ relative to D65\n var LMStoXYZ = [\n [1.2268798758459243, -0.5578149944602171, 0.2813910456659647],\n [-0.0405757452148008, 1.112286803280317, -0.0717110580655164],\n [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816]\n ];\n var OKLabtoLMS = [\n [1.0, 0.3963377773761749, 0.2158037573099136],\n [1.0, -0.1055613458156586, -0.0638541728258133],\n [1.0, -0.0894841775298119, -1.2914855480194092]\n ];\n\n var LMSnl = multiplyMatrices(OKLabtoLMS, OKLab);\n return multiplyMatrices(\n LMStoXYZ,\n LMSnl.map((c) => c ** 3)\n );\n}\n\nexport default oklab2rgb;\n","import { unpack } from '../../utils/index.js';\nimport multiplyMatrices from '../../utils/multiply-matrices.js';\nimport { rgb2xyz } from '../lab/rgb2lab.js';\n\nconst rgb2oklab = (...args) => {\n const [r, g, b, ...rest] = unpack(args, 'rgb');\n const xyz = rgb2xyz(r, g, b);\n const oklab = XYZ_to_OKLab(xyz);\n return [...oklab, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\n// from https://www.w3.org/TR/css-color-4/#color-conversion-code\nfunction XYZ_to_OKLab(XYZ) {\n // Given XYZ relative to D65, convert to OKLab\n const XYZtoLMS = [\n [0.819022437996703, 0.3619062600528904, -0.1288737815209879],\n [0.0329836539323885, 0.9292868615863434, 0.0361446663506424],\n [0.0481771893596242, 0.2642395317527308, 0.6335478284694309]\n ];\n const LMStoOKLab = [\n [0.210454268309314, 0.7936177747023054, -0.0040720430116193],\n [1.9779985324311684, -2.4285922420485799, 0.450593709617411],\n [0.0259040424655478, 0.7827717124575296, -0.8086757549230774]\n ];\n\n const LMS = multiplyMatrices(XYZtoLMS, XYZ);\n // JavaScript Math.cbrt returns a sign-matched cube root\n // beware if porting to other languages\n // especially if tempted to use a general power function\n return multiplyMatrices(\n LMStoOKLab,\n LMS.map((c) => Math.cbrt(c))\n );\n // L in range [0,1]. For use in CSS, multiply by 100 and add a percent\n}\n\nexport default rgb2oklab;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport oklab2rgb from './oklab2rgb.js';\nimport rgb2oklab from './rgb2oklab.js';\n\nColor.prototype.oklab = function () {\n return rgb2oklab(this._rgb);\n};\n\nconst oklab = (...args) => new Color(...args, 'oklab');\nObject.assign(chroma, { oklab });\n\ninput.format.oklab = oklab2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'oklab');\n if (type(args) === 'array' && args.length === 3) {\n return 'oklab';\n }\n }\n});\n\nexport { oklab };\n","import '../io/oklab/index.js';\nimport index from './index.js';\nimport Color from '../Color.js';\n\nconst oklab = (col1, col2, f) => {\n const xyz0 = col1.oklab();\n const xyz1 = col2.oklab();\n return new Color(\n xyz0[0] + f * (xyz1[0] - xyz0[0]),\n xyz0[1] + f * (xyz1[1] - xyz0[1]),\n xyz0[2] + f * (xyz1[2] - xyz0[2]),\n 'oklab'\n );\n};\n\n// register interpolator\nindex.oklab = oklab;\n\nexport default oklab;\n","import '../io/lch/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst oklch = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'oklch');\n};\n\n// register interpolator\nindex.oklch = oklch;\n\nexport default oklch;\n","import Color from '../Color.js';\nimport { clip_rgb } from '../utils/index.js';\n\nconst { pow, sqrt, PI, cos, sin, atan2 } = Math;\n\nexport default (colors, mode = 'lrgb', weights = null) => {\n const l = colors.length;\n if (!weights) weights = Array.from(new Array(l)).map(() => 1);\n // normalize weights\n const k =\n l /\n weights.reduce(function (a, b) {\n return a + b;\n });\n weights.forEach((w, i) => {\n weights[i] *= k;\n });\n // convert colors to Color objects\n colors = colors.map((c) => new Color(c));\n if (mode === 'lrgb') {\n return _average_lrgb(colors, weights);\n }\n const first = colors.shift();\n const xyz = first.get(mode);\n const cnt = [];\n let dx = 0;\n let dy = 0;\n // initial color\n for (let i = 0; i < xyz.length; i++) {\n xyz[i] = (xyz[i] || 0) * weights[0];\n cnt.push(isNaN(xyz[i]) ? 0 : weights[0]);\n if (mode.charAt(i) === 'h' && !isNaN(xyz[i])) {\n const A = (xyz[i] / 180) * PI;\n dx += cos(A) * weights[0];\n dy += sin(A) * weights[0];\n }\n }\n\n let alpha = first.alpha() * weights[0];\n colors.forEach((c, ci) => {\n const xyz2 = c.get(mode);\n alpha += c.alpha() * weights[ci + 1];\n for (let i = 0; i < xyz.length; i++) {\n if (!isNaN(xyz2[i])) {\n cnt[i] += weights[ci + 1];\n if (mode.charAt(i) === 'h') {\n const A = (xyz2[i] / 180) * PI;\n dx += cos(A) * weights[ci + 1];\n dy += sin(A) * weights[ci + 1];\n } else {\n xyz[i] += xyz2[i] * weights[ci + 1];\n }\n }\n }\n });\n\n for (let i = 0; i < xyz.length; i++) {\n if (mode.charAt(i) === 'h') {\n let A = (atan2(dy / cnt[i], dx / cnt[i]) / PI) * 180;\n while (A < 0) A += 360;\n while (A >= 360) A -= 360;\n xyz[i] = A;\n } else {\n xyz[i] = xyz[i] / cnt[i];\n }\n }\n alpha /= l;\n return new Color(xyz, mode).alpha(alpha > 0.99999 ? 1 : alpha, true);\n};\n\nconst _average_lrgb = (colors, weights) => {\n const l = colors.length;\n const xyz = [0, 0, 0, 0];\n for (let i = 0; i < colors.length; i++) {\n const col = colors[i];\n const f = weights[i] / l;\n const rgb = col._rgb;\n xyz[0] += pow(rgb[0], 2) * f;\n xyz[1] += pow(rgb[1], 2) * f;\n xyz[2] += pow(rgb[2], 2) * f;\n xyz[3] += rgb[3] * f;\n }\n xyz[0] = sqrt(xyz[0]);\n xyz[1] = sqrt(xyz[1]);\n xyz[2] = sqrt(xyz[2]);\n if (xyz[3] > 0.9999999) xyz[3] = 1;\n return new Color(clip_rgb(xyz));\n};\n","// minimal multi-purpose interface\n\n// @requires utils color analyze\nimport chroma from '../chroma.js';\nimport { limit, type } from '../utils/index.js';\n\nconst { pow } = Math;\n\nexport default function (colors) {\n // constructor\n let _mode = 'rgb';\n let _nacol = chroma('#ccc');\n let _spread = 0;\n // const _fixed = false;\n let _positions = [0, 1];\n let _domain = [0, 1];\n let _pos = [];\n let _padding = [0, 0];\n let _classes = false;\n let _colors = [];\n let _out = false;\n let _min = 0;\n let _max = 1;\n let _correctLightness = false;\n let _colorCache = {};\n let _useCache = true;\n let _gamma = 1;\n\n // private methods\n\n const setColors = function (colors) {\n colors = colors || ['#fff', '#000'];\n if (\n colors &&\n type(colors) === 'string' &&\n chroma.brewer &&\n chroma.brewer[colors.toLowerCase()]\n ) {\n colors = chroma.brewer[colors.toLowerCase()];\n }\n if (type(colors) === 'array') {\n // handle single color\n if (colors.length === 1) {\n colors = [colors[0], colors[0]];\n }\n // make a copy of the colors\n colors = colors.slice(0);\n // convert to chroma classes\n for (let c = 0; c < colors.length; c++) {\n colors[c] = chroma(colors[c]);\n }\n // auto-fill color position\n _pos.length = 0;\n for (let c = 0; c < colors.length; c++) {\n _pos.push(c / (colors.length - 1));\n }\n }\n resetCache();\n return (_colors = colors);\n };\n\n const getClass = function (value) {\n if (_classes != null) {\n const n = _classes.length - 1;\n let i = 0;\n while (i < n && value >= _classes[i]) {\n i++;\n }\n return i - 1;\n }\n return 0;\n };\n\n let tMapLightness = (t) => t;\n let tMapDomain = (t) => t;\n\n // const classifyValue = function(value) {\n // let val = value;\n // if (_classes.length > 2) {\n // const n = _classes.length-1;\n // const i = getClass(value);\n // const minc = _classes[0] + ((_classes[1]-_classes[0]) * (0 + (_spread * 0.5))); // center of 1st class\n // const maxc = _classes[n-1] + ((_classes[n]-_classes[n-1]) * (1 - (_spread * 0.5))); // center of last class\n // val = _min + ((((_classes[i] + ((_classes[i+1] - _classes[i]) * 0.5)) - minc) / (maxc-minc)) * (_max - _min));\n // }\n // return val;\n // };\n\n const getColor = function (val, bypassMap) {\n let col, t;\n if (bypassMap == null) {\n bypassMap = false;\n }\n if (isNaN(val) || val === null) {\n return _nacol;\n }\n if (!bypassMap) {\n if (_classes && _classes.length > 2) {\n // find the class\n const c = getClass(val);\n t = c / (_classes.length - 2);\n } else if (_max !== _min) {\n // just interpolate between min/max\n t = (val - _min) / (_max - _min);\n } else {\n t = 1;\n }\n } else {\n t = val;\n }\n\n // domain map\n t = tMapDomain(t);\n\n if (!bypassMap) {\n t = tMapLightness(t); // lightness correction\n }\n\n if (_gamma !== 1) {\n t = pow(t, _gamma);\n }\n\n t = _padding[0] + t * (1 - _padding[0] - _padding[1]);\n\n t = limit(t, 0, 1);\n\n const k = Math.floor(t * 10000);\n\n if (_useCache && _colorCache[k]) {\n col = _colorCache[k];\n } else {\n if (type(_colors) === 'array') {\n //for i in [0.._pos.length-1]\n for (let i = 0; i < _pos.length; i++) {\n const p = _pos[i];\n if (t <= p) {\n col = _colors[i];\n break;\n }\n if (t >= p && i === _pos.length - 1) {\n col = _colors[i];\n break;\n }\n if (t > p && t < _pos[i + 1]) {\n t = (t - p) / (_pos[i + 1] - p);\n col = chroma.interpolate(\n _colors[i],\n _colors[i + 1],\n t,\n _mode\n );\n break;\n }\n }\n } else if (type(_colors) === 'function') {\n col = _colors(t);\n }\n if (_useCache) {\n _colorCache[k] = col;\n }\n }\n return col;\n };\n\n var resetCache = () => (_colorCache = {});\n\n setColors(colors);\n\n // public interface\n\n const f = function (v) {\n const c = chroma(getColor(v));\n if (_out && c[_out]) {\n return c[_out]();\n } else {\n return c;\n }\n };\n\n f.classes = function (classes) {\n if (classes != null) {\n if (type(classes) === 'array') {\n _classes = classes;\n _positions = [classes[0], classes[classes.length - 1]];\n } else {\n const d = chroma.analyze(_positions);\n if (classes === 0) {\n _classes = [d.min, d.max];\n } else {\n _classes = chroma.limits(d, 'e', classes);\n }\n }\n return f;\n }\n return _classes;\n };\n\n f.domain = function (domain) {\n if (!arguments.length) {\n // return original domain\n return _domain;\n }\n // store original domain so we can return it later\n _domain = domain.slice(0);\n _min = domain[0];\n _max = domain[domain.length - 1];\n _pos = [];\n const k = _colors.length;\n if (domain.length === k && _min !== _max) {\n // update positions\n for (let d of Array.from(domain)) {\n _pos.push((d - _min) / (_max - _min));\n }\n } else {\n for (let c = 0; c < k; c++) {\n _pos.push(c / (k - 1));\n }\n if (domain.length > 2) {\n // set domain map\n const tOut = domain.map((d, i) => i / (domain.length - 1));\n const tBreaks = domain.map((d) => (d - _min) / (_max - _min));\n if (!tBreaks.every((val, i) => tOut[i] === val)) {\n tMapDomain = (t) => {\n if (t <= 0 || t >= 1) return t;\n let i = 0;\n while (t >= tBreaks[i + 1]) i++;\n const f =\n (t - tBreaks[i]) / (tBreaks[i + 1] - tBreaks[i]);\n const out = tOut[i] + f * (tOut[i + 1] - tOut[i]);\n return out;\n };\n }\n }\n }\n _positions = [_min, _max];\n return f;\n };\n\n f.mode = function (_m) {\n if (!arguments.length) {\n return _mode;\n }\n _mode = _m;\n resetCache();\n return f;\n };\n\n f.range = function (colors, _pos) {\n setColors(colors, _pos);\n return f;\n };\n\n f.out = function (_o) {\n _out = _o;\n return f;\n };\n\n f.spread = function (val) {\n if (!arguments.length) {\n return _spread;\n }\n _spread = val;\n return f;\n };\n\n f.correctLightness = function (v) {\n if (v == null) {\n v = true;\n }\n _correctLightness = v;\n resetCache();\n if (_correctLightness) {\n tMapLightness = function (t) {\n const L0 = getColor(0, true).lab()[0];\n const L1 = getColor(1, true).lab()[0];\n const pol = L0 > L1;\n let L_actual = getColor(t, true).lab()[0];\n const L_ideal = L0 + (L1 - L0) * t;\n let L_diff = L_actual - L_ideal;\n let t0 = 0;\n let t1 = 1;\n let max_iter = 20;\n while (Math.abs(L_diff) > 1e-2 && max_iter-- > 0) {\n (function () {\n if (pol) {\n L_diff *= -1;\n }\n if (L_diff < 0) {\n t0 = t;\n t += (t1 - t) * 0.5;\n } else {\n t1 = t;\n t += (t0 - t) * 0.5;\n }\n L_actual = getColor(t, true).lab()[0];\n return (L_diff = L_actual - L_ideal);\n })();\n }\n return t;\n };\n } else {\n tMapLightness = (t) => t;\n }\n return f;\n };\n\n f.padding = function (p) {\n if (p != null) {\n if (type(p) === 'number') {\n p = [p, p];\n }\n _padding = p;\n return f;\n } else {\n return _padding;\n }\n };\n\n f.colors = function (numColors, out) {\n // If no arguments are given, return the original colors that were provided\n if (arguments.length < 2) {\n out = 'hex';\n }\n let result = [];\n\n if (arguments.length === 0) {\n result = _colors.slice(0);\n } else if (numColors === 1) {\n result = [f(0.5)];\n } else if (numColors > 1) {\n const dm = _positions[0];\n const dd = _positions[1] - dm;\n result = __range__(0, numColors, false).map((i) =>\n f(dm + (i / (numColors - 1)) * dd)\n );\n } else {\n // returns all colors based on the defined classes\n colors = [];\n let samples = [];\n if (_classes && _classes.length > 2) {\n for (\n let i = 1, end = _classes.length, asc = 1 <= end;\n asc ? i < end : i > end;\n asc ? i++ : i--\n ) {\n samples.push((_classes[i - 1] + _classes[i]) * 0.5);\n }\n } else {\n samples = _positions;\n }\n result = samples.map((v) => f(v));\n }\n\n if (chroma[out]) {\n result = result.map((c) => c[out]());\n }\n return result;\n };\n\n f.cache = function (c) {\n if (c != null) {\n _useCache = c;\n return f;\n } else {\n return _useCache;\n }\n };\n\n f.gamma = function (g) {\n if (g != null) {\n _gamma = g;\n return f;\n } else {\n return _gamma;\n }\n };\n\n f.nodata = function (d) {\n if (d != null) {\n _nacol = chroma(d);\n return f;\n } else {\n return _nacol;\n }\n };\n\n return f;\n}\n\nfunction __range__(left, right, inclusive) {\n let range = [];\n let ascending = left < right;\n let end = !inclusive ? right : ascending ? right + 1 : right - 1;\n for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {\n range.push(i);\n }\n return range;\n}\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport { unpack, type } from '../../utils/index.js';\nconst { round } = Math;\n\nColor.prototype.rgb = function (rnd = true) {\n if (rnd === false) return this._rgb.slice(0, 3);\n return this._rgb.slice(0, 3).map(round);\n};\n\nColor.prototype.rgba = function (rnd = true) {\n return this._rgb.slice(0, 4).map((v, i) => {\n return i < 3 ? (rnd === false ? v : round(v)) : v;\n });\n};\n\nconst rgb = (...args) => new Color(...args, 'rgb');\nObject.assign(chroma, { rgb });\n\ninput.format.rgb = (...args) => {\n const rgba = unpack(args, 'rgba');\n if (rgba[3] === undefined) rgba[3] = 1;\n return rgba;\n};\n\ninput.autodetect.push({\n p: 3,\n test: (...args) => {\n args = unpack(args, 'rgba');\n if (\n type(args) === 'array' &&\n (args.length === 3 ||\n (args.length === 4 &&\n type(args[3]) == 'number' &&\n args[3] >= 0 &&\n args[3] <= 1))\n ) {\n return 'rgb';\n }\n }\n});\n\nexport { rgb };\n","/*\n * interpolates between a set of colors uzing a bezier spline\n * blend mode formulas taken from https://web.archive.org/web/20180110014946/http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/\n */\n\nimport '../io/rgb/index.js';\nimport chroma from '../chroma.js';\n\nconst blend = (bottom, top, mode) => {\n if (!blend[mode]) {\n throw new Error('unknown blend mode ' + mode);\n }\n return blend[mode](bottom, top);\n};\n\nconst blend_f = (f) => (bottom, top) => {\n const c0 = chroma(top).rgb();\n const c1 = chroma(bottom).rgb();\n return chroma.rgb(f(c0, c1));\n};\n\nconst each = (f) => (c0, c1) => {\n const out = [];\n out[0] = f(c0[0], c1[0]);\n out[1] = f(c0[1], c1[1]);\n out[2] = f(c0[2], c1[2]);\n return out;\n};\n\nconst normal = (a) => a;\nconst multiply = (a, b) => (a * b) / 255;\nconst darken = (a, b) => (a > b ? b : a);\nconst lighten = (a, b) => (a > b ? a : b);\nconst screen = (a, b) => 255 * (1 - (1 - a / 255) * (1 - b / 255));\nconst overlay = (a, b) =>\n b < 128 ? (2 * a * b) / 255 : 255 * (1 - 2 * (1 - a / 255) * (1 - b / 255));\nconst burn = (a, b) => 255 * (1 - (1 - b / 255) / (a / 255));\nconst dodge = (a, b) => {\n if (a === 255) return 255;\n a = (255 * (b / 255)) / (1 - a / 255);\n return a > 255 ? 255 : a;\n};\n\n// # add = (a,b) ->\n// # if (a + b > 255) then 255 else a + b\n\nblend.normal = blend_f(each(normal));\nblend.multiply = blend_f(each(multiply));\nblend.screen = blend_f(each(screen));\nblend.overlay = blend_f(each(overlay));\nblend.darken = blend_f(each(darken));\nblend.lighten = blend_f(each(lighten));\nblend.dodge = blend_f(each(dodge));\nblend.burn = blend_f(each(burn));\n// blend.add = blend_f(each(add));\n\nexport default blend;\n","// cubehelix interpolation\n// based on D.A. Green \"A colour scheme for the display of astronomical intensity images\"\n// http://astron-soc.in/bulletin/11June/289392011.pdf\nimport { type, clip_rgb, TWOPI } from '../utils/index.js';\nimport chroma from '../chroma.js';\nconst { pow, sin, cos } = Math;\n\nexport default function (\n start = 300,\n rotations = -1.5,\n hue = 1,\n gamma = 1,\n lightness = [0, 1]\n) {\n let dh = 0,\n dl;\n if (type(lightness) === 'array') {\n dl = lightness[1] - lightness[0];\n } else {\n dl = 0;\n lightness = [lightness, lightness];\n }\n const f = function (fract) {\n const a = TWOPI * ((start + 120) / 360 + rotations * fract);\n const l = pow(lightness[0] + dl * fract, gamma);\n const h = dh !== 0 ? hue[0] + fract * dh : hue;\n const amp = (h * l * (1 - l)) / 2;\n const cos_a = cos(a);\n const sin_a = sin(a);\n const r = l + amp * (-0.14861 * cos_a + 1.78277 * sin_a);\n const g = l + amp * (-0.29227 * cos_a - 0.90649 * sin_a);\n const b = l + amp * (+1.97294 * cos_a);\n return chroma(clip_rgb([r * 255, g * 255, b * 255, 1]));\n };\n f.start = function (s) {\n if (s == null) {\n return start;\n }\n start = s;\n return f;\n };\n f.rotations = function (r) {\n if (r == null) {\n return rotations;\n }\n rotations = r;\n return f;\n };\n f.gamma = function (g) {\n if (g == null) {\n return gamma;\n }\n gamma = g;\n return f;\n };\n f.hue = function (h) {\n if (h == null) {\n return hue;\n }\n hue = h;\n if (type(hue) === 'array') {\n dh = hue[1] - hue[0];\n if (dh === 0) {\n hue = hue[1];\n }\n } else {\n dh = 0;\n }\n return f;\n };\n f.lightness = function (h) {\n if (h == null) {\n return lightness;\n }\n if (type(h) === 'array') {\n lightness = h;\n dl = h[1] - h[0];\n } else {\n lightness = [h, h];\n dl = 0;\n }\n return f;\n };\n f.scale = () => chroma.scale(f);\n f.hue(hue);\n return f;\n}\n","import Color from '../Color.js';\nconst digits = '0123456789abcdef';\n\nconst { floor, random } = Math;\n\n/**\n * Generates a random color.\n * @param {() => number} rng - A random number generator function.\n */\nexport default (rng = random) => {\n let code = '#';\n for (let i = 0; i < 6; i++) {\n code += digits.charAt(floor(rng() * 16));\n }\n return new Color(code, 'hex');\n};\n","import type from './type.js';\n\nconst { log, pow, floor, abs } = Math;\n\nexport function analyze(data, key = null) {\n const r = {\n min: Number.MAX_VALUE,\n max: Number.MAX_VALUE * -1,\n sum: 0,\n values: [],\n count: 0\n };\n if (type(data) === 'object') {\n data = Object.values(data);\n }\n data.forEach((val) => {\n if (key && type(val) === 'object') val = val[key];\n if (val !== undefined && val !== null && !isNaN(val)) {\n r.values.push(val);\n r.sum += val;\n if (val < r.min) r.min = val;\n if (val > r.max) r.max = val;\n r.count += 1;\n }\n });\n\n r.domain = [r.min, r.max];\n\n r.limits = (mode, num) => limits(r, mode, num);\n\n return r;\n}\n\nexport function limits(data, mode = 'equal', num = 7) {\n if (type(data) == 'array') {\n data = analyze(data);\n }\n const { min, max } = data;\n const values = data.values.sort((a, b) => a - b);\n\n if (num === 1) {\n return [min, max];\n }\n\n const limits = [];\n\n if (mode.substr(0, 1) === 'c') {\n // continuous\n limits.push(min);\n limits.push(max);\n }\n\n if (mode.substr(0, 1) === 'e') {\n // equal interval\n limits.push(min);\n for (let i = 1; i < num; i++) {\n limits.push(min + (i / num) * (max - min));\n }\n limits.push(max);\n } else if (mode.substr(0, 1) === 'l') {\n // log scale\n if (min <= 0) {\n throw new Error(\n 'Logarithmic scales are only possible for values > 0'\n );\n }\n const min_log = Math.LOG10E * log(min);\n const max_log = Math.LOG10E * log(max);\n limits.push(min);\n for (let i = 1; i < num; i++) {\n limits.push(pow(10, min_log + (i / num) * (max_log - min_log)));\n }\n limits.push(max);\n } else if (mode.substr(0, 1) === 'q') {\n // quantile scale\n limits.push(min);\n for (let i = 1; i < num; i++) {\n const p = ((values.length - 1) * i) / num;\n const pb = floor(p);\n if (pb === p) {\n limits.push(values[pb]);\n } else {\n // p > pb\n const pr = p - pb;\n limits.push(values[pb] * (1 - pr) + values[pb + 1] * pr);\n }\n }\n limits.push(max);\n } else if (mode.substr(0, 1) === 'k') {\n // k-means clustering\n /*\n implementation based on\n http://code.google.com/p/figue/source/browse/trunk/figue.js#336\n simplified for 1-d input values\n */\n let cluster;\n const n = values.length;\n const assignments = new Array(n);\n const clusterSizes = new Array(num);\n let repeat = true;\n let nb_iters = 0;\n let centroids = null;\n\n // get seed values\n centroids = [];\n centroids.push(min);\n for (let i = 1; i < num; i++) {\n centroids.push(min + (i / num) * (max - min));\n }\n centroids.push(max);\n\n while (repeat) {\n // assignment step\n for (let j = 0; j < num; j++) {\n clusterSizes[j] = 0;\n }\n for (let i = 0; i < n; i++) {\n const value = values[i];\n let mindist = Number.MAX_VALUE;\n let best;\n for (let j = 0; j < num; j++) {\n const dist = abs(centroids[j] - value);\n if (dist < mindist) {\n mindist = dist;\n best = j;\n }\n clusterSizes[best]++;\n assignments[i] = best;\n }\n }\n\n // update centroids step\n const newCentroids = new Array(num);\n for (let j = 0; j < num; j++) {\n newCentroids[j] = null;\n }\n for (let i = 0; i < n; i++) {\n cluster = assignments[i];\n if (newCentroids[cluster] === null) {\n newCentroids[cluster] = values[i];\n } else {\n newCentroids[cluster] += values[i];\n }\n }\n for (let j = 0; j < num; j++) {\n newCentroids[j] *= 1 / clusterSizes[j];\n }\n\n // check convergence\n repeat = false;\n for (let j = 0; j < num; j++) {\n if (newCentroids[j] !== centroids[j]) {\n repeat = true;\n break;\n }\n }\n\n centroids = newCentroids;\n nb_iters++;\n\n if (nb_iters > 200) {\n repeat = false;\n }\n }\n\n // finished k-means clustering\n // the next part is borrowed from gabrielflor.it\n const kClusters = {};\n for (let j = 0; j < num; j++) {\n kClusters[j] = [];\n }\n for (let i = 0; i < n; i++) {\n cluster = assignments[i];\n kClusters[cluster].push(values[i]);\n }\n let tmpKMeansBreaks = [];\n for (let j = 0; j < num; j++) {\n tmpKMeansBreaks.push(kClusters[j][0]);\n tmpKMeansBreaks.push(kClusters[j][kClusters[j].length - 1]);\n }\n tmpKMeansBreaks = tmpKMeansBreaks.sort((a, b) => a - b);\n limits.push(tmpKMeansBreaks[0]);\n for (let i = 1; i < tmpKMeansBreaks.length; i += 2) {\n const v = tmpKMeansBreaks[i];\n if (!isNaN(v) && limits.indexOf(v) === -1) {\n limits.push(v);\n }\n }\n }\n return limits;\n}\n","import Color from '../Color.js';\nimport mix from '../generator/mix.js';\n\n/**\n * @license\n *\n * The APCA contrast prediction algorithm is based of the formulas published\n * in the APCA-1.0.98G specification by Myndex. The specification is available at:\n * https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg\n *\n * Note that the APCA implementation is still beta, so please update to\n * future versions of chroma.js when they become available.\n *\n * You can read more about the APCA Readability Criterion at\n * https://readtech.org/ARC/\n */\n\n// constants\nconst W_offset = 0.027;\nconst P_in = 0.0005;\nconst P_out = 0.1;\nconst R_scale = 1.14;\nconst B_threshold = 0.022;\nconst B_exp = 1.414;\n\nexport default (text, bg) => {\n // parse input colors\n text = new Color(text);\n bg = new Color(bg);\n // if text color has alpha, blend against background\n if (text.alpha() < 1) {\n text = mix(bg, text, text.alpha(), 'rgb');\n }\n const l_text = lum(...text.rgb());\n const l_bg = lum(...bg.rgb());\n\n // soft clamp black levels\n const Y_text =\n l_text >= B_threshold\n ? l_text\n : l_text + Math.pow(B_threshold - l_text, B_exp);\n const Y_bg =\n l_bg >= B_threshold ? l_bg : l_bg + Math.pow(B_threshold - l_bg, B_exp);\n\n // normal polarity (dark text on light background)\n const S_norm = Math.pow(Y_bg, 0.56) - Math.pow(Y_text, 0.57);\n // reverse polarity (light text on dark background)\n const S_rev = Math.pow(Y_bg, 0.65) - Math.pow(Y_text, 0.62);\n // clamp noise then scale\n const C =\n Math.abs(Y_bg - Y_text) < P_in\n ? 0\n : Y_text < Y_bg\n ? S_norm * R_scale\n : S_rev * R_scale;\n // clamp minimum contrast then offset\n const S_apc = Math.abs(C) < P_out ? 0 : C > 0 ? C - W_offset : C + W_offset;\n // scale to 100\n return S_apc * 100;\n};\n\nfunction lum(r, g, b) {\n return (\n 0.2126729 * Math.pow(r / 255, 2.4) +\n 0.7151522 * Math.pow(g / 255, 2.4) +\n 0.072175 * Math.pow(b / 255, 2.4)\n );\n}\n","import Color from '../Color.js';\nconst { sqrt, pow, min, max, atan2, abs, cos, sin, exp, PI } = Math;\n\nexport default function (a, b, Kl = 1, Kc = 1, Kh = 1) {\n // Delta E (CIE 2000)\n // see http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE2000.html\n var rad2deg = function (rad) {\n return (360 * rad) / (2 * PI);\n };\n var deg2rad = function (deg) {\n return (2 * PI * deg) / 360;\n };\n a = new Color(a);\n b = new Color(b);\n const [L1, a1, b1] = Array.from(a.lab());\n const [L2, a2, b2] = Array.from(b.lab());\n const avgL = (L1 + L2) / 2;\n const C1 = sqrt(pow(a1, 2) + pow(b1, 2));\n const C2 = sqrt(pow(a2, 2) + pow(b2, 2));\n const avgC = (C1 + C2) / 2;\n const G = 0.5 * (1 - sqrt(pow(avgC, 7) / (pow(avgC, 7) + pow(25, 7))));\n const a1p = a1 * (1 + G);\n const a2p = a2 * (1 + G);\n const C1p = sqrt(pow(a1p, 2) + pow(b1, 2));\n const C2p = sqrt(pow(a2p, 2) + pow(b2, 2));\n const avgCp = (C1p + C2p) / 2;\n const arctan1 = rad2deg(atan2(b1, a1p));\n const arctan2 = rad2deg(atan2(b2, a2p));\n const h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360;\n const h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360;\n const avgHp =\n abs(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h2p) / 2;\n const T =\n 1 -\n 0.17 * cos(deg2rad(avgHp - 30)) +\n 0.24 * cos(deg2rad(2 * avgHp)) +\n 0.32 * cos(deg2rad(3 * avgHp + 6)) -\n 0.2 * cos(deg2rad(4 * avgHp - 63));\n let deltaHp = h2p - h1p;\n deltaHp =\n abs(deltaHp) <= 180\n ? deltaHp\n : h2p <= h1p\n ? deltaHp + 360\n : deltaHp - 360;\n deltaHp = 2 * sqrt(C1p * C2p) * sin(deg2rad(deltaHp) / 2);\n const deltaL = L2 - L1;\n const deltaCp = C2p - C1p;\n const sl = 1 + (0.015 * pow(avgL - 50, 2)) / sqrt(20 + pow(avgL - 50, 2));\n const sc = 1 + 0.045 * avgCp;\n const sh = 1 + 0.015 * avgCp * T;\n const deltaTheta = 30 * exp(-pow((avgHp - 275) / 25, 2));\n const Rc = 2 * sqrt(pow(avgCp, 7) / (pow(avgCp, 7) + pow(25, 7)));\n const Rt = -Rc * sin(2 * deg2rad(deltaTheta));\n const result = sqrt(\n pow(deltaL / (Kl * sl), 2) +\n pow(deltaCp / (Kc * sc), 2) +\n pow(deltaHp / (Kh * sh), 2) +\n Rt * (deltaCp / (Kc * sc)) * (deltaHp / (Kh * sh))\n );\n return max(0, min(100, result));\n}\n","import Color from '../Color.js';\n\nexport default (...args) => {\n try {\n new Color(...args);\n return true;\n // eslint-disable-next-line\n } catch (e) {\n return false;\n }\n};\n","// some pre-defined color scales:\nimport chroma from '../chroma.js';\nimport '../io/hsl/index.js';\nimport scale from '../generator/scale.js';\n\nexport default {\n cool() {\n return scale([chroma.hsl(180, 1, 0.9), chroma.hsl(250, 0.7, 0.4)]);\n },\n hot() {\n return scale(['#000', '#f00', '#ff0', '#fff'], [0, 0.25, 0.75, 1]).mode(\n 'rgb'\n );\n }\n};\n","/**\n ColorBrewer colors for chroma.js\n\n Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The\n Pennsylvania State University.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software distributed\n under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n CONDITIONS OF ANY KIND, either express or implied. See the License for the\n specific language governing permissions and limitations under the License.\n*/\n\nconst colorbrewer = {\n // sequential\n OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],\n PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],\n BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],\n Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],\n BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],\n YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],\n YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],\n Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],\n RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],\n Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],\n YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],\n Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],\n GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],\n Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],\n YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],\n PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],\n Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],\n PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],\n Viridis: ['#440154', '#482777', '#3f4a8a', '#31678e', '#26838f', '#1f9d8a', '#6cce5a', '#b6de2b', '#fee825'],\n\n // diverging\n Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],\n RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],\n RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],\n PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],\n PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],\n RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],\n BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],\n RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],\n PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],\n\n // qualitative\n Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],\n Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],\n Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],\n Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'],\n Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],\n Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],\n Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],\n Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2']\n};\n\nconst colorbrewerTypes = Object.keys(colorbrewer);\nconst typeMap = new Map(colorbrewerTypes.map((key) => [key.toLowerCase(), key]));\n\n// use Proxy to allow case-insensitive access to palettes\nconst colorbrewerProxy =\n typeof Proxy === 'function'\n ? new Proxy(colorbrewer, {\n get(target, prop) {\n const lower = prop.toLowerCase();\n if (typeMap.has(lower)) {\n return target[typeMap.get(lower)];\n }\n },\n getOwnPropertyNames() {\n return Object.getOwnPropertyNames(colorbrewerTypes);\n }\n })\n : colorbrewer;\n\nexport default colorbrewerProxy;\n","import { unpack } from '../../utils/index.js';\nconst { max } = Math;\n\nconst rgb2cmyk = (...args) => {\n let [r, g, b] = unpack(args, 'rgb');\n r = r / 255;\n g = g / 255;\n b = b / 255;\n const k = 1 - max(r, max(g, b));\n const f = k < 1 ? 1 / (1 - k) : 0;\n const c = (1 - r - k) * f;\n const m = (1 - g - k) * f;\n const y = (1 - b - k) * f;\n return [c, m, y, k];\n};\n\nexport default rgb2cmyk;\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport { unpack, type } from '../../utils/index.js';\nimport cmyk2rgb from './cmyk2rgb.js';\nimport rgb2cmyk from './rgb2cmyk.js';\n\nColor.prototype.cmyk = function () {\n return rgb2cmyk(this._rgb);\n};\n\nconst cmyk = (...args) => new Color(...args, 'cmyk');\nObject.assign(chroma, { cmyk });\n\ninput.format.cmyk = cmyk2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'cmyk');\n if (type(args) === 'array' && args.length === 4) {\n return 'cmyk';\n }\n }\n});\n\nexport { cmyk };\n","import { unpack } from '../../utils/index.js';\n\nconst cmyk2rgb = (...args) => {\n args = unpack(args, 'cmyk');\n const [c, m, y, k] = args;\n const alpha = args.length > 4 ? args[4] : 1;\n if (k === 1) return [0, 0, 0, alpha];\n return [\n c >= 1 ? 0 : 255 * (1 - c) * (1 - k), // r\n m >= 1 ? 0 : 255 * (1 - m) * (1 - k), // g\n y >= 1 ? 0 : 255 * (1 - y) * (1 - k), // b\n alpha\n ];\n};\n\nexport default cmyk2rgb;\n","import { unpack, last, rnd2 } from '../../utils/index.js';\n\n/*\n * supported arguments:\n * - hsl2css(h,s,l)\n * - hsl2css(h,s,l,a)\n * - hsl2css([h,s,l], mode)\n * - hsl2css([h,s,l,a], mode)\n * - hsl2css({h,s,l,a}, mode)\n */\nconst hsl2css = (...args) => {\n const hsla = unpack(args, 'hsla');\n let mode = last(args) || 'lsa';\n hsla[0] = rnd2(hsla[0] || 0) + 'deg';\n hsla[1] = rnd2(hsla[1] * 100) + '%';\n hsla[2] = rnd2(hsla[2] * 100) + '%';\n if (mode === 'hsla' || (hsla.length > 3 && hsla[3] < 1)) {\n hsla[3] = '/ ' + (hsla.length > 3 ? hsla[3] : 1);\n mode = 'hsla';\n } else {\n hsla.length = 3;\n }\n return `${mode.substr(0, 3)}(${hsla.join(' ')})`;\n};\n\nexport default hsl2css;\n","import { unpack } from '../../utils/index.js';\nimport rgb2oklab from '../oklab/rgb2oklab.js';\nimport lab2lch from '../lch/lab2lch.js';\n\nconst rgb2oklch = (...args) => {\n const [r, g, b, ...rest] = unpack(args, 'rgb');\n const [l, a, b_] = rgb2oklab(r, g, b);\n const [L, c, h] = lab2lch(l, a, b_);\n return [L, c, h, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\nexport default rgb2oklch;\n","import { unpack, last } from '../../utils/index.js';\nimport hsl2css from './hsl2css.js';\nimport rgb2hsl from '../hsl/rgb2hsl.js';\nimport lab2css from './lab2css.js';\nimport rgb2lab from '../lab/rgb2lab.js';\nimport lch2css from './lch2css.js';\nimport rgb2lch from '../lch/rgb2lch.js';\nimport rgb2oklab from '../oklab/rgb2oklab.js';\nimport oklab2css from './oklab2css.js';\nimport rgb2oklch from '../oklch/rgb2oklch.js';\nimport oklch2css from './oklch2css.js';\nimport { getLabWhitePoint, setLabWhitePoint } from '../lab/lab-constants.js';\nconst { round } = Math;\n\n/*\n * supported arguments:\n * - rgb2css(r,g,b)\n * - rgb2css(r,g,b,a)\n * - rgb2css([r,g,b], mode)\n * - rgb2css([r,g,b,a], mode)\n * - rgb2css({r,g,b,a}, mode)\n */\nconst rgb2css = (...args) => {\n const rgba = unpack(args, 'rgba');\n let mode = last(args) || 'rgb';\n if (mode.substr(0, 3) === 'hsl') {\n return hsl2css(rgb2hsl(rgba), mode);\n }\n if (mode.substr(0, 3) === 'lab') {\n // change to D50 lab whitepoint since this is what W3C is using for CSS Lab colors\n const prevWhitePoint = getLabWhitePoint();\n setLabWhitePoint('d50');\n const cssColor = lab2css(rgb2lab(rgba), mode);\n setLabWhitePoint(prevWhitePoint);\n return cssColor;\n }\n if (mode.substr(0, 3) === 'lch') {\n // change to D50 lab whitepoint since this is what W3C is using for CSS Lab colors\n const prevWhitePoint = getLabWhitePoint();\n setLabWhitePoint('d50');\n const cssColor = lch2css(rgb2lch(rgba), mode);\n setLabWhitePoint(prevWhitePoint);\n return cssColor;\n }\n if (mode.substr(0, 5) === 'oklab') {\n return oklab2css(rgb2oklab(rgba));\n }\n if (mode.substr(0, 5) === 'oklch') {\n return oklch2css(rgb2oklch(rgba));\n }\n rgba[0] = round(rgba[0]);\n rgba[1] = round(rgba[1]);\n rgba[2] = round(rgba[2]);\n if (mode === 'rgba' || (rgba.length > 3 && rgba[3] < 1)) {\n rgba[3] = '/ ' + (rgba.length > 3 ? rgba[3] : 1);\n mode = 'rgba';\n }\n return `${mode.substr(0, 3)}(${rgba.slice(0, mode === 'rgb' ? 3 : 4).join(' ')})`;\n};\n\nexport default rgb2css;\n","import { unpack, last, rnd2 } from '../../utils/index.js';\n\n/*\n * supported arguments:\n * - lab2css(l,a,b)\n * - lab2css(l,a,b,alpha)\n * - lab2css([l,a,b], mode)\n * - lab2css([l,a,b,alpha], mode)\n */\nconst lab2css = (...args) => {\n const laba = unpack(args, 'lab');\n let mode = last(args) || 'lab';\n laba[0] = rnd2(laba[0]) + '%';\n laba[1] = rnd2(laba[1]);\n laba[2] = rnd2(laba[2]);\n if (mode === 'laba' || (laba.length > 3 && laba[3] < 1)) {\n laba[3] = '/ ' + (laba.length > 3 ? laba[3] : 1);\n } else {\n laba.length = 3;\n }\n return `lab(${laba.join(' ')})`;\n};\n\nexport default lab2css;\n","import { unpack, last, rnd2 } from '../../utils/index.js';\n\n/*\n * supported arguments:\n * - lab2css(l,a,b)\n * - lab2css(l,a,b,alpha)\n * - lab2css([l,a,b], mode)\n * - lab2css([l,a,b,alpha], mode)\n */\nconst lch2css = (...args) => {\n const lcha = unpack(args, 'lch');\n let mode = last(args) || 'lab';\n lcha[0] = rnd2(lcha[0]) + '%';\n lcha[1] = rnd2(lcha[1]);\n lcha[2] = isNaN(lcha[2]) ? 'none' : rnd2(lcha[2]) + 'deg'; // add deg unit to hue\n if (mode === 'lcha' || (lcha.length > 3 && lcha[3] < 1)) {\n lcha[3] = '/ ' + (lcha.length > 3 ? lcha[3] : 1);\n } else {\n lcha.length = 3;\n }\n return `lch(${lcha.join(' ')})`;\n};\n\nexport default lch2css;\n","import { unpack, rnd2, rnd3 } from '../../utils/index.js';\n\nconst oklab2css = (...args) => {\n const laba = unpack(args, 'lab');\n laba[0] = rnd2(laba[0] * 100) + '%';\n laba[1] = rnd3(laba[1]);\n laba[2] = rnd3(laba[2]);\n if (laba.length > 3 && laba[3] < 1) {\n laba[3] = '/ ' + (laba.length > 3 ? laba[3] : 1);\n } else {\n laba.length = 3;\n }\n return `oklab(${laba.join(' ')})`;\n};\n\nexport default oklab2css;\n","import { unpack, rnd2, rnd3 } from '../../utils/index.js';\n\nconst oklch2css = (...args) => {\n const lcha = unpack(args, 'lch');\n lcha[0] = rnd2(lcha[0] * 100) + '%';\n lcha[1] = rnd3(lcha[1]);\n lcha[2] = isNaN(lcha[2]) ? 'none' : rnd2(lcha[2]) + 'deg'; // add deg unit to hue\n if (lcha.length > 3 && lcha[3] < 1) {\n lcha[3] = '/ ' + (lcha.length > 3 ? lcha[3] : 1);\n } else {\n lcha.length = 3;\n }\n return `oklch(${lcha.join(' ')})`;\n};\n\nexport default oklch2css;\n","import { unpack } from '../../utils/index.js';\nimport lch2lab from '../lch/lch2lab.js';\nimport oklab2rgb from '../oklab/oklab2rgb.js';\n\nconst oklch2rgb = (...args) => {\n args = unpack(args, 'lch');\n const [l, c, h, ...rest] = args;\n const [L, a, b_] = lch2lab(l, c, h);\n const [r, g, b] = oklab2rgb(L, a, b_);\n return [r, g, b, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\nexport default oklch2rgb;\n","import hsl2rgb from '../hsl/hsl2rgb.js';\nimport lab2rgb from '../lab/lab2rgb.js';\nimport lch2rgb from '../lch/lch2rgb.js';\nimport oklab2rgb from '../oklab/oklab2rgb.js';\nimport oklch2rgb from '../oklch/oklch2rgb.js';\nimport input from '../input.js';\nimport limit from '../../utils/limit.js';\nimport { getLabWhitePoint, setLabWhitePoint } from '../lab/lab-constants.js';\n\nconst INT_OR_PCT = /((?:-?\\d+)|(?:-?\\d+(?:\\.\\d+)?)%|none)/.source;\nconst FLOAT_OR_PCT = /((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)%?)|none)/.source;\nconst PCT = /((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)%)|none)/.source;\nconst RE_S = /\\s*/.source;\nconst SEP = /\\s+/.source;\nconst COMMA = /\\s*,\\s*/.source;\nconst ANLGE = /((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:deg)?)|none)/.source;\nconst ALPHA = /\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?/.source;\n\n// e.g. rgb(250 20 0), rgb(100% 50% 20%), rgb(100% 50% 20% / 0.5)\nconst RE_RGB = new RegExp(\n '^rgba?\\\\(' +\n RE_S +\n [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\nconst RE_RGB_LEGACY = new RegExp(\n '^rgb\\\\(' +\n RE_S +\n [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT].join(COMMA) +\n RE_S +\n '\\\\)$'\n);\nconst RE_RGBA_LEGACY = new RegExp(\n '^rgba\\\\(' +\n RE_S +\n [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT, FLOAT_OR_PCT].join(COMMA) +\n RE_S +\n '\\\\)$'\n);\n\nconst RE_HSL = new RegExp(\n '^hsla?\\\\(' + RE_S + [ANLGE, PCT, PCT].join(SEP) + ALPHA + '\\\\)$'\n);\nconst RE_HSL_LEGACY = new RegExp(\n '^hsl?\\\\(' + RE_S + [ANLGE, PCT, PCT].join(COMMA) + RE_S + '\\\\)$'\n);\nconst RE_HSLA_LEGACY =\n /^hsla\\(\\s*(-?\\d+(?:\\.\\d+)?),\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*([01]|[01]?\\.\\d+)\\)$/;\n\nconst RE_LAB = new RegExp(\n '^lab\\\\(' +\n RE_S +\n [FLOAT_OR_PCT, FLOAT_OR_PCT, FLOAT_OR_PCT].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\nconst RE_LCH = new RegExp(\n '^lch\\\\(' +\n RE_S +\n [FLOAT_OR_PCT, FLOAT_OR_PCT, ANLGE].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\nconst RE_OKLAB = new RegExp(\n '^oklab\\\\(' +\n RE_S +\n [FLOAT_OR_PCT, FLOAT_OR_PCT, FLOAT_OR_PCT].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\nconst RE_OKLCH = new RegExp(\n '^oklch\\\\(' +\n RE_S +\n [FLOAT_OR_PCT, FLOAT_OR_PCT, ANLGE].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\n\nconst { round } = Math;\n\nconst roundRGB = (rgb) => {\n return rgb.map((v, i) => (i <= 2 ? limit(round(v), 0, 255) : v));\n};\n\nconst percentToAbsolute = (pct, min = 0, max = 100, signed = false) => {\n if (typeof pct === 'string' && pct.endsWith('%')) {\n pct = parseFloat(pct.substring(0, pct.length - 1)) / 100;\n if (signed) {\n // signed percentages are in the range -100% to 100%\n pct = min + (pct + 1) * 0.5 * (max - min);\n } else {\n pct = min + pct * (max - min);\n }\n }\n return +pct;\n};\n\nconst noneToValue = (v, noneValue) => {\n return v === 'none' ? noneValue : v;\n};\n\nconst css2rgb = (css) => {\n css = css.toLowerCase().trim();\n\n if (css === 'transparent') {\n return [0, 0, 0, 0];\n }\n\n let m;\n\n if (input.format.named) {\n try {\n return input.format.named(css);\n // eslint-disable-next-line\n } catch (e) {}\n }\n\n // rgb(250 20 0) or rgb(250,20,0)\n if ((m = css.match(RE_RGB)) || (m = css.match(RE_RGB_LEGACY))) {\n let rgb = m.slice(1, 4);\n for (let i = 0; i < 3; i++) {\n rgb[i] = +percentToAbsolute(noneToValue(rgb[i], 0), 0, 255);\n }\n rgb = roundRGB(rgb);\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha; // default alpha\n return rgb;\n }\n\n // rgba(250,20,0,0.4)\n if ((m = css.match(RE_RGBA_LEGACY))) {\n const rgb = m.slice(1, 5);\n for (let i = 0; i < 4; i++) {\n rgb[i] = +percentToAbsolute(rgb[i], 0, 255);\n }\n return rgb;\n }\n\n // hsl(0,100%,50%)\n if ((m = css.match(RE_HSL)) || (m = css.match(RE_HSL_LEGACY))) {\n const hsl = m.slice(1, 4);\n hsl[0] = +noneToValue(hsl[0].replace('deg', ''), 0);\n hsl[1] = +percentToAbsolute(noneToValue(hsl[1], 0), 0, 100) * 0.01;\n hsl[2] = +percentToAbsolute(noneToValue(hsl[2], 0), 0, 100) * 0.01;\n const rgb = roundRGB(hsl2rgb(hsl));\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n\n // hsla(0,100%,50%,0.5)\n if ((m = css.match(RE_HSLA_LEGACY))) {\n const hsl = m.slice(1, 4);\n hsl[1] *= 0.01;\n hsl[2] *= 0.01;\n const rgb = hsl2rgb(hsl);\n for (let i = 0; i < 3; i++) {\n rgb[i] = round(rgb[i]);\n }\n rgb[3] = +m[4]; // default alpha = 1\n return rgb;\n }\n\n if ((m = css.match(RE_LAB))) {\n const lab = m.slice(1, 4);\n lab[0] = percentToAbsolute(noneToValue(lab[0], 0), 0, 100);\n lab[1] = percentToAbsolute(noneToValue(lab[1], 0), -125, 125, true);\n lab[2] = percentToAbsolute(noneToValue(lab[2], 0), -125, 125, true);\n // convert to D50 Lab whitepoint\n const wp = getLabWhitePoint();\n setLabWhitePoint('d50');\n const rgb = roundRGB(lab2rgb(lab));\n // convert back to original Lab whitepoint\n setLabWhitePoint(wp);\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n\n if ((m = css.match(RE_LCH))) {\n const lch = m.slice(1, 4);\n lch[0] = percentToAbsolute(lch[0], 0, 100);\n lch[1] = percentToAbsolute(noneToValue(lch[1], 0), 0, 150, false);\n lch[2] = +noneToValue(lch[2].replace('deg', ''), 0);\n // convert to D50 Lab whitepoint\n const wp = getLabWhitePoint();\n setLabWhitePoint('d50');\n const rgb = roundRGB(lch2rgb(lch));\n // convert back to original Lab whitepoint\n setLabWhitePoint(wp);\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n\n if ((m = css.match(RE_OKLAB))) {\n const oklab = m.slice(1, 4);\n oklab[0] = percentToAbsolute(noneToValue(oklab[0], 0), 0, 1);\n oklab[1] = percentToAbsolute(noneToValue(oklab[1], 0), -0.4, 0.4, true);\n oklab[2] = percentToAbsolute(noneToValue(oklab[2], 0), -0.4, 0.4, true);\n const rgb = roundRGB(oklab2rgb(oklab));\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n\n if ((m = css.match(RE_OKLCH))) {\n const oklch = m.slice(1, 4);\n oklch[0] = percentToAbsolute(noneToValue(oklch[0], 0), 0, 1);\n oklch[1] = percentToAbsolute(noneToValue(oklch[1], 0), 0, 0.4, false);\n oklch[2] = +noneToValue(oklch[2].replace('deg', ''), 0);\n const rgb = roundRGB(oklch2rgb(oklch));\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n};\n\ncss2rgb.test = (s) => {\n return (\n // modern\n RE_RGB.test(s) ||\n RE_HSL.test(s) ||\n RE_LAB.test(s) ||\n RE_LCH.test(s) ||\n RE_OKLAB.test(s) ||\n RE_OKLCH.test(s) ||\n // legacy\n RE_RGB_LEGACY.test(s) ||\n RE_RGBA_LEGACY.test(s) ||\n RE_HSL_LEGACY.test(s) ||\n RE_HSLA_LEGACY.test(s) ||\n s === 'transparent'\n );\n};\n\nexport default css2rgb;\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport { type } from '../../utils/index.js';\n\nimport rgb2css from './rgb2css.js';\nimport css2rgb from './css2rgb.js';\n\nColor.prototype.css = function (mode) {\n return rgb2css(this._rgb, mode);\n};\n\nconst css = (...args) => new Color(...args, 'css');\nchroma.css = css;\n\ninput.format.css = css2rgb;\n\ninput.autodetect.push({\n p: 5,\n test: (h, ...rest) => {\n if (!rest.length && type(h) === 'string' && css2rgb.test(h)) {\n return 'css';\n }\n }\n});\n\nexport { css };\n","import Color from '../../Color.js';\nimport chroma from '../../chroma.js';\nimport input from '../input.js';\nimport { unpack } from '../../utils/index.js';\n\ninput.format.gl = (...args) => {\n const rgb = unpack(args, 'rgba');\n rgb[0] *= 255;\n rgb[1] *= 255;\n rgb[2] *= 255;\n return rgb;\n};\n\nconst gl = (...args) => new Color(...args, 'gl');\nchroma.gl = gl;\n\nColor.prototype.gl = function () {\n const rgb = this._rgb;\n return [rgb[0] / 255, rgb[1] / 255, rgb[2] / 255, rgb[3]];\n};\n\nexport { gl };\n","import Color from '../../Color.js';\nimport chroma from '../../chroma.js';\nimport { type } from '../../utils/index.js';\nimport input from '../input.js';\nimport hex2rgb from './hex2rgb.js';\nimport rgb2hex from './rgb2hex.js';\n\nColor.prototype.hex = function (mode) {\n return rgb2hex(this._rgb, mode);\n};\n\nconst hex = (...args) => new Color(...args, 'hex');\nchroma.hex = hex;\n\ninput.format.hex = hex2rgb;\ninput.autodetect.push({\n p: 4,\n test: (h, ...rest) => {\n if (\n !rest.length &&\n type(h) === 'string' &&\n [3, 4, 5, 6, 7, 8, 9].indexOf(h.length) >= 0\n ) {\n return 'hex';\n }\n }\n});\n\nexport { hex };\n","/*\n * Based on implementation by Neil Bartlett\n * https://github.com/neilbartlett/color-temperature\n */\n\nconst { log } = Math;\n\nconst temperature2rgb = (kelvin) => {\n const temp = kelvin / 100;\n let r, g, b;\n if (temp < 66) {\n r = 255;\n g =\n temp < 6\n ? 0\n : -155.25485562709179 -\n 0.44596950469579133 * (g = temp - 2) +\n 104.49216199393888 * log(g);\n b =\n temp < 20\n ? 0\n : -254.76935184120902 +\n 0.8274096064007395 * (b = temp - 10) +\n 115.67994401066147 * log(b);\n } else {\n r =\n 351.97690566805693 +\n 0.114206453784165 * (r = temp - 55) -\n 40.25366309332127 * log(r);\n g =\n 325.4494125711974 +\n 0.07943456536662342 * (g = temp - 50) -\n 28.0852963507957 * log(g);\n b = 255;\n }\n return [r, g, b, 1];\n};\n\nexport default temperature2rgb;\n","/*\n * Based on implementation by Neil Bartlett\n * https://github.com/neilbartlett/color-temperature\n **/\n\nimport temperature2rgb from './temperature2rgb.js';\nimport { unpack } from '../../utils/index.js';\nconst { round } = Math;\n\nconst rgb2temperature = (...args) => {\n const rgb = unpack(args, 'rgb');\n const r = rgb[0],\n b = rgb[2];\n let minTemp = 1000;\n let maxTemp = 40000;\n const eps = 0.4;\n let temp;\n while (maxTemp - minTemp > eps) {\n temp = (maxTemp + minTemp) * 0.5;\n const rgb = temperature2rgb(temp);\n if (rgb[2] / rgb[0] >= b / r) {\n maxTemp = temp;\n } else {\n minTemp = temp;\n }\n }\n return round(temp);\n};\n\nexport default rgb2temperature;\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport temperature2rgb from './temperature2rgb.js';\nimport rgb2temperature from './rgb2temperature.js';\n\nColor.prototype.temp =\n Color.prototype.kelvin =\n Color.prototype.temperature =\n function () {\n return rgb2temperature(this._rgb);\n };\n\nconst temp = (...args) => new Color(...args, 'temp');\nObject.assign(chroma, { temp, kelvin: temp, temperature: temp });\n\ninput.format.temp =\n input.format.kelvin =\n input.format.temperature =\n temperature2rgb;\n\nexport { temp, temp as kelvin, temp as temperature };\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport oklch2rgb from './oklch2rgb.js';\nimport rgb2oklch from './rgb2oklch.js';\n\nColor.prototype.oklch = function () {\n return rgb2oklch(this._rgb);\n};\n\nconst oklch = (...args) => new Color(...args, 'oklch');\nObject.assign(chroma, { oklch });\n\ninput.format.oklch = oklch2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'oklch');\n if (type(args) === 'array' && args.length === 3) {\n return 'oklch';\n }\n }\n});\n\nexport { oklch };\n","// feel free to comment out anything to rollup\n// a smaller chroma.js bundle\nimport chroma from './src/chroma.js';\n\n// io --> convert colors\nimport './src/io/named/index.js';\n\n// operators --> modify existing Colors\nimport './src/ops/alpha.js';\nimport './src/ops/clipped.js';\nimport './src/ops/darken.js';\nimport './src/ops/get.js';\nimport './src/ops/luminance.js';\nimport './src/ops/mix.js';\nimport './src/ops/premultiply.js';\nimport './src/ops/saturate.js';\nimport './src/ops/set.js';\nimport './src/ops/shade.js';\n\n// interpolators\nimport './src/interpolator/rgb.js';\nimport './src/interpolator/lrgb.js';\nimport './src/interpolator/lab.js';\nimport './src/interpolator/lch.js';\nimport './src/interpolator/num.js';\nimport './src/interpolator/hcg.js';\nimport './src/interpolator/hsi.js';\nimport './src/interpolator/hsl.js';\nimport './src/interpolator/hsv.js';\nimport './src/interpolator/oklab.js';\nimport './src/interpolator/oklch.js';\n\n// generators -- > create new colors\nimport average from './src/generator/average.js';\nimport bezier from './src/generator/bezier.js';\nimport blend from './src/generator/blend.js';\nimport cubehelix from './src/generator/cubehelix.js';\nimport mix from './src/generator/mix.js';\nimport random from './src/generator/random.js';\nimport scale from './src/generator/scale.js';\n\n// other utility methods\nimport { analyze } from './src/utils/analyze.js';\nimport contrast from './src/utils/contrast.js';\nimport contrastAPCA from './src/utils/contrastAPCA.js';\nimport deltaE from './src/utils/delta-e.js';\nimport distance from './src/utils/distance.js';\nimport { limits } from './src/utils/analyze.js';\nimport valid from './src/utils/valid.js';\nimport input from './src/io/input.js';\n\n// scale\nimport scales from './src/utils/scales.js';\n\n// colors\nimport colors from './src/colors/w3cx11.js';\nimport brewer from './src/colors/colorbrewer.js';\nimport Color from './src/Color.js';\n\nObject.assign(chroma, {\n analyze,\n average,\n bezier,\n blend,\n brewer,\n Color,\n colors,\n contrast,\n contrastAPCA,\n cubehelix,\n deltaE,\n distance,\n input,\n interpolate: mix,\n limits,\n mix,\n random,\n scale,\n scales,\n valid\n});\n\nexport default chroma;\n\nexport {\n analyze,\n average,\n bezier,\n blend,\n brewer,\n Color,\n colors,\n contrast,\n contrastAPCA,\n cubehelix,\n deltaE,\n distance,\n input,\n limits,\n mix,\n mix as interpolate,\n random,\n scale,\n scales,\n valid\n};\n\nexport * from './src/io/cmyk/index.js';\nexport * from './src/io/css/index.js';\nexport * from './src/io/gl/index.js';\nexport * from './src/io/hcg/index.js';\nexport * from './src/io/hex/index.js';\nexport * from './src/io/hsi/index.js';\nexport * from './src/io/hsl/index.js';\nexport * from './src/io/hsv/index.js';\nexport * from './src/io/lab/index.js';\nexport * from './src/io/lch/index.js';\nexport * from './src/io/num/index.js';\nexport * from './src/io/rgb/index.js';\nexport * from './src/io/temp/index.js';\nexport * from './src/io/oklab/index.js';\nexport * from './src/io/oklch/index.js';\n","//\n// interpolates between a set of colors uzing a bezier spline\n//\n\n// @requires utils lab\nimport Color from '../Color.js';\nimport '../io/lab/index.js';\nimport scale from './scale.js';\n\n// nth row of the pascal triangle\nconst binom_row = function (n) {\n let row = [1, 1];\n for (let i = 1; i < n; i++) {\n let newrow = [1];\n for (let j = 1; j <= row.length; j++) {\n newrow[j] = (row[j] || 0) + row[j - 1];\n }\n row = newrow;\n }\n return row;\n};\n\nconst bezier = function (colors) {\n let I, lab0, lab1, lab2;\n colors = colors.map((c) => new Color(c));\n if (colors.length === 2) {\n // linear interpolation\n [lab0, lab1] = colors.map((c) => c.lab());\n I = function (t) {\n const lab = [0, 1, 2].map((i) => lab0[i] + t * (lab1[i] - lab0[i]));\n return new Color(lab, 'lab');\n };\n } else if (colors.length === 3) {\n // quadratic bezier interpolation\n [lab0, lab1, lab2] = colors.map((c) => c.lab());\n I = function (t) {\n const lab = [0, 1, 2].map(\n (i) =>\n (1 - t) * (1 - t) * lab0[i] +\n 2 * (1 - t) * t * lab1[i] +\n t * t * lab2[i]\n );\n return new Color(lab, 'lab');\n };\n } else if (colors.length === 4) {\n // cubic bezier interpolation\n let lab3;\n [lab0, lab1, lab2, lab3] = colors.map((c) => c.lab());\n I = function (t) {\n const lab = [0, 1, 2].map(\n (i) =>\n (1 - t) * (1 - t) * (1 - t) * lab0[i] +\n 3 * (1 - t) * (1 - t) * t * lab1[i] +\n 3 * (1 - t) * t * t * lab2[i] +\n t * t * t * lab3[i]\n );\n return new Color(lab, 'lab');\n };\n } else if (colors.length >= 5) {\n // general case (degree n bezier)\n let labs, row, n;\n labs = colors.map((c) => c.lab());\n n = colors.length - 1;\n row = binom_row(n);\n I = function (t) {\n const u = 1 - t;\n const lab = [0, 1, 2].map((i) =>\n labs.reduce(\n (sum, el, j) =>\n sum + row[j] * u ** (n - j) * t ** j * el[i],\n 0\n )\n );\n return new Color(lab, 'lab');\n };\n } else {\n throw new RangeError('No point in running bezier with only one color.');\n }\n return I;\n};\n\nexport default (colors) => {\n const f = bezier(colors);\n f.scale = () => scale(f);\n return f;\n};\n","import Color from '../Color.js';\nimport '../ops/luminance.js';\n\nexport default (a, b) => {\n // WCAG contrast ratio\n // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef\n a = new Color(a);\n b = new Color(b);\n const l1 = a.luminance();\n const l2 = b.luminance();\n return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);\n};\n","import Color from '../Color.js';\n\n// simple Euclidean distance\nexport default function (a, b, mode = 'lab') {\n // Delta E (CIE 1976)\n // see http://www.brucelindbloom.com/index.html?Equations.html\n a = new Color(a);\n b = new Color(b);\n const l1 = a.get(mode);\n const l2 = b.get(mode);\n let sum_sq = 0;\n for (let i in l1) {\n const d = (l1[i] || 0) - (l2[i] || 0);\n sum_sq += d * d;\n }\n return Math.sqrt(sum_sq);\n}\n","(function(context) {\n\n /**\n * Defines an available color.\n *\n * @typedef {Object} ColorSpec\n * @property {string=} name A name for the color, e.g., 'red'\n * @property {string} source The hex-based color string, e.g., '#FF0'\n * @property {RGB} rgb The {@link RGB} color values\n */\n\n /**\n * Describes a matched color.\n *\n * @typedef {Object} ColorMatch\n * @property {string} name The name of the matched color, e.g., 'red'\n * @property {string} value The hex-based color string, e.g., '#FF0'\n * @property {RGB} rgb The {@link RGB} color values.\n */\n\n /**\n * Provides the RGB breakdown of a color.\n *\n * @typedef {Object} RGB\n * @property {number} r The red component, from 0 to 255\n * @property {number} g The green component, from 0 to 255\n * @property {number} b The blue component, from 0 to 255\n */\n\n /**\n * Gets the nearest color, from the given list of {@link ColorSpec} objects\n * (which defaults to {@link nearestColor.DEFAULT_COLORS}).\n *\n * Probably you wouldn't call this method directly. Instead you'd get a custom\n * color matcher by calling {@link nearestColor.from}.\n *\n * @public\n * @param {RGB|string} needle Either an {@link RGB} color or a hex-based\n * string representing one, e.g., '#FF0'\n * @param {Array.<ColorSpec>=} colors An optional list of available colors\n * (defaults to {@link nearestColor.DEFAULT_COLORS})\n * @return {ColorMatch|string} If the colors in the provided list had names,\n * then a {@link ColorMatch} object with the name and (hex) value of the\n * nearest color from the list. Otherwise, simply the hex value.\n *\n * @example\n * nearestColor({ r: 200, g: 50, b: 50 }); // => '#f00'\n * nearestColor('#f11'); // => '#f00'\n * nearestColor('#f88'); // => '#f80'\n * nearestColor('#ffe'); // => '#ff0'\n * nearestColor('#efe'); // => '#ff0'\n * nearestColor('#abc'); // => '#808'\n * nearestColor('red'); // => '#f00'\n * nearestColor('foo'); // => throws\n */\n function nearestColor(needle, colors) {\n needle = parseColor(needle);\n\n if (!needle) {\n return null;\n }\n\n var distanceSq,\n minDistanceSq = Infinity,\n rgb,\n value;\n\n colors || (colors = nearestColor.DEFAULT_COLORS);\n\n for (var i = 0; i < colors.length; ++i) {\n rgb = colors[i].rgb;\n\n distanceSq = (\n Math.pow(needle.r - rgb.r, 2) +\n Math.pow(needle.g - rgb.g, 2) +\n Math.pow(needle.b - rgb.b, 2)\n );\n\n if (distanceSq < minDistanceSq) {\n minDistanceSq = distanceSq;\n value = colors[i];\n }\n }\n\n if (value.name) {\n return {\n name: value.name,\n value: value.source,\n rgb: value.rgb,\n distance: Math.sqrt(minDistanceSq)\n };\n }\n\n return value.source;\n }\n\n /**\n * Provides a matcher to find the nearest color based on the provided list of\n * available colors.\n *\n * @public\n * @param {Array.<string>|Object} availableColors An array of hex-based color\n * strings, or an object mapping color *names* to hex values.\n * @return {function(string):ColorMatch|string} A function with the same\n * behavior as {@link nearestColor}, but with the list of colors\n * predefined.\n *\n * @example\n * var colors = {\n * 'maroon': '#800',\n * 'light yellow': { r: 255, g: 255, b: 51 },\n * 'pale blue': '#def',\n * 'white': 'fff'\n * };\n *\n * var bgColors = [\n * '#eee',\n * '#444'\n * ];\n *\n * var invalidColors = {\n * 'invalid': 'foo'\n * };\n *\n * var getColor = nearestColor.from(colors);\n * var getBGColor = getColor.from(bgColors);\n * var getAnyColor = nearestColor.from(colors).or(bgColors);\n *\n * getColor('ffe');\n * // => { name: 'white', value: 'fff', rgb: { r: 255, g: 255, b: 255 }, distance: 17}\n *\n * getColor('#f00');\n * // => { name: 'maroon', value: '#800', rgb: { r: 136, g: 0, b: 0 }, distance: 119}\n *\n * getColor('#ff0');\n * // => { name: 'light yellow', value: '#ffff33', rgb: { r: 255, g: 255, b: 51 }, distance: 51}\n *\n * getBGColor('#fff'); // => '#eee'\n * getBGColor('#000'); // => '#444'\n *\n * getAnyColor('#f00');\n * // => { name: 'maroon', value: '#800', rgb: { r: 136, g: 0, b: 0 }, distance: 119}\n *\n * getAnyColor('#888'); // => '#444'\n *\n * nearestColor.from(invalidColors); // => throws\n */\n nearestColor.from = function from(availableColors) {\n var colors = mapColors(availableColors),\n nearestColorBase = nearestColor;\n\n var matcher = function nearestColor(hex) {\n return nearestColorBase(hex, colors);\n };\n\n // Keep the 'from' method, to support changing the list of available colors\n // multiple times without needing to keep a reference to the original\n // nearestColor function.\n matcher.from = from;\n\n // Also provide a way to combine multiple color lists.\n matcher.or = function or(alternateColors) {\n var extendedColors = colors.concat(mapColors(alternateColors));\n return nearestColor.from(extendedColors);\n };\n\n return matcher;\n };\n\n /**\n * Given either an array or object of colors, returns an array of\n * {@link ColorSpec} objects (with {@link RGB} values).\n *\n * @private\n * @param {Array.<string>|Object} colors An array of hex-based color strings, or\n * an object mapping color *names* to hex values.\n * @return {Array.<ColorSpec>} An array of {@link ColorSpec} objects\n * representing the same colors passed in.\n */\n function mapColors(colors) {\n if (colors instanceof Array) {\n return colors.map(function(color) {\n return createColorSpec(color);\n });\n }\n\n return Object.keys(colors).map(function(name) {\n return createColorSpec(colors[name], name);\n });\n };\n\n /**\n * Parses a color from a string.\n *\n * @private\n * @param {RGB|string} source\n * @return {RGB}\n *\n * @example\n * parseColor({ r: 3, g: 22, b: 111 }); // => { r: 3, g: 22, b: 111 }\n * parseColor('#f00'); // => { r: 255, g: 0, b: 0 }\n * parseColor('#04fbc8'); // => { r: 4, g: 251, b: 200 }\n * parseColor('#FF0'); // => { r: 255, g: 255, b: 0 }\n * parseColor('rgb(3, 10, 100)'); // => { r: 3, g: 10, b: 100 }\n * parseColor('rgb(50%, 0%, 50%)'); // => { r: 128, g: 0, b: 128 }\n * parseColor('aqua'); // => { r: 0, g: 255, b: 255 }\n * parseColor('fff'); // => { r: 255, g: 255, b: 255 }\n * parseColor('foo'); // => throws\n */\n function parseColor(source) {\n var red, green, blue;\n\n if (typeof source === 'object') {\n return source;\n }\n\n if (source in nearestColor.STANDARD_COLORS) {\n return parseColor(nearestColor.STANDARD_COLORS[source]);\n }\n\n var hexMatch = source.match(/^#?((?:[0-9a-f]{3}){1,2})$/i);\n if (hexMatch) {\n hexMatch = hexMatch[1];\n\n if (hexMatch.length === 3) {\n hexMatch = [\n hexMatch.charAt(0) + hexMatch.charAt(0),\n hexMatch.charAt(1) + hexMatch.charAt(1),\n hexMatch.charAt(2) + hexMatch.charAt(2)\n ];\n\n } else {\n hexMatch = [\n hexMatch.substring(0, 2),\n hexMatch.substring(2, 4),\n hexMatch.substring(4, 6)\n ];\n }\n\n red = parseInt(hexMatch[0], 16);\n green = parseInt(hexMatch[1], 16);\n blue = parseInt(hexMatch[2], 16);\n\n return { r: red, g: green, b: blue };\n }\n\n var rgbMatch = source.match(/^rgb\\(\\s*(\\d{1,3}%?),\\s*(\\d{1,3}%?),\\s*(\\d{1,3}%?)\\s*\\)$/i);\n if (rgbMatch) {\n red = parseComponentValue(rgbMatch[1]);\n green = parseComponentValue(rgbMatch[2]);\n blue = parseComponentValue(rgbMatch[3]);\n\n return { r: red, g: green, b: blue };\n }\n\n throw Error('\"' + source + '\" is not a valid color');\n }\n\n /**\n * Creates a {@link ColorSpec} from either a string or an {@link RGB}.\n *\n * @private\n * @param {string|RGB} input\n * @param {string=} name\n * @return {ColorSpec}\n *\n * @example\n * createColorSpec('#800'); // => {\n * source: '#800',\n * rgb: { r: 136, g: 0, b: 0 }\n * }\n *\n * createColorSpec('#800', 'maroon'); // => {\n * name: 'maroon',\n * source: '#800',\n * rgb: { r: 136, g: 0, b: 0 }\n * }\n */\n function createColorSpec(input, name) {\n var color = {};\n\n if (name) {\n color.name = name;\n }\n\n if (typeof input === 'string') {\n color.source = input;\n color.rgb = parseColor(input);\n\n } else if (typeof input === 'object') {\n // This is for if/when we're concatenating lists of colors.\n if (input.source) {\n return createColorSpec(input.source, input.name);\n }\n\n color.rgb = input;\n color.source = rgbToHex(input);\n }\n\n return color;\n }\n\n /**\n * Parses a value between 0-255 from a string.\n *\n * @private\n * @param {string} string\n * @return {number}\n *\n * @example\n * parseComponentValue('100'); // => 100\n * parseComponentValue('100%'); // => 255\n * parseComponentValue('50%'); // => 128\n */\n function parseComponentValue(string) {\n if (string.charAt(string.length - 1) === '%') {\n return Math.round(parseInt(string, 10) * 255 / 100);\n }\n\n return Number(string);\n }\n\n /**\n * Converts an {@link RGB} color to its hex representation.\n *\n * @private\n * @param {RGB} rgb\n * @return {string}\n *\n * @example\n * rgbToHex({ r: 255, g: 128, b: 0 }); // => '#ff8000'\n */\n function rgbToHex(rgb) {\n return '#' + leadingZero(rgb.r.toString(16)) +\n leadingZero(rgb.g.toString(16)) + leadingZero(rgb.b.toString(16));\n }\n\n /**\n * Puts a 0 in front of a numeric string if it's only one digit. Otherwise\n * nothing (just returns the value passed in).\n *\n * @private\n * @param {string} value\n * @return\n *\n * @example\n * leadingZero('1'); // => '01'\n * leadingZero('12'); // => '12'\n */\n function leadingZero(value) {\n if (value.length === 1) {\n value = '0' + value;\n }\n return value;\n }\n\n /**\n * A map from the names of standard CSS colors to their hex values.\n */\n nearestColor.STANDARD_COLORS = {\n aqua: '#0ff',\n black: '#000',\n blue: '#00f',\n fuchsia: '#f0f',\n gray: '#808080',\n green: '#008000',\n lime: '#0f0',\n maroon: '#800000',\n navy: '#000080',\n olive: '#808000',\n orange: '#ffa500',\n purple: '#800080',\n red: '#f00',\n silver: '#c0c0c0',\n teal: '#008080',\n white: '#fff',\n yellow: '#ff0'\n };\n\n /**\n * Default colors. Comprises the colors of the rainbow (good ol' ROY G. BIV).\n * This list will be used for calls to {@nearestColor} that don't specify a list\n * of available colors to match.\n */\n nearestColor.DEFAULT_COLORS = mapColors([\n '#f00', // r\n '#f80', // o\n '#ff0', // y\n '#0f0', // g\n '#00f', // b\n '#008', // i\n '#808' // v\n ]);\n\n nearestColor.VERSION = '0.4.4';\n\n if (typeof module === 'object' && module && module.exports) {\n module.exports = nearestColor;\n } else {\n context.nearestColor = nearestColor;\n }\n\n}(this));\n","/**\n * Represents an HSL (Hue, Saturation, Lightness) color unit.\n */\nexport class UnitHSL {\n /** Hue component (0–360) */\n h: number;\n /** Saturation component (0–100%) */\n s: number;\n /** Lightness component (0–100%) */\n l: number;\n\n /**\n * Create a new UnitHSL instance.\n * @param {[number, number, number]} components - The HSL components: [h, s, l]\n */\n constructor([h, s, l]: [number, number, number]) {\n this.h = Number(!isNaN(h) ? h.toFixed(0) : '0');\n this.s = Number((s * 100).toFixed(0));\n this.l = Number((l * 100).toFixed(0));\n }\n\n /**\n * Converts the HSL unit to a CSS string representation.\n * @returns {string} - A string like \"hsl(30, 50%, 80%)\"\n * @example\n * ```ts\n * const hslUnit = new UnitHSL([30, 0.5, 0.8]);\n * const hslString = hslUnit.toString(); // \"hsl(30, 50%, 80%)\"\n * ```\n */\n toString(): string {\n return `hsl(${this.h}, ${this.s}%, ${this.l}%)`;\n }\n}\n\n/**\n * Represents an HSL (Hue, Saturation, Lightness) color unit with float values.\n */\nexport class UnitHSLFloat {\n /** Hue component */\n h: number;\n /** Saturation component */\n s: number;\n /** Lightness component */\n l: number;\n\n /**\n * Create a new UnitHSLFloat instance.\n * @param {[number, number, number]} components - The HSL components: [h, s, l]\n */\n constructor([h, s, l]: [number, number, number]) {\n this.h = Number(!isNaN(h) ? h.toFixed(0) : '0');\n this.s = Number(s.toFixed(2));\n this.l = Number(l.toFixed(2));\n }\n\n /**\n * Converts the HSL float unit to a string.\n * @returns {string} - A string like \"30, 0.50, 0.80\"\n * @example\n * ```ts\n * const hslFloatUnit = new UnitHSLFloat([30, 0.5, 0.8]);\n * const hslFloatString = hslFloatUnit.toString(); // \"30, 0.50, 0.80\"\n * ```\n */\n toString(): string {\n return `${this.h}, ${this.s}, ${this.l}`;\n }\n}\n","/**\n * Represents an XYZ color unit.\n */\nexport class UnitXYZ {\n /** X component */\n x: number;\n /** Y component */\n y: number;\n /** Z component */\n z: number;\n\n /**\n * Create a new UnitXYZ instance.\n * @param {{ x: number, y: number, z: number }} components - The XYZ components.\n */\n constructor({ x, y, z }: { x: number; y: number; z: number }) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n\n /**\n * Converts the XYZ unit to a string representation.\n * @returns {string} - The string representation of the XYZ unit.\n * @example\n * ```ts\n * const xyzUnit = new UnitXYZ({ x: 0.4, y: 0.6, z: 0.8 });\n * const xyzString = xyzUnit.toString(); // \"0.4, 0.6, 0.8\"\n * ```\n */\n toString(): string {\n return `${this.x}, ${this.y}, ${this.z}`;\n }\n}\n","/**\n * Represents a CMYK color unit.\n */\nexport class UnitCMYK {\n /** Cyan component */\n c: number;\n /** Magenta component */\n m: number;\n /** Yellow component */\n y: number;\n /** Black (Key) component */\n k: number;\n\n /**\n * Create a new UnitCMYK instance.\n * @param {{ c: number, m: number, y: number, k: number }} components - The CMYK components.\n */\n constructor({ c, m, y, k }: { c: number; m: number; y: number; k: number }) {\n this.c = c;\n this.m = m;\n this.y = y;\n this.k = k;\n }\n\n /**\n * Converts the CMYK unit to a string representation.\n * @returns {string} - The string representation of the CMYK unit.\n * @example\n * ```ts\n * const cmykUnit = new UnitCMYK({ c: 0.2, m: 0.4, y: 0.6, k: 0.1 });\n * const cmykString = cmykUnit.toString(); // \"0.2, 0.4, 0.6, 0.1\"\n * ```\n */\n toString(): string {\n return `${this.c}, ${this.m}, ${this.y}, ${this.k}`;\n }\n}\n","/**\n * Represents an RGB float color unit.\n */\nexport class UnitRGBFloat {\n /** Red component */\n r: number;\n /** Green component */\n g: number;\n /** Blue component */\n b: number;\n\n /**\n * Create a new UnitRGBFloat instance.\n * @param {{ r: number, g: number, b: number }} components - The RGB float components.\n */\n constructor({ r, g, b }: { r: number; g: number; b: number }) {\n this.r = r;\n this.g = g;\n this.b = b;\n }\n\n /**\n * Converts the RGB float unit to a string representation.\n * @returns {string} - The string representation of the RGB float unit.\n * @example\n * ```ts\n * const rgbFloatUnit = new UnitRGBFloat({ r: 255, g: 128, b: 0 });\n * const rgbFloatString = rgbFloatUnit.toString(); // \"255, 128, 0\"\n * ```\n */\n toString(): string {\n return `${this.r}, ${this.g}, ${this.b}`;\n }\n}\n","/**\n * Represents an HWB (Hue, Whiteness, Blackness) color unit.\n */\nexport class UnitHWB {\n /** Hue component */\n h: number;\n /** Whiteness component */\n w: number;\n /** Blackness component */\n b: number;\n\n /**\n * Create a new UnitHWB instance.\n * @param {{ h: number, w: number, b: number }} components - The HWB components.\n */\n constructor({ h, w, b }: { h: number; w: number; b: number }) {\n this.h = h;\n this.w = w;\n this.b = b;\n }\n\n /**\n * Converts the HWB unit to a string representation.\n * @returns {string} - A string like `\"200, 0.2, 0.1\"`\n * @example\n * ```ts\n * const hwbUnit = new UnitHWB({ h: 200, w: 0.2, b: 0.1 });\n * const hwbString = hwbUnit.toString(); // \"200, 0.2, 0.1\"\n * ```\n */\n toString(): string {\n return `${this.h}, ${this.w}, ${this.b}`;\n }\n}\n","/**\n * Represents a LAB (CIELAB) color unit.\n */\nexport class UnitLAB {\n /** Lightness component */\n l: number;\n /** A color component */\n a: number;\n /** B color component */\n b: number;\n\n /**\n * Create a new UnitLAB instance.\n * @param {[number, number, number]} components - The LAB components: [l, a, b]\n */\n constructor([l, a, b]: [number, number, number]) {\n this.l = Number(l.toFixed(2));\n this.a = Number(a.toFixed(2));\n this.b = Number(b.toFixed(2));\n }\n\n /**\n * Converts the LAB unit to a string representation.\n * @returns {string} - The string representation of the LAB unit.\n * @example\n * ```ts\n * const labUnit = new UnitLAB([70, 10, 20]);\n * const labString = labUnit.toString(); // \"70, 10, 20\"\n * ```\n */\n toString(): string {\n return `${this.l}, ${this.a}, ${this.b}`;\n }\n}\n","/**\n * Represents an OKLAB color unit.\n */\nexport class UnitOKLAB {\n /** Lightness component */\n l: number;\n /** First color opponent axis */\n a: number;\n /** Second color opponent axis */\n b: number;\n\n /**\n * Create a new UnitOKLAB instance.\n * @param {[number, number, number]} components - The OKLAB components [l, a, b].\n */\n constructor([l, a, b]: [number, number, number]) {\n this.l = Number(l.toFixed(2));\n this.a = Number(a.toFixed(2));\n this.b = Number(b.toFixed(2));\n }\n\n /**\n * Converts the OKLAB unit to a string representation.\n * @returns {string} - The string representation of the OKLAB unit.\n * @example\n * ```ts\n * const oklabUnit = new UnitOKLAB([70, 30, 45]);\n * const oklabString = oklabUnit.toString(); // \"70, 30, 45\"\n * ```\n */\n toString(): string {\n return `${this.l}, ${this.a}, ${this.b}`;\n }\n}\n","/**\n * Represents an HSV (Hue, Saturation, Value) color unit.\n */\nexport class UnitHSV {\n /** Hue component */\n h: number;\n /** Saturation component */\n s: number;\n /** Value component */\n v: number;\n\n /**\n * Create a new UnitHSV instance.\n * @param {[number, number, number]} components - The HSV components: [h, s, v]\n */\n constructor([h, s, v]: [number, number, number]) {\n this.h = Number(!isNaN(h) ? h.toFixed(2) : '0');\n this.s = Number(s.toFixed(2));\n this.v = Number(v.toFixed(2));\n }\n\n /**\n * Converts the HSV unit to a string representation.\n * @returns {string} - A string like `\"30.00, 0.50, 0.80\"`\n * @example\n * ```ts\n * const hsvUnit = new UnitHSV([30, 0.5, 0.8]);\n * const hsvString = hsvUnit.toString(); // \"30.00, 0.50, 0.80\"\n * ```\n */\n toString(): string {\n return `${this.h}, ${this.s}, ${this.v}`;\n }\n}\n","/**\n * Represents an LCH (CIELCH) color unit.\n */\nexport class UnitLCH {\n /** Lightness component */\n l: number;\n /** Chroma component */\n c: number;\n /** Hue component */\n h: number;\n\n /**\n * Create a new UnitLCH instance.\n * @param {[number, number, number]} components - The LCH components: [l, c, h]\n */\n constructor([l, c, h]: [number, number, number]) {\n this.l = Number(l.toFixed(2));\n this.c = Number(c.toFixed(2));\n this.h = Number(!isNaN(h) ? h.toFixed(2) : '0');\n }\n\n /**\n * Converts the LCH unit to a string representation.\n * @returns {string} - A string like `\"70.00, 30.00, 45.00\"`\n * @example\n * ```ts\n * const lchUnit = new UnitLCH([70, 30, 45]);\n * const lchString = lchUnit.toString(); // \"70.00, 30.00, 45.00\"\n * ```\n */\n toString(): string {\n return `${this.l}, ${this.c}, ${this.h}`;\n }\n}\n","/**\n * Represents an OKLCH color unit.\n */\nexport class UnitOKLCH {\n /** Lightness component */\n l: number;\n /** Chroma component */\n c: number;\n /** Hue component */\n h: number;\n\n /**\n * Create a new UnitOKLCH instance.\n * @param {[number, number, number]} components - The OKLCH components: [l, c, h]\n */\n constructor([l, c, h]: [number, number, number]) {\n this.l = Number(l.toFixed(2));\n this.c = Number(c.toFixed(2));\n this.h = Number(!isNaN(h) ? h.toFixed(2) : '0');\n }\n\n /**\n * Converts the OKLCH unit to a string representation.\n * @returns {string} - The string representation of the OKLCH unit.\n * @example\n * ```ts\n * const oklchUnit = new UnitOKLCH([70, 30, 45]);\n * const oklchString = oklchUnit.toString(); // \"70.00, 30.00, 45.00\"\n * ```\n */\n toString(): string {\n return `${this.l}, ${this.c}, ${this.h}`;\n }\n}\n","/**\n * Represents an HSI (Hue, Saturation, Intensity) color unit.\n */\nexport class UnitHSI {\n /** Hue component */\n h: number;\n /** Saturation component */\n s: number;\n /** Intensity component */\n i: number;\n\n /**\n * Create a new UnitHSI instance.\n * @param {[number, number, number]} components - The HSI components: [h, s, i]\n */\n constructor([h, s, i]: [number, number, number]) {\n this.h = Number(!isNaN(h) ? h.toFixed(2) : '0');\n this.s = Number(s.toFixed(2));\n this.i = Number(i.toFixed(2));\n }\n\n /**\n * Converts the HSI unit to a string representation.\n * @returns {string} - The string representation of the HSI unit.\n * @example\n * ```ts\n * const hsiUnit = new UnitHSI([30, 0.5, 0.8]);\n * const hsiString = hsiUnit.toString(); // \"30, 0.5, 0.8\"\n * ```\n */\n toString(): string {\n return `${this.h}, ${this.s}, ${this.i}`;\n }\n}\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusHSLObjectType,\n MoebiusRGBObjectType\n} from '../../types';\nimport { UnitHSLFloat } from '../color-objects/hsl';\nimport { UnitRGBFloat } from '../color-objects/rgb';\n\n/**\n * Converts a color to its float representation.\n * @param {MoebiusChromaColorInputType} color - The input color in hex, rgb, or rgba format.\n * @param {string} [type] - The color type ('hsl' for HSL, undefined for RGB).\n * @returns {UnitHSLFloat | UnitRGBFloat} - The float representation of the color.\n * @example\n * ```ts\n * const hslFloatColor = toFloat('#00ff00', 'hsl');\n * console.log(hslFloatColor.toString()); // 120, 100, 50\n * ```\n * @example\n * ```ts\n * const rgbFloatColor = toFloat('#00ff00');\n * console.log(rgbFloatColor.toString()); // 0, 1, 0\n * ```\n */\nexport const toFloat = (\n color: MoebiusChromaColorInputType,\n type?: string\n): MoebiusHSLObjectType | MoebiusRGBObjectType => {\n if (type === 'hsl') {\n // Convert the color to HSL and create a new HSL float unit\n return new UnitHSLFloat(chroma(color).hsl());\n }\n\n // Convert the color to RGB and create a new RGB float unit\n const _rgb = chroma(color).rgb();\n const rgbFloat = new UnitRGBFloat({\n r: Number((_rgb[0] / 255).toFixed(2)),\n g: Number((_rgb[1] / 255).toFixed(2)),\n b: Number((_rgb[2] / 255).toFixed(2))\n });\n\n return rgbFloat;\n};\n","/**\n * Normalizes an RGB input value.\n * @param {number} r - The input value in the RGB color space (0 to 255).\n * @returns {number} - The normalized value.\n */\nexport const normalizeRGBInput = (r: number): number => {\n if ((r /= 255) <= 0.04045) return r / 12.92;\n\n return Math.pow((r + 0.055) / 1.055, 2.4);\n};\n\n/**\n * Normalizes a LAB input value.\n * @param {number} t - The input value in the LAB color space.\n * @returns {number} - The normalized value.\n */\nexport const normalizeLABInput = (t: number): number => {\n if (t > 0.008856452) return Math.pow(t, 1 / 3);\n\n return t / 0.12841855 + 0.137931034;\n};\n","import {\n MoebiusCMYKObjectType,\n MoebiusColorValueHexType,\n MoebiusColorValueRgbType,\n MoebiusHSIObjectType,\n MoebiusHSLObjectType,\n MoebiusHSVObjectType,\n MoebiusHWBObjectType,\n MoebiusLABObjectType,\n MoebiusLCHObjectType,\n MoebiusColorInterface,\n MoebiusRGBObjectType,\n MoebiusXYZObjectType,\n MoebiusChromaColorInputType\n} from '../types';\nimport * as CONVERTERS from '../utils/converters';\n\n/**\n * MoebiusColor class representing a color with various formats and conversions.\n *\n * @example\n * ```ts\n * const mColor = new MoebiusColor('#ff9900')\n * ```\n */\nexport class MoebiusColor implements MoebiusColorInterface {\n color: MoebiusChromaColorInputType;\n name: string;\n hex: MoebiusColorValueHexType;\n rgb: MoebiusColorValueRgbType;\n hsl: MoebiusHSLObjectType;\n hwb: MoebiusHWBObjectType;\n hsv: MoebiusHSVObjectType;\n lab: MoebiusLABObjectType;\n xyz: MoebiusXYZObjectType;\n lch: MoebiusLCHObjectType;\n oklch: MoebiusLCHObjectType;\n hsi: MoebiusHSIObjectType;\n oklab: MoebiusLABObjectType;\n cmyk: MoebiusCMYKObjectType;\n rgbFloat: MoebiusRGBObjectType;\n hslFloat: MoebiusHSLObjectType;\n\n /**\n * Creates an instance of MoebiusColor.\n * @param {MoebiusChromaColorInputType} color - The hex value of the color.\n * @param {string} name - The name of the color\n *\n * @throws Will throw an error if init has not been run before creating an instance.\n */\n constructor(color: MoebiusChromaColorInputType, name: string) {\n this.color = color;\n this.name = name;\n\n this.hex = CONVERTERS.toHEX(this.color);\n this.cmyk = CONVERTERS.toCMYK(this.color);\n this.xyz = CONVERTERS.toXYZ(this.color);\n this.hsl = CONVERTERS.toHSL(this.color);\n this.hwb = CONVERTERS.toHWB(this.color);\n this.lab = CONVERTERS.toLAB(this.color);\n this.oklab = CONVERTERS.toOKLAB(this.color);\n this.hsv = CONVERTERS.toHSV(this.color);\n this.lch = CONVERTERS.toLCH(this.color);\n this.oklch = CONVERTERS.toOKLCH(this.color);\n this.hsi = CONVERTERS.toHSI(this.color);\n this.rgb = CONVERTERS.toRGB(this.color);\n this.rgbFloat = CONVERTERS.toFloat(this.color) as MoebiusRGBObjectType;\n this.hslFloat = CONVERTERS.toFloat(\n this.color,\n 'hsl'\n ) as MoebiusHSLObjectType;\n }\n /**\n * Converts the color to an object in the specified color space.\n * @param {string} type - The color space type (e.g., 'rgb' or 'hsl').\n * @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The color object in the specified color space.\n */\n toObject(type?: string): MoebiusRGBObjectType | MoebiusHSLObjectType {\n return CONVERTERS.toObject(this.color, type);\n }\n /**\n * Converts the color to a floating-point representation in the specified color space.\n * @param {string} type - The color space type (e.g., 'rgb' or 'hsl').\n * @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The floating-point representation of the color in the specified color space.\n */\n toFloat(type?: string): MoebiusRGBObjectType | MoebiusHSLObjectType {\n return CONVERTERS.toFloat(this.color, type);\n }\n}\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType\n} from '../../types';\n\n/**\n * Converts a color to its corresponding HEX representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in various formats (HEX, RGB, HSL, etc.).\n * @returns {MoebiusColorValueHexType} The HEX representation of the color.\n *\n * @example\n * ```ts\n * const hexColor = toHEX('#3498db');\n * console.log(hexColor); // Output: '#3498db'\n * ```\n */\nexport const toHEX = (\n color: MoebiusChromaColorInputType\n): MoebiusColorValueHexType => {\n return chroma(color).hex() as MoebiusColorValueHexType;\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusCMYKObjectType,\n MoebiusChromaColorInputType\n} from '../../types';\nimport { UnitCMYK } from '../color-objects';\n\n/**\n * Converts an RGB color to its CMYK representation.\n * @param {MoebiusChromaColorInputType} color - The input color in hex, rgb, or rgba format.\n * @returns {MoebiusCMYKObjectType} - The CMYK representation of the color.\n * @example\n * ```ts\n * const cmykColor = toCMYK('#00ff00');\n * console.log(cmykColor); // { c: 40, m: 0, y: 100, k: 0 }\n * ```\n */\nexport const toCMYK = (\n color: MoebiusChromaColorInputType\n): MoebiusCMYKObjectType => {\n // Convert the color to RGB components\n let [r, b, g] = chroma(color).rgb();\n\n // Normalize RGB values to the range [0, 1]\n r /= 255;\n g /= 255;\n b /= 255;\n\n // Calculate the CMYK components\n const k = +(1 - Math.max(r, g, b));\n const c = +((1 - r - k) / (1 - k) || 0);\n const m = +((1 - g - k) / (1 - k) || 0);\n const y = +((1 - b - k) / (1 - k) || 0);\n\n // Create a new CMYK unit\n return new UnitCMYK({\n c: Number((c * 100).toFixed()),\n m: Number((m * 100).toFixed()),\n y: Number((y * 100).toFixed()),\n k: Number((k * 100).toFixed())\n });\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusXYZObjectType } from '../../types';\nimport { UnitXYZ } from '../color-objects';\nimport { normalizeLABInput, normalizeRGBInput } from '../normalize-color-units';\n\n/**\n * Converts a color from RGB to CIE 1931 XYZ color space.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hexadecimal format.\n * @returns {MoebiusXYZObjectType} - An object representing the XYZ color values.\n */\nexport const toXYZ = (\n color: MoebiusChromaColorInputType\n): MoebiusXYZObjectType => {\n // Extract RGB components from the input color\n let [r, b, g] = chroma(color).rgb();\n\n // Normalize RGB values\n r = normalizeRGBInput(r);\n g = normalizeRGBInput(g);\n b = normalizeRGBInput(b);\n\n // Convert RGB to XYZ\n const x = normalizeLABInput(\n (0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047\n );\n const y = normalizeLABInput(\n (0.2126729 * r + 0.7151522 * g + 0.072175 * b) / 1\n );\n const z = normalizeLABInput(\n (0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883\n );\n\n // Return XYZ color values as a UnitXYZ object\n return new UnitXYZ({\n x: Number(x.toFixed(2)),\n y: Number(y.toFixed(2)),\n z: Number(z.toFixed(2))\n });\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusHSLObjectType } from '../../types';\nimport { UnitHSL } from '../color-objects';\n\n/**\n * Converts a color to its corresponding HSL object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusHSLObjectType} The HSL color representation object.\n *\n * @example\n * ```ts\n * const hslObject = toHSL('#3498db');\n * console.log(hslObject); // Output: { h: 207.76, s: 0.86, l: 0.56 }\n * ```\n */\nexport const toHSL = (\n color: MoebiusChromaColorInputType\n): MoebiusHSLObjectType => {\n return new UnitHSL(chroma(color).hsl());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusHWBObjectType } from '../../types';\nimport { UnitHWB } from '../color-objects';\n\n/**\n * Converts a color to its corresponding HWB object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusHWBObjectType} The HWB color representation object.\n *\n * @example\n * ```ts\n * const hwbObject = toHWB('#3498db');\n * console.log(hwbObject); // Output: { h: 207.76, w: 0.5, b: 0.14 }\n * ```\n */\nexport const toHWB = (\n color: MoebiusChromaColorInputType\n): MoebiusHWBObjectType => {\n let [r, b, g] = chroma(color).rgb();\n\n r /= 255;\n g /= 255;\n b /= 255;\n\n const w = Math.min(r, g, b);\n const v = Math.max(r, g, b);\n const black = 1 - v;\n\n if (v === w) return { h: 0, w: w, b: black };\n\n const f = r === w ? g - b : g === w ? b - r : r - g;\n const i = r === w ? 3 : g === w ? 5 : 1;\n\n return new UnitHWB({\n h: Number(((i - f / (v - w)) / 6).toFixed(2)),\n w: Number(w.toFixed(2)),\n b: Number(black.toFixed(2))\n });\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusLABObjectType } from '../../types';\nimport { UnitLAB } from '../color-objects';\n\n/**\n * Converts a color to its corresponding LAB object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusLABObjectType} The LAB color representation object.\n *\n * @example\n * ```ts\n * const labObject = toLAB('#3498db');\n * console.log(labObject); // Output: { l: 54.24, a: -12.56, b: -43.81 }\n * ```\n */\nexport const toLAB = (\n color: MoebiusChromaColorInputType\n): MoebiusLABObjectType => {\n return new UnitLAB(chroma(color).lab());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusLABObjectType } from '../../types';\nimport { UnitOKLAB } from '../color-objects';\n\n/**\n * Converts a color to its OKLAB representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusLABObjectType} The OKLAB representation of the input color.\n *\n * @example\n * ```ts\n * const oklabColor = toOKLAB('#3498db');\n * console.log(oklabColor); // Output: { l: 52.42, a: -9.93, b: -39.49 }\n * ```\n */\nexport const toOKLAB = (\n color: MoebiusChromaColorInputType\n): MoebiusLABObjectType => {\n return new UnitOKLAB(chroma(color).oklab());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusHSVObjectType } from '../../types';\nimport { UnitHSV } from '../color-objects';\n\n/**\n * Converts a color to its corresponding HSV object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusHSVObjectType} The HSV color representation object.\n *\n * @example\n * ```ts\n * const hsvObject = toHSV('#3498db');\n * console.log(hsvObject); // Output: { h: 207.76, s: 0.86, v: 0.85 }\n * ```\n */\nexport const toHSV = (\n color: MoebiusChromaColorInputType\n): MoebiusHSVObjectType => {\n return new UnitHSV(chroma(color).hsv());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusLCHObjectType } from '../../types';\nimport { UnitLCH } from '../color-objects';\n\n/**\n * Converts a color to its corresponding LCH object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusLCHObjectType} The LCH color representation object.\n *\n * @example\n * ```ts\n * const lchObject = toLCH('#3498db');\n * console.log(lchObject); // Output: { l: 54.66, c: 76.91, h: 217.76 }\n * ```\n */\nexport const toLCH = (\n color: MoebiusChromaColorInputType\n): MoebiusLCHObjectType => {\n return new UnitLCH(chroma(color).lch());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusLCHObjectType } from '../../types';\nimport { UnitOKLCH } from '../color-objects';\n\n/**\n * Converts a color to its OKLCH representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusLCHObjectType} The OKLCH representation of the input color.\n *\n * @example\n * ```ts\n * const oklchColor = toOKLCH('#3498db');\n * console.log(oklchColor); // Output: { l: 52.12, c: 126.62, h: 232.53 }\n * ```\n */\nexport const toOKLCH = (\n color: MoebiusChromaColorInputType\n): MoebiusLCHObjectType => {\n return new UnitOKLCH(chroma(color).oklch());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusHSIObjectType } from '../../types';\nimport { UnitHSI } from '../color-objects';\n\n/**\n * Converts a color to its corresponding HSI object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusHSIObjectType} The HSI color representation object.\n *\n * @example\n * ```ts\n * const hsiObject = toHSI('#3498db');\n * console.log(hsiObject); // Output: { h: 207.76, s: 0.52, i: 0.4 }\n * ```\n */\nexport const toHSI = (\n color: MoebiusChromaColorInputType\n): MoebiusHSIObjectType => {\n return new UnitHSI(chroma(color).hsi());\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueRgbType\n} from '../../types';\n\n/**\n * Converts a color to its RGB representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in any valid chroma-js format.\n * @returns {MoebiusColorValueRgbType} The RGB representation of the input color.\n *\n * @example\n * ```ts\n * const rgbColor = toRGB('#3498db');\n * console.log(rgbColor); // Output: 'rgb(52, 152, 219)'\n * ```\n */\nexport const toRGB = (\n color: MoebiusChromaColorInputType\n): MoebiusColorValueRgbType => {\n const [r, g, b] = chroma(color).rgb();\n\n return `rgb(${r}, ${g}, ${b})`;\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusHSLObjectType,\n MoebiusRGBObjectType\n} from '../../types';\n\n/**\n * Converts a color to its corresponding object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @param {string} [type] - The type of representation ('hsl' or undefined for RGB).\n * @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The color representation object.\n *\n * @example\n * ```ts\n * const rgbObject = toObject('#3498db');\n * console.log(rgbObject); // Output: { r: 52, g: 152, b: 219 }\n *\n * const hslObject = toObject('#3498db', 'hsl');\n * console.log(hslObject); // Output: { h: 207, s: 79, l: 57 }\n * ```\n */\nexport const toObject = (\n color: MoebiusChromaColorInputType,\n type?: string\n): MoebiusRGBObjectType | MoebiusHSLObjectType => {\n if (type === 'hsl') {\n const [h, s, l] = chroma(color).hsl();\n\n return {\n h: Number(!isNaN(h) ? h.toFixed(0) : 0),\n s: Number((s * 100).toFixed()),\n l: Number((l * 100).toFixed())\n };\n }\n\n const rgb = chroma(color).rgb();\n const rgbObject = {\n r: rgb[0],\n g: rgb[1],\n b: rgb[2]\n };\n\n return rgbObject;\n};\n","import { MoebiusPaletteDefaultOptionsType } from '../types';\n\n/**\n * Default options for the Moebius Palette.\n *\n * @type {MoebiusPaletteDefaultOptionsType}\n * @readonly\n *\n * @example\n * ```ts\n * console.log(MOEBIUS_PALETTE_DEFAULT_OPTIONS);\n * // {\n * // diverging: false,\n * // bezier: false,\n * // randomOffset: false,\n * // correctLightness: false,\n * // noDuplicates: true,\n * // colorScaleMode: 'lch',\n * // reverseDirection: false\n * // }\n * ```\n */\nexport const MOEBIUS_PALETTE_DEFAULT_OPTIONS: MoebiusPaletteDefaultOptionsType =\n {\n diverging: false,\n bezier: false,\n randomOffset: false,\n correctLightness: false,\n noDuplicates: true,\n colorScaleMode: 'lch',\n reverseDirection: false\n };\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\n/**\n * Generate a harmonized color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the harmonized palette.\n * @param {number} start - The starting angle for generating harmonized colors (degrees).\n * @param {number} end - The ending angle for generating harmonized colors (degrees).\n * @param {number} interval - The interval between harmonized colors (degrees).\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors in the palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the harmonized palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const harmonizedPalette = harmonize(baseColor, 30, 210, 30, { noDuplicates: true });\n * console.log(harmonizedPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#3498db']\n * ```\n */\nexport const harmonize = (\n color: MoebiusChromaColorInputType,\n start: number,\n end: number,\n interval: number,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const { noDuplicates = true } = options || {};\n // Initialize the array with the base color.\n const colors = [chroma(color).hex() as MoebiusColorValueHexType];\n\n // Convert the HSL color to an object for easy manipulation.\n let [h, s, l] = chroma(color).hsl();\n\n if (isNaN(h)) {\n h = 0;\n }\n\n s = Number((s * 100).toFixed());\n l = Number((l * 100).toFixed());\n\n // Generate harmonized colors within the specified range.\n for (let i = start; i <= end; i += interval) {\n // Calculate the adjusted hue.\n const h1 = Number(((h + i) % 360).toFixed());\n\n // Create the harmonized color in HSL format and add it to the array.\n colors.push(\n chroma(`hsl(${h1}, ${s}%, ${l}%)`).hex() as MoebiusColorValueHexType\n );\n }\n\n let uniqueColors = colors;\n\n if (noDuplicates) {\n uniqueColors = [...new Set(colors)];\n }\n\n return uniqueColors;\n};\n","/**\n * Generates a random integer within a specified range.\n *\n * @param {number} max - The maximum value (inclusive) for the random number.\n * @param {number} min - The minimum value (inclusive) for the random number.\n * @returns {number} - A random integer within the specified range.\n *\n * @example\n * ```ts\n * // Generate a random integer between 1 and 10, inclusive\n * const randomNumber = random(10, 1);\n * console.log(randomNumber); // Example output: 5\n * ```\n */\nexport const random = (max: number, min: number): number =>\n Math.floor(Math.random() * (max - min + 1)) + min;\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusColorValueHslType,\n MoebiusPaletteOptionsType\n} from '../types';\nimport { random } from '../utils/random';\n\n/**\n * Generates a monochromatic color palette based on the given color.\n * @param {MoebiusChromaColorInputType} color - The base color for the palette.\n * @param {MoebiusPaletteOptionsType} options - Options for generating the palette.\n * @returns {MoebiusColorValueHexType[]} - An array of hex color values in the palette.\n * @example\n * ```typescript\n * const baseColor = '#003f5c';\n * const options = { numberOfColors: 5, bezier: true, randomOffset: false };\n * const monochromaticPalette = monochromatic(baseColor, options);\n * console.log(monochromaticPalette);\n * [\n * '#003f5c', // maniacMansion,\n * '#014268', // darkImperialBlue,\n * '#024575', // macraggeBlue,\n * '#044784', // bridgeport,\n * '#064898', // frightNight,\n * '#0745b6', // absoluteZero,\n * '#002df5', // blueBouquet\n * ];\n * ```\n */\nexport const monochromatic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n bezier = false,\n randomOffset = false,\n colorScaleMode = 'rgb',\n noDuplicates = true,\n reverseDirection = false,\n correctLightness = true\n } = options || {};\n\n let [h, s, l] = chroma(color).hsl();\n\n if (isNaN(h)) {\n h = 0;\n }\n\n h = Number(h.toFixed(0));\n s = Number((s * 100).toFixed(0));\n l = Number((l * 100).toFixed(0));\n\n const hslColors: MoebiusColorValueHslType[] = [];\n\n hslColors.push(\n chroma(\n `hsl(${h}, ${s}%, ${l < 0 ? 0 : l}%)`\n ) as unknown as MoebiusColorValueHslType\n );\n\n if (randomOffset) {\n // because we've already added the original color, we start counting from 1\n for (let i = 1; i < numberOfColors; i++) {\n if (reverseDirection) {\n l += random(0, 10);\n h += random(-5, 5);\n } else {\n l -= random(0, 10);\n h -= random(-5, 5);\n }\n\n if (h > 359) h = 359;\n\n if (h < 0) h = 0;\n\n hslColors.push(\n chroma(\n `hsl(${h}, ${s}%, ${l < 0 ? 0 : l}%)`\n ) as unknown as MoebiusColorValueHslType\n );\n }\n } else {\n for (let i = 1; i < numberOfColors; i++) {\n if (reverseDirection) {\n l += 5;\n h += 5;\n } else {\n l -= 5;\n h -= 5;\n }\n\n if (h > 359) h = 359;\n\n if (h < 0) h = 0;\n\n hslColors.push(\n chroma(\n `hsl(${h}, ${s}%, ${l < 0 ? 0 : l}%)`\n ) as unknown as MoebiusColorValueHslType\n );\n }\n }\n\n let colors = hslColors.map((color) =>\n chroma(color).hex()\n ) as MoebiusColorValueHexType[];\n\n if (noDuplicates) {\n colors = [...new Set(colors)];\n }\n\n if (bezier) {\n if (colors.length > 1) {\n colors = chroma\n .bezier(colors)\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n } else {\n colors = chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n }\n }\n\n return colors;\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType,\n MoebiusChromaColorInputType\n} from '../types';\nimport { range } from '../utils/range';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a luminance shift palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the luminance shift palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {boolean} [options.diverging=false] - Whether to generate a diverging palette.\n * @param {number} [options.numberOfColors=7] - The number of colors in the luminance shift palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the luminance shift palette.\n * @private\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const luminanceShiftPalette = generateLuminanceShiftPalette(baseColor, { numberOfColors: 5 });\n * console.log(luminanceShiftPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\nconst generateLuminanceShiftPalette = (\n color: MoebiusChromaColorInputType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n) => {\n if (!color) throw Error('MoebiusPalettes: missing input `color`');\n\n const { diverging = false, numberOfColors = 7 } =\n options as MoebiusPaletteOptionsType;\n const [l, a, b] = chroma(color).lab();\n const lRange = 100 * (0.95 - 1 / numberOfColors);\n const lStep = lRange / (numberOfColors - 1);\n const lStart = (100 - lRange) * 0.5;\n const colorRange = range(lStart, lStart + numberOfColors * lStep, lStep);\n\n let offset = 0;\n\n if (!diverging) {\n offset = 9999;\n for (let i = 0; i < numberOfColors; i++) {\n const diff = l - colorRange[i];\n\n if (Math.abs(diff) < Math.abs(offset)) {\n offset = diff;\n }\n }\n }\n\n return colorRange.map((l) =>\n chroma.lab(l + offset, a, b).hex()\n ) as MoebiusColorValueHexType[];\n};\n/**\n * Generate an array of auto colors for luminance shift based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating auto colors.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the auto colors.\n * @param {number} [options.numberOfColors] - The number of auto colors to generate.\n * @param {boolean} [options.reverseDirection=false] - Whether to reverse the order of generated colors.\n * @param {boolean} [options.diverging=false] - Whether to generate diverging auto colors.\n * @param {string} [options.divergentColor] - The divergent color to include in the palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the auto colors.\n * @private\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const autoColors = luminanceShiftAutoColors(baseColor, { numberOfColors: 5 });\n * console.log(autoColors); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\nconst luminanceShiftAutoColors = (\n color: MoebiusColorValueHexType,\n options?: Partial<MoebiusPaletteOptionsType>\n) => {\n const {\n numberOfColors = 7,\n reverseDirection = false,\n diverging = false,\n divergentColor = '#f5f5f5'\n } = options || {};\n\n if (diverging) {\n const colors = generateLuminanceShiftPalette(chroma(color).hex(), {\n numberOfColors: Math.ceil((numberOfColors as number) / 2)\n }).concat(divergentColor);\n\n if (reverseDirection) colors.reverse();\n\n return colors;\n } else {\n return generateLuminanceShiftPalette(color, { numberOfColors });\n }\n};\n\n/**\n * Generate a luminance shift palette based on an array of colors, with optional diverging colors.\n *\n * @param {MoebiusChromaColorInputType[]} colors - Array of base colors for generating the luminance shift palette.\n * @param {MoebiusChromaColorInputType[]} [divergingColors=[]] - Array of diverging colors.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The total number of colors in the luminance shift palette.\n * @param {boolean} [options.diverging=false] - Whether to generate a diverging palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.\n * @param {string} [options.divergentColor='#f5f5f5'] - The divergent color for a diverging palette.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the luminance shift palette.\n *\n * @example\n * ```ts\n * const baseColors = ['#3498db', '#99db34'];\n * const divergingColors = ['#db3434'];\n * const luminanceShiftPalette = luminanceShift(baseColors, divergingColors, { numberOfColors: 5 });\n * console.log(luminanceShiftPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\nexport const luminanceShift = (\n colors: MoebiusColorValueHexType[],\n divergingColors: MoebiusColorValueHexType[] = [],\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n diverging = false,\n colorScaleMode = 'rgb',\n bezier = false,\n divergentColor = '#f5f5f5',\n correctLightness = true\n } = options || {};\n\n divergingColors =\n divergingColors.length === 0\n ? [harmonize(colors[0], 90, 270, 90)[3]]\n : divergingColors;\n\n const even = numberOfColors % 2 === 0;\n const numberOfColorsLeft = diverging\n ? Math.ceil(numberOfColors / 2) + (even ? 1 : 0)\n : numberOfColors;\n const numberOfColorsRight = diverging\n ? Math.ceil(numberOfColors / 2) + (even ? 1 : 0)\n : 0;\n const generatedColors =\n colors.length !== 1\n ? colors\n : luminanceShiftAutoColors(colors[0], {\n numberOfColors: numberOfColorsLeft,\n divergentColor\n });\n\n let generatedDivergentColors: MoebiusColorValueHexType[] = [];\n\n if (diverging) {\n generatedDivergentColors =\n divergingColors.length !== 1\n ? divergingColors\n : luminanceShiftAutoColors(divergingColors[0], {\n numberOfColors: numberOfColorsRight,\n divergentColor,\n reverseDirection: false,\n diverging\n });\n }\n\n let stepsLeft = colors.length\n ? (chroma\n .scale(generatedColors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColorsLeft) as MoebiusColorValueHexType[])\n : [];\n\n if (bezier) {\n stepsLeft = colors.length\n ? (chroma\n .bezier(generatedColors)\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColorsLeft) as MoebiusColorValueHexType[])\n : [];\n }\n\n let stepsRight =\n diverging && divergingColors.length\n ? (chroma\n .scale(generatedDivergentColors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColorsRight) as MoebiusColorValueHexType[])\n : [];\n\n if (bezier) {\n stepsRight =\n diverging && divergingColors.length\n ? (chroma\n .bezier(generatedDivergentColors)\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColorsRight) as MoebiusColorValueHexType[])\n : [];\n }\n\n let steps = stepsLeft;\n\n steps = (\n diverging\n ? stepsLeft.slice(\n 0,\n stepsLeft.length - (numberOfColorsLeft % 2 !== 0 ? 0 : 1)\n )\n : stepsLeft\n )\n //).concat(stepsRight.slice(1).reverse());\n .concat(stepsRight.reverse());\n\n return steps;\n};\n","/**\n * Generates an array of numbers within a specified range with a given interval.\n * @param {number} start - The starting value of the range.\n * @param {number} stop - The stopping value of the range.\n * @param {number} interval - The interval between numbers in the range.\n * @returns {number[]} - An array of numbers in the specified range.\n * @example\n * ```ts\n * const result = range(1, 10, 2);\n * console.log(result); // [1, 3, 5, 7, 9]\n * ```\n */\nexport const range = (\n start: number,\n stop: number,\n interval: number\n): number[] => {\n const a: number[] = [];\n\n for (let i = start; i < stop; i += interval) {\n a.push(i);\n }\n\n return a;\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusColorValueHexType, MoebiusPaletteOptionsType } from '../types';\n\n/**\n * Generates a color scale using Chroma.js's bezier interpolation.\n * @param {MoebiusColorValueHexType[]} colors - The input colors for the bezier interpolation.\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Options for generating the color scale.\n * @param {number} [options.numberOfColors=8] - The number of colors in the resulting scale.\n * @param {string} [options.colorScaleMode] - The color scale mode for Chroma.js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the color scale.\n * @returns {MoebiusColorValueHexType[]} - The generated color scale.\n * @example\n * ```ts\n * const inputColors = ['#3498db', '#2ecc71', '#e74c3c'];\n * const options = { numberOfColors: 5, colorScaleMode: 'lch', correctLightness: false };\n * const scaleColors = getChromaBezierScaleColors(inputColors, options);\n * console.log(scaleColors);\n * ```\n */\nexport const getChromaBezierScaleColors = (\n colors: MoebiusColorValueHexType[],\n options?: MoebiusPaletteOptionsType\n) => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n\n try {\n return chroma\n .bezier(colors)\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n } catch {\n return [];\n }\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusColorValueHexType, MoebiusPaletteOptionsType } from '../types';\n\n/**\n * Generates a color scale using Chroma.js.\n * @param {MoebiusColorValueHexType[]} colors - The input colors for the color scale.\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Options for generating the color scale.\n * @param {number} [options.numberOfColors=8] - The number of colors in the resulting scale.\n * @param {string} [options.colorScaleMode] - The color scale mode for Chroma.js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the color scale.\n * @returns {MoebiusColorValueHexType[]} - The generated color scale.\n * @example\n * ```ts\n * const inputColors = ['#3498db', '#2ecc71', '#e74c3c'];\n * const options = { numberOfColors: 5, colorScaleMode: 'lch', correctLightness: false };\n * const scaleColors = getChromaScaleColors(inputColors, options);\n * console.log(scaleColors);\n * ```\n */\nexport const getChromaScaleColors = (\n colors: MoebiusColorValueHexType[],\n options?: MoebiusPaletteOptionsType\n) => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n\n try {\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n } catch {\n return [];\n }\n};\n","/* eslint-disable @stylistic/indent */\nimport { monochromatic } from '../features';\nimport {\n MoebiusColorValueHexType,\n MoebiusPaletteAccentColorsInterface,\n MoebiusPaletteColorsInterface,\n MoebiusPaletteOptionsType\n} from '../types';\n\n/**\n * Class representing a set of accent colors in various palettes.\n */\nexport class MoebiusAccentColors\n implements MoebiusPaletteAccentColorsInterface\n{\n interpolate: MoebiusColorValueHexType[][];\n luminanceShift: MoebiusColorValueHexType[][];\n monochromatic: MoebiusColorValueHexType[][];\n complement: MoebiusColorValueHexType[][];\n split: MoebiusColorValueHexType[][];\n triadic: MoebiusColorValueHexType[][];\n tetradic: MoebiusColorValueHexType[][];\n pentadic: MoebiusColorValueHexType[][];\n hexadic: MoebiusColorValueHexType[][];\n analogous: MoebiusColorValueHexType[][];\n\n /**\n * Creates an instance of MoebiusAccentColors.\n * @param {MoebiusPaletteColorsInterface} colors - Base colors for accent palettes.\n * @param {MoebiusPaletteOptionsType} options - Options for generating accent palettes.\n * @example\n * ```ts\n * const colors = {\n * monochromatic: ['#ff0000', '#00ff00'],\n * // other base palettes...\n * };\n * const options = { baseColor: { color: '#ff0000', name: 'Red', hex: '#ff0000' }, numberOfColors: 9 };\n * const accentColors = new MoebiusAccentColors(colors, options);\n * ```\n */\n constructor(\n colors: MoebiusPaletteColorsInterface,\n options: MoebiusPaletteOptionsType\n ) {\n Object.keys(colors).forEach((palette) => {\n this[palette] = colors[palette].map((color: MoebiusColorValueHexType) =>\n monochromatic(color, { ...options, numberOfColors: 9 })\n );\n });\n }\n /**\n * Converts the accent palettes to a flat array.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values.\n * @example\n * ```ts\n * const accentColors = new MoebiusAccentColors(baseColors, options);\n * const flatArray = accentColors.toArray();\n * console.log(flatArray); // ['#ff0000', '#00ff00', ...]\n * ```\n */\n toArray(): MoebiusColorValueHexType[] {\n return [\n ...this.interpolate,\n ...this.luminanceShift,\n ...this.monochromatic,\n ...this.complement,\n ...this.split,\n ...this.triadic,\n ...this.tetradic,\n ...this.pentadic,\n ...this.hexadic,\n ...this.analogous\n ].flat();\n }\n}\n","import {\n MoebiusColorValueHexType,\n MoebiusPaletteColorsInterface\n} from '../types';\n\n/**\n * Class representing a set of colors in various palettes.\n */\nexport class MoebiusPaletteColors implements MoebiusPaletteColorsInterface {\n interpolate: MoebiusColorValueHexType[];\n luminanceShift: MoebiusColorValueHexType[];\n monochromatic: MoebiusColorValueHexType[];\n complement: MoebiusColorValueHexType[];\n split: MoebiusColorValueHexType[];\n triadic: MoebiusColorValueHexType[];\n tetradic: MoebiusColorValueHexType[];\n pentadic: MoebiusColorValueHexType[];\n hexadic: MoebiusColorValueHexType[];\n analogous: MoebiusColorValueHexType[];\n\n /**\n * Creates an instance of MoebiusPaletteColors.\n * @param {MoebiusPaletteColorsInterface} colors - Palette colors to initialize with.\n * @example\n * ```ts\n * const colors = {\n * interpolate: ['#ff0000', '#00ff00'],\n * // other palettes...\n * };\n * const palette = new MoebiusPaletteColors(colors);\n * ```\n */\n constructor(colors: MoebiusPaletteColorsInterface) {\n Object.keys(colors).forEach((palette) => {\n this[palette] = colors[palette];\n });\n }\n\n /**\n * Converts the palettes to a flat array.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values.\n * @example\n * ```ts\n * const palette = new MoebiusPaletteColors({ interpolate: ['#ff0000', '#00ff00'] });\n * const flatArray = palette.toArray();\n * console.log(flatArray); // ['#ff0000', '#00ff00']\n * ```\n */\n toArray(): MoebiusColorValueHexType[] {\n return [\n ...this.interpolate,\n ...this.luminanceShift,\n ...this.monochromatic,\n ...this.complement,\n ...this.split,\n ...this.triadic,\n ...this.tetradic,\n ...this.pentadic,\n ...this.hexadic,\n ...this.analogous\n ].flat();\n }\n}\n","import {\n MoebiusColorValueHexType,\n MoebiusThemeColorsInterface\n} from '../types';\n\n/**\n * Class representing a set of colors in various themes.\n */\nexport class MoebiusThemeColors implements MoebiusThemeColorsInterface {\n darkMode: Record<string, MoebiusColorValueHexType[]>;\n\n /**\n * Creates an instance of MoebiusThemeColors.\n * @param {MoebiusThemeColorsInterface} colors - Palette colors to initialize with.\n * @example\n * ```ts\n * const colors = {\n * interpolate: ['#ff0000', '#00ff00'],\n * // other themes...\n * };\n * const theme = new MoebiusThemeColors(colors);\n * ```\n */\n constructor(colors: MoebiusThemeColorsInterface) {\n Object.keys(colors).forEach((theme) => {\n this[theme] = colors[theme];\n });\n }\n}\n","import { MOEBIUS_PALETTE_DEFAULT_OPTIONS } from '../constants';\nimport * as FEATURES from '../features';\nimport {\n MoebiusColorValueHexType,\n MoebiusColorInterface,\n MoebiusPaletteAccentColorsInterface,\n MoebiusPaletteColorsInterface,\n MoebiusPaletteDefaultOptionsType,\n MoebiusPaletteOptionsType,\n MoebiusPaletteInterface,\n MoebiusChromaColorInputType,\n MoebiusThemeColorsInterface\n} from '../types';\n\nimport { MoebiusAccentColors } from './MoebiusAccentColors';\nimport { MoebiusPaletteColors } from './MoebiusPaletteColors';\nimport { MoebiusThemeColors } from './MoebiusThemeColors';\n\n/**\n * MoebiusPalettes class representing a set of color palettes and their variations.\n *\n */\nexport class MoebiusPalettes implements MoebiusPaletteInterface {\n baseColor: MoebiusColorInterface;\n secondaryColor: MoebiusColorInterface;\n colors: MoebiusPaletteColorsInterface;\n themes: MoebiusThemeColorsInterface;\n defaultOptions: MoebiusPaletteDefaultOptionsType = {\n ...MOEBIUS_PALETTE_DEFAULT_OPTIONS,\n divergentColor: '#f5f5f5'\n };\n options: MoebiusPaletteOptionsType;\n all: MoebiusColorValueHexType[] = [];\n accents: MoebiusPaletteAccentColorsInterface;\n\n /**\n * Creates an instance of MoebiusPalettes.\n * @param {MoebiusPaletteOptionsType} options - Options for configuring the palettes.\n */\n constructor(options: MoebiusPaletteOptionsType) {\n this.options = { ...this.defaultOptions, ...options };\n this.baseColor = this.options.baseColor;\n this.secondaryColor = this.options.secondaryColor;\n this.themes = new MoebiusThemeColors({\n darkMode: this.darkMode(this.baseColor.hex, this.secondaryColor.hex, {\n ...this.options,\n reverseDirection: !this.options.reverseDirection\n })\n });\n this.colors = new MoebiusPaletteColors({\n interpolate: this.interpolate(\n this.baseColor.hex,\n this.secondaryColor.hex,\n this.options\n ),\n luminanceShift: this.luminanceShift(\n [this.baseColor.hex],\n [this.secondaryColor.hex],\n this.options\n ),\n monochromatic: this.monochromatic(this.baseColor.hex),\n complement: this.complement(this.baseColor.hex),\n split: this.split(this.baseColor.hex),\n triadic: this.triadic(this.baseColor.hex),\n tetradic: this.tetradic(this.baseColor.hex),\n pentadic: this.pentadic(this.baseColor.hex),\n hexadic: this.hexadic(this.baseColor.hex),\n analogous: this.analogous(this.baseColor.hex)\n });\n\n this.accents = new MoebiusAccentColors(this.colors, this.options);\n\n this.all = [\n ...new Set(\n [\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(this.accents as any).toArray(),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(this.colors as any).toArray()\n ].flat()\n )\n ];\n }\n\n /**\n * Generate a complement color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the complement palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.<\n * @param {number} [options.numberOfColors=8] - The number of colors in the complement palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the complement palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const complementPalette = complement(baseColor, { numberOfColors: 5 });\n * console.log(complementPalette); // ['#3498db', '#db3434', '#75db34', '#dbd134', '#db7434']\n * ```\n */\n complement(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.complement(color, currentOptions);\n }\n\n /**\n * Generates a dark mode color palette based on the provided base and secondary colors.\n * @param {MoebiusChromaColorInputType} baseColor - The base color for the palette.\n * @param {MoebiusChromaColorInputType} secondaryColor - The secondary color for the palette.\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Palette options.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation for color scales.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma.mix.\n * @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors from the palette.\n * @returns {Record<string, MoebiusColorValueHexType[]>} - The generated dark mode color palette.\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const secondaryColor = '#2ecc71';\n * const options = { bezier: true, colorScaleMode: 'lch' };\n * const palette = darkMode(baseColor, secondaryColor, options);\n * console.log(palette);\n * ```\n */\n darkMode(\n baseColor: MoebiusChromaColorInputType,\n secondaryColor: MoebiusChromaColorInputType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): Record<string, MoebiusColorValueHexType[]> {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.darkMode(baseColor, secondaryColor, currentOptions);\n }\n\n /**\n * Generate a split color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the split palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the split palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the split palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const splitPalette = split(baseColor, { numberOfColors: 5 });\n * console.log(splitPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\n split(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.split(color, currentOptions);\n }\n\n /**\n * Generates a triadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in various formats (HEX, RGB, HSL, etc.).\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} options - Additional options for palette generation.\n * @param {number} [options.numberOfColors=8] - The number of colors in the generated palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for the generated palette.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} An array of HEX values representing the triadic color palette.\n *\n * @example\n * ```ts\n * const triadicPalette = triadic('#3498db', { numberOfColors: 5 });\n * console.log(triadicPalette);\n * // Output: ['#3498db', '#db344f', '#4fdb34', '#9834db', '#34db98']\n * ```\n */\n triadic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.triadic(color, currentOptions);\n }\n\n /**\n * Generate a tetradic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the tetradic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the tetradic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the tetradic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const tetradicPalette = tetradic(baseColor, { numberOfColors: 5 });\n * console.log(tetradicPalette); // ['#3498db', '#db3434', '#34db99', '#dbd134', '#8f34db']\n * ```\n */\n tetradic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.tetradic(color, currentOptions);\n }\n\n /**\n * Generate a pentadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the pentadic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the pentadic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the pentadic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const pentadicPalette = pentadic(baseColor, { numberOfColors: 5 });\n * console.log(pentadicPalette); // ['#3498db', '#dbd134', '#db3434', '#34db99', '#8f34db']\n * ```\n */\n pentadic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.pentadic(color, currentOptions);\n }\n\n /**\n * Generate a hexadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the hexadic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the hexadic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the hexadic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const hexadicPalette = hexadic(baseColor, { numberOfColors: 5 });\n * console.log(hexadicPalette); // ['#3498db', '#5d7f33', '#8473a9', '#ad7a95', '#db3434']\n * ```\n */\n hexadic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.hexadic(color, currentOptions);\n }\n\n /**\n * Generate an analogous color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the analogous palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the analogous palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the analogous palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const analogousPalette = analogous(baseColor, { numberOfColors: 5 });\n * console.log(analogousPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#db3474']\n * ```\n */\n analogous(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.analogous(color, currentOptions);\n }\n\n /**\n * Interpolate between two colors and generate a color palette.\n *\n * @param {MoebiusChromaColorInputType} primaryColor - The starting color for interpolation.\n * @param {MoebiusChromaColorInputType} secondaryColor - The ending color for interpolation.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the interpolated palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the interpolated palette.\n *\n * @example\n * ```ts\n * const startColor = '#3498db';\n * const endColor = '#db3434';\n * const interpolatedPalette = interpolate(startColor, endColor, { numberOfColors: 5 });\n * console.log(interpolatedPalette); // ['#3498db', '#5d6d7e', '#8473a9', '#ad7a95', '#db3434']\n * ```\n */\n interpolate(\n primaryColor: MoebiusColorValueHexType,\n secondaryColor: MoebiusColorValueHexType,\n options?: MoebiusPaletteOptionsType\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...(options || {}) };\n\n return FEATURES.interpolate(primaryColor, secondaryColor, currentOptions);\n }\n /**\n * Generate a luminance shift palette based on an array of colors, with optional diverging colors.\n *\n * @param {MoebiusChromaColorInputType[]} colors - Array of base colors for generating the luminance shift palette.\n * @param {MoebiusChromaColorInputType[]} [divergingColors=[]] - Array of diverging colors.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The total number of colors in the luminance shift palette.\n * @param {boolean} [options.diverging=false] - Whether to generate a diverging palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.\n * @param {string} [options.divergentColor='#f5f5f5'] - The divergent color for a diverging palette.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the luminance shift palette.\n *\n * @example\n * ```ts\n * const baseColors = ['#3498db', '#99db34'];\n * const divergingColors = ['#db3434'];\n * const luminanceShiftPalette = luminanceShift(baseColors, divergingColors, { numberOfColors: 5 });\n * console.log(luminanceShiftPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\n luminanceShift(\n colors: MoebiusColorValueHexType[],\n divergingColors: MoebiusColorValueHexType[] = [],\n\n options?: MoebiusPaletteOptionsType\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...(options || {}) };\n\n return FEATURES.luminanceShift(colors, divergingColors, currentOptions);\n }\n\n /**\n * Generates a monochromatic color palette based on the given color.\n * @param {MoebiusChromaColorInputType} color - The base color for the palette.\n * @param {MoebiusPaletteOptionsType} options - Options for generating the palette.\n * @returns {MoebiusColorValueHexType[]} - An array of hex color values in the palette.\n * @example\n * ```typescript\n * const baseColor = '#003f5c';\n * const options = { numberOfColors: 5, bezier: true, randomOffset: false };\n * const monochromaticPalette = monochromatic(baseColor, options);\n * console.log(monochromaticPalette);\n * [\n * '#003f5c', // maniacMansion,\n * '#014268', // darkImperialBlue,\n * '#024575', // macraggeBlue,\n * '#044784', // bridgeport,\n * '#064898', // frightNight,\n * '#0745b6', // absoluteZero,\n * '#002df5', // blueBouquet\n * ];\n * ```\n */\n monochromatic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.monochromatic(color, currentOptions);\n }\n /**\n * Generate a harmonized color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the harmonized palette.\n * @param {number} start - The starting angle for generating harmonized colors (degrees).\n * @param {number} end - The ending angle for generating harmonized colors (degrees).\n * @param {number} interval - The interval between harmonized colors (degrees).\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors in the palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the harmonized palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const harmonizedPalette = harmonize(baseColor, 30, 210, 30, { noDuplicates: true });\n * console.log(harmonizedPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#3498db']\n * ```\n */\n harmonize(\n color: MoebiusColorValueHexType,\n start: number,\n end: number,\n interval: number,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.harmonize(color, start, end, interval, currentOptions);\n }\n}\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a complement color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the complement palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the complement palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the complement palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const complementPalette = complement(baseColor, { numberOfColors: 5 });\n * console.log(complementPalette); // ['#3498db', '#db3434', '#75db34', '#dbd134', '#db7434']\n * ```\n */\nexport const complement = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a complement color scheme.\n const colors = harmonize(color, 180, 180, 1);\n\n // Use chroma-js to fill in missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\nimport { getChromaBezierScaleColors } from '../utils/get-chroma-bezier-scale-colors';\nimport { getChromaScaleColors } from '../utils/get-chroma-scale-colors';\n\nimport { monochromatic } from './monochromatic';\n\n/**\n * Generates a dark mode color palette based on the provided base and secondary colors.\n * @param {MoebiusChromaColorInputType} baseColor - The base color for the palette.\n * @param {MoebiusChromaColorInputType} secondaryColor - The secondary color for the palette.\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Palette options.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation for color scales.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma.mix.\n * @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors from the palette.\n * @returns {Record<string, MoebiusColorValueHexType[]>} - The generated dark mode color palette.\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const secondaryColor = '#2ecc71';\n * const options = { bezier: true, colorScaleMode: 'lch' };\n * const palette = darkMode(baseColor, secondaryColor, options);\n * console.log(palette);\n * ```\n */\nexport const darkMode = (\n baseColor: MoebiusChromaColorInputType,\n secondaryColor: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): Record<string, MoebiusColorValueHexType[]> => {\n const {\n bezier = false,\n colorScaleMode = 'rgb',\n noDuplicates = true\n } = options || {};\n const ratio = 0.99;\n const ratioMultiplier = 0.02;\n const primaryAccents = monochromatic(baseColor, options);\n const surfaceAccents = monochromatic(secondaryColor, options);\n const mixedAccents = surfaceAccents.map((hex, index) => {\n return chroma\n .mix(\n primaryAccents[index],\n hex,\n ratio - index * ratioMultiplier,\n colorScaleMode\n )\n .hex() as unknown as MoebiusColorValueHexType;\n });\n const palette = {\n primary: primaryAccents,\n surface: surfaceAccents,\n mixed: mixedAccents\n };\n\n if (noDuplicates) {\n palette.primary = [...new Set(primaryAccents)];\n palette.surface = [...new Set(surfaceAccents)];\n palette.mixed = [...new Set(mixedAccents)];\n }\n\n if (bezier) {\n if (\n palette.primary.length > 1 &&\n palette.surface.length > 1 &&\n palette.mixed.length > 1\n ) {\n palette.primary = getChromaBezierScaleColors(palette.primary, options);\n palette.surface = getChromaBezierScaleColors(palette.surface, options);\n palette.mixed = getChromaBezierScaleColors(palette.mixed, options);\n } else {\n palette.primary = getChromaScaleColors(palette.primary, options);\n palette.surface = getChromaScaleColors(palette.surface, options);\n palette.mixed = getChromaScaleColors(palette.mixed, options);\n }\n }\n\n return palette;\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a split color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the split palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the split palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the split palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const splitPalette = split(baseColor, { numberOfColors: 5 });\n * console.log(splitPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\nexport const split = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a split color scheme.\n const colors = harmonize(color, 150, 210, 60);\n\n // Use chroma-js to fill in the missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generates a triadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in various formats (HEX, RGB, HSL, etc.).\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} options - Additional options for palette generation.\n * @param {number} [options.numberOfColors=8] - The number of colors in the generated palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for the generated palette.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} An array of HEX values representing the triadic color palette.\n *\n * @example\n * ```ts\n * const triadicPalette = triadic('#3498db', { numberOfColors: 5 });\n * console.log(triadicPalette);\n * // Output: ['#3498db', '#db344f', '#4fdb34', '#9834db', '#34db98']\n * ```\n */\nexport const triadic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n const colors = harmonize(color, 120, 240, 120);\n\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a tetradic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the tetradic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the tetradic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the tetradic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const tetradicPalette = tetradic(baseColor, { numberOfColors: 5 });\n * console.log(tetradicPalette); // ['#3498db', '#db3434', '#34db99', '#dbd134', '#8f34db']\n * ```\n */\nexport const tetradic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a tetradic color scheme.\n const colors = harmonize(color, 90, 270, 90);\n\n // Use chroma-js to fill in the missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a pentadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the pentadic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the pentadic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the pentadic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const pentadicPalette = pentadic(baseColor, { numberOfColors: 5 });\n * console.log(pentadicPalette); // ['#3498db', '#dbd134', '#db3434', '#34db99', '#8f34db']\n * ```\n */\nexport const pentadic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a pentadic color scheme.\n const colors = harmonize(color, 144, 360, 72);\n\n // Use chroma-js to fill in colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a hexadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the hexadic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the hexadic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the hexadic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const hexadicPalette = hexadic(baseColor, { numberOfColors: 5 });\n * console.log(hexadicPalette); // ['#3498db', '#5d7f33', '#8473a9', '#ad7a95', '#db3434']\n * ```\n */\nexport const hexadic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a hexadic color scheme.\n const colors = harmonize(color, 120, 360, 60);\n\n // Use chroma-js to fill in missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate an analogous color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the analogous palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the analogous palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the analogous palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const analogousPalette = analogous(baseColor, { numberOfColors: 5 });\n * console.log(analogousPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#db3474']\n * ```\n */\nexport const analogous = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate an analogous color scheme.\n const colors = harmonize(color, 30, 90, 30);\n\n // Use chroma-js to fill in the missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusColorValueHexType, MoebiusPaletteOptionsType } from '../types';\n\n/**\n * Interpolate between two colors and generate a color palette.\n *\n * @param {MoebiusColorValueHexType} primaryColor - The starting color for interpolation.\n * @param {MoebiusColorValueHexType} secondaryColor - The ending color for interpolation.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the interpolated palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the interpolated palette.\n *\n * @example\n * ```ts\n * const startColor = '#3498db';\n * const endColor = '#db3434';\n * const interpolatedPalette = interpolate(startColor, endColor, { numberOfColors: 5 });\n * console.log(interpolatedPalette); // ['#3498db', '#5d6d7e', '#8473a9', '#ad7a95', '#db3434']\n * ```\n */\nexport const interpolate = (\n primaryColor: MoebiusColorValueHexType,\n secondaryColor: MoebiusColorValueHexType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n bezier = false,\n correctLightness = true\n } = options || {};\n\n let colors = chroma\n .scale([primaryColor, secondaryColor])\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n\n if (bezier) {\n colors = chroma\n .bezier([primaryColor, secondaryColor])\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n }\n\n return colors;\n};\n","import { MoebiusColorValueHexType } from '../types';\nimport { getStartMaskDegree } from '../utils/svg/get-start-mask-degree';\nimport { pieSlice } from '../utils/svg/pie-slice';\nimport { uniqueID } from '../utils/unique-id';\n\n/**\n * Helper class for generating SVG paths for colored pie slices.\n */\nexport class MoebiusSVGHelper {\n xlmns = 'http://www.w3.org/2000/svg';\n\n /**\n * Gets SVG paths for coloured pie slices based on the provided colors.\n * @param {MoebiusColorValueHexType[][]} colors - Array of color groups.\n * @param {number} [size=256] - Size of the SVG.\n * @returns {DocumentFragment} - Document fragment containing the SVG paths.\n * @example\n * ```ts\n * const svgHelper = new MoebiusSVGHelper();\n * const colors = [['#ff0000', '#00ff00'], ['#0000ff']];\n * const svgFragment = svgHelper.getColorPiePaths(colors, 256);\n * document.body.appendChild(svgFragment);\n * ```\n */\n getColorPiePaths(\n colors: MoebiusColorValueHexType[][],\n size: number = 256\n ): DocumentFragment {\n const df = document.createDocumentFragment();\n const defsElement = document.createElementNS(this.xlmns, 'defs');\n const maskElement = document.createElementNS(this.xlmns, 'mask');\n const rectElement = document.createElementNS(this.xlmns, 'rect');\n const gElement = document.createElementNS(this.xlmns, 'g');\n const interval = 360 / colors.length;\n const id = uniqueID();\n\n maskElement.setAttributeNS(null, 'id', id);\n rectElement.setAttributeNS(null, 'height', '100%');\n rectElement.setAttributeNS(null, 'width', '100%');\n rectElement.setAttributeNS(null, 'fill', 'white');\n gElement.setAttributeNS(null, 'mask', `url(#${id})`);\n maskElement.appendChild(rectElement);\n\n const maskDegrees = 360 / colors.length;\n const startMaskDegree = getStartMaskDegree(maskDegrees / 2, colors.length);\n\n for (let i = startMaskDegree; i < 360; i += maskDegrees) {\n const lineElement = document.createElementNS(this.xlmns, 'line');\n\n lineElement.setAttributeNS(null, 'x1', '128');\n lineElement.setAttributeNS(null, 'y1', '128');\n lineElement.setAttributeNS(null, 'x2', '0');\n lineElement.setAttributeNS(null, 'y2', '128');\n lineElement.setAttributeNS(null, 'stroke', 'black');\n lineElement.setAttributeNS(null, 'stroke-width', '6');\n lineElement.setAttributeNS(null, 'transform', `rotate(${i} 128 128)`);\n maskElement.appendChild(lineElement);\n }\n\n let start = 0;\n\n colors.forEach((group: string[]) => {\n const inwardInterval = size / 2 / group.length;\n\n start += interval;\n\n return group.forEach((color: MoebiusColorValueHexType, index: number) => {\n const r = size / 2 - index * inwardInterval;\n const path = document.createElementNS(this.xlmns, 'path');\n\n path.setAttributeNS(null, 'fill', color);\n path.setAttributeNS(null, 'data-color-hex', color);\n path.setAttributeNS(null, 'data-r', `${r}`);\n path.setAttributeNS(null, 'd', pieSlice(start, interval, r));\n gElement.appendChild(path);\n });\n });\n defsElement.appendChild(maskElement);\n df.appendChild(defsElement);\n df.appendChild(gElement);\n\n return df;\n }\n}\n","/**\n * Generates a unique identifier.\n * @returns {string} - A unique identifier.\n * @example\n * ```ts\n * const id = uniqueID();\n * console.log(id); // \"_abc123\"\n * ```\n */\nexport const uniqueID = (): string =>\n '_' + Math.random().toString(36).substring(2, 11);\n","/**\n * Calculates the starting mask degree based on the number of elements in a color group.\n *\n * @param {number} initial - The initial starting degree.\n * @param {number} length - The number of elements in the color group.\n * @returns {number} - The adjusted starting degree for creating a color mask.\n */\nexport const getStartMaskDegree = (initial: number, length: number): number => {\n if (length === 4 || length === 8 || length === 12) {\n return 0;\n } else if (length === 3 || length === 9) {\n return 30;\n } else if (length === 7) {\n return 12;\n } else if (length === 5) {\n return 55;\n }\n\n return initial;\n};\n","/**\n * Generates an SVG path representing a pie slice.\n *\n * @param {number} start - Starting angle of the pie slice in degrees.\n * @param {number} interval - Angular interval of the pie slice in degrees.\n * @param {number} radius - Radius of the circle.\n * @param {number} size - Size of the circle. Default is 256.\n * @returns {string} - SVG path representing the pie slice.\n */\nexport const pieSlice = (\n start: number,\n interval: number,\n radius: number,\n size: number = 256\n): string => {\n const centerX = size / 2; // X-coordinate of the circle's center\n const centerY = centerX; // Y-coordinate of the circle's center\n\n let stop = start + interval;\n\n // Ensure start is smaller than stop\n if (start > stop) {\n const temp = start;\n\n start = stop;\n stop = temp;\n }\n\n // Calculate start and end points\n const startX = centerX + radius * Math.cos((-start + 90) * (Math.PI / 180));\n const startY = centerY + radius * Math.sin((-start + 90) * (Math.PI / 180));\n const endX = centerX + radius * Math.cos((-stop + 90) * (Math.PI / 180));\n const endY = centerY + radius * Math.sin((-stop + 90) * (Math.PI / 180));\n const largeArcFlag = stop - start <= 180 ? '0' : '1';\n\n // Create the SVG path\n return `M ${startX} ${startY} A ${radius} ${radius} 0 ${largeArcFlag} 0 ${endX} ${endY} L ${centerX} ${centerY} Z`;\n};\n","/* eslint-disable import/no-unused-modules */\nimport { isString } from '@phun-ky/typeof';\nimport chroma from 'chroma-js';\nimport nearestColor from 'nearest-color';\n\nimport { MoebiusColor } from './classes/MoebiusColor';\nimport { MoebiusPalettes } from './classes/MoebiusPalettes';\nimport { MoebiusSVGHelper } from './classes/MoebiusSVGHelper';\nimport {\n MoebiusColorValueHexType,\n MoebiusReturnType,\n NearestColorColorMatchInterface\n} from './types';\n\nexport type * from './types';\n\n/**\n * Initializes a color name mapping using an external API.\n * The resulting function takes a color (hex or keyword) and returns either:\n * - The matched color name (as a string)\n * - An object with `name`, `value`, and other nearest match metadata\n *\n * @async\n * @function initializeColorNames\n * @returns A function that maps color strings to the nearest known color\n *\n * @example\n * ```ts\n * const getColorName = await initializeColorNames();\n * const match = getColorName('#ffcc00');\n * console.log(match); // { name: 'gold', value: '#ffd700', distance: 3.2, ... }\n * ```\n */\nconst initializeColorNames = async (): Promise<\n (color: string) => NearestColorColorMatchInterface | string\n> => {\n const response = await fetch('https://color-names.herokuapp.com/v1/');\n const data = await response.json();\n const colors = data.colors;\n const map = {};\n\n colors.forEach((entry: Record<string, unknown>) => {\n map[entry.name as string] = entry.hex;\n });\n\n return nearestColor.from(map);\n};\n\n/**\n * Initializes and returns Moebius utilities with dynamic color naming support.\n *\n * This includes:\n * - A subclass of `MoebiusColor` with nearest color name mapping\n * - `MoebiusPalettes` for generating color palettes\n * - `MoebiusSVGHelper` for generating SVG paths for colored pie slices.\n *\n * @function\n * @async\n * @returns {Promise<MoebiusReturnType>} An object containing Moebius utility classes\n *\n * @example\n * ```ts\n * const moebius = await Moebius();\n * const color = new moebius.MoebiusColor('#abc123');\n * console.log(color.name); // Closest color name, e.g., 'Avocado'\n * ```\n */\nasync function Moebius(): MoebiusReturnType {\n const colorNames = await initializeColorNames();\n\n /**\n * Extended version of `MoebiusColor` that assigns a nearest color name\n * using the initialized color name map.\n */\n class MoebiusColorAbstract extends MoebiusColor {\n constructor(color: MoebiusColorValueHexType) {\n super(\n chroma(color).hex(),\n isString(colorNames(color))\n ? (colorNames(color) as string)\n : (colorNames(color) as NearestColorColorMatchInterface).name\n );\n }\n }\n\n return {\n MoebiusColor: MoebiusColorAbstract as typeof MoebiusColor,\n MoebiusPalettes,\n MoebiusSVGHelper\n };\n}\n\nexport default Moebius;\n","/**\n* @phun-ky/typeof\n* A set of JavaScript helper functions to check for types\n* @author Alexander Vassbotn Røyne-Helgesen <alexander@phun-ky.net>\n* @version 2.1.3\n* @license\n* Copyright (c) 2024 Alexander Vassbotn Røyne-Helgesen\n*\n* Permission is hereby granted, free of charge, to any person obtaining a copy\n* of this software and associated documentation files (the \"Software\"), to deal\n* in the Software without restriction, including without limitation the rights\n* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n* copies of the Software, and to permit persons to whom the Software is\n* furnished to do so, subject to the following conditions:\n*\n* The above copyright notice and this permission notice shall be included in all\n* copies or substantial portions of the Software.\n*\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n* SOFTWARE.\n*/\nfunction t(t){return\"string\"==typeof t}function r(r){return!t(r)}function n(t){return\"number\"==typeof t}function e(t){return!n(t)}function o(t){return\"boolean\"==typeof t}function c(t){return!o(t)}function u(t){return void 0===t}function f(t){return!u(t)}function i(t){return!u(t)}function p(t){if(\"[object Object]\"!==Object.prototype.toString.call(t))return!1;const r=Object.getPrototypeOf(t);return r===Object.prototype||null===r}function y(t){if(\"object\"!=typeof t||null===t)return!1;if(\"[object Object]\"!==Object.prototype.toString.call(t))return!1;const r=Object.getPrototypeOf(t);if(null===r)return!0;const n=Object.prototype.hasOwnProperty.call(r,\"constructor\")?r.constructor:null;return\"function\"==typeof n&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(t)}function l(t){const r=typeof t;return null!==t&&(\"object\"===r||\"function\"===r)}function a(t){if(\"function\"!=typeof t)return!1;if(b(t))return!1;try{const r=Object.getOwnPropertyDescriptor(t,\"prototype\");return!!r&&!r.writable}catch{return!1}}function b(t){if(\"function\"!=typeof t)return!1;return[Object,Array,Function,String,Number,Boolean,Date,RegExp,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,Map,WeakMap,Set,WeakSet,Promise].includes(t)}const O=new Set([Object,Array,Function,String,Number,Boolean,Date,RegExp,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,Map,WeakMap,Set,WeakSet,Promise,BigInt,Symbol]);function j(t){return\"function\"==typeof t&&O.has(t)}function E(t){return\"object\"==typeof t&&null!==t&&Object.getPrototypeOf(t)!==Object.prototype&&null!==Object.getPrototypeOf(t)}function s(t){return\"function\"==typeof t}export{o as isBoolean,j as isBuiltInCallable,b as isBuiltInConstructor,a as isClass,i as isDefined,s as isFunction,E as isInstanceOfUnknownClass,c as isNotBoolean,e as isNotNumber,r as isNotString,f as isNotUndefined,n as isNumber,l as isObjectLoose,p as isObjectPlain,y as isObjectStrict,t as isString,u as isUndefined};\n//# sourceMappingURL=typeof.js.map\n"],"names":["min","max","Math","limit","x","low","high","clip_rgb","rgb","_clipped","_unclipped","slice","i","classToType","name","toLowerCase","type","obj","Object","prototype","toString","call","unpack","args","keyOrder","length","Array","split","filter","k","undefined","map","last","l","PI","rnd2","a","round","rnd3","TWOPI","PITHIRD","DEG2RAD","RAD2DEG","reverse3","arr","reverse","input","format","autodetect","Color","constructor","me","this","mode","_input","sorted","sort","b","p","chk","test","Error","apply","_rgb","push","hex","join","chroma","version","w3cx11","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","laserlemon","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrod","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","maroon2","maroon3","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","purple2","purple3","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","RE_HEX","RE_HEXA","hex2rgb","match","substr","u","parseInt","rgb2hex","r","g","str","hxa","n","keys","named","h","rest","alpha","mutate","clipped","labConstants","Kn","labWhitePoint","Xn","Yn","Zn","kE","kKE","kK","RefWhiteRGB","X","Y","Z","MtxRGB2XYZ","m00","m01","m02","m10","m11","m12","m20","m21","m22","MtxXYZ2RGB","As","Bs","Cs","MtxAdaptMa","MtxAdaptMaI","ILLUMINANTS","Map","setLabWhitePoint","ill","get","String","getLabWhitePoint","lab2rgb","L","y","z","lab2xyz","b_","xyz2rgb","LAB_CONSTANTS","fy","fx","fz","fx3","fz3","pow","compand","linear","sign","abs","Ad","Bd","Cd","X1","Y1","Z1","X2","Y2","Z2","rgb2lab","rgb2xyz","xr","yr","zr","xyz2lab","gammaAdjustSRGB","companded","lab","assign","darken","amount","brighten","darker","brighter","mc","channel","src","indexOf","luminance","lum","cur_lum","max_iter","mid","interpolate","lm","rgb2luminance","luminance_x","index","mix","col1","col2","f","interpolator","premultiply","sin","cos","lch2lab","c","isNaN","lch2rgb","sqrt","atan2","lab2lch","Number","NaN","rgb2lch","lch","hcl","forEach","m","saturate","desaturate","set","value","charAt","out","tint","shade","xyz0","xyz1","lrgb","x1","y1","z1","x2","y2","z2","interpolate_hsx","hue0","hue1","sat0","sat1","lbv0","lbv1","sat","hue","lbv","dh","hsl","hsv","hcg","hsi","oklch","num","rgb2num","c1","c2","floor","minRgb","maxRgb","delta","_g","rgb2hcg","_c","q","t","v","acos","min_","s","rgb2hsi","hsl2rgb","t3","t2","t1","h_","rgb2hsl","max_","rgb2hsv","multiplyMatrices","A","B","isArray","B_cols","_","product","row","col","reduce","oklab2rgb","LMStoXYZ","LMSnl","rgb2oklab","XYZ","LMStoOKLab","LMS","cbrt","XYZ_to_OKLab","oklab","_average_lrgb","colors","weights","xyz","scale","_mode","_nacol","_spread","_positions","_domain","_pos","_padding","_classes","_colors","_out","_min","_max","_correctLightness","_colorCache","_useCache","_gamma","setColors","brewer","resetCache","tMapLightness","tMapDomain","getColor","val","bypassMap","getClass","classes","d","analyze","limits","domain","arguments","from","tOut","tBreaks","every","_m","range","_o","spread","correctLightness","L0","L1","pol","L_actual","L_ideal","L_diff","t0","padding","numColors","result","dm","dd","left","right","ascending","end","__range__","samples","asc","cache","gamma","nodata","rnd","rgba","blend","bottom","top","blend_f","c0","each","normal","multiply","screen","overlay","lighten","dodge","burn","random","log","data","key","MAX_VALUE","sum","values","count","min_log","LOG10E","max_log","pb","pr","cluster","assignments","clusterSizes","repeat","nb_iters","centroids","j","best","mindist","dist","newCentroids","kClusters","tmpKMeansBreaks","B_threshold","exp","scales","cool","hot","colorbrewer","OrRd","PuBu","BuPu","Oranges","BuGn","YlOrBr","YlGn","Reds","RdPu","Greens","YlGnBu","Purples","GnBu","Greys","YlOrRd","PuRd","Blues","PuBuGn","Viridis","Spectral","RdYlGn","RdBu","PiYG","PRGn","RdYlBu","BrBG","RdGy","PuOr","Set2","Accent","Set1","Set3","Dark2","Paired","Pastel2","Pastel1","colorbrewerTypes","typeMap","colorbrewerProxy","Proxy","target","prop","lower","has","getOwnPropertyNames","cmyk","rgb2cmyk","rgb2oklch","rgb2css","hsla","hsl2css","prevWhitePoint","cssColor","laba","lab2css","lcha","lch2css","oklab2css","oklch2css","oklch2rgb","INT_OR_PCT","source","FLOAT_OR_PCT","PCT","RE_S","SEP","COMMA","ANLGE","ALPHA","RE_RGB","RegExp","RE_RGB_LEGACY","RE_RGBA_LEGACY","RE_HSL","RE_HSL_LEGACY","RE_HSLA_LEGACY","RE_LAB","RE_LCH","RE_OKLAB","RE_OKLCH","roundRGB","percentToAbsolute","pct","signed","endsWith","parseFloat","substring","noneToValue","noneValue","css2rgb","css","trim","e","replace","wp","gl","temperature2rgb","kelvin","temp","temperature","minTemp","maxTemp","rgb2temperature","average","w","first","shift","cnt","dx","dy","ci","xyz2","bezier","I","lab0","lab1","lab2","lab3","RangeError","labs","newrow","binom_row","el","contrast","l1","l2","contrastAPCA","text","bg","l_text","l_bg","Y_text","Y_bg","S_norm","S_rev","C","cubehelix","start","rotations","lightness","dl","fract","amp","cos_a","sin_a","deltaE","Kl","Kc","Kh","rad2deg","rad","deg2rad","deg","a1","b1","L2","a2","b2","avgL","avgC","G","a1p","a2p","C1p","C2p","avgCp","arctan1","arctan2","h1p","h2p","avgHp","T","deltaHp","deltaL","deltaCp","sl","sc","sh","deltaTheta","Rt","distance","sum_sq","rng","code","valid","context","nearestColor","needle","parseColor","distanceSq","minDistanceSq","Infinity","DEFAULT_COLORS","mapColors","color","createColorSpec","STANDARD_COLORS","hexMatch","rgbMatch","parseComponentValue","leadingZero","rgbToHex","string","availableColors","nearestColorBase","matcher","or","alternateColors","extendedColors","concat","VERSION","module","exports","UnitHSL","toFixed","UnitHSLFloat","UnitXYZ","UnitCMYK","UnitRGBFloat","UnitHWB","UnitLAB","UnitOKLAB","UnitHSV","UnitLCH","UnitOKLCH","UnitHSI","toFloat","normalizeRGBInput","normalizeLABInput","MoebiusColor","hwb","rgbFloat","hslFloat","CONVERTERS.toHEX","CONVERTERS.toCMYK","CONVERTERS.toXYZ","CONVERTERS.toHSL","CONVERTERS.toHWB","CONVERTERS.toLAB","CONVERTERS.toOKLAB","CONVERTERS.toHSV","CONVERTERS.toLCH","CONVERTERS.toOKLCH","CONVERTERS.toHSI","CONVERTERS.toRGB","CONVERTERS.toFloat","toObject","CONVERTERS.toObject","MOEBIUS_PALETTE_DEFAULT_OPTIONS","diverging","randomOffset","noDuplicates","colorScaleMode","reverseDirection","harmonize","interval","options","h1","uniqueColors","Set","monochromatic","numberOfColors","hslColors","generateLuminanceShiftPalette","lRange","lStep","lStart","colorRange","stop","offset","diff","luminanceShiftAutoColors","divergentColor","ceil","getChromaBezierScaleColors","getChromaScaleColors","MoebiusAccentColors","luminanceShift","complement","triadic","tetradic","pentadic","hexadic","analogous","palette","toArray","flat","MoebiusPaletteColors","MoebiusThemeColors","darkMode","theme","MoebiusPalettes","baseColor","secondaryColor","themes","defaultOptions","all","accents","FEATURES.complement","primaryAccents","surfaceAccents","mixedAccents","primary","surface","mixed","FEATURES.darkMode","FEATURES.split","FEATURES.triadic","FEATURES.tetradic","FEATURES.pentadic","FEATURES.hexadic","FEATURES.analogous","primaryColor","FEATURES.interpolate","divergingColors","even","numberOfColorsLeft","numberOfColorsRight","generatedColors","generatedDivergentColors","stepsLeft","stepsRight","steps","FEATURES.luminanceShift","currentOptions","FEATURES.monochromatic","FEATURES.harmonize","MoebiusSVGHelper","xlmns","getColorPiePaths","size","df","document","createDocumentFragment","defsElement","createElementNS","maskElement","rectElement","gElement","id","setAttributeNS","appendChild","maskDegrees","initial","lineElement","group","inwardInterval","path","radius","centerX","centerY","pieSlice","async","Moebius","colorNames","response","fetch","json","entry","initializeColorNames","super","isString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,UAAQA,EAAGC,IAAEA,GAAQC,KAErB,IAAAC,EAAe,CAACC,EAAGC,EAAM,EAAGC,EAAO,IACxBN,EAAIC,EAAII,EAAKD,GAAIE,GCD5BC,EAAgBC,IACZA,EAAIC,UAAW,EACfD,EAAIE,WAAaF,EAAIG,MAAM,GAC3B,IAAK,IAAIC,EAAI,EAAGA,GAAK,EAAGA,IAChBA,EAAI,IACAJ,EAAII,GAAK,GAAKJ,EAAII,GAAK,OAAKJ,EAAIC,UAAW,GAC/CD,EAAII,GAAKT,EAAMK,EAAII,GAAI,EAAG,MACb,IAANA,IACPJ,EAAII,GAAKT,EAAM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GnB,GAAItH,EAAQmI,EAAM,CAChB,MAAM1K,EAAOuC,EAEbA,EAAQmI,EACRA,EAAO1K,CACT,CAUA,MAAO,KAPQ2P,EAAUD,EAASj4B,KAAKqV,KAAc,GAARyV,IAAe9qB,KAAKgC,GAAK,SACvDm2B,EAAUF,EAASj4B,KAAKoV,KAAc,GAAR0V,IAAe9qB,KAAKgC,GAAK,WAMpCi2B,KAAUA,OAHvBhF,EAAOnI,GAAS,IAAM,IAAM,SAFpCoN,EAAUD,EAASj4B,KAAKqV,KAAa,GAAP4d,IAAcjzB,KAAKgC,GAAK,SACtDm2B,EAAUF,EAASj4B,KAAKoV,KAAa,GAAP6d,IAAcjzB,KAAKgC,GAAK,WAIyBk2B,KAAWC,OHqClEC,CAAStN,EAAOsH,EAAU9jB,IACzDipB,EAASG,YAAYM,OAGzBb,EAAYO,YAAYL,GACxBL,EAAGU,YAAYP,GACfH,EAAGU,YAAYH,GAERP,CACT,EIfFqB,eAAeC,KACb,MAAMC,OAnCqBF,WAG3B,MAAMG,QAAiBC,MAAM,yCAEvBrd,SADaod,EAASE,QACRtd,OACdvZ,EAAM,CAAA,EAMZ,OAJAuZ,EAAOlF,QAASyiB,IACd92B,EAAI82B,EAAM/3B,MAAkB+3B,EAAM50B,MAG7BgqB,GAAaxQ,KAAK1b,IAuBA+2B,GAiBzB,MAAO,CACLlI,aAZF,cAAmCA,GACjC,WAAA1tB,CAAYurB,GACVsK,MACE50B,EAAOsqB,GAAOxqB,MCnDtB,SAAWkV,GAAG,MAAM,iBAAiBA,CAAC,CDoD9B6f,CAASP,EAAWhK,IACfgK,EAAWhK,GACXgK,EAAWhK,GAA2C3tB,KAE/D,GAKA4zB,mBACAoC,oBAEJ","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,156]}
|
|
1
|
+
{"version":3,"file":"moebius.js","sources":["../node_modules/chroma-js/src/utils/limit.js","../node_modules/chroma-js/src/utils/clip_rgb.js","../node_modules/chroma-js/src/utils/type.js","../node_modules/chroma-js/src/utils/unpack.js","../node_modules/chroma-js/src/utils/last.js","../node_modules/chroma-js/src/utils/index.js","../node_modules/chroma-js/src/io/input.js","../node_modules/chroma-js/src/Color.js","../node_modules/chroma-js/src/version.js","../node_modules/chroma-js/src/chroma.js","../node_modules/chroma-js/src/colors/w3cx11.js","../node_modules/chroma-js/src/io/hex/hex2rgb.js","../node_modules/chroma-js/src/io/hex/rgb2hex.js","../node_modules/chroma-js/src/io/named/index.js","../node_modules/chroma-js/src/ops/alpha.js","../node_modules/chroma-js/src/ops/clipped.js","../node_modules/chroma-js/src/io/lab/lab-constants.js","../node_modules/chroma-js/src/io/lab/lab2rgb.js","../node_modules/chroma-js/src/io/lab/rgb2lab.js","../node_modules/chroma-js/src/io/lab/index.js","../node_modules/chroma-js/src/ops/darken.js","../node_modules/chroma-js/src/ops/get.js","../node_modules/chroma-js/src/ops/luminance.js","../node_modules/chroma-js/src/interpolator/index.js","../node_modules/chroma-js/src/generator/mix.js","../node_modules/chroma-js/src/ops/mix.js","../node_modules/chroma-js/src/ops/premultiply.js","../node_modules/chroma-js/src/io/lch/lch2lab.js","../node_modules/chroma-js/src/io/lch/lch2rgb.js","../node_modules/chroma-js/src/io/lch/lab2lch.js","../node_modules/chroma-js/src/io/lch/rgb2lch.js","../node_modules/chroma-js/src/io/lch/index.js","../node_modules/chroma-js/src/io/lch/hcl2rgb.js","../node_modules/chroma-js/src/ops/saturate.js","../node_modules/chroma-js/src/ops/set.js","../node_modules/chroma-js/src/ops/shade.js","../node_modules/chroma-js/src/interpolator/rgb.js","../node_modules/chroma-js/src/interpolator/lrgb.js","../node_modules/chroma-js/src/interpolator/lab.js","../node_modules/chroma-js/src/interpolator/_hsx.js","../node_modules/chroma-js/src/interpolator/lch.js","../node_modules/chroma-js/src/io/num/index.js","../node_modules/chroma-js/src/io/num/rgb2num.js","../node_modules/chroma-js/src/io/num/num2rgb.js","../node_modules/chroma-js/src/interpolator/num.js","../node_modules/chroma-js/src/io/hcg/hcg2rgb.js","../node_modules/chroma-js/src/io/hcg/index.js","../node_modules/chroma-js/src/io/hcg/rgb2hcg.js","../node_modules/chroma-js/src/interpolator/hcg.js","../node_modules/chroma-js/src/io/hsi/hsi2rgb.js","../node_modules/chroma-js/src/io/hsi/rgb2hsi.js","../node_modules/chroma-js/src/io/hsi/index.js","../node_modules/chroma-js/src/interpolator/hsi.js","../node_modules/chroma-js/src/io/hsl/hsl2rgb.js","../node_modules/chroma-js/src/io/hsl/rgb2hsl.js","../node_modules/chroma-js/src/io/hsl/index.js","../node_modules/chroma-js/src/interpolator/hsl.js","../node_modules/chroma-js/src/io/hsv/hsv2rgb.js","../node_modules/chroma-js/src/io/hsv/rgb2hsv.js","../node_modules/chroma-js/src/io/hsv/index.js","../node_modules/chroma-js/src/utils/multiply-matrices.js","../node_modules/chroma-js/src/interpolator/hsv.js","../node_modules/chroma-js/src/io/oklab/oklab2rgb.js","../node_modules/chroma-js/src/io/oklab/rgb2oklab.js","../node_modules/chroma-js/src/io/oklab/index.js","../node_modules/chroma-js/src/interpolator/oklab.js","../node_modules/chroma-js/src/interpolator/oklch.js","../node_modules/chroma-js/src/generator/average.js","../node_modules/chroma-js/src/generator/scale.js","../node_modules/chroma-js/src/io/rgb/index.js","../node_modules/chroma-js/src/generator/blend.js","../node_modules/chroma-js/src/generator/cubehelix.js","../node_modules/chroma-js/src/generator/random.js","../node_modules/chroma-js/src/utils/analyze.js","../node_modules/chroma-js/src/utils/contrastAPCA.js","../node_modules/chroma-js/src/utils/delta-e.js","../node_modules/chroma-js/src/utils/valid.js","../node_modules/chroma-js/src/utils/scales.js","../node_modules/chroma-js/src/colors/colorbrewer.js","../node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js","../node_modules/chroma-js/src/io/cmyk/index.js","../node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js","../node_modules/chroma-js/src/io/css/hsl2css.js","../node_modules/chroma-js/src/io/oklch/rgb2oklch.js","../node_modules/chroma-js/src/io/css/rgb2css.js","../node_modules/chroma-js/src/io/css/lab2css.js","../node_modules/chroma-js/src/io/css/lch2css.js","../node_modules/chroma-js/src/io/css/oklab2css.js","../node_modules/chroma-js/src/io/css/oklch2css.js","../node_modules/chroma-js/src/io/oklch/oklch2rgb.js","../node_modules/chroma-js/src/io/css/css2rgb.js","../node_modules/chroma-js/src/io/css/index.js","../node_modules/chroma-js/src/io/gl/index.js","../node_modules/chroma-js/src/io/hex/index.js","../node_modules/chroma-js/src/io/temp/temperature2rgb.js","../node_modules/chroma-js/src/io/temp/rgb2temperature.js","../node_modules/chroma-js/src/io/temp/index.js","../node_modules/chroma-js/src/io/oklch/index.js","../node_modules/chroma-js/index.js","../node_modules/chroma-js/src/generator/bezier.js","../node_modules/chroma-js/src/utils/contrast.js","../node_modules/chroma-js/src/utils/distance.js","../node_modules/nearest-color/nearestColor.js","../src/utils/color-objects/hsl.ts","../src/utils/color-objects/xyz.ts","../src/utils/color-objects/cmyk.ts","../src/utils/color-objects/rgb.ts","../src/utils/color-objects/hwb.ts","../src/utils/color-objects/lab.ts","../src/utils/color-objects/oklab.ts","../src/utils/color-objects/hsv.ts","../src/utils/color-objects/lch.ts","../src/utils/color-objects/oklch.ts","../src/utils/color-objects/hsi.ts","../src/utils/converters/to-float.ts","../src/utils/normalize-color-units.ts","../src/classes/MoebiusColor.ts","../src/utils/converters/to-hex.ts","../src/utils/converters/to-cmyk.ts","../src/utils/converters/to-xyz.ts","../src/utils/converters/to-hsl.ts","../src/utils/converters/to-hwb.ts","../src/utils/converters/to-lab.ts","../src/utils/converters/to-oklab.ts","../src/utils/converters/to-hsv.ts","../src/utils/converters/to-lch.ts","../src/utils/converters/to-oklch.ts","../src/utils/converters/to-hsi.ts","../src/utils/converters/to-rgb.ts","../src/utils/converters/to-object.ts","../src/constants/index.ts","../src/features/harmonize.ts","../src/utils/random.ts","../src/features/monochromatic.ts","../src/features/luminance-shift.ts","../src/utils/range.ts","../src/utils/get-chroma-bezier-scale-colors.ts","../src/utils/get-chroma-scale-colors.ts","../src/classes/MoebiusAccentColors.ts","../src/classes/MoebiusPaletteColors.ts","../src/classes/MoebiusThemeColors.ts","../src/classes/MoebiusPalettes.ts","../src/features/complement.ts","../src/features/dark-mode.ts","../src/features/split.ts","../src/features/triadic.ts","../src/features/tetradic.ts","../src/features/pentadic.ts","../src/features/hexadic.ts","../src/features/analogous.ts","../src/features/interpolate.ts","../src/classes/MoebiusSVGHelper.ts","../src/utils/unique-id.ts","../src/utils/svg/get-start-mask-degree.ts","../src/utils/svg/pie-slice.ts","../src/main.ts","../node_modules/@phun-ky/typeof/dist/typeof.js"],"sourcesContent":["const { min, max } = Math;\n\nexport default (x, low = 0, high = 1) => {\n return min(max(low, x), high);\n};\n","import limit from './limit.js';\n\nexport default (rgb) => {\n rgb._clipped = false;\n rgb._unclipped = rgb.slice(0);\n for (let i = 0; i <= 3; i++) {\n if (i < 3) {\n if (rgb[i] < 0 || rgb[i] > 255) rgb._clipped = true;\n rgb[i] = limit(rgb[i], 0, 255);\n } else if (i === 3) {\n rgb[i] = limit(rgb[i], 0, 1);\n }\n }\n return rgb;\n};\n","// ported from jQuery's $.type\nconst classToType = {};\nfor (let name of [\n 'Boolean',\n 'Number',\n 'String',\n 'Function',\n 'Array',\n 'Date',\n 'RegExp',\n 'Undefined',\n 'Null'\n]) {\n classToType[`[object ${name}]`] = name.toLowerCase();\n}\nexport default function (obj) {\n return classToType[Object.prototype.toString.call(obj)] || 'object';\n}\n","import type from './type.js';\n\nexport default (args, keyOrder = null) => {\n // if called with more than 3 arguments, we return the arguments\n if (args.length >= 3) return Array.prototype.slice.call(args);\n // with less than 3 args we check if first arg is object\n // and use the keyOrder string to extract and sort properties\n if (type(args[0]) == 'object' && keyOrder) {\n return keyOrder\n .split('')\n .filter((k) => args[0][k] !== undefined)\n .map((k) => args[0][k]);\n }\n // otherwise we just return the first argument\n // (which we suppose is an array of args)\n return args[0].slice(0);\n};\n","import type from './type.js';\n\nexport default (args) => {\n if (args.length < 2) return null;\n const l = args.length - 1;\n if (type(args[l]) == 'string') return args[l].toLowerCase();\n return null;\n};\n","const { PI, min, max } = Math;\n\nconst rnd2 = (a) => Math.round(a * 100) / 100;\nconst rnd3 = (a) => Math.round(a * 100) / 100;\n\nexport { default as clip_rgb } from './clip_rgb.js';\nexport { default as limit } from './limit.js';\nexport { default as type } from './type.js';\nexport { default as unpack } from './unpack.js';\nexport { default as last } from './last.js';\n\nconst TWOPI = PI * 2;\nconst PITHIRD = PI / 3;\nconst DEG2RAD = PI / 180;\nconst RAD2DEG = 180 / PI;\n\n/**\n * Reverse the first three elements of an array\n *\n * @param {any[]} arr\n * @returns {any[]}\n */\nfunction reverse3(arr) {\n return [...arr.slice(0, 3).reverse(), ...arr.slice(3)];\n}\n\nexport { PI, TWOPI, PITHIRD, DEG2RAD, RAD2DEG, min, max, rnd2, rnd3, reverse3 };\n","export default {\n format: {},\n autodetect: []\n};\n","import { last, clip_rgb, type } from './utils/index.js';\nimport _input from './io/input.js';\n\nclass Color {\n constructor(...args) {\n const me = this;\n if (\n type(args[0]) === 'object' &&\n args[0].constructor &&\n args[0].constructor === this.constructor\n ) {\n // the argument is already a Color instance\n return args[0];\n }\n // last argument could be the mode\n let mode = last(args);\n let autodetect = false;\n if (!mode) {\n autodetect = true;\n\n if (!_input.sorted) {\n _input.autodetect = _input.autodetect.sort((a, b) => b.p - a.p);\n _input.sorted = true;\n }\n\n // auto-detect format\n for (let chk of _input.autodetect) {\n mode = chk.test(...args);\n if (mode) break;\n }\n }\n if (_input.format[mode]) {\n const rgb = _input.format[mode].apply(\n null,\n autodetect ? args : args.slice(0, -1)\n );\n me._rgb = clip_rgb(rgb);\n } else {\n throw new Error('unknown format: ' + args);\n }\n // add alpha channel\n if (me._rgb.length === 3) me._rgb.push(1);\n }\n toString() {\n if (type(this.hex) == 'function') return this.hex();\n return `[${this._rgb.join(',')}]`;\n }\n}\nexport default Color;\n","// this gets updated automatically\nexport const version = '3.2.0';\n","import Color from './Color.js';\nimport { version } from './version.js';\n\nconst chroma = (...args) => {\n return new Color(...args);\n};\n\nchroma.version = version;\n\nexport default chroma;\n","/**\n\tX11 color names\n\n\thttp://www.w3.org/TR/css3-color/#svg-color\n*/\n\nconst w3cx11 = {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkgrey: '#a9a9a9',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkslategrey: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n grey: '#808080',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n indianred: '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n laserlemon: '#ffff54',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrod: '#fafad2',\n lightgoldenrodyellow: '#fafad2',\n lightgray: '#d3d3d3',\n lightgreen: '#90ee90',\n lightgrey: '#d3d3d3',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n maroon2: '#7f0000',\n maroon3: '#b03060',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370db',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#db7093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n purple2: '#7f007f',\n purple3: '#a020f0',\n rebeccapurple: '#663399',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n slategrey: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32'\n};\n\nexport default w3cx11;\n","const RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;\nconst RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;\n\nconst hex2rgb = (hex) => {\n if (hex.match(RE_HEX)) {\n // remove optional leading #\n if (hex.length === 4 || hex.length === 7) {\n hex = hex.substr(1);\n }\n // expand short-notation to full six-digit\n if (hex.length === 3) {\n hex = hex.split('');\n hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];\n }\n const u = parseInt(hex, 16);\n const r = u >> 16;\n const g = (u >> 8) & 0xff;\n const b = u & 0xff;\n return [r, g, b, 1];\n }\n\n // match rgba hex format, eg #FF000077\n if (hex.match(RE_HEXA)) {\n if (hex.length === 5 || hex.length === 9) {\n // remove optional leading #\n hex = hex.substr(1);\n }\n // expand short-notation to full eight-digit\n if (hex.length === 4) {\n hex = hex.split('');\n hex =\n hex[0] +\n hex[0] +\n hex[1] +\n hex[1] +\n hex[2] +\n hex[2] +\n hex[3] +\n hex[3];\n }\n const u = parseInt(hex, 16);\n const r = (u >> 24) & 0xff;\n const g = (u >> 16) & 0xff;\n const b = (u >> 8) & 0xff;\n const a = Math.round(((u & 0xff) / 0xff) * 100) / 100;\n return [r, g, b, a];\n }\n\n // we used to check for css colors here\n // if _input.css? and rgb = _input.css hex\n // return rgb\n\n throw new Error(`unknown hex color: ${hex}`);\n};\n\nexport default hex2rgb;\n","import { unpack, last } from '../../utils/index.js';\nconst { round } = Math;\n\nconst rgb2hex = (...args) => {\n let [r, g, b, a] = unpack(args, 'rgba');\n let mode = last(args) || 'auto';\n if (a === undefined) a = 1;\n if (mode === 'auto') {\n mode = a < 1 ? 'rgba' : 'rgb';\n }\n r = round(r);\n g = round(g);\n b = round(b);\n const u = (r << 16) | (g << 8) | b;\n let str = '000000' + u.toString(16); //#.toUpperCase();\n str = str.substr(str.length - 6);\n let hxa = '0' + round(a * 255).toString(16);\n hxa = hxa.substr(hxa.length - 2);\n switch (mode.toLowerCase()) {\n case 'rgba':\n return `#${str}${hxa}`;\n case 'argb':\n return `#${hxa}${str}`;\n default:\n return `#${str}`;\n }\n};\n\nexport default rgb2hex;\n","import Color from '../../Color.js';\nimport input from '../input.js';\nimport { type } from '../../utils/index.js';\n\nimport w3cx11 from '../../colors/w3cx11.js';\nimport hex2rgb from '../hex/hex2rgb.js';\nimport rgb2hex from '../hex/rgb2hex.js';\n\nColor.prototype.name = function () {\n const hex = rgb2hex(this._rgb, 'rgb');\n for (let n of Object.keys(w3cx11)) {\n if (w3cx11[n] === hex) return n.toLowerCase();\n }\n return hex;\n};\n\ninput.format.named = (name) => {\n name = name.toLowerCase();\n if (w3cx11[name]) return hex2rgb(w3cx11[name]);\n throw new Error('unknown color name: ' + name);\n};\n\ninput.autodetect.push({\n p: 5,\n test: (h, ...rest) => {\n if (!rest.length && type(h) === 'string' && w3cx11[h.toLowerCase()]) {\n return 'named';\n }\n }\n});\n","import Color from '../Color.js';\nimport { type } from '../utils/index.js';\n\nColor.prototype.alpha = function (a, mutate = false) {\n if (a !== undefined && type(a) === 'number') {\n if (mutate) {\n this._rgb[3] = a;\n return this;\n }\n return new Color([this._rgb[0], this._rgb[1], this._rgb[2], a], 'rgb');\n }\n return this._rgb[3];\n};\n","import Color from '../Color.js';\n\nColor.prototype.clipped = function () {\n return this._rgb._clipped || false;\n};\n","const labConstants = {\n // Corresponds roughly to RGB brighter/darker\n Kn: 18,\n\n // D65 standard referent\n labWhitePoint: 'd65',\n Xn: 0.95047,\n Yn: 1,\n Zn: 1.08883,\n\n t0: 0.137931034, // 4 / 29\n t1: 0.206896552, // 6 / 29\n t2: 0.12841855, // 3 * t1 * t1\n t3: 0.008856452, // t1 * t1 * t1,\n\n kE: 216.0 / 24389.0,\n kKE: 8.0,\n kK: 24389.0 / 27.0,\n\n RefWhiteRGB: {\n // sRGB\n X: 0.95047,\n Y: 1,\n Z: 1.08883\n },\n\n MtxRGB2XYZ: {\n m00: 0.4124564390896922,\n m01: 0.21267285140562253,\n m02: 0.0193338955823293,\n m10: 0.357576077643909,\n m11: 0.715152155287818,\n m12: 0.11919202588130297,\n m20: 0.18043748326639894,\n m21: 0.07217499330655958,\n m22: 0.9503040785363679\n },\n\n MtxXYZ2RGB: {\n m00: 3.2404541621141045,\n m01: -0.9692660305051868,\n m02: 0.055643430959114726,\n m10: -1.5371385127977166,\n m11: 1.8760108454466942,\n m12: -0.2040259135167538,\n m20: -0.498531409556016,\n m21: 0.041556017530349834,\n m22: 1.0572251882231791\n },\n\n // used in rgb2xyz\n As: 0.9414285350000001,\n Bs: 1.040417467,\n Cs: 1.089532651,\n\n MtxAdaptMa: {\n m00: 0.8951,\n m01: -0.7502,\n m02: 0.0389,\n m10: 0.2664,\n m11: 1.7135,\n m12: -0.0685,\n m20: -0.1614,\n m21: 0.0367,\n m22: 1.0296\n },\n\n MtxAdaptMaI: {\n m00: 0.9869929054667123,\n m01: 0.43230526972339456,\n m02: -0.008528664575177328,\n m10: -0.14705425642099013,\n m11: 0.5183602715367776,\n m12: 0.04004282165408487,\n m20: 0.15996265166373125,\n m21: 0.0492912282128556,\n m22: 0.9684866957875502\n }\n};\n\nexport default labConstants;\n\n// taken from https://de.mathworks.com/help/images/ref/whitepoint.html\nconst ILLUMINANTS = new Map([\n // ASTM E308-01\n ['a', [1.0985, 0.35585]],\n // Wyszecki & Stiles, p. 769\n ['b', [1.0985, 0.35585]],\n // C ASTM E308-01\n ['c', [0.98074, 1.18232]],\n // D50 (ASTM E308-01)\n ['d50', [0.96422, 0.82521]],\n // D55 (ASTM E308-01)\n ['d55', [0.95682, 0.92149]],\n // D65 (ASTM E308-01)\n ['d65', [0.95047, 1.08883]],\n // E (ASTM E308-01)\n ['e', [1, 1, 1]],\n // F2 (ASTM E308-01)\n ['f2', [0.99186, 0.67393]],\n // F7 (ASTM E308-01)\n ['f7', [0.95041, 1.08747]],\n // F11 (ASTM E308-01)\n ['f11', [1.00962, 0.6435]],\n ['icc', [0.96422, 0.82521]]\n]);\n\nexport function setLabWhitePoint(name) {\n const ill = ILLUMINANTS.get(String(name).toLowerCase());\n if (!ill) {\n throw new Error('unknown Lab illuminant ' + name);\n }\n labConstants.labWhitePoint = name;\n labConstants.Xn = ill[0];\n labConstants.Zn = ill[1];\n}\n\nexport function getLabWhitePoint() {\n return labConstants.labWhitePoint;\n}\n","import LAB_CONSTANTS from './lab-constants.js';\nimport { unpack } from '../../utils/index.js';\n\n/*\n * L* [0..100]\n * a [-100..100]\n * b [-100..100]\n */\nconst lab2rgb = (...args) => {\n args = unpack(args, 'lab');\n const [L, a, b] = args;\n const [x, y, z] = lab2xyz(L, a, b);\n const [r, g, b_] = xyz2rgb(x, y, z);\n return [r, g, b_, args.length > 3 ? args[3] : 1];\n};\n\nconst lab2xyz = (L, a, b) => {\n const { kE, kK, kKE, Xn, Yn, Zn } = LAB_CONSTANTS;\n\n const fy = (L + 16.0) / 116.0;\n const fx = 0.002 * a + fy;\n const fz = fy - 0.005 * b;\n\n const fx3 = fx * fx * fx;\n const fz3 = fz * fz * fz;\n\n const xr = fx3 > kE ? fx3 : (116.0 * fx - 16.0) / kK;\n const yr = L > kKE ? Math.pow((L + 16.0) / 116.0, 3.0) : L / kK;\n const zr = fz3 > kE ? fz3 : (116.0 * fz - 16.0) / kK;\n\n const x = xr * Xn;\n const y = yr * Yn;\n const z = zr * Zn;\n\n return [x, y, z];\n};\n\nconst compand = (linear) => {\n /* sRGB */\n const sign = Math.sign(linear);\n linear = Math.abs(linear);\n return (\n (linear <= 0.0031308\n ? linear * 12.92\n : 1.055 * Math.pow(linear, 1.0 / 2.4) - 0.055) * sign\n );\n};\n\nconst xyz2rgb = (x, y, z) => {\n const { MtxAdaptMa, MtxAdaptMaI, MtxXYZ2RGB, RefWhiteRGB, Xn, Yn, Zn } =\n LAB_CONSTANTS;\n\n const As = Xn * MtxAdaptMa.m00 + Yn * MtxAdaptMa.m10 + Zn * MtxAdaptMa.m20;\n const Bs = Xn * MtxAdaptMa.m01 + Yn * MtxAdaptMa.m11 + Zn * MtxAdaptMa.m21;\n const Cs = Xn * MtxAdaptMa.m02 + Yn * MtxAdaptMa.m12 + Zn * MtxAdaptMa.m22;\n\n const Ad =\n RefWhiteRGB.X * MtxAdaptMa.m00 +\n RefWhiteRGB.Y * MtxAdaptMa.m10 +\n RefWhiteRGB.Z * MtxAdaptMa.m20;\n const Bd =\n RefWhiteRGB.X * MtxAdaptMa.m01 +\n RefWhiteRGB.Y * MtxAdaptMa.m11 +\n RefWhiteRGB.Z * MtxAdaptMa.m21;\n const Cd =\n RefWhiteRGB.X * MtxAdaptMa.m02 +\n RefWhiteRGB.Y * MtxAdaptMa.m12 +\n RefWhiteRGB.Z * MtxAdaptMa.m22;\n\n const X1 =\n (x * MtxAdaptMa.m00 + y * MtxAdaptMa.m10 + z * MtxAdaptMa.m20) *\n (Ad / As);\n const Y1 =\n (x * MtxAdaptMa.m01 + y * MtxAdaptMa.m11 + z * MtxAdaptMa.m21) *\n (Bd / Bs);\n const Z1 =\n (x * MtxAdaptMa.m02 + y * MtxAdaptMa.m12 + z * MtxAdaptMa.m22) *\n (Cd / Cs);\n\n const X2 =\n X1 * MtxAdaptMaI.m00 + Y1 * MtxAdaptMaI.m10 + Z1 * MtxAdaptMaI.m20;\n const Y2 =\n X1 * MtxAdaptMaI.m01 + Y1 * MtxAdaptMaI.m11 + Z1 * MtxAdaptMaI.m21;\n const Z2 =\n X1 * MtxAdaptMaI.m02 + Y1 * MtxAdaptMaI.m12 + Z1 * MtxAdaptMaI.m22;\n\n const r = compand(\n X2 * MtxXYZ2RGB.m00 + Y2 * MtxXYZ2RGB.m10 + Z2 * MtxXYZ2RGB.m20\n );\n const g = compand(\n X2 * MtxXYZ2RGB.m01 + Y2 * MtxXYZ2RGB.m11 + Z2 * MtxXYZ2RGB.m21\n );\n const b = compand(\n X2 * MtxXYZ2RGB.m02 + Y2 * MtxXYZ2RGB.m12 + Z2 * MtxXYZ2RGB.m22\n );\n\n return [r * 255, g * 255, b * 255];\n};\n\nexport default lab2rgb;\nexport { xyz2rgb };\n","import LAB_CONSTANTS from './lab-constants.js';\nimport { unpack } from '../../utils/index.js';\n\nconst rgb2lab = (...args) => {\n const [r, g, b, ...rest] = unpack(args, 'rgb');\n const [x, y, z] = rgb2xyz(r, g, b);\n const [L, a, b_] = xyz2lab(x, y, z);\n return [L, a, b_, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\nfunction xyz2lab(x, y, z) {\n const { Xn, Yn, Zn, kE, kK } = LAB_CONSTANTS;\n const xr = x / Xn;\n const yr = y / Yn;\n const zr = z / Zn;\n\n const fx = xr > kE ? Math.pow(xr, 1.0 / 3.0) : (kK * xr + 16.0) / 116.0;\n const fy = yr > kE ? Math.pow(yr, 1.0 / 3.0) : (kK * yr + 16.0) / 116.0;\n const fz = zr > kE ? Math.pow(zr, 1.0 / 3.0) : (kK * zr + 16.0) / 116.0;\n\n return [116.0 * fy - 16.0, 500.0 * (fx - fy), 200.0 * (fy - fz)];\n}\n\nfunction gammaAdjustSRGB(companded) {\n const sign = Math.sign(companded);\n companded = Math.abs(companded);\n const linear =\n companded <= 0.04045\n ? companded / 12.92\n : Math.pow((companded + 0.055) / 1.055, 2.4);\n return linear * sign;\n}\n\nconst rgb2xyz = (r, g, b) => {\n // normalize and gamma adjust\n r = gammaAdjustSRGB(r / 255);\n g = gammaAdjustSRGB(g / 255);\n b = gammaAdjustSRGB(b / 255);\n\n const { MtxRGB2XYZ, MtxAdaptMa, MtxAdaptMaI, Xn, Yn, Zn, As, Bs, Cs } =\n LAB_CONSTANTS;\n\n let x = r * MtxRGB2XYZ.m00 + g * MtxRGB2XYZ.m10 + b * MtxRGB2XYZ.m20;\n let y = r * MtxRGB2XYZ.m01 + g * MtxRGB2XYZ.m11 + b * MtxRGB2XYZ.m21;\n let z = r * MtxRGB2XYZ.m02 + g * MtxRGB2XYZ.m12 + b * MtxRGB2XYZ.m22;\n\n const Ad = Xn * MtxAdaptMa.m00 + Yn * MtxAdaptMa.m10 + Zn * MtxAdaptMa.m20;\n const Bd = Xn * MtxAdaptMa.m01 + Yn * MtxAdaptMa.m11 + Zn * MtxAdaptMa.m21;\n const Cd = Xn * MtxAdaptMa.m02 + Yn * MtxAdaptMa.m12 + Zn * MtxAdaptMa.m22;\n\n let X = x * MtxAdaptMa.m00 + y * MtxAdaptMa.m10 + z * MtxAdaptMa.m20;\n let Y = x * MtxAdaptMa.m01 + y * MtxAdaptMa.m11 + z * MtxAdaptMa.m21;\n let Z = x * MtxAdaptMa.m02 + y * MtxAdaptMa.m12 + z * MtxAdaptMa.m22;\n\n X *= Ad / As;\n Y *= Bd / Bs;\n Z *= Cd / Cs;\n\n x = X * MtxAdaptMaI.m00 + Y * MtxAdaptMaI.m10 + Z * MtxAdaptMaI.m20;\n y = X * MtxAdaptMaI.m01 + Y * MtxAdaptMaI.m11 + Z * MtxAdaptMaI.m21;\n z = X * MtxAdaptMaI.m02 + Y * MtxAdaptMaI.m12 + Z * MtxAdaptMaI.m22;\n\n return [x, y, z];\n};\n\nexport default rgb2lab;\nexport { rgb2xyz };\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport lab2rgb from './lab2rgb.js';\nimport rgb2lab from './rgb2lab.js';\nimport { getLabWhitePoint, setLabWhitePoint } from './lab-constants.js';\n\nColor.prototype.lab = function () {\n return rgb2lab(this._rgb);\n};\n\nconst lab = (...args) => new Color(...args, 'lab');\nObject.assign(chroma, { lab, getLabWhitePoint, setLabWhitePoint });\n\ninput.format.lab = lab2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'lab');\n if (type(args) === 'array' && args.length === 3) {\n return 'lab';\n }\n }\n});\n\nexport { lab, getLabWhitePoint, setLabWhitePoint };\n","import '../io/lab/index.js';\nimport Color from '../Color.js';\nimport LAB_CONSTANTS from '../io/lab/lab-constants.js';\n\nColor.prototype.darken = function (amount = 1) {\n const me = this;\n const lab = me.lab();\n lab[0] -= LAB_CONSTANTS.Kn * amount;\n return new Color(lab, 'lab').alpha(me.alpha(), true);\n};\n\nColor.prototype.brighten = function (amount = 1) {\n return this.darken(-amount);\n};\n\nColor.prototype.darker = Color.prototype.darken;\nColor.prototype.brighter = Color.prototype.brighten;\n","import Color from '../Color.js';\n\nColor.prototype.get = function (mc) {\n const [mode, channel] = mc.split('.');\n const src = this[mode]();\n if (channel) {\n const i = mode.indexOf(channel) - (mode.substr(0, 2) === 'ok' ? 2 : 0);\n if (i > -1) return src[i];\n throw new Error(`unknown channel ${channel} in mode ${mode}`);\n } else {\n return src;\n }\n};\n","import Color from '../Color.js';\nimport { type } from '../utils/index.js';\nconst { pow } = Math;\n\nconst EPS = 1e-7;\nconst MAX_ITER = 20;\n\nColor.prototype.luminance = function (lum, mode = 'rgb') {\n if (lum !== undefined && type(lum) === 'number') {\n if (lum === 0) {\n // return pure black\n return new Color([0, 0, 0, this._rgb[3]], 'rgb');\n }\n if (lum === 1) {\n // return pure white\n return new Color([255, 255, 255, this._rgb[3]], 'rgb');\n }\n // compute new color using...\n let cur_lum = this.luminance();\n let max_iter = MAX_ITER;\n\n const test = (low, high) => {\n const mid = low.interpolate(high, 0.5, mode);\n const lm = mid.luminance();\n if (Math.abs(lum - lm) < EPS || !max_iter--) {\n // close enough\n return mid;\n }\n return lm > lum ? test(low, mid) : test(mid, high);\n };\n\n const rgb = (\n cur_lum > lum\n ? test(new Color([0, 0, 0]), this)\n : test(this, new Color([255, 255, 255]))\n ).rgb();\n return new Color([...rgb, this._rgb[3]]);\n }\n return rgb2luminance(...this._rgb.slice(0, 3));\n};\n\nconst rgb2luminance = (r, g, b) => {\n // relative luminance\n // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n r = luminance_x(r);\n g = luminance_x(g);\n b = luminance_x(b);\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nconst luminance_x = (x) => {\n x /= 255;\n return x <= 0.03928 ? x / 12.92 : pow((x + 0.055) / 1.055, 2.4);\n};\n","export default {};\n","import Color from '../Color.js';\nimport { type } from '../utils/index.js';\nimport interpolator from '../interpolator/index.js';\n\nexport default (col1, col2, f = 0.5, ...rest) => {\n let mode = rest[0] || 'lrgb';\n if (!interpolator[mode] && !rest.length) {\n // fall back to the first supported mode\n mode = Object.keys(interpolator)[0];\n }\n if (!interpolator[mode]) {\n throw new Error(`interpolation mode ${mode} is not defined`);\n }\n if (type(col1) !== 'object') col1 = new Color(col1);\n if (type(col2) !== 'object') col2 = new Color(col2);\n return interpolator[mode](col1, col2, f).alpha(\n col1.alpha() + f * (col2.alpha() - col1.alpha())\n );\n};\n","import Color from '../Color.js';\nimport mix from '../generator/mix.js';\n\nColor.prototype.mix = Color.prototype.interpolate = function (\n col2,\n f = 0.5,\n ...rest\n) {\n return mix(this, col2, f, ...rest);\n};\n","import Color from '../Color.js';\n\nColor.prototype.premultiply = function (mutate = false) {\n const rgb = this._rgb;\n const a = rgb[3];\n if (mutate) {\n this._rgb = [rgb[0] * a, rgb[1] * a, rgb[2] * a, a];\n return this;\n } else {\n return new Color([rgb[0] * a, rgb[1] * a, rgb[2] * a, a], 'rgb');\n }\n};\n","import { unpack, DEG2RAD } from '../../utils/index.js';\nconst { sin, cos } = Math;\n\nconst lch2lab = (...args) => {\n /*\n Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel.\n These formulas were invented by David Dalrymple to obtain maximum contrast without going\n out of gamut if the parameters are in the range 0-1.\n\n A saturation multiplier was added by Gregor Aisch\n */\n let [l, c, h] = unpack(args, 'lch');\n if (isNaN(h)) h = 0;\n h = h * DEG2RAD;\n return [l, cos(h) * c, sin(h) * c];\n};\n\nexport default lch2lab;\n","import { unpack } from '../../utils/index.js';\nimport lch2lab from './lch2lab.js';\nimport lab2rgb from '../lab/lab2rgb.js';\n\nconst lch2rgb = (...args) => {\n args = unpack(args, 'lch');\n const [l, c, h] = args;\n const [L, a, b_] = lch2lab(l, c, h);\n const [r, g, b] = lab2rgb(L, a, b_);\n return [r, g, b, args.length > 3 ? args[3] : 1];\n};\n\nexport default lch2rgb;\n","import { unpack, RAD2DEG } from '../../utils/index.js';\nconst { sqrt, atan2, round } = Math;\n\nconst lab2lch = (...args) => {\n const [l, a, b] = unpack(args, 'lab');\n const c = sqrt(a * a + b * b);\n let h = (atan2(b, a) * RAD2DEG + 360) % 360;\n if (round(c * 10000) === 0) h = Number.NaN;\n return [l, c, h];\n};\n\nexport default lab2lch;\n","import { unpack } from '../../utils/index.js';\nimport rgb2lab from '../lab/rgb2lab.js';\nimport lab2lch from './lab2lch.js';\n\nconst rgb2lch = (...args) => {\n const [r, g, b, ...rest] = unpack(args, 'rgb');\n const [l, a, b_] = rgb2lab(r, g, b);\n const [L, c, h] = lab2lch(l, a, b_);\n return [L, c, h, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\nexport default rgb2lch;\n","import { unpack, type, reverse3 } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport lch2rgb from './lch2rgb.js';\nimport hcl2rgb from './hcl2rgb.js';\nimport rgb2lch from './rgb2lch.js';\n\nColor.prototype.lch = function () {\n return rgb2lch(this._rgb);\n};\nColor.prototype.hcl = function () {\n return reverse3(rgb2lch(this._rgb));\n};\n\nconst lch = (...args) => new Color(...args, 'lch');\nconst hcl = (...args) => new Color(...args, 'hcl');\n\nObject.assign(chroma, { lch, hcl });\n\ninput.format.lch = lch2rgb;\ninput.format.hcl = hcl2rgb;\n['lch', 'hcl'].forEach((m) =>\n input.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, m);\n if (type(args) === 'array' && args.length === 3) {\n return m;\n }\n }\n })\n);\n\nexport { lch, hcl };\n","import { unpack, reverse3 } from '../../utils/index.js';\nimport lch2rgb from './lch2rgb.js';\n\nconst hcl2rgb = (...args) => {\n const hcl = reverse3(unpack(args, 'hcl'));\n return lch2rgb(...hcl);\n};\n\nexport default hcl2rgb;\n","import '../io/lch/index.js';\nimport Color from '../Color.js';\nimport LAB_CONSTANTS from '../io/lab/lab-constants.js';\n\nColor.prototype.saturate = function (amount = 1) {\n const me = this;\n const lch = me.lch();\n lch[1] += LAB_CONSTANTS.Kn * amount;\n if (lch[1] < 0) lch[1] = 0;\n return new Color(lch, 'lch').alpha(me.alpha(), true);\n};\n\nColor.prototype.desaturate = function (amount = 1) {\n return this.saturate(-amount);\n};\n","import Color from '../Color.js';\nimport { type } from '../utils/index.js';\n\nColor.prototype.set = function (mc, value, mutate = false) {\n const [mode, channel] = mc.split('.');\n const src = this[mode]();\n if (channel) {\n const i = mode.indexOf(channel) - (mode.substr(0, 2) === 'ok' ? 2 : 0);\n if (i > -1) {\n if (type(value) == 'string') {\n switch (value.charAt(0)) {\n case '+':\n src[i] += +value;\n break;\n case '-':\n src[i] += +value;\n break;\n case '*':\n src[i] *= +value.substr(1);\n break;\n case '/':\n src[i] /= +value.substr(1);\n break;\n default:\n src[i] = +value;\n }\n } else if (type(value) === 'number') {\n src[i] = value;\n } else {\n throw new Error(`unsupported value for Color.set`);\n }\n const out = new Color(src, mode);\n if (mutate) {\n this._rgb = out._rgb;\n return this;\n }\n return out;\n }\n throw new Error(`unknown channel ${channel} in mode ${mode}`);\n } else {\n return src;\n }\n};\n","import '../io/lab/index.js';\nimport Color from '../Color.js';\nimport mix from '../generator/mix.js';\n\nColor.prototype.tint = function (f = 0.5, ...rest) {\n return mix(this, 'white', f, ...rest);\n};\n\nColor.prototype.shade = function (f = 0.5, ...rest) {\n return mix(this, 'black', f, ...rest);\n};\n","import Color from '../Color.js';\nimport index from './index.js';\n\nconst rgb = (col1, col2, f) => {\n const xyz0 = col1._rgb;\n const xyz1 = col2._rgb;\n return new Color(\n xyz0[0] + f * (xyz1[0] - xyz0[0]),\n xyz0[1] + f * (xyz1[1] - xyz0[1]),\n xyz0[2] + f * (xyz1[2] - xyz0[2]),\n 'rgb'\n );\n};\n\n// register interpolator\nindex.rgb = rgb;\n\nexport default rgb;\n","import Color from '../Color.js';\nconst { sqrt, pow } = Math;\nimport index from './index.js';\n\nconst lrgb = (col1, col2, f) => {\n const [x1, y1, z1] = col1._rgb;\n const [x2, y2, z2] = col2._rgb;\n return new Color(\n sqrt(pow(x1, 2) * (1 - f) + pow(x2, 2) * f),\n sqrt(pow(y1, 2) * (1 - f) + pow(y2, 2) * f),\n sqrt(pow(z1, 2) * (1 - f) + pow(z2, 2) * f),\n 'rgb'\n );\n};\n\n// register interpolator\nindex.lrgb = lrgb;\n\nexport default lrgb;\n","import '../io/lab/index.js';\nimport index from './index.js';\nimport Color from '../Color.js';\n\nconst lab = (col1, col2, f) => {\n const xyz0 = col1.lab();\n const xyz1 = col2.lab();\n return new Color(\n xyz0[0] + f * (xyz1[0] - xyz0[0]),\n xyz0[1] + f * (xyz1[1] - xyz0[1]),\n xyz0[2] + f * (xyz1[2] - xyz0[2]),\n 'lab'\n );\n};\n\n// register interpolator\nindex.lab = lab;\n\nexport default lab;\n","import Color from '../Color.js';\n\nexport default (col1, col2, f, m) => {\n let xyz0, xyz1;\n if (m === 'hsl') {\n xyz0 = col1.hsl();\n xyz1 = col2.hsl();\n } else if (m === 'hsv') {\n xyz0 = col1.hsv();\n xyz1 = col2.hsv();\n } else if (m === 'hcg') {\n xyz0 = col1.hcg();\n xyz1 = col2.hcg();\n } else if (m === 'hsi') {\n xyz0 = col1.hsi();\n xyz1 = col2.hsi();\n } else if (m === 'lch' || m === 'hcl') {\n m = 'hcl';\n xyz0 = col1.hcl();\n xyz1 = col2.hcl();\n } else if (m === 'oklch') {\n xyz0 = col1.oklch().reverse();\n xyz1 = col2.oklch().reverse();\n }\n\n let hue0, hue1, sat0, sat1, lbv0, lbv1;\n if (m.substr(0, 1) === 'h' || m === 'oklch') {\n [hue0, sat0, lbv0] = xyz0;\n [hue1, sat1, lbv1] = xyz1;\n }\n\n let sat, hue, lbv, dh;\n\n if (!isNaN(hue0) && !isNaN(hue1)) {\n // both colors have hue\n if (hue1 > hue0 && hue1 - hue0 > 180) {\n dh = hue1 - (hue0 + 360);\n } else if (hue1 < hue0 && hue0 - hue1 > 180) {\n dh = hue1 + 360 - hue0;\n } else {\n dh = hue1 - hue0;\n }\n hue = hue0 + f * dh;\n } else if (!isNaN(hue0)) {\n hue = hue0;\n if ((lbv1 == 1 || lbv1 == 0) && m != 'hsv') sat = sat0;\n } else if (!isNaN(hue1)) {\n hue = hue1;\n if ((lbv0 == 1 || lbv0 == 0) && m != 'hsv') sat = sat1;\n } else {\n hue = Number.NaN;\n }\n\n if (sat === undefined) sat = sat0 + f * (sat1 - sat0);\n lbv = lbv0 + f * (lbv1 - lbv0);\n return m === 'oklch'\n ? new Color([lbv, sat, hue], m)\n : new Color([hue, sat, lbv], m);\n};\n","import '../io/lch/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst lch = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'lch');\n};\n\n// register interpolator\nindex.lch = lch;\nindex.hcl = lch;\n\nexport default lch;\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport { type } from '../../utils/index.js';\nimport num2rgb from './num2rgb.js';\nimport rgb2num from './rgb2num.js';\n\nColor.prototype.num = function () {\n return rgb2num(this._rgb);\n};\n\nconst num = (...args) => new Color(...args, 'num');\n\nObject.assign(chroma, { num });\n\ninput.format.num = num2rgb;\n\ninput.autodetect.push({\n p: 5,\n test: (...args) => {\n if (\n args.length === 1 &&\n type(args[0]) === 'number' &&\n args[0] >= 0 &&\n args[0] <= 0xffffff\n ) {\n return 'num';\n }\n }\n});\n\nexport { num };\n","import { unpack } from '../../utils/index.js';\n\nconst rgb2num = (...args) => {\n const [r, g, b] = unpack(args, 'rgb');\n return (r << 16) + (g << 8) + b;\n};\n\nexport default rgb2num;\n","import { type } from '../../utils/index.js';\n\nconst num2rgb = (num) => {\n if (type(num) == 'number' && num >= 0 && num <= 0xffffff) {\n const r = num >> 16;\n const g = (num >> 8) & 0xff;\n const b = num & 0xff;\n return [r, g, b, 1];\n }\n throw new Error('unknown num color: ' + num);\n};\n\nexport default num2rgb;\n","import '../io/num/index.js';\nimport index from './index.js';\n\nimport Color from '../Color.js';\n\nconst num = (col1, col2, f) => {\n const c1 = col1.num();\n const c2 = col2.num();\n return new Color(c1 + f * (c2 - c1), 'num');\n};\n\n// register interpolator\nindex.num = num;\n\nexport default num;\n","import { unpack } from '../../utils/index.js';\nconst { floor } = Math;\n\n/*\n * this is basically just HSV with some minor tweaks\n *\n * hue.. [0..360]\n * chroma .. [0..1]\n * grayness .. [0..1]\n */\n\nconst hcg2rgb = (...args) => {\n args = unpack(args, 'hcg');\n let [h, c, _g] = args;\n let r, g, b;\n _g = _g * 255;\n const _c = c * 255;\n if (c === 0) {\n r = g = b = _g;\n } else {\n if (h === 360) h = 0;\n if (h > 360) h -= 360;\n if (h < 0) h += 360;\n h /= 60;\n const i = floor(h);\n const f = h - i;\n const p = _g * (1 - c);\n const q = p + _c * (1 - f);\n const t = p + _c * f;\n const v = p + _c;\n switch (i) {\n case 0:\n [r, g, b] = [v, t, p];\n break;\n case 1:\n [r, g, b] = [q, v, p];\n break;\n case 2:\n [r, g, b] = [p, v, t];\n break;\n case 3:\n [r, g, b] = [p, q, v];\n break;\n case 4:\n [r, g, b] = [t, p, v];\n break;\n case 5:\n [r, g, b] = [v, p, q];\n break;\n }\n }\n return [r, g, b, args.length > 3 ? args[3] : 1];\n};\n\nexport default hcg2rgb;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport hcg2rgb from './hcg2rgb.js';\nimport rgb2hcg from './rgb2hcg.js';\n\nColor.prototype.hcg = function () {\n return rgb2hcg(this._rgb);\n};\n\nconst hcg = (...args) => new Color(...args, 'hcg');\nchroma.hcg = hcg;\n\ninput.format.hcg = hcg2rgb;\n\ninput.autodetect.push({\n p: 1,\n test: (...args) => {\n args = unpack(args, 'hcg');\n if (type(args) === 'array' && args.length === 3) {\n return 'hcg';\n }\n }\n});\n\nexport { hcg };\n","import { unpack, max, min } from '../../utils/index.js';\n\nconst rgb2hcg = (...args) => {\n const [r, g, b] = unpack(args, 'rgb');\n const minRgb = min(r, g, b);\n const maxRgb = max(r, g, b);\n const delta = maxRgb - minRgb;\n const c = (delta * 100) / 255;\n const _g = (minRgb / (255 - delta)) * 100;\n let h;\n if (delta === 0) {\n h = Number.NaN;\n } else {\n if (r === maxRgb) h = (g - b) / delta;\n if (g === maxRgb) h = 2 + (b - r) / delta;\n if (b === maxRgb) h = 4 + (r - g) / delta;\n h *= 60;\n if (h < 0) h += 360;\n }\n return [h, c, _g];\n};\n\nexport default rgb2hcg;\n","import '../io/hcg/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst hcg = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'hcg');\n};\n\n// register interpolator\nindex.hcg = hcg;\n\nexport default hcg;\n","import { unpack, limit, TWOPI, PITHIRD } from '../../utils/index.js';\nconst { cos } = Math;\n\n/*\n * hue [0..360]\n * saturation [0..1]\n * intensity [0..1]\n */\nconst hsi2rgb = (...args) => {\n /*\n borrowed from here:\n http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp\n */\n args = unpack(args, 'hsi');\n let [h, s, i] = args;\n let r, g, b;\n\n if (isNaN(h)) h = 0;\n if (isNaN(s)) s = 0;\n // normalize hue\n if (h > 360) h -= 360;\n if (h < 0) h += 360;\n h /= 360;\n if (h < 1 / 3) {\n b = (1 - s) / 3;\n r = (1 + (s * cos(TWOPI * h)) / cos(PITHIRD - TWOPI * h)) / 3;\n g = 1 - (b + r);\n } else if (h < 2 / 3) {\n h -= 1 / 3;\n r = (1 - s) / 3;\n g = (1 + (s * cos(TWOPI * h)) / cos(PITHIRD - TWOPI * h)) / 3;\n b = 1 - (r + g);\n } else {\n h -= 2 / 3;\n g = (1 - s) / 3;\n b = (1 + (s * cos(TWOPI * h)) / cos(PITHIRD - TWOPI * h)) / 3;\n r = 1 - (g + b);\n }\n r = limit(i * r * 3);\n g = limit(i * g * 3);\n b = limit(i * b * 3);\n return [r * 255, g * 255, b * 255, args.length > 3 ? args[3] : 1];\n};\n\nexport default hsi2rgb;\n","import { unpack, TWOPI } from '../../utils/index.js';\nconst { min, sqrt, acos } = Math;\n\nconst rgb2hsi = (...args) => {\n /*\n borrowed from here:\n http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp\n */\n let [r, g, b] = unpack(args, 'rgb');\n r /= 255;\n g /= 255;\n b /= 255;\n let h;\n const min_ = min(r, g, b);\n const i = (r + g + b) / 3;\n const s = i > 0 ? 1 - min_ / i : 0;\n if (s === 0) {\n h = NaN;\n } else {\n h = (r - g + (r - b)) / 2;\n h /= sqrt((r - g) * (r - g) + (r - b) * (g - b));\n h = acos(h);\n if (b > g) {\n h = TWOPI - h;\n }\n h /= TWOPI;\n }\n return [h * 360, s, i];\n};\n\nexport default rgb2hsi;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport hsi2rgb from './hsi2rgb.js';\nimport rgb2hsi from './rgb2hsi.js';\n\nColor.prototype.hsi = function () {\n return rgb2hsi(this._rgb);\n};\n\nconst hsi = (...args) => new Color(...args, 'hsi');\nchroma.hsi = hsi;\n\ninput.format.hsi = hsi2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'hsi');\n if (type(args) === 'array' && args.length === 3) {\n return 'hsi';\n }\n }\n});\n\nexport { hsi };\n","import '../io/hsi/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst hsi = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'hsi');\n};\n\n// register interpolator\nindex.hsi = hsi;\n\nexport default hsi;\n","import { unpack } from '../../utils/index.js';\n\nconst hsl2rgb = (...args) => {\n args = unpack(args, 'hsl');\n const [h, s, l] = args;\n let r, g, b;\n if (s === 0) {\n r = g = b = l * 255;\n } else {\n const t3 = [0, 0, 0];\n const c = [0, 0, 0];\n const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const t1 = 2 * l - t2;\n const h_ = h / 360;\n t3[0] = h_ + 1 / 3;\n t3[1] = h_;\n t3[2] = h_ - 1 / 3;\n for (let i = 0; i < 3; i++) {\n if (t3[i] < 0) t3[i] += 1;\n if (t3[i] > 1) t3[i] -= 1;\n if (6 * t3[i] < 1) c[i] = t1 + (t2 - t1) * 6 * t3[i];\n else if (2 * t3[i] < 1) c[i] = t2;\n else if (3 * t3[i] < 2) c[i] = t1 + (t2 - t1) * (2 / 3 - t3[i]) * 6;\n else c[i] = t1;\n }\n [r, g, b] = [c[0] * 255, c[1] * 255, c[2] * 255];\n }\n if (args.length > 3) {\n // keep alpha channel\n return [r, g, b, args[3]];\n }\n return [r, g, b, 1];\n};\n\nexport default hsl2rgb;\n","import { unpack, min, max } from '../../utils/index.js';\n\n/*\n * supported arguments:\n * - rgb2hsl(r,g,b)\n * - rgb2hsl(r,g,b,a)\n * - rgb2hsl([r,g,b])\n * - rgb2hsl([r,g,b,a])\n * - rgb2hsl({r,g,b,a})\n */\nconst rgb2hsl = (...args) => {\n args = unpack(args, 'rgba');\n let [r, g, b] = args;\n\n r /= 255;\n g /= 255;\n b /= 255;\n\n const minRgb = min(r, g, b);\n const maxRgb = max(r, g, b);\n\n const l = (maxRgb + minRgb) / 2;\n let s, h;\n\n if (maxRgb === minRgb) {\n s = 0;\n h = Number.NaN;\n } else {\n s =\n l < 0.5\n ? (maxRgb - minRgb) / (maxRgb + minRgb)\n : (maxRgb - minRgb) / (2 - maxRgb - minRgb);\n }\n\n if (r == maxRgb) h = (g - b) / (maxRgb - minRgb);\n else if (g == maxRgb) h = 2 + (b - r) / (maxRgb - minRgb);\n else if (b == maxRgb) h = 4 + (r - g) / (maxRgb - minRgb);\n\n h *= 60;\n if (h < 0) h += 360;\n if (args.length > 3 && args[3] !== undefined) return [h, s, l, args[3]];\n return [h, s, l];\n};\n\nexport default rgb2hsl;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport hsl2rgb from './hsl2rgb.js';\nimport rgb2hsl from './rgb2hsl.js';\n\nColor.prototype.hsl = function () {\n return rgb2hsl(this._rgb);\n};\n\nconst hsl = (...args) => new Color(...args, 'hsl');\nchroma.hsl = hsl;\n\ninput.format.hsl = hsl2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'hsl');\n if (type(args) === 'array' && args.length === 3) {\n return 'hsl';\n }\n }\n});\n\nexport { hsl };\n","import '../io/hsl/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst hsl = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'hsl');\n};\n\n// register interpolator\nindex.hsl = hsl;\n\nexport default hsl;\n","import { unpack } from '../../utils/index.js';\nconst { floor } = Math;\n\nconst hsv2rgb = (...args) => {\n args = unpack(args, 'hsv');\n let [h, s, v] = args;\n let r, g, b;\n v *= 255;\n if (s === 0) {\n r = g = b = v;\n } else {\n if (h === 360) h = 0;\n if (h > 360) h -= 360;\n if (h < 0) h += 360;\n h /= 60;\n\n const i = floor(h);\n const f = h - i;\n const p = v * (1 - s);\n const q = v * (1 - s * f);\n const t = v * (1 - s * (1 - f));\n\n switch (i) {\n case 0:\n [r, g, b] = [v, t, p];\n break;\n case 1:\n [r, g, b] = [q, v, p];\n break;\n case 2:\n [r, g, b] = [p, v, t];\n break;\n case 3:\n [r, g, b] = [p, q, v];\n break;\n case 4:\n [r, g, b] = [t, p, v];\n break;\n case 5:\n [r, g, b] = [v, p, q];\n break;\n }\n }\n return [r, g, b, args.length > 3 ? args[3] : 1];\n};\n\nexport default hsv2rgb;\n","import { unpack } from '../../utils/index.js';\nconst { min, max } = Math;\n\n/*\n * supported arguments:\n * - rgb2hsv(r,g,b)\n * - rgb2hsv([r,g,b])\n * - rgb2hsv({r,g,b})\n */\nconst rgb2hsl = (...args) => {\n args = unpack(args, 'rgb');\n let [r, g, b] = args;\n const min_ = min(r, g, b);\n const max_ = max(r, g, b);\n const delta = max_ - min_;\n let h, s, v;\n v = max_ / 255.0;\n if (max_ === 0) {\n h = Number.NaN;\n s = 0;\n } else {\n s = delta / max_;\n if (r === max_) h = (g - b) / delta;\n if (g === max_) h = 2 + (b - r) / delta;\n if (b === max_) h = 4 + (r - g) / delta;\n h *= 60;\n if (h < 0) h += 360;\n }\n return [h, s, v];\n};\n\nexport default rgb2hsl;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport hsv2rgb from './hsv2rgb.js';\nimport rgb2hsv from './rgb2hsv.js';\n\nColor.prototype.hsv = function () {\n return rgb2hsv(this._rgb);\n};\n\nconst hsv = (...args) => new Color(...args, 'hsv');\nchroma.hsv = hsv;\n\ninput.format.hsv = hsv2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'hsv');\n if (type(args) === 'array' && args.length === 3) {\n return 'hsv';\n }\n }\n});\n\nexport { hsv };\n","// from https://www.w3.org/TR/css-color-4/multiply-matrices.js\nexport default function multiplyMatrices(A, B) {\n let m = A.length;\n\n if (!Array.isArray(A[0])) {\n // A is vector, convert to [[a, b, c, ...]]\n A = [A];\n }\n\n if (!Array.isArray(B[0])) {\n // B is vector, convert to [[a], [b], [c], ...]]\n B = B.map((x) => [x]);\n }\n\n let p = B[0].length;\n let B_cols = B[0].map((_, i) => B.map((x) => x[i])); // transpose B\n let product = A.map((row) =>\n B_cols.map((col) => {\n if (!Array.isArray(row)) {\n return col.reduce((a, c) => a + c * row, 0);\n }\n\n return row.reduce((a, c, i) => a + c * (col[i] || 0), 0);\n })\n );\n\n if (m === 1) {\n product = product[0]; // Avoid [[a, b, c, ...]]\n }\n\n if (p === 1) {\n return product.map((x) => x[0]); // Avoid [[a], [b], [c], ...]]\n }\n\n return product;\n}\n","import '../io/hsv/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst hsv = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'hsv');\n};\n\n// register interpolator\nindex.hsv = hsv;\n\nexport default hsv;\n","import { unpack } from '../../utils/index.js';\nimport multiplyMatrices from '../../utils/multiply-matrices.js';\nimport { xyz2rgb } from '../lab/lab2rgb.js';\n\nconst oklab2rgb = (...args) => {\n args = unpack(args, 'lab');\n const [L, a, b, ...rest] = args;\n const [X, Y, Z] = OKLab_to_XYZ([L, a, b]);\n const [r, g, b_] = xyz2rgb(X, Y, Z);\n return [r, g, b_, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\n// from https://www.w3.org/TR/css-color-4/#color-conversion-code\nfunction OKLab_to_XYZ(OKLab) {\n // Given OKLab, convert to XYZ relative to D65\n var LMStoXYZ = [\n [1.2268798758459243, -0.5578149944602171, 0.2813910456659647],\n [-0.0405757452148008, 1.112286803280317, -0.0717110580655164],\n [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816]\n ];\n var OKLabtoLMS = [\n [1.0, 0.3963377773761749, 0.2158037573099136],\n [1.0, -0.1055613458156586, -0.0638541728258133],\n [1.0, -0.0894841775298119, -1.2914855480194092]\n ];\n\n var LMSnl = multiplyMatrices(OKLabtoLMS, OKLab);\n return multiplyMatrices(\n LMStoXYZ,\n LMSnl.map((c) => c ** 3)\n );\n}\n\nexport default oklab2rgb;\n","import { unpack } from '../../utils/index.js';\nimport multiplyMatrices from '../../utils/multiply-matrices.js';\nimport { rgb2xyz } from '../lab/rgb2lab.js';\n\nconst rgb2oklab = (...args) => {\n const [r, g, b, ...rest] = unpack(args, 'rgb');\n const xyz = rgb2xyz(r, g, b);\n const oklab = XYZ_to_OKLab(xyz);\n return [...oklab, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\n// from https://www.w3.org/TR/css-color-4/#color-conversion-code\nfunction XYZ_to_OKLab(XYZ) {\n // Given XYZ relative to D65, convert to OKLab\n const XYZtoLMS = [\n [0.819022437996703, 0.3619062600528904, -0.1288737815209879],\n [0.0329836539323885, 0.9292868615863434, 0.0361446663506424],\n [0.0481771893596242, 0.2642395317527308, 0.6335478284694309]\n ];\n const LMStoOKLab = [\n [0.210454268309314, 0.7936177747023054, -0.0040720430116193],\n [1.9779985324311684, -2.4285922420485799, 0.450593709617411],\n [0.0259040424655478, 0.7827717124575296, -0.8086757549230774]\n ];\n\n const LMS = multiplyMatrices(XYZtoLMS, XYZ);\n // JavaScript Math.cbrt returns a sign-matched cube root\n // beware if porting to other languages\n // especially if tempted to use a general power function\n return multiplyMatrices(\n LMStoOKLab,\n LMS.map((c) => Math.cbrt(c))\n );\n // L in range [0,1]. For use in CSS, multiply by 100 and add a percent\n}\n\nexport default rgb2oklab;\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport oklab2rgb from './oklab2rgb.js';\nimport rgb2oklab from './rgb2oklab.js';\n\nColor.prototype.oklab = function () {\n return rgb2oklab(this._rgb);\n};\n\nconst oklab = (...args) => new Color(...args, 'oklab');\nObject.assign(chroma, { oklab });\n\ninput.format.oklab = oklab2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'oklab');\n if (type(args) === 'array' && args.length === 3) {\n return 'oklab';\n }\n }\n});\n\nexport { oklab };\n","import '../io/oklab/index.js';\nimport index from './index.js';\nimport Color from '../Color.js';\n\nconst oklab = (col1, col2, f) => {\n const xyz0 = col1.oklab();\n const xyz1 = col2.oklab();\n return new Color(\n xyz0[0] + f * (xyz1[0] - xyz0[0]),\n xyz0[1] + f * (xyz1[1] - xyz0[1]),\n xyz0[2] + f * (xyz1[2] - xyz0[2]),\n 'oklab'\n );\n};\n\n// register interpolator\nindex.oklab = oklab;\n\nexport default oklab;\n","import '../io/lch/index.js';\nimport interpolate_hsx from './_hsx.js';\nimport index from './index.js';\n\nconst oklch = (col1, col2, f) => {\n return interpolate_hsx(col1, col2, f, 'oklch');\n};\n\n// register interpolator\nindex.oklch = oklch;\n\nexport default oklch;\n","import Color from '../Color.js';\nimport { clip_rgb } from '../utils/index.js';\n\nconst { pow, sqrt, PI, cos, sin, atan2 } = Math;\n\nexport default (colors, mode = 'lrgb', weights = null) => {\n const l = colors.length;\n if (!weights) weights = Array.from(new Array(l)).map(() => 1);\n // normalize weights\n const k =\n l /\n weights.reduce(function (a, b) {\n return a + b;\n });\n weights.forEach((w, i) => {\n weights[i] *= k;\n });\n // convert colors to Color objects\n colors = colors.map((c) => new Color(c));\n if (mode === 'lrgb') {\n return _average_lrgb(colors, weights);\n }\n const first = colors.shift();\n const xyz = first.get(mode);\n const cnt = [];\n let dx = 0;\n let dy = 0;\n // initial color\n for (let i = 0; i < xyz.length; i++) {\n xyz[i] = (xyz[i] || 0) * weights[0];\n cnt.push(isNaN(xyz[i]) ? 0 : weights[0]);\n if (mode.charAt(i) === 'h' && !isNaN(xyz[i])) {\n const A = (xyz[i] / 180) * PI;\n dx += cos(A) * weights[0];\n dy += sin(A) * weights[0];\n }\n }\n\n let alpha = first.alpha() * weights[0];\n colors.forEach((c, ci) => {\n const xyz2 = c.get(mode);\n alpha += c.alpha() * weights[ci + 1];\n for (let i = 0; i < xyz.length; i++) {\n if (!isNaN(xyz2[i])) {\n cnt[i] += weights[ci + 1];\n if (mode.charAt(i) === 'h') {\n const A = (xyz2[i] / 180) * PI;\n dx += cos(A) * weights[ci + 1];\n dy += sin(A) * weights[ci + 1];\n } else {\n xyz[i] += xyz2[i] * weights[ci + 1];\n }\n }\n }\n });\n\n for (let i = 0; i < xyz.length; i++) {\n if (mode.charAt(i) === 'h') {\n let A = (atan2(dy / cnt[i], dx / cnt[i]) / PI) * 180;\n while (A < 0) A += 360;\n while (A >= 360) A -= 360;\n xyz[i] = A;\n } else {\n xyz[i] = xyz[i] / cnt[i];\n }\n }\n alpha /= l;\n return new Color(xyz, mode).alpha(alpha > 0.99999 ? 1 : alpha, true);\n};\n\nconst _average_lrgb = (colors, weights) => {\n const l = colors.length;\n const xyz = [0, 0, 0, 0];\n for (let i = 0; i < colors.length; i++) {\n const col = colors[i];\n const f = weights[i] / l;\n const rgb = col._rgb;\n xyz[0] += pow(rgb[0], 2) * f;\n xyz[1] += pow(rgb[1], 2) * f;\n xyz[2] += pow(rgb[2], 2) * f;\n xyz[3] += rgb[3] * f;\n }\n xyz[0] = sqrt(xyz[0]);\n xyz[1] = sqrt(xyz[1]);\n xyz[2] = sqrt(xyz[2]);\n if (xyz[3] > 0.9999999) xyz[3] = 1;\n return new Color(clip_rgb(xyz));\n};\n","// minimal multi-purpose interface\n\n// @requires utils color analyze\nimport chroma from '../chroma.js';\nimport { limit, type } from '../utils/index.js';\n\nconst { pow } = Math;\n\nexport default function (colors) {\n // constructor\n let _mode = 'rgb';\n let _nacol = chroma('#ccc');\n let _spread = 0;\n // const _fixed = false;\n let _positions = [0, 1];\n let _domain = [0, 1];\n let _pos = [];\n let _padding = [0, 0];\n let _classes = false;\n let _colors = [];\n let _out = false;\n let _min = 0;\n let _max = 1;\n let _correctLightness = false;\n let _colorCache = {};\n let _useCache = true;\n let _gamma = 1;\n\n // private methods\n\n const setColors = function (colors) {\n colors = colors || ['#fff', '#000'];\n if (\n colors &&\n type(colors) === 'string' &&\n chroma.brewer &&\n chroma.brewer[colors.toLowerCase()]\n ) {\n colors = chroma.brewer[colors.toLowerCase()];\n }\n if (type(colors) === 'array') {\n // handle single color\n if (colors.length === 1) {\n colors = [colors[0], colors[0]];\n }\n // make a copy of the colors\n colors = colors.slice(0);\n // convert to chroma classes\n for (let c = 0; c < colors.length; c++) {\n colors[c] = chroma(colors[c]);\n }\n // auto-fill color position\n _pos.length = 0;\n for (let c = 0; c < colors.length; c++) {\n _pos.push(c / (colors.length - 1));\n }\n }\n resetCache();\n return (_colors = colors);\n };\n\n const getClass = function (value) {\n if (_classes != null) {\n const n = _classes.length - 1;\n let i = 0;\n while (i < n && value >= _classes[i]) {\n i++;\n }\n return i - 1;\n }\n return 0;\n };\n\n let tMapLightness = (t) => t;\n let tMapDomain = (t) => t;\n\n // const classifyValue = function(value) {\n // let val = value;\n // if (_classes.length > 2) {\n // const n = _classes.length-1;\n // const i = getClass(value);\n // const minc = _classes[0] + ((_classes[1]-_classes[0]) * (0 + (_spread * 0.5))); // center of 1st class\n // const maxc = _classes[n-1] + ((_classes[n]-_classes[n-1]) * (1 - (_spread * 0.5))); // center of last class\n // val = _min + ((((_classes[i] + ((_classes[i+1] - _classes[i]) * 0.5)) - minc) / (maxc-minc)) * (_max - _min));\n // }\n // return val;\n // };\n\n const getColor = function (val, bypassMap) {\n let col, t;\n if (bypassMap == null) {\n bypassMap = false;\n }\n if (isNaN(val) || val === null) {\n return _nacol;\n }\n if (!bypassMap) {\n if (_classes && _classes.length > 2) {\n // find the class\n const c = getClass(val);\n t = c / (_classes.length - 2);\n } else if (_max !== _min) {\n // just interpolate between min/max\n t = (val - _min) / (_max - _min);\n } else {\n t = 1;\n }\n } else {\n t = val;\n }\n\n // domain map\n t = tMapDomain(t);\n\n if (!bypassMap) {\n t = tMapLightness(t); // lightness correction\n }\n\n if (_gamma !== 1) {\n t = pow(t, _gamma);\n }\n\n t = _padding[0] + t * (1 - _padding[0] - _padding[1]);\n\n t = limit(t, 0, 1);\n\n const k = Math.floor(t * 10000);\n\n if (_useCache && _colorCache[k]) {\n col = _colorCache[k];\n } else {\n if (type(_colors) === 'array') {\n //for i in [0.._pos.length-1]\n for (let i = 0; i < _pos.length; i++) {\n const p = _pos[i];\n if (t <= p) {\n col = _colors[i];\n break;\n }\n if (t >= p && i === _pos.length - 1) {\n col = _colors[i];\n break;\n }\n if (t > p && t < _pos[i + 1]) {\n t = (t - p) / (_pos[i + 1] - p);\n col = chroma.interpolate(\n _colors[i],\n _colors[i + 1],\n t,\n _mode\n );\n break;\n }\n }\n } else if (type(_colors) === 'function') {\n col = _colors(t);\n }\n if (_useCache) {\n _colorCache[k] = col;\n }\n }\n return col;\n };\n\n var resetCache = () => (_colorCache = {});\n\n setColors(colors);\n\n // public interface\n\n const f = function (v) {\n const c = chroma(getColor(v));\n if (_out && c[_out]) {\n return c[_out]();\n } else {\n return c;\n }\n };\n\n f.classes = function (classes) {\n if (classes != null) {\n if (type(classes) === 'array') {\n _classes = classes;\n _positions = [classes[0], classes[classes.length - 1]];\n } else {\n const d = chroma.analyze(_positions);\n if (classes === 0) {\n _classes = [d.min, d.max];\n } else {\n _classes = chroma.limits(d, 'e', classes);\n }\n }\n return f;\n }\n return _classes;\n };\n\n f.domain = function (domain) {\n if (!arguments.length) {\n // return original domain\n return _domain;\n }\n // store original domain so we can return it later\n _domain = domain.slice(0);\n _min = domain[0];\n _max = domain[domain.length - 1];\n _pos = [];\n const k = _colors.length;\n if (domain.length === k && _min !== _max) {\n // update positions\n for (let d of Array.from(domain)) {\n _pos.push((d - _min) / (_max - _min));\n }\n } else {\n for (let c = 0; c < k; c++) {\n _pos.push(c / (k - 1));\n }\n if (domain.length > 2) {\n // set domain map\n const tOut = domain.map((d, i) => i / (domain.length - 1));\n const tBreaks = domain.map((d) => (d - _min) / (_max - _min));\n if (!tBreaks.every((val, i) => tOut[i] === val)) {\n tMapDomain = (t) => {\n if (t <= 0 || t >= 1) return t;\n let i = 0;\n while (t >= tBreaks[i + 1]) i++;\n const f =\n (t - tBreaks[i]) / (tBreaks[i + 1] - tBreaks[i]);\n const out = tOut[i] + f * (tOut[i + 1] - tOut[i]);\n return out;\n };\n }\n }\n }\n _positions = [_min, _max];\n return f;\n };\n\n f.mode = function (_m) {\n if (!arguments.length) {\n return _mode;\n }\n _mode = _m;\n resetCache();\n return f;\n };\n\n f.range = function (colors, _pos) {\n setColors(colors, _pos);\n return f;\n };\n\n f.out = function (_o) {\n _out = _o;\n return f;\n };\n\n f.spread = function (val) {\n if (!arguments.length) {\n return _spread;\n }\n _spread = val;\n return f;\n };\n\n f.correctLightness = function (v) {\n if (v == null) {\n v = true;\n }\n _correctLightness = v;\n resetCache();\n if (_correctLightness) {\n tMapLightness = function (t) {\n const L0 = getColor(0, true).lab()[0];\n const L1 = getColor(1, true).lab()[0];\n const pol = L0 > L1;\n let L_actual = getColor(t, true).lab()[0];\n const L_ideal = L0 + (L1 - L0) * t;\n let L_diff = L_actual - L_ideal;\n let t0 = 0;\n let t1 = 1;\n let max_iter = 20;\n while (Math.abs(L_diff) > 1e-2 && max_iter-- > 0) {\n (function () {\n if (pol) {\n L_diff *= -1;\n }\n if (L_diff < 0) {\n t0 = t;\n t += (t1 - t) * 0.5;\n } else {\n t1 = t;\n t += (t0 - t) * 0.5;\n }\n L_actual = getColor(t, true).lab()[0];\n return (L_diff = L_actual - L_ideal);\n })();\n }\n return t;\n };\n } else {\n tMapLightness = (t) => t;\n }\n return f;\n };\n\n f.padding = function (p) {\n if (p != null) {\n if (type(p) === 'number') {\n p = [p, p];\n }\n _padding = p;\n return f;\n } else {\n return _padding;\n }\n };\n\n f.colors = function (numColors, out) {\n // If no arguments are given, return the original colors that were provided\n if (arguments.length < 2) {\n out = 'hex';\n }\n let result = [];\n\n if (arguments.length === 0) {\n result = _colors.slice(0);\n } else if (numColors === 1) {\n result = [f(0.5)];\n } else if (numColors > 1) {\n const dm = _positions[0];\n const dd = _positions[1] - dm;\n result = __range__(0, numColors, false).map((i) =>\n f(dm + (i / (numColors - 1)) * dd)\n );\n } else {\n // returns all colors based on the defined classes\n colors = [];\n let samples = [];\n if (_classes && _classes.length > 2) {\n for (\n let i = 1, end = _classes.length, asc = 1 <= end;\n asc ? i < end : i > end;\n asc ? i++ : i--\n ) {\n samples.push((_classes[i - 1] + _classes[i]) * 0.5);\n }\n } else {\n samples = _positions;\n }\n result = samples.map((v) => f(v));\n }\n\n if (chroma[out]) {\n result = result.map((c) => c[out]());\n }\n return result;\n };\n\n f.cache = function (c) {\n if (c != null) {\n _useCache = c;\n return f;\n } else {\n return _useCache;\n }\n };\n\n f.gamma = function (g) {\n if (g != null) {\n _gamma = g;\n return f;\n } else {\n return _gamma;\n }\n };\n\n f.nodata = function (d) {\n if (d != null) {\n _nacol = chroma(d);\n return f;\n } else {\n return _nacol;\n }\n };\n\n return f;\n}\n\nfunction __range__(left, right, inclusive) {\n let range = [];\n let ascending = left < right;\n let end = !inclusive ? right : ascending ? right + 1 : right - 1;\n for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {\n range.push(i);\n }\n return range;\n}\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport { unpack, type } from '../../utils/index.js';\nconst { round } = Math;\n\nColor.prototype.rgb = function (rnd = true) {\n if (rnd === false) return this._rgb.slice(0, 3);\n return this._rgb.slice(0, 3).map(round);\n};\n\nColor.prototype.rgba = function (rnd = true) {\n return this._rgb.slice(0, 4).map((v, i) => {\n return i < 3 ? (rnd === false ? v : round(v)) : v;\n });\n};\n\nconst rgb = (...args) => new Color(...args, 'rgb');\nObject.assign(chroma, { rgb });\n\ninput.format.rgb = (...args) => {\n const rgba = unpack(args, 'rgba');\n if (rgba[3] === undefined) rgba[3] = 1;\n return rgba;\n};\n\ninput.autodetect.push({\n p: 3,\n test: (...args) => {\n args = unpack(args, 'rgba');\n if (\n type(args) === 'array' &&\n (args.length === 3 ||\n (args.length === 4 &&\n type(args[3]) == 'number' &&\n args[3] >= 0 &&\n args[3] <= 1))\n ) {\n return 'rgb';\n }\n }\n});\n\nexport { rgb };\n","/*\n * interpolates between a set of colors uzing a bezier spline\n * blend mode formulas taken from https://web.archive.org/web/20180110014946/http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/\n */\n\nimport '../io/rgb/index.js';\nimport chroma from '../chroma.js';\n\nconst blend = (bottom, top, mode) => {\n if (!blend[mode]) {\n throw new Error('unknown blend mode ' + mode);\n }\n return blend[mode](bottom, top);\n};\n\nconst blend_f = (f) => (bottom, top) => {\n const c0 = chroma(top).rgb();\n const c1 = chroma(bottom).rgb();\n return chroma.rgb(f(c0, c1));\n};\n\nconst each = (f) => (c0, c1) => {\n const out = [];\n out[0] = f(c0[0], c1[0]);\n out[1] = f(c0[1], c1[1]);\n out[2] = f(c0[2], c1[2]);\n return out;\n};\n\nconst normal = (a) => a;\nconst multiply = (a, b) => (a * b) / 255;\nconst darken = (a, b) => (a > b ? b : a);\nconst lighten = (a, b) => (a > b ? a : b);\nconst screen = (a, b) => 255 * (1 - (1 - a / 255) * (1 - b / 255));\nconst overlay = (a, b) =>\n b < 128 ? (2 * a * b) / 255 : 255 * (1 - 2 * (1 - a / 255) * (1 - b / 255));\nconst burn = (a, b) => 255 * (1 - (1 - b / 255) / (a / 255));\nconst dodge = (a, b) => {\n if (a === 255) return 255;\n a = (255 * (b / 255)) / (1 - a / 255);\n return a > 255 ? 255 : a;\n};\n\n// # add = (a,b) ->\n// # if (a + b > 255) then 255 else a + b\n\nblend.normal = blend_f(each(normal));\nblend.multiply = blend_f(each(multiply));\nblend.screen = blend_f(each(screen));\nblend.overlay = blend_f(each(overlay));\nblend.darken = blend_f(each(darken));\nblend.lighten = blend_f(each(lighten));\nblend.dodge = blend_f(each(dodge));\nblend.burn = blend_f(each(burn));\n// blend.add = blend_f(each(add));\n\nexport default blend;\n","// cubehelix interpolation\n// based on D.A. Green \"A colour scheme for the display of astronomical intensity images\"\n// http://astron-soc.in/bulletin/11June/289392011.pdf\nimport { type, clip_rgb, TWOPI } from '../utils/index.js';\nimport chroma from '../chroma.js';\nconst { pow, sin, cos } = Math;\n\nexport default function (\n start = 300,\n rotations = -1.5,\n hue = 1,\n gamma = 1,\n lightness = [0, 1]\n) {\n let dh = 0,\n dl;\n if (type(lightness) === 'array') {\n dl = lightness[1] - lightness[0];\n } else {\n dl = 0;\n lightness = [lightness, lightness];\n }\n const f = function (fract) {\n const a = TWOPI * ((start + 120) / 360 + rotations * fract);\n const l = pow(lightness[0] + dl * fract, gamma);\n const h = dh !== 0 ? hue[0] + fract * dh : hue;\n const amp = (h * l * (1 - l)) / 2;\n const cos_a = cos(a);\n const sin_a = sin(a);\n const r = l + amp * (-0.14861 * cos_a + 1.78277 * sin_a);\n const g = l + amp * (-0.29227 * cos_a - 0.90649 * sin_a);\n const b = l + amp * (+1.97294 * cos_a);\n return chroma(clip_rgb([r * 255, g * 255, b * 255, 1]));\n };\n f.start = function (s) {\n if (s == null) {\n return start;\n }\n start = s;\n return f;\n };\n f.rotations = function (r) {\n if (r == null) {\n return rotations;\n }\n rotations = r;\n return f;\n };\n f.gamma = function (g) {\n if (g == null) {\n return gamma;\n }\n gamma = g;\n return f;\n };\n f.hue = function (h) {\n if (h == null) {\n return hue;\n }\n hue = h;\n if (type(hue) === 'array') {\n dh = hue[1] - hue[0];\n if (dh === 0) {\n hue = hue[1];\n }\n } else {\n dh = 0;\n }\n return f;\n };\n f.lightness = function (h) {\n if (h == null) {\n return lightness;\n }\n if (type(h) === 'array') {\n lightness = h;\n dl = h[1] - h[0];\n } else {\n lightness = [h, h];\n dl = 0;\n }\n return f;\n };\n f.scale = () => chroma.scale(f);\n f.hue(hue);\n return f;\n}\n","import Color from '../Color.js';\nconst digits = '0123456789abcdef';\n\nconst { floor, random } = Math;\n\n/**\n * Generates a random color.\n * @param {() => number} rng - A random number generator function.\n */\nexport default (rng = random) => {\n let code = '#';\n for (let i = 0; i < 6; i++) {\n code += digits.charAt(floor(rng() * 16));\n }\n return new Color(code, 'hex');\n};\n","import type from './type.js';\n\nconst { log, pow, floor, abs } = Math;\n\nexport function analyze(data, key = null) {\n const r = {\n min: Number.MAX_VALUE,\n max: Number.MAX_VALUE * -1,\n sum: 0,\n values: [],\n count: 0\n };\n if (type(data) === 'object') {\n data = Object.values(data);\n }\n data.forEach((val) => {\n if (key && type(val) === 'object') val = val[key];\n if (val !== undefined && val !== null && !isNaN(val)) {\n r.values.push(val);\n r.sum += val;\n if (val < r.min) r.min = val;\n if (val > r.max) r.max = val;\n r.count += 1;\n }\n });\n\n r.domain = [r.min, r.max];\n\n r.limits = (mode, num) => limits(r, mode, num);\n\n return r;\n}\n\nexport function limits(data, mode = 'equal', num = 7) {\n if (type(data) == 'array') {\n data = analyze(data);\n }\n const { min, max } = data;\n const values = data.values.sort((a, b) => a - b);\n\n if (num === 1) {\n return [min, max];\n }\n\n const limits = [];\n\n if (mode.substr(0, 1) === 'c') {\n // continuous\n limits.push(min);\n limits.push(max);\n }\n\n if (mode.substr(0, 1) === 'e') {\n // equal interval\n limits.push(min);\n for (let i = 1; i < num; i++) {\n limits.push(min + (i / num) * (max - min));\n }\n limits.push(max);\n } else if (mode.substr(0, 1) === 'l') {\n // log scale\n if (min <= 0) {\n throw new Error(\n 'Logarithmic scales are only possible for values > 0'\n );\n }\n const min_log = Math.LOG10E * log(min);\n const max_log = Math.LOG10E * log(max);\n limits.push(min);\n for (let i = 1; i < num; i++) {\n limits.push(pow(10, min_log + (i / num) * (max_log - min_log)));\n }\n limits.push(max);\n } else if (mode.substr(0, 1) === 'q') {\n // quantile scale\n limits.push(min);\n for (let i = 1; i < num; i++) {\n const p = ((values.length - 1) * i) / num;\n const pb = floor(p);\n if (pb === p) {\n limits.push(values[pb]);\n } else {\n // p > pb\n const pr = p - pb;\n limits.push(values[pb] * (1 - pr) + values[pb + 1] * pr);\n }\n }\n limits.push(max);\n } else if (mode.substr(0, 1) === 'k') {\n // k-means clustering\n /*\n implementation based on\n http://code.google.com/p/figue/source/browse/trunk/figue.js#336\n simplified for 1-d input values\n */\n let cluster;\n const n = values.length;\n const assignments = new Array(n);\n const clusterSizes = new Array(num);\n let repeat = true;\n let nb_iters = 0;\n let centroids = null;\n\n // get seed values\n centroids = [];\n centroids.push(min);\n for (let i = 1; i < num; i++) {\n centroids.push(min + (i / num) * (max - min));\n }\n centroids.push(max);\n\n while (repeat) {\n // assignment step\n for (let j = 0; j < num; j++) {\n clusterSizes[j] = 0;\n }\n for (let i = 0; i < n; i++) {\n const value = values[i];\n let mindist = Number.MAX_VALUE;\n let best;\n for (let j = 0; j < num; j++) {\n const dist = abs(centroids[j] - value);\n if (dist < mindist) {\n mindist = dist;\n best = j;\n }\n clusterSizes[best]++;\n assignments[i] = best;\n }\n }\n\n // update centroids step\n const newCentroids = new Array(num);\n for (let j = 0; j < num; j++) {\n newCentroids[j] = null;\n }\n for (let i = 0; i < n; i++) {\n cluster = assignments[i];\n if (newCentroids[cluster] === null) {\n newCentroids[cluster] = values[i];\n } else {\n newCentroids[cluster] += values[i];\n }\n }\n for (let j = 0; j < num; j++) {\n newCentroids[j] *= 1 / clusterSizes[j];\n }\n\n // check convergence\n repeat = false;\n for (let j = 0; j < num; j++) {\n if (newCentroids[j] !== centroids[j]) {\n repeat = true;\n break;\n }\n }\n\n centroids = newCentroids;\n nb_iters++;\n\n if (nb_iters > 200) {\n repeat = false;\n }\n }\n\n // finished k-means clustering\n // the next part is borrowed from gabrielflor.it\n const kClusters = {};\n for (let j = 0; j < num; j++) {\n kClusters[j] = [];\n }\n for (let i = 0; i < n; i++) {\n cluster = assignments[i];\n kClusters[cluster].push(values[i]);\n }\n let tmpKMeansBreaks = [];\n for (let j = 0; j < num; j++) {\n tmpKMeansBreaks.push(kClusters[j][0]);\n tmpKMeansBreaks.push(kClusters[j][kClusters[j].length - 1]);\n }\n tmpKMeansBreaks = tmpKMeansBreaks.sort((a, b) => a - b);\n limits.push(tmpKMeansBreaks[0]);\n for (let i = 1; i < tmpKMeansBreaks.length; i += 2) {\n const v = tmpKMeansBreaks[i];\n if (!isNaN(v) && limits.indexOf(v) === -1) {\n limits.push(v);\n }\n }\n }\n return limits;\n}\n","import Color from '../Color.js';\nimport mix from '../generator/mix.js';\n\n/**\n * @license\n *\n * The APCA contrast prediction algorithm is based of the formulas published\n * in the APCA-1.0.98G specification by Myndex. The specification is available at:\n * https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg\n *\n * Note that the APCA implementation is still beta, so please update to\n * future versions of chroma.js when they become available.\n *\n * You can read more about the APCA Readability Criterion at\n * https://readtech.org/ARC/\n */\n\n// constants\nconst W_offset = 0.027;\nconst P_in = 0.0005;\nconst P_out = 0.1;\nconst R_scale = 1.14;\nconst B_threshold = 0.022;\nconst B_exp = 1.414;\n\nexport default (text, bg) => {\n // parse input colors\n text = new Color(text);\n bg = new Color(bg);\n // if text color has alpha, blend against background\n if (text.alpha() < 1) {\n text = mix(bg, text, text.alpha(), 'rgb');\n }\n const l_text = lum(...text.rgb());\n const l_bg = lum(...bg.rgb());\n\n // soft clamp black levels\n const Y_text =\n l_text >= B_threshold\n ? l_text\n : l_text + Math.pow(B_threshold - l_text, B_exp);\n const Y_bg =\n l_bg >= B_threshold ? l_bg : l_bg + Math.pow(B_threshold - l_bg, B_exp);\n\n // normal polarity (dark text on light background)\n const S_norm = Math.pow(Y_bg, 0.56) - Math.pow(Y_text, 0.57);\n // reverse polarity (light text on dark background)\n const S_rev = Math.pow(Y_bg, 0.65) - Math.pow(Y_text, 0.62);\n // clamp noise then scale\n const C =\n Math.abs(Y_bg - Y_text) < P_in\n ? 0\n : Y_text < Y_bg\n ? S_norm * R_scale\n : S_rev * R_scale;\n // clamp minimum contrast then offset\n const S_apc = Math.abs(C) < P_out ? 0 : C > 0 ? C - W_offset : C + W_offset;\n // scale to 100\n return S_apc * 100;\n};\n\nfunction lum(r, g, b) {\n return (\n 0.2126729 * Math.pow(r / 255, 2.4) +\n 0.7151522 * Math.pow(g / 255, 2.4) +\n 0.072175 * Math.pow(b / 255, 2.4)\n );\n}\n","import Color from '../Color.js';\nconst { sqrt, pow, min, max, atan2, abs, cos, sin, exp, PI } = Math;\n\nexport default function (a, b, Kl = 1, Kc = 1, Kh = 1) {\n // Delta E (CIE 2000)\n // see http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE2000.html\n var rad2deg = function (rad) {\n return (360 * rad) / (2 * PI);\n };\n var deg2rad = function (deg) {\n return (2 * PI * deg) / 360;\n };\n a = new Color(a);\n b = new Color(b);\n const [L1, a1, b1] = Array.from(a.lab());\n const [L2, a2, b2] = Array.from(b.lab());\n const avgL = (L1 + L2) / 2;\n const C1 = sqrt(pow(a1, 2) + pow(b1, 2));\n const C2 = sqrt(pow(a2, 2) + pow(b2, 2));\n const avgC = (C1 + C2) / 2;\n const G = 0.5 * (1 - sqrt(pow(avgC, 7) / (pow(avgC, 7) + pow(25, 7))));\n const a1p = a1 * (1 + G);\n const a2p = a2 * (1 + G);\n const C1p = sqrt(pow(a1p, 2) + pow(b1, 2));\n const C2p = sqrt(pow(a2p, 2) + pow(b2, 2));\n const avgCp = (C1p + C2p) / 2;\n const arctan1 = rad2deg(atan2(b1, a1p));\n const arctan2 = rad2deg(atan2(b2, a2p));\n const h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360;\n const h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360;\n const avgHp =\n abs(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h2p) / 2;\n const T =\n 1 -\n 0.17 * cos(deg2rad(avgHp - 30)) +\n 0.24 * cos(deg2rad(2 * avgHp)) +\n 0.32 * cos(deg2rad(3 * avgHp + 6)) -\n 0.2 * cos(deg2rad(4 * avgHp - 63));\n let deltaHp = h2p - h1p;\n deltaHp =\n abs(deltaHp) <= 180\n ? deltaHp\n : h2p <= h1p\n ? deltaHp + 360\n : deltaHp - 360;\n deltaHp = 2 * sqrt(C1p * C2p) * sin(deg2rad(deltaHp) / 2);\n const deltaL = L2 - L1;\n const deltaCp = C2p - C1p;\n const sl = 1 + (0.015 * pow(avgL - 50, 2)) / sqrt(20 + pow(avgL - 50, 2));\n const sc = 1 + 0.045 * avgCp;\n const sh = 1 + 0.015 * avgCp * T;\n const deltaTheta = 30 * exp(-pow((avgHp - 275) / 25, 2));\n const Rc = 2 * sqrt(pow(avgCp, 7) / (pow(avgCp, 7) + pow(25, 7)));\n const Rt = -Rc * sin(2 * deg2rad(deltaTheta));\n const result = sqrt(\n pow(deltaL / (Kl * sl), 2) +\n pow(deltaCp / (Kc * sc), 2) +\n pow(deltaHp / (Kh * sh), 2) +\n Rt * (deltaCp / (Kc * sc)) * (deltaHp / (Kh * sh))\n );\n return max(0, min(100, result));\n}\n","import Color from '../Color.js';\n\nexport default (...args) => {\n try {\n new Color(...args);\n return true;\n // eslint-disable-next-line\n } catch (e) {\n return false;\n }\n};\n","// some pre-defined color scales:\nimport chroma from '../chroma.js';\nimport '../io/hsl/index.js';\nimport scale from '../generator/scale.js';\n\nexport default {\n cool() {\n return scale([chroma.hsl(180, 1, 0.9), chroma.hsl(250, 0.7, 0.4)]);\n },\n hot() {\n return scale(['#000', '#f00', '#ff0', '#fff'], [0, 0.25, 0.75, 1]).mode(\n 'rgb'\n );\n }\n};\n","/**\n ColorBrewer colors for chroma.js\n\n Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The\n Pennsylvania State University.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software distributed\n under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n CONDITIONS OF ANY KIND, either express or implied. See the License for the\n specific language governing permissions and limitations under the License.\n*/\n\nconst colorbrewer = {\n // sequential\n OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],\n PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],\n BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],\n Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],\n BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],\n YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],\n YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],\n Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],\n RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],\n Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],\n YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],\n Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],\n GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],\n Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],\n YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],\n PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],\n Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],\n PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],\n Viridis: ['#440154', '#482777', '#3f4a8a', '#31678e', '#26838f', '#1f9d8a', '#6cce5a', '#b6de2b', '#fee825'],\n\n // diverging\n Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],\n RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],\n RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],\n PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],\n PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],\n RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],\n BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],\n RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],\n PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],\n\n // qualitative\n Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],\n Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],\n Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],\n Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'],\n Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],\n Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],\n Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],\n Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2']\n};\n\nconst colorbrewerTypes = Object.keys(colorbrewer);\nconst typeMap = new Map(colorbrewerTypes.map((key) => [key.toLowerCase(), key]));\n\n// use Proxy to allow case-insensitive access to palettes\nconst colorbrewerProxy =\n typeof Proxy === 'function'\n ? new Proxy(colorbrewer, {\n get(target, prop) {\n const lower = prop.toLowerCase();\n if (typeMap.has(lower)) {\n return target[typeMap.get(lower)];\n }\n },\n getOwnPropertyNames() {\n return Object.getOwnPropertyNames(colorbrewerTypes);\n }\n })\n : colorbrewer;\n\nexport default colorbrewerProxy;\n","import { unpack } from '../../utils/index.js';\nconst { max } = Math;\n\nconst rgb2cmyk = (...args) => {\n let [r, g, b] = unpack(args, 'rgb');\n r = r / 255;\n g = g / 255;\n b = b / 255;\n const k = 1 - max(r, max(g, b));\n const f = k < 1 ? 1 / (1 - k) : 0;\n const c = (1 - r - k) * f;\n const m = (1 - g - k) * f;\n const y = (1 - b - k) * f;\n return [c, m, y, k];\n};\n\nexport default rgb2cmyk;\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport { unpack, type } from '../../utils/index.js';\nimport cmyk2rgb from './cmyk2rgb.js';\nimport rgb2cmyk from './rgb2cmyk.js';\n\nColor.prototype.cmyk = function () {\n return rgb2cmyk(this._rgb);\n};\n\nconst cmyk = (...args) => new Color(...args, 'cmyk');\nObject.assign(chroma, { cmyk });\n\ninput.format.cmyk = cmyk2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'cmyk');\n if (type(args) === 'array' && args.length === 4) {\n return 'cmyk';\n }\n }\n});\n\nexport { cmyk };\n","import { unpack } from '../../utils/index.js';\n\nconst cmyk2rgb = (...args) => {\n args = unpack(args, 'cmyk');\n const [c, m, y, k] = args;\n const alpha = args.length > 4 ? args[4] : 1;\n if (k === 1) return [0, 0, 0, alpha];\n return [\n c >= 1 ? 0 : 255 * (1 - c) * (1 - k), // r\n m >= 1 ? 0 : 255 * (1 - m) * (1 - k), // g\n y >= 1 ? 0 : 255 * (1 - y) * (1 - k), // b\n alpha\n ];\n};\n\nexport default cmyk2rgb;\n","import { unpack, last, rnd2 } from '../../utils/index.js';\n\n/*\n * supported arguments:\n * - hsl2css(h,s,l)\n * - hsl2css(h,s,l,a)\n * - hsl2css([h,s,l], mode)\n * - hsl2css([h,s,l,a], mode)\n * - hsl2css({h,s,l,a}, mode)\n */\nconst hsl2css = (...args) => {\n const hsla = unpack(args, 'hsla');\n let mode = last(args) || 'lsa';\n hsla[0] = rnd2(hsla[0] || 0) + 'deg';\n hsla[1] = rnd2(hsla[1] * 100) + '%';\n hsla[2] = rnd2(hsla[2] * 100) + '%';\n if (mode === 'hsla' || (hsla.length > 3 && hsla[3] < 1)) {\n hsla[3] = '/ ' + (hsla.length > 3 ? hsla[3] : 1);\n mode = 'hsla';\n } else {\n hsla.length = 3;\n }\n return `${mode.substr(0, 3)}(${hsla.join(' ')})`;\n};\n\nexport default hsl2css;\n","import { unpack } from '../../utils/index.js';\nimport rgb2oklab from '../oklab/rgb2oklab.js';\nimport lab2lch from '../lch/lab2lch.js';\n\nconst rgb2oklch = (...args) => {\n const [r, g, b, ...rest] = unpack(args, 'rgb');\n const [l, a, b_] = rgb2oklab(r, g, b);\n const [L, c, h] = lab2lch(l, a, b_);\n return [L, c, h, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\nexport default rgb2oklch;\n","import { unpack, last } from '../../utils/index.js';\nimport hsl2css from './hsl2css.js';\nimport rgb2hsl from '../hsl/rgb2hsl.js';\nimport lab2css from './lab2css.js';\nimport rgb2lab from '../lab/rgb2lab.js';\nimport lch2css from './lch2css.js';\nimport rgb2lch from '../lch/rgb2lch.js';\nimport rgb2oklab from '../oklab/rgb2oklab.js';\nimport oklab2css from './oklab2css.js';\nimport rgb2oklch from '../oklch/rgb2oklch.js';\nimport oklch2css from './oklch2css.js';\nimport { getLabWhitePoint, setLabWhitePoint } from '../lab/lab-constants.js';\nconst { round } = Math;\n\n/*\n * supported arguments:\n * - rgb2css(r,g,b)\n * - rgb2css(r,g,b,a)\n * - rgb2css([r,g,b], mode)\n * - rgb2css([r,g,b,a], mode)\n * - rgb2css({r,g,b,a}, mode)\n */\nconst rgb2css = (...args) => {\n const rgba = unpack(args, 'rgba');\n let mode = last(args) || 'rgb';\n if (mode.substr(0, 3) === 'hsl') {\n return hsl2css(rgb2hsl(rgba), mode);\n }\n if (mode.substr(0, 3) === 'lab') {\n // change to D50 lab whitepoint since this is what W3C is using for CSS Lab colors\n const prevWhitePoint = getLabWhitePoint();\n setLabWhitePoint('d50');\n const cssColor = lab2css(rgb2lab(rgba), mode);\n setLabWhitePoint(prevWhitePoint);\n return cssColor;\n }\n if (mode.substr(0, 3) === 'lch') {\n // change to D50 lab whitepoint since this is what W3C is using for CSS Lab colors\n const prevWhitePoint = getLabWhitePoint();\n setLabWhitePoint('d50');\n const cssColor = lch2css(rgb2lch(rgba), mode);\n setLabWhitePoint(prevWhitePoint);\n return cssColor;\n }\n if (mode.substr(0, 5) === 'oklab') {\n return oklab2css(rgb2oklab(rgba));\n }\n if (mode.substr(0, 5) === 'oklch') {\n return oklch2css(rgb2oklch(rgba));\n }\n rgba[0] = round(rgba[0]);\n rgba[1] = round(rgba[1]);\n rgba[2] = round(rgba[2]);\n if (mode === 'rgba' || (rgba.length > 3 && rgba[3] < 1)) {\n rgba[3] = '/ ' + (rgba.length > 3 ? rgba[3] : 1);\n mode = 'rgba';\n }\n return `${mode.substr(0, 3)}(${rgba.slice(0, mode === 'rgb' ? 3 : 4).join(' ')})`;\n};\n\nexport default rgb2css;\n","import { unpack, last, rnd2 } from '../../utils/index.js';\n\n/*\n * supported arguments:\n * - lab2css(l,a,b)\n * - lab2css(l,a,b,alpha)\n * - lab2css([l,a,b], mode)\n * - lab2css([l,a,b,alpha], mode)\n */\nconst lab2css = (...args) => {\n const laba = unpack(args, 'lab');\n let mode = last(args) || 'lab';\n laba[0] = rnd2(laba[0]) + '%';\n laba[1] = rnd2(laba[1]);\n laba[2] = rnd2(laba[2]);\n if (mode === 'laba' || (laba.length > 3 && laba[3] < 1)) {\n laba[3] = '/ ' + (laba.length > 3 ? laba[3] : 1);\n } else {\n laba.length = 3;\n }\n return `lab(${laba.join(' ')})`;\n};\n\nexport default lab2css;\n","import { unpack, last, rnd2 } from '../../utils/index.js';\n\n/*\n * supported arguments:\n * - lab2css(l,a,b)\n * - lab2css(l,a,b,alpha)\n * - lab2css([l,a,b], mode)\n * - lab2css([l,a,b,alpha], mode)\n */\nconst lch2css = (...args) => {\n const lcha = unpack(args, 'lch');\n let mode = last(args) || 'lab';\n lcha[0] = rnd2(lcha[0]) + '%';\n lcha[1] = rnd2(lcha[1]);\n lcha[2] = isNaN(lcha[2]) ? 'none' : rnd2(lcha[2]) + 'deg'; // add deg unit to hue\n if (mode === 'lcha' || (lcha.length > 3 && lcha[3] < 1)) {\n lcha[3] = '/ ' + (lcha.length > 3 ? lcha[3] : 1);\n } else {\n lcha.length = 3;\n }\n return `lch(${lcha.join(' ')})`;\n};\n\nexport default lch2css;\n","import { unpack, rnd2, rnd3 } from '../../utils/index.js';\n\nconst oklab2css = (...args) => {\n const laba = unpack(args, 'lab');\n laba[0] = rnd2(laba[0] * 100) + '%';\n laba[1] = rnd3(laba[1]);\n laba[2] = rnd3(laba[2]);\n if (laba.length > 3 && laba[3] < 1) {\n laba[3] = '/ ' + (laba.length > 3 ? laba[3] : 1);\n } else {\n laba.length = 3;\n }\n return `oklab(${laba.join(' ')})`;\n};\n\nexport default oklab2css;\n","import { unpack, rnd2, rnd3 } from '../../utils/index.js';\n\nconst oklch2css = (...args) => {\n const lcha = unpack(args, 'lch');\n lcha[0] = rnd2(lcha[0] * 100) + '%';\n lcha[1] = rnd3(lcha[1]);\n lcha[2] = isNaN(lcha[2]) ? 'none' : rnd2(lcha[2]) + 'deg'; // add deg unit to hue\n if (lcha.length > 3 && lcha[3] < 1) {\n lcha[3] = '/ ' + (lcha.length > 3 ? lcha[3] : 1);\n } else {\n lcha.length = 3;\n }\n return `oklch(${lcha.join(' ')})`;\n};\n\nexport default oklch2css;\n","import { unpack } from '../../utils/index.js';\nimport lch2lab from '../lch/lch2lab.js';\nimport oklab2rgb from '../oklab/oklab2rgb.js';\n\nconst oklch2rgb = (...args) => {\n args = unpack(args, 'lch');\n const [l, c, h, ...rest] = args;\n const [L, a, b_] = lch2lab(l, c, h);\n const [r, g, b] = oklab2rgb(L, a, b_);\n return [r, g, b, ...(rest.length > 0 && rest[0] < 1 ? [rest[0]] : [])];\n};\n\nexport default oklch2rgb;\n","import hsl2rgb from '../hsl/hsl2rgb.js';\nimport lab2rgb from '../lab/lab2rgb.js';\nimport lch2rgb from '../lch/lch2rgb.js';\nimport oklab2rgb from '../oklab/oklab2rgb.js';\nimport oklch2rgb from '../oklch/oklch2rgb.js';\nimport input from '../input.js';\nimport limit from '../../utils/limit.js';\nimport { getLabWhitePoint, setLabWhitePoint } from '../lab/lab-constants.js';\n\nconst INT_OR_PCT = /((?:-?\\d+)|(?:-?\\d+(?:\\.\\d+)?)%|none)/.source;\nconst FLOAT_OR_PCT = /((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)%?)|none)/.source;\nconst PCT = /((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)%)|none)/.source;\nconst RE_S = /\\s*/.source;\nconst SEP = /\\s+/.source;\nconst COMMA = /\\s*,\\s*/.source;\nconst ANLGE = /((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:deg)?)|none)/.source;\nconst ALPHA = /\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?/.source;\n\n// e.g. rgb(250 20 0), rgb(100% 50% 20%), rgb(100% 50% 20% / 0.5)\nconst RE_RGB = new RegExp(\n '^rgba?\\\\(' +\n RE_S +\n [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\nconst RE_RGB_LEGACY = new RegExp(\n '^rgb\\\\(' +\n RE_S +\n [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT].join(COMMA) +\n RE_S +\n '\\\\)$'\n);\nconst RE_RGBA_LEGACY = new RegExp(\n '^rgba\\\\(' +\n RE_S +\n [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT, FLOAT_OR_PCT].join(COMMA) +\n RE_S +\n '\\\\)$'\n);\n\nconst RE_HSL = new RegExp(\n '^hsla?\\\\(' + RE_S + [ANLGE, PCT, PCT].join(SEP) + ALPHA + '\\\\)$'\n);\nconst RE_HSL_LEGACY = new RegExp(\n '^hsl?\\\\(' + RE_S + [ANLGE, PCT, PCT].join(COMMA) + RE_S + '\\\\)$'\n);\nconst RE_HSLA_LEGACY =\n /^hsla\\(\\s*(-?\\d+(?:\\.\\d+)?),\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*([01]|[01]?\\.\\d+)\\)$/;\n\nconst RE_LAB = new RegExp(\n '^lab\\\\(' +\n RE_S +\n [FLOAT_OR_PCT, FLOAT_OR_PCT, FLOAT_OR_PCT].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\nconst RE_LCH = new RegExp(\n '^lch\\\\(' +\n RE_S +\n [FLOAT_OR_PCT, FLOAT_OR_PCT, ANLGE].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\nconst RE_OKLAB = new RegExp(\n '^oklab\\\\(' +\n RE_S +\n [FLOAT_OR_PCT, FLOAT_OR_PCT, FLOAT_OR_PCT].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\nconst RE_OKLCH = new RegExp(\n '^oklch\\\\(' +\n RE_S +\n [FLOAT_OR_PCT, FLOAT_OR_PCT, ANLGE].join(SEP) +\n ALPHA +\n '\\\\)$'\n);\n\nconst { round } = Math;\n\nconst roundRGB = (rgb) => {\n return rgb.map((v, i) => (i <= 2 ? limit(round(v), 0, 255) : v));\n};\n\nconst percentToAbsolute = (pct, min = 0, max = 100, signed = false) => {\n if (typeof pct === 'string' && pct.endsWith('%')) {\n pct = parseFloat(pct.substring(0, pct.length - 1)) / 100;\n if (signed) {\n // signed percentages are in the range -100% to 100%\n pct = min + (pct + 1) * 0.5 * (max - min);\n } else {\n pct = min + pct * (max - min);\n }\n }\n return +pct;\n};\n\nconst noneToValue = (v, noneValue) => {\n return v === 'none' ? noneValue : v;\n};\n\nconst css2rgb = (css) => {\n css = css.toLowerCase().trim();\n\n if (css === 'transparent') {\n return [0, 0, 0, 0];\n }\n\n let m;\n\n if (input.format.named) {\n try {\n return input.format.named(css);\n // eslint-disable-next-line\n } catch (e) {}\n }\n\n // rgb(250 20 0) or rgb(250,20,0)\n if ((m = css.match(RE_RGB)) || (m = css.match(RE_RGB_LEGACY))) {\n let rgb = m.slice(1, 4);\n for (let i = 0; i < 3; i++) {\n rgb[i] = +percentToAbsolute(noneToValue(rgb[i], 0), 0, 255);\n }\n rgb = roundRGB(rgb);\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha; // default alpha\n return rgb;\n }\n\n // rgba(250,20,0,0.4)\n if ((m = css.match(RE_RGBA_LEGACY))) {\n const rgb = m.slice(1, 5);\n for (let i = 0; i < 4; i++) {\n rgb[i] = +percentToAbsolute(rgb[i], 0, 255);\n }\n return rgb;\n }\n\n // hsl(0,100%,50%)\n if ((m = css.match(RE_HSL)) || (m = css.match(RE_HSL_LEGACY))) {\n const hsl = m.slice(1, 4);\n hsl[0] = +noneToValue(hsl[0].replace('deg', ''), 0);\n hsl[1] = +percentToAbsolute(noneToValue(hsl[1], 0), 0, 100) * 0.01;\n hsl[2] = +percentToAbsolute(noneToValue(hsl[2], 0), 0, 100) * 0.01;\n const rgb = roundRGB(hsl2rgb(hsl));\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n\n // hsla(0,100%,50%,0.5)\n if ((m = css.match(RE_HSLA_LEGACY))) {\n const hsl = m.slice(1, 4);\n hsl[1] *= 0.01;\n hsl[2] *= 0.01;\n const rgb = hsl2rgb(hsl);\n for (let i = 0; i < 3; i++) {\n rgb[i] = round(rgb[i]);\n }\n rgb[3] = +m[4]; // default alpha = 1\n return rgb;\n }\n\n if ((m = css.match(RE_LAB))) {\n const lab = m.slice(1, 4);\n lab[0] = percentToAbsolute(noneToValue(lab[0], 0), 0, 100);\n lab[1] = percentToAbsolute(noneToValue(lab[1], 0), -125, 125, true);\n lab[2] = percentToAbsolute(noneToValue(lab[2], 0), -125, 125, true);\n // convert to D50 Lab whitepoint\n const wp = getLabWhitePoint();\n setLabWhitePoint('d50');\n const rgb = roundRGB(lab2rgb(lab));\n // convert back to original Lab whitepoint\n setLabWhitePoint(wp);\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n\n if ((m = css.match(RE_LCH))) {\n const lch = m.slice(1, 4);\n lch[0] = percentToAbsolute(lch[0], 0, 100);\n lch[1] = percentToAbsolute(noneToValue(lch[1], 0), 0, 150, false);\n lch[2] = +noneToValue(lch[2].replace('deg', ''), 0);\n // convert to D50 Lab whitepoint\n const wp = getLabWhitePoint();\n setLabWhitePoint('d50');\n const rgb = roundRGB(lch2rgb(lch));\n // convert back to original Lab whitepoint\n setLabWhitePoint(wp);\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n\n if ((m = css.match(RE_OKLAB))) {\n const oklab = m.slice(1, 4);\n oklab[0] = percentToAbsolute(noneToValue(oklab[0], 0), 0, 1);\n oklab[1] = percentToAbsolute(noneToValue(oklab[1], 0), -0.4, 0.4, true);\n oklab[2] = percentToAbsolute(noneToValue(oklab[2], 0), -0.4, 0.4, true);\n const rgb = roundRGB(oklab2rgb(oklab));\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n\n if ((m = css.match(RE_OKLCH))) {\n const oklch = m.slice(1, 4);\n oklch[0] = percentToAbsolute(noneToValue(oklch[0], 0), 0, 1);\n oklch[1] = percentToAbsolute(noneToValue(oklch[1], 0), 0, 0.4, false);\n oklch[2] = +noneToValue(oklch[2].replace('deg', ''), 0);\n const rgb = roundRGB(oklch2rgb(oklch));\n const alpha = m[4] !== undefined ? +percentToAbsolute(m[4], 0, 1) : 1;\n rgb[3] = alpha;\n return rgb;\n }\n};\n\ncss2rgb.test = (s) => {\n return (\n // modern\n RE_RGB.test(s) ||\n RE_HSL.test(s) ||\n RE_LAB.test(s) ||\n RE_LCH.test(s) ||\n RE_OKLAB.test(s) ||\n RE_OKLCH.test(s) ||\n // legacy\n RE_RGB_LEGACY.test(s) ||\n RE_RGBA_LEGACY.test(s) ||\n RE_HSL_LEGACY.test(s) ||\n RE_HSLA_LEGACY.test(s) ||\n s === 'transparent'\n );\n};\n\nexport default css2rgb;\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport { type } from '../../utils/index.js';\n\nimport rgb2css from './rgb2css.js';\nimport css2rgb from './css2rgb.js';\n\nColor.prototype.css = function (mode) {\n return rgb2css(this._rgb, mode);\n};\n\nconst css = (...args) => new Color(...args, 'css');\nchroma.css = css;\n\ninput.format.css = css2rgb;\n\ninput.autodetect.push({\n p: 5,\n test: (h, ...rest) => {\n if (!rest.length && type(h) === 'string' && css2rgb.test(h)) {\n return 'css';\n }\n }\n});\n\nexport { css };\n","import Color from '../../Color.js';\nimport chroma from '../../chroma.js';\nimport input from '../input.js';\nimport { unpack } from '../../utils/index.js';\n\ninput.format.gl = (...args) => {\n const rgb = unpack(args, 'rgba');\n rgb[0] *= 255;\n rgb[1] *= 255;\n rgb[2] *= 255;\n return rgb;\n};\n\nconst gl = (...args) => new Color(...args, 'gl');\nchroma.gl = gl;\n\nColor.prototype.gl = function () {\n const rgb = this._rgb;\n return [rgb[0] / 255, rgb[1] / 255, rgb[2] / 255, rgb[3]];\n};\n\nexport { gl };\n","import Color from '../../Color.js';\nimport chroma from '../../chroma.js';\nimport { type } from '../../utils/index.js';\nimport input from '../input.js';\nimport hex2rgb from './hex2rgb.js';\nimport rgb2hex from './rgb2hex.js';\n\nColor.prototype.hex = function (mode) {\n return rgb2hex(this._rgb, mode);\n};\n\nconst hex = (...args) => new Color(...args, 'hex');\nchroma.hex = hex;\n\ninput.format.hex = hex2rgb;\ninput.autodetect.push({\n p: 4,\n test: (h, ...rest) => {\n if (\n !rest.length &&\n type(h) === 'string' &&\n [3, 4, 5, 6, 7, 8, 9].indexOf(h.length) >= 0\n ) {\n return 'hex';\n }\n }\n});\n\nexport { hex };\n","/*\n * Based on implementation by Neil Bartlett\n * https://github.com/neilbartlett/color-temperature\n */\n\nconst { log } = Math;\n\nconst temperature2rgb = (kelvin) => {\n const temp = kelvin / 100;\n let r, g, b;\n if (temp < 66) {\n r = 255;\n g =\n temp < 6\n ? 0\n : -155.25485562709179 -\n 0.44596950469579133 * (g = temp - 2) +\n 104.49216199393888 * log(g);\n b =\n temp < 20\n ? 0\n : -254.76935184120902 +\n 0.8274096064007395 * (b = temp - 10) +\n 115.67994401066147 * log(b);\n } else {\n r =\n 351.97690566805693 +\n 0.114206453784165 * (r = temp - 55) -\n 40.25366309332127 * log(r);\n g =\n 325.4494125711974 +\n 0.07943456536662342 * (g = temp - 50) -\n 28.0852963507957 * log(g);\n b = 255;\n }\n return [r, g, b, 1];\n};\n\nexport default temperature2rgb;\n","/*\n * Based on implementation by Neil Bartlett\n * https://github.com/neilbartlett/color-temperature\n **/\n\nimport temperature2rgb from './temperature2rgb.js';\nimport { unpack } from '../../utils/index.js';\nconst { round } = Math;\n\nconst rgb2temperature = (...args) => {\n const rgb = unpack(args, 'rgb');\n const r = rgb[0],\n b = rgb[2];\n let minTemp = 1000;\n let maxTemp = 40000;\n const eps = 0.4;\n let temp;\n while (maxTemp - minTemp > eps) {\n temp = (maxTemp + minTemp) * 0.5;\n const rgb = temperature2rgb(temp);\n if (rgb[2] / rgb[0] >= b / r) {\n maxTemp = temp;\n } else {\n minTemp = temp;\n }\n }\n return round(temp);\n};\n\nexport default rgb2temperature;\n","import chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport temperature2rgb from './temperature2rgb.js';\nimport rgb2temperature from './rgb2temperature.js';\n\nColor.prototype.temp =\n Color.prototype.kelvin =\n Color.prototype.temperature =\n function () {\n return rgb2temperature(this._rgb);\n };\n\nconst temp = (...args) => new Color(...args, 'temp');\nObject.assign(chroma, { temp, kelvin: temp, temperature: temp });\n\ninput.format.temp =\n input.format.kelvin =\n input.format.temperature =\n temperature2rgb;\n\nexport { temp, temp as kelvin, temp as temperature };\n","import { unpack, type } from '../../utils/index.js';\nimport chroma from '../../chroma.js';\nimport Color from '../../Color.js';\nimport input from '../input.js';\nimport oklch2rgb from './oklch2rgb.js';\nimport rgb2oklch from './rgb2oklch.js';\n\nColor.prototype.oklch = function () {\n return rgb2oklch(this._rgb);\n};\n\nconst oklch = (...args) => new Color(...args, 'oklch');\nObject.assign(chroma, { oklch });\n\ninput.format.oklch = oklch2rgb;\n\ninput.autodetect.push({\n p: 2,\n test: (...args) => {\n args = unpack(args, 'oklch');\n if (type(args) === 'array' && args.length === 3) {\n return 'oklch';\n }\n }\n});\n\nexport { oklch };\n","// feel free to comment out anything to rollup\n// a smaller chroma.js bundle\nimport chroma from './src/chroma.js';\n\n// io --> convert colors\nimport './src/io/named/index.js';\n\n// operators --> modify existing Colors\nimport './src/ops/alpha.js';\nimport './src/ops/clipped.js';\nimport './src/ops/darken.js';\nimport './src/ops/get.js';\nimport './src/ops/luminance.js';\nimport './src/ops/mix.js';\nimport './src/ops/premultiply.js';\nimport './src/ops/saturate.js';\nimport './src/ops/set.js';\nimport './src/ops/shade.js';\n\n// interpolators\nimport './src/interpolator/rgb.js';\nimport './src/interpolator/lrgb.js';\nimport './src/interpolator/lab.js';\nimport './src/interpolator/lch.js';\nimport './src/interpolator/num.js';\nimport './src/interpolator/hcg.js';\nimport './src/interpolator/hsi.js';\nimport './src/interpolator/hsl.js';\nimport './src/interpolator/hsv.js';\nimport './src/interpolator/oklab.js';\nimport './src/interpolator/oklch.js';\n\n// generators -- > create new colors\nimport average from './src/generator/average.js';\nimport bezier from './src/generator/bezier.js';\nimport blend from './src/generator/blend.js';\nimport cubehelix from './src/generator/cubehelix.js';\nimport mix from './src/generator/mix.js';\nimport random from './src/generator/random.js';\nimport scale from './src/generator/scale.js';\n\n// other utility methods\nimport { analyze } from './src/utils/analyze.js';\nimport contrast from './src/utils/contrast.js';\nimport contrastAPCA from './src/utils/contrastAPCA.js';\nimport deltaE from './src/utils/delta-e.js';\nimport distance from './src/utils/distance.js';\nimport { limits } from './src/utils/analyze.js';\nimport valid from './src/utils/valid.js';\nimport input from './src/io/input.js';\n\n// scale\nimport scales from './src/utils/scales.js';\n\n// colors\nimport colors from './src/colors/w3cx11.js';\nimport brewer from './src/colors/colorbrewer.js';\nimport Color from './src/Color.js';\n\nObject.assign(chroma, {\n analyze,\n average,\n bezier,\n blend,\n brewer,\n Color,\n colors,\n contrast,\n contrastAPCA,\n cubehelix,\n deltaE,\n distance,\n input,\n interpolate: mix,\n limits,\n mix,\n random,\n scale,\n scales,\n valid\n});\n\nexport default chroma;\n\nexport {\n analyze,\n average,\n bezier,\n blend,\n brewer,\n Color,\n colors,\n contrast,\n contrastAPCA,\n cubehelix,\n deltaE,\n distance,\n input,\n limits,\n mix,\n mix as interpolate,\n random,\n scale,\n scales,\n valid\n};\n\nexport * from './src/io/cmyk/index.js';\nexport * from './src/io/css/index.js';\nexport * from './src/io/gl/index.js';\nexport * from './src/io/hcg/index.js';\nexport * from './src/io/hex/index.js';\nexport * from './src/io/hsi/index.js';\nexport * from './src/io/hsl/index.js';\nexport * from './src/io/hsv/index.js';\nexport * from './src/io/lab/index.js';\nexport * from './src/io/lch/index.js';\nexport * from './src/io/num/index.js';\nexport * from './src/io/rgb/index.js';\nexport * from './src/io/temp/index.js';\nexport * from './src/io/oklab/index.js';\nexport * from './src/io/oklch/index.js';\n","//\n// interpolates between a set of colors uzing a bezier spline\n//\n\n// @requires utils lab\nimport Color from '../Color.js';\nimport '../io/lab/index.js';\nimport scale from './scale.js';\n\n// nth row of the pascal triangle\nconst binom_row = function (n) {\n let row = [1, 1];\n for (let i = 1; i < n; i++) {\n let newrow = [1];\n for (let j = 1; j <= row.length; j++) {\n newrow[j] = (row[j] || 0) + row[j - 1];\n }\n row = newrow;\n }\n return row;\n};\n\nconst bezier = function (colors) {\n let I, lab0, lab1, lab2;\n colors = colors.map((c) => new Color(c));\n if (colors.length === 2) {\n // linear interpolation\n [lab0, lab1] = colors.map((c) => c.lab());\n I = function (t) {\n const lab = [0, 1, 2].map((i) => lab0[i] + t * (lab1[i] - lab0[i]));\n return new Color(lab, 'lab');\n };\n } else if (colors.length === 3) {\n // quadratic bezier interpolation\n [lab0, lab1, lab2] = colors.map((c) => c.lab());\n I = function (t) {\n const lab = [0, 1, 2].map(\n (i) =>\n (1 - t) * (1 - t) * lab0[i] +\n 2 * (1 - t) * t * lab1[i] +\n t * t * lab2[i]\n );\n return new Color(lab, 'lab');\n };\n } else if (colors.length === 4) {\n // cubic bezier interpolation\n let lab3;\n [lab0, lab1, lab2, lab3] = colors.map((c) => c.lab());\n I = function (t) {\n const lab = [0, 1, 2].map(\n (i) =>\n (1 - t) * (1 - t) * (1 - t) * lab0[i] +\n 3 * (1 - t) * (1 - t) * t * lab1[i] +\n 3 * (1 - t) * t * t * lab2[i] +\n t * t * t * lab3[i]\n );\n return new Color(lab, 'lab');\n };\n } else if (colors.length >= 5) {\n // general case (degree n bezier)\n let labs, row, n;\n labs = colors.map((c) => c.lab());\n n = colors.length - 1;\n row = binom_row(n);\n I = function (t) {\n const u = 1 - t;\n const lab = [0, 1, 2].map((i) =>\n labs.reduce(\n (sum, el, j) =>\n sum + row[j] * u ** (n - j) * t ** j * el[i],\n 0\n )\n );\n return new Color(lab, 'lab');\n };\n } else {\n throw new RangeError('No point in running bezier with only one color.');\n }\n return I;\n};\n\nexport default (colors) => {\n const f = bezier(colors);\n f.scale = () => scale(f);\n return f;\n};\n","import Color from '../Color.js';\nimport '../ops/luminance.js';\n\nexport default (a, b) => {\n // WCAG contrast ratio\n // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef\n a = new Color(a);\n b = new Color(b);\n const l1 = a.luminance();\n const l2 = b.luminance();\n return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);\n};\n","import Color from '../Color.js';\n\n// simple Euclidean distance\nexport default function (a, b, mode = 'lab') {\n // Delta E (CIE 1976)\n // see http://www.brucelindbloom.com/index.html?Equations.html\n a = new Color(a);\n b = new Color(b);\n const l1 = a.get(mode);\n const l2 = b.get(mode);\n let sum_sq = 0;\n for (let i in l1) {\n const d = (l1[i] || 0) - (l2[i] || 0);\n sum_sq += d * d;\n }\n return Math.sqrt(sum_sq);\n}\n","(function(context) {\n\n /**\n * Defines an available color.\n *\n * @typedef {Object} ColorSpec\n * @property {string=} name A name for the color, e.g., 'red'\n * @property {string} source The hex-based color string, e.g., '#FF0'\n * @property {RGB} rgb The {@link RGB} color values\n */\n\n /**\n * Describes a matched color.\n *\n * @typedef {Object} ColorMatch\n * @property {string} name The name of the matched color, e.g., 'red'\n * @property {string} value The hex-based color string, e.g., '#FF0'\n * @property {RGB} rgb The {@link RGB} color values.\n */\n\n /**\n * Provides the RGB breakdown of a color.\n *\n * @typedef {Object} RGB\n * @property {number} r The red component, from 0 to 255\n * @property {number} g The green component, from 0 to 255\n * @property {number} b The blue component, from 0 to 255\n */\n\n /**\n * Gets the nearest color, from the given list of {@link ColorSpec} objects\n * (which defaults to {@link nearestColor.DEFAULT_COLORS}).\n *\n * Probably you wouldn't call this method directly. Instead you'd get a custom\n * color matcher by calling {@link nearestColor.from}.\n *\n * @public\n * @param {RGB|string} needle Either an {@link RGB} color or a hex-based\n * string representing one, e.g., '#FF0'\n * @param {Array.<ColorSpec>=} colors An optional list of available colors\n * (defaults to {@link nearestColor.DEFAULT_COLORS})\n * @return {ColorMatch|string} If the colors in the provided list had names,\n * then a {@link ColorMatch} object with the name and (hex) value of the\n * nearest color from the list. Otherwise, simply the hex value.\n *\n * @example\n * nearestColor({ r: 200, g: 50, b: 50 }); // => '#f00'\n * nearestColor('#f11'); // => '#f00'\n * nearestColor('#f88'); // => '#f80'\n * nearestColor('#ffe'); // => '#ff0'\n * nearestColor('#efe'); // => '#ff0'\n * nearestColor('#abc'); // => '#808'\n * nearestColor('red'); // => '#f00'\n * nearestColor('foo'); // => throws\n */\n function nearestColor(needle, colors) {\n needle = parseColor(needle);\n\n if (!needle) {\n return null;\n }\n\n var distanceSq,\n minDistanceSq = Infinity,\n rgb,\n value;\n\n colors || (colors = nearestColor.DEFAULT_COLORS);\n\n for (var i = 0; i < colors.length; ++i) {\n rgb = colors[i].rgb;\n\n distanceSq = (\n Math.pow(needle.r - rgb.r, 2) +\n Math.pow(needle.g - rgb.g, 2) +\n Math.pow(needle.b - rgb.b, 2)\n );\n\n if (distanceSq < minDistanceSq) {\n minDistanceSq = distanceSq;\n value = colors[i];\n }\n }\n\n if (value.name) {\n return {\n name: value.name,\n value: value.source,\n rgb: value.rgb,\n distance: Math.sqrt(minDistanceSq)\n };\n }\n\n return value.source;\n }\n\n /**\n * Provides a matcher to find the nearest color based on the provided list of\n * available colors.\n *\n * @public\n * @param {Array.<string>|Object} availableColors An array of hex-based color\n * strings, or an object mapping color *names* to hex values.\n * @return {function(string):ColorMatch|string} A function with the same\n * behavior as {@link nearestColor}, but with the list of colors\n * predefined.\n *\n * @example\n * var colors = {\n * 'maroon': '#800',\n * 'light yellow': { r: 255, g: 255, b: 51 },\n * 'pale blue': '#def',\n * 'white': 'fff'\n * };\n *\n * var bgColors = [\n * '#eee',\n * '#444'\n * ];\n *\n * var invalidColors = {\n * 'invalid': 'foo'\n * };\n *\n * var getColor = nearestColor.from(colors);\n * var getBGColor = getColor.from(bgColors);\n * var getAnyColor = nearestColor.from(colors).or(bgColors);\n *\n * getColor('ffe');\n * // => { name: 'white', value: 'fff', rgb: { r: 255, g: 255, b: 255 }, distance: 17}\n *\n * getColor('#f00');\n * // => { name: 'maroon', value: '#800', rgb: { r: 136, g: 0, b: 0 }, distance: 119}\n *\n * getColor('#ff0');\n * // => { name: 'light yellow', value: '#ffff33', rgb: { r: 255, g: 255, b: 51 }, distance: 51}\n *\n * getBGColor('#fff'); // => '#eee'\n * getBGColor('#000'); // => '#444'\n *\n * getAnyColor('#f00');\n * // => { name: 'maroon', value: '#800', rgb: { r: 136, g: 0, b: 0 }, distance: 119}\n *\n * getAnyColor('#888'); // => '#444'\n *\n * nearestColor.from(invalidColors); // => throws\n */\n nearestColor.from = function from(availableColors) {\n var colors = mapColors(availableColors),\n nearestColorBase = nearestColor;\n\n var matcher = function nearestColor(hex) {\n return nearestColorBase(hex, colors);\n };\n\n // Keep the 'from' method, to support changing the list of available colors\n // multiple times without needing to keep a reference to the original\n // nearestColor function.\n matcher.from = from;\n\n // Also provide a way to combine multiple color lists.\n matcher.or = function or(alternateColors) {\n var extendedColors = colors.concat(mapColors(alternateColors));\n return nearestColor.from(extendedColors);\n };\n\n return matcher;\n };\n\n /**\n * Given either an array or object of colors, returns an array of\n * {@link ColorSpec} objects (with {@link RGB} values).\n *\n * @private\n * @param {Array.<string>|Object} colors An array of hex-based color strings, or\n * an object mapping color *names* to hex values.\n * @return {Array.<ColorSpec>} An array of {@link ColorSpec} objects\n * representing the same colors passed in.\n */\n function mapColors(colors) {\n if (colors instanceof Array) {\n return colors.map(function(color) {\n return createColorSpec(color);\n });\n }\n\n return Object.keys(colors).map(function(name) {\n return createColorSpec(colors[name], name);\n });\n };\n\n /**\n * Parses a color from a string.\n *\n * @private\n * @param {RGB|string} source\n * @return {RGB}\n *\n * @example\n * parseColor({ r: 3, g: 22, b: 111 }); // => { r: 3, g: 22, b: 111 }\n * parseColor('#f00'); // => { r: 255, g: 0, b: 0 }\n * parseColor('#04fbc8'); // => { r: 4, g: 251, b: 200 }\n * parseColor('#FF0'); // => { r: 255, g: 255, b: 0 }\n * parseColor('rgb(3, 10, 100)'); // => { r: 3, g: 10, b: 100 }\n * parseColor('rgb(50%, 0%, 50%)'); // => { r: 128, g: 0, b: 128 }\n * parseColor('aqua'); // => { r: 0, g: 255, b: 255 }\n * parseColor('fff'); // => { r: 255, g: 255, b: 255 }\n * parseColor('foo'); // => throws\n */\n function parseColor(source) {\n var red, green, blue;\n\n if (typeof source === 'object') {\n return source;\n }\n\n if (source in nearestColor.STANDARD_COLORS) {\n return parseColor(nearestColor.STANDARD_COLORS[source]);\n }\n\n var hexMatch = source.match(/^#?((?:[0-9a-f]{3}){1,2})$/i);\n if (hexMatch) {\n hexMatch = hexMatch[1];\n\n if (hexMatch.length === 3) {\n hexMatch = [\n hexMatch.charAt(0) + hexMatch.charAt(0),\n hexMatch.charAt(1) + hexMatch.charAt(1),\n hexMatch.charAt(2) + hexMatch.charAt(2)\n ];\n\n } else {\n hexMatch = [\n hexMatch.substring(0, 2),\n hexMatch.substring(2, 4),\n hexMatch.substring(4, 6)\n ];\n }\n\n red = parseInt(hexMatch[0], 16);\n green = parseInt(hexMatch[1], 16);\n blue = parseInt(hexMatch[2], 16);\n\n return { r: red, g: green, b: blue };\n }\n\n var rgbMatch = source.match(/^rgb\\(\\s*(\\d{1,3}%?),\\s*(\\d{1,3}%?),\\s*(\\d{1,3}%?)\\s*\\)$/i);\n if (rgbMatch) {\n red = parseComponentValue(rgbMatch[1]);\n green = parseComponentValue(rgbMatch[2]);\n blue = parseComponentValue(rgbMatch[3]);\n\n return { r: red, g: green, b: blue };\n }\n\n throw Error('\"' + source + '\" is not a valid color');\n }\n\n /**\n * Creates a {@link ColorSpec} from either a string or an {@link RGB}.\n *\n * @private\n * @param {string|RGB} input\n * @param {string=} name\n * @return {ColorSpec}\n *\n * @example\n * createColorSpec('#800'); // => {\n * source: '#800',\n * rgb: { r: 136, g: 0, b: 0 }\n * }\n *\n * createColorSpec('#800', 'maroon'); // => {\n * name: 'maroon',\n * source: '#800',\n * rgb: { r: 136, g: 0, b: 0 }\n * }\n */\n function createColorSpec(input, name) {\n var color = {};\n\n if (name) {\n color.name = name;\n }\n\n if (typeof input === 'string') {\n color.source = input;\n color.rgb = parseColor(input);\n\n } else if (typeof input === 'object') {\n // This is for if/when we're concatenating lists of colors.\n if (input.source) {\n return createColorSpec(input.source, input.name);\n }\n\n color.rgb = input;\n color.source = rgbToHex(input);\n }\n\n return color;\n }\n\n /**\n * Parses a value between 0-255 from a string.\n *\n * @private\n * @param {string} string\n * @return {number}\n *\n * @example\n * parseComponentValue('100'); // => 100\n * parseComponentValue('100%'); // => 255\n * parseComponentValue('50%'); // => 128\n */\n function parseComponentValue(string) {\n if (string.charAt(string.length - 1) === '%') {\n return Math.round(parseInt(string, 10) * 255 / 100);\n }\n\n return Number(string);\n }\n\n /**\n * Converts an {@link RGB} color to its hex representation.\n *\n * @private\n * @param {RGB} rgb\n * @return {string}\n *\n * @example\n * rgbToHex({ r: 255, g: 128, b: 0 }); // => '#ff8000'\n */\n function rgbToHex(rgb) {\n return '#' + leadingZero(rgb.r.toString(16)) +\n leadingZero(rgb.g.toString(16)) + leadingZero(rgb.b.toString(16));\n }\n\n /**\n * Puts a 0 in front of a numeric string if it's only one digit. Otherwise\n * nothing (just returns the value passed in).\n *\n * @private\n * @param {string} value\n * @return\n *\n * @example\n * leadingZero('1'); // => '01'\n * leadingZero('12'); // => '12'\n */\n function leadingZero(value) {\n if (value.length === 1) {\n value = '0' + value;\n }\n return value;\n }\n\n /**\n * A map from the names of standard CSS colors to their hex values.\n */\n nearestColor.STANDARD_COLORS = {\n aqua: '#0ff',\n black: '#000',\n blue: '#00f',\n fuchsia: '#f0f',\n gray: '#808080',\n green: '#008000',\n lime: '#0f0',\n maroon: '#800000',\n navy: '#000080',\n olive: '#808000',\n orange: '#ffa500',\n purple: '#800080',\n red: '#f00',\n silver: '#c0c0c0',\n teal: '#008080',\n white: '#fff',\n yellow: '#ff0'\n };\n\n /**\n * Default colors. Comprises the colors of the rainbow (good ol' ROY G. BIV).\n * This list will be used for calls to {@nearestColor} that don't specify a list\n * of available colors to match.\n */\n nearestColor.DEFAULT_COLORS = mapColors([\n '#f00', // r\n '#f80', // o\n '#ff0', // y\n '#0f0', // g\n '#00f', // b\n '#008', // i\n '#808' // v\n ]);\n\n nearestColor.VERSION = '0.4.4';\n\n if (typeof module === 'object' && module && module.exports) {\n module.exports = nearestColor;\n } else {\n context.nearestColor = nearestColor;\n }\n\n}(this));\n","/**\n * Represents an HSL (Hue, Saturation, Lightness) color unit.\n */\nexport class UnitHSL {\n /** Hue component (0–360) */\n h: number;\n /** Saturation component (0–100%) */\n s: number;\n /** Lightness component (0–100%) */\n l: number;\n\n /**\n * Create a new UnitHSL instance.\n * @param {[number, number, number]} components - The HSL components: [h, s, l]\n */\n constructor([h, s, l]: [number, number, number]) {\n this.h = Number(!isNaN(h) ? h.toFixed(0) : '0');\n this.s = Number((s * 100).toFixed(0));\n this.l = Number((l * 100).toFixed(0));\n }\n\n /**\n * Converts the HSL unit to a CSS string representation.\n * @returns {string} - A string like \"hsl(30, 50%, 80%)\"\n * @example\n * ```ts\n * const hslUnit = new UnitHSL([30, 0.5, 0.8]);\n * const hslString = hslUnit.toString(); // \"hsl(30, 50%, 80%)\"\n * ```\n */\n toString(): string {\n return `hsl(${this.h}, ${this.s}%, ${this.l}%)`;\n }\n}\n\n/**\n * Represents an HSL (Hue, Saturation, Lightness) color unit with float values.\n */\nexport class UnitHSLFloat {\n /** Hue component */\n h: number;\n /** Saturation component */\n s: number;\n /** Lightness component */\n l: number;\n\n /**\n * Create a new UnitHSLFloat instance.\n * @param {[number, number, number]} components - The HSL components: [h, s, l]\n */\n constructor([h, s, l]: [number, number, number]) {\n this.h = Number(!isNaN(h) ? h.toFixed(0) : '0');\n this.s = Number(s.toFixed(2));\n this.l = Number(l.toFixed(2));\n }\n\n /**\n * Converts the HSL float unit to a string.\n * @returns {string} - A string like \"30, 0.50, 0.80\"\n * @example\n * ```ts\n * const hslFloatUnit = new UnitHSLFloat([30, 0.5, 0.8]);\n * const hslFloatString = hslFloatUnit.toString(); // \"30, 0.50, 0.80\"\n * ```\n */\n toString(): string {\n return `${this.h}, ${this.s}, ${this.l}`;\n }\n}\n","/**\n * Represents an XYZ color unit.\n */\nexport class UnitXYZ {\n /** X component */\n x: number;\n /** Y component */\n y: number;\n /** Z component */\n z: number;\n\n /**\n * Create a new UnitXYZ instance.\n * @param {{ x: number, y: number, z: number }} components - The XYZ components.\n */\n constructor({ x, y, z }: { x: number; y: number; z: number }) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n\n /**\n * Converts the XYZ unit to a string representation.\n * @returns {string} - The string representation of the XYZ unit.\n * @example\n * ```ts\n * const xyzUnit = new UnitXYZ({ x: 0.4, y: 0.6, z: 0.8 });\n * const xyzString = xyzUnit.toString(); // \"0.4, 0.6, 0.8\"\n * ```\n */\n toString(): string {\n return `${this.x}, ${this.y}, ${this.z}`;\n }\n}\n","/**\n * Represents a CMYK color unit.\n */\nexport class UnitCMYK {\n /** Cyan component */\n c: number;\n /** Magenta component */\n m: number;\n /** Yellow component */\n y: number;\n /** Black (Key) component */\n k: number;\n\n /**\n * Create a new UnitCMYK instance.\n * @param {{ c: number, m: number, y: number, k: number }} components - The CMYK components.\n */\n constructor({ c, m, y, k }: { c: number; m: number; y: number; k: number }) {\n this.c = c;\n this.m = m;\n this.y = y;\n this.k = k;\n }\n\n /**\n * Converts the CMYK unit to a string representation.\n * @returns {string} - The string representation of the CMYK unit.\n * @example\n * ```ts\n * const cmykUnit = new UnitCMYK({ c: 0.2, m: 0.4, y: 0.6, k: 0.1 });\n * const cmykString = cmykUnit.toString(); // \"0.2, 0.4, 0.6, 0.1\"\n * ```\n */\n toString(): string {\n return `${this.c}, ${this.m}, ${this.y}, ${this.k}`;\n }\n}\n","/**\n * Represents an RGB float color unit.\n */\nexport class UnitRGBFloat {\n /** Red component */\n r: number;\n /** Green component */\n g: number;\n /** Blue component */\n b: number;\n\n /**\n * Create a new UnitRGBFloat instance.\n * @param {{ r: number, g: number, b: number }} components - The RGB float components.\n */\n constructor({ r, g, b }: { r: number; g: number; b: number }) {\n this.r = r;\n this.g = g;\n this.b = b;\n }\n\n /**\n * Converts the RGB float unit to a string representation.\n * @returns {string} - The string representation of the RGB float unit.\n * @example\n * ```ts\n * const rgbFloatUnit = new UnitRGBFloat({ r: 255, g: 128, b: 0 });\n * const rgbFloatString = rgbFloatUnit.toString(); // \"255, 128, 0\"\n * ```\n */\n toString(): string {\n return `${this.r}, ${this.g}, ${this.b}`;\n }\n}\n","/**\n * Represents an HWB (Hue, Whiteness, Blackness) color unit.\n */\nexport class UnitHWB {\n /** Hue component */\n h: number;\n /** Whiteness component */\n w: number;\n /** Blackness component */\n b: number;\n\n /**\n * Create a new UnitHWB instance.\n * @param {{ h: number, w: number, b: number }} components - The HWB components.\n */\n constructor({ h, w, b }: { h: number; w: number; b: number }) {\n this.h = h;\n this.w = w;\n this.b = b;\n }\n\n /**\n * Converts the HWB unit to a string representation.\n * @returns {string} - A string like `\"200, 0.2, 0.1\"`\n * @example\n * ```ts\n * const hwbUnit = new UnitHWB({ h: 200, w: 0.2, b: 0.1 });\n * const hwbString = hwbUnit.toString(); // \"200, 0.2, 0.1\"\n * ```\n */\n toString(): string {\n return `${this.h}, ${this.w}, ${this.b}`;\n }\n}\n","/**\n * Represents a LAB (CIELAB) color unit.\n */\nexport class UnitLAB {\n /** Lightness component */\n l: number;\n /** A color component */\n a: number;\n /** B color component */\n b: number;\n\n /**\n * Create a new UnitLAB instance.\n * @param {[number, number, number]} components - The LAB components: [l, a, b]\n */\n constructor([l, a, b]: [number, number, number]) {\n this.l = Number(l.toFixed(2));\n this.a = Number(a.toFixed(2));\n this.b = Number(b.toFixed(2));\n }\n\n /**\n * Converts the LAB unit to a string representation.\n * @returns {string} - The string representation of the LAB unit.\n * @example\n * ```ts\n * const labUnit = new UnitLAB([70, 10, 20]);\n * const labString = labUnit.toString(); // \"70, 10, 20\"\n * ```\n */\n toString(): string {\n return `${this.l}, ${this.a}, ${this.b}`;\n }\n}\n","/**\n * Represents an OKLAB color unit.\n */\nexport class UnitOKLAB {\n /** Lightness component */\n l: number;\n /** First color opponent axis */\n a: number;\n /** Second color opponent axis */\n b: number;\n\n /**\n * Create a new UnitOKLAB instance.\n * @param {[number, number, number]} components - The OKLAB components [l, a, b].\n */\n constructor([l, a, b]: [number, number, number]) {\n this.l = Number(l.toFixed(2));\n this.a = Number(a.toFixed(2));\n this.b = Number(b.toFixed(2));\n }\n\n /**\n * Converts the OKLAB unit to a string representation.\n * @returns {string} - The string representation of the OKLAB unit.\n * @example\n * ```ts\n * const oklabUnit = new UnitOKLAB([70, 30, 45]);\n * const oklabString = oklabUnit.toString(); // \"70, 30, 45\"\n * ```\n */\n toString(): string {\n return `${this.l}, ${this.a}, ${this.b}`;\n }\n}\n","/**\n * Represents an HSV (Hue, Saturation, Value) color unit.\n */\nexport class UnitHSV {\n /** Hue component */\n h: number;\n /** Saturation component */\n s: number;\n /** Value component */\n v: number;\n\n /**\n * Create a new UnitHSV instance.\n * @param {[number, number, number]} components - The HSV components: [h, s, v]\n */\n constructor([h, s, v]: [number, number, number]) {\n this.h = Number(!isNaN(h) ? h.toFixed(2) : '0');\n this.s = Number(s.toFixed(2));\n this.v = Number(v.toFixed(2));\n }\n\n /**\n * Converts the HSV unit to a string representation.\n * @returns {string} - A string like `\"30.00, 0.50, 0.80\"`\n * @example\n * ```ts\n * const hsvUnit = new UnitHSV([30, 0.5, 0.8]);\n * const hsvString = hsvUnit.toString(); // \"30.00, 0.50, 0.80\"\n * ```\n */\n toString(): string {\n return `${this.h}, ${this.s}, ${this.v}`;\n }\n}\n","/**\n * Represents an LCH (CIELCH) color unit.\n */\nexport class UnitLCH {\n /** Lightness component */\n l: number;\n /** Chroma component */\n c: number;\n /** Hue component */\n h: number;\n\n /**\n * Create a new UnitLCH instance.\n * @param {[number, number, number]} components - The LCH components: [l, c, h]\n */\n constructor([l, c, h]: [number, number, number]) {\n this.l = Number(l.toFixed(2));\n this.c = Number(c.toFixed(2));\n this.h = Number(!isNaN(h) ? h.toFixed(2) : '0');\n }\n\n /**\n * Converts the LCH unit to a string representation.\n * @returns {string} - A string like `\"70.00, 30.00, 45.00\"`\n * @example\n * ```ts\n * const lchUnit = new UnitLCH([70, 30, 45]);\n * const lchString = lchUnit.toString(); // \"70.00, 30.00, 45.00\"\n * ```\n */\n toString(): string {\n return `${this.l}, ${this.c}, ${this.h}`;\n }\n}\n","/**\n * Represents an OKLCH color unit.\n */\nexport class UnitOKLCH {\n /** Lightness component */\n l: number;\n /** Chroma component */\n c: number;\n /** Hue component */\n h: number;\n\n /**\n * Create a new UnitOKLCH instance.\n * @param {[number, number, number]} components - The OKLCH components: [l, c, h]\n */\n constructor([l, c, h]: [number, number, number]) {\n this.l = Number(l.toFixed(2));\n this.c = Number(c.toFixed(2));\n this.h = Number(!isNaN(h) ? h.toFixed(2) : '0');\n }\n\n /**\n * Converts the OKLCH unit to a string representation.\n * @returns {string} - The string representation of the OKLCH unit.\n * @example\n * ```ts\n * const oklchUnit = new UnitOKLCH([70, 30, 45]);\n * const oklchString = oklchUnit.toString(); // \"70.00, 30.00, 45.00\"\n * ```\n */\n toString(): string {\n return `${this.l}, ${this.c}, ${this.h}`;\n }\n}\n","/**\n * Represents an HSI (Hue, Saturation, Intensity) color unit.\n */\nexport class UnitHSI {\n /** Hue component */\n h: number;\n /** Saturation component */\n s: number;\n /** Intensity component */\n i: number;\n\n /**\n * Create a new UnitHSI instance.\n * @param {[number, number, number]} components - The HSI components: [h, s, i]\n */\n constructor([h, s, i]: [number, number, number]) {\n this.h = Number(!isNaN(h) ? h.toFixed(2) : '0');\n this.s = Number(s.toFixed(2));\n this.i = Number(i.toFixed(2));\n }\n\n /**\n * Converts the HSI unit to a string representation.\n * @returns {string} - The string representation of the HSI unit.\n * @example\n * ```ts\n * const hsiUnit = new UnitHSI([30, 0.5, 0.8]);\n * const hsiString = hsiUnit.toString(); // \"30, 0.5, 0.8\"\n * ```\n */\n toString(): string {\n return `${this.h}, ${this.s}, ${this.i}`;\n }\n}\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusHSLObjectType,\n MoebiusRGBObjectType\n} from '../../types';\nimport { UnitHSLFloat } from '../color-objects/hsl';\nimport { UnitRGBFloat } from '../color-objects/rgb';\n\n/**\n * Converts a color to its float representation.\n * @param {MoebiusChromaColorInputType} color - The input color in hex, rgb, or rgba format.\n * @param {string} [type] - The color type ('hsl' for HSL, undefined for RGB).\n * @returns {UnitHSLFloat | UnitRGBFloat} - The float representation of the color.\n * @example\n * ```ts\n * const hslFloatColor = toFloat('#00ff00', 'hsl');\n * console.log(hslFloatColor.toString()); // 120, 100, 50\n * ```\n * @example\n * ```ts\n * const rgbFloatColor = toFloat('#00ff00');\n * console.log(rgbFloatColor.toString()); // 0, 1, 0\n * ```\n */\nexport const toFloat = (\n color: MoebiusChromaColorInputType,\n type?: string\n): MoebiusHSLObjectType | MoebiusRGBObjectType => {\n if (type === 'hsl') {\n // Convert the color to HSL and create a new HSL float unit\n return new UnitHSLFloat(chroma(color).hsl());\n }\n\n // Convert the color to RGB and create a new RGB float unit\n const _rgb = chroma(color).rgb();\n const rgbFloat = new UnitRGBFloat({\n r: Number((_rgb[0] / 255).toFixed(2)),\n g: Number((_rgb[1] / 255).toFixed(2)),\n b: Number((_rgb[2] / 255).toFixed(2))\n });\n\n return rgbFloat;\n};\n","/**\n * Normalizes an RGB input value.\n * @param {number} r - The input value in the RGB color space (0 to 255).\n * @returns {number} - The normalized value.\n */\nexport const normalizeRGBInput = (r: number): number => {\n if ((r /= 255) <= 0.04045) return r / 12.92;\n\n return Math.pow((r + 0.055) / 1.055, 2.4);\n};\n\n/**\n * Normalizes a LAB input value.\n * @param {number} t - The input value in the LAB color space.\n * @returns {number} - The normalized value.\n */\nexport const normalizeLABInput = (t: number): number => {\n if (t > 0.008856452) return Math.pow(t, 1 / 3);\n\n return t / 0.12841855 + 0.137931034;\n};\n","import {\n MoebiusCMYKObjectType,\n MoebiusColorValueHexType,\n MoebiusColorValueRgbType,\n MoebiusHSIObjectType,\n MoebiusHSLObjectType,\n MoebiusHSVObjectType,\n MoebiusHWBObjectType,\n MoebiusLABObjectType,\n MoebiusLCHObjectType,\n MoebiusColorInterface,\n MoebiusRGBObjectType,\n MoebiusXYZObjectType,\n MoebiusChromaColorInputType\n} from '../types';\nimport * as CONVERTERS from '../utils/converters';\n\n/**\n * MoebiusColor class representing a color with various formats and conversions.\n *\n * @example\n * ```ts\n * const mColor = new MoebiusColor('#ff9900')\n * ```\n */\nexport class MoebiusColor implements MoebiusColorInterface {\n color: MoebiusChromaColorInputType;\n name: string;\n hex: MoebiusColorValueHexType;\n rgb: MoebiusColorValueRgbType;\n hsl: MoebiusHSLObjectType;\n hwb: MoebiusHWBObjectType;\n hsv: MoebiusHSVObjectType;\n lab: MoebiusLABObjectType;\n xyz: MoebiusXYZObjectType;\n lch: MoebiusLCHObjectType;\n oklch: MoebiusLCHObjectType;\n hsi: MoebiusHSIObjectType;\n oklab: MoebiusLABObjectType;\n cmyk: MoebiusCMYKObjectType;\n rgbFloat: MoebiusRGBObjectType;\n hslFloat: MoebiusHSLObjectType;\n\n /**\n * Creates an instance of MoebiusColor.\n * @param {MoebiusChromaColorInputType} color - The hex value of the color.\n * @param {string} name - The name of the color\n *\n * @throws Will throw an error if init has not been run before creating an instance.\n */\n constructor(color: MoebiusChromaColorInputType, name: string) {\n this.color = color;\n this.name = name;\n\n this.hex = CONVERTERS.toHEX(this.color);\n this.cmyk = CONVERTERS.toCMYK(this.color);\n this.xyz = CONVERTERS.toXYZ(this.color);\n this.hsl = CONVERTERS.toHSL(this.color);\n this.hwb = CONVERTERS.toHWB(this.color);\n this.lab = CONVERTERS.toLAB(this.color);\n this.oklab = CONVERTERS.toOKLAB(this.color);\n this.hsv = CONVERTERS.toHSV(this.color);\n this.lch = CONVERTERS.toLCH(this.color);\n this.oklch = CONVERTERS.toOKLCH(this.color);\n this.hsi = CONVERTERS.toHSI(this.color);\n this.rgb = CONVERTERS.toRGB(this.color);\n this.rgbFloat = CONVERTERS.toFloat(this.color) as MoebiusRGBObjectType;\n this.hslFloat = CONVERTERS.toFloat(\n this.color,\n 'hsl'\n ) as MoebiusHSLObjectType;\n }\n /**\n * Converts the color to an object in the specified color space.\n * @param {string} type - The color space type (e.g., 'rgb' or 'hsl').\n * @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The color object in the specified color space.\n */\n toObject(type?: string): MoebiusRGBObjectType | MoebiusHSLObjectType {\n return CONVERTERS.toObject(this.color, type);\n }\n /**\n * Converts the color to a floating-point representation in the specified color space.\n * @param {string} type - The color space type (e.g., 'rgb' or 'hsl').\n * @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The floating-point representation of the color in the specified color space.\n */\n toFloat(type?: string): MoebiusRGBObjectType | MoebiusHSLObjectType {\n return CONVERTERS.toFloat(this.color, type);\n }\n}\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType\n} from '../../types';\n\n/**\n * Converts a color to its corresponding HEX representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in various formats (HEX, RGB, HSL, etc.).\n * @returns {MoebiusColorValueHexType} The HEX representation of the color.\n *\n * @example\n * ```ts\n * const hexColor = toHEX('#3498db');\n * console.log(hexColor); // Output: '#3498db'\n * ```\n */\nexport const toHEX = (\n color: MoebiusChromaColorInputType\n): MoebiusColorValueHexType => {\n return chroma(color).hex() as MoebiusColorValueHexType;\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusCMYKObjectType,\n MoebiusChromaColorInputType\n} from '../../types';\nimport { UnitCMYK } from '../color-objects';\n\n/**\n * Converts an RGB color to its CMYK representation.\n * @param {MoebiusChromaColorInputType} color - The input color in hex, rgb, or rgba format.\n * @returns {MoebiusCMYKObjectType} - The CMYK representation of the color.\n * @example\n * ```ts\n * const cmykColor = toCMYK('#00ff00');\n * console.log(cmykColor); // { c: 40, m: 0, y: 100, k: 0 }\n * ```\n */\nexport const toCMYK = (\n color: MoebiusChromaColorInputType\n): MoebiusCMYKObjectType => {\n // Convert the color to RGB components\n let [r, b, g] = chroma(color).rgb();\n\n // Normalize RGB values to the range [0, 1]\n r /= 255;\n g /= 255;\n b /= 255;\n\n // Calculate the CMYK components\n const k = +(1 - Math.max(r, g, b));\n const c = +((1 - r - k) / (1 - k) || 0);\n const m = +((1 - g - k) / (1 - k) || 0);\n const y = +((1 - b - k) / (1 - k) || 0);\n\n // Create a new CMYK unit\n return new UnitCMYK({\n c: Number((c * 100).toFixed()),\n m: Number((m * 100).toFixed()),\n y: Number((y * 100).toFixed()),\n k: Number((k * 100).toFixed())\n });\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusXYZObjectType } from '../../types';\nimport { UnitXYZ } from '../color-objects';\nimport { normalizeLABInput, normalizeRGBInput } from '../normalize-color-units';\n\n/**\n * Converts a color from RGB to CIE 1931 XYZ color space.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hexadecimal format.\n * @returns {MoebiusXYZObjectType} - An object representing the XYZ color values.\n */\nexport const toXYZ = (\n color: MoebiusChromaColorInputType\n): MoebiusXYZObjectType => {\n // Extract RGB components from the input color\n let [r, b, g] = chroma(color).rgb();\n\n // Normalize RGB values\n r = normalizeRGBInput(r);\n g = normalizeRGBInput(g);\n b = normalizeRGBInput(b);\n\n // Convert RGB to XYZ\n const x = normalizeLABInput(\n (0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047\n );\n const y = normalizeLABInput(\n (0.2126729 * r + 0.7151522 * g + 0.072175 * b) / 1\n );\n const z = normalizeLABInput(\n (0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883\n );\n\n // Return XYZ color values as a UnitXYZ object\n return new UnitXYZ({\n x: Number(x.toFixed(2)),\n y: Number(y.toFixed(2)),\n z: Number(z.toFixed(2))\n });\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusHSLObjectType } from '../../types';\nimport { UnitHSL } from '../color-objects';\n\n/**\n * Converts a color to its corresponding HSL object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusHSLObjectType} The HSL color representation object.\n *\n * @example\n * ```ts\n * const hslObject = toHSL('#3498db');\n * console.log(hslObject); // Output: { h: 207.76, s: 0.86, l: 0.56 }\n * ```\n */\nexport const toHSL = (\n color: MoebiusChromaColorInputType\n): MoebiusHSLObjectType => {\n return new UnitHSL(chroma(color).hsl());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusHWBObjectType } from '../../types';\nimport { UnitHWB } from '../color-objects';\n\n/**\n * Converts a color to its corresponding HWB object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusHWBObjectType} The HWB color representation object.\n *\n * @example\n * ```ts\n * const hwbObject = toHWB('#3498db');\n * console.log(hwbObject); // Output: { h: 207.76, w: 0.5, b: 0.14 }\n * ```\n */\nexport const toHWB = (\n color: MoebiusChromaColorInputType\n): MoebiusHWBObjectType => {\n let [r, b, g] = chroma(color).rgb();\n\n r /= 255;\n g /= 255;\n b /= 255;\n\n const w = Math.min(r, g, b);\n const v = Math.max(r, g, b);\n const black = 1 - v;\n\n if (v === w) return { h: 0, w: w, b: black };\n\n const f = r === w ? g - b : g === w ? b - r : r - g;\n const i = r === w ? 3 : g === w ? 5 : 1;\n\n return new UnitHWB({\n h: Number(((i - f / (v - w)) / 6).toFixed(2)),\n w: Number(w.toFixed(2)),\n b: Number(black.toFixed(2))\n });\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusLABObjectType } from '../../types';\nimport { UnitLAB } from '../color-objects';\n\n/**\n * Converts a color to its corresponding LAB object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusLABObjectType} The LAB color representation object.\n *\n * @example\n * ```ts\n * const labObject = toLAB('#3498db');\n * console.log(labObject); // Output: { l: 54.24, a: -12.56, b: -43.81 }\n * ```\n */\nexport const toLAB = (\n color: MoebiusChromaColorInputType\n): MoebiusLABObjectType => {\n return new UnitLAB(chroma(color).lab());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusLABObjectType } from '../../types';\nimport { UnitOKLAB } from '../color-objects';\n\n/**\n * Converts a color to its OKLAB representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusLABObjectType} The OKLAB representation of the input color.\n *\n * @example\n * ```ts\n * const oklabColor = toOKLAB('#3498db');\n * console.log(oklabColor); // Output: { l: 52.42, a: -9.93, b: -39.49 }\n * ```\n */\nexport const toOKLAB = (\n color: MoebiusChromaColorInputType\n): MoebiusLABObjectType => {\n return new UnitOKLAB(chroma(color).oklab());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusHSVObjectType } from '../../types';\nimport { UnitHSV } from '../color-objects';\n\n/**\n * Converts a color to its corresponding HSV object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusHSVObjectType} The HSV color representation object.\n *\n * @example\n * ```ts\n * const hsvObject = toHSV('#3498db');\n * console.log(hsvObject); // Output: { h: 207.76, s: 0.86, v: 0.85 }\n * ```\n */\nexport const toHSV = (\n color: MoebiusChromaColorInputType\n): MoebiusHSVObjectType => {\n return new UnitHSV(chroma(color).hsv());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusLCHObjectType } from '../../types';\nimport { UnitLCH } from '../color-objects';\n\n/**\n * Converts a color to its corresponding LCH object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusLCHObjectType} The LCH color representation object.\n *\n * @example\n * ```ts\n * const lchObject = toLCH('#3498db');\n * console.log(lchObject); // Output: { l: 54.66, c: 76.91, h: 217.76 }\n * ```\n */\nexport const toLCH = (\n color: MoebiusChromaColorInputType\n): MoebiusLCHObjectType => {\n return new UnitLCH(chroma(color).lch());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusLCHObjectType } from '../../types';\nimport { UnitOKLCH } from '../color-objects';\n\n/**\n * Converts a color to its OKLCH representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusLCHObjectType} The OKLCH representation of the input color.\n *\n * @example\n * ```ts\n * const oklchColor = toOKLCH('#3498db');\n * console.log(oklchColor); // Output: { l: 52.12, c: 126.62, h: 232.53 }\n * ```\n */\nexport const toOKLCH = (\n color: MoebiusChromaColorInputType\n): MoebiusLCHObjectType => {\n return new UnitOKLCH(chroma(color).oklch());\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusChromaColorInputType, MoebiusHSIObjectType } from '../../types';\nimport { UnitHSI } from '../color-objects';\n\n/**\n * Converts a color to its corresponding HSI object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @returns {MoebiusHSIObjectType} The HSI color representation object.\n *\n * @example\n * ```ts\n * const hsiObject = toHSI('#3498db');\n * console.log(hsiObject); // Output: { h: 207.76, s: 0.52, i: 0.4 }\n * ```\n */\nexport const toHSI = (\n color: MoebiusChromaColorInputType\n): MoebiusHSIObjectType => {\n return new UnitHSI(chroma(color).hsi());\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueRgbType\n} from '../../types';\n\n/**\n * Converts a color to its RGB representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in any valid chroma-js format.\n * @returns {MoebiusColorValueRgbType} The RGB representation of the input color.\n *\n * @example\n * ```ts\n * const rgbColor = toRGB('#3498db');\n * console.log(rgbColor); // Output: 'rgb(52, 152, 219)'\n * ```\n */\nexport const toRGB = (\n color: MoebiusChromaColorInputType\n): MoebiusColorValueRgbType => {\n const [r, g, b] = chroma(color).rgb();\n\n return `rgb(${r}, ${g}, ${b})`;\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusHSLObjectType,\n MoebiusRGBObjectType\n} from '../../types';\n\n/**\n * Converts a color to its corresponding object representation.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in hex format.\n * @param {string} [type] - The type of representation ('hsl' or undefined for RGB).\n * @returns {MoebiusRGBObjectType | MoebiusHSLObjectType} The color representation object.\n *\n * @example\n * ```ts\n * const rgbObject = toObject('#3498db');\n * console.log(rgbObject); // Output: { r: 52, g: 152, b: 219 }\n *\n * const hslObject = toObject('#3498db', 'hsl');\n * console.log(hslObject); // Output: { h: 207, s: 79, l: 57 }\n * ```\n */\nexport const toObject = (\n color: MoebiusChromaColorInputType,\n type?: string\n): MoebiusRGBObjectType | MoebiusHSLObjectType => {\n if (type === 'hsl') {\n const [h, s, l] = chroma(color).hsl();\n\n return {\n h: Number(!isNaN(h) ? h.toFixed(0) : 0),\n s: Number((s * 100).toFixed()),\n l: Number((l * 100).toFixed())\n };\n }\n\n const rgb = chroma(color).rgb();\n const rgbObject = {\n r: rgb[0],\n g: rgb[1],\n b: rgb[2]\n };\n\n return rgbObject;\n};\n","import { MoebiusPaletteDefaultOptionsType } from '../types';\n\n/**\n * Default options for the Moebius Palette.\n *\n * @type {MoebiusPaletteDefaultOptionsType}\n * @readonly\n *\n * @example\n * ```ts\n * console.log(MOEBIUS_PALETTE_DEFAULT_OPTIONS);\n * // {\n * // diverging: false,\n * // bezier: false,\n * // randomOffset: false,\n * // correctLightness: false,\n * // noDuplicates: true,\n * // colorScaleMode: 'lch',\n * // reverseDirection: false\n * // }\n * ```\n */\nexport const MOEBIUS_PALETTE_DEFAULT_OPTIONS: MoebiusPaletteDefaultOptionsType =\n {\n diverging: false,\n bezier: false,\n randomOffset: false,\n correctLightness: false,\n noDuplicates: true,\n colorScaleMode: 'lch',\n reverseDirection: false\n };\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\n/**\n * Generate a harmonized color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the harmonized palette.\n * @param {number} start - The starting angle for generating harmonized colors (degrees).\n * @param {number} end - The ending angle for generating harmonized colors (degrees).\n * @param {number} interval - The interval between harmonized colors (degrees).\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors in the palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the harmonized palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const harmonizedPalette = harmonize(baseColor, 30, 210, 30, { noDuplicates: true });\n * console.log(harmonizedPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#3498db']\n * ```\n */\nexport const harmonize = (\n color: MoebiusChromaColorInputType,\n start: number,\n end: number,\n interval: number,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const { noDuplicates = true } = options || {};\n // Initialize the array with the base color.\n const colors = [chroma(color).hex() as MoebiusColorValueHexType];\n\n // Convert the HSL color to an object for easy manipulation.\n let [h, s, l] = chroma(color).hsl();\n\n if (isNaN(h)) {\n h = 0;\n }\n\n s = Number((s * 100).toFixed());\n l = Number((l * 100).toFixed());\n\n // Generate harmonized colors within the specified range.\n for (let i = start; i <= end; i += interval) {\n // Calculate the adjusted hue.\n const h1 = Number(((h + i) % 360).toFixed());\n\n // Create the harmonized color in HSL format and add it to the array.\n colors.push(\n chroma(`hsl(${h1}, ${s}%, ${l}%)`).hex() as MoebiusColorValueHexType\n );\n }\n\n let uniqueColors = colors;\n\n if (noDuplicates) {\n uniqueColors = [...new Set(colors)];\n }\n\n return uniqueColors;\n};\n","/**\n * Generates a random integer within a specified range.\n *\n * @param {number} max - The maximum value (inclusive) for the random number.\n * @param {number} min - The minimum value (inclusive) for the random number.\n * @returns {number} - A random integer within the specified range.\n *\n * @example\n * ```ts\n * // Generate a random integer between 1 and 10, inclusive\n * const randomNumber = random(10, 1);\n * console.log(randomNumber); // Example output: 5\n * ```\n */\nexport const random = (max: number, min: number): number =>\n Math.floor(Math.random() * (max - min + 1)) + min;\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusColorValueHslType,\n MoebiusPaletteOptionsType\n} from '../types';\nimport { random } from '../utils/random';\n\n/**\n * Generates a monochromatic color palette based on the given color.\n * @param {MoebiusChromaColorInputType} color - The base color for the palette.\n * @param {MoebiusPaletteOptionsType} options - Options for generating the palette.\n * @returns {MoebiusColorValueHexType[]} - An array of hex color values in the palette.\n * @example\n * ```typescript\n * const baseColor = '#003f5c';\n * const options = { numberOfColors: 5, bezier: true, randomOffset: false };\n * const monochromaticPalette = monochromatic(baseColor, options);\n * console.log(monochromaticPalette);\n * [\n * '#003f5c', // maniacMansion,\n * '#014268', // darkImperialBlue,\n * '#024575', // macraggeBlue,\n * '#044784', // bridgeport,\n * '#064898', // frightNight,\n * '#0745b6', // absoluteZero,\n * '#002df5', // blueBouquet\n * ];\n * ```\n */\nexport const monochromatic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n bezier = false,\n randomOffset = false,\n colorScaleMode = 'rgb',\n noDuplicates = true,\n reverseDirection = false,\n correctLightness = true\n } = options || {};\n\n let [h, s, l] = chroma(color).hsl();\n\n if (isNaN(h)) {\n h = 0;\n }\n\n h = Number(h.toFixed(0));\n s = Number((s * 100).toFixed(0));\n l = Number((l * 100).toFixed(0));\n\n const hslColors: MoebiusColorValueHslType[] = [];\n\n hslColors.push(\n chroma(\n `hsl(${h}, ${s}%, ${l < 0 ? 0 : l}%)`\n ) as unknown as MoebiusColorValueHslType\n );\n\n if (randomOffset) {\n // because we've already added the original color, we start counting from 1\n for (let i = 1; i < numberOfColors; i++) {\n if (reverseDirection) {\n l += random(0, 10);\n h += random(-5, 5);\n } else {\n l -= random(0, 10);\n h -= random(-5, 5);\n }\n\n if (h > 359) h = 359;\n\n if (h < 0) h = 0;\n\n hslColors.push(\n chroma(\n `hsl(${h}, ${s}%, ${l < 0 ? 0 : l}%)`\n ) as unknown as MoebiusColorValueHslType\n );\n }\n } else {\n for (let i = 1; i < numberOfColors; i++) {\n if (reverseDirection) {\n l += 5;\n h += 5;\n } else {\n l -= 5;\n h -= 5;\n }\n\n if (h > 359) h = 359;\n\n if (h < 0) h = 0;\n\n hslColors.push(\n chroma(\n `hsl(${h}, ${s}%, ${l < 0 ? 0 : l}%)`\n ) as unknown as MoebiusColorValueHslType\n );\n }\n }\n\n let colors = hslColors.map((color) =>\n chroma(color).hex()\n ) as MoebiusColorValueHexType[];\n\n if (noDuplicates) {\n colors = [...new Set(colors)];\n }\n\n if (bezier) {\n if (colors.length > 1) {\n colors = chroma\n .bezier(colors)\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n } else {\n colors = chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n }\n }\n\n return colors;\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType,\n MoebiusChromaColorInputType\n} from '../types';\nimport { range } from '../utils/range';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a luminance shift palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the luminance shift palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {boolean} [options.diverging=false] - Whether to generate a diverging palette.\n * @param {number} [options.numberOfColors=7] - The number of colors in the luminance shift palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the luminance shift palette.\n * @private\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const luminanceShiftPalette = generateLuminanceShiftPalette(baseColor, { numberOfColors: 5 });\n * console.log(luminanceShiftPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\nconst generateLuminanceShiftPalette = (\n color: MoebiusChromaColorInputType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n) => {\n if (!color) throw Error('MoebiusPalettes: missing input `color`');\n\n const { diverging = false, numberOfColors = 7 } =\n options as MoebiusPaletteOptionsType;\n const [l, a, b] = chroma(color).lab();\n const lRange = 100 * (0.95 - 1 / numberOfColors);\n const lStep = lRange / (numberOfColors - 1);\n const lStart = (100 - lRange) * 0.5;\n const colorRange = range(lStart, lStart + numberOfColors * lStep, lStep);\n\n let offset = 0;\n\n if (!diverging) {\n offset = 9999;\n for (let i = 0; i < numberOfColors; i++) {\n const diff = l - colorRange[i];\n\n if (Math.abs(diff) < Math.abs(offset)) {\n offset = diff;\n }\n }\n }\n\n return colorRange.map((l) =>\n chroma.lab(l + offset, a, b).hex()\n ) as MoebiusColorValueHexType[];\n};\n/**\n * Generate an array of auto colors for luminance shift based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating auto colors.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the auto colors.\n * @param {number} [options.numberOfColors] - The number of auto colors to generate.\n * @param {boolean} [options.reverseDirection=false] - Whether to reverse the order of generated colors.\n * @param {boolean} [options.diverging=false] - Whether to generate diverging auto colors.\n * @param {string} [options.divergentColor] - The divergent color to include in the palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the auto colors.\n * @private\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const autoColors = luminanceShiftAutoColors(baseColor, { numberOfColors: 5 });\n * console.log(autoColors); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\nconst luminanceShiftAutoColors = (\n color: MoebiusColorValueHexType,\n options?: Partial<MoebiusPaletteOptionsType>\n) => {\n const {\n numberOfColors = 7,\n reverseDirection = false,\n diverging = false,\n divergentColor = '#f5f5f5'\n } = options || {};\n\n if (diverging) {\n const colors = generateLuminanceShiftPalette(chroma(color).hex(), {\n numberOfColors: Math.ceil((numberOfColors as number) / 2)\n }).concat(divergentColor);\n\n if (reverseDirection) colors.reverse();\n\n return colors;\n } else {\n return generateLuminanceShiftPalette(color, { numberOfColors });\n }\n};\n\n/**\n * Generate a luminance shift palette based on an array of colors, with optional diverging colors.\n *\n * @param {MoebiusChromaColorInputType[]} colors - Array of base colors for generating the luminance shift palette.\n * @param {MoebiusChromaColorInputType[]} [divergingColors=[]] - Array of diverging colors.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The total number of colors in the luminance shift palette.\n * @param {boolean} [options.diverging=false] - Whether to generate a diverging palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.\n * @param {string} [options.divergentColor='#f5f5f5'] - The divergent color for a diverging palette.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the luminance shift palette.\n *\n * @example\n * ```ts\n * const baseColors = ['#3498db', '#99db34'];\n * const divergingColors = ['#db3434'];\n * const luminanceShiftPalette = luminanceShift(baseColors, divergingColors, { numberOfColors: 5 });\n * console.log(luminanceShiftPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\nexport const luminanceShift = (\n colors: MoebiusColorValueHexType[],\n divergingColors: MoebiusColorValueHexType[] = [],\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n diverging = false,\n colorScaleMode = 'rgb',\n bezier = false,\n divergentColor = '#f5f5f5',\n correctLightness = true\n } = options || {};\n\n divergingColors =\n divergingColors.length === 0\n ? [harmonize(colors[0], 90, 270, 90)[3]]\n : divergingColors;\n\n const even = numberOfColors % 2 === 0;\n const numberOfColorsLeft = diverging\n ? Math.ceil(numberOfColors / 2) + (even ? 1 : 0)\n : numberOfColors;\n const numberOfColorsRight = diverging\n ? Math.ceil(numberOfColors / 2) + (even ? 1 : 0)\n : 0;\n const generatedColors =\n colors.length !== 1\n ? colors\n : luminanceShiftAutoColors(colors[0], {\n numberOfColors: numberOfColorsLeft,\n divergentColor\n });\n\n let generatedDivergentColors: MoebiusColorValueHexType[] = [];\n\n if (diverging) {\n generatedDivergentColors =\n divergingColors.length !== 1\n ? divergingColors\n : luminanceShiftAutoColors(divergingColors[0], {\n numberOfColors: numberOfColorsRight,\n divergentColor,\n reverseDirection: false,\n diverging\n });\n }\n\n let stepsLeft = colors.length\n ? (chroma\n .scale(generatedColors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColorsLeft) as MoebiusColorValueHexType[])\n : [];\n\n if (bezier) {\n stepsLeft = colors.length\n ? (chroma\n .bezier(generatedColors)\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColorsLeft) as MoebiusColorValueHexType[])\n : [];\n }\n\n let stepsRight =\n diverging && divergingColors.length\n ? (chroma\n .scale(generatedDivergentColors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColorsRight) as MoebiusColorValueHexType[])\n : [];\n\n if (bezier) {\n stepsRight =\n diverging && divergingColors.length\n ? (chroma\n .bezier(generatedDivergentColors)\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColorsRight) as MoebiusColorValueHexType[])\n : [];\n }\n\n let steps = stepsLeft;\n\n steps = (\n diverging\n ? stepsLeft.slice(\n 0,\n stepsLeft.length - (numberOfColorsLeft % 2 !== 0 ? 0 : 1)\n )\n : stepsLeft\n )\n //).concat(stepsRight.slice(1).reverse());\n .concat(stepsRight.reverse());\n\n return steps;\n};\n","/**\n * Generates an array of numbers within a specified range with a given interval.\n * @param {number} start - The starting value of the range.\n * @param {number} stop - The stopping value of the range.\n * @param {number} interval - The interval between numbers in the range.\n * @returns {number[]} - An array of numbers in the specified range.\n * @example\n * ```ts\n * const result = range(1, 10, 2);\n * console.log(result); // [1, 3, 5, 7, 9]\n * ```\n */\nexport const range = (\n start: number,\n stop: number,\n interval: number\n): number[] => {\n const a: number[] = [];\n\n for (let i = start; i < stop; i += interval) {\n a.push(i);\n }\n\n return a;\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusColorValueHexType, MoebiusPaletteOptionsType } from '../types';\n\n/**\n * Generates a color scale using Chroma.js's bezier interpolation.\n * @param {MoebiusColorValueHexType[]} colors - The input colors for the bezier interpolation.\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Options for generating the color scale.\n * @param {number} [options.numberOfColors=8] - The number of colors in the resulting scale.\n * @param {string} [options.colorScaleMode] - The color scale mode for Chroma.js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the color scale.\n * @returns {MoebiusColorValueHexType[]} - The generated color scale.\n * @example\n * ```ts\n * const inputColors = ['#3498db', '#2ecc71', '#e74c3c'];\n * const options = { numberOfColors: 5, colorScaleMode: 'lch', correctLightness: false };\n * const scaleColors = getChromaBezierScaleColors(inputColors, options);\n * console.log(scaleColors);\n * ```\n */\nexport const getChromaBezierScaleColors = (\n colors: MoebiusColorValueHexType[],\n options?: MoebiusPaletteOptionsType\n) => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n\n try {\n return chroma\n .bezier(colors)\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n } catch {\n return [];\n }\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusColorValueHexType, MoebiusPaletteOptionsType } from '../types';\n\n/**\n * Generates a color scale using Chroma.js.\n * @param {MoebiusColorValueHexType[]} colors - The input colors for the color scale.\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Options for generating the color scale.\n * @param {number} [options.numberOfColors=8] - The number of colors in the resulting scale.\n * @param {string} [options.colorScaleMode] - The color scale mode for Chroma.js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the color scale.\n * @returns {MoebiusColorValueHexType[]} - The generated color scale.\n * @example\n * ```ts\n * const inputColors = ['#3498db', '#2ecc71', '#e74c3c'];\n * const options = { numberOfColors: 5, colorScaleMode: 'lch', correctLightness: false };\n * const scaleColors = getChromaScaleColors(inputColors, options);\n * console.log(scaleColors);\n * ```\n */\nexport const getChromaScaleColors = (\n colors: MoebiusColorValueHexType[],\n options?: MoebiusPaletteOptionsType\n) => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n\n try {\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n } catch {\n return [];\n }\n};\n","/* eslint-disable @stylistic/indent */\nimport { monochromatic } from '../features';\nimport {\n MoebiusColorValueHexType,\n MoebiusPaletteAccentColorsInterface,\n MoebiusPaletteColorsInterface,\n MoebiusPaletteOptionsType\n} from '../types';\n\n/**\n * Class representing a set of accent colors in various palettes.\n */\nexport class MoebiusAccentColors\n implements MoebiusPaletteAccentColorsInterface\n{\n interpolate: MoebiusColorValueHexType[][];\n luminanceShift: MoebiusColorValueHexType[][];\n monochromatic: MoebiusColorValueHexType[][];\n complement: MoebiusColorValueHexType[][];\n split: MoebiusColorValueHexType[][];\n triadic: MoebiusColorValueHexType[][];\n tetradic: MoebiusColorValueHexType[][];\n pentadic: MoebiusColorValueHexType[][];\n hexadic: MoebiusColorValueHexType[][];\n analogous: MoebiusColorValueHexType[][];\n\n /**\n * Creates an instance of MoebiusAccentColors.\n * @param {MoebiusPaletteColorsInterface} colors - Base colors for accent palettes.\n * @param {MoebiusPaletteOptionsType} options - Options for generating accent palettes.\n * @example\n * ```ts\n * const colors = {\n * monochromatic: ['#ff0000', '#00ff00'],\n * // other base palettes...\n * };\n * const options = { baseColor: { color: '#ff0000', name: 'Red', hex: '#ff0000' }, numberOfColors: 9 };\n * const accentColors = new MoebiusAccentColors(colors, options);\n * ```\n */\n constructor(\n colors: MoebiusPaletteColorsInterface,\n options: MoebiusPaletteOptionsType\n ) {\n Object.keys(colors).forEach((palette) => {\n this[palette] = colors[palette].map((color: MoebiusColorValueHexType) =>\n monochromatic(color, { ...options, numberOfColors: 9 })\n );\n });\n }\n /**\n * Converts the accent palettes to a flat array.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values.\n * @example\n * ```ts\n * const accentColors = new MoebiusAccentColors(baseColors, options);\n * const flatArray = accentColors.toArray();\n * console.log(flatArray); // ['#ff0000', '#00ff00', ...]\n * ```\n */\n toArray(): MoebiusColorValueHexType[] {\n return [\n ...this.interpolate,\n ...this.luminanceShift,\n ...this.monochromatic,\n ...this.complement,\n ...this.split,\n ...this.triadic,\n ...this.tetradic,\n ...this.pentadic,\n ...this.hexadic,\n ...this.analogous\n ].flat();\n }\n}\n","import {\n MoebiusColorValueHexType,\n MoebiusPaletteColorsInterface\n} from '../types';\n\n/**\n * Class representing a set of colors in various palettes.\n */\nexport class MoebiusPaletteColors implements MoebiusPaletteColorsInterface {\n interpolate: MoebiusColorValueHexType[];\n luminanceShift: MoebiusColorValueHexType[];\n monochromatic: MoebiusColorValueHexType[];\n complement: MoebiusColorValueHexType[];\n split: MoebiusColorValueHexType[];\n triadic: MoebiusColorValueHexType[];\n tetradic: MoebiusColorValueHexType[];\n pentadic: MoebiusColorValueHexType[];\n hexadic: MoebiusColorValueHexType[];\n analogous: MoebiusColorValueHexType[];\n\n /**\n * Creates an instance of MoebiusPaletteColors.\n * @param {MoebiusPaletteColorsInterface} colors - Palette colors to initialize with.\n * @example\n * ```ts\n * const colors = {\n * interpolate: ['#ff0000', '#00ff00'],\n * // other palettes...\n * };\n * const palette = new MoebiusPaletteColors(colors);\n * ```\n */\n constructor(colors: MoebiusPaletteColorsInterface) {\n Object.keys(colors).forEach((palette) => {\n this[palette] = colors[palette];\n });\n }\n\n /**\n * Converts the palettes to a flat array.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values.\n * @example\n * ```ts\n * const palette = new MoebiusPaletteColors({ interpolate: ['#ff0000', '#00ff00'] });\n * const flatArray = palette.toArray();\n * console.log(flatArray); // ['#ff0000', '#00ff00']\n * ```\n */\n toArray(): MoebiusColorValueHexType[] {\n return [\n ...this.interpolate,\n ...this.luminanceShift,\n ...this.monochromatic,\n ...this.complement,\n ...this.split,\n ...this.triadic,\n ...this.tetradic,\n ...this.pentadic,\n ...this.hexadic,\n ...this.analogous\n ].flat();\n }\n}\n","import {\n MoebiusColorValueHexType,\n MoebiusThemeColorsInterface\n} from '../types';\n\n/**\n * Class representing a set of colors in various themes.\n */\nexport class MoebiusThemeColors implements MoebiusThemeColorsInterface {\n darkMode: Record<string, MoebiusColorValueHexType[]>;\n\n /**\n * Creates an instance of MoebiusThemeColors.\n * @param {MoebiusThemeColorsInterface} colors - Palette colors to initialize with.\n * @example\n * ```ts\n * const colors = {\n * interpolate: ['#ff0000', '#00ff00'],\n * // other themes...\n * };\n * const theme = new MoebiusThemeColors(colors);\n * ```\n */\n constructor(colors: MoebiusThemeColorsInterface) {\n Object.keys(colors).forEach((theme) => {\n this[theme] = colors[theme];\n });\n }\n}\n","import { MOEBIUS_PALETTE_DEFAULT_OPTIONS } from '../constants';\nimport * as FEATURES from '../features';\nimport {\n MoebiusColorValueHexType,\n MoebiusColorInterface,\n MoebiusPaletteAccentColorsInterface,\n MoebiusPaletteColorsInterface,\n MoebiusPaletteDefaultOptionsType,\n MoebiusPaletteOptionsType,\n MoebiusPaletteInterface,\n MoebiusChromaColorInputType,\n MoebiusThemeColorsInterface\n} from '../types';\n\nimport { MoebiusAccentColors } from './MoebiusAccentColors';\nimport { MoebiusPaletteColors } from './MoebiusPaletteColors';\nimport { MoebiusThemeColors } from './MoebiusThemeColors';\n\n/**\n * MoebiusPalettes class representing a set of color palettes and their variations.\n *\n */\nexport class MoebiusPalettes implements MoebiusPaletteInterface {\n baseColor: MoebiusColorInterface;\n secondaryColor: MoebiusColorInterface;\n colors: MoebiusPaletteColorsInterface;\n themes: MoebiusThemeColorsInterface;\n defaultOptions: MoebiusPaletteDefaultOptionsType = {\n ...MOEBIUS_PALETTE_DEFAULT_OPTIONS,\n divergentColor: '#f5f5f5'\n };\n options: MoebiusPaletteOptionsType;\n all: MoebiusColorValueHexType[] = [];\n accents: MoebiusPaletteAccentColorsInterface;\n\n /**\n * Creates an instance of MoebiusPalettes.\n * @param {MoebiusPaletteOptionsType} options - Options for configuring the palettes.\n */\n constructor(options: MoebiusPaletteOptionsType) {\n this.options = { ...this.defaultOptions, ...options };\n this.baseColor = this.options.baseColor;\n this.secondaryColor = this.options.secondaryColor;\n this.themes = new MoebiusThemeColors({\n darkMode: this.darkMode(this.baseColor.hex, this.secondaryColor.hex, {\n ...this.options,\n reverseDirection: !this.options.reverseDirection\n })\n });\n this.colors = new MoebiusPaletteColors({\n interpolate: this.interpolate(\n this.baseColor.hex,\n this.secondaryColor.hex,\n this.options\n ),\n luminanceShift: this.luminanceShift(\n [this.baseColor.hex],\n [this.secondaryColor.hex],\n this.options\n ),\n monochromatic: this.monochromatic(this.baseColor.hex),\n complement: this.complement(this.baseColor.hex),\n split: this.split(this.baseColor.hex),\n triadic: this.triadic(this.baseColor.hex),\n tetradic: this.tetradic(this.baseColor.hex),\n pentadic: this.pentadic(this.baseColor.hex),\n hexadic: this.hexadic(this.baseColor.hex),\n analogous: this.analogous(this.baseColor.hex)\n });\n\n this.accents = new MoebiusAccentColors(this.colors, this.options);\n\n this.all = [\n ...new Set(\n [\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(this.accents as any).toArray(),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...(this.colors as any).toArray()\n ].flat()\n )\n ];\n }\n\n /**\n * Generate a complement color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the complement palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.<\n * @param {number} [options.numberOfColors=8] - The number of colors in the complement palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the complement palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const complementPalette = complement(baseColor, { numberOfColors: 5 });\n * console.log(complementPalette); // ['#3498db', '#db3434', '#75db34', '#dbd134', '#db7434']\n * ```\n */\n complement(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.complement(color, currentOptions);\n }\n\n /**\n * Generates a dark mode color palette based on the provided base and secondary colors.\n * @param {MoebiusChromaColorInputType} baseColor - The base color for the palette.\n * @param {MoebiusChromaColorInputType} secondaryColor - The secondary color for the palette.\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Palette options.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation for color scales.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma.mix.\n * @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors from the palette.\n * @returns {Record<string, MoebiusColorValueHexType[]>} - The generated dark mode color palette.\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const secondaryColor = '#2ecc71';\n * const options = { bezier: true, colorScaleMode: 'lch' };\n * const palette = darkMode(baseColor, secondaryColor, options);\n * console.log(palette);\n * ```\n */\n darkMode(\n baseColor: MoebiusChromaColorInputType,\n secondaryColor: MoebiusChromaColorInputType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): Record<string, MoebiusColorValueHexType[]> {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.darkMode(baseColor, secondaryColor, currentOptions);\n }\n\n /**\n * Generate a split color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the split palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the split palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the split palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const splitPalette = split(baseColor, { numberOfColors: 5 });\n * console.log(splitPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\n split(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.split(color, currentOptions);\n }\n\n /**\n * Generates a triadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in various formats (HEX, RGB, HSL, etc.).\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} options - Additional options for palette generation.\n * @param {number} [options.numberOfColors=8] - The number of colors in the generated palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for the generated palette.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} An array of HEX values representing the triadic color palette.\n *\n * @example\n * ```ts\n * const triadicPalette = triadic('#3498db', { numberOfColors: 5 });\n * console.log(triadicPalette);\n * // Output: ['#3498db', '#db344f', '#4fdb34', '#9834db', '#34db98']\n * ```\n */\n triadic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.triadic(color, currentOptions);\n }\n\n /**\n * Generate a tetradic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the tetradic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the tetradic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the tetradic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const tetradicPalette = tetradic(baseColor, { numberOfColors: 5 });\n * console.log(tetradicPalette); // ['#3498db', '#db3434', '#34db99', '#dbd134', '#8f34db']\n * ```\n */\n tetradic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.tetradic(color, currentOptions);\n }\n\n /**\n * Generate a pentadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the pentadic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the pentadic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the pentadic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const pentadicPalette = pentadic(baseColor, { numberOfColors: 5 });\n * console.log(pentadicPalette); // ['#3498db', '#dbd134', '#db3434', '#34db99', '#8f34db']\n * ```\n */\n pentadic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.pentadic(color, currentOptions);\n }\n\n /**\n * Generate a hexadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the hexadic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the hexadic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the hexadic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const hexadicPalette = hexadic(baseColor, { numberOfColors: 5 });\n * console.log(hexadicPalette); // ['#3498db', '#5d7f33', '#8473a9', '#ad7a95', '#db3434']\n * ```\n */\n hexadic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.hexadic(color, currentOptions);\n }\n\n /**\n * Generate an analogous color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the analogous palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the analogous palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the analogous palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const analogousPalette = analogous(baseColor, { numberOfColors: 5 });\n * console.log(analogousPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#db3474']\n * ```\n */\n analogous(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.analogous(color, currentOptions);\n }\n\n /**\n * Interpolate between two colors and generate a color palette.\n *\n * @param {MoebiusChromaColorInputType} primaryColor - The starting color for interpolation.\n * @param {MoebiusChromaColorInputType} secondaryColor - The ending color for interpolation.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the interpolated palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the interpolated palette.\n *\n * @example\n * ```ts\n * const startColor = '#3498db';\n * const endColor = '#db3434';\n * const interpolatedPalette = interpolate(startColor, endColor, { numberOfColors: 5 });\n * console.log(interpolatedPalette); // ['#3498db', '#5d6d7e', '#8473a9', '#ad7a95', '#db3434']\n * ```\n */\n interpolate(\n primaryColor: MoebiusColorValueHexType,\n secondaryColor: MoebiusColorValueHexType,\n options?: MoebiusPaletteOptionsType\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...(options || {}) };\n\n return FEATURES.interpolate(primaryColor, secondaryColor, currentOptions);\n }\n /**\n * Generate a luminance shift palette based on an array of colors, with optional diverging colors.\n *\n * @param {MoebiusChromaColorInputType[]} colors - Array of base colors for generating the luminance shift palette.\n * @param {MoebiusChromaColorInputType[]} [divergingColors=[]] - Array of diverging colors.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The total number of colors in the luminance shift palette.\n * @param {boolean} [options.diverging=false] - Whether to generate a diverging palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.\n * @param {string} [options.divergentColor='#f5f5f5'] - The divergent color for a diverging palette.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the luminance shift palette.\n *\n * @example\n * ```ts\n * const baseColors = ['#3498db', '#99db34'];\n * const divergingColors = ['#db3434'];\n * const luminanceShiftPalette = luminanceShift(baseColors, divergingColors, { numberOfColors: 5 });\n * console.log(luminanceShiftPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\n luminanceShift(\n colors: MoebiusColorValueHexType[],\n divergingColors: MoebiusColorValueHexType[] = [],\n\n options?: MoebiusPaletteOptionsType\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...(options || {}) };\n\n return FEATURES.luminanceShift(colors, divergingColors, currentOptions);\n }\n\n /**\n * Generates a monochromatic color palette based on the given color.\n * @param {MoebiusChromaColorInputType} color - The base color for the palette.\n * @param {MoebiusPaletteOptionsType} options - Options for generating the palette.\n * @returns {MoebiusColorValueHexType[]} - An array of hex color values in the palette.\n * @example\n * ```typescript\n * const baseColor = '#003f5c';\n * const options = { numberOfColors: 5, bezier: true, randomOffset: false };\n * const monochromaticPalette = monochromatic(baseColor, options);\n * console.log(monochromaticPalette);\n * [\n * '#003f5c', // maniacMansion,\n * '#014268', // darkImperialBlue,\n * '#024575', // macraggeBlue,\n * '#044784', // bridgeport,\n * '#064898', // frightNight,\n * '#0745b6', // absoluteZero,\n * '#002df5', // blueBouquet\n * ];\n * ```\n */\n monochromatic(\n color: MoebiusColorValueHexType,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.monochromatic(color, currentOptions);\n }\n /**\n * Generate a harmonized color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the harmonized palette.\n * @param {number} start - The starting angle for generating harmonized colors (degrees).\n * @param {number} end - The ending angle for generating harmonized colors (degrees).\n * @param {number} interval - The interval between harmonized colors (degrees).\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors in the palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the harmonized palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const harmonizedPalette = harmonize(baseColor, 30, 210, 30, { noDuplicates: true });\n * console.log(harmonizedPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#3498db']\n * ```\n */\n harmonize(\n color: MoebiusColorValueHexType,\n start: number,\n end: number,\n interval: number,\n options: Record<string, unknown> | MoebiusPaletteOptionsType = {}\n ): MoebiusColorValueHexType[] {\n const currentOptions = { ...this.options, ...options };\n\n return FEATURES.harmonize(color, start, end, interval, currentOptions);\n }\n}\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a complement color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the complement palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the complement palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the complement palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const complementPalette = complement(baseColor, { numberOfColors: 5 });\n * console.log(complementPalette); // ['#3498db', '#db3434', '#75db34', '#dbd134', '#db7434']\n * ```\n */\nexport const complement = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a complement color scheme.\n const colors = harmonize(color, 180, 180, 1);\n\n // Use chroma-js to fill in missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\nimport { getChromaBezierScaleColors } from '../utils/get-chroma-bezier-scale-colors';\nimport { getChromaScaleColors } from '../utils/get-chroma-scale-colors';\n\nimport { monochromatic } from './monochromatic';\n\n/**\n * Generates a dark mode color palette based on the provided base and secondary colors.\n * @param {MoebiusChromaColorInputType} baseColor - The base color for the palette.\n * @param {MoebiusChromaColorInputType} secondaryColor - The secondary color for the palette.\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} [options={}] - Palette options.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation for color scales.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma.mix.\n * @param {boolean} [options.noDuplicates=true] - Whether to remove duplicate colors from the palette.\n * @returns {Record<string, MoebiusColorValueHexType[]>} - The generated dark mode color palette.\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const secondaryColor = '#2ecc71';\n * const options = { bezier: true, colorScaleMode: 'lch' };\n * const palette = darkMode(baseColor, secondaryColor, options);\n * console.log(palette);\n * ```\n */\nexport const darkMode = (\n baseColor: MoebiusChromaColorInputType,\n secondaryColor: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): Record<string, MoebiusColorValueHexType[]> => {\n const {\n bezier = false,\n colorScaleMode = 'rgb',\n noDuplicates = true\n } = options || {};\n const ratio = 0.99;\n const ratioMultiplier = 0.02;\n const primaryAccents = monochromatic(baseColor, options);\n const surfaceAccents = monochromatic(secondaryColor, options);\n const mixedAccents = surfaceAccents.map((hex, index) => {\n return chroma\n .mix(\n primaryAccents[index],\n hex,\n ratio - index * ratioMultiplier,\n colorScaleMode\n )\n .hex() as unknown as MoebiusColorValueHexType;\n });\n const palette = {\n primary: primaryAccents,\n surface: surfaceAccents,\n mixed: mixedAccents\n };\n\n if (noDuplicates) {\n palette.primary = [...new Set(primaryAccents)];\n palette.surface = [...new Set(surfaceAccents)];\n palette.mixed = [...new Set(mixedAccents)];\n }\n\n if (bezier) {\n if (\n palette.primary.length > 1 &&\n palette.surface.length > 1 &&\n palette.mixed.length > 1\n ) {\n palette.primary = getChromaBezierScaleColors(palette.primary, options);\n palette.surface = getChromaBezierScaleColors(palette.surface, options);\n palette.mixed = getChromaBezierScaleColors(palette.mixed, options);\n } else {\n palette.primary = getChromaScaleColors(palette.primary, options);\n palette.surface = getChromaScaleColors(palette.surface, options);\n palette.mixed = getChromaScaleColors(palette.mixed, options);\n }\n }\n\n return palette;\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a split color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the split palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the split palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the split palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const splitPalette = split(baseColor, { numberOfColors: 5 });\n * console.log(splitPalette); // ['#3498db', '#99db34', '#dbd134', '#db3434', '#8f34db']\n * ```\n */\nexport const split = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a split color scheme.\n const colors = harmonize(color, 150, 210, 60);\n\n // Use chroma-js to fill in the missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generates a triadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The input color in various formats (HEX, RGB, HSL, etc.).\n * @param {Record<string, unknown> | MoebiusPaletteOptionsType} options - Additional options for palette generation.\n * @param {number} [options.numberOfColors=8] - The number of colors in the generated palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for the generated palette.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} An array of HEX values representing the triadic color palette.\n *\n * @example\n * ```ts\n * const triadicPalette = triadic('#3498db', { numberOfColors: 5 });\n * console.log(triadicPalette);\n * // Output: ['#3498db', '#db344f', '#4fdb34', '#9834db', '#34db98']\n * ```\n */\nexport const triadic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n const colors = harmonize(color, 120, 240, 120);\n\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a tetradic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the tetradic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the tetradic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the tetradic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const tetradicPalette = tetradic(baseColor, { numberOfColors: 5 });\n * console.log(tetradicPalette); // ['#3498db', '#db3434', '#34db99', '#dbd134', '#8f34db']\n * ```\n */\nexport const tetradic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a tetradic color scheme.\n const colors = harmonize(color, 90, 270, 90);\n\n // Use chroma-js to fill in the missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a pentadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the pentadic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the pentadic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the pentadic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const pentadicPalette = pentadic(baseColor, { numberOfColors: 5 });\n * console.log(pentadicPalette); // ['#3498db', '#dbd134', '#db3434', '#34db99', '#8f34db']\n * ```\n */\nexport const pentadic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a pentadic color scheme.\n const colors = harmonize(color, 144, 360, 72);\n\n // Use chroma-js to fill in colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate a hexadic color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the hexadic palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the hexadic palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the hexadic palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const hexadicPalette = hexadic(baseColor, { numberOfColors: 5 });\n * console.log(hexadicPalette); // ['#3498db', '#5d7f33', '#8473a9', '#ad7a95', '#db3434']\n * ```\n */\nexport const hexadic = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate a hexadic color scheme.\n const colors = harmonize(color, 120, 360, 60);\n\n // Use chroma-js to fill in missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport {\n MoebiusChromaColorInputType,\n MoebiusColorValueHexType,\n MoebiusPaletteOptionsType\n} from '../types';\n\nimport { harmonize } from './harmonize';\n\n/**\n * Generate an analogous color palette based on the input color.\n *\n * @param {MoebiusChromaColorInputType} color - The base color for generating the analogous palette.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the analogous palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the analogous palette.\n *\n * @example\n * ```ts\n * const baseColor = '#3498db';\n * const analogousPalette = analogous(baseColor, { numberOfColors: 5 });\n * console.log(analogousPalette); // ['#3498db', '#75db34', '#dbd134', '#db7434', '#db3474']\n * ```\n */\nexport const analogous = (\n color: MoebiusChromaColorInputType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n correctLightness = true\n } = options || {};\n // Generate an analogous color scheme.\n const colors = harmonize(color, 30, 90, 30);\n\n // Use chroma-js to fill in the missing colors for the palette.\n return chroma\n .scale(colors)\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n};\n","import chroma from 'chroma-js';\n\nimport { MoebiusColorValueHexType, MoebiusPaletteOptionsType } from '../types';\n\n/**\n * Interpolate between two colors and generate a color palette.\n *\n * @param {MoebiusColorValueHexType} primaryColor - The starting color for interpolation.\n * @param {MoebiusColorValueHexType} secondaryColor - The ending color for interpolation.\n * @param {MoebiusPaletteOptionsType} [options={}] - Options for generating the palette.\n * @param {number} [options.numberOfColors=8] - The number of colors in the interpolated palette.\n * @param {string} [options.colorScaleMode] - The color scale mode for chroma-js.\n * @param {boolean} [options.bezier=false] - Whether to use bezier interpolation.\n * @param {boolean} [options.correctLightness=true] - Whether to correct lightness in the generated palette.\n * @returns {MoebiusColorValueHexType[]} - Array of hex color values representing the interpolated palette.\n *\n * @example\n * ```ts\n * const startColor = '#3498db';\n * const endColor = '#db3434';\n * const interpolatedPalette = interpolate(startColor, endColor, { numberOfColors: 5 });\n * console.log(interpolatedPalette); // ['#3498db', '#5d6d7e', '#8473a9', '#ad7a95', '#db3434']\n * ```\n */\nexport const interpolate = (\n primaryColor: MoebiusColorValueHexType,\n secondaryColor: MoebiusColorValueHexType,\n options?: MoebiusPaletteOptionsType\n): MoebiusColorValueHexType[] => {\n const {\n numberOfColors = 8,\n colorScaleMode = 'rgb',\n bezier = false,\n correctLightness = true\n } = options || {};\n\n let colors = chroma\n .scale([primaryColor, secondaryColor])\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n\n if (bezier) {\n colors = chroma\n .bezier([primaryColor, secondaryColor])\n .scale()\n .mode(colorScaleMode)\n .correctLightness(correctLightness)\n .colors(numberOfColors) as MoebiusColorValueHexType[];\n }\n\n return colors;\n};\n","import { MoebiusColorValueHexType } from '../types';\nimport { getStartMaskDegree } from '../utils/svg/get-start-mask-degree';\nimport { pieSlice } from '../utils/svg/pie-slice';\nimport { uniqueID } from '../utils/unique-id';\n\n/**\n * Helper class for generating SVG paths for colored pie slices.\n */\nexport class MoebiusSVGHelper {\n xlmns = 'http://www.w3.org/2000/svg';\n\n /**\n * Gets SVG paths for coloured pie slices based on the provided colors.\n * @param {MoebiusColorValueHexType[][]} colors - Array of color groups.\n * @param {number} [size=256] - Size of the SVG.\n * @returns {DocumentFragment} - Document fragment containing the SVG paths.\n * @example\n * ```ts\n * const svgHelper = new MoebiusSVGHelper();\n * const colors = [['#ff0000', '#00ff00'], ['#0000ff']];\n * const svgFragment = svgHelper.getColorPiePaths(colors, 256);\n * document.body.appendChild(svgFragment);\n * ```\n */\n getColorPiePaths(\n colors: MoebiusColorValueHexType[][],\n size: number = 256\n ): DocumentFragment {\n const df = document.createDocumentFragment();\n const defsElement = document.createElementNS(this.xlmns, 'defs');\n const maskElement = document.createElementNS(this.xlmns, 'mask');\n const rectElement = document.createElementNS(this.xlmns, 'rect');\n const gElement = document.createElementNS(this.xlmns, 'g');\n const interval = 360 / colors.length;\n const id = uniqueID();\n\n maskElement.setAttributeNS(null, 'id', id);\n rectElement.setAttributeNS(null, 'height', '100%');\n rectElement.setAttributeNS(null, 'width', '100%');\n rectElement.setAttributeNS(null, 'fill', 'white');\n gElement.setAttributeNS(null, 'mask', `url(#${id})`);\n maskElement.appendChild(rectElement);\n\n const maskDegrees = 360 / colors.length;\n const startMaskDegree = getStartMaskDegree(maskDegrees / 2, colors.length);\n\n for (let i = startMaskDegree; i < 360; i += maskDegrees) {\n const lineElement = document.createElementNS(this.xlmns, 'line');\n\n lineElement.setAttributeNS(null, 'x1', '128');\n lineElement.setAttributeNS(null, 'y1', '128');\n lineElement.setAttributeNS(null, 'x2', '0');\n lineElement.setAttributeNS(null, 'y2', '128');\n lineElement.setAttributeNS(null, 'stroke', 'black');\n lineElement.setAttributeNS(null, 'stroke-width', '6');\n lineElement.setAttributeNS(null, 'transform', `rotate(${i} 128 128)`);\n maskElement.appendChild(lineElement);\n }\n\n let start = 0;\n\n colors.forEach((group: string[]) => {\n const inwardInterval = size / 2 / group.length;\n\n start += interval;\n\n return group.forEach((color: MoebiusColorValueHexType, index: number) => {\n const r = size / 2 - index * inwardInterval;\n const path = document.createElementNS(this.xlmns, 'path');\n\n path.setAttributeNS(null, 'fill', color);\n path.setAttributeNS(null, 'data-color-hex', color);\n path.setAttributeNS(null, 'data-r', `${r}`);\n path.setAttributeNS(null, 'd', pieSlice(start, interval, r));\n gElement.appendChild(path);\n });\n });\n defsElement.appendChild(maskElement);\n df.appendChild(defsElement);\n df.appendChild(gElement);\n\n return df;\n }\n}\n","/**\n * Generates a unique identifier.\n * @returns {string} - A unique identifier.\n * @example\n * ```ts\n * const id = uniqueID();\n * console.log(id); // \"_abc123\"\n * ```\n */\nexport const uniqueID = (): string =>\n '_' + Math.random().toString(36).substring(2, 11);\n","/**\n * Calculates the starting mask degree based on the number of elements in a color group.\n *\n * @param {number} initial - The initial starting degree.\n * @param {number} length - The number of elements in the color group.\n * @returns {number} - The adjusted starting degree for creating a color mask.\n */\nexport const getStartMaskDegree = (initial: number, length: number): number => {\n if (length === 4 || length === 8 || length === 12) {\n return 0;\n } else if (length === 3 || length === 9) {\n return 30;\n } else if (length === 7) {\n return 12;\n } else if (length === 5) {\n return 55;\n }\n\n return initial;\n};\n","/**\n * Generates an SVG path representing a pie slice.\n *\n * @param {number} start - Starting angle of the pie slice in degrees.\n * @param {number} interval - Angular interval of the pie slice in degrees.\n * @param {number} radius - Radius of the circle.\n * @param {number} size - Size of the circle. Default is 256.\n * @returns {string} - SVG path representing the pie slice.\n */\nexport const pieSlice = (\n start: number,\n interval: number,\n radius: number,\n size: number = 256\n): string => {\n const centerX = size / 2; // X-coordinate of the circle's center\n const centerY = centerX; // Y-coordinate of the circle's center\n\n let stop = start + interval;\n\n // Ensure start is smaller than stop\n if (start > stop) {\n const temp = start;\n\n start = stop;\n stop = temp;\n }\n\n // Calculate start and end points\n const startX = centerX + radius * Math.cos((-start + 90) * (Math.PI / 180));\n const startY = centerY + radius * Math.sin((-start + 90) * (Math.PI / 180));\n const endX = centerX + radius * Math.cos((-stop + 90) * (Math.PI / 180));\n const endY = centerY + radius * Math.sin((-stop + 90) * (Math.PI / 180));\n const largeArcFlag = stop - start <= 180 ? '0' : '1';\n\n // Create the SVG path\n return `M ${startX} ${startY} A ${radius} ${radius} 0 ${largeArcFlag} 0 ${endX} ${endY} L ${centerX} ${centerY} Z`;\n};\n","/* eslint-disable import/no-unused-modules */\nimport { isString } from '@phun-ky/typeof';\nimport chroma from 'chroma-js';\nimport nearestColor from 'nearest-color';\n\nimport { MoebiusColor } from './classes/MoebiusColor';\nimport { MoebiusPalettes } from './classes/MoebiusPalettes';\nimport { MoebiusSVGHelper } from './classes/MoebiusSVGHelper';\nimport {\n MoebiusColorValueHexType,\n MoebiusReturnType,\n NearestColorColorMatchInterface\n} from './types';\n\nexport type * from './types';\n\n/**\n * Initializes a color name mapping using an external API.\n * The resulting function takes a color (hex or keyword) and returns either:\n * - The matched color name (as a string)\n * - An object with `name`, `value`, and other nearest match metadata\n *\n * @async\n * @function initializeColorNames\n * @returns A function that maps color strings to the nearest known color\n *\n * @example\n * ```ts\n * const getColorName = await initializeColorNames();\n * const match = getColorName('#ffcc00');\n * console.log(match); // { name: 'gold', value: '#ffd700', distance: 3.2, ... }\n * ```\n */\nconst initializeColorNames = async (): Promise<\n (color: string) => NearestColorColorMatchInterface | string\n> => {\n const response = await fetch('https://color-names.herokuapp.com/v1/');\n const data = await response.json();\n const colors = data.colors;\n const map = {};\n\n colors.forEach((entry: Record<string, unknown>) => {\n map[entry.name as string] = entry.hex;\n });\n\n return nearestColor.from(map);\n};\n\n/**\n * Initializes and returns Moebius utilities with dynamic color naming support.\n *\n * This includes:\n * - A subclass of `MoebiusColor` with nearest color name mapping\n * - `MoebiusPalettes` for generating color palettes\n * - `MoebiusSVGHelper` for generating SVG paths for colored pie slices.\n *\n * @function\n * @async\n * @returns {Promise<MoebiusReturnType>} An object containing Moebius utility classes\n *\n * @example\n * ```ts\n * const moebius = await Moebius();\n * const color = new moebius.MoebiusColor('#abc123');\n * console.log(color.name); // Closest color name, e.g., 'Avocado'\n * ```\n */\nasync function Moebius(): MoebiusReturnType {\n const colorNames = await initializeColorNames();\n\n /**\n * Extended version of `MoebiusColor` that assigns a nearest color name\n * using the initialized color name map.\n */\n class MoebiusColorAbstract extends MoebiusColor {\n constructor(color: MoebiusColorValueHexType) {\n super(\n chroma(color).hex(),\n isString(colorNames(color))\n ? (colorNames(color) as string)\n : (colorNames(color) as NearestColorColorMatchInterface).name\n );\n }\n }\n\n return {\n MoebiusColor: MoebiusColorAbstract as typeof MoebiusColor,\n MoebiusPalettes,\n MoebiusSVGHelper\n };\n}\n\nexport default Moebius;\n","/**\n* @phun-ky/typeof\n* A set of JavaScript helper functions to check for types\n* @author Alexander Vassbotn Røyne-Helgesen <alexander@phun-ky.net>\n* @version 2.1.4\n* @license\n* Copyright (c) 2024 Alexander Vassbotn Røyne-Helgesen\n*\n* Permission is hereby granted, free of charge, to any person obtaining a copy\n* of this software and associated documentation files (the \"Software\"), to deal\n* in the Software without restriction, including without limitation the rights\n* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n* copies of the Software, and to permit persons to whom the Software is\n* furnished to do so, subject to the following conditions:\n*\n* The above copyright notice and this permission notice shall be included in all\n* copies or substantial portions of the Software.\n*\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n* SOFTWARE.\n*/\nfunction t(t){return\"string\"==typeof t}function r(r){return!t(r)}function n(t){return\"number\"==typeof t}function e(t){return!n(t)}function o(t){return\"boolean\"==typeof t}function c(t){return!o(t)}function u(t){return void 0===t}function f(t){return!u(t)}function i(t){return!u(t)}function p(t){if(\"[object Object]\"!==Object.prototype.toString.call(t))return!1;const r=Object.getPrototypeOf(t);return r===Object.prototype||null===r}function y(t){if(\"object\"!=typeof t||null===t)return!1;if(\"[object Object]\"!==Object.prototype.toString.call(t))return!1;const r=Object.getPrototypeOf(t);if(null===r)return!0;const n=Object.prototype.hasOwnProperty.call(r,\"constructor\")?r.constructor:null;return\"function\"==typeof n&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(t)}function l(t){const r=typeof t;return null!==t&&(\"object\"===r||\"function\"===r)}function a(t){if(\"function\"!=typeof t)return!1;if(b(t))return!1;try{const r=Object.getOwnPropertyDescriptor(t,\"prototype\");return!!r&&!r.writable}catch{return!1}}function b(t){if(\"function\"!=typeof t)return!1;return[Object,Array,Function,String,Number,Boolean,Date,RegExp,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,Map,WeakMap,Set,WeakSet,Promise].includes(t)}const O=new Set([Object,Array,Function,String,Number,Boolean,Date,RegExp,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,Map,WeakMap,Set,WeakSet,Promise,BigInt,Symbol]);function j(t){return\"function\"==typeof t&&O.has(t)}function E(t){return\"object\"==typeof t&&null!==t&&Object.getPrototypeOf(t)!==Object.prototype&&null!==Object.getPrototypeOf(t)}function s(t){return\"function\"==typeof t}export{o as isBoolean,j as isBuiltInCallable,b as isBuiltInConstructor,a as isClass,i as isDefined,s as isFunction,E as isInstanceOfUnknownClass,c as isNotBoolean,e as isNotNumber,r as isNotString,f as isNotUndefined,n as isNumber,l as isObjectLoose,p as isObjectPlain,y as isObjectStrict,t as isString,u as isUndefined};\n//# sourceMappingURL=typeof.js.map\n"],"names":["min","max","Math","limit","x","low","high","clip_rgb","rgb","_clipped","_unclipped","slice","i","classToType","name","toLowerCase","type","obj","Object","prototype","toString","call","unpack","args","keyOrder","length","Array","split","filter","k","undefined","map","last","l","PI","rnd2","a","round","rnd3","TWOPI","PITHIRD","DEG2RAD","RAD2DEG","reverse3","arr","reverse","input","format","autodetect","Color","constructor","me","this","mode","_input","sorted","sort","b","p","chk","test","Error","apply","_rgb","push","hex","join","chroma","version","w3cx11","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","laserlemon","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrod","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","maroon2","maroon3","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","purple2","purple3","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","RE_HEX","RE_HEXA","hex2rgb","match","substr","u","parseInt","rgb2hex","r","g","str","hxa","n","keys","named","h","rest","alpha","mutate","clipped","labConstants","Kn","labWhitePoint","Xn","Yn","Zn","kE","kKE","kK","RefWhiteRGB","X","Y","Z","MtxRGB2XYZ","m00","m01","m02","m10","m11","m12","m20","m21","m22","MtxXYZ2RGB","As","Bs","Cs","MtxAdaptMa","MtxAdaptMaI","ILLUMINANTS","Map","setLabWhitePoint","ill","get","String","getLabWhitePoint","lab2rgb","L","y","z","lab2xyz","b_","xyz2rgb","LAB_CONSTANTS","fy","fx","fz","fx3","fz3","pow","compand","linear","sign","abs","Ad","Bd","Cd","X1","Y1","Z1","X2","Y2","Z2","rgb2lab","rgb2xyz","xr","yr","zr","xyz2lab","gammaAdjustSRGB","companded","lab","assign","darken","amount","brighten","darker","brighter","mc","channel","src","indexOf","luminance","lum","cur_lum","max_iter","mid","interpolate","lm","rgb2luminance","luminance_x","index","mix","col1","col2","f","interpolator","premultiply","sin","cos","lch2lab","c","isNaN","lch2rgb","sqrt","atan2","lab2lch","Number","NaN","rgb2lch","lch","hcl","forEach","m","saturate","desaturate","set","value","charAt","out","tint","shade","xyz0","xyz1","lrgb","x1","y1","z1","x2","y2","z2","interpolate_hsx","hue0","hue1","sat0","sat1","lbv0","lbv1","sat","hue","lbv","dh","hsl","hsv","hcg","hsi","oklch","num","rgb2num","c1","c2","floor","minRgb","maxRgb","delta","_g","rgb2hcg","_c","q","t","v","acos","min_","s","rgb2hsi","hsl2rgb","t3","t2","t1","h_","rgb2hsl","max_","rgb2hsv","multiplyMatrices","A","B","isArray","B_cols","_","product","row","col","reduce","oklab2rgb","LMStoXYZ","LMSnl","rgb2oklab","XYZ","LMStoOKLab","LMS","cbrt","XYZ_to_OKLab","oklab","_average_lrgb","colors","weights","xyz","scale","_mode","_nacol","_spread","_positions","_domain","_pos","_padding","_classes","_colors","_out","_min","_max","_correctLightness","_colorCache","_useCache","_gamma","setColors","brewer","resetCache","tMapLightness","tMapDomain","getColor","val","bypassMap","getClass","classes","d","analyze","limits","domain","arguments","from","tOut","tBreaks","every","_m","range","_o","spread","correctLightness","L0","L1","pol","L_actual","L_ideal","L_diff","t0","padding","numColors","result","dm","dd","left","right","ascending","end","__range__","samples","asc","cache","gamma","nodata","rnd","rgba","blend","bottom","top","blend_f","c0","each","normal","multiply","screen","overlay","lighten","dodge","burn","random","log","data","key","MAX_VALUE","sum","values","count","min_log","LOG10E","max_log","pb","pr","cluster","assignments","clusterSizes","repeat","nb_iters","centroids","j","best","mindist","dist","newCentroids","kClusters","tmpKMeansBreaks","B_threshold","exp","scales","cool","hot","colorbrewer","OrRd","PuBu","BuPu","Oranges","BuGn","YlOrBr","YlGn","Reds","RdPu","Greens","YlGnBu","Purples","GnBu","Greys","YlOrRd","PuRd","Blues","PuBuGn","Viridis","Spectral","RdYlGn","RdBu","PiYG","PRGn","RdYlBu","BrBG","RdGy","PuOr","Set2","Accent","Set1","Set3","Dark2","Paired","Pastel2","Pastel1","colorbrewerTypes","typeMap","colorbrewerProxy","Proxy","target","prop","lower","has","getOwnPropertyNames","cmyk","rgb2cmyk","rgb2oklch","rgb2css","hsla","hsl2css","prevWhitePoint","cssColor","laba","lab2css","lcha","lch2css","oklab2css","oklch2css","oklch2rgb","INT_OR_PCT","source","FLOAT_OR_PCT","PCT","RE_S","SEP","COMMA","ANLGE","ALPHA","RE_RGB","RegExp","RE_RGB_LEGACY","RE_RGBA_LEGACY","RE_HSL","RE_HSL_LEGACY","RE_HSLA_LEGACY","RE_LAB","RE_LCH","RE_OKLAB","RE_OKLCH","roundRGB","percentToAbsolute","pct","signed","endsWith","parseFloat","substring","noneToValue","noneValue","css2rgb","css","trim","e","replace","wp","gl","temperature2rgb","kelvin","temp","temperature","minTemp","maxTemp","rgb2temperature","average","w","first","shift","cnt","dx","dy","ci","xyz2","bezier","I","lab0","lab1","lab2","lab3","RangeError","labs","newrow","binom_row","el","contrast","l1","l2","contrastAPCA","text","bg","l_text","l_bg","Y_text","Y_bg","S_norm","S_rev","C","cubehelix","start","rotations","lightness","dl","fract","amp","cos_a","sin_a","deltaE","Kl","Kc","Kh","rad2deg","rad","deg2rad","deg","a1","b1","L2","a2","b2","avgL","avgC","G","a1p","a2p","C1p","C2p","avgCp","arctan1","arctan2","h1p","h2p","avgHp","T","deltaHp","deltaL","deltaCp","sl","sc","sh","deltaTheta","Rt","distance","sum_sq","rng","code","valid","context","nearestColor","needle","parseColor","distanceSq","minDistanceSq","Infinity","DEFAULT_COLORS","mapColors","color","createColorSpec","STANDARD_COLORS","hexMatch","rgbMatch","parseComponentValue","leadingZero","rgbToHex","string","availableColors","nearestColorBase","matcher","or","alternateColors","extendedColors","concat","VERSION","module","exports","UnitHSL","toFixed","UnitHSLFloat","UnitXYZ","UnitCMYK","UnitRGBFloat","UnitHWB","UnitLAB","UnitOKLAB","UnitHSV","UnitLCH","UnitOKLCH","UnitHSI","toFloat","normalizeRGBInput","normalizeLABInput","MoebiusColor","hwb","rgbFloat","hslFloat","CONVERTERS.toHEX","CONVERTERS.toCMYK","CONVERTERS.toXYZ","CONVERTERS.toHSL","CONVERTERS.toHWB","CONVERTERS.toLAB","CONVERTERS.toOKLAB","CONVERTERS.toHSV","CONVERTERS.toLCH","CONVERTERS.toOKLCH","CONVERTERS.toHSI","CONVERTERS.toRGB","CONVERTERS.toFloat","toObject","CONVERTERS.toObject","MOEBIUS_PALETTE_DEFAULT_OPTIONS","diverging","randomOffset","noDuplicates","colorScaleMode","reverseDirection","harmonize","interval","options","h1","uniqueColors","Set","monochromatic","numberOfColors","hslColors","generateLuminanceShiftPalette","lRange","lStep","lStart","colorRange","stop","offset","diff","luminanceShiftAutoColors","divergentColor","ceil","getChromaBezierScaleColors","getChromaScaleColors","MoebiusAccentColors","luminanceShift","complement","triadic","tetradic","pentadic","hexadic","analogous","palette","toArray","flat","MoebiusPaletteColors","MoebiusThemeColors","darkMode","theme","MoebiusPalettes","baseColor","secondaryColor","themes","defaultOptions","all","accents","FEATURES.complement","primaryAccents","surfaceAccents","mixedAccents","primary","surface","mixed","FEATURES.darkMode","FEATURES.split","FEATURES.triadic","FEATURES.tetradic","FEATURES.pentadic","FEATURES.hexadic","FEATURES.analogous","primaryColor","FEATURES.interpolate","divergingColors","even","numberOfColorsLeft","numberOfColorsRight","generatedColors","generatedDivergentColors","stepsLeft","stepsRight","steps","FEATURES.luminanceShift","currentOptions","FEATURES.monochromatic","FEATURES.harmonize","MoebiusSVGHelper","xlmns","getColorPiePaths","size","df","document","createDocumentFragment","defsElement","createElementNS","maskElement","rectElement","gElement","id","setAttributeNS","appendChild","maskDegrees","initial","lineElement","group","inwardInterval","path","radius","centerX","centerY","pieSlice","async","Moebius","colorNames","response","fetch","json","entry","initializeColorNames","super","isString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,UAAQA,EAAGC,IAAEA,GAAQC,KAErB,IAAAC,EAAe,CAACC,EAAGC,EAAM,EAAGC,EAAO,IACxBN,EAAIC,EAAII,EAAKD,GAAIE,GCD5BC,EAAgBC,IACZA,EAAIC,UAAW,EACfD,EAAIE,WAAaF,EAAIG,MAAM,GAC3B,IAAK,IAAIC,EAAI,EAAGA,GAAK,EAAGA,IAChBA,EAAI,IACAJ,EAAII,GAAK,GAAKJ,EAAII,GAAK,OAAKJ,EAAIC,UAAW,GAC/CD,EAAII,GAAKT,EAAMK,EAAII,GAAI,EAAG,MACb,IAANA,IACPJ,EAAII,GAAKT,EAAMK,EAAII,GAAI,EAAG,IAGlC,OAAOJ,GCZX,MAAMK,EAAc,CAAA,EACpB,IAAK,IAAIC,IAAQ,CACb,UACA,SACA,SACA,WACA,QACA,O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4B,KAAKqV,KAAc,GAARyV,IAAe9qB,KAAKgC,GAAK,SACvDm2B,EAAUF,EAASj4B,KAAKoV,KAAc,GAAR0V,IAAe9qB,KAAKgC,GAAK,WAMpCi2B,KAAUA,OAHvBhF,EAAOnI,GAAS,IAAM,IAAM,SAFpCoN,EAAUD,EAASj4B,KAAKqV,KAAa,GAAP4d,IAAcjzB,KAAKgC,GAAK,SACtDm2B,EAAUF,EAASj4B,KAAKoV,KAAa,GAAP6d,IAAcjzB,KAAKgC,GAAK,WAIyBk2B,KAAWC,OHqClEC,CAAStN,EAAOsH,EAAU9jB,IACzDipB,EAASG,YAAYM,OAGzBb,EAAYO,YAAYL,GACxBL,EAAGU,YAAYP,GACfH,EAAGU,YAAYH,GAERP,CACT,EIfFqB,eAAeC,KACb,MAAMC,OAnCqBF,WAG3B,MAAMG,QAAiBC,MAAM,yCAEvBrd,SADaod,EAASE,QACRtd,OACdvZ,EAAM,CAAA,EAMZ,OAJAuZ,EAAOlF,QAASyiB,IACd92B,EAAI82B,EAAM/3B,MAAkB+3B,EAAM50B,MAG7BgqB,GAAaxQ,KAAK1b,IAuBA+2B,GAiBzB,MAAO,CACLlI,aAZF,cAAmCA,GACjC,WAAA1tB,CAAYurB,GACVsK,MACE50B,EAAOsqB,GAAOxqB,MCnDtB,SAAWkV,GAAG,MAAM,iBAAiBA,CAAC,CDoD9B6f,CAASP,EAAWhK,IACfgK,EAAWhK,GACXgK,EAAWhK,GAA2C3tB,KAE/D,GAKA4zB,mBACAoC,oBAEJ","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,156]}
|