"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=function(r){return r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)},t=function(r){return r.toString(16).padStart(2,"0")};exports.channelsToHex=function(r,a){var e=r.r,n=r.g,c=r.b,o=r.a;return a?"#".concat(t(e)).concat(t(n)).concat(t(c)).concat(t(Math.round(255*o))):"#".concat(t(e)).concat(t(n)).concat(t(c))},exports.channelsToRgba=function(r,t){var a=r.r,e=r.g,n=r.b,c=r.a;return t?"rgba(".concat(a,", ").concat(e,", ").concat(n,", ").concat(Math.round(100*c)/100,")"):"rgb(".concat(a,", ").concat(e,", ").concat(n,")")},exports.defaultColor="#03BCD4",exports.getLuminance=function(t){var a=t.replace("#",""),e=parseInt(a.slice(0,2),16)/255,n=parseInt(a.slice(2,4),16)/255,c=parseInt(a.slice(4,6),16)/255;return.2126*r(e)+.7152*r(n)+.0722*r(c)},exports.parseColor=function(r){var t,a=r.replace(/\s+/gi,""),e=null===(t=a.match(/^#([0-9a-f]{3,8})$/i))||void 0===t?void 0:t[1];if(e){var n=e.length;if(3===n||4===n)return{r:parseInt(e[0].repeat(2),16),g:parseInt(e[1].repeat(2),16),b:parseInt(e[2].repeat(2),16),a:4===n?parseInt(e[3].repeat(2),16)/255:1};if(6===n||8===n)return{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16),a:8===n?parseInt(e.slice(6,8),16)/255:1}}var c=a.match(/^rgba?\((\d+),(\d+),(\d+)(?:,([\d.]+))?\)$/i);if(c)return{r:parseInt(c[1],10),g:parseInt(c[2],10),b:parseInt(c[3],10),a:void 0!==c[4]?parseFloat(c[4]):1};throw new Error("Unsupported color format: ".concat(a))};
//# sourceMappingURL=utils.js.map
