Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asamuzakjp/css-color

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asamuzakjp/css-color - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

4

dist/cjs/index.js

@@ -1,2 +0,2 @@

var T=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var b=(t,x)=>{for(var n in x)T(t,n,{get:x[n],enumerable:!0})},p=(t,x,n,y)=>{if(x&&typeof x=="object"||typeof x=="function")for(let l of N(x))!z.call(t,l)&&l!==n&&T(t,l,{get:()=>x[l],enumerable:!(y=h(x,l))||y.enumerable});return t};var g=t=>p(T({},"__esModule",{value:!0}),t);var u={};b(u,{convert:()=>X,parse:()=>m,resolve:()=>$});module.exports=g(u);var e=require("./js/color.js"),f=require("./js/common.js");/*!
var f=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var z=(t,x)=>{for(var a in x)f(t,a,{get:x[a],enumerable:!0})},p=(t,x,a,T)=>{if(x&&typeof x=="object"||typeof x=="function")for(let l of h(x))!N.call(t,l)&&l!==a&&f(t,l,{get:()=>x[l],enumerable:!(T=b(x,l))||T.enumerable});return t};var g=t=>p(f({},"__esModule",{value:!0}),t);var H={};z(H,{convert:()=>u,parse:()=>$,resolve:()=>m});module.exports=g(H);var e=require("./js/color.js"),y=require("./js/common.js");/*!
* CSS color - Resolve, parse, convert CSS color.

@@ -6,3 +6,3 @@ * @license MIT

* @see {@link https://github.com/asamuzaK/cssColor/blob/main/LICENSE}
*/const $=(t,x={})=>{if((0,f.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,f.getType)(t)}.`);const{currentColor:n,format:y,key:l}=x;let r,s,o,a;/^currentcolor$/i.test(t)?n?n.startsWith("color-mix")?[r,s,o,a]=(0,e.resolveColorMix)(n):n.startsWith("color(")?[r,s,o,a]=(0,e.resolveColorFunc)(n):[r,s,o,a]=(0,e.resolveColorValue)(n):(r=0,s=0,o=0,a=0):/^transparent$/i.test(t)?(r=0,s=0,o=0,a=0):t.startsWith("color-mix")?[r,s,o,a]=(0,e.resolveColorMix)(t):t.startsWith("color(")?[r,s,o,a]=(0,e.resolveColorFunc)(t):[r,s,o,a]=(0,e.resolveColorValue)(t);let c;switch(y){case"array":{l?c=[l,[r,s,o,a]]:c=[r,s,o,a];break}case"hex":{let i;/^transparent$/i.test(t)||isNaN(r)||isNaN(s)||isNaN(o)?i=null:i=(0,e.convertRgbToHex)([r,s,o]),l?c=[l,i]:c=i;break}case"hexAlpha":{let i;/^transparent$/i.test(t)?i="#00000000":isNaN(r)||isNaN(s)||isNaN(o)||isNaN(a)?i=null:i=(0,e.convertRgbToHex)([r,s,o,a]),l?c=[l,i]:c=i;break}default:{let i;isNaN(r)||isNaN(s)||isNaN(o)||isNaN(a)?i="":(r=Math.round(r),s=Math.round(s),o=Math.round(o),a===1?i=`rgb(${r}, ${s}, ${o})`:i=`rgba(${r}, ${s}, ${o}, ${a})`),l?c=[l,i]:c=i}}return c},m=(t,x={})=>{if((0,f.isString)(t)){if(t=t.trim(),t.startsWith("color-mix("))throw new Error("color-mix() is not supported.")}else throw new TypeError(`Expected String but got ${(0,f.getType)(t)}.`);const{d50:n}=x;let y;return t.startsWith("color(")?y=(0,e.parseColorFunc)(t,n):y=(0,e.parseColorValue)(t,n),y},X={rgbToHex:e.convertRgbToHex,xyzD50ToLab:e.convertXyzD50ToLab,xyzD50ToLch:e.convertXyzD50ToLch,xyzToHex:e.convertXyzToHex,xyzToHsl:e.convertXyzToHsl,xyzToHwb:e.convertXyzToHwb,xyzToOklab:e.convertXyzToOklab,xyzToOklch:e.convertXyzToOklch,xyzToRgb:e.convertXyzToRgb,xyzToXyzD50:e.convertXyzToXyzD50};0&&(module.exports={convert,parse,resolve});
*/const m=(t,x={})=>{if((0,y.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,y.getType)(t)}.`);const{currentColor:a,format:T,key:l}=x;let r,s,o,n;/^currentcolor$/i.test(t)?a?a.startsWith("color-mix")?[r,s,o,n]=(0,e.resolveColorMix)(a):a.startsWith("color(")?[r,s,o,n]=(0,e.resolveColorFunc)(a):[r,s,o,n]=(0,e.resolveColorValue)(a):(r=0,s=0,o=0,n=0):/^transparent$/i.test(t)?(r=0,s=0,o=0,n=0):t.startsWith("color-mix")?[r,s,o,n]=(0,e.resolveColorMix)(t):t.startsWith("color(")?[r,s,o,n]=(0,e.resolveColorFunc)(t):[r,s,o,n]=(0,e.resolveColorValue)(t);let c;switch(T){case"array":{l?c=[l,[r,s,o,n]]:c=[r,s,o,n];break}case"hex":{let i;/^transparent$/i.test(t)||isNaN(r)||isNaN(s)||isNaN(o)?i=null:i=(0,e.convertRgbToHex)([r,s,o]),l?c=[l,i]:c=i;break}case"hexAlpha":{let i;/^transparent$/i.test(t)?i="#00000000":isNaN(r)||isNaN(s)||isNaN(o)||isNaN(n)?i=null:i=(0,e.convertRgbToHex)([r,s,o,n]),l?c=[l,i]:c=i;break}default:{let i;isNaN(r)||isNaN(s)||isNaN(o)||isNaN(n)?i="":(r=Math.round(r),s=Math.round(s),o=Math.round(o),n===1?i=`rgb(${r}, ${s}, ${o})`:i=`rgba(${r}, ${s}, ${o}, ${n})`),l?c=[l,i]:c=i}}return c},$=(t,x={})=>{if((0,y.isString)(t)){if(t=t.trim(),t.startsWith("color-mix("))throw new Error("color-mix() is not supported.")}else throw new TypeError(`Expected String but got ${(0,y.getType)(t)}.`);const{d50:a}=x;let T;return t.startsWith("color(")?T=(0,e.parseColorFunc)(t,a):T=(0,e.parseColorValue)(t,a),T},u={hexToRgb:e.convertHexToRgb,numberToHex:e.numberToHexString,rgbToHex:e.convertRgbToHex,xyzD50ToLab:e.convertXyzD50ToLab,xyzD50ToLch:e.convertXyzD50ToLch,xyzToHex:e.convertXyzToHex,xyzToHsl:e.convertXyzToHsl,xyzToHwb:e.convertXyzToHwb,xyzToOklab:e.convertXyzToOklab,xyzToOklch:e.convertXyzToOklch,xyzToRgb:e.convertXyzToRgb,xyzToXyzD50:e.convertXyzToXyzD50};0&&(module.exports={convert,parse,resolve});
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

