import{c as E}from"./color.87d313dc.js";import{b as S}from"./balanced-match.d2a36341.js";import{r as N}from"./ms.564e106c.js";var k={},y={exports:{}};function _(t){r.debug=r,r.default=r,r.coerce=s,r.disable=i,r.enable=C,r.enabled=a,r.humanize=N(),Object.keys(t).forEach(function(o){r[o]=t[o]}),r.instances=[],r.names=[],r.skips=[],r.formatters={};function u(o){for(var e=0,n=0;n"u"?":":e)+o)}function C(o){r.save(o),r.names=[],r.skips=[];var e,n=(typeof o=="string"?o:"").split(/[\s,]+/),f=n.length;for(e=0;e=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function v(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!!this.useColors){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var f=0,c=0;e[0].replace(/%[a-zA-Z%]/g,function(d){d!=="%%"&&(f++,d==="%c"&&(c=f))}),e.splice(c,0,n)}}function C(){var e;return(typeof console>"u"?"undefined":r(console))==="object"&&console.log&&(e=console).log.apply(e,arguments)}function i(e){try{e?u.storage.setItem("debug",e):u.storage.removeItem("debug")}catch{}}function a(){var e;try{e=u.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e={}.DEBUG),e}function s(){try{return localStorage}catch{}}t.exports=B(u);var o=t.exports.formatters;o.j=function(e){try{return JSON.stringify(e)}catch(n){return"[UnexpectedJSONParseError]: "+n.message}}})(y,y.exports);var D=S,m=y.exports("css-color-function:parse"),M=L;function L(t){typeof t!="string"&&(t=t.toString()),m("string %s",t);function u(e){var n=e.exec(t);if(!!n)return t=t.slice(n[0].length),n.slice(1)}function r(){u(/^\s+/)}function l(){var e=u(/^\)/);if(!!e)return m("rparen"),e}function v(){var e=u(/^([\+\-\*])/);if(!!e){var n={};return n.type="modifier",n.value=e[0],m("modifier %o",n),n}}function C(){var e=u(/^([^\)\s]+)/);if(!!e){var n={};return n.type="number",n.value=e[0],m("number %o",n),n}}function i(){for(var e=[],n;n=v()||o()||C();)e.push(n),r();return m("args %o",e),e}function a(){var e=u(/^(\w+)\(/);if(!!e){r();var n={};return n.type="function",n.name=e[0],n.arguments=i(),l(),m("adjuster %o",n),n}}function s(){var e={};e.type="color";var n=u(/([^\)\s]+)/)[0];if(n.indexOf("(")!=-1){var f=u(/([^\)]*?\))/)[0];n=n+f}return e.value=n,r(),e}function o(){if(!!t.match(/^color\(/)){var e=D("(",")",t);if(!e)throw new SyntaxError("Missing closing parenthese for '"+t+"'");if(e.body==="")throw new SyntaxError("color() function cannot be empty");t=e.body,r();var n={};n.type="function",n.name="color",n.arguments=[o()||s()],m("function arguments %o",n.arguments);for(var f;f=a();)n.arguments.push(f),r();return t=e.post,r(),m("function %o",n),n}}return o()}var O={};(function(t){var u=E;t.red=r("red"),t.blue=r("blue"),t.green=r("green"),t.alpha=t.a=r("alpha"),t.rgb=function(){},t.hue=t.h=l("hue"),t.saturation=t.s=l("saturation"),t.lightness=t.l=l("lightness"),t.whiteness=t.w=l("whiteness"),t.blackness=t.b=l("blackness"),t.blend=function(i,a){var s=i.alpha();i.alpha(1);var o=new u(a[0].value),e=1-parseInt(a[1].value,10)/100;i.mix(o,e).alpha(s)},t.tint=function(i,a){a.unshift({type:"argument",value:"white"}),t.blend(i,a)},t.shade=function(i,a){a.unshift({type:"argument",value:"black"}),t.blend(i,a)},t.contrast=function(i,a){a.length==0&&a.push({type:"argument",value:"100%"});var s=1-parseInt(a[0].value,10)/100,o=i.luminosity()<.5?new u({h:i.hue(),w:100,b:0}):new u({h:i.hue(),w:0,b:100}),e=o,n=4.5;if(i.contrast(o)>n){var e=C(n,i,o),f=e.alpha();e.alpha(1),e.mix(o,s).alpha(f)}i.hwb(e.hwb())};function r(i){return function(a,s){var o;s[0].type=="modifier"&&(o=s.shift().value);var e=s[0].value;e.indexOf("%")!=-1?(e=parseInt(e,10)/100,o?o!="*"&&(e=a[i]()*e):e=e*(i=="alpha"?1:255)):e=Number(e),a[i](v(a[i](),e,o))}}function l(i){return function(a,s){var o;s[0].type=="modifier"&&(o=s.shift().value);var e=parseFloat(s[0].value,10);a[i](v(a[i](),e,o))}}function v(i,a,s){switch(s){case"+":return i+a;case"-":return i-a;case"*":return i*a;default:return a}}function C(i,a,s){a.hue();for(var o=a.clone(),e=a.whiteness(),n=a.blackness(),f=s.whiteness(),c=s.blackness();Math.abs(e-f)>1||Math.abs(n-c)>1;){var d=Math.round((f+e)/2),h=Math.round((c+n)/2);o.whiteness(d),o.blackness(h),o.contrast(a)>i?(f=d,c=h):(e=d,n=h)}return o}})(O);var U=S,G=E,J=M,A=O,W=$;function $(t){var u=t.indexOf("color(");if(u==-1)return t;if(t=t.slice(u),t=U("(",")",t),!t)throw new SyntaxError("Missing closing parenthese for '"+t+"'");var r=J("color("+t.body+")");return w(r)+$(t.post)}function w(t){var u=new G(t.arguments[0].type=="function"?w(t.arguments[0]):t.arguments[0].value),r=t.arguments.slice(1);return r.forEach(function(l){var v=l.name;if(!A[v])throw new Error("Unknown '"+v+"'");l.arguments.forEach(function(C){C.type=="function"&&C.name=="color"&&(C.value=w(C),C.type="color",delete C.name)}),A[v](u,l.arguments)}),u.rgbString()}var Z=W,q=M;k.convert=Z;k.parse=q;export{k as l};