import{Q as f,R as g}from"./OdysseyThemeProvider-Bh0Bu-2o.js";function r(e,n=0,s=1){return g(e,n,s)}function h(e){e=e.slice(1);const n=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let s=e.match(n);return s&&s[0].length===1&&(s=s.map(t=>t+t)),s?`rgb${s.length===4?"a":""}(${s.map((t,a)=>a<3?parseInt(t,16):Math.round(parseInt(t,16)/255*1e3)/1e3).join(", ")})`:""}function i(e){if(e.type)return e;if(e.charAt(0)==="#")return i(h(e));const n=e.indexOf("("),s=e.substring(0,n);if(["rgb","rgba","hsl","hsla","color"].indexOf(s)===-1)throw new Error(f(9,e));let t=e.substring(n+1,e.length-1),a;if(s==="color"){if(t=t.split(" "),a=t.shift(),t.length===4&&t[3].charAt(0)==="/"&&(t[3]=t[3].slice(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(a)===-1)throw new Error(f(10,a))}else t=t.split(",");return t=t.map(p=>parseFloat(p)),{type:s,values:t,colorSpace:a}}function u(e){const{type:n,colorSpace:s}=e;let{values:t}=e;return n.indexOf("rgb")!==-1?t=t.map((a,p)=>p<3?parseInt(a,10):a):n.indexOf("hsl")!==-1&&(t[1]=`${t[1]}%`,t[2]=`${t[2]}%`),n.indexOf("color")!==-1?t=`${s} ${t.join(" ")}`:t=`${t.join(", ")}`,`${n}(${t})`}function d(e,n){return e=i(e),n=r(n),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${n}`:e.values[3]=n,u(e)}function x(e,n){if(e=i(e),n=r(n),e.type.indexOf("hsl")!==-1)e.values[2]*=1-n;else if(e.type.indexOf("rgb")!==-1||e.type.indexOf("color")!==-1)for(let s=0;s<3;s+=1)e.values[s]*=1-n;return u(e)}function y(e,n){if(e=i(e),n=r(n),e.type.indexOf("hsl")!==-1)e.values[2]+=(100-e.values[2])*n;else if(e.type.indexOf("rgb")!==-1)for(let s=0;s<3;s+=1)e.values[s]+=(255-e.values[s])*n;else if(e.type.indexOf("color")!==-1)for(let s=0;s<3;s+=1)e.values[s]+=(1-e.values[s])*n;return u(e)}export{d as a,x as d,y as l};