var L=t=>Object.prototype.toString.call(t).slice(8,-1),Y=t=>typeof t=="string"||t instanceof String;var et=.5,$t=2,ot=3,K=4,Yt=10,G=16,q=360,rt=60,R=100,M=255,Tt=2,yt=3,bt=2.4,Ft=12.92,v=.055,mt=116,Vt=500,Zt=200,ut=216/24389,Mt=24389/27,Ut=[.3457/.3585,1,(1-.3457-.3585)/.3585],wt=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],tt=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],Ot=[[506752/1228815,87881/245763,12673/70218],[87098/409605,175762/245763,12673/175545],[7918/409605,87881/737289,1001167/1053270]],Nt=[[12831/3959,-329/214,-1974/3959],[-851781/878810,1648619/878810,36519/878810],[705/12673,-2585/12673,705/667]],fe=[[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]],jt=[[1.2268798733741557,-.5578149965554813,.28139105017721583],[-.04057576262431372,1.1122868293970594,-.07171106666151701],[-.07637294974672142,-.4214933239627914,1.5869240244272418]],Kt=[[.9999999984505196,.39633779217376774,.2158037580607588],[1.0000000088817607,-.10556134232365633,-.0638541747717059],[1.0000000546724108,-.08948418209496574,-1.2914855378640917]],he=[[.2104542553,.793617785,-.0040720468],[1.9779984951,-2.428592205,.4505937099],[.0259040371,.7827717662,-.808675766]],pe=[[608311/1250200,189793/714400,198249/1000160],[35783/156275,247089/357200,198249/2500400],[0,32229/714400,5220557/5000800]],ge=[[63426534/99577255,20160776/139408157,47086771/278816314],[26158966/99577255,472592308/697040785,8267143/139408157],[0,19567812/697040785,295819943/278816314]],$e=[[573536/994567,263643/1420810,187206/994567],[591459/1989134,6239551/9945670,374412/4972835],[53769/1989134,351524/4972835,4929758/4972835]],be=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],b="none",Bt="deg|g?rad|turn",Qt="srgb(?:-linear)?",Jt="xyz(?:-d(?:50|65))?",Fe=`(?:ok)?l(?:ab|ch)|h(?:sl|wb)|${Qt}|${Jt}`,ye=`(?:a98|prophoto)-rgb|display-p3|rec2020|${Qt}`,Z="[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?",j=`${Z}%`,dt=`(?:${Z}(?:${Bt})?|${b})(?:\\s+(?:${j}|${b})){2}(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,vt=`${Z}(?:${Bt})?(?:\\s*,\\s*${j}){2}(?:\\s*,\\s*(?:${Z}|${j}))?`,Lt=`(?:(?:${Z}|${b})(?:\\s+(?:${Z}|${b})){2}|(?:${j}|${b})(?:\\s+(?:${j}|${b})){2})(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,te=`(?:${Z}(?:\\s*,\\s*${Z}){2}|${j}(?:\\s*,\\s*${j}){2})(?:\\s*,\\s*(?:${Z}|${j}))?`,Et=`(?:${Z}|${j}|${b})(?:\\s+(?:${Z}|${j}|${b})){2}(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,kt=`(?:(?:${Z}|${j}|${b})\\s+){2}(?:${Z}(?:${Bt})?|${b})(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,zt=`(?:${ye}|${Jt})(?:\\s+(?:${Z}|${j}|${b})){3}(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,ee=`[a-z]+|#(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})|hsla?\\(\\s*(?:${dt}|${vt})\\s*\\)|hwb\\(\\s*${dt}\\s*\\)|rgba?\\(\\s*(?:${Lt}|${te})\\s*\\)|(?:ok)?lab\\(\\s*${Et}\\s*\\)|(?:ok)?lch\\(\\s*${kt}\\s*\\)|color\\(\\s*${zt}\\s*\\)`,qt=`(?:${ee})(?:\\s+${j})?`,me=`color-mix\\(\\s*in\\s+(${Fe})\\s*,\\s*(${qt})\\s*,\\s*(${qt})\\s*\\)`,H=/^currentColor$/i,Rt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},J=(t,x={})=>{if(!Array.isArray(t))throw new TypeError(`Expected Array but got ${L(t)}.`);let{alpha:a=!1,minLength:o=ot,maxLength:e=K,minRange:s=0,maxRange:r=1,validateRange:n=!0}=x;if(typeof o!="number")throw new TypeError(`Expected Number but got ${L(o)}.`);if(Number.isNaN(o))throw new TypeError(`${o} is not a number.`);if(typeof e!="number")throw new TypeError(`Expected Number but got ${L(e)}.`);if(Number.isNaN(e))throw new TypeError(`${e} is not a number.`);if(typeof s!="number")throw new TypeError(`Expected Number but got ${L(s)}.`);if(Number.isNaN(s))throw new TypeError(`${s} is not a number.`);if(typeof r!="number")throw new TypeError(`Expected Number but got ${L(r)}.`);if(Number.isNaN(r))throw new TypeError(`${r} is not a number.`);let l=t.length;if(l<o||l>e){let i;throw o===e?i=`Expected array length of ${e} but got ${l}.`:i=`Expected array length of ${o} or ${e} but got ${l}.`,new Error(i)}let h=0;for(;h<l;){let i=t[h];if(typeof i!="number")throw new TypeError(`Expected Number but got ${L(i)}.`);if(Number.isNaN(i))throw new TypeError(`${i} is not a number.`);if(h<ot&&n&&(i<s||i>r))throw new RangeError(`${i} is not between ${s} and ${r}.`);if(h===ot&&(i<0||i>1))throw new RangeError(`${i} is not between 0 and 1.`);h++}return a&&l===ot&&t.push(1),t},O=(t,x)=>{if(Array.isArray(t)){if(t.length!==ot)throw new Error(`Expected array length of 3 but got ${t.length}.`);for(let X of t)X=J(X,{maxLength:ot,validateRange:!1})}else throw new TypeError(`Expected Array but got ${L(t)}.`);let[[a,o,e],[s,r,n],[l,h,i]]=t,[E,c,A]=J(x,{maxLength:ot,validateRange:!1}),p=a*E+o*c+e*A,$=s*E+r*c+n*A,W=l*E+h*c+i*A;return[p,$,W]},C=(t,x=[])=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let[a,o,e,s]=x,r,n,l,h;if(/none/.test(t)){let i=new RegExp(`^rgba?\\(\\s*(${Lt})\\s*\\)$`),E=new RegExp(`^color\\(\\s*(${zt})\\s*\\)$`),c=new RegExp(`^h(?:sla?|wb)\\(\\s*(${dt})\\s*\\)$`),A=new RegExp(`^(?:ok)?lab\\(\\s*(${Et})\\s*\\)$`),p=new RegExp(`^(?:ok)?lch\\(\\s*(${kt})\\s*\\)$`);i.test(t)?[r,n,l,h]=t.match(i)[1].replace("/"," ").split(/\s+/):E.test(t)?[,r,n,l,h]=t.match(E)[1].replace("/"," ").split(/\s+/):t.startsWith("hsl")&&c.test(t)?[l,n,r,h]=t.match(c)[1].replace("/"," ").split(/\s+/):t.startsWith("hwb")&&c.test(t)?[l,,,h]=t.match(c)[1].replace("/"," ").split(/\s+/):A.test(t)?[r,,,h]=t.match(A)[1].replace("/"," ").split(/\s+/):p.test(t)&&([r,n,l,h]=t.match(p)[1].replace("/"," ").split(/\s+/))}return[r===b?r:a,n===b?n:o,l===b?l:e,h===b?h:s]},st=(t,x)=>{if(Array.isArray(t)){if(t.length!==K)throw new Error(`Expected array length of 4 but got ${t.length}.`)}else throw new TypeError(`Expected Array but got ${L(t)}.`);if(Array.isArray(x)){if(x.length!==K)throw new Error(`Expected array length of 4 but got ${x.length}.`)}else throw new TypeError(`Expected Array but got ${L(x)}.`);let a=0;for(;a<K;)t[a]===b&&x[a]===b?(t[a]=0,x[a]=0):t[a]===b?t[a]=x[a]:x[a]===b&&(x[a]=t[a]),a++;return t=J(t,{minLength:K,validateRange:!1}),x=J(x,{minLength:K,validateRange:!1}),[t,x]},nt=t=>{if(typeof t!="number")throw new TypeError(`Expected Number but got ${L(t)}.`);if(Number.isNaN(t))throw new TypeError(`${t} is not a number.`);if(t=Math.round(t),t<0||t>M)throw new RangeError(`${t} is not between 0 and ${M}.`);let x=t.toString(G);return x.length===1&&(x=`0${x}`),x},Ct=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=q/400,a=q/(Math.PI*$t),o=new RegExp(`^(${Z})(${Bt})?$`);if(!o.test(t))throw new Error(`Invalid property value: ${t}`);let[,e,s]=t.match(o),r=e.startsWith(".")?`0${e}`:e,n;switch(s){case"grad":n=parseFloat(r)*x;break;case"rad":n=parseFloat(r)*a;break;case"turn":n=parseFloat(r)*q;break;default:n=parseFloat(r)}return n%=q,n<0&&(n+=q),n},It=t=>{let[x,a,o]=J(t,{maxLength:ot,maxRange:M}),e=x/M,s=a/M,r=o/M,n=.04045;return e>n?e=Math.pow((e+v)/(1+v),bt):e/=Ft,s>n?s=Math.pow((s+v)/(1+v),bt):s/=Ft,r>n?r=Math.pow((r+v)/(1+v),bt):r/=Ft,[e,s,r]},Dt=t=>{let[x,a,o,e]=J(t,{alpha:!0,maxRange:M}),[s,r,n]=It([x,a,o]),[l,h,i]=O(Ot,[s,r,n]);return[l,h,i,e]};var _t=t=>{let[x,a,o,e]=J(t,{alpha:!0,maxRange:M}),s=nt(x),r=nt(a),n=nt(o),l=nt(e*M),h;return l==="ff"?h=`#${s}${r}${n}`:h=`#${s}${r}${n}${l}`,h},Xt=t=>{let[x,a,o]=J(t,{maxLength:ot}),e=809/258400;return x>e?x=Math.pow(x,1/bt)*(1+v)-v:x*=Ft,a>e?a=Math.pow(a,1/bt)*(1+v)-v:a*=Ft,o>e?o=Math.pow(o,1/bt)*(1+v)-v:o*=Ft,[Math.round(x*M),Math.round(a*M),Math.round(o*M)]},we=t=>{let[x,a,o,e]=J(t,{minLength:K});[x,a,o]=Xt([x,a,o]);let s=nt(x),r=nt(a),n=nt(o),l=nt(e*M),h;return l==="ff"?h=`#${s}${r}${n}`:h=`#${s}${r}${n}${l}`,h},se=t=>{let[x,a,o,e]=J(t,{minLength:K,validateRange:!1}),[s,r,n]=O(Nt,[x,a,o]);return we([Math.min(Math.max(s,0),1),Math.min(Math.max(r,0),1),Math.min(Math.max(n,0),1),e])};var at=t=>{let[x,a,o,e]=J(t,{validateRange:!1}),[s,r,n]=O(Nt,[x,a,o]);return[s,r,n]=Xt([Math.min(Math.max(s,0),1),Math.min(Math.max(r,0),1),Math.min(Math.max(n,0),1)]),[s,r,n,e]},re=t=>{let[x,a,o,e]=J(t,{validateRange:!1}),[s,r,n]=O(tt,[x,a,o]);return[s,r,n,e]},xt=t=>{let[x,a,o,e]=at(t),s=x/M,r=a/M,n=o/M,l=Math.max(s,r,n),h=Math.min(s,r,n),i=l-h,E=(l+h)*et*R,c,A;if(Math.round(E)===0||Math.round(E)===R)c=b,A=b;else if(A=i/(1-Math.abs(l+h-1))*R,A===0)c=b;else{switch(l){case s:c=(r-n)/i;break;case r:c=(n-s)/i+$t;break;case n:default:c=(s-r)/i+K;break}c=c*rt%q,c<0&&(c+=q)}return[c,A,E,e]},ht=t=>{let[x,a,o,e]=at(t),s=Math.min(x,a,o)/M,r=1-Math.max(x,a,o)/M,n;return s+r===1?n=b:[n]=xt(t),[n,s*R,r*R,e]},lt=t=>{let[x,a,o,e]=J(t,{validateRange:!1}),r=O(fe,[x,a,o]).map(E=>Math.cbrt(E)),[n,l,h]=O(he,r);n=Math.min(Math.max(n,0),1);let i=Math.round(parseFloat(n.toFixed(K))*R);return(i===0||i===R)&&(l=b,h=b),[n,l,h,e]},pt=t=>{let[x,a,o,e]=lt(t),s,r,n=Math.round(parseFloat(x.toFixed(K))*R);return n===0||n===R?(s=b,r=b):(s=Math.max(Math.sqrt(Math.pow(a,Tt)+Math.pow(o,Tt)),0),parseFloat(s.toFixed(K))===0?r=b:(r=Math.atan2(o,a)*q*et/Math.PI,r<0&&(r+=q))),[x,s,r,e]},oe=t=>{let[x,a,o,e]=J(t,{minLength:K,validateRange:!1}),s=O(wt,[x,a,o]),[r,n,l]=at(s);return[r,n,l,e]},ct=t=>{let[x,a,o,e]=J(t,{validateRange:!1}),s=[x,a,o].map((c,A)=>c/Ut[A]),[r,n,l]=s.map(c=>c>ut?Math.cbrt(c):(c*Mt+G)/mt),h=Math.min(Math.max(mt*n-G,0),R),i,E;return h===0||h===R?(i=b,E=b):(i=(r-n)*Vt,E=(n-l)*Zt),[h,i,E,e]},gt=t=>{let[x,a,o,e]=ct(t),s,r;return x===0||x===R?(s=b,r=b):(s=Math.max(Math.sqrt(Math.pow(a,Tt)+Math.pow(o,Tt)),0),parseFloat(s.toFixed(K))===0?r=b:(r=Math.atan2(o,a)*q*et/Math.PI,r<0&&(r+=q))),[x,s,r,e]},ne=t=>{if(Y(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${L(t)}.`);if(!(/^#[\da-f]{6}$/.test(t)||/^#[\da-f]{3}$/.test(t)||/^#[\da-f]{8}$/.test(t)||/^#[\da-f]{4}$/.test(t)))throw new Error(`Invalid property value: ${t}`);let x=[];if(/^#[\da-f]{6}$/.test(t)){let[,a,o,e]=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/);x.push(parseInt(a,G),parseInt(o,G),parseInt(e,G),1)}else if(/^#[\da-f]{3}$/.test(t)){let[,a,o,e]=t.match(/^#([\da-f])([\da-f])([\da-f])$/);x.push(parseInt(`${a}${a}`,G),parseInt(`${o}${o}`,G),parseInt(`${e}${e}`,G),1)}else if(/^#[\da-f]{8}$/.test(t)){let[,a,o,e,s]=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})$/);x.push(parseInt(a,G),parseInt(o,G),parseInt(e,G),parseInt(s,G)/M)}else if(/^#[\da-f]{4}$/.test(t)){let[,a,o,e,s]=t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/);x.push(parseInt(`${a}${a}`,G),parseInt(`${o}${o}`,G),parseInt(`${e}${e}`,G),parseInt(`${s}${s}`,G)/M)}return x},de=t=>{let[x,a,o,e]=ne(t),[s,r,n]=It([x,a,o]);return[s,r,n,e]},Ee=t=>{let[x,a,o,e]=de(t),[s,r,n]=O(Ot,[x,a,o]);return[s,r,n,e]},it=t=>{if(Y(t))if(t=t.trim(),!t)t=1;else if(t===b)t=0;else{if(t.startsWith(".")&&(t=`0${t}`),t.endsWith("%")?t=parseFloat(t)/R:t=parseFloat(t),Number.isNaN(t))throw new TypeError(`${t} is not a number.`);(t<0||t>1)&&(t=Math.min(Math.max(t,0),1))}else t=1;return t},ae=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^rgba?\\(\\s*(${Lt}|${te})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let[,a]=t.match(x),[o,e,s,r]=a.replace(/[,/]/g," ").split(/\s+/);return o===b?o=0:(o.startsWith(".")&&(o=`0${o}`),o.endsWith("%")?o=parseFloat(o)*M/R:o=parseFloat(o)),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)*M/R:e=parseFloat(e)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*M/R:s=parseFloat(s)),r=it(r),[Math.min(Math.max(o,0),M),Math.min(Math.max(e,0),M),Math.min(Math.max(s,0),M),r]},Pt=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^hsla?\\(\\s*(${dt}|${vt})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let[,a]=t.match(x),[o,e,s,r]=a.replace(/[,/]/g," ").split(/\s+/);o===b?o=0:o=Ct(o),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=Math.min(Math.max(parseFloat(e),0),R)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s=Math.min(Math.max(parseFloat(s),0),R)),r=it(r);let n,l;s<R*et?(n=(s+s*(e/R))*M/R,l=(s-s*(e/R))*M/R):(n=(s+(R-s)*(e/R))*M/R,l=(s-(R-s)*(e/R))*M/R);let h=(n-l)/rt,i,E,c;return o>=0&&o<rt?(i=n,E=o*h+l,c=l):o<rt*$t?(i=(rt*$t-o)*h+l,E=n,c=l):o<q*et?(i=l,E=n,c=(o-rt*$t)*h+l):o<rt*K?(i=l,E=(rt*K-o)*h+l,c=n):o<q-rt?(i=(o-rt*K)*h+l,E=l,c=n):o<q&&(i=n,E=l,c=(q-o)*h+l),[Math.min(Math.max(i,0),M),Math.min(Math.max(E,0),M),Math.min(Math.max(c,0),M),r]},ie=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^hwb\\(\\s*(${dt})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let[,a]=t.match(x),[o,e,s,r]=a.replace("/"," ").split(/\s+/);o===b?o=0:o=Ct(o),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=Math.min(Math.max(parseFloat(e),0),R)/R),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s=Math.min(Math.max(parseFloat(s),0),R)/R),r=it(r);let n=[];if(e+s>=1){let l=e/(e+s)*M;n.push(l,l,l,r)}else{let[l,h,i]=Pt(`hsl(${o} 100% 50%)`),E=(1-e-s)/M;n.push((l*E+e)*M,(h*E+e)*M,(i*E+e)*M,r)}return n},St=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^lab\\(\\s*(${Et})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let a=1.25,o=8,[,e]=t.match(x),[s,r,n,l]=e.replace("/"," ").split(/\s+/);s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?(s=parseFloat(s),s>R&&(s=R)):s=parseFloat(s),s<0&&(s=0)),r===b?r=0:(r.startsWith(".")&&(r=`0${r}`),r.endsWith("%")?r=parseFloat(r)*a:r=parseFloat(r)),n===b?n=0:n.endsWith("%")?n=parseFloat(n)*a:n=parseFloat(n),l=it(l);let h=(s+G)/mt,i=r/Vt+h,E=h-n/Zt,c=Math.pow(h,yt),A=Math.pow(i,yt),p=Math.pow(E,yt),$=[A>ut?A:(i*mt-G)/Mt,s>o?c:s/Mt,p>ut?p:(E*mt-G)/Mt],[W,X,I]=$.map((S,w)=>S*Ut[w]);return[W,X,I,l]},xe=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^lch\\(\\s*(${kt})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let a=1.5,[,o]=t.match(x),[e,s,r,n]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*a:s=parseFloat(s)),r===b?r=0:r=Ct(r),n=it(n);let l=s*Math.cos(r*Math.PI/(q*et)),h=s*Math.sin(r*Math.PI/(q*et)),[i,E,c]=St(`lab(${e} ${l} ${h})`);return[i,E,c,n]},le=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^oklab\\(\\s*(${Et})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let a=.4,[,o]=t.match(x),[e,s,r,n]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)/R:e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*a/R:s=parseFloat(s)),r===b?r=0:r.endsWith("%")?r=parseFloat(r)*a/R:r=parseFloat(r),n=it(n);let h=O(Kt,[e,s,r]).map(A=>Math.pow(A,yt)),[i,E,c]=O(jt,h);return[i,E,c,n]},ce=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^oklch\\(\\s*(${Et})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let a=.4,[,o]=t.match(x),[e,s,r,n]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)/R:e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*a/R:s=parseFloat(s),s<0&&(s=0)),r===b?r=0:r=Ct(r),n=it(n);let l=s*Math.cos(r*Math.PI/(q*et)),h=s*Math.sin(r*Math.PI/(q*et)),E=O(Kt,[e,l,h]).map($=>Math.pow($,yt)),[c,A,p]=O(jt,E);return[c,A,p,n]},V=(t,x=!1)=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let a=new RegExp(`^color\\(\\s*(${zt})\\s*\\)$`);if(!a.test(t))throw new Error(`Invalid property value: ${t}`);let[,o]=t.match(a),[e,s,r,n,l]=o.replace("/"," ").split(/\s+/),h,i,E;if(s===b)h=0;else{let W;s.startsWith(".")?W=`0${s}`:W=s,h=W.endsWith("%")?parseFloat(W)/R:parseFloat(W)}if(r===b)i=0;else{let W;r.startsWith(".")?W=`0${r}`:W=r,i=W.endsWith("%")?parseFloat(W)/R:parseFloat(W)}if(n===b)E=0;else{let W;n.startsWith(".")?W=`0${n}`:W=n,E=W.endsWith("%")?parseFloat(W)/R:parseFloat(W)}let c=it(l),A,p,$;if(e==="srgb")[A,p,$]=Dt([h*M,i*M,E*M]),x&&([A,p,$]=O(tt,[A,p,$]));else if(e==="srgb-linear")[A,p,$]=O(Ot,[h,i,E]),x&&([A,p,$]=O(tt,[A,p,$]));else if(e==="display-p3"){let W=It([h*M,i*M,E*M]);[A,p,$]=O(pe,W),x&&([A,p,$]=O(tt,[A,p,$]))}else if(e==="rec2020"){let W=1.09929682680944,X=.018053968510807,I=.45,S=[h,i,E].map(w=>{let f;return w<X*I*Yt?f=w/(I*Yt):f=Math.pow((w+W-1)/W,1/I),f});[A,p,$]=O(ge,S),x&&([A,p,$]=O(tt,[A,p,$]))}else if(e==="a98-rgb"){let W=2.19921875,X=[h,i,E].map(I=>Math.pow(I,W));[A,p,$]=O($e,X),x&&([A,p,$]=O(tt,[A,p,$]))}else if(e==="prophoto-rgb"){let X=[h,i,E].map(I=>{let S;return I>1/(G*$t)?S=Math.pow(I,1.8):S=I/G,S});[A,p,$]=O(be,X),x||([A,p,$]=O(wt,[A,p,$]))}else/^xyz(?:-d(?:50|65))?$/.test(e)&&([A,p,$]=[h,i,E],e==="xyz-d50"?x||([A,p,$]=O(wt,[A,p,$])):x&&([A,p,$]=O(tt,[A,p,$])));return[A,p,$,c]},U=(t,x=!1)=>{if(Y(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let a,o,e,s;if(H.test(t))a=0,o=0,e=0,s=0;else if(/^[a-z]+$/.test(t))if(Object.prototype.hasOwnProperty.call(Rt,t)){let[r,n,l]=Rt[t];s=1,[a,o,e]=Dt([r,n,l]),x&&([a,o,e]=O(tt,[a,o,e]))}else if(t==="transparent")a=0,o=0,e=0,s=0;else throw new Error(`Invalid property value: ${t}`);else if(t.startsWith("#")){let r;if(/^#[\da-f]{6}$/.test(t))r=t;else if(/^#[\da-f]{3}$/.test(t)){let[,n,l,h]=t.match(/^#([\da-f])([\da-f])([\da-f])$/);r=`#${n}${n}${l}${l}${h}${h}`}else if(/^#[\da-f]{8}$/.test(t))r=t;else if(/^#[\da-f]{4}$/.test(t)){let[,n,l,h,i]=t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/);r=`#${n}${n}${l}${l}${h}${h}${i}${i}`}else throw new Error(`Invalid property value: ${t}`);[a,o,e,s]=Ee(r),x&&([a,o,e]=O(tt,[a,o,e]))}else if(t.startsWith("lab"))[a,o,e,s]=St(t),x||([a,o,e]=O(wt,[a,o,e]));else if(t.startsWith("lch"))[a,o,e,s]=xe(t),x||([a,o,e]=O(wt,[a,o,e]));else if(t.startsWith("oklab"))[a,o,e,s]=le(t),x&&([a,o,e]=O(tt,[a,o,e]));else if(t.startsWith("oklch"))[a,o,e,s]=ce(t),x&&([a,o,e]=O(tt,[a,o,e]));else{let r,n,l;if(t.startsWith("rgb"))[r,n,l,s]=ae(t);else if(t.startsWith("hsl"))[r,n,l,s]=Pt(t);else if(t.startsWith("hwb"))[r,n,l,s]=ie(t);else throw new Error(`Invalid property value: ${t}`);[a,o,e]=Dt([r,n,l]),x&&([a,o,e]=O(tt,[a,o,e]))}return[a,o,e,s]},Wt=(t,x={})=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let{alpha:a}=x,o,e,s,r;t.startsWith("color(")?[o,e,s,r]=V(t):[o,e,s,r]=U(t);let[n,l,h]=O(Nt,[o,e,s]);n=Math.min(Math.max(n,0),1),l=Math.min(Math.max(l,0),1),h=Math.min(Math.max(h,0),1);let i=[n,l,h];return a?i.push(r):i.push(1),i},At=t=>{let[x,a,o,e]=Wt(t,{alpha:!0});return[x,a,o]=Xt([x,a,o]),[x,a,o,e]},ft=t=>{if(Y(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x,a,o,e;if(H.test(t))x=0,a=0,o=0,e=0;else if(/^[a-z]+$/i.test(t))Object.prototype.hasOwnProperty.call(Rt,t)?([x,a,o]=Rt[t],e=1):t==="transparent"&&(x=0,a=0,o=0,e=0);else if(t.startsWith("#"))[x,a,o,e]=ne(t);else if(/^l(?:ab|ch)/.test(t)){let r,n,l;t.startsWith("lab")?[r,n,l,e]=St(t):[r,n,l,e]=xe(t),[x,a,o,e]=oe([r,n,l,e])}else if(/^okl(?:ab|ch)/.test(t)){let r,n,l;t.startsWith("oklab")?[r,n,l,e]=le(t):[r,n,l,e]=ce(t),[x,a,o,e]=at([r,n,l,e])}else t.startsWith("rgb")?[x,a,o,e]=ae(t):t.startsWith("hsl")?[x,a,o,e]=Pt(t):t.startsWith("hwb")&&([x,a,o,e]=ie(t));let s;return isNaN(x)||isNaN(a)||isNaN(o)||isNaN(e)?s=[]:s=[Math.round(x),Math.round(a),Math.round(o),e],s},Ht=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);if(!new RegExp(`^color\\(\\s*${zt}\\s*\\)$`).test(t))throw new Error(`Invalid property value: ${t}`);let[a,o,e,s]=V(t),[r,n,l]=at([a,o,e]);return[r,n,l,s]},Gt=(t,x={})=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let a=new RegExp(`^${me}$`,"i");if(!a.test(t))throw new Error(`Invalid property value: ${t}`);let o="lch(none none none / none)",e="rgb(none none none / none)",s=new RegExp(`^(${ee})(?:\\s+(${j}))?$`,"i"),r=new RegExp(b),[,n,l,h]=t.match(a),[,i,E]=l.match(s),[,c,A]=h.match(s),p,$,W;if(E&&A){let f=parseFloat(E)/R,g=parseFloat(A)/R;if(f<0||f>1)throw new RangeError(`${E} is not between 0% and 100%.`);if(g<0||g>1)throw new RangeError(`${A} is not between 0% and 100%.`);let d=f+g;if(d===0)throw new Error(`Invalid property value: ${t}`);p=f/d,$=g/d,W=d<1?d:1}else{if(E){if(p=parseFloat(E)/R,p<0||p>1)throw new RangeError(`${E} is not between 0% and 100%.`);$=1-p}else if(A){if($=parseFloat(A)/R,$<0||$>1)throw new RangeError(`${A} is not between 0% and 100%.`);p=1-$}else p=et,$=et;W=1}let X,I,S,w;if(n==="srgb"){let f=At(i,{alpha:!0}),g=At(c,{alpha:!0});H.test(i)?f=C(e,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(e,g):r.test(c)&&(g=C(c,g));let[[d,y,F,z],[T,m,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B,w===0?(X=d*p+T*$,I=y*p+m*$,S=F*p+D*$):(X=(d*_+T*B)/w,I=(y*_+m*B)/w,S=(F*_+D*B)/w)}else if(n==="srgb-linear"){let f=Wt(i,{alpha:!0}),g=Wt(c,{alpha:!0});H.test(i)?f=C(e,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(e,g):r.test(c)&&(g=C(c,g));let[[d,y,F,z],[T,m,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B,w===0?(X=(d*p+T*$)*M,I=(y*p+m*$)*M,S=(F*p+D*$)*M):(X=(d*_+T*B)*w*M,I=(y*_+m*B)*w*M,S=(F*_+D*B)*w*M)}else if(/^xyz(?:-d65)?$/.test(n)){let f,g;i.startsWith("color(")?f=V(i):f=U(i),c.startsWith("color(")?g=V(c):g=U(c),H.test(i)?f=C(e,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(e,g):r.test(c)&&(g=C(c,g));let[[d,y,F,z],[T,m,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B;let N,u,P;w===0?(N=d*p+T*$,u=y*p+m*$,P=F*p+D*$):(N=(d*_+T*B)*w,u=(y*_+m*B)*w,P=(F*_+D*B)*w),[X,I,S]=at([N,u,P])}else if(n==="xyz-d50"){let f,g;i.startsWith("color(")?f=V(i,!0):f=U(i,!0),c.startsWith("color(")?g=V(c,!0):g=U(c,!0),H.test(i)?f=C(e,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(e,g):r.test(c)&&(g=C(c,g));let[[d,y,F,z],[T,m,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B;let N,u,P;w===0?(N=d*p+T*$,u=y*p+m*$,P=F*p+D*$):(N=(d*_+T*B)*w,u=(y*_+m*B)*w,P=(F*_+D*B)*w),[X,I,S]=oe([N,u,P,w])}else if(n==="hsl"){let f,g,d,y;if(i.startsWith("color(")){let u=V(i);[f,g,d,y]=xt(u)}else{let u=U(i);[f,g,d,y]=xt(u)}let F,z,T,m;if(c.startsWith("color(")){let u=V(c);[F,z,T,m]=xt(u)}else{let u=U(c);[F,z,T,m]=xt(u)}H.test(i)?[d,g,f,y]=C(o,[d,g,f,y]):r.test(i)&&([d,g,f,y]=C(i,[d,g,f,y])),H.test(c)?[T,z,F,m]=C(o,[T,z,F,m]):r.test(c)&&([T,z,F,m]=C(c,[T,z,F,m])),[[f,g,d,y],[F,z,T,m]]=st([f,g,d,y],[F,z,T,m]);let D=y*p,k=m*$;w=D+k;let _=(f*p+F*$)%q,B,N;w===0?(B=g*p+z*$,N=d*p+T*$):(B=(g*D+z*k)/w,N=(d*D+T*k)/w),[X,I,S]=At(`hsl(${_} ${B}% ${N}%)`)}else if(n==="hwb"){let f,g,d,y;if(i.startsWith("color(")){let P=V(i);[f,g,d,y]=ht(P)}else{let P=U(i);[f,g,d,y]=ht(P)}let F,z,T,m;if(c.startsWith("color(")){let P=V(c);[F,z,T,m]=ht(P)}else{let P=U(c);[F,z,T,m]=ht(P)}H.test(i)?[,,f,y]=C(o,[null,null,f,y]):r.test(i)&&([,,f,y]=C(i,[null,null,f,y])),H.test(c)?[,,F,m]=C(o,[null,null,F,m]):r.test(c)&&([,,F,m]=C(c,[null,null,F,m])),[[f,g,d,y],[F,z,T,m]]=st([f,g,d,y],[F,z,T,m]);let D=y*p,k=m*$;w=D+k;let _=(f*p+F*$)%q,B,N;w===0?(B=g*p+z*$,N=d*p+T*$):(B=(g*D+z*k)/w,N=(d*D+T*k)/w),[X,I,S]=At(`hwb(${_} ${B}% ${N}%)`)}else if(n==="lab"){let f,g,d,y;if(i.startsWith("color(")){let u=V(i,!0);[f,g,d,y]=ct(u)}else{let u=U(i,!0);[f,g,d,y]=ct(u)}let F,z,T,m;if(c.startsWith("color(")){let u=V(c,!0);[F,z,T,m]=ct(u)}else{let u=U(c,!0);[F,z,T,m]=ct(u)}H.test(i)?[f,,,y]=C(o,[f,null,null,y]):r.test(i)&&([f,,,y]=C(i,[f,null,null,y])),H.test(c)?[F,,,m]=C(o,[F,null,null,m]):r.test(c)&&([F,,,m]=C(c,[F,null,null,m])),[[f,g,d,y],[F,z,T,m]]=st([f,g,d,y],[F,z,T,m]);let D=y*p,k=m*$;w=D+k;let _,B,N;w===0?(_=f*p+F*$,B=g*p+z*$,N=d*p+T*$):(_=(f*D+F*k)*w,B=(g*D+z*k)*w,N=(d*D+T*k)*w),[X,I,S]=ft(`lab(${_} ${B} ${N})`)}else if(n==="lch"){let f,g;if(i.startsWith("color(")){let Q=V(i,!0);f=gt(Q)}else{let Q=U(i,!0);f=gt(Q)}if(c.startsWith("color(")){let Q=V(c,!0);g=gt(Q)}else{let Q=U(c,!0);g=gt(Q)}H.test(i)?f=C(o,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(o,g):r.test(c)&&(g=C(c,g));let[[d,y,F,z],[T,m,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B;let N,u,P;w===0?(N=d*p+T*$,u=y*p+m*$,P=F*p+D*$):(N=(d*_+T*B)*w,u=(y*_+m*B)*w,P=(F*_+D*B)*w),[X,I,S]=ft(`lch(${N} ${u} ${P})`)}else if(n==="oklab"){let f,g,d,y;if(i.startsWith("color(")){let u=V(i);[f,g,d,y]=lt(u)}else{let u=U(i);[f,g,d,y]=lt(u)}let F,z,T,m;if(c.startsWith("color(")){let u=V(c);[F,z,T,m]=lt(u)}else{let u=U(c);[F,z,T,m]=lt(u)}H.test(i)?[f,,,y]=C(o,[f,null,null,y]):r.test(i)&&([f,,,y]=C(i,[f,null,null,y])),H.test(c)?[f,,,m]=C(o,[F,null,null,m]):r.test(c)&&([F,,,m]=C(c,[F,null,null,m])),[[f,g,d,y],[F,z,T,m]]=st([f,g,d,y],[F,z,T,m]);let D=y*p,k=m*$;w=D+k;let _,B,N;w===0?(_=f*p+F*$,B=g*p+z*$,N=d*p+T*$):(_=(f*D+F*k)*w,B=(g*D+z*k)*w,N=(d*D+T*k)*w),[X,I,S]=ft(`oklab(${_} ${B} ${N})`)}else if(n==="oklch"){let f,g;if(i.startsWith("color(")){let Q=V(i,!0);f=pt(Q)}else{let Q=U(i,!0);f=pt(Q)}if(c.startsWith("color(")){let Q=V(c,!0);g=pt(Q)}else{let Q=U(c,!0);g=pt(Q)}H.test(i)?f=C(o,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(o,g):r.test(c)&&(g=C(c,g)),r.test(i)&&(f=C(i,f)),r.test(c)&&(g=C(c,g));let[[d,y,F,z],[T,m,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B;let N,u,P;w===0?(N=d*p+T*$,u=y*p+m*$,P=F*p+D*$):(N=(d*_+T*B)*w,u=(y*_+m*B)*w,P=(F*_+D*B)*w),[X,I,S]=ft(`oklch(${N} ${u} ${P})`)}return[X,I,S,w*W]};var ze=(t,x={})=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let{currentColor:a,format:o,key:e}=x,s,r,n,l;/^currentcolor$/i.test(t)?a?a.startsWith("color-mix")?[s,r,n,l]=Gt(a):a.startsWith("color(")?[s,r,n,l]=Ht(a):[s,r,n,l]=ft(a):(s=0,r=0,n=0,l=0):/^transparent$/i.test(t)?(s=0,r=0,n=0,l=0):t.startsWith("color-mix")?[s,r,n,l]=Gt(t):t.startsWith("color(")?[s,r,n,l]=Ht(t):[s,r,n,l]=ft(t);let h;switch(o){case"array":{e?h=[e,[s,r,n,l]]:h=[s,r,n,l];break}case"hex":{let i;/^transparent$/i.test(t)||isNaN(s)||isNaN(r)||isNaN(n)?i=null:i=_t([s,r,n]),e?h=[e,i]:h=i;break}case"hexAlpha":{let i;/^transparent$/i.test(t)?i="#00000000":isNaN(s)||isNaN(r)||isNaN(n)||isNaN(l)?i=null:i=_t([s,r,n,l]),e?h=[e,i]:h=i;break}default:{let i;isNaN(s)||isNaN(r)||isNaN(n)||isNaN(l)?i="":(s=Math.round(s),r=Math.round(r),n=Math.round(n),l===1?i=`rgb(${s}, ${r}, ${n})`:i=`rgba(${s}, ${r}, ${n}, ${l})`),e?h=[e,i]:h=i}}return h},Ce=(t,x={})=>{if(Y(t)){if(t=t.trim(),t.startsWith("color-mix("))throw new Error("color-mix() is not supported.")}else throw new TypeError(`Expected String but got ${L(t)}.`);let{d50:a}=x,o;return t.startsWith("color(")?o=V(t,a):o=U(t,a),o},_e={rgbToHex:_t,xyzD50ToLab:ct,xyzD50ToLch:gt,xyzToHex:se,xyzToHsl:xt,xyzToHwb:ht,xyzToOklab:lt,xyzToOklch:pt,xyzToRgb:at,xyzToXyzD50:re};export{_e as convert,Ce as parse,ze as resolve};
var L=t=>Object.prototype.toString.call(t).slice(8,-1),Y=t=>typeof t=="string"||t instanceof String;var et=.5,$t=2,nt=3,K=4,qt=10,G=16,q=360,rt=60,R=100,M=255,Tt=2,mt=3,bt=2.4,Ft=12.92,v=.055,yt=116,Zt=500,Ut=200,Dt=216/24389,Mt=24389/27,jt=[.3457/.3585,1,(1-.3457-.3585)/.3585],wt=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],tt=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],Nt=[[506752/1228815,87881/245763,12673/70218],[87098/409605,175762/245763,12673/175545],[7918/409605,87881/737289,1001167/1053270]],Lt=[[12831/3959,-329/214,-1974/3959],[-851781/878810,1648619/878810,36519/878810],[705/12673,-2585/12673,705/667]],fe=[[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]],Kt=[[1.2268798733741557,-.5578149965554813,.28139105017721583],[-.04057576262431372,1.1122868293970594,-.07171106666151701],[-.07637294974672142,-.4214933239627914,1.5869240244272418]],Qt=[[.9999999984505196,.39633779217376774,.2158037580607588],[1.0000000088817607,-.10556134232365633,-.0638541747717059],[1.0000000546724108,-.08948418209496574,-1.2914855378640917]],he=[[.2104542553,.793617785,-.0040720468],[1.9779984951,-2.428592205,.4505937099],[.0259040371,.7827717662,-.808675766]],pe=[[608311/1250200,189793/714400,198249/1000160],[35783/156275,247089/357200,198249/2500400],[0,32229/714400,5220557/5000800]],ge=[[63426534/99577255,20160776/139408157,47086771/278816314],[26158966/99577255,472592308/697040785,8267143/139408157],[0,19567812/697040785,295819943/278816314]],$e=[[573536/994567,263643/1420810,187206/994567],[591459/1989134,6239551/9945670,374412/4972835],[53769/1989134,351524/4972835,4929758/4972835]],be=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],b="none",Bt="deg|g?rad|turn",Jt="srgb(?:-linear)?",vt="xyz(?:-d(?:50|65))?",Fe=`(?:ok)?l(?:ab|ch)|h(?:sl|wb)|${Jt}|${vt}`,me=`(?:a98|prophoto)-rgb|display-p3|rec2020|${Jt}`,Z="[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?",j=`${Z}%`,dt=`(?:${Z}(?:${Bt})?|${b})(?:\\s+(?:${j}|${b})){2}(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,te=`${Z}(?:${Bt})?(?:\\s*,\\s*${j}){2}(?:\\s*,\\s*(?:${Z}|${j}))?`,kt=`(?:(?:${Z}|${b})(?:\\s+(?:${Z}|${b})){2}|(?:${j}|${b})(?:\\s+(?:${j}|${b})){2})(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,ee=`(?:${Z}(?:\\s*,\\s*${Z}){2}|${j}(?:\\s*,\\s*${j}){2})(?:\\s*,\\s*(?:${Z}|${j}))?`,Et=`(?:${Z}|${j}|${b})(?:\\s+(?:${Z}|${j}|${b})){2}(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,It=`(?:(?:${Z}|${j}|${b})\\s+){2}(?:${Z}(?:${Bt})?|${b})(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,zt=`(?:${me}|${vt})(?:\\s+(?:${Z}|${j}|${b})){3}(?:\\s*\\/\\s*(?:${Z}|${j}|${b}))?`,se=`[a-z]+|#(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})|hsla?\\(\\s*(?:${dt}|${te})\\s*\\)|hwb\\(\\s*${dt}\\s*\\)|rgba?\\(\\s*(?:${kt}|${ee})\\s*\\)|(?:ok)?lab\\(\\s*${Et}\\s*\\)|(?:ok)?lch\\(\\s*${It}\\s*\\)|color\\(\\s*${zt}\\s*\\)`,Vt=`(?:${se})(?:\\s+${j})?`,ye=`color-mix\\(\\s*in\\s+(${Fe})\\s*,\\s*(${Vt})\\s*,\\s*(${Vt})\\s*\\)`,H=/^currentColor$/i,Rt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},J=(t,x={})=>{if(!Array.isArray(t))throw new TypeError(`Expected Array but got ${L(t)}.`);let{alpha:a=!1,minLength:o=nt,maxLength:e=K,minRange:s=0,maxRange:r=1,validateRange:n=!0}=x;if(typeof o!="number")throw new TypeError(`Expected Number but got ${L(o)}.`);if(Number.isNaN(o))throw new TypeError(`${o} is not a number.`);if(typeof e!="number")throw new TypeError(`Expected Number but got ${L(e)}.`);if(Number.isNaN(e))throw new TypeError(`${e} is not a number.`);if(typeof s!="number")throw new TypeError(`Expected Number but got ${L(s)}.`);if(Number.isNaN(s))throw new TypeError(`${s} is not a number.`);if(typeof r!="number")throw new TypeError(`Expected Number but got ${L(r)}.`);if(Number.isNaN(r))throw new TypeError(`${r} is not a number.`);let l=t.length;if(l<o||l>e){let i;throw o===e?i=`Expected array length of ${e} but got ${l}.`:i=`Expected array length of ${o} or ${e} but got ${l}.`,new Error(i)}let h=0;for(;h<l;){let i=t[h];if(typeof i!="number")throw new TypeError(`Expected Number but got ${L(i)}.`);if(Number.isNaN(i))throw new TypeError(`${i} is not a number.`);if(h<nt&&n&&(i<s||i>r))throw new RangeError(`${i} is not between ${s} and ${r}.`);if(h===nt&&(i<0||i>1))throw new RangeError(`${i} is not between 0 and 1.`);h++}return a&&l===nt&&t.push(1),t},O=(t,x)=>{if(Array.isArray(t)){if(t.length!==nt)throw new Error(`Expected array length of 3 but got ${t.length}.`);for(let X of t)X=J(X,{maxLength:nt,validateRange:!1})}else throw new TypeError(`Expected Array but got ${L(t)}.`);let[[a,o,e],[s,r,n],[l,h,i]]=t,[E,c,A]=J(x,{maxLength:nt,validateRange:!1}),p=a*E+o*c+e*A,$=s*E+r*c+n*A,W=l*E+h*c+i*A;return[p,$,W]},C=(t,x=[])=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let[a,o,e,s]=x,r,n,l,h;if(/none/.test(t)){let i=new RegExp(`^rgba?\\(\\s*(${kt})\\s*\\)$`),E=new RegExp(`^color\\(\\s*(${zt})\\s*\\)$`),c=new RegExp(`^h(?:sla?|wb)\\(\\s*(${dt})\\s*\\)$`),A=new RegExp(`^(?:ok)?lab\\(\\s*(${Et})\\s*\\)$`),p=new RegExp(`^(?:ok)?lch\\(\\s*(${It})\\s*\\)$`);i.test(t)?[r,n,l,h]=t.match(i)[1].replace("/"," ").split(/\s+/):E.test(t)?[,r,n,l,h]=t.match(E)[1].replace("/"," ").split(/\s+/):t.startsWith("hsl")&&c.test(t)?[l,n,r,h]=t.match(c)[1].replace("/"," ").split(/\s+/):t.startsWith("hwb")&&c.test(t)?[l,,,h]=t.match(c)[1].replace("/"," ").split(/\s+/):A.test(t)?[r,,,h]=t.match(A)[1].replace("/"," ").split(/\s+/):p.test(t)&&([r,n,l,h]=t.match(p)[1].replace("/"," ").split(/\s+/))}return[r===b?r:a,n===b?n:o,l===b?l:e,h===b?h:s]},st=(t,x)=>{if(Array.isArray(t)){if(t.length!==K)throw new Error(`Expected array length of 4 but got ${t.length}.`)}else throw new TypeError(`Expected Array but got ${L(t)}.`);if(Array.isArray(x)){if(x.length!==K)throw new Error(`Expected array length of 4 but got ${x.length}.`)}else throw new TypeError(`Expected Array but got ${L(x)}.`);let a=0;for(;a<K;)t[a]===b&&x[a]===b?(t[a]=0,x[a]=0):t[a]===b?t[a]=x[a]:x[a]===b&&(x[a]=t[a]),a++;return t=J(t,{minLength:K,validateRange:!1}),x=J(x,{minLength:K,validateRange:!1}),[t,x]},ot=t=>{if(typeof t!="number")throw new TypeError(`Expected Number but got ${L(t)}.`);if(Number.isNaN(t))throw new TypeError(`${t} is not a number.`);if(t=Math.round(t),t<0||t>M)throw new RangeError(`${t} is not between 0 and ${M}.`);let x=t.toString(G);return x.length===1&&(x=`0${x}`),x},Ct=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=q/400,a=q/(Math.PI*$t),o=new RegExp(`^(${Z})(${Bt})?$`);if(!o.test(t))throw new Error(`Invalid property value: ${t}`);let[,e,s]=t.match(o),r=e.startsWith(".")?`0${e}`:e,n;switch(s){case"grad":n=parseFloat(r)*x;break;case"rad":n=parseFloat(r)*a;break;case"turn":n=parseFloat(r)*q;break;default:n=parseFloat(r)}return n%=q,n<0&&(n+=q),n},Xt=t=>{let[x,a,o]=J(t,{maxLength:nt,maxRange:M}),e=x/M,s=a/M,r=o/M,n=.04045;return e>n?e=Math.pow((e+v)/(1+v),bt):e/=Ft,s>n?s=Math.pow((s+v)/(1+v),bt):s/=Ft,r>n?r=Math.pow((r+v)/(1+v),bt):r/=Ft,[e,s,r]},Wt=t=>{let[x,a,o,e]=J(t,{alpha:!0,maxRange:M}),[s,r,n]=Xt([x,a,o]),[l,h,i]=O(Nt,[s,r,n]);return[l,h,i,e]};var _t=t=>{let[x,a,o,e]=J(t,{alpha:!0,maxRange:M}),s=ot(x),r=ot(a),n=ot(o),l=ot(e*M),h;return l==="ff"?h=`#${s}${r}${n}`:h=`#${s}${r}${n}${l}`,h},Pt=t=>{let[x,a,o]=J(t,{maxLength:nt}),e=809/258400;return x>e?x=Math.pow(x,1/bt)*(1+v)-v:x*=Ft,a>e?a=Math.pow(a,1/bt)*(1+v)-v:a*=Ft,o>e?o=Math.pow(o,1/bt)*(1+v)-v:o*=Ft,[Math.round(x*M),Math.round(a*M),Math.round(o*M)]},we=t=>{let[x,a,o,e]=J(t,{minLength:K});[x,a,o]=Pt([x,a,o]);let s=ot(x),r=ot(a),n=ot(o),l=ot(e*M),h;return l==="ff"?h=`#${s}${r}${n}`:h=`#${s}${r}${n}${l}`,h},re=t=>{let[x,a,o,e]=J(t,{minLength:K,validateRange:!1}),[s,r,n]=O(Lt,[x,a,o]);return we([Math.min(Math.max(s,0),1),Math.min(Math.max(r,0),1),Math.min(Math.max(n,0),1),e])};var at=t=>{let[x,a,o,e]=J(t,{validateRange:!1}),[s,r,n]=O(Lt,[x,a,o]);return[s,r,n]=Pt([Math.min(Math.max(s,0),1),Math.min(Math.max(r,0),1),Math.min(Math.max(n,0),1)]),[s,r,n,e]},oe=t=>{let[x,a,o,e]=J(t,{validateRange:!1}),[s,r,n]=O(tt,[x,a,o]);return[s,r,n,e]},xt=t=>{let[x,a,o,e]=at(t),s=x/M,r=a/M,n=o/M,l=Math.max(s,r,n),h=Math.min(s,r,n),i=l-h,E=(l+h)*et*R,c,A;if(Math.round(E)===0||Math.round(E)===R)c=b,A=b;else if(A=i/(1-Math.abs(l+h-1))*R,A===0)c=b;else{switch(l){case s:c=(r-n)/i;break;case r:c=(n-s)/i+$t;break;case n:default:c=(s-r)/i+K;break}c=c*rt%q,c<0&&(c+=q)}return[c,A,E,e]},ht=t=>{let[x,a,o,e]=at(t),s=Math.min(x,a,o)/M,r=1-Math.max(x,a,o)/M,n;return s+r===1?n=b:[n]=xt(t),[n,s*R,r*R,e]},lt=t=>{let[x,a,o,e]=J(t,{validateRange:!1}),r=O(fe,[x,a,o]).map(E=>Math.cbrt(E)),[n,l,h]=O(he,r);n=Math.min(Math.max(n,0),1);let i=Math.round(parseFloat(n.toFixed(K))*R);return(i===0||i===R)&&(l=b,h=b),[n,l,h,e]},pt=t=>{let[x,a,o,e]=lt(t),s,r,n=Math.round(parseFloat(x.toFixed(K))*R);return n===0||n===R?(s=b,r=b):(s=Math.max(Math.sqrt(Math.pow(a,Tt)+Math.pow(o,Tt)),0),parseFloat(s.toFixed(K))===0?r=b:(r=Math.atan2(o,a)*q*et/Math.PI,r<0&&(r+=q))),[x,s,r,e]},ne=t=>{let[x,a,o,e]=J(t,{minLength:K,validateRange:!1}),s=O(wt,[x,a,o]),[r,n,l]=at(s);return[r,n,l,e]},ct=t=>{let[x,a,o,e]=J(t,{validateRange:!1}),s=[x,a,o].map((c,A)=>c/jt[A]),[r,n,l]=s.map(c=>c>Dt?Math.cbrt(c):(c*Mt+G)/yt),h=Math.min(Math.max(yt*n-G,0),R),i,E;return h===0||h===R?(i=b,E=b):(i=(r-n)*Zt,E=(n-l)*Ut),[h,i,E,e]},gt=t=>{let[x,a,o,e]=ct(t),s,r;return x===0||x===R?(s=b,r=b):(s=Math.max(Math.sqrt(Math.pow(a,Tt)+Math.pow(o,Tt)),0),parseFloat(s.toFixed(K))===0?r=b:(r=Math.atan2(o,a)*q*et/Math.PI,r<0&&(r+=q))),[x,s,r,e]},ut=t=>{if(Y(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${L(t)}.`);if(!(/^#[\da-f]{6}$/.test(t)||/^#[\da-f]{3}$/.test(t)||/^#[\da-f]{8}$/.test(t)||/^#[\da-f]{4}$/.test(t)))throw new Error(`Invalid property value: ${t}`);let x=[];if(/^#[\da-f]{6}$/.test(t)){let[,a,o,e]=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/);x.push(parseInt(a,G),parseInt(o,G),parseInt(e,G),1)}else if(/^#[\da-f]{3}$/.test(t)){let[,a,o,e]=t.match(/^#([\da-f])([\da-f])([\da-f])$/);x.push(parseInt(`${a}${a}`,G),parseInt(`${o}${o}`,G),parseInt(`${e}${e}`,G),1)}else if(/^#[\da-f]{8}$/.test(t)){let[,a,o,e,s]=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})$/);x.push(parseInt(a,G),parseInt(o,G),parseInt(e,G),parseInt(s,G)/M)}else if(/^#[\da-f]{4}$/.test(t)){let[,a,o,e,s]=t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/);x.push(parseInt(`${a}${a}`,G),parseInt(`${o}${o}`,G),parseInt(`${e}${e}`,G),parseInt(`${s}${s}`,G)/M)}return x},de=t=>{let[x,a,o,e]=ut(t),[s,r,n]=Xt([x,a,o]);return[s,r,n,e]},Ee=t=>{let[x,a,o,e]=de(t),[s,r,n]=O(Nt,[x,a,o]);return[s,r,n,e]},it=t=>{if(Y(t))if(t=t.trim(),!t)t=1;else if(t===b)t=0;else{if(t.startsWith(".")&&(t=`0${t}`),t.endsWith("%")?t=parseFloat(t)/R:t=parseFloat(t),Number.isNaN(t))throw new TypeError(`${t} is not a number.`);(t<0||t>1)&&(t=Math.min(Math.max(t,0),1))}else t=1;return t},ae=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^rgba?\\(\\s*(${kt}|${ee})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let[,a]=t.match(x),[o,e,s,r]=a.replace(/[,/]/g," ").split(/\s+/);return o===b?o=0:(o.startsWith(".")&&(o=`0${o}`),o.endsWith("%")?o=parseFloat(o)*M/R:o=parseFloat(o)),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)*M/R:e=parseFloat(e)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*M/R:s=parseFloat(s)),r=it(r),[Math.min(Math.max(o,0),M),Math.min(Math.max(e,0),M),Math.min(Math.max(s,0),M),r]},St=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^hsla?\\(\\s*(${dt}|${te})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let[,a]=t.match(x),[o,e,s,r]=a.replace(/[,/]/g," ").split(/\s+/);o===b?o=0:o=Ct(o),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=Math.min(Math.max(parseFloat(e),0),R)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s=Math.min(Math.max(parseFloat(s),0),R)),r=it(r);let n,l;s<R*et?(n=(s+s*(e/R))*M/R,l=(s-s*(e/R))*M/R):(n=(s+(R-s)*(e/R))*M/R,l=(s-(R-s)*(e/R))*M/R);let h=(n-l)/rt,i,E,c;return o>=0&&o<rt?(i=n,E=o*h+l,c=l):o<rt*$t?(i=(rt*$t-o)*h+l,E=n,c=l):o<q*et?(i=l,E=n,c=(o-rt*$t)*h+l):o<rt*K?(i=l,E=(rt*K-o)*h+l,c=n):o<q-rt?(i=(o-rt*K)*h+l,E=l,c=n):o<q&&(i=n,E=l,c=(q-o)*h+l),[Math.min(Math.max(i,0),M),Math.min(Math.max(E,0),M),Math.min(Math.max(c,0),M),r]},ie=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^hwb\\(\\s*(${dt})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let[,a]=t.match(x),[o,e,s,r]=a.replace("/"," ").split(/\s+/);o===b?o=0:o=Ct(o),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=Math.min(Math.max(parseFloat(e),0),R)/R),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s=Math.min(Math.max(parseFloat(s),0),R)/R),r=it(r);let n=[];if(e+s>=1){let l=e/(e+s)*M;n.push(l,l,l,r)}else{let[l,h,i]=St(`hsl(${o} 100% 50%)`),E=(1-e-s)/M;n.push((l*E+e)*M,(h*E+e)*M,(i*E+e)*M,r)}return n},Ht=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^lab\\(\\s*(${Et})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let a=1.25,o=8,[,e]=t.match(x),[s,r,n,l]=e.replace("/"," ").split(/\s+/);s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?(s=parseFloat(s),s>R&&(s=R)):s=parseFloat(s),s<0&&(s=0)),r===b?r=0:(r.startsWith(".")&&(r=`0${r}`),r.endsWith("%")?r=parseFloat(r)*a:r=parseFloat(r)),n===b?n=0:n.endsWith("%")?n=parseFloat(n)*a:n=parseFloat(n),l=it(l);let h=(s+G)/yt,i=r/Zt+h,E=h-n/Ut,c=Math.pow(h,mt),A=Math.pow(i,mt),p=Math.pow(E,mt),$=[A>Dt?A:(i*yt-G)/Mt,s>o?c:s/Mt,p>Dt?p:(E*yt-G)/Mt],[W,X,I]=$.map((S,w)=>S*jt[w]);return[W,X,I,l]},xe=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^lch\\(\\s*(${It})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let a=1.5,[,o]=t.match(x),[e,s,r,n]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*a:s=parseFloat(s)),r===b?r=0:r=Ct(r),n=it(n);let l=s*Math.cos(r*Math.PI/(q*et)),h=s*Math.sin(r*Math.PI/(q*et)),[i,E,c]=Ht(`lab(${e} ${l} ${h})`);return[i,E,c,n]},le=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^oklab\\(\\s*(${Et})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let a=.4,[,o]=t.match(x),[e,s,r,n]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)/R:e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*a/R:s=parseFloat(s)),r===b?r=0:r.endsWith("%")?r=parseFloat(r)*a/R:r=parseFloat(r),n=it(n);let h=O(Qt,[e,s,r]).map(A=>Math.pow(A,mt)),[i,E,c]=O(Kt,h);return[i,E,c,n]},ce=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x=new RegExp(`^oklch\\(\\s*(${Et})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);let a=.4,[,o]=t.match(x),[e,s,r,n]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)/R:e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*a/R:s=parseFloat(s),s<0&&(s=0)),r===b?r=0:r=Ct(r),n=it(n);let l=s*Math.cos(r*Math.PI/(q*et)),h=s*Math.sin(r*Math.PI/(q*et)),E=O(Qt,[e,l,h]).map($=>Math.pow($,mt)),[c,A,p]=O(Kt,E);return[c,A,p,n]},V=(t,x=!1)=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let a=new RegExp(`^color\\(\\s*(${zt})\\s*\\)$`);if(!a.test(t))throw new Error(`Invalid property value: ${t}`);let[,o]=t.match(a),[e,s,r,n,l]=o.replace("/"," ").split(/\s+/),h,i,E;if(s===b)h=0;else{let W;s.startsWith(".")?W=`0${s}`:W=s,h=W.endsWith("%")?parseFloat(W)/R:parseFloat(W)}if(r===b)i=0;else{let W;r.startsWith(".")?W=`0${r}`:W=r,i=W.endsWith("%")?parseFloat(W)/R:parseFloat(W)}if(n===b)E=0;else{let W;n.startsWith(".")?W=`0${n}`:W=n,E=W.endsWith("%")?parseFloat(W)/R:parseFloat(W)}let c=it(l),A,p,$;if(e==="srgb")[A,p,$]=Wt([h*M,i*M,E*M]),x&&([A,p,$]=O(tt,[A,p,$]));else if(e==="srgb-linear")[A,p,$]=O(Nt,[h,i,E]),x&&([A,p,$]=O(tt,[A,p,$]));else if(e==="display-p3"){let W=Xt([h*M,i*M,E*M]);[A,p,$]=O(pe,W),x&&([A,p,$]=O(tt,[A,p,$]))}else if(e==="rec2020"){let W=1.09929682680944,X=.018053968510807,I=.45,S=[h,i,E].map(w=>{let f;return w<X*I*qt?f=w/(I*qt):f=Math.pow((w+W-1)/W,1/I),f});[A,p,$]=O(ge,S),x&&([A,p,$]=O(tt,[A,p,$]))}else if(e==="a98-rgb"){let W=2.19921875,X=[h,i,E].map(I=>Math.pow(I,W));[A,p,$]=O($e,X),x&&([A,p,$]=O(tt,[A,p,$]))}else if(e==="prophoto-rgb"){let X=[h,i,E].map(I=>{let S;return I>1/(G*$t)?S=Math.pow(I,1.8):S=I/G,S});[A,p,$]=O(be,X),x||([A,p,$]=O(wt,[A,p,$]))}else/^xyz(?:-d(?:50|65))?$/.test(e)&&([A,p,$]=[h,i,E],e==="xyz-d50"?x||([A,p,$]=O(wt,[A,p,$])):x&&([A,p,$]=O(tt,[A,p,$])));return[A,p,$,c]},U=(t,x=!1)=>{if(Y(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let a,o,e,s;if(H.test(t))a=0,o=0,e=0,s=0;else if(/^[a-z]+$/.test(t))if(Object.prototype.hasOwnProperty.call(Rt,t)){let[r,n,l]=Rt[t];s=1,[a,o,e]=Wt([r,n,l]),x&&([a,o,e]=O(tt,[a,o,e]))}else if(t==="transparent")a=0,o=0,e=0,s=0;else throw new Error(`Invalid property value: ${t}`);else if(t.startsWith("#")){let r;if(/^#[\da-f]{6}$/.test(t))r=t;else if(/^#[\da-f]{3}$/.test(t)){let[,n,l,h]=t.match(/^#([\da-f])([\da-f])([\da-f])$/);r=`#${n}${n}${l}${l}${h}${h}`}else if(/^#[\da-f]{8}$/.test(t))r=t;else if(/^#[\da-f]{4}$/.test(t)){let[,n,l,h,i]=t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/);r=`#${n}${n}${l}${l}${h}${h}${i}${i}`}else throw new Error(`Invalid property value: ${t}`);[a,o,e,s]=Ee(r),x&&([a,o,e]=O(tt,[a,o,e]))}else if(t.startsWith("lab"))[a,o,e,s]=Ht(t),x||([a,o,e]=O(wt,[a,o,e]));else if(t.startsWith("lch"))[a,o,e,s]=xe(t),x||([a,o,e]=O(wt,[a,o,e]));else if(t.startsWith("oklab"))[a,o,e,s]=le(t),x&&([a,o,e]=O(tt,[a,o,e]));else if(t.startsWith("oklch"))[a,o,e,s]=ce(t),x&&([a,o,e]=O(tt,[a,o,e]));else{let r,n,l;if(t.startsWith("rgb"))[r,n,l,s]=ae(t);else if(t.startsWith("hsl"))[r,n,l,s]=St(t);else if(t.startsWith("hwb"))[r,n,l,s]=ie(t);else throw new Error(`Invalid property value: ${t}`);[a,o,e]=Wt([r,n,l]),x&&([a,o,e]=O(tt,[a,o,e]))}return[a,o,e,s]},Ot=(t,x={})=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let{alpha:a}=x,o,e,s,r;t.startsWith("color(")?[o,e,s,r]=V(t):[o,e,s,r]=U(t);let[n,l,h]=O(Lt,[o,e,s]);n=Math.min(Math.max(n,0),1),l=Math.min(Math.max(l,0),1),h=Math.min(Math.max(h,0),1);let i=[n,l,h];return a?i.push(r):i.push(1),i},At=t=>{let[x,a,o,e]=Ot(t,{alpha:!0});return[x,a,o]=Pt([x,a,o]),[x,a,o,e]},ft=t=>{if(Y(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let x,a,o,e;if(H.test(t))x=0,a=0,o=0,e=0;else if(/^[a-z]+$/i.test(t))Object.prototype.hasOwnProperty.call(Rt,t)?([x,a,o]=Rt[t],e=1):t==="transparent"&&(x=0,a=0,o=0,e=0);else if(t.startsWith("#"))[x,a,o,e]=ut(t);else if(/^l(?:ab|ch)/.test(t)){let r,n,l;t.startsWith("lab")?[r,n,l,e]=Ht(t):[r,n,l,e]=xe(t),[x,a,o,e]=ne([r,n,l,e])}else if(/^okl(?:ab|ch)/.test(t)){let r,n,l;t.startsWith("oklab")?[r,n,l,e]=le(t):[r,n,l,e]=ce(t),[x,a,o,e]=at([r,n,l,e])}else t.startsWith("rgb")?[x,a,o,e]=ae(t):t.startsWith("hsl")?[x,a,o,e]=St(t):t.startsWith("hwb")&&([x,a,o,e]=ie(t));let s;return isNaN(x)||isNaN(a)||isNaN(o)||isNaN(e)?s=[]:s=[Math.round(x),Math.round(a),Math.round(o),e],s},Gt=t=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);if(!new RegExp(`^color\\(\\s*${zt}\\s*\\)$`).test(t))throw new Error(`Invalid property value: ${t}`);let[a,o,e,s]=V(t),[r,n,l]=at([a,o,e]);return[r,n,l,s]},Yt=(t,x={})=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let a=new RegExp(`^${ye}$`,"i");if(!a.test(t))throw new Error(`Invalid property value: ${t}`);let o="lch(none none none / none)",e="rgb(none none none / none)",s=new RegExp(`^(${se})(?:\\s+(${j}))?$`,"i"),r=new RegExp(b),[,n,l,h]=t.match(a),[,i,E]=l.match(s),[,c,A]=h.match(s),p,$,W;if(E&&A){let f=parseFloat(E)/R,g=parseFloat(A)/R;if(f<0||f>1)throw new RangeError(`${E} is not between 0% and 100%.`);if(g<0||g>1)throw new RangeError(`${A} is not between 0% and 100%.`);let d=f+g;if(d===0)throw new Error(`Invalid property value: ${t}`);p=f/d,$=g/d,W=d<1?d:1}else{if(E){if(p=parseFloat(E)/R,p<0||p>1)throw new RangeError(`${E} is not between 0% and 100%.`);$=1-p}else if(A){if($=parseFloat(A)/R,$<0||$>1)throw new RangeError(`${A} is not between 0% and 100%.`);p=1-$}else p=et,$=et;W=1}let X,I,S,w;if(n==="srgb"){let f=At(i,{alpha:!0}),g=At(c,{alpha:!0});H.test(i)?f=C(e,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(e,g):r.test(c)&&(g=C(c,g));let[[d,m,F,z],[T,y,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B,w===0?(X=d*p+T*$,I=m*p+y*$,S=F*p+D*$):(X=(d*_+T*B)/w,I=(m*_+y*B)/w,S=(F*_+D*B)/w)}else if(n==="srgb-linear"){let f=Ot(i,{alpha:!0}),g=Ot(c,{alpha:!0});H.test(i)?f=C(e,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(e,g):r.test(c)&&(g=C(c,g));let[[d,m,F,z],[T,y,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B,w===0?(X=(d*p+T*$)*M,I=(m*p+y*$)*M,S=(F*p+D*$)*M):(X=(d*_+T*B)*w*M,I=(m*_+y*B)*w*M,S=(F*_+D*B)*w*M)}else if(/^xyz(?:-d65)?$/.test(n)){let f,g;i.startsWith("color(")?f=V(i):f=U(i),c.startsWith("color(")?g=V(c):g=U(c),H.test(i)?f=C(e,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(e,g):r.test(c)&&(g=C(c,g));let[[d,m,F,z],[T,y,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B;let N,u,P;w===0?(N=d*p+T*$,u=m*p+y*$,P=F*p+D*$):(N=(d*_+T*B)*w,u=(m*_+y*B)*w,P=(F*_+D*B)*w),[X,I,S]=at([N,u,P])}else if(n==="xyz-d50"){let f,g;i.startsWith("color(")?f=V(i,!0):f=U(i,!0),c.startsWith("color(")?g=V(c,!0):g=U(c,!0),H.test(i)?f=C(e,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(e,g):r.test(c)&&(g=C(c,g));let[[d,m,F,z],[T,y,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B;let N,u,P;w===0?(N=d*p+T*$,u=m*p+y*$,P=F*p+D*$):(N=(d*_+T*B)*w,u=(m*_+y*B)*w,P=(F*_+D*B)*w),[X,I,S]=ne([N,u,P,w])}else if(n==="hsl"){let f,g,d,m;if(i.startsWith("color(")){let u=V(i);[f,g,d,m]=xt(u)}else{let u=U(i);[f,g,d,m]=xt(u)}let F,z,T,y;if(c.startsWith("color(")){let u=V(c);[F,z,T,y]=xt(u)}else{let u=U(c);[F,z,T,y]=xt(u)}H.test(i)?[d,g,f,m]=C(o,[d,g,f,m]):r.test(i)&&([d,g,f,m]=C(i,[d,g,f,m])),H.test(c)?[T,z,F,y]=C(o,[T,z,F,y]):r.test(c)&&([T,z,F,y]=C(c,[T,z,F,y])),[[f,g,d,m],[F,z,T,y]]=st([f,g,d,m],[F,z,T,y]);let D=m*p,k=y*$;w=D+k;let _=(f*p+F*$)%q,B,N;w===0?(B=g*p+z*$,N=d*p+T*$):(B=(g*D+z*k)/w,N=(d*D+T*k)/w),[X,I,S]=At(`hsl(${_} ${B}% ${N}%)`)}else if(n==="hwb"){let f,g,d,m;if(i.startsWith("color(")){let P=V(i);[f,g,d,m]=ht(P)}else{let P=U(i);[f,g,d,m]=ht(P)}let F,z,T,y;if(c.startsWith("color(")){let P=V(c);[F,z,T,y]=ht(P)}else{let P=U(c);[F,z,T,y]=ht(P)}H.test(i)?[,,f,m]=C(o,[null,null,f,m]):r.test(i)&&([,,f,m]=C(i,[null,null,f,m])),H.test(c)?[,,F,y]=C(o,[null,null,F,y]):r.test(c)&&([,,F,y]=C(c,[null,null,F,y])),[[f,g,d,m],[F,z,T,y]]=st([f,g,d,m],[F,z,T,y]);let D=m*p,k=y*$;w=D+k;let _=(f*p+F*$)%q,B,N;w===0?(B=g*p+z*$,N=d*p+T*$):(B=(g*D+z*k)/w,N=(d*D+T*k)/w),[X,I,S]=At(`hwb(${_} ${B}% ${N}%)`)}else if(n==="lab"){let f,g,d,m;if(i.startsWith("color(")){let u=V(i,!0);[f,g,d,m]=ct(u)}else{let u=U(i,!0);[f,g,d,m]=ct(u)}let F,z,T,y;if(c.startsWith("color(")){let u=V(c,!0);[F,z,T,y]=ct(u)}else{let u=U(c,!0);[F,z,T,y]=ct(u)}H.test(i)?[f,,,m]=C(o,[f,null,null,m]):r.test(i)&&([f,,,m]=C(i,[f,null,null,m])),H.test(c)?[F,,,y]=C(o,[F,null,null,y]):r.test(c)&&([F,,,y]=C(c,[F,null,null,y])),[[f,g,d,m],[F,z,T,y]]=st([f,g,d,m],[F,z,T,y]);let D=m*p,k=y*$;w=D+k;let _,B,N;w===0?(_=f*p+F*$,B=g*p+z*$,N=d*p+T*$):(_=(f*D+F*k)*w,B=(g*D+z*k)*w,N=(d*D+T*k)*w),[X,I,S]=ft(`lab(${_} ${B} ${N})`)}else if(n==="lch"){let f,g;if(i.startsWith("color(")){let Q=V(i,!0);f=gt(Q)}else{let Q=U(i,!0);f=gt(Q)}if(c.startsWith("color(")){let Q=V(c,!0);g=gt(Q)}else{let Q=U(c,!0);g=gt(Q)}H.test(i)?f=C(o,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(o,g):r.test(c)&&(g=C(c,g));let[[d,m,F,z],[T,y,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B;let N,u,P;w===0?(N=d*p+T*$,u=m*p+y*$,P=F*p+D*$):(N=(d*_+T*B)*w,u=(m*_+y*B)*w,P=(F*_+D*B)*w),[X,I,S]=ft(`lch(${N} ${u} ${P})`)}else if(n==="oklab"){let f,g,d,m;if(i.startsWith("color(")){let u=V(i);[f,g,d,m]=lt(u)}else{let u=U(i);[f,g,d,m]=lt(u)}let F,z,T,y;if(c.startsWith("color(")){let u=V(c);[F,z,T,y]=lt(u)}else{let u=U(c);[F,z,T,y]=lt(u)}H.test(i)?[f,,,m]=C(o,[f,null,null,m]):r.test(i)&&([f,,,m]=C(i,[f,null,null,m])),H.test(c)?[f,,,y]=C(o,[F,null,null,y]):r.test(c)&&([F,,,y]=C(c,[F,null,null,y])),[[f,g,d,m],[F,z,T,y]]=st([f,g,d,m],[F,z,T,y]);let D=m*p,k=y*$;w=D+k;let _,B,N;w===0?(_=f*p+F*$,B=g*p+z*$,N=d*p+T*$):(_=(f*D+F*k)*w,B=(g*D+z*k)*w,N=(d*D+T*k)*w),[X,I,S]=ft(`oklab(${_} ${B} ${N})`)}else if(n==="oklch"){let f,g;if(i.startsWith("color(")){let Q=V(i,!0);f=pt(Q)}else{let Q=U(i,!0);f=pt(Q)}if(c.startsWith("color(")){let Q=V(c,!0);g=pt(Q)}else{let Q=U(c,!0);g=pt(Q)}H.test(i)?f=C(o,f):r.test(i)&&(f=C(i,f)),H.test(c)?g=C(o,g):r.test(c)&&(g=C(c,g)),r.test(i)&&(f=C(i,f)),r.test(c)&&(g=C(c,g));let[[d,m,F,z],[T,y,D,k]]=st(f,g),_=z*p,B=k*$;w=_+B;let N,u,P;w===0?(N=d*p+T*$,u=m*p+y*$,P=F*p+D*$):(N=(d*_+T*B)*w,u=(m*_+y*B)*w,P=(F*_+D*B)*w),[X,I,S]=ft(`oklch(${N} ${u} ${P})`)}return[X,I,S,w*W]};var ze=(t,x={})=>{if(Y(t))t=t.trim();else throw new TypeError(`Expected String but got ${L(t)}.`);let{currentColor:a,format:o,key:e}=x,s,r,n,l;/^currentcolor$/i.test(t)?a?a.startsWith("color-mix")?[s,r,n,l]=Yt(a):a.startsWith("color(")?[s,r,n,l]=Gt(a):[s,r,n,l]=ft(a):(s=0,r=0,n=0,l=0):/^transparent$/i.test(t)?(s=0,r=0,n=0,l=0):t.startsWith("color-mix")?[s,r,n,l]=Yt(t):t.startsWith("color(")?[s,r,n,l]=Gt(t):[s,r,n,l]=ft(t);let h;switch(o){case"array":{e?h=[e,[s,r,n,l]]:h=[s,r,n,l];break}case"hex":{let i;/^transparent$/i.test(t)||isNaN(s)||isNaN(r)||isNaN(n)?i=null:i=_t([s,r,n]),e?h=[e,i]:h=i;break}case"hexAlpha":{let i;/^transparent$/i.test(t)?i="#00000000":isNaN(s)||isNaN(r)||isNaN(n)||isNaN(l)?i=null:i=_t([s,r,n,l]),e?h=[e,i]:h=i;break}default:{let i;isNaN(s)||isNaN(r)||isNaN(n)||isNaN(l)?i="":(s=Math.round(s),r=Math.round(r),n=Math.round(n),l===1?i=`rgb(${s}, ${r}, ${n})`:i=`rgba(${s}, ${r}, ${n}, ${l})`),e?h=[e,i]:h=i}}return h},Ce=(t,x={})=>{if(Y(t)){if(t=t.trim(),t.startsWith("color-mix("))throw new Error("color-mix() is not supported.")}else throw new TypeError(`Expected String but got ${L(t)}.`);let{d50:a}=x,o;return t.startsWith("color(")?o=V(t,a):o=U(t,a),o},_e={hexToRgb:ut,numberToHex:ot,rgbToHex:_t,xyzD50ToLab:ct,xyzD50ToLch:gt,xyzToHex:re,xyzToHsl:xt,xyzToHwb:ht,xyzToOklab:lt,xyzToOklch:pt,xyzToRgb:at,xyzToXyzD50:oe};export{_e as convert,Ce as parse,ze as resolve};
/*!

@@ -3,0 +3,0 @@ * CSS color - Resolve, parse, convert CSS color.

@@ -51,3 +51,3 @@ {

},
"version": "1.0.3"
"version": "1.0.4"
}

@@ -82,2 +82,24 @@ # CSS color

### convert.numberToHex
Convert number to hex string.
#### Parameters
* `n` **[number][97]** 0..255
Returns **[string][93]** hex string `00`..`ff`
### convert.hexToRgb
Convert hex color to rgb color array.
#### Parameters
* `hex` **[string][93]** `#rrggbbaa`
Returns **[Array][96]<[number][97]>** `[r, g, b, a]` r|g|b: 0..255 a: 0..1
### convert.rgbToHex

@@ -84,0 +106,0 @@

@@ -9,6 +9,7 @@ /*!

import {
convertRgbToHex, convertXyzD50ToLab, convertXyzD50ToLch, convertXyzToHex,
convertXyzToHsl, convertXyzToHwb, convertXyzToOklab, convertXyzToOklch,
convertXyzToRgb, convertXyzToXyzD50, parseColorFunc, parseColorValue,
resolveColorFunc, resolveColorMix, resolveColorValue
convertHexToRgb, convertRgbToHex, convertXyzD50ToLab, convertXyzD50ToLch,
convertXyzToHex, convertXyzToHsl, convertXyzToHwb, convertXyzToOklab,
convertXyzToOklch, convertXyzToRgb, convertXyzToXyzD50, numberToHexString,
parseColorFunc, parseColorValue, resolveColorFunc, resolveColorMix,
resolveColorValue
} from './js/color.js';

@@ -179,2 +180,4 @@ import { getType, isString } from './js/common.js';

export const convert = {
hexToRgb: convertHexToRgb,
numberToHex: numberToHexString,
rgbToHex: convertRgbToHex,

@@ -181,0 +184,0 @@ xyzD50ToLab: convertXyzD50ToLab,

@@ -10,2 +10,4 @@ export function resolve(color: string, opt?: {

export namespace convert {
export { convertHexToRgb as hexToRgb };
export { numberToHexString as numberToHex };
export { convertRgbToHex as rgbToHex };

@@ -22,2 +24,4 @@ export { convertXyzD50ToLab as xyzD50ToLab };

}
import { convertHexToRgb } from './js/color.js';
import { numberToHexString } from './js/color.js';
import { convertRgbToHex } from './js/color.js';

@@ -24,0 +28,0 @@ import { convertXyzD50ToLab } from './js/color.js';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc