import n from"../../../utils/esm/formatMuiErrorMessage.js";function t(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return"production"!==process.env.NODE_ENV&&(n<t||n>r)&&console.error("Material-UI: The value provided ".concat(n," is out of range [").concat(t,", ").concat(r,"].")),Math.min(Math.max(t,n),r)}function r(n){n=n.substr(1);var t=new RegExp(".{1,".concat(n.length>=6?2:1,"}"),"g"),r=n.match(t);return r&&1===r[0].length&&(r=r.map((function(n){return n+n}))),r?"rgb".concat(4===r.length?"a":"","(").concat(r.map((function(n,t){return t<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3})).join(", "),")"):""}function e(n){var t=(n=a(n)).values,r=t[0],e=t[1]/100,u=t[2]/100,i=e*Math.min(u,1-u),s=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(n+r/30)%12;return u-i*Math.max(Math.min(t-3,9-t,1),-1)},c="rgb",l=[Math.round(255*s(0)),Math.round(255*s(8)),Math.round(255*s(4))];return"hsla"===n.type&&(c+="a",l.push(t[3])),o({type:c,values:l})}function a(t){if(t.type)return t;if("#"===t.charAt(0))return a(r(t));var e=t.indexOf("("),o=t.substring(0,e);if(-1===["rgb","rgba","hsl","hsla"].indexOf(o))throw new Error("production"!==process.env.NODE_ENV?"Material-UI: Unsupported `".concat(t,"` color.\nWe support the following formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()."):n(3,t));var u=t.substring(e+1,t.length-1).split(",");return{type:o,values:u=u.map((function(n){return parseFloat(n)}))}}function o(n){var t=n.type,r=n.values;return-1!==t.indexOf("rgb")?r=r.map((function(n,t){return t<3?parseInt(n,10):n})):-1!==t.indexOf("hsl")&&(r[1]="".concat(r[1],"%"),r[2]="".concat(r[2],"%")),"".concat(t,"(").concat(r.join(", "),")")}function u(n,t){var r=i(n),e=i(t);return(Math.max(r,e)+.05)/(Math.min(r,e)+.05)}function i(n){var t="hsl"===(n=a(n)).type?a(e(n)).values:n.values;return t=t.map((function(n){return(n/=255)<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)})),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function s(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.15;return i(n)>.5?l(n,t):f(n,t)}function c(n,r){return n=a(n),r=t(r),"rgb"!==n.type&&"hsl"!==n.type||(n.type+="a"),n.values[3]=r,o(n)}function l(n,r){if(n=a(n),r=t(r),-1!==n.type.indexOf("hsl"))n.values[2]*=1-r;else if(-1!==n.type.indexOf("rgb"))for(var e=0;e<3;e+=1)n.values[e]*=1-r;return o(n)}function f(n,r){if(n=a(n),r=t(r),-1!==n.type.indexOf("hsl"))n.values[2]+=(100-n.values[2])*r;else if(-1!==n.type.indexOf("rgb"))for(var e=0;e<3;e+=1)n.values[e]+=(255-n.values[e])*r;return o(n)}export{l as darken,a as decomposeColor,s as emphasize,c as fade,u as getContrastRatio,i as getLuminance,r as hexToRgb,e as hslToRgb,f as lighten,o as recomposeColor};
//# sourceMappingURL=colorManipulator.js.map
