"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./util.js");function g(t,a,r){return{r:u.bound01(t,255)*255,g:u.bound01(a,255)*255,b:u.bound01(r,255)*255}}function m(t,a,r){t=u.bound01(t,255),a=u.bound01(a,255),r=u.bound01(r,255);var e=Math.max(t,a,r),o=Math.min(t,a,r),n=0,c=0,i=(e+o)/2;if(e===o)c=0,n=0;else{var h=e-o;switch(c=i>.5?h/(2-e-o):h/(e+o),e){case t:n=(a-r)/h+(a<r?6:0);break;case a:n=(r-t)/h+2;break;case r:n=(t-a)/h+4;break}n/=6}return{h:n,s:c,l:i}}function b(t,a,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(a-t)*(6*r):r<1/2?a:r<2/3?t+(a-t)*(2/3-r)*6:t}function x(t,a,r){var e,o,n;if(t=u.bound01(t,360),a=u.bound01(a,100),r=u.bound01(r,100),a===0)o=r,n=r,e=r;else{var c=r<.5?r*(1+a):r+a-r*a,i=2*r-c;e=b(i,c,t+1/3),o=b(i,c,t),n=b(i,c,t-1/3)}return{r:e*255,g:o*255,b:n*255}}function A(t,a,r){t=u.bound01(t,255),a=u.bound01(a,255),r=u.bound01(r,255);var e=Math.max(t,a,r),o=Math.min(t,a,r),n=0,c=e,i=e-o,h=e===0?0:i/e;if(e===o)n=0;else{switch(e){case t:n=(a-r)/i+(a<r?6:0);break;case a:n=(r-t)/i+2;break;case r:n=(t-a)/i+4;break}n/=6}return{h:n,s:h,v:c}}function H(t,a,r){t=u.bound01(t,360)*6,a=u.bound01(a,100),r=u.bound01(r,100);var e=Math.floor(t),o=t-e,n=r*(1-a),c=r*(1-o*a),i=r*(1-(1-o)*a),h=e%6,f=[r,c,n,n,i,r][h],v=[i,r,r,c,n,n][h],T=[n,n,i,r,r,c][h];return{r:f*255,g:v*255,b:T*255}}function M(t,a,r,e){var o=[u.pad2(Math.round(t).toString(16)),u.pad2(Math.round(a).toString(16)),u.pad2(Math.round(r).toString(16))];return e&&o[0].startsWith(o[0].charAt(1))&&o[1].startsWith(o[1].charAt(1))&&o[2].startsWith(o[2].charAt(1))?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function p(t,a,r,e,o){var n=[u.pad2(Math.round(t).toString(16)),u.pad2(Math.round(a).toString(16)),u.pad2(Math.round(r).toString(16)),u.pad2(s(e))];return o&&n[0].startsWith(n[0].charAt(1))&&n[1].startsWith(n[1].charAt(1))&&n[2].startsWith(n[2].charAt(1))&&n[3].startsWith(n[3].charAt(1))?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)+n[3].charAt(0):n.join("")}function s(t){return Math.round(parseFloat(t)*255).toString(16)}function S(t){return d(t)/255}function d(t){return parseInt(t,16)}function l(t){return{r:t>>16,g:(t&65280)>>8,b:t&255}}exports.convertDecimalToHex=s;exports.convertHexToDecimal=S;exports.hslToRgb=x;exports.hsvToRgb=H;exports.numberInputToObject=l;exports.parseIntFromHex=d;exports.rgbToHex=M;exports.rgbToHsl=m;exports.rgbToHsv=A;exports.rgbToRgb=g;exports.rgbaToHex=p;
