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.0 to 1.0.1

4

dist/cjs/index.js

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

var f=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var b=(t,a)=>{for(var r in a)f(t,r,{get:a[r],enumerable:!0})},g=(t,a,r,y)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of z(a))!p.call(t,o)&&o!==r&&f(t,o,{get:()=>a[o],enumerable:!(y=T(a,o))||y.enumerable});return t};var $=t=>g(f({},"__esModule",{value:!0}),t);var X={};b(X,{convert:()=>m,parse:()=>d,resolve:()=>u});module.exports=$(X);var e=require("./js/color.js"),h=require("./js/common.js");/*!
var h=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var p=(t,x)=>{for(var n in x)h(t,n,{get:x[n],enumerable:!0})},b=(t,x,n,y)=>{if(x&&typeof x=="object"||typeof x=="function")for(let l of T(x))!z.call(t,l)&&l!==n&&h(t,l,{get:()=>x[l],enumerable:!(y=N(x,l))||y.enumerable});return t};var g=t=>b(h({},"__esModule",{value:!0}),t);var u={};p(u,{convert:()=>X,parse:()=>m,resolve:()=>$});module.exports=g(u);var e=require("./js/color.js"),f=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 u=(t,a={})=>{if((0,h.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,h.getType)(t)}.`);const{currentColor:r,format:y,key:o}=a;let s,i,n,x;/^currentcolor$/i.test(t)?r?r.startsWith("color-mix")?[s,i,n,x]=(0,e.resolveColorMix)(r):r.startsWith("color(")?[s,i,n,x]=(0,e.resolveColorFunc)(r):[s,i,n,x]=(0,e.resolveColorValue)(r):(s=0,i=0,n=0,x=0):/^transparent$/i.test(t)?(s=0,i=0,n=0,x=0):t.startsWith("color-mix")?[s,i,n,x]=(0,e.resolveColorMix)(t):t.startsWith("color(")?[s,i,n,x]=(0,e.resolveColorFunc)(t):[s,i,n,x]=(0,e.resolveColorValue)(t);let c;switch(y){case"array":{o?c=[o,[s,i,n,x]]:c=[s,i,n,x];break}case"hex":{let l;/^transparent$/i.test(t)?l=null:l=(0,e.convertRgbToHex)([s,i,n]),o?c=[o,l]:c=l;break}case"hexAlpha":{let l;/^transparent$/i.test(t)?l="#00000000":l=(0,e.convertRgbToHex)([s,i,n,x]),o?c=[o,l]:c=l;break}default:{let l;x===1?l=`rgb(${Math.round(s)}, ${Math.round(i)}, ${Math.round(n)})`:l=`rgba(${Math.round(s)}, ${Math.round(i)}, ${Math.round(n)}, ${x})`,o?c=[o,l]:c=l}}return c},d=(t,a={})=>{if((0,h.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,h.getType)(t)}.`);const{d50:r}=a;let y;return t.startsWith("color(")?y=(0,e.parseColorFunc)(t,r):y=(0,e.parseColorValue)(t,r),y},m={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 $=(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={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 kt=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var fe=(t,x)=>{for(var n in x)kt(t,n,{get:x[n],enumerable:!0})},pe=(t,x,n,o)=>{if(x&&typeof x=="object"||typeof x=="function")for(let e of ce(x))!he.call(t,e)&&e!==n&&kt(t,e,{get:()=>x[e],enumerable:!(o=le(x,e))||o.enumerable});return t};var ge=t=>pe(kt({},"__esModule",{value:!0}),t);var ue={};fe(ue,{angleToDeg:()=>wt,convertColorValueToLinearRgb:()=>Lt,convertColorValueToRgb:()=>At,convertHexToLinearRgb:()=>xe,convertHexToRgb:()=>Ht,convertHexToXyz:()=>ie,convertLinearRgbToHex:()=>St,convertLinearRgbToRgb:()=>Dt,convertRgbToHex:()=>Re,convertRgbToLinearRgb:()=>ut,convertRgbToXyz:()=>mt,convertRgbToXyzD50:()=>Me,convertXyzD50ToHex:()=>Ce,convertXyzD50ToLab:()=>pt,convertXyzD50ToLch:()=>yt,convertXyzD50ToRgb:()=>Gt,convertXyzToHex:()=>Be,convertXyzToHsl:()=>ht,convertXyzToHwb:()=>dt,convertXyzToOklab:()=>ft,convertXyzToOklch:()=>Et,convertXyzToRgb:()=>at,convertXyzToXyzD50:()=>Te,normalizeColorComponents:()=>et,numberToHexString:()=>ot,parseAlpha:()=>nt,parseColorFunc:()=>U,parseColorValue:()=>j,parseHsl:()=>Wt,parseHwb:()=>qt,parseLab:()=>Ot,parseLch:()=>Zt,parseOklab:()=>Ut,parseOklch:()=>Vt,parseRgb:()=>Yt,reInsertMissingColorComponents:()=>z,resolveColorFunc:()=>_e,resolveColorMix:()=>ze,resolveColorValue:()=>Mt,transformMatrix:()=>W,validateColorComponents:()=>K});module.exports=ge(ue);var T=require("./common.js");const tt=.5,xt=2,rt=3,V=4,jt=10,G=16,Y=360,st=60,B=100,M=255,Rt=2,gt=3,it=2.4,lt=12.92,v=.055,$t=116,Kt=500,Qt=200,It=216/24389,Bt=24389/27,Jt=[.3457/.3585,1,(1-.3457-.3585)/.3585],ct=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],J=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],Pt=[[506752/1228815,87881/245763,12673/70218],[87098/409605,175762/245763,12673/175545],[7918/409605,87881/737289,1001167/1053270]],Ct=[[12831/3959,-329/214,-1974/3959],[-851781/878810,1648619/878810,36519/878810],[705/12673,-2585/12673,705/667]],$e=[[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]],vt=[[1.2268798733741557,-.5578149965554813,.28139105017721583],[-.04057576262431372,1.1122868293970594,-.07171106666151701],[-.07637294974672142,-.4214933239627914,1.5869240244272418]],te=[[.9999999984505196,.39633779217376774,.2158037580607588],[1.0000000088817607,-.10556134232365633,-.0638541747717059],[1.0000000546724108,-.08948418209496574,-1.2914855378640917]],be=[[.2104542553,.793617785,-.0040720468],[1.9779984951,-2.428592205,.4505937099],[.0259040371,.7827717662,-.808675766]],Fe=[[608311/1250200,189793/714400,198249/1000160],[35783/156275,247089/357200,198249/2500400],[0,32229/714400,5220557/5000800]],we=[[63426534/99577255,20160776/139408157,47086771/278816314],[26158966/99577255,472592308/697040785,8267143/139408157],[0,19567812/697040785,295819943/278816314]],me=[[573536/994567,263643/1420810,187206/994567],[591459/1989134,6239551/9945670,374412/4972835],[53769/1989134,351524/4972835,4929758/4972835]],de=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],b="none",Tt="deg|g?rad|turn",ee="srgb(?:-linear)?",se="xyz(?:-d(?:50|65))?",Ee=`(?:ok)?l(?:ab|ch)|h(?:sl|wb)|${ee}|${se}`,ye=`(?:a98|prophoto)-rgb|display-p3|rec2020|${ee}`,q="[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?",Z=`${q}%`,bt=`(?:${q}(?:${Tt})?|${b})(?:\\s+(?:${Z}|${b})){2}(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,re=`${q}(?:${Tt})?(?:\\s*,\\s*${Z}){2}(?:\\s*,\\s*(?:${q}|${Z}))?`,Xt=`(?:(?:${q}|${b})(?:\\s+(?:${q}|${b})){2}|(?:${Z}|${b})(?:\\s+(?:${Z}|${b})){2})(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,oe=`(?:${q}(?:\\s*,\\s*${q}){2}|${Z}(?:\\s*,\\s*${Z}){2})(?:\\s*,\\s*(?:${q}|${Z}))?`,Ft=`(?:${q}|${Z}|${b})(?:\\s+(?:${q}|${Z}|${b})){2}(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,Nt=`(?:(?:${q}|${Z}|${b})\\s+){2}(?:${q}(?:${Tt})?|${b})(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,_t=`(?:${ye}|${se})(?:\\s+(?:${q}|${Z}|${b})){3}(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,ne=`[a-z]+|#(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})|hsla?\\(\\s*(?:${bt}|${re})\\s*\\)|hwb\\(\\s*${bt}\\s*\\)|rgba?\\(\\s*(?:${Xt}|${oe})\\s*\\)|(?:ok)?lab\\(\\s*${Ft}\\s*\\)|(?:ok)?lch\\(\\s*${Nt}\\s*\\)|color\\(\\s*${_t}\\s*\\)`,ae=`(?:${ne})(?:\\s+${Z})?`,Ae=`color-mix\\(\\s*in\\s+(${Ee})\\s*,\\s*(${ae})\\s*,\\s*(${ae})\\s*\\)`,H=/^currentColor$/i,zt={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]},K=(t,x={})=>{if(!Array.isArray(t))throw new TypeError(`Expected Array but got ${(0,T.getType)(t)}.`);const{alpha:n=!1,minLength:o=rt,maxLength:e=V,minRange:s=0,maxRange:r=1,validateRange:a=!0}=x;if(typeof o!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(o)}.`);if(Number.isNaN(o))throw new TypeError(`${o} is not a number.`);if(typeof e!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(e)}.`);if(Number.isNaN(e))throw new TypeError(`${e} is not a number.`);if(typeof s!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(s)}.`);if(Number.isNaN(s))throw new TypeError(`${s} is not a number.`);if(typeof r!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(r)}.`);if(Number.isNaN(r))throw new TypeError(`${r} is not a number.`);const h=t.length;if(h<o||h>e){let i;throw o===e?i=`Expected array length of ${e} but got ${h}.`:i=`Expected array length of ${o} or ${e} but got ${h}.`,new Error(i)}let g=0;for(;g<h;){const i=t[g];if(typeof i!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(i)}.`);if(Number.isNaN(i))throw new TypeError(`${i} is not a number.`);if(g<rt&&a&&(i<s||i>r))throw new RangeError(`${i} is not between ${s} and ${r}.`);if(g===rt&&(i<0||i>1))throw new RangeError(`${i} is not between 0 and 1.`);g++}return n&&h===rt&&t.push(1),t},W=(t,x)=>{if(Array.isArray(t)){if(t.length!==rt)throw new Error(`Expected array length of 3 but got ${t.length}.`);for(let X of t)X=K(X,{maxLength:rt,validateRange:!1})}else throw new TypeError(`Expected Array but got ${(0,T.getType)(t)}.`);const[[n,o,e],[s,r,a],[h,g,i]]=t,[y,l,A]=K(x,{maxLength:rt,validateRange:!1}),f=n*y+o*l+e*A,$=s*y+r*l+a*A,L=h*y+g*l+i*A;return[f,$,L]},z=(t,x=[])=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const[n,o,e,s]=x;let r,a,h,g;if(/none/.test(t)){const i=new RegExp(`^rgba?\\(\\s*(${Xt})\\s*\\)$`),y=new RegExp(`^color\\(\\s*(${_t})\\s*\\)$`),l=new RegExp(`^h(?:sla?|wb)\\(\\s*(${bt})\\s*\\)$`),A=new RegExp(`^(?:ok)?lab\\(\\s*(${Ft})\\s*\\)$`),f=new RegExp(`^(?:ok)?lch\\(\\s*(${Nt})\\s*\\)$`);i.test(t)?[r,a,h,g]=t.match(i)[1].replace("/"," ").split(/\s+/):y.test(t)?[,r,a,h,g]=t.match(y)[1].replace("/"," ").split(/\s+/):t.startsWith("hsl")&&l.test(t)?[h,a,r,g]=t.match(l)[1].replace("/"," ").split(/\s+/):t.startsWith("hwb")&&l.test(t)?[h,,,g]=t.match(l)[1].replace("/"," ").split(/\s+/):A.test(t)?[r,,,g]=t.match(A)[1].replace("/"," ").split(/\s+/):f.test(t)&&([r,a,h,g]=t.match(f)[1].replace("/"," ").split(/\s+/))}return[r===b?r:n,a===b?a:o,h===b?h:e,g===b?g:s]},et=(t,x)=>{if(Array.isArray(t)){if(t.length!==V)throw new Error(`Expected array length of 4 but got ${t.length}.`)}else throw new TypeError(`Expected Array but got ${(0,T.getType)(t)}.`);if(Array.isArray(x)){if(x.length!==V)throw new Error(`Expected array length of 4 but got ${x.length}.`)}else throw new TypeError(`Expected Array but got ${(0,T.getType)(x)}.`);let n=0;for(;n<V;)t[n]===b&&x[n]===b?(t[n]=0,x[n]=0):t[n]===b?t[n]=x[n]:x[n]===b&&(x[n]=t[n]),n++;return t=K(t,{minLength:V,validateRange:!1}),x=K(x,{minLength:V,validateRange:!1}),[t,x]},ot=t=>{if(typeof t!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(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},wt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=Y/400,n=Y/(Math.PI*xt),o=new RegExp(`^(${q})(${Tt})?$`);if(!o.test(t))throw new Error(`Invalid property value: ${t}`);const[,e,s]=t.match(o),r=e.startsWith(".")?`0${e}`:e;let a;switch(s){case"grad":a=parseFloat(r)*x;break;case"rad":a=parseFloat(r)*n;break;case"turn":a=parseFloat(r)*Y;break;default:a=parseFloat(r)}return a%=Y,a<0&&(a+=Y),a},ut=t=>{const[x,n,o]=K(t,{maxLength:rt,maxRange:M});let e=x/M,s=n/M,r=o/M;const a=.04045;return e>a?e=Math.pow((e+v)/(1+v),it):e/=lt,s>a?s=Math.pow((s+v)/(1+v),it):s/=lt,r>a?r=Math.pow((r+v)/(1+v),it):r/=lt,[e,s,r]},mt=t=>{const[x,n,o,e]=K(t,{alpha:!0,maxRange:M}),[s,r,a]=ut([x,n,o]),[h,g,i]=W(Pt,[s,r,a]);return[h,g,i,e]},Me=t=>{const[x,n,o,e]=mt(t),[s,r,a]=W(J,[x,n,o]);return[s,r,a,e]},Re=t=>{const[x,n,o,e]=K(t,{alpha:!0,maxRange:M}),s=ot(x),r=ot(n),a=ot(o),h=ot(e*M);let g;return h==="ff"?g=`#${s}${r}${a}`:g=`#${s}${r}${a}${h}`,g},Dt=t=>{let[x,n,o]=K(t,{maxLength:rt});const e=809/258400;return x>e?x=Math.pow(x,1/it)*(1+v)-v:x*=lt,n>e?n=Math.pow(n,1/it)*(1+v)-v:n*=lt,o>e?o=Math.pow(o,1/it)*(1+v)-v:o*=lt,[Math.round(x*M),Math.round(n*M),Math.round(o*M)]},St=t=>{let[x,n,o,e]=K(t,{minLength:V});[x,n,o]=Dt([x,n,o]);const s=ot(x),r=ot(n),a=ot(o),h=ot(e*M);let g;return h==="ff"?g=`#${s}${r}${a}`:g=`#${s}${r}${a}${h}`,g},Be=t=>{const[x,n,o,e]=K(t,{minLength:V,validateRange:!1}),[s,r,a]=W(Ct,[x,n,o]);return St([Math.min(Math.max(s,0),1),Math.min(Math.max(r,0),1),Math.min(Math.max(a,0),1),e])},Ce=t=>{const[x,n,o,e]=K(t,{minLength:V,validateRange:!1}),s=W(ct,[x,n,o]),[r,a,h]=W(Ct,s);return St([Math.min(Math.max(r,0),1),Math.min(Math.max(a,0),1),Math.min(Math.max(h,0),1),e])},at=t=>{const[x,n,o,e]=K(t,{validateRange:!1});let[s,r,a]=W(Ct,[x,n,o]);return[s,r,a]=Dt([Math.min(Math.max(s,0),1),Math.min(Math.max(r,0),1),Math.min(Math.max(a,0),1)]),[s,r,a,e]},Te=t=>{const[x,n,o,e]=K(t,{validateRange:!1}),[s,r,a]=W(J,[x,n,o]);return[s,r,a,e]},ht=t=>{const[x,n,o,e]=at(t),s=x/M,r=n/M,a=o/M,h=Math.max(s,r,a),g=Math.min(s,r,a),i=h-g,y=(h+g)*tt*B;let l,A;if(Math.round(y)===0||Math.round(y)===B)l=b,A=b;else if(A=i/(1-Math.abs(h+g-1))*B,A===0)l=b;else{switch(h){case s:l=(r-a)/i;break;case r:l=(a-s)/i+xt;break;case a:default:l=(s-r)/i+V;break}l=l*st%Y,l<0&&(l+=Y)}return[l,A,y,e]},dt=t=>{const[x,n,o,e]=at(t),s=Math.min(x,n,o)/M,r=1-Math.max(x,n,o)/M;let a;return s+r===1?a=b:[a]=ht(t),[a,s*B,r*B,e]},ft=t=>{const[x,n,o,e]=K(t,{validateRange:!1}),r=W($e,[x,n,o]).map(y=>Math.cbrt(y));let[a,h,g]=W(be,r);a=Math.min(Math.max(a,0),1);const i=Math.round(parseFloat(a.toFixed(V))*B);return(i===0||i===B)&&(h=b,g=b),[a,h,g,e]},Et=t=>{const[x,n,o,e]=ft(t);let s,r;const a=Math.round(parseFloat(x.toFixed(V))*B);return a===0||a===B?(s=b,r=b):(s=Math.max(Math.sqrt(Math.pow(n,Rt)+Math.pow(o,Rt)),0),parseFloat(s.toFixed(V))===0?r=b:(r=Math.atan2(o,n)*Y*tt/Math.PI,r<0&&(r+=Y))),[x,s,r,e]},Gt=t=>{const[x,n,o,e]=K(t,{minLength:V,validateRange:!1}),s=W(ct,[x,n,o]),[r,a,h]=at(s);return[r,a,h,e]},pt=t=>{const[x,n,o,e]=K(t,{validateRange:!1}),s=[x,n,o].map((l,A)=>l/Jt[A]),[r,a,h]=s.map(l=>l>It?Math.cbrt(l):(l*Bt+G)/$t),g=Math.min(Math.max($t*a-G,0),B);let i,y;return g===0||g===B?(i=b,y=b):(i=(r-a)*Kt,y=(a-h)*Qt),[g,i,y,e]},yt=t=>{const[x,n,o,e]=pt(t);let s,r;return x===0||x===B?(s=b,r=b):(s=Math.max(Math.sqrt(Math.pow(n,Rt)+Math.pow(o,Rt)),0),parseFloat(s.toFixed(V))===0?r=b:(r=Math.atan2(o,n)*Y*tt/Math.PI,r<0&&(r+=Y))),[x,s,r,e]},Ht=t=>{if((0,T.isString)(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(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}`);const x=[];if(/^#[\da-f]{6}$/.test(t)){const[,n,o,e]=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/);x.push(parseInt(n,G),parseInt(o,G),parseInt(e,G),1)}else if(/^#[\da-f]{3}$/.test(t)){const[,n,o,e]=t.match(/^#([\da-f])([\da-f])([\da-f])$/);x.push(parseInt(`${n}${n}`,G),parseInt(`${o}${o}`,G),parseInt(`${e}${e}`,G),1)}else if(/^#[\da-f]{8}$/.test(t)){const[,n,o,e,s]=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})$/);x.push(parseInt(n,G),parseInt(o,G),parseInt(e,G),parseInt(s,G)/M)}else if(/^#[\da-f]{4}$/.test(t)){const[,n,o,e,s]=t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/);x.push(parseInt(`${n}${n}`,G),parseInt(`${o}${o}`,G),parseInt(`${e}${e}`,G),parseInt(`${s}${s}`,G)/M)}return x},xe=t=>{const[x,n,o,e]=Ht(t),[s,r,a]=ut([x,n,o]);return[s,r,a,e]},ie=t=>{const[x,n,o,e]=xe(t),[s,r,a]=W(Pt,[x,n,o]);return[s,r,a,e]},nt=t=>{if((0,T.isString)(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)/B: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},Yt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^rgba?\\(\\s*(${Xt}|${oe})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const[,n]=t.match(x);let[o,e,s,r]=n.replace(/[,/]/g," ").split(/\s+/);return o===b?o=0:(o.startsWith(".")&&(o=`0${o}`),o.endsWith("%")?o=parseFloat(o)*M/B:o=parseFloat(o)),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)*M/B:e=parseFloat(e)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*M/B:s=parseFloat(s)),r=nt(r),[Math.min(Math.max(o,0),M),Math.min(Math.max(e,0),M),Math.min(Math.max(s,0),M),r]},Wt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^hsla?\\(\\s*(${bt}|${re})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const[,n]=t.match(x);let[o,e,s,r]=n.replace(/[,/]/g," ").split(/\s+/);o===b?o=0:o=wt(o),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=Math.min(Math.max(parseFloat(e),0),B)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s=Math.min(Math.max(parseFloat(s),0),B)),r=nt(r);let a,h;s<B*tt?(a=(s+s*(e/B))*M/B,h=(s-s*(e/B))*M/B):(a=(s+(B-s)*(e/B))*M/B,h=(s-(B-s)*(e/B))*M/B);const g=(a-h)/st;let i,y,l;return o>=0&&o<st?(i=a,y=o*g+h,l=h):o<st*xt?(i=(st*xt-o)*g+h,y=a,l=h):o<Y*tt?(i=h,y=a,l=(o-st*xt)*g+h):o<st*V?(i=h,y=(st*V-o)*g+h,l=a):o<Y-st?(i=(o-st*V)*g+h,y=h,l=a):o<Y&&(i=a,y=h,l=(Y-o)*g+h),[Math.min(Math.max(i,0),M),Math.min(Math.max(y,0),M),Math.min(Math.max(l,0),M),r]},qt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^hwb\\(\\s*(${bt})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const[,n]=t.match(x);let[o,e,s,r]=n.replace("/"," ").split(/\s+/);o===b?o=0:o=wt(o),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=Math.min(Math.max(parseFloat(e),0),B)/B),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s=Math.min(Math.max(parseFloat(s),0),B)/B),r=nt(r);const a=[];if(e+s>=1){const h=e/(e+s)*M;a.push(h,h,h,r)}else{const[h,g,i]=Wt(`hsl(${o} 100% 50%)`),y=(1-e-s)/M;a.push((h*y+e)*M,(g*y+e)*M,(i*y+e)*M,r)}return a},Ot=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^lab\\(\\s*(${Ft})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const n=1.25,o=8,[,e]=t.match(x);let[s,r,a,h]=e.replace("/"," ").split(/\s+/);s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?(s=parseFloat(s),s>B&&(s=B)):s=parseFloat(s),s<0&&(s=0)),r===b?r=0:(r.startsWith(".")&&(r=`0${r}`),r.endsWith("%")?r=parseFloat(r)*n:r=parseFloat(r)),a===b?a=0:a.endsWith("%")?a=parseFloat(a)*n:a=parseFloat(a),h=nt(h);const g=(s+G)/$t,i=r/Kt+g,y=g-a/Qt,l=Math.pow(g,gt),A=Math.pow(i,gt),f=Math.pow(y,gt),$=[A>It?A:(i*$t-G)/Bt,s>o?l:s/Bt,f>It?f:(y*$t-G)/Bt],[L,X,P]=$.map((S,d)=>S*Jt[d]);return[L,X,P,h]},Zt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^lch\\(\\s*(${Nt})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const n=1.5,[,o]=t.match(x);let[e,s,r,a]=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)*n:s=parseFloat(s)),r===b?r=0:r=wt(r),a=nt(a);const h=s*Math.cos(r*Math.PI/(Y*tt)),g=s*Math.sin(r*Math.PI/(Y*tt)),[i,y,l]=Ot(`lab(${e} ${h} ${g})`);return[i,y,l,a]},Ut=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^oklab\\(\\s*(${Ft})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const n=.4,[,o]=t.match(x);let[e,s,r,a]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)/B:e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*n/B:s=parseFloat(s)),r===b?r=0:r.endsWith("%")?r=parseFloat(r)*n/B:r=parseFloat(r),a=nt(a);const g=W(te,[e,s,r]).map(A=>Math.pow(A,gt)),[i,y,l]=W(vt,g);return[i,y,l,a]},Vt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^oklch\\(\\s*(${Ft})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const n=.4,[,o]=t.match(x);let[e,s,r,a]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)/B:e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*n/B:s=parseFloat(s),s<0&&(s=0)),r===b?r=0:r=wt(r),a=nt(a);const h=s*Math.cos(r*Math.PI/(Y*tt)),g=s*Math.sin(r*Math.PI/(Y*tt)),y=W(te,[e,h,g]).map($=>Math.pow($,gt)),[l,A,f]=W(vt,y);return[l,A,f,a]},U=(t,x=!1)=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const n=new RegExp(`^color\\(\\s*(${_t})\\s*\\)$`);if(!n.test(t))throw new Error(`Invalid property value: ${t}`);const[,o]=t.match(n),[e,s,r,a,h]=o.replace("/"," ").split(/\s+/);let g,i,y;if(s===b)g=0;else{let L;s.startsWith(".")?L=`0${s}`:L=s,g=L.endsWith("%")?parseFloat(L)/B:parseFloat(L)}if(r===b)i=0;else{let L;r.startsWith(".")?L=`0${r}`:L=r,i=L.endsWith("%")?parseFloat(L)/B:parseFloat(L)}if(a===b)y=0;else{let L;a.startsWith(".")?L=`0${a}`:L=a,y=L.endsWith("%")?parseFloat(L)/B:parseFloat(L)}const l=nt(h);let A,f,$;if(e==="srgb")[A,f,$]=mt([g*M,i*M,y*M]),x&&([A,f,$]=W(J,[A,f,$]));else if(e==="srgb-linear")[A,f,$]=W(Pt,[g,i,y]),x&&([A,f,$]=W(J,[A,f,$]));else if(e==="display-p3"){const L=ut([g*M,i*M,y*M]);[A,f,$]=W(Fe,L),x&&([A,f,$]=W(J,[A,f,$]))}else if(e==="rec2020"){const L=1.09929682680944,X=.018053968510807,P=.45,S=[g,i,y].map(d=>{let c;return d<X*P*jt?c=d/(P*jt):c=Math.pow((d+L-1)/L,1/P),c});[A,f,$]=W(we,S),x&&([A,f,$]=W(J,[A,f,$]))}else if(e==="a98-rgb"){const L=2.19921875,X=[g,i,y].map(P=>Math.pow(P,L));[A,f,$]=W(me,X),x&&([A,f,$]=W(J,[A,f,$]))}else if(e==="prophoto-rgb"){const X=[g,i,y].map(P=>{let S;return P>1/(G*xt)?S=Math.pow(P,1.8):S=P/G,S});[A,f,$]=W(de,X),x||([A,f,$]=W(ct,[A,f,$]))}else/^xyz(?:-d(?:50|65))?$/.test(e)&&([A,f,$]=[g,i,y],e==="xyz-d50"?x||([A,f,$]=W(ct,[A,f,$])):x&&([A,f,$]=W(J,[A,f,$])));return[A,f,$,l]},j=(t,x=!1)=>{if((0,T.isString)(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);let n,o,e,s;if(H.test(t))n=0,o=0,e=0,s=0;else if(/^[a-z]+$/.test(t))if(Object.prototype.hasOwnProperty.call(zt,t)){const[r,a,h]=zt[t];s=1,[n,o,e]=mt([r,a,h]),x&&([n,o,e]=W(J,[n,o,e]))}else if(t==="transparent")n=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)){const[,a,h,g]=t.match(/^#([\da-f])([\da-f])([\da-f])$/);r=`#${a}${a}${h}${h}${g}${g}`}else if(/^#[\da-f]{8}$/.test(t))r=t;else if(/^#[\da-f]{4}$/.test(t)){const[,a,h,g,i]=t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/);r=`#${a}${a}${h}${h}${g}${g}${i}${i}`}else throw new Error(`Invalid property value: ${t}`);[n,o,e,s]=ie(r),x&&([n,o,e]=W(J,[n,o,e]))}else if(t.startsWith("lab"))[n,o,e,s]=Ot(t),x||([n,o,e]=W(ct,[n,o,e]));else if(t.startsWith("lch"))[n,o,e,s]=Zt(t),x||([n,o,e]=W(ct,[n,o,e]));else if(t.startsWith("oklab"))[n,o,e,s]=Ut(t),x&&([n,o,e]=W(J,[n,o,e]));else if(t.startsWith("oklch"))[n,o,e,s]=Vt(t),x&&([n,o,e]=W(J,[n,o,e]));else{let r,a,h;if(t.startsWith("rgb"))[r,a,h,s]=Yt(t);else if(t.startsWith("hsl"))[r,a,h,s]=Wt(t);else if(t.startsWith("hwb"))[r,a,h,s]=qt(t);else throw new Error(`Invalid property value: ${t}`);[n,o,e]=mt([r,a,h]),x&&([n,o,e]=W(J,[n,o,e]))}return[n,o,e,s]},Lt=(t,x={})=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const{alpha:n}=x;let o,e,s,r;t.startsWith("color(")?[o,e,s,r]=U(t):[o,e,s,r]=j(t);let[a,h,g]=W(Ct,[o,e,s]);a=Math.min(Math.max(a,0),1),h=Math.min(Math.max(h,0),1),g=Math.min(Math.max(g,0),1);const i=[a,h,g];return n?i.push(r):i.push(1),i},At=t=>{let[x,n,o,e]=Lt(t,{alpha:!0});return[x,n,o]=Dt([x,n,o]),[x,n,o,e]},Mt=t=>{if((0,T.isString)(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);let x,n,o,e;if(H.test(t))x=0,n=0,o=0,e=0;else if(/^[a-z]+$/i.test(t))Object.prototype.hasOwnProperty.call(zt,t)?([x,n,o]=zt[t],e=1):t==="transparent"?(x=0,n=0,o=0,e=0):(x=0,n=0,o=0,e=1);else if(t.startsWith("#"))[x,n,o,e]=Ht(t);else if(/^l(?:ab|ch)/.test(t)){let s,r,a;t.startsWith("lab")?[s,r,a,e]=Ot(t):[s,r,a,e]=Zt(t),[x,n,o,e]=Gt([s,r,a,e])}else if(/^okl(?:ab|ch)/.test(t)){let s,r,a;t.startsWith("oklab")?[s,r,a,e]=Ut(t):[s,r,a,e]=Vt(t),[x,n,o,e]=at([s,r,a,e])}else t.startsWith("rgb")?[x,n,o,e]=Yt(t):t.startsWith("hsl")?[x,n,o,e]=Wt(t):t.startsWith("hwb")&&([x,n,o,e]=qt(t));return[Math.round(x),Math.round(n),Math.round(o),e]},_e=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);if(!new RegExp(`^color\\(\\s*${_t}\\s*\\)$`).test(t))throw new Error(`Invalid property value: ${t}`);const[n,o,e,s]=U(t),[r,a,h]=at([n,o,e]);return[r,a,h,s]},ze=(t,x={})=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const n=new RegExp(`^${Ae}$`,"i");if(!n.test(t))throw new Error(`Invalid property value: ${t}`);const o="lch(none none none / none)",e="rgb(none none none / none)",s=new RegExp(`^(${ne})(?:\\s+(${Z}))?$`,"i"),r=new RegExp(b),[,a,h,g]=t.match(n),[,i,y]=h.match(s),[,l,A]=g.match(s);let f,$,L;if(y&&A){const c=parseFloat(y)/B,p=parseFloat(A)/B;if(c<0||c>1)throw new RangeError(`${y} is not between 0% and 100%.`);if(p<0||p>1)throw new RangeError(`${A} is not between 0% and 100%.`);const E=c+p;if(E===0)throw new Error(`Invalid property value: ${t}`);f=c/E,$=p/E,L=E<1?E:1}else{if(y){if(f=parseFloat(y)/B,f<0||f>1)throw new RangeError(`${y} is not between 0% and 100%.`);$=1-f}else if(A){if($=parseFloat(A)/B,$<0||$>1)throw new RangeError(`${A} is not between 0% and 100%.`);f=1-$}else f=tt,$=tt;L=1}let X,P,S,d;if(a==="srgb"){let c=At(i,{alpha:!0}),p=At(l,{alpha:!0});H.test(i)?c=z(e,c):r.test(i)&&(c=z(i,c)),H.test(l)?p=z(e,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(c,p),u=_*f,C=I*$;d=u+C,d===0?(X=E*f+R*$,P=w*f+m*$,S=F*f+O*$):(X=(E*u+R*C)/d,P=(w*u+m*C)/d,S=(F*u+O*C)/d)}else if(a==="srgb-linear"){let c=Lt(i,{alpha:!0}),p=Lt(l,{alpha:!0});H.test(i)?c=z(e,c):r.test(i)&&(c=z(i,c)),H.test(l)?p=z(e,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(c,p),u=_*f,C=I*$;d=u+C,d===0?(X=(E*f+R*$)*M,P=(w*f+m*$)*M,S=(F*f+O*$)*M):(X=(E*u+R*C)*d*M,P=(w*u+m*C)*d*M,S=(F*u+O*C)*d*M)}else if(/^xyz(?:-d65)?$/.test(a)){let c,p;i.startsWith("color(")?c=U(i):c=j(i),l.startsWith("color(")?p=U(l):p=j(l),H.test(i)?c=z(e,c):r.test(i)&&(c=z(i,c)),H.test(l)?p=z(e,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(c,p),u=_*f,C=I*$;d=u+C;let k,D,N;d===0?(k=E*f+R*$,D=w*f+m*$,N=F*f+O*$):(k=(E*u+R*C)*d,D=(w*u+m*C)*d,N=(F*u+O*C)*d),[X,P,S]=at([k,D,N])}else if(a==="xyz-d50"){let c,p;i.startsWith("color(")?c=U(i,!0):c=j(i,!0),l.startsWith("color(")?p=U(l,!0):p=j(l,!0),H.test(i)?c=z(e,c):r.test(i)&&(c=z(i,c)),H.test(l)?p=z(e,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(c,p),u=_*f,C=I*$;d=u+C;let k,D,N;d===0?(k=E*f+R*$,D=w*f+m*$,N=F*f+O*$):(k=(E*u+R*C)*d,D=(w*u+m*C)*d,N=(F*u+O*C)*d),[X,P,S]=Gt([k,D,N,d])}else if(a==="hsl"){let c,p,E,w;if(i.startsWith("color(")){const D=U(i);[c,p,E,w]=ht(D)}else{const D=j(i);[c,p,E,w]=ht(D)}let F,_,R,m;if(l.startsWith("color(")){const D=U(l);[F,_,R,m]=ht(D)}else{const D=j(l);[F,_,R,m]=ht(D)}H.test(i)?[E,p,c,w]=z(o,[E,p,c,w]):r.test(i)&&([E,p,c,w]=z(i,[E,p,c,w])),H.test(l)?[R,_,F,m]=z(o,[R,_,F,m]):r.test(l)&&([R,_,F,m]=z(l,[R,_,F,m])),[[c,p,E,w],[F,_,R,m]]=et([c,p,E,w],[F,_,R,m]);const O=w*f,I=m*$;d=O+I;const u=(c*f+F*$)%Y;let C,k;d===0?(C=p*f+_*$,k=E*f+R*$):(C=(p*O+_*I)/d,k=(E*O+R*I)/d),[X,P,S]=At(`hsl(${u} ${C}% ${k}%)`)}else if(a==="hwb"){let c,p,E,w;if(i.startsWith("color(")){const N=U(i);[c,p,E,w]=dt(N)}else{const N=j(i);[c,p,E,w]=dt(N)}let F,_,R,m;if(l.startsWith("color(")){const N=U(l);[F,_,R,m]=dt(N)}else{const N=j(l);[F,_,R,m]=dt(N)}H.test(i)?[,,c,w]=z(o,[null,null,c,w]):r.test(i)&&([,,c,w]=z(i,[null,null,c,w])),H.test(l)?[,,F,m]=z(o,[null,null,F,m]):r.test(l)&&([,,F,m]=z(l,[null,null,F,m])),[[c,p,E,w],[F,_,R,m]]=et([c,p,E,w],[F,_,R,m]);const O=w*f,I=m*$;d=O+I;const u=(c*f+F*$)%Y;let C,k;d===0?(C=p*f+_*$,k=E*f+R*$):(C=(p*O+_*I)/d,k=(E*O+R*I)/d),[X,P,S]=At(`hwb(${u} ${C}% ${k}%)`)}else if(a==="lab"){let c,p,E,w;if(i.startsWith("color(")){const D=U(i,!0);[c,p,E,w]=pt(D)}else{const D=j(i,!0);[c,p,E,w]=pt(D)}let F,_,R,m;if(l.startsWith("color(")){const D=U(l,!0);[F,_,R,m]=pt(D)}else{const D=j(l,!0);[F,_,R,m]=pt(D)}H.test(i)?[c,,,w]=z(o,[c,null,null,w]):r.test(i)&&([c,,,w]=z(i,[c,null,null,w])),H.test(l)?[F,,,m]=z(o,[F,null,null,m]):r.test(l)&&([F,,,m]=z(l,[F,null,null,m])),[[c,p,E,w],[F,_,R,m]]=et([c,p,E,w],[F,_,R,m]);const O=w*f,I=m*$;d=O+I;let u,C,k;d===0?(u=c*f+F*$,C=p*f+_*$,k=E*f+R*$):(u=(c*O+F*I)*d,C=(p*O+_*I)*d,k=(E*O+R*I)*d),[X,P,S]=Mt(`lab(${u} ${C} ${k})`)}else if(a==="lch"){let c,p;if(i.startsWith("color(")){const Q=U(i,!0);c=yt(Q)}else{const Q=j(i,!0);c=yt(Q)}if(l.startsWith("color(")){const Q=U(l,!0);p=yt(Q)}else{const Q=j(l,!0);p=yt(Q)}H.test(i)?c=z(o,c):r.test(i)&&(c=z(i,c)),H.test(l)?p=z(o,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(c,p),u=_*f,C=I*$;d=u+C;let k,D,N;d===0?(k=E*f+R*$,D=w*f+m*$,N=F*f+O*$):(k=(E*u+R*C)*d,D=(w*u+m*C)*d,N=(F*u+O*C)*d),[X,P,S]=Mt(`lch(${k} ${D} ${N})`)}else if(a==="oklab"){let c,p,E,w;if(i.startsWith("color(")){const D=U(i);[c,p,E,w]=ft(D)}else{const D=j(i);[c,p,E,w]=ft(D)}let F,_,R,m;if(l.startsWith("color(")){const D=U(l);[F,_,R,m]=ft(D)}else{const D=j(l);[F,_,R,m]=ft(D)}H.test(i)?[c,,,w]=z(o,[c,null,null,w]):r.test(i)&&([c,,,w]=z(i,[c,null,null,w])),H.test(l)?[c,,,m]=z(o,[F,null,null,m]):r.test(l)&&([F,,,m]=z(l,[F,null,null,m])),[[c,p,E,w],[F,_,R,m]]=et([c,p,E,w],[F,_,R,m]);const O=w*f,I=m*$;d=O+I;let u,C,k;d===0?(u=c*f+F*$,C=p*f+_*$,k=E*f+R*$):(u=(c*O+F*I)*d,C=(p*O+_*I)*d,k=(E*O+R*I)*d),[X,P,S]=Mt(`oklab(${u} ${C} ${k})`)}else if(a==="oklch"){let c,p;if(i.startsWith("color(")){const Q=U(i,!0);c=Et(Q)}else{const Q=j(i,!0);c=Et(Q)}if(l.startsWith("color(")){const Q=U(l,!0);p=Et(Q)}else{const Q=j(l,!0);p=Et(Q)}H.test(i)?c=z(o,c):r.test(i)&&(c=z(i,c)),H.test(l)?p=z(o,p):r.test(l)&&(p=z(l,p)),r.test(i)&&(c=z(i,c)),r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(c,p),u=_*f,C=I*$;d=u+C;let k,D,N;d===0?(k=E*f+R*$,D=w*f+m*$,N=F*f+O*$):(k=(E*u+R*C)*d,D=(w*u+m*C)*d,N=(F*u+O*C)*d),[X,P,S]=Mt(`oklch(${k} ${D} ${N})`)}return[X,P,S,d*L]};0&&(module.exports={angleToDeg,convertColorValueToLinearRgb,convertColorValueToRgb,convertHexToLinearRgb,convertHexToRgb,convertHexToXyz,convertLinearRgbToHex,convertLinearRgbToRgb,convertRgbToHex,convertRgbToLinearRgb,convertRgbToXyz,convertRgbToXyzD50,convertXyzD50ToHex,convertXyzD50ToLab,convertXyzD50ToLch,convertXyzD50ToRgb,convertXyzToHex,convertXyzToHsl,convertXyzToHwb,convertXyzToOklab,convertXyzToOklch,convertXyzToRgb,convertXyzToXyzD50,normalizeColorComponents,numberToHexString,parseAlpha,parseColorFunc,parseColorValue,parseHsl,parseHwb,parseLab,parseLch,parseOklab,parseOklch,parseRgb,reInsertMissingColorComponents,resolveColorFunc,resolveColorMix,resolveColorValue,transformMatrix,validateColorComponents});
var kt=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var fe=(t,x)=>{for(var n in x)kt(t,n,{get:x[n],enumerable:!0})},pe=(t,x,n,o)=>{if(x&&typeof x=="object"||typeof x=="function")for(let e of ce(x))!he.call(t,e)&&e!==n&&kt(t,e,{get:()=>x[e],enumerable:!(o=le(x,e))||o.enumerable});return t};var ge=t=>pe(kt({},"__esModule",{value:!0}),t);var ue={};fe(ue,{angleToDeg:()=>wt,convertColorValueToLinearRgb:()=>Lt,convertColorValueToRgb:()=>At,convertHexToLinearRgb:()=>xe,convertHexToRgb:()=>Ht,convertHexToXyz:()=>ie,convertLinearRgbToHex:()=>St,convertLinearRgbToRgb:()=>Dt,convertRgbToHex:()=>Re,convertRgbToLinearRgb:()=>ut,convertRgbToXyz:()=>mt,convertRgbToXyzD50:()=>Me,convertXyzD50ToHex:()=>Ce,convertXyzD50ToLab:()=>pt,convertXyzD50ToLch:()=>yt,convertXyzD50ToRgb:()=>Gt,convertXyzToHex:()=>Be,convertXyzToHsl:()=>ht,convertXyzToHwb:()=>dt,convertXyzToOklab:()=>ft,convertXyzToOklch:()=>Et,convertXyzToRgb:()=>at,convertXyzToXyzD50:()=>Te,normalizeColorComponents:()=>et,numberToHexString:()=>ot,parseAlpha:()=>nt,parseColorFunc:()=>U,parseColorValue:()=>j,parseHsl:()=>Wt,parseHwb:()=>qt,parseLab:()=>Ot,parseLch:()=>Zt,parseOklab:()=>Ut,parseOklch:()=>Vt,parseRgb:()=>Yt,reInsertMissingColorComponents:()=>z,resolveColorFunc:()=>_e,resolveColorMix:()=>ze,resolveColorValue:()=>Mt,transformMatrix:()=>W,validateColorComponents:()=>K});module.exports=ge(ue);var T=require("./common.js");const tt=.5,xt=2,rt=3,V=4,jt=10,G=16,Y=360,st=60,B=100,M=255,Rt=2,gt=3,it=2.4,lt=12.92,v=.055,$t=116,Kt=500,Qt=200,It=216/24389,Bt=24389/27,Jt=[.3457/.3585,1,(1-.3457-.3585)/.3585],ct=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],J=[[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]],Ct=[[12831/3959,-329/214,-1974/3959],[-851781/878810,1648619/878810,36519/878810],[705/12673,-2585/12673,705/667]],$e=[[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]],vt=[[1.2268798733741557,-.5578149965554813,.28139105017721583],[-.04057576262431372,1.1122868293970594,-.07171106666151701],[-.07637294974672142,-.4214933239627914,1.5869240244272418]],te=[[.9999999984505196,.39633779217376774,.2158037580607588],[1.0000000088817607,-.10556134232365633,-.0638541747717059],[1.0000000546724108,-.08948418209496574,-1.2914855378640917]],be=[[.2104542553,.793617785,-.0040720468],[1.9779984951,-2.428592205,.4505937099],[.0259040371,.7827717662,-.808675766]],Fe=[[608311/1250200,189793/714400,198249/1000160],[35783/156275,247089/357200,198249/2500400],[0,32229/714400,5220557/5000800]],we=[[63426534/99577255,20160776/139408157,47086771/278816314],[26158966/99577255,472592308/697040785,8267143/139408157],[0,19567812/697040785,295819943/278816314]],me=[[573536/994567,263643/1420810,187206/994567],[591459/1989134,6239551/9945670,374412/4972835],[53769/1989134,351524/4972835,4929758/4972835]],de=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],b="none",Tt="deg|g?rad|turn",ee="srgb(?:-linear)?",se="xyz(?:-d(?:50|65))?",Ee=`(?:ok)?l(?:ab|ch)|h(?:sl|wb)|${ee}|${se}`,ye=`(?:a98|prophoto)-rgb|display-p3|rec2020|${ee}`,q="[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?",Z=`${q}%`,bt=`(?:${q}(?:${Tt})?|${b})(?:\\s+(?:${Z}|${b})){2}(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,re=`${q}(?:${Tt})?(?:\\s*,\\s*${Z}){2}(?:\\s*,\\s*(?:${q}|${Z}))?`,Pt=`(?:(?:${q}|${b})(?:\\s+(?:${q}|${b})){2}|(?:${Z}|${b})(?:\\s+(?:${Z}|${b})){2})(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,oe=`(?:${q}(?:\\s*,\\s*${q}){2}|${Z}(?:\\s*,\\s*${Z}){2})(?:\\s*,\\s*(?:${q}|${Z}))?`,Ft=`(?:${q}|${Z}|${b})(?:\\s+(?:${q}|${Z}|${b})){2}(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,Xt=`(?:(?:${q}|${Z}|${b})\\s+){2}(?:${q}(?:${Tt})?|${b})(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,_t=`(?:${ye}|${se})(?:\\s+(?:${q}|${Z}|${b})){3}(?:\\s*\\/\\s*(?:${q}|${Z}|${b}))?`,ne=`[a-z]+|#(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})|hsla?\\(\\s*(?:${bt}|${re})\\s*\\)|hwb\\(\\s*${bt}\\s*\\)|rgba?\\(\\s*(?:${Pt}|${oe})\\s*\\)|(?:ok)?lab\\(\\s*${Ft}\\s*\\)|(?:ok)?lch\\(\\s*${Xt}\\s*\\)|color\\(\\s*${_t}\\s*\\)`,ae=`(?:${ne})(?:\\s+${Z})?`,Ae=`color-mix\\(\\s*in\\s+(${Ee})\\s*,\\s*(${ae})\\s*,\\s*(${ae})\\s*\\)`,H=/^currentColor$/i,zt={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]},K=(t,x={})=>{if(!Array.isArray(t))throw new TypeError(`Expected Array but got ${(0,T.getType)(t)}.`);const{alpha:n=!1,minLength:o=rt,maxLength:e=V,minRange:s=0,maxRange:r=1,validateRange:a=!0}=x;if(typeof o!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(o)}.`);if(Number.isNaN(o))throw new TypeError(`${o} is not a number.`);if(typeof e!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(e)}.`);if(Number.isNaN(e))throw new TypeError(`${e} is not a number.`);if(typeof s!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(s)}.`);if(Number.isNaN(s))throw new TypeError(`${s} is not a number.`);if(typeof r!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(r)}.`);if(Number.isNaN(r))throw new TypeError(`${r} is not a number.`);const c=t.length;if(c<o||c>e){let i;throw o===e?i=`Expected array length of ${e} but got ${c}.`:i=`Expected array length of ${o} or ${e} but got ${c}.`,new Error(i)}let g=0;for(;g<c;){const i=t[g];if(typeof i!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(i)}.`);if(Number.isNaN(i))throw new TypeError(`${i} is not a number.`);if(g<rt&&a&&(i<s||i>r))throw new RangeError(`${i} is not between ${s} and ${r}.`);if(g===rt&&(i<0||i>1))throw new RangeError(`${i} is not between 0 and 1.`);g++}return n&&c===rt&&t.push(1),t},W=(t,x)=>{if(Array.isArray(t)){if(t.length!==rt)throw new Error(`Expected array length of 3 but got ${t.length}.`);for(let P of t)P=K(P,{maxLength:rt,validateRange:!1})}else throw new TypeError(`Expected Array but got ${(0,T.getType)(t)}.`);const[[n,o,e],[s,r,a],[c,g,i]]=t,[y,l,A]=K(x,{maxLength:rt,validateRange:!1}),f=n*y+o*l+e*A,$=s*y+r*l+a*A,L=c*y+g*l+i*A;return[f,$,L]},z=(t,x=[])=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const[n,o,e,s]=x;let r,a,c,g;if(/none/.test(t)){const i=new RegExp(`^rgba?\\(\\s*(${Pt})\\s*\\)$`),y=new RegExp(`^color\\(\\s*(${_t})\\s*\\)$`),l=new RegExp(`^h(?:sla?|wb)\\(\\s*(${bt})\\s*\\)$`),A=new RegExp(`^(?:ok)?lab\\(\\s*(${Ft})\\s*\\)$`),f=new RegExp(`^(?:ok)?lch\\(\\s*(${Xt})\\s*\\)$`);i.test(t)?[r,a,c,g]=t.match(i)[1].replace("/"," ").split(/\s+/):y.test(t)?[,r,a,c,g]=t.match(y)[1].replace("/"," ").split(/\s+/):t.startsWith("hsl")&&l.test(t)?[c,a,r,g]=t.match(l)[1].replace("/"," ").split(/\s+/):t.startsWith("hwb")&&l.test(t)?[c,,,g]=t.match(l)[1].replace("/"," ").split(/\s+/):A.test(t)?[r,,,g]=t.match(A)[1].replace("/"," ").split(/\s+/):f.test(t)&&([r,a,c,g]=t.match(f)[1].replace("/"," ").split(/\s+/))}return[r===b?r:n,a===b?a:o,c===b?c:e,g===b?g:s]},et=(t,x)=>{if(Array.isArray(t)){if(t.length!==V)throw new Error(`Expected array length of 4 but got ${t.length}.`)}else throw new TypeError(`Expected Array but got ${(0,T.getType)(t)}.`);if(Array.isArray(x)){if(x.length!==V)throw new Error(`Expected array length of 4 but got ${x.length}.`)}else throw new TypeError(`Expected Array but got ${(0,T.getType)(x)}.`);let n=0;for(;n<V;)t[n]===b&&x[n]===b?(t[n]=0,x[n]=0):t[n]===b?t[n]=x[n]:x[n]===b&&(x[n]=t[n]),n++;return t=K(t,{minLength:V,validateRange:!1}),x=K(x,{minLength:V,validateRange:!1}),[t,x]},ot=t=>{if(typeof t!="number")throw new TypeError(`Expected Number but got ${(0,T.getType)(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},wt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=Y/400,n=Y/(Math.PI*xt),o=new RegExp(`^(${q})(${Tt})?$`);if(!o.test(t))throw new Error(`Invalid property value: ${t}`);const[,e,s]=t.match(o),r=e.startsWith(".")?`0${e}`:e;let a;switch(s){case"grad":a=parseFloat(r)*x;break;case"rad":a=parseFloat(r)*n;break;case"turn":a=parseFloat(r)*Y;break;default:a=parseFloat(r)}return a%=Y,a<0&&(a+=Y),a},ut=t=>{const[x,n,o]=K(t,{maxLength:rt,maxRange:M});let e=x/M,s=n/M,r=o/M;const a=.04045;return e>a?e=Math.pow((e+v)/(1+v),it):e/=lt,s>a?s=Math.pow((s+v)/(1+v),it):s/=lt,r>a?r=Math.pow((r+v)/(1+v),it):r/=lt,[e,s,r]},mt=t=>{const[x,n,o,e]=K(t,{alpha:!0,maxRange:M}),[s,r,a]=ut([x,n,o]),[c,g,i]=W(Nt,[s,r,a]);return[c,g,i,e]},Me=t=>{const[x,n,o,e]=mt(t),[s,r,a]=W(J,[x,n,o]);return[s,r,a,e]},Re=t=>{const[x,n,o,e]=K(t,{alpha:!0,maxRange:M}),s=ot(x),r=ot(n),a=ot(o),c=ot(e*M);let g;return c==="ff"?g=`#${s}${r}${a}`:g=`#${s}${r}${a}${c}`,g},Dt=t=>{let[x,n,o]=K(t,{maxLength:rt});const e=809/258400;return x>e?x=Math.pow(x,1/it)*(1+v)-v:x*=lt,n>e?n=Math.pow(n,1/it)*(1+v)-v:n*=lt,o>e?o=Math.pow(o,1/it)*(1+v)-v:o*=lt,[Math.round(x*M),Math.round(n*M),Math.round(o*M)]},St=t=>{let[x,n,o,e]=K(t,{minLength:V});[x,n,o]=Dt([x,n,o]);const s=ot(x),r=ot(n),a=ot(o),c=ot(e*M);let g;return c==="ff"?g=`#${s}${r}${a}`:g=`#${s}${r}${a}${c}`,g},Be=t=>{const[x,n,o,e]=K(t,{minLength:V,validateRange:!1}),[s,r,a]=W(Ct,[x,n,o]);return St([Math.min(Math.max(s,0),1),Math.min(Math.max(r,0),1),Math.min(Math.max(a,0),1),e])},Ce=t=>{const[x,n,o,e]=K(t,{minLength:V,validateRange:!1}),s=W(ct,[x,n,o]),[r,a,c]=W(Ct,s);return St([Math.min(Math.max(r,0),1),Math.min(Math.max(a,0),1),Math.min(Math.max(c,0),1),e])},at=t=>{const[x,n,o,e]=K(t,{validateRange:!1});let[s,r,a]=W(Ct,[x,n,o]);return[s,r,a]=Dt([Math.min(Math.max(s,0),1),Math.min(Math.max(r,0),1),Math.min(Math.max(a,0),1)]),[s,r,a,e]},Te=t=>{const[x,n,o,e]=K(t,{validateRange:!1}),[s,r,a]=W(J,[x,n,o]);return[s,r,a,e]},ht=t=>{const[x,n,o,e]=at(t),s=x/M,r=n/M,a=o/M,c=Math.max(s,r,a),g=Math.min(s,r,a),i=c-g,y=(c+g)*tt*B;let l,A;if(Math.round(y)===0||Math.round(y)===B)l=b,A=b;else if(A=i/(1-Math.abs(c+g-1))*B,A===0)l=b;else{switch(c){case s:l=(r-a)/i;break;case r:l=(a-s)/i+xt;break;case a:default:l=(s-r)/i+V;break}l=l*st%Y,l<0&&(l+=Y)}return[l,A,y,e]},dt=t=>{const[x,n,o,e]=at(t),s=Math.min(x,n,o)/M,r=1-Math.max(x,n,o)/M;let a;return s+r===1?a=b:[a]=ht(t),[a,s*B,r*B,e]},ft=t=>{const[x,n,o,e]=K(t,{validateRange:!1}),r=W($e,[x,n,o]).map(y=>Math.cbrt(y));let[a,c,g]=W(be,r);a=Math.min(Math.max(a,0),1);const i=Math.round(parseFloat(a.toFixed(V))*B);return(i===0||i===B)&&(c=b,g=b),[a,c,g,e]},Et=t=>{const[x,n,o,e]=ft(t);let s,r;const a=Math.round(parseFloat(x.toFixed(V))*B);return a===0||a===B?(s=b,r=b):(s=Math.max(Math.sqrt(Math.pow(n,Rt)+Math.pow(o,Rt)),0),parseFloat(s.toFixed(V))===0?r=b:(r=Math.atan2(o,n)*Y*tt/Math.PI,r<0&&(r+=Y))),[x,s,r,e]},Gt=t=>{const[x,n,o,e]=K(t,{minLength:V,validateRange:!1}),s=W(ct,[x,n,o]),[r,a,c]=at(s);return[r,a,c,e]},pt=t=>{const[x,n,o,e]=K(t,{validateRange:!1}),s=[x,n,o].map((l,A)=>l/Jt[A]),[r,a,c]=s.map(l=>l>It?Math.cbrt(l):(l*Bt+G)/$t),g=Math.min(Math.max($t*a-G,0),B);let i,y;return g===0||g===B?(i=b,y=b):(i=(r-a)*Kt,y=(a-c)*Qt),[g,i,y,e]},yt=t=>{const[x,n,o,e]=pt(t);let s,r;return x===0||x===B?(s=b,r=b):(s=Math.max(Math.sqrt(Math.pow(n,Rt)+Math.pow(o,Rt)),0),parseFloat(s.toFixed(V))===0?r=b:(r=Math.atan2(o,n)*Y*tt/Math.PI,r<0&&(r+=Y))),[x,s,r,e]},Ht=t=>{if((0,T.isString)(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(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}`);const x=[];if(/^#[\da-f]{6}$/.test(t)){const[,n,o,e]=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/);x.push(parseInt(n,G),parseInt(o,G),parseInt(e,G),1)}else if(/^#[\da-f]{3}$/.test(t)){const[,n,o,e]=t.match(/^#([\da-f])([\da-f])([\da-f])$/);x.push(parseInt(`${n}${n}`,G),parseInt(`${o}${o}`,G),parseInt(`${e}${e}`,G),1)}else if(/^#[\da-f]{8}$/.test(t)){const[,n,o,e,s]=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})$/);x.push(parseInt(n,G),parseInt(o,G),parseInt(e,G),parseInt(s,G)/M)}else if(/^#[\da-f]{4}$/.test(t)){const[,n,o,e,s]=t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/);x.push(parseInt(`${n}${n}`,G),parseInt(`${o}${o}`,G),parseInt(`${e}${e}`,G),parseInt(`${s}${s}`,G)/M)}return x},xe=t=>{const[x,n,o,e]=Ht(t),[s,r,a]=ut([x,n,o]);return[s,r,a,e]},ie=t=>{const[x,n,o,e]=xe(t),[s,r,a]=W(Nt,[x,n,o]);return[s,r,a,e]},nt=t=>{if((0,T.isString)(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)/B: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},Yt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^rgba?\\(\\s*(${Pt}|${oe})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const[,n]=t.match(x);let[o,e,s,r]=n.replace(/[,/]/g," ").split(/\s+/);return o===b?o=0:(o.startsWith(".")&&(o=`0${o}`),o.endsWith("%")?o=parseFloat(o)*M/B:o=parseFloat(o)),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)*M/B:e=parseFloat(e)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*M/B:s=parseFloat(s)),r=nt(r),[Math.min(Math.max(o,0),M),Math.min(Math.max(e,0),M),Math.min(Math.max(s,0),M),r]},Wt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^hsla?\\(\\s*(${bt}|${re})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const[,n]=t.match(x);let[o,e,s,r]=n.replace(/[,/]/g," ").split(/\s+/);o===b?o=0:o=wt(o),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=Math.min(Math.max(parseFloat(e),0),B)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s=Math.min(Math.max(parseFloat(s),0),B)),r=nt(r);let a,c;s<B*tt?(a=(s+s*(e/B))*M/B,c=(s-s*(e/B))*M/B):(a=(s+(B-s)*(e/B))*M/B,c=(s-(B-s)*(e/B))*M/B);const g=(a-c)/st;let i,y,l;return o>=0&&o<st?(i=a,y=o*g+c,l=c):o<st*xt?(i=(st*xt-o)*g+c,y=a,l=c):o<Y*tt?(i=c,y=a,l=(o-st*xt)*g+c):o<st*V?(i=c,y=(st*V-o)*g+c,l=a):o<Y-st?(i=(o-st*V)*g+c,y=c,l=a):o<Y&&(i=a,y=c,l=(Y-o)*g+c),[Math.min(Math.max(i,0),M),Math.min(Math.max(y,0),M),Math.min(Math.max(l,0),M),r]},qt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^hwb\\(\\s*(${bt})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const[,n]=t.match(x);let[o,e,s,r]=n.replace("/"," ").split(/\s+/);o===b?o=0:o=wt(o),e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e=Math.min(Math.max(parseFloat(e),0),B)/B),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s=Math.min(Math.max(parseFloat(s),0),B)/B),r=nt(r);const a=[];if(e+s>=1){const c=e/(e+s)*M;a.push(c,c,c,r)}else{const[c,g,i]=Wt(`hsl(${o} 100% 50%)`),y=(1-e-s)/M;a.push((c*y+e)*M,(g*y+e)*M,(i*y+e)*M,r)}return a},Ot=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^lab\\(\\s*(${Ft})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const n=1.25,o=8,[,e]=t.match(x);let[s,r,a,c]=e.replace("/"," ").split(/\s+/);s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?(s=parseFloat(s),s>B&&(s=B)):s=parseFloat(s),s<0&&(s=0)),r===b?r=0:(r.startsWith(".")&&(r=`0${r}`),r.endsWith("%")?r=parseFloat(r)*n:r=parseFloat(r)),a===b?a=0:a.endsWith("%")?a=parseFloat(a)*n:a=parseFloat(a),c=nt(c);const g=(s+G)/$t,i=r/Kt+g,y=g-a/Qt,l=Math.pow(g,gt),A=Math.pow(i,gt),f=Math.pow(y,gt),$=[A>It?A:(i*$t-G)/Bt,s>o?l:s/Bt,f>It?f:(y*$t-G)/Bt],[L,P,N]=$.map((S,d)=>S*Jt[d]);return[L,P,N,c]},Zt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^lch\\(\\s*(${Xt})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const n=1.5,[,o]=t.match(x);let[e,s,r,a]=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)*n:s=parseFloat(s)),r===b?r=0:r=wt(r),a=nt(a);const c=s*Math.cos(r*Math.PI/(Y*tt)),g=s*Math.sin(r*Math.PI/(Y*tt)),[i,y,l]=Ot(`lab(${e} ${c} ${g})`);return[i,y,l,a]},Ut=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^oklab\\(\\s*(${Ft})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const n=.4,[,o]=t.match(x);let[e,s,r,a]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)/B:e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*n/B:s=parseFloat(s)),r===b?r=0:r.endsWith("%")?r=parseFloat(r)*n/B:r=parseFloat(r),a=nt(a);const g=W(te,[e,s,r]).map(A=>Math.pow(A,gt)),[i,y,l]=W(vt,g);return[i,y,l,a]},Vt=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const x=new RegExp(`^oklch\\(\\s*(${Ft})\\s*\\)$`);if(!x.test(t))throw new Error(`Invalid property value: ${t}`);const n=.4,[,o]=t.match(x);let[e,s,r,a]=o.replace("/"," ").split(/\s+/);e===b?e=0:(e.startsWith(".")&&(e=`0${e}`),e.endsWith("%")?e=parseFloat(e)/B:e=parseFloat(e),e<0&&(e=0)),s===b?s=0:(s.startsWith(".")&&(s=`0${s}`),s.endsWith("%")?s=parseFloat(s)*n/B:s=parseFloat(s),s<0&&(s=0)),r===b?r=0:r=wt(r),a=nt(a);const c=s*Math.cos(r*Math.PI/(Y*tt)),g=s*Math.sin(r*Math.PI/(Y*tt)),y=W(te,[e,c,g]).map($=>Math.pow($,gt)),[l,A,f]=W(vt,y);return[l,A,f,a]},U=(t,x=!1)=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const n=new RegExp(`^color\\(\\s*(${_t})\\s*\\)$`);if(!n.test(t))throw new Error(`Invalid property value: ${t}`);const[,o]=t.match(n),[e,s,r,a,c]=o.replace("/"," ").split(/\s+/);let g,i,y;if(s===b)g=0;else{let L;s.startsWith(".")?L=`0${s}`:L=s,g=L.endsWith("%")?parseFloat(L)/B:parseFloat(L)}if(r===b)i=0;else{let L;r.startsWith(".")?L=`0${r}`:L=r,i=L.endsWith("%")?parseFloat(L)/B:parseFloat(L)}if(a===b)y=0;else{let L;a.startsWith(".")?L=`0${a}`:L=a,y=L.endsWith("%")?parseFloat(L)/B:parseFloat(L)}const l=nt(c);let A,f,$;if(e==="srgb")[A,f,$]=mt([g*M,i*M,y*M]),x&&([A,f,$]=W(J,[A,f,$]));else if(e==="srgb-linear")[A,f,$]=W(Nt,[g,i,y]),x&&([A,f,$]=W(J,[A,f,$]));else if(e==="display-p3"){const L=ut([g*M,i*M,y*M]);[A,f,$]=W(Fe,L),x&&([A,f,$]=W(J,[A,f,$]))}else if(e==="rec2020"){const L=1.09929682680944,P=.018053968510807,N=.45,S=[g,i,y].map(d=>{let h;return d<P*N*jt?h=d/(N*jt):h=Math.pow((d+L-1)/L,1/N),h});[A,f,$]=W(we,S),x&&([A,f,$]=W(J,[A,f,$]))}else if(e==="a98-rgb"){const L=2.19921875,P=[g,i,y].map(N=>Math.pow(N,L));[A,f,$]=W(me,P),x&&([A,f,$]=W(J,[A,f,$]))}else if(e==="prophoto-rgb"){const P=[g,i,y].map(N=>{let S;return N>1/(G*xt)?S=Math.pow(N,1.8):S=N/G,S});[A,f,$]=W(de,P),x||([A,f,$]=W(ct,[A,f,$]))}else/^xyz(?:-d(?:50|65))?$/.test(e)&&([A,f,$]=[g,i,y],e==="xyz-d50"?x||([A,f,$]=W(ct,[A,f,$])):x&&([A,f,$]=W(J,[A,f,$])));return[A,f,$,l]},j=(t,x=!1)=>{if((0,T.isString)(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);let n,o,e,s;if(H.test(t))n=0,o=0,e=0,s=0;else if(/^[a-z]+$/.test(t))if(Object.prototype.hasOwnProperty.call(zt,t)){const[r,a,c]=zt[t];s=1,[n,o,e]=mt([r,a,c]),x&&([n,o,e]=W(J,[n,o,e]))}else if(t==="transparent")n=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)){const[,a,c,g]=t.match(/^#([\da-f])([\da-f])([\da-f])$/);r=`#${a}${a}${c}${c}${g}${g}`}else if(/^#[\da-f]{8}$/.test(t))r=t;else if(/^#[\da-f]{4}$/.test(t)){const[,a,c,g,i]=t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/);r=`#${a}${a}${c}${c}${g}${g}${i}${i}`}else throw new Error(`Invalid property value: ${t}`);[n,o,e,s]=ie(r),x&&([n,o,e]=W(J,[n,o,e]))}else if(t.startsWith("lab"))[n,o,e,s]=Ot(t),x||([n,o,e]=W(ct,[n,o,e]));else if(t.startsWith("lch"))[n,o,e,s]=Zt(t),x||([n,o,e]=W(ct,[n,o,e]));else if(t.startsWith("oklab"))[n,o,e,s]=Ut(t),x&&([n,o,e]=W(J,[n,o,e]));else if(t.startsWith("oklch"))[n,o,e,s]=Vt(t),x&&([n,o,e]=W(J,[n,o,e]));else{let r,a,c;if(t.startsWith("rgb"))[r,a,c,s]=Yt(t);else if(t.startsWith("hsl"))[r,a,c,s]=Wt(t);else if(t.startsWith("hwb"))[r,a,c,s]=qt(t);else throw new Error(`Invalid property value: ${t}`);[n,o,e]=mt([r,a,c]),x&&([n,o,e]=W(J,[n,o,e]))}return[n,o,e,s]},Lt=(t,x={})=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const{alpha:n}=x;let o,e,s,r;t.startsWith("color(")?[o,e,s,r]=U(t):[o,e,s,r]=j(t);let[a,c,g]=W(Ct,[o,e,s]);a=Math.min(Math.max(a,0),1),c=Math.min(Math.max(c,0),1),g=Math.min(Math.max(g,0),1);const i=[a,c,g];return n?i.push(r):i.push(1),i},At=t=>{let[x,n,o,e]=Lt(t,{alpha:!0});return[x,n,o]=Dt([x,n,o]),[x,n,o,e]},Mt=t=>{if((0,T.isString)(t))t=t.toLowerCase().trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);let x,n,o,e;if(H.test(t))x=0,n=0,o=0,e=0;else if(/^[a-z]+$/i.test(t))Object.prototype.hasOwnProperty.call(zt,t)?([x,n,o]=zt[t],e=1):t==="transparent"&&(x=0,n=0,o=0,e=0);else if(t.startsWith("#"))[x,n,o,e]=Ht(t);else if(/^l(?:ab|ch)/.test(t)){let r,a,c;t.startsWith("lab")?[r,a,c,e]=Ot(t):[r,a,c,e]=Zt(t),[x,n,o,e]=Gt([r,a,c,e])}else if(/^okl(?:ab|ch)/.test(t)){let r,a,c;t.startsWith("oklab")?[r,a,c,e]=Ut(t):[r,a,c,e]=Vt(t),[x,n,o,e]=at([r,a,c,e])}else t.startsWith("rgb")?[x,n,o,e]=Yt(t):t.startsWith("hsl")?[x,n,o,e]=Wt(t):t.startsWith("hwb")&&([x,n,o,e]=qt(t));let s;return isNaN(x)||isNaN(n)||isNaN(o)||isNaN(e)?s=[]:s=[Math.round(x),Math.round(n),Math.round(o),e],s},_e=t=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);if(!new RegExp(`^color\\(\\s*${_t}\\s*\\)$`).test(t))throw new Error(`Invalid property value: ${t}`);const[n,o,e,s]=U(t),[r,a,c]=at([n,o,e]);return[r,a,c,s]},ze=(t,x={})=>{if((0,T.isString)(t))t=t.trim();else throw new TypeError(`Expected String but got ${(0,T.getType)(t)}.`);const n=new RegExp(`^${Ae}$`,"i");if(!n.test(t))throw new Error(`Invalid property value: ${t}`);const o="lch(none none none / none)",e="rgb(none none none / none)",s=new RegExp(`^(${ne})(?:\\s+(${Z}))?$`,"i"),r=new RegExp(b),[,a,c,g]=t.match(n),[,i,y]=c.match(s),[,l,A]=g.match(s);let f,$,L;if(y&&A){const h=parseFloat(y)/B,p=parseFloat(A)/B;if(h<0||h>1)throw new RangeError(`${y} is not between 0% and 100%.`);if(p<0||p>1)throw new RangeError(`${A} is not between 0% and 100%.`);const E=h+p;if(E===0)throw new Error(`Invalid property value: ${t}`);f=h/E,$=p/E,L=E<1?E:1}else{if(y){if(f=parseFloat(y)/B,f<0||f>1)throw new RangeError(`${y} is not between 0% and 100%.`);$=1-f}else if(A){if($=parseFloat(A)/B,$<0||$>1)throw new RangeError(`${A} is not between 0% and 100%.`);f=1-$}else f=tt,$=tt;L=1}let P,N,S,d;if(a==="srgb"){let h=At(i,{alpha:!0}),p=At(l,{alpha:!0});H.test(i)?h=z(e,h):r.test(i)&&(h=z(i,h)),H.test(l)?p=z(e,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(h,p),u=_*f,C=I*$;d=u+C,d===0?(P=E*f+R*$,N=w*f+m*$,S=F*f+O*$):(P=(E*u+R*C)/d,N=(w*u+m*C)/d,S=(F*u+O*C)/d)}else if(a==="srgb-linear"){let h=Lt(i,{alpha:!0}),p=Lt(l,{alpha:!0});H.test(i)?h=z(e,h):r.test(i)&&(h=z(i,h)),H.test(l)?p=z(e,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(h,p),u=_*f,C=I*$;d=u+C,d===0?(P=(E*f+R*$)*M,N=(w*f+m*$)*M,S=(F*f+O*$)*M):(P=(E*u+R*C)*d*M,N=(w*u+m*C)*d*M,S=(F*u+O*C)*d*M)}else if(/^xyz(?:-d65)?$/.test(a)){let h,p;i.startsWith("color(")?h=U(i):h=j(i),l.startsWith("color(")?p=U(l):p=j(l),H.test(i)?h=z(e,h):r.test(i)&&(h=z(i,h)),H.test(l)?p=z(e,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(h,p),u=_*f,C=I*$;d=u+C;let k,D,X;d===0?(k=E*f+R*$,D=w*f+m*$,X=F*f+O*$):(k=(E*u+R*C)*d,D=(w*u+m*C)*d,X=(F*u+O*C)*d),[P,N,S]=at([k,D,X])}else if(a==="xyz-d50"){let h,p;i.startsWith("color(")?h=U(i,!0):h=j(i,!0),l.startsWith("color(")?p=U(l,!0):p=j(l,!0),H.test(i)?h=z(e,h):r.test(i)&&(h=z(i,h)),H.test(l)?p=z(e,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(h,p),u=_*f,C=I*$;d=u+C;let k,D,X;d===0?(k=E*f+R*$,D=w*f+m*$,X=F*f+O*$):(k=(E*u+R*C)*d,D=(w*u+m*C)*d,X=(F*u+O*C)*d),[P,N,S]=Gt([k,D,X,d])}else if(a==="hsl"){let h,p,E,w;if(i.startsWith("color(")){const D=U(i);[h,p,E,w]=ht(D)}else{const D=j(i);[h,p,E,w]=ht(D)}let F,_,R,m;if(l.startsWith("color(")){const D=U(l);[F,_,R,m]=ht(D)}else{const D=j(l);[F,_,R,m]=ht(D)}H.test(i)?[E,p,h,w]=z(o,[E,p,h,w]):r.test(i)&&([E,p,h,w]=z(i,[E,p,h,w])),H.test(l)?[R,_,F,m]=z(o,[R,_,F,m]):r.test(l)&&([R,_,F,m]=z(l,[R,_,F,m])),[[h,p,E,w],[F,_,R,m]]=et([h,p,E,w],[F,_,R,m]);const O=w*f,I=m*$;d=O+I;const u=(h*f+F*$)%Y;let C,k;d===0?(C=p*f+_*$,k=E*f+R*$):(C=(p*O+_*I)/d,k=(E*O+R*I)/d),[P,N,S]=At(`hsl(${u} ${C}% ${k}%)`)}else if(a==="hwb"){let h,p,E,w;if(i.startsWith("color(")){const X=U(i);[h,p,E,w]=dt(X)}else{const X=j(i);[h,p,E,w]=dt(X)}let F,_,R,m;if(l.startsWith("color(")){const X=U(l);[F,_,R,m]=dt(X)}else{const X=j(l);[F,_,R,m]=dt(X)}H.test(i)?[,,h,w]=z(o,[null,null,h,w]):r.test(i)&&([,,h,w]=z(i,[null,null,h,w])),H.test(l)?[,,F,m]=z(o,[null,null,F,m]):r.test(l)&&([,,F,m]=z(l,[null,null,F,m])),[[h,p,E,w],[F,_,R,m]]=et([h,p,E,w],[F,_,R,m]);const O=w*f,I=m*$;d=O+I;const u=(h*f+F*$)%Y;let C,k;d===0?(C=p*f+_*$,k=E*f+R*$):(C=(p*O+_*I)/d,k=(E*O+R*I)/d),[P,N,S]=At(`hwb(${u} ${C}% ${k}%)`)}else if(a==="lab"){let h,p,E,w;if(i.startsWith("color(")){const D=U(i,!0);[h,p,E,w]=pt(D)}else{const D=j(i,!0);[h,p,E,w]=pt(D)}let F,_,R,m;if(l.startsWith("color(")){const D=U(l,!0);[F,_,R,m]=pt(D)}else{const D=j(l,!0);[F,_,R,m]=pt(D)}H.test(i)?[h,,,w]=z(o,[h,null,null,w]):r.test(i)&&([h,,,w]=z(i,[h,null,null,w])),H.test(l)?[F,,,m]=z(o,[F,null,null,m]):r.test(l)&&([F,,,m]=z(l,[F,null,null,m])),[[h,p,E,w],[F,_,R,m]]=et([h,p,E,w],[F,_,R,m]);const O=w*f,I=m*$;d=O+I;let u,C,k;d===0?(u=h*f+F*$,C=p*f+_*$,k=E*f+R*$):(u=(h*O+F*I)*d,C=(p*O+_*I)*d,k=(E*O+R*I)*d),[P,N,S]=Mt(`lab(${u} ${C} ${k})`)}else if(a==="lch"){let h,p;if(i.startsWith("color(")){const Q=U(i,!0);h=yt(Q)}else{const Q=j(i,!0);h=yt(Q)}if(l.startsWith("color(")){const Q=U(l,!0);p=yt(Q)}else{const Q=j(l,!0);p=yt(Q)}H.test(i)?h=z(o,h):r.test(i)&&(h=z(i,h)),H.test(l)?p=z(o,p):r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(h,p),u=_*f,C=I*$;d=u+C;let k,D,X;d===0?(k=E*f+R*$,D=w*f+m*$,X=F*f+O*$):(k=(E*u+R*C)*d,D=(w*u+m*C)*d,X=(F*u+O*C)*d),[P,N,S]=Mt(`lch(${k} ${D} ${X})`)}else if(a==="oklab"){let h,p,E,w;if(i.startsWith("color(")){const D=U(i);[h,p,E,w]=ft(D)}else{const D=j(i);[h,p,E,w]=ft(D)}let F,_,R,m;if(l.startsWith("color(")){const D=U(l);[F,_,R,m]=ft(D)}else{const D=j(l);[F,_,R,m]=ft(D)}H.test(i)?[h,,,w]=z(o,[h,null,null,w]):r.test(i)&&([h,,,w]=z(i,[h,null,null,w])),H.test(l)?[h,,,m]=z(o,[F,null,null,m]):r.test(l)&&([F,,,m]=z(l,[F,null,null,m])),[[h,p,E,w],[F,_,R,m]]=et([h,p,E,w],[F,_,R,m]);const O=w*f,I=m*$;d=O+I;let u,C,k;d===0?(u=h*f+F*$,C=p*f+_*$,k=E*f+R*$):(u=(h*O+F*I)*d,C=(p*O+_*I)*d,k=(E*O+R*I)*d),[P,N,S]=Mt(`oklab(${u} ${C} ${k})`)}else if(a==="oklch"){let h,p;if(i.startsWith("color(")){const Q=U(i,!0);h=Et(Q)}else{const Q=j(i,!0);h=Et(Q)}if(l.startsWith("color(")){const Q=U(l,!0);p=Et(Q)}else{const Q=j(l,!0);p=Et(Q)}H.test(i)?h=z(o,h):r.test(i)&&(h=z(i,h)),H.test(l)?p=z(o,p):r.test(l)&&(p=z(l,p)),r.test(i)&&(h=z(i,h)),r.test(l)&&(p=z(l,p));const[[E,w,F,_],[R,m,O,I]]=et(h,p),u=_*f,C=I*$;d=u+C;let k,D,X;d===0?(k=E*f+R*$,D=w*f+m*$,X=F*f+O*$):(k=(E*u+R*C)*d,D=(w*u+m*C)*d,X=(F*u+O*C)*d),[P,N,S]=Mt(`oklch(${k} ${D} ${X})`)}return[P,N,S,d*L]};0&&(module.exports={angleToDeg,convertColorValueToLinearRgb,convertColorValueToRgb,convertHexToLinearRgb,convertHexToRgb,convertHexToXyz,convertLinearRgbToHex,convertLinearRgbToRgb,convertRgbToHex,convertRgbToLinearRgb,convertRgbToXyz,convertRgbToXyzD50,convertXyzD50ToHex,convertXyzD50ToLab,convertXyzD50ToLch,convertXyzD50ToRgb,convertXyzToHex,convertXyzToHsl,convertXyzToHwb,convertXyzToOklab,convertXyzToOklch,convertXyzToRgb,convertXyzToXyzD50,normalizeColorComponents,numberToHexString,parseAlpha,parseColorFunc,parseColorValue,parseHsl,parseHwb,parseLab,parseLch,parseOklab,parseOklch,parseRgb,reInsertMissingColorComponents,resolveColorFunc,resolveColorMix,resolveColorValue,transformMatrix,validateColorComponents});
//# sourceMappingURL=color.js.map

@@ -47,3 +47,3 @@ {

},
"version": "1.0.0"
"version": "1.0.1"
}

@@ -47,6 +47,16 @@ # CSS color

Returns **([string][93]? | [Array][96])** `rgba?()`, `[r, g, b, a]`, `#rrggbb(aa)?`, `null`, or if `key` is specified, `[key, rgba?()|[r, g, b, a]|#rrggbb(aa)?|null]`
* In `rgb`, `r`, `g`, `b` values are rounded.
* In `array`, values are floats.
* In `hex`, `transparent` keyword resolves as `null`, `currentcolor` as `#000000` if `opt.currentColor` not specified.
* In `hexAlpha`, `transparent` keyword resolves as `#00000000`, `currentcolor` as `#00000000` if `opt.currentColor` not specified.
* In `rgb`:
* `r`, `g`, `b` values are rounded.
* Returns empty string for unknown / unsupported color name.
* In `array`:
* Values are floats.
* Returns array filled with undefined for unknown / unsupported color name, i.e. `[undefined, undefined, undefined, undefined]`.
* In `hex`:
* `transparent` returns `null`.
* Also returns `null` for unknown / unsupported color name.
* `currentcolor` resolves as `#000000` if `opt.currentColor` is not specified.
* In `hexAlpha`:
* `transparent` resolves as `#00000000`.
* `currentcolor` resolves as `#00000000` if `opt.currentColor` is not specified.
* Returns `null` for unknown / unsupported color name.

@@ -60,4 +70,4 @@

* `value` **[string][93]** color value
* `color-mix()` and [&lt;system-color&gt;](https://developer.mozilla.org/en-US/docs/Web/CSS/system-color)s are not supported
* `color` **[string][93]** color value
* `color-mix()` and [&lt;system-color&gt;](https://developer.mozilla.org/en-US/docs/Web/CSS/system-color)s are not supported. It throws.
* `opt` **[object][94]?** options

@@ -64,0 +74,0 @@ * `opt.d50` **[boolean][95]?** get xyz values in d50 white point

@@ -19,13 +19,18 @@ /*!

* @param {string} color - color value
* - system colors are not supported
* - system colors are not supported
* @param {object} [opt] - options
* @param {string} [opt.currentColor] - color to use for 'currentcolor' keyword
* @param {string} [opt.format] - 'rgb'(default), 'array', 'hex' or 'hexAlpha'
* - 'hexAlpha' is a hex color notation with alpha channel, i.e. #rrggbbaa
* @param {string} [opt.currentColor] - color to use for `currentcolor` keyword
* @param {string} [opt.format] - `rgb`(default), `array`, `hex` or `hexAlpha`
* - `hexAlpha` is a hex color notation with alpha channel, i.e. #rrggbbaa
* @param {*} [opt.key] - key e.g. CSS property `background-color`
* @returns {?string|Array} - rgba?(), [r, g, b, a], #rrggbb(aa)?, null
* - if `key` is specified, [key, rgba?()|[r, g, b, a]|#rrggbb(aa)?|null]
* - in 'rgb', 'r', 'g', 'b' values are rounded
* - in 'array', values are floating point
* - in 'hex', 'transparent' resolves as 'null'
* - in `rgb`, `r`, `g`, `b` values are rounded,
* resolves as empty string if any of `r`, `g`, `b`, `a` is not a number
* - in `array`, values are floating point,
* if any of `r`, `g`, `b`, `a` is not a number then they stay as is,
* e.g. [undefined, undefined, undefined, undefined]
* - in `hex`, `transparent` resolves as `null`,
* also resolves as `null` if any of `r`, `g`, `b`, `a` is not a number
* - in `hexAlpha`, resolves as `null` if any of `r`, `g`, `b`, `a` is not a number
*/

@@ -79,3 +84,3 @@ export const resolve = (color, opt = {}) => {

let hex;
if (/^transparent$/i.test(color)) {
if (/^transparent$/i.test(color) || isNaN(r) || isNaN(g) || isNaN(b)) {
hex = null;

@@ -96,2 +101,4 @@ } else {

hex = '#00000000';
} else if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(a)) {
hex = null;
} else {

@@ -109,7 +116,13 @@ hex = convertRgbToHex([r, g, b, a]);

let rgb;
if (a === 1) {
rgb = `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;
if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(a)) {
rgb = '';
} else {
rgb =
`rgba(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)}, ${a})`;
r = Math.round(r);
g = Math.round(g);
b = Math.round(b);
if (a === 1) {
rgb = `rgb(${r}, ${g}, ${b})`;
} else {
rgb = `rgba(${r}, ${g}, ${b}, ${a})`;
}
}

@@ -116,0 +129,0 @@ if (key) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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