import{colord as r,extend as t}from"../../../../colord/index.mjs";import n from"../../../../../_virtual/index19.mjs";import i from"../../../../colord/plugins/names.mjs";import l from"../../../../colord/plugins/hwb.mjs";import s from"../../../../colord/plugins/lab.mjs";import o from"../../../../colord/plugins/lch.mjs";t([i,l,s,o,(r,t)=>{t.string.push([e,"hwb-with-comma"])},(r,t)=>{t.string.push([m,"gray"])}]);const u=r;function e(r){if(!(r=r.toLowerCase()).startsWith("hwb(")||!r.endsWith(")")||r.includes("/"))return null;const[t,n="",i="",l,...s]=r.slice(4,-1).split(",");if(!t||!t.trim()||!n.trim()||!i.trim()||s.length>0)return null;const o=u(`hwb(${t} ${n} ${i}${l?` / ${l}`:""})`);return o.isValid()?o.rgba:null}function m(r){if(!(r=r.toLowerCase()).startsWith("gray(")||!r.endsWith(")"))return null;const[t,i,...l]=r.slice(5,-1).split(",");if(!t||l.length>0)return null;const s=n.unit(t.trim());if(!s||!["","%"].includes(s.unit))return null;let o={l:Number(s.number),a:0,b:0};if(i){const r=n.unit(i.trim());if(!r||!["","%"].includes(r.unit))return null;o={...o,alpha:Number(r.number)/(r.unit?100:1)}}return u(o).rgba}export{u as colord};