function g(t){let e=t.match(/(\{[a-zA-Z0-9]{6}\}|\{[a-zA-Z0-9]{8}\})/g);if(e)for(let r of e){let s=r.replace("{","").replace("}","");t=t.split(r).join(`<span style="color: #${s}">`)}return t}function p(t){const e=Array.isArray(t);let r=e?t:[t],s="";return r=r.map(n=>{let o=n.match(/(\{[a-zA-Z0-9]{6}\}|\{[a-zA-Z0-9]{8}\})/g);const c=[];if(o)for(let a=0;a<=o.length;a++){let l=o[a]?o[a].replace("{","").replace("}",""):"";const u=o[a]?o[a].length:0,i=o[a]?n.indexOf(o[a]):n.length,h=n.substring(0,i);n=n.substring(i+u),c.push({color:s,text:h}),l.length&&(s=l)}else c.push({color:s,text:n});return c}),e?r:r[0]}function f(t){const e=t.replace("#",""),r=parseInt(e.substring(0,0+2),16),s=parseInt(e.substring(2,2+2),16),n=parseInt(e.substring(4,4+2),16);return(r*299+s*587+n*114)/1e3>155}function d(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(s,n,o,c){return n+n+o+o+c+c});var r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function b(t,e=1){const r=t.replace("#","");let s,n,o;return r.length===3?(s=parseInt(r[0]+r[0],16),n=parseInt(r[1]+r[1],16),o=parseInt(r[2]+r[2],16)):(s=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),o=parseInt(r.substring(4,6),16)),`rgba(${s}, ${n}, ${o}, ${e})`}function I(){const t=(r,s)=>Math.random()*(s-r)+r,e=[`hue-rotate(${Math.round(t(0,360))}deg)`,`saturate(${t(.6,2.5).toFixed(2)})`,`brightness(${t(.7,1.6).toFixed(2)})`,`contrast(${t(.7,1.6).toFixed(2)})`];return Math.random()<.3&&e.push(`sepia(${t(.1,1).toFixed(2)})`),Math.random()<.3&&e.push(`grayscale(${t(.1,1).toFixed(2)})`),Math.random()<.2&&e.push(`invert(${t(.05,1).toFixed(2)})`),e.join(" ")}function $(t){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t)}export{d as a,f as c,g as e,I as g,b as h,p as s,$ as v};
