import{w as f,g as I}from"./Bj8SChEI.js";const c=f({}),C=f(0),A=()=>({customLabelColorsStore:c,colorVersion:C,getCustomColor:o=>I(c)[o],setCustomColor:(o,a,s=1)=>{c.update(t=>({...t,[o]:{color:a,alpha:s}})),C.update(t=>t+1)},hasCustomColor:o=>!!I(c)[o],deleteCustomColor:o=>{c.update(a=>{const{[o]:s,...t}=a;return t}),C.update(a=>a+1)},clearCustomColors:()=>{c.set({}),C.update(o=>o+1)}}),S=(g,r=1)=>{r=Math.max(0,Math.min(r,1));const{getCustomColor:p,hasCustomColor:h}=A();if(h(g)){const l=p(g);if(l)return((b,$)=>{const i=parseInt(b.slice(1,3),16),M=parseInt(b.slice(3,5),16),x=parseInt(b.slice(5,7),16);return{color:`rgba(${i}, ${M}, ${x}, ${$})`,contrastColor:`rgba(${255-i}, ${255-M}, ${255-x}, ${$})`}})(l.color,l.alpha*r)}const e=["rgba(255, 0, 0, alpha)","rgba(0, 255, 0, alpha)","rgba(0, 0, 255, alpha)","rgba(255, 255, 0, alpha)","rgba(255, 0, 255, alpha)","rgba(0, 255, 255, alpha)","rgba(128, 0, 0, alpha)","rgba(0, 128, 0, alpha)","rgba(0, 0, 128, alpha)","rgba(128, 128, 0, alpha)","rgba(128, 0, 128, alpha)","rgba(0, 128, 128, alpha)","rgba(192, 192, 192, alpha)","rgba(128, 128, 128, alpha)","rgba(255, 165, 0, alpha)","rgba(255, 20, 147, alpha)","rgba(75, 0, 130, alpha)","rgba(255, 105, 180, alpha)","rgba(0, 255, 127, alpha)","rgba(255, 215, 0, alpha)","rgba(255, 69, 0, alpha)"];let o;const a=e.length-1;if(o=Array.from(g).reduce((l,d)=>(l<<5)-l+d.charCodeAt(0),0),o=Math.abs(o)%a+1,o>=1&&o<=a)return{color:e[o-1].replace("alpha",r.toString()),contrastColor:`rgba(${255-Math.round(parseInt(e[o-1].split(",")[0].split("(")[1])*(r/255))}, ${255-Math.round(parseInt(e[o-1].split(",")[1]))}, ${255-Math.round(parseInt(e[o-1].split(",")[2]))}, ${r})`};const s=(o*30+20)%256,t=(o*60+100)%256,u=(o*90+150)%256,m=Math.max(s,t,u),L=Math.min(s,t,u);if(m-L===0)return{color:`rgba(255, 255, 255, ${r})`,contrastColor:`rgba(0, 0, 0, ${r})`};const n=255/m,w=`rgba(${Math.round(s*n)}, ${Math.round(t*n)}, ${Math.round(u*n)}, ${r})`,y=`rgba(${255-Math.round(s*n)}, ${255-Math.round(t*n)}, ${255-Math.round(u*n)}, ${r})`;return{color:w,contrastColor:y}};export{S as g,A as u};
