'use strict';var chunkBLKDDW2U_cjs=require('../chunk-BLKDDW2U.cjs');require('../chunk-3V4MONNR.cjs');var chunkYISEJCI6_cjs=require('../chunk-YISEJCI6.cjs');var c=o=>{let r=chunkYISEJCI6_cjs.a(o.w,0,1/0),t=chunkYISEJCI6_cjs.a(o.b,0,1/0),n=r+t;return {h:chunkYISEJCI6_cjs.c(o.h),w:n>100?r/n*100:r,b:n>100?t/n*100:t,alpha:chunkYISEJCI6_cjs.a(chunkYISEJCI6_cjs.b(o.alpha,3),0,1)}},R=o=>{let{h:r}=chunkBLKDDW2U_cjs.a(o);return c({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})},$=({h:o,w:r,b:t,alpha:n})=>{let e=t===100?0:100-r/(100-t)*100;return chunkBLKDDW2U_cjs.b({h:o,s:e,v:100-t,alpha:n})},m=o=>{if(!chunkYISEJCI6_cjs.h(o)||!chunkYISEJCI6_cjs.i(o,["h","w","b"]))return null;let{h:r,w:t,b:n,alpha:e=1}=o;return !chunkYISEJCI6_cjs.f(r)||!chunkYISEJCI6_cjs.f(t)||!chunkYISEJCI6_cjs.f(n)||!chunkYISEJCI6_cjs.f(e)?null:$(c({h:chunkYISEJCI6_cjs.g(r),w:chunkYISEJCI6_cjs.g(t),b:chunkYISEJCI6_cjs.g(n),alpha:chunkYISEJCI6_cjs.g(e)}))},N=new RegExp(`^hwb\\(\\s*(?<h>${chunkYISEJCI6_cjs.k})(?<hu>deg|rad|grad|turn)?\\s+(?<w>${chunkYISEJCI6_cjs.k})(?<wp>%?)\\s+(?<b>${chunkYISEJCI6_cjs.k})(?<bp>%?)\\s*(?:/\\s*(?<al>${chunkYISEJCI6_cjs.k})(?<alp>%?)\\s*)?\\)$`,"i"),H=o=>{if(typeof o!="string")return null;let r=N.exec(o.trim())?.groups;if(!r)return null;let t=r.hu?.toLowerCase()??"deg",n=chunkYISEJCI6_cjs.l(r.h)*(chunkYISEJCI6_cjs.d[t]??1),e=chunkYISEJCI6_cjs.l(r.w),l=chunkYISEJCI6_cjs.l(r.b),b=r.al===void 0?1:chunkYISEJCI6_cjs.l(r.al)/(r.alp?100:1);return $(c({h:n,w:e,b:l,alpha:b}))};var j=(o,r,t)=>{o.prototype.toHwb=function(n=0){let{h:e,w:l,b,alpha:h}=R(this._rawRgb());return {h:chunkYISEJCI6_cjs.b(e,n),w:chunkYISEJCI6_cjs.b(l,n),b:chunkYISEJCI6_cjs.b(b,n),alpha:chunkYISEJCI6_cjs.b(h,3)}},o.prototype.toHwbString=function(n=0){let{h:e,w:l,b,alpha:h}=this.toHwb(n);return h<1?`hwb(${e} ${l}% ${b}% / ${h})`:`hwb(${e} ${l}% ${b}%)`},r.push(H,m),t.push([H,"hwb"],[m,"hwb"]);},E=j;module.exports=E;//# sourceMappingURL=hwb.cjs.map
//# sourceMappingURL=hwb.cjs.map