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