'use strict';var chunkKP3R2XXN_cjs=require('../chunk-KP3R2XXN.cjs');require('../chunk-GYCEEHZT.cjs');var chunkEXPXWBLP_cjs=require('../chunk-EXPXWBLP.cjs');var i=o=>{let r=chunkEXPXWBLP_cjs.a(o.w,0,1/0),t=chunkEXPXWBLP_cjs.a(o.b,0,1/0),n=r+t;return {h:chunkEXPXWBLP_cjs.c(o.h),w:n>100?r/n*100:r,b:n>100?t/n*100:t,alpha:chunkEXPXWBLP_cjs.a(chunkEXPXWBLP_cjs.b(o.alpha,3),0,1)}};var x=o=>{let{h:r}=chunkKP3R2XXN_cjs.a(o);return i({h:r,w:Math.min(o.r,o.g,o.b)/255*100,b:100-Math.max(o.r,o.g,o.b)/255*100,alpha:o.alpha})},y=({h:o,w:r,b:t,alpha:n})=>{let e=t===100?0:100-r/(100-t)*100;return chunkKP3R2XXN_cjs.c({h:o,s:e,v:100-t,alpha:n})},h=o=>{if(!chunkEXPXWBLP_cjs.h(o)||!chunkEXPXWBLP_cjs.i(o,["h","w","b"]))return null;let{h:r,w:t,b:n,alpha:e=1}=o;return !chunkEXPXWBLP_cjs.f(r)||!chunkEXPXWBLP_cjs.f(t)||!chunkEXPXWBLP_cjs.f(n)||!chunkEXPXWBLP_cjs.f(e)?null:y(i({h:chunkEXPXWBLP_cjs.g(r),w:chunkEXPXWBLP_cjs.g(t),b:chunkEXPXWBLP_cjs.g(n),alpha:chunkEXPXWBLP_cjs.g(e)}))},R=/^hwb\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,c=o=>{if(typeof o!="string")return null;let r=R.exec(o.trim());if(!r)return null;let t=r[2]?.toLowerCase()??"deg",n=Number(r[1])*(chunkEXPXWBLP_cjs.d[t]??1),e=r[5]===void 0?1:Number(r[5])/(r[6]?100:1);return y(i({h:n,w:Number(r[3]),b:Number(r[4]),alpha:e}))};var $=(o,r,t)=>{o.prototype.toHwb=function(n=0){let{h:e,w,b:a,alpha:u}=x(this._rawRgb());return {h:chunkEXPXWBLP_cjs.b(e,n),w:chunkEXPXWBLP_cjs.b(w,n),b:chunkEXPXWBLP_cjs.b(a,n),alpha:chunkEXPXWBLP_cjs.b(u,3)}},o.prototype.toHwbString=function(n=0){let{h:e,w,b:a,alpha:u}=this.toHwb(n);return u<1?`hwb(${e} ${w}% ${a}% / ${u})`:`hwb(${e} ${w}% ${a}%)`},r.push(c,h),t.push([c,"hwb"],[h,"hwb"]);},v=$;module.exports=v;//# sourceMappingURL=hwb.cjs.map
//# sourceMappingURL=hwb.cjs.map