@mkbabb/value.js 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/value.cjs +1 -1
- package/dist/value.d.ts +1 -0
- package/dist/value.js +124 -117
- package/package.json +1 -1
package/dist/value.cjs
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
${c}`}function zs(t,e="",n=!1,r=console.log){const o=s=>{const i=t.parser(s),a=n?Ar(t):t.context.name??"",c=Mr(i,e,a);return r(c),i};return new x(o,M("debug",t,r))}class Ke{constructor(e,n=void 0,r=0,o=!1,s=0){this.src=e,this.value=n,this.offset=r,this.isError=o,this.furthest=s}ok(e,n=0){return n+=this.offset,new Ke(this.src,e,n,!1)}err(e,n=0){const r=this.ok(e,n);return r.isError=!0,r}from(e,n=0){return n+=this.offset,new Ke(this.src,e,n,this.isError)}getColumnNumber(){const e=this.offset,n=this.src.lastIndexOf(`
|
|
5
5
|
`,e),r=n===-1?e:e-(n+1);return Math.max(0,r)}getLineNumber(){const e=this.src.lastIndexOf(`
|
|
6
6
|
`,this.offset);return e>=0?this.src.slice(0,e).split(`
|
|
7
|
-
`).length:0}toString(){return Mr(this)}}function M(t,e,...n){return{name:t,parser:e,args:n}}let Us=0;const me=new Map,De=new Map;let Me;function G(t){return(!Me||t.offset>Me.offset)&&(Me=t),Me}function _r(t){return t.parser?t.parser:t.parser=t()}class x{constructor(e,n={}){this.parser=e,this.context=n}id=Us++;state;reset(){Me=void 0,me.clear(),De.clear()}parseState(e){this.reset();const n=this.parser(new Ke(e));return this.state=G(n),this.state.isError=n.isError,this.state.isError,n}parse(e){return this.parseState(e).value}getCijKey(e){return`${this.id}${e.offset}`}atLeftRecursionLimit(e){return(De.get(this.getCijKey(e))??0)>e.src.length-e.offset}memoize(){const e=n=>{const r=this.getCijKey(n),o=De.get(r)??0;let s=me.get(this.id);if(s&&s.offset>=n.offset)return s;if(this.atLeftRecursionLimit(n))return n.err(void 0);De.set(r,o+1);const i=this.parser(n);return s=me.get(this.id),s&&s.offset>i.offset?i.offset=s.offset:s||me.set(this.id,i),i};return new x(e,M("memoize",this))}mergeMemos(){const e=n=>{let r=me.get(this.id);if(r)return r;if(this.atLeftRecursionLimit(n))return n.err(void 0);const o=this.parser(n);return r=me.get(this.id),r||me.set(this.id,o),o};return new x(e,M("mergeMemo",this))}then(e){const n=r=>{const o=this.parser(r);if(!o.isError){const s=e.parser(o);if(!s.isError)return s.ok([o.value,s.value])}return G(r),r.err(void 0)};return new x(n,M("then",this,this,e))}or(e){const n=r=>{const o=this.parser(r);return o.isError?e.parser(r):o};return new x(n,M("or",this,this,e))}chain(e,n=!1){const r=o=>{const s=this.parser(o);return s.isError?s:s.value||n?e(s.value).parser(s):o};return new x(r,M("chain",this,e))}map(e,n=!1){const r=o=>{const s=this.parser(o);return!s.isError||n?s.ok(e(s.value)):s};return new x(r,M("map",this))}mapState(e){const n=r=>{const o=this.parser(r);return e(o,r)};return new x(n,M("mapState",this))}skip(e){const n=r=>{const o=this.parser(r);if(!o.isError){const s=e.parser(o);if(!s.isError)return s.ok(o.value)}return G(r),r.err(void 0)};return new x(n,M("skip",this,e))}next(e){const n=this.then(e).map(([,r])=>r);return n.context=M("next",this,e),n}opt(){const e=n=>{const r=this.parser(n);return r.isError?(G(n),n.ok(void 0)):r};return new x(e,M("opt",this))}not(e){const n=o=>this.parser(o).isError?(G(o),o.ok(o.value)):o.err(void 0),r=o=>{const s=this.parser(o);return s.isError?(G(o),s):e.parser(o).isError?s:(G(o),o.err(void 0))};return new x(e?r:n,M("not",this,e))}wrap(e,n,r=!0){if(!r)return _(e,this,n);const o=e.next(this).skip(n);return o.context=M("wrap",this,e,n),o}trim(e=g,n=!0){if(!n)return _(e,this,e);if(e.context?.name==="whitespace"){const r=o=>{const s=cr(o),i=this.parser(s);return i.isError?(G(o),o.err(void 0)):cr(i)};return new x(r,M("trimWhitespace",this))}return this.wrap(e,e)}many(e=0,n=1/0){const r=o=>{const s=[];let i=o;for(let a=0;a<n;a+=1){const c=this.parser(i);if(c.isError)break;s.push(c.value),i=c}return s.length>=e?i.ok(s):(G(o),o.err([]))};return new x(r,M("many",this,e,n))}sepBy(e,n=0,r=1/0){const o=s=>{const i=[];let a=s;for(let c=0;c<r;c+=1){const l=this.parser(a);if(l.isError)break;a=l,i.push(a.value);const p=e.parser(a);if(p.isError)break;a=p}return i.length>n?a.ok(i):(G(s),s.err([]))};return new x(o,M("sepBy",this,e))}eof(){const e=this.skip(Gs());return e.context=M("eof",this),e}debug(e="",n=!1,r=console.log){return zs(this,e,n,r)}toString(){return Ar(this)}static lazy(e){const n=r=>_r(e).parser(r);return new x(n,M("lazy",void 0,e))}}function Gs(){const t=e=>e.offset>=e.src.length?e.ok(void 0):(G(e),e.err());return new x(t,M("eof",void 0))}function d(...t){const e=n=>{for(const r of t){const o=r.parser(n);if(!o.isError)return o}return G(n),n.err(void 0)};return new x(t.length===1?t[0].parser:e,M("any",void 0,...t))}function _(...t){const e=n=>{const r=[];let o=n;for(const s of t){const i=s.parser(o);if(i.isError)return i;i.value!==void 0&&r.push(i.value),o=i}return G(o),o.ok(r)};return new x(t.length===1?t[0].parser:e,M("all",void 0,...t))}function B(t){const e=n=>{if(n.offset>=n.src.length)return n.err(void 0);const r=n.src.slice(n.offset,n.offset+t.length);return r===t?n.ok(r,r.length):(G(n),n.err(void 0))};return new x(e,M("string",void 0,t))}function V(t,e=n=>n?.[0]??null){const n=t.flags.replace(/y/g,""),r=new RegExp(t,n+"y"),o=s=>{if(s.offset>=s.src.length)return s.err(void 0);r.lastIndex=s.offset;const i=e(s.src.match(r));return i?s.ok(i,r.lastIndex-s.offset):i===""?s.ok(void 0):(G(s),s.err(void 0))};return new x(o,M("regex",void 0,t))}const ar=/\s*/y,cr=t=>{if(t.offset>=t.src.length)return t;ar.lastIndex=t.offset;const e=t.src.match(ar)?.[0]??"";return t.ok(t.value,e.length)},g=V(/\s*/);g.context.name="whitespace";const m=t=>{const e=new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i");return V(e)},Rr=V(/-?[a-zA-Z][a-zA-Z0-9-]*/),ht=m("none"),Or=V(/-?\d+/).map(Number),q=V(/-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/).map(Number);function Nr(t){return new x(e=>e.ok(t,0))}function Br(t){return new x(e=>e.err(void 0,0))}function Te(t,e){const n=t.parseState(e);if(n.isError)throw new Error(`Parse error at offset ${n.offset}`);return n.value}function $s(t,e){const n=t.parseState(e);return{status:!n.isError,value:n.value}}function O(t,e){const[n,r,o]=t;return[e[0]*n+e[1]*r+e[2]*o,e[3]*n+e[4]*r+e[5]*o,e[6]*n+e[7]*r+e[8]*o]}function Fs(t){return[t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]]}function Ds(t,e){return[t[0]*e[0]+t[1]*e[3]+t[2]*e[6],t[0]*e[1]+t[1]*e[4]+t[2]*e[7],t[0]*e[2]+t[1]*e[5]+t[2]*e[8],t[3]*e[0]+t[4]*e[3]+t[5]*e[6],t[3]*e[1]+t[4]*e[4]+t[5]*e[7],t[3]*e[2]+t[4]*e[5]+t[5]*e[8],t[6]*e[0]+t[7]*e[3]+t[8]*e[6],t[6]*e[1]+t[7]*e[4]+t[8]*e[7],t[6]*e[2]+t[7]*e[5]+t[8]*e[8]]}function J(t){const[e,n,r,o,s,i,a,c,l]=t,p=s*l-i*c,u=-(o*l-i*a),b=o*c-s*a,y=1/(e*p+n*u+r*b);return[p*y,(r*c-n*l)*y,(n*i-r*s)*y,u*y,(e*l-r*a)*y,(r*o-e*i)*y,b*y,(n*a-e*c)*y,(e*s-n*o)*y]}const N=255,h={"%":{min:0,max:100},number:{min:0,max:1}},Ve={"%":h["%"],number:{min:0,max:N}},L={"%":h["%"],number:h.number},Se={deg:{min:0,max:360},number:{min:0,max:360},"%":h["%"]},f={rgb:{r:Ve,g:Ve,b:Ve,alpha:h},hsl:{h:Se,s:{"%":h["%"],number:h.number},l:{"%":h["%"],number:h.number},alpha:h},hsv:{h:Se,s:{"%":h["%"],number:h.number},v:{"%":h["%"],number:h.number},alpha:h},hwb:{h:Se,w:{"%":h["%"],number:h.number},b:{"%":h["%"],number:h.number},alpha:h},lab:{l:{"%":h["%"],number:h["%"]},a:{number:{min:-125,max:125},"%":{min:-100,max:100}},b:{number:{min:-125,max:125},"%":{min:-100,max:100}},alpha:h},lch:{l:{"%":h["%"],number:h["%"]},c:{number:{min:0,max:150},"%":h["%"]},h:Se,alpha:h},oklab:{l:{"%":h["%"],number:h["%"]},a:{number:{min:-.4,max:.4},"%":{min:-100,max:100}},b:{number:{min:-.4,max:.4},"%":{min:-100,max:100}},alpha:h},oklch:{l:{"%":h["%"],number:h["%"]},c:{number:{min:0,max:.5},"%":h["%"]},h:Se,alpha:h},xyz:{x:{"%":h["%"],number:h.number},y:{"%":h["%"],number:h.number},z:{"%":h["%"],number:h.number},alpha:h},kelvin:{kelvin:{number:{min:1e3,max:4e4}},alpha:h},"srgb-linear":{r:L,g:L,b:L,alpha:h},"display-p3":{r:L,g:L,b:L,alpha:h},"a98-rgb":{r:L,g:L,b:L,alpha:h},"prophoto-rgb":{r:L,g:L,b:L,alpha:h},rec2020:{r:L,g:L,b:L,alpha:h}},z="%",In={rgb:{r:"",g:"",b:"",alpha:z},hsl:{h:"deg",s:"%",l:"%",alpha:z},hsv:{h:"deg",s:"%",v:"%",alpha:z},hwb:{h:"deg",w:"%",b:"%",alpha:z},lab:{l:"%",a:"",b:"",alpha:z},lch:{l:"%",c:"",h:"deg",alpha:z},oklab:{l:"%",a:"",b:"",alpha:z},oklch:{l:"%",c:"",h:"deg",alpha:z},xyz:{x:"%",y:"%",z:"%",alpha:z},kelvin:{kelvin:"K",alpha:z},"srgb-linear":{r:"",g:"",b:"",alpha:z},"display-p3":{r:"",g:"",b:"",alpha:z},"a98-rgb":{r:"",g:"",b:"",alpha:z},"prophoto-rgb":{r:"",g:"",b:"",alpha:z},rec2020:{r:"",g:"",b:"",alpha:z}},Vs={rgb:"RGB",hsl:"HSL",hsv:"HSV",hwb:"HWB",lab:"Lab",lch:"LCh",oklab:"OKLab",oklch:"OKLCh",xyz:"XYZ",kelvin:"Kelvin","srgb-linear":"sRGB Linear","display-p3":"Display P3","a98-rgb":"Adobe RGB","prophoto-rgb":"ProPhoto RGB",rec2020:"Rec. 2020"},vr=[.3127/.329,1,(1-.3127-.329)/.329],Pr=[.3457/.3585,1,(1-.3457-.3585)/.3585],ft=[1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],An=J(ft),Mn={D65:vr,D50:Pr},_n=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],Lr=J(_n),Rn=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774],zr=J(Rn),k=[4.0767416621,-3.3077115913,.2309699292,-1.2684380046,2.6097574011,-.3413193965,-.0041960863,-.7034186147,1.707614701],j=[.4122214708,.5363325363,.0514459929,.2119034982,.6806995451,.1073969566,.0883024619,.2817188376,.6299787005],v={l:[1,.3963377774,.2158037573],m:[1,-.1055613458,-.0638541728],s:[1,-.0894841775,-1.291485548]},Ur=[{test:(t,e)=>-1.88170328*t-.80936493*e>1,k0:1.19086277,k1:1.76576728,k2:.59662641,k3:.75515197,k4:.56771245,wl:4.0767416621,wm:-3.3077115913,ws:.2309699292},{test:(t,e)=>1.81444104*t-1.19445276*e>1,k0:.73956515,k1:-.45954404,k2:.08285427,k3:.1254107,k4:.14503204,wl:-1.2684380046,wm:2.6097574011,ws:-.3413193965},{test:()=>!0,k0:1.35733652,k1:-.00915799,k2:-1.1513021,k3:-.50559606,k4:.00692167,wl:-.0041960863,wm:-.7034186147,ws:1.707614701}],Ft={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",padaleckipink:"oklch(100% 0.42 360deg / 71.70%)","lodge-blu-color":"rgb(53 101 144)",lavendi:"oklch(79.90% 0.11 318.24deg / 100%)",shadyshroom:"oklch(53% 0.07 21.60deg / 100%)",patriarchalplum:"oklch(31.20% 0.11 19.80deg / 100%)"};function R(t,e,n){return Math.min(Math.max(t,e),n)}function A(t,e,n,r=0,o=1){const s=(o-r)/(n-e);if(n===e)throw new Error("fromMax and fromMin cannot be equal");return(t-e)*s+r}function qe(t,e,n){return(1-t)*e+t*n}function Hs(t,e,n){return e=e===0?1e-9:e,e*Math.pow(n/e,t)}function Le(t,e){const n=e.length-1,r=[...e];for(let o=1;o<=n;o++)for(let s=0;s<=n-o;s++)r[s]=qe(t,r[s],r[s+1]);return r[0]}function On(t,e,n,r,o){return[Le(t,[0,e,r,1]),Le(t,[0,n,o,1])]}function $e(t,e){const n=e.map(o=>o[0]),r=e.map(o=>o[1]);return[Le(t,n),Le(t,r)]}function Xs(t,e,n,r){let o="M0 0";for(let s=0;s<=1;s+=.001){const[i,a]=On(s,t,e,n,r);o+=` L${i} ${a}`}return`<path d="${o}"/>`}function Ws(t,e,n,r){const o=s=>s.toFixed(2);return`cubic-bezier(${o(t)}, ${o(e)}, ${o(n)}, ${o(r)})`}const Gr=2.4,Je=.055,Nn=12.92,js=.04045,$r=js/Nn;function Lt(t){const e=t<0?-1:1,n=t*e;return n<=$r?t/Nn:e*((n+Je)/(1+Je))**Gr}function zt(t){const e=t<0?-1:1,n=t*e;return n<=$r?t*Nn:e*((1+Je)*n**(1/Gr)-Je)}function Ut(t,e,n){return Math.min(Math.max(t,e),n)}const Ys=.02;function Zs(t,e,n,r,o,s){const i=t-r,a=e-o,c=n-s;return Math.sqrt(i*i+a*a+c*c)}function bt(t,e,n){const r=t+v.l[1]*e+v.l[2]*n,o=t+v.m[1]*e+v.m[2]*n,s=t+v.s[1]*e+v.s[2]*n,i=r*r*r,a=o*o*o,c=s*s*s;return[k[0]*i+k[1]*a+k[2]*c,k[3]*i+k[4]*a+k[5]*c,k[6]*i+k[7]*a+k[8]*c]}function Fr(t,e,n){return t>=0&&t<=1&&e>=0&&e<=1&&n>=0&&n<=1}function Dr(t,e){const n=Ur.find(T=>T.test(t,e)),{k0:r,k1:o,k2:s,k3:i,k4:a,wl:c,wm:l,ws:p}=n;let u=r+o*t+s*e+i*t*t+a*t*e;const b=v.l[1]*t+v.l[2]*e,C=v.m[1]*t+v.m[2]*e,y=v.s[1]*t+v.s[2]*e;{const T=1+u*b,w=1+u*C,E=1+u*y,I=T*T*T,U=w*w*w,H=E*E*E,ae=3*b*T*T,ce=3*C*w*w,le=3*y*E*E,Ee=6*b*b*T,Ie=6*C*C*w,Ae=6*y*y*E,be=c*I+l*U+p*H,ue=c*ae+l*ce+p*le,Fe=c*Ee+l*Ie+p*Ae;u=u-be*ue/(ue*ue-.5*be*Fe)}return u}function Vr(t,e){const n=Dr(t,e),[r,o,s]=bt(1,n*t,n*e),i=Math.cbrt(1/Math.max(r,o,s)),a=i*n;return{L:i,C:a}}function Hr(t,e,n,r,o,s){let i;if((n-o)*s.C-(s.L-o)*r<=0)i=s.C*o/(r*s.L+s.C*(o-n));else{i=s.C*(o-1)/(r*(s.L-1)+s.C*(o-n));const a=n-o,c=r,l=v.l[1]*t+v.l[2]*e,p=v.m[1]*t+v.m[2]*e,u=v.s[1]*t+v.s[2]*e,b=a+c*l,C=a+c*p,y=a+c*u;{const T=o*(1-i)+i*n,w=i*r,E=T+w*l,I=T+w*p,U=T+w*u,H=E*E*E,ae=I*I*I,ce=U*U*U,le=3*b*E*E,Ee=3*C*I*I,Ie=3*y*U*U,Ae=6*b*b*E,be=6*C*C*I,ue=6*y*y*U,Fe=k[0]*H+k[1]*ae+k[2]*ce-1,Rt=k[0]*le+k[1]*Ee+k[2]*Ie,ds=k[0]*Ae+k[1]*be+k[2]*ue,qn=Rt/(Rt*Rt-.5*Fe*ds);let Ot=-Fe*qn;const Jn=k[3]*H+k[4]*ae+k[5]*ce-1,Nt=k[3]*le+k[4]*Ee+k[5]*Ie,gs=k[3]*Ae+k[4]*be+k[5]*ue,Qn=Nt/(Nt*Nt-.5*Jn*gs);let Bt=-Jn*Qn;const er=k[6]*H+k[7]*ae+k[8]*ce-1,vt=k[6]*le+k[7]*Ee+k[8]*Ie,ws=k[6]*Ae+k[7]*be+k[8]*ue,tr=vt/(vt*vt-.5*er*ws);let Pt=-er*tr;Ot=qn>=0?Ot:1/0,Bt=Qn>=0?Bt:1/0,Pt=tr>=0?Pt:1/0,i+=Math.min(Ot,Bt,Pt)}}return i}const Ks=1e-5,qs=.05;function Xr(t,e,n){const[r,o,s]=bt(t,e,n);if(Fr(r,o,s))return[t,e,n];const i=Math.max(Ks,Math.sqrt(e*e+n*n)),a=e/i,c=n/i,l=Vr(a,c),p=t-.5,u=.5+Math.abs(p)+qs*i,b=.5*(1+Math.sign(p)*(u-Math.sqrt(u*u-2*Math.abs(p)))),C=Hr(a,c,t,i,b,l),y=b*(1-C)+C*t,T=C*i;return[y,T*a,T*c]}function Wr(t,e,n){const r=Lt(t),o=Lt(e),s=Lt(n),i=Math.cbrt(j[0]*r+j[1]*o+j[2]*s),a=Math.cbrt(j[3]*r+j[4]*o+j[5]*s),c=Math.cbrt(j[6]*r+j[7]*o+j[8]*s);return[.2104542553*i+.793617785*a-.0040720468*c,1.9779984951*i-2.428592205*a+.4505937099*c,.0259040371*i+.7827717662*a-.808675766*c]}function jr(t,e,n){if(t>=0&&t<=1&&e>=0&&e<=1&&n>=0&&n<=1)return[t,e,n];const[r,o,s]=Wr(t,e,n),[i,a,c]=Xr(r,o,s),[l,p,u]=bt(i,a,c);return[Ut(zt(l),0,1),Ut(zt(p),0,1),Ut(zt(u),0,1)]}const Js=t=>{const e=f[t],n=In[t];return Object.entries(e).reduce((r,[o,s])=>{const i=n[o];let{min:a,max:c}=s[i]??s.number;return a=`${a}${i}`,c=`${c}${i}`,r[o]={min:a,max:c},r},{})},Z=16,Yr=t=>{if(t=t.slice(1),t.length<=4){const e=parseInt(t[0]+t[0],Z),n=parseInt(t[1]+t[1],Z),r=parseInt(t[2]+t[2],Z),o=t[3]?parseInt(t[3]+t[3],Z)/N:1;return new P(e,n,r,o)}else{const e=parseInt(t.slice(0,2),Z),n=parseInt(t.slice(2,4),Z),r=parseInt(t.slice(4,6),Z),o=t.length===8?parseInt(t.slice(6,8),Z)/N:1;return new P(e,n,r,o)}},Qs=({r:t,g:e,b:n,alpha:r})=>{const o=s=>{const i=s.toString(Z);return i.length===1?"0"+i:i};return`#${o(t)}${o(e)}${o(n)}${r<1?o(Math.round(r*N)):""}`},Zr=1e3,Kr=4e4,qr=100,Bn=({kelvin:t,alpha:e})=>{t=R(t,Zr,Kr)/qr;let n,r,o;return t<=66?n=N:(n=t-60,n=329.698727446*n**-.1332047592),n=R(n,0,N)/N,t<=66?(r=t,r=99.4708025861*Math.log(r)-161.1195681661):(r=t-60,r=288.1221695283*r**-.0755148492),r=R(r,0,N)/N,t>=66?o=N:t<=19?o=0:(o=t-10,o=138.5177312231*Math.log(o)-305.0447927307),o=R(o,0,N)/N,new P(n,r,o,e)},Jr=({r:t,g:e,b:n,alpha:r})=>{t=R(t*N,0,N),e=R(e*N,0,N),n=R(n*N,0,N);let o;if(n===N?o=6600:n===0?o=1900:o=Math.exp((n+305.0447927307)/138.5177312231)+10,t<N){const i=(329.698727446/t)**-7.507239275877164+60;o=Math.max(o,i)}const s=o<=6600?Math.exp((e+161.1195681661)/99.4708025861):(288.1221695283/e)**(1/-.0755148492)+60;return o=(o+s)/2,o=R(Math.round(o*qr),Zr,Kr),new Cn(o,r)},vn=({h:t,s:e,v:n,alpha:r})=>{const o=n-n*e/2;let s;return o===0||o===1?s=0:s=(n-o)/Math.min(o,1-o),new fe(t,s,o,r)},Pn=({h:t,s:e,l:n,alpha:r})=>{const o=n+e*Math.min(n,1-n);let s;return o===0?s=0:s=2*(1-n/o),new rt(t,s,o,r)},Qr=({h:t,w:e,b:n,alpha:r})=>{let o,s;const i=e+n;return i>=1?(s=e/i,o=0):(s=1-n,o=s===0?0:1-e/s),vn(new rt(t,o,s,r))},eo=({h:t,s:e,l:n,alpha:r})=>{const{h:o,s,v:i}=Pn(new fe(t,e,n,r));return new ot(o,i*(1-s),1-i,r)},Ln=({r:t,g:e,b:n,alpha:r})=>{const o=Math.max(t,e,n),s=Math.min(t,e,n);let[i,a,c]=[0,0,(o+s)/2];const l=o-s;switch(a=l/(1-Math.abs(2*c-1)),o){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4;break}return i/=6,a<0&&(i=(i+.5)%1,a=Math.abs(a)%1),i>=1&&(i-=1),new fe(i,a,c,r)};function to({h:t,s:e,l:n,alpha:r}){const o=(1-Math.abs(2*n-1))*e,s=o*(1-Math.abs(t*6%2-1)),i=n-o/2;let a,c,l;return t<1/6?[a,c,l]=[o,s,0]:t<2/6?[a,c,l]=[s,o,0]:t<3/6?[a,c,l]=[0,o,s]:t<4/6?[a,c,l]=[0,s,o]:t<5/6?[a,c,l]=[s,0,o]:[a,c,l]=[o,0,s],new P(a+i,c+i,l+i,r)}const ei=216/24389,ti=24/116,Dt=24389/27,ni=8,Re=16,Oe=116,no=500,ro=200;function ri(t){if(t.whitePoint==="D50")return[t.x,t.y,t.z];if(t.whitePoint==="D65")return O([t.x,t.y,t.z],ft);throw new Error(`Unsupported white point: ${t.whitePoint}`)}function oi(t){if(t.whitePoint==="D65")return[t.x,t.y,t.z];if(t.whitePoint==="D50")return O([t.x,t.y,t.z],An);throw new Error(`Unsupported white point: ${t.whitePoint}`)}function dt(t,e="D50"){const n=E=>E>ei?Math.cbrt(E):(Dt*E+Re)/Oe,r=Mn[e],[o,s,i]=ri(t),a=o/r[0],c=s/r[1],l=i/r[2],p=n(a),u=n(c),b=n(l),C=Oe*u-Re,y=no*(p-u),T=ro*(u-b),w=new Ue(A(C,f.lab.l.number.min,f.lab.l.number.max),A(y,f.lab.a.number.min,f.lab.a.number.max),A(T,f.lab.b.number.min,f.lab.b.number.max),t.alpha);return w.whitePoint=e,w}function gt(t){const e=I=>I>ti?I**3:(Oe*I-Re)/Dt,n=I=>I>ni?((I+Re)/Oe)**3:I/Dt,r=Mn[t.whitePoint];let{l:o,a:s,b:i,alpha:a}=t;o=A(o,0,1,f.lab.l.number.min,f.lab.l.number.max),s=A(s,0,1,f.lab.a.number.min,f.lab.a.number.max),i=A(i,0,1,f.lab.b.number.min,f.lab.b.number.max);const c=(o+Re)/Oe,l=s/no+c,p=c-i/ro,[u,b,C]=[e(l),n(o),e(p)];let y=u*r[0],T=b*r[1],w=C*r[2];const E=new F(y,T,w,a);return E.whitePoint=t.whitePoint,[y,T,w]=oi(E),E.whitePoint="D65",E.x=y,E.y=T,E.z=w,E}const zn=[.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],oo=J(zn),so=2.4,Qe=.055,Un=12.92,si=.04045,io=si/Un;function he(t){const e=t<0?-1:1,n=t*e;return n<=io?t/Un:e*((n+Qe)/(1+Qe))**so}function Gn(t){const e=t<0?-1:1,n=t*e;return n<=io?t*Un:e*((1+Qe)*n**(1/so)-Qe)}function wt({r:t,g:e,b:n,alpha:r}){const o=[he(t),he(e),he(n)],[s,i,a]=O(o,zn);return new F(s,i,a,r)}const kt=({x:t,y:e,z:n,alpha:r},o=!0)=>{const s=O([t,e,n],oo),[i,a,c]=s.map(Gn);if(o){const l=Vo(new P(i,a,c,r));return new P(l.r,l.g,l.b,r)}else return new P(i,a,c,r)};function ao({l:t,c:e,h:n,alpha:r}){e=A(e,0,1,f.lch.c.number.min,f.lch.c.number.max);const o=n*2*Math.PI,s=Math.cos(o)*e,i=Math.sin(o)*e;return new Ue(t,A(s,f.lab.a.number.min,f.lab.a.number.max),A(i,f.lab.b.number.min,f.lab.b.number.max),r)}function co({l:t,a:e,b:n,alpha:r}){e=A(e,0,1,f.lab.a.number.min,f.lab.a.number.max),n=A(n,0,1,f.lab.b.number.min,f.lab.b.number.max);const o=Math.hypot(e,n);let s=Math.atan2(n,e)/(2*Math.PI);return s<0&&(s+=1),new st(t,A(o,f.lch.c.number.min,f.lch.c.number.max),s,r)}function St({l:t,a:e,b:n,alpha:r}){e=A(e,0,1,f.oklab.a.number.min,f.oklab.a.number.max),n=A(n,0,1,f.oklab.b.number.min,f.oklab.b.number.max);const o=O([t,e,n],zr),s=[o[0]*o[0]*o[0],o[1]*o[1]*o[1],o[2]*o[2]*o[2]],[i,a,c]=O(s,Lr);return new F(i,a,c,r)}function yt(t){const{x:e,y:n,z:r}=t,o=O([e,n,r],_n),s=[Math.cbrt(o[0]),Math.cbrt(o[1]),Math.cbrt(o[2])],[i,a,c]=O(s,Rn);return new Ge(i,A(a,f.oklab.a.number.min,f.oklab.a.number.max),A(c,f.oklab.b.number.min,f.oklab.b.number.max),t.alpha)}function lo(t){const e=St(t);return dt(e)}function uo(t){const e=gt(t);return yt(e)}function $n({l:t,a:e,b:n,alpha:r}){e=A(e,0,1,f.oklab.a.number.min,f.oklab.a.number.max),n=A(n,0,1,f.oklab.b.number.min,f.oklab.b.number.max);const o=Math.hypot(e,n);let s=Math.atan2(n,e)/(2*Math.PI);return s<0&&(s+=1),new it(t,A(o,f.oklch.c.number.min,f.oklch.c.number.max),s,r)}function Fn({l:t,c:e,h:n,alpha:r}){e=A(e,0,1,f.oklch.c.number.min,f.oklch.c.number.max);const o=n*2*Math.PI,s=Math.cos(o)*e,i=Math.sin(o)*e;return new Ge(t,A(s,f.oklab.a.number.min,f.oklab.a.number.max),A(i,f.oklab.b.number.min,f.oklab.b.number.max),r)}function ii(t){return lo(Fn(t))}function ai(t){return $n(uo(t))}function Ct(t){const e=to(t);return wt(e)}function xt(t){const e=kt(t);return Ln(e)}function po(t){const e=vn(t);return Ct(e)}function mo(t){const e=xt(t);return Pn(e)}function ho(t){const e=Qr(t);return Ct(e)}function fo(t){const e=xt(t);return eo(e)}function bo(t){const e=ao(t);return gt(e)}function go(t){const e=dt(t);return co(e)}function wo(t){const e=Fn(t);return St(e)}function ko(t){const e=yt(t);return $n(e)}function So(t){const e=Bn(t);return wt(e)}function yo(t){const e=kt(t);return Jr(e)}const Co=563/256;function He(t){return(t<0?-1:1)*Math.abs(t)**Co}function xo(t){return(t<0?-1:1)*Math.abs(t)**(1/Co)}const To=1/512,Eo=1.8;function Xe(t){const e=t<0?-1:1,n=Math.abs(t);return e*(n<=To*16?n/16:n**Eo)}function Io(t){const e=t<0?-1:1,n=Math.abs(t);return e*(n>=To?n**(1/Eo):n*16)}const et=1.09929682680944,Ao=.018053968510807;function We(t){const e=t<0?-1:1,n=Math.abs(t);return n<Ao*4.5?e*n/4.5:e*((n+et-1)/et)**(1/.45)}function Mo(t){const e=t<0?-1:1,n=Math.abs(t);return n>=Ao?e*(et*n**.45-(et-1)):e*4.5*n}const _o=[.4865709486482162,.26566769316909306,.1982172852343625,.22897456406974884,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],ci=J(_o),Ro=[.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.07529145849399788,.02703136138641234,.07068885253582723,.9913375368376388],li=J(Ro),Oo=[.7977604896723027,.13518583717574031,.0313493495815248,.2880711282292934,.7118432178101014,8565396060525902e-20,0,0,.8251046025104602],ui=J(Oo),No=[.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.0609850577107909],pi=J(No);function Bo({r:t,g:e,b:n,alpha:r}){const[o,s,i]=O([t,e,n],zn);return new F(o,s,i,r)}function vo({x:t,y:e,z:n,alpha:r}){const[o,s,i]=O([t,e,n],oo);return new at(o,s,i,r)}function Po({r:t,g:e,b:n,alpha:r}){const o=[he(t),he(e),he(n)],[s,i,a]=O(o,_o);return new F(s,i,a,r)}function Lo({x:t,y:e,z:n,alpha:r}){const o=O([t,e,n],ci),[s,i,a]=o.map(Gn);return new ct(s,i,a,r)}function zo({r:t,g:e,b:n,alpha:r}){const o=[He(t),He(e),He(n)],[s,i,a]=O(o,Ro);return new F(s,i,a,r)}function Uo({x:t,y:e,z:n,alpha:r}){const o=O([t,e,n],li),[s,i,a]=o.map(xo);return new lt(s,i,a,r)}function Go({r:t,g:e,b:n,alpha:r}){const o=[Xe(t),Xe(e),Xe(n)],s=O(o,Oo),[i,a,c]=O(s,An);return new F(i,a,c,r)}function $o({x:t,y:e,z:n,alpha:r}){const o=O([t,e,n],ft),s=O(o,ui),[i,a,c]=s.map(Io);return new ut(i,a,c,r)}function Fo({r:t,g:e,b:n,alpha:r}){const o=[We(t),We(e),We(n)],[s,i,a]=O(o,No);return new F(s,i,a,r)}function Do({x:t,y:e,z:n,alpha:r}){const o=O([t,e,n],pi),[s,i,a]=o.map(Mo);return new pt(s,i,a,r)}const lr={rgb:{to:wt,from:kt},hsl:{to:Ct,from:xt},hsv:{to:po,from:mo},hwb:{to:ho,from:fo},lab:{to:gt,from:dt},lch:{to:bo,from:go},oklab:{to:St,from:yt},oklch:{to:wo,from:ko},kelvin:{to:So,from:yo},xyz:{to:t=>t,from:t=>t},"srgb-linear":{to:Bo,from:vo},"display-p3":{to:Po,from:Lo},"a98-rgb":{to:zo,from:Uo},"prophoto-rgb":{to:Go,from:$o},rec2020:{to:Fo,from:Do}};function oe(t,e){if(t.colorSpace===e)return t;const n=lr[t.colorSpace].to,r=n(t),o=lr[e].from;return o(r)}const de=1e-6;function Vo(t){const e=oe(t,"rgb"),n=Number.isNaN(e.r)?0:e.r,r=Number.isNaN(e.g)?0:e.g,o=Number.isNaN(e.b)?0:e.b;if(n>=0&&n<=1&&r>=0&&r<=1&&o>=0&&o<=1)return t;if(n>=-de&&n<=1+de&&r>=-de&&r<=1+de&&o>=-de&&o<=1+de){const l=new P(R(n,0,1),R(r,0,1),R(o,0,1),t.alpha);return oe(l,t.colorSpace)}const[s,i,a]=jr(n,r,o),c=new P(s,i,a,t.alpha);return oe(c,t.colorSpace)}const Ho={hsl:"h",hsv:"h",hwb:"h",lch:"h",oklch:"h"};function Xo(t,e,n,r="shorter"){if(Number.isNaN(t)&&Number.isNaN(e))return 0;if(Number.isNaN(t))return e;if(Number.isNaN(e))return t;let o=e-t;switch(r){case"shorter":o>.5?t+=1:o<-.5&&(e+=1);break;case"longer":o>0&&o<.5?t+=1:o>-.5&&o<=0&&(e+=1);break;case"increasing":o<0&&(e+=1);break;case"decreasing":o>0&&(t+=1);break}let s=t+n*(e-t);return s=(s%1+1)%1,s}function Wo(t,e,n,r,o="oklab",s="shorter"){const i=oe(t,o),a=oe(e,o);n<0&&(n=0),r<0&&(r=0);const c=n+r;c===0?(n=.5,r=.5):c!==1&&(n=n/c,r=r/c);const l=Math.min(c,1),p=Ho[o],u=i.keys().filter(I=>I!=="alpha"),b=Number.isNaN(i.alpha)?a.alpha:i.alpha,C=Number.isNaN(a.alpha)?i.alpha:a.alpha,y=qe(r,b,C)*l,T=[];for(const I of u){let U=i[I],H=a[I];if(Number.isNaN(U)&&Number.isNaN(H)){T.push(0);continue}if(Number.isNaN(U)&&(U=H),Number.isNaN(H)&&(H=U),I===p)T.push(Xo(U,H,r,s));else{const ae=U*b,ce=H*C,le=qe(r,ae,ce);T.push(y>0?le/y:0)}}const w=i.constructor;return new w(...T,y)}const mi=(t,e,n)=>{const r=f[e][n];return r[t]??r.number},jo=(t,e,n,r,o=!1)=>{e=o?In[n][r]:e;const{min:s,max:i}=mi(e,n,r),[a,c,l,p]=o?[s,i,0,1]:[0,1,s,i],u=A(t,l,p,a,c);return new S(u,o?e:"")},Yo=(t,e=!1)=>{const n=t.colorSpace;return t.keys().forEach(r=>{const o=t[r]instanceof S?t[r].value:t[r];t[r]=jo(o,t[r]?.unit,n,r,e)}),t},tt=(t,e=!1,n=!1)=>{t=n?t:t.clone();const r=Yo(t.value,e);return n?t:new S(r).coalesce(t,!0)},Vt=(t,e="lab",n=!1,r=!1,o=!1)=>{const s=n?o?t:t.clone():tt(t,!1,o),i=oe(s.toJSON(),e);return i.entries().forEach(([a,c])=>{i[a]=new S(c)}),s.value=i,s.superType[1]=e,r?tt(s,!0,!0):s},Zo=(t,e,n="lab",r=!1,o=!1,s=!1)=>[Vt(t,n,r,o,s),Vt(e,n,r,o,s)],$=t=>new S(t,"color",["color",t.colorSpace],void 0,"color");function Ht(t){const n=tt(t).value,r=n.clone();for(const o of n.keys()){const s=n[o];r[o]=s instanceof S?s.value:s}return r}function hi(t){const e=t.replace(/[^0-9.+\-*/() e]/g,"");return new Function(`return (${e})`)()}function ur(t,e){switch(t.type){case"ref":return e[t.name]??0;case"literal":return t.value;case"none":return NaN;case"calc":{let n=t.expr;const r=Object.keys(e).sort((o,s)=>s.length-o.length);for(const o of r)n=n.replace(new RegExp(`\\b${o}\\b`,"g"),String(e[o]));return hi(n)}}}function fi(t,e,n,r){const o=Ht(t),s=oe(o,e),i={};for(const[b,C]of s.entries())i[b]=C;const a=n.map(b=>ur(b,i)),c=r?ur(r,i):i.alpha??1,p={rgb:P,hsl:fe,hwb:ot,lab:Ue,lch:st,oklab:Ge,oklch:it,xyz:F,"srgb-linear":at,"display-p3":ct,"a98-rgb":lt,"prophoto-rgb":ut,rec2020:pt}[e]??P,u=new p(...a,c);return $(u)}const bi={srgb:"rgb","srgb-linear":"srgb-linear","display-p3":"display-p3","a98-rgb":"a98-rgb","prophoto-rgb":"prophoto-rgb",rec2020:"rec2020",lab:"lab",oklab:"oklab",oklch:"oklch",hsl:"hsl",hwb:"hwb",lch:"lch",xyz:"xyz","xyz-d65":"xyz","xyz-d50":"xyz"},di={srgb:{space:"rgb",ctor:P},"srgb-linear":{space:"srgb-linear",ctor:at},"display-p3":{space:"display-p3",ctor:ct},"a98-rgb":{space:"a98-rgb",ctor:lt},"prophoto-rgb":{space:"prophoto-rgb",ctor:ut},rec2020:{space:"rec2020",ctor:pt},xyz:{space:"xyz",ctor:F},"xyz-d65":{space:"xyz",ctor:F},"xyz-d50":{space:"xyz",ctor:F}},gi=B(","),wi=V(/\s+/),Tt=B("/"),Et=B("("),It=B(")"),nt=d(gi.trim(g),wi),Ko=d(Tt.trim(g),nt),X=x.lazy(()=>d(W.Percentage,W.Angle.map(t=>{const e=mt(t.value,t.unit);return new S(e,"deg",["angle"])}),d(q,Or).map(t=>new S(t)),ht.map(()=>new S(NaN)))),_e=d(m("calc").next(V(/\(([^)]+)\)/,t=>t?.[1]??null)).map(t=>({type:"calc",expr:t})),ht.map(()=>({type:"none"})),V(/\b(alpha|r|g|b|h|s|l|c|w|a|x|y|z)\b/).map(t=>({type:"ref",name:t})),X.map(t=>({type:"literal",value:t.value}))),Q=t=>{const e=B(t).skip(m("a").opt()),n=d(_(X.skip(Ko),X),X.map(o=>[o])),r=_(X.skip(nt),X.skip(nt),n).trim(g).wrap(Et,It);return e.next(r).map(([o,s,[i,a]])=>[o,s,i,a??new S(1)])};function ie(t,e){return B(t).skip(m("a").opt()).next(_(m("from").skip(g).next(x.lazy(()=>At.Value)),g.next(_e),g.next(_e),g.next(_e),Tt.trim(g).next(_e).opt()).trim(g).wrap(Et,It)).map(([n,r,o,s,i])=>fi(n,e,[r,o,s],i))}const ki=V(/#[0-9a-fA-F]{3,8}/).map(t=>{const{r:e,g:n,b:r,alpha:o}=Yr(t);return $(new P(e,n,r,o))}),Si=q.skip(m("k")).map(t=>{const e=Bn(new Cn(t));return $(e)}),yi=d(ie("rgb","rgb"),Q("rgb").map(([t,e,n,r])=>$(new P(t,e,n,r)))),Ci=d(ie("hsl","hsl"),Q("hsl").map(([t,e,n,r])=>$(new fe(t,e,n,r)))),xi=Q("hsv").map(([t,e,n,r])=>$(new rt(t,e,n,r))),Ti=d(ie("hwb","hwb"),Q("hwb").map(([t,e,n,r])=>$(new ot(t,e,n,r)))),Ei=d(ie("lab","lab"),Q("lab").map(([t,e,n,r])=>$(new Ue(t,e,n,r)))),Ii=d(ie("lch","lch"),Q("lch").map(([t,e,n,r])=>$(new st(t,e,n,r)))),Ai=d(ie("oklab","oklab"),Q("oklab").map(([t,e,n,r])=>$(new Ge(t,e,n,r)))),Mi=d(ie("oklch","oklch"),Q("oklch").map(([t,e,n,r])=>$(new it(t,e,n,r)))),_i=d(ie("xyz","xyz"),Q("xyz").map(([t,e,n,r])=>$(new F(t,e,n,r)))),Ri=d(m("srgb-linear").map(()=>"srgb-linear"),m("srgb").map(()=>"srgb"),m("display-p3").map(()=>"display-p3"),m("a98-rgb").map(()=>"a98-rgb"),m("prophoto-rgb").map(()=>"prophoto-rgb"),m("rec2020").map(()=>"rec2020"),m("oklab").map(()=>"oklab"),m("oklch").map(()=>"oklch"),m("lab").map(()=>"lab"),m("lch").map(()=>"lch"),m("hsl").map(()=>"hsl"),m("hwb").map(()=>"hwb"),m("xyz-d65").map(()=>"xyz-d65"),m("xyz-d50").map(()=>"xyz-d50"),m("xyz").map(()=>"xyz")),Oi=d(m("shorter"),m("longer"),m("increasing"),m("decreasing")).skip(g).skip(m("hue")),pr=x.lazy(()=>_(At.Value,g.next(W.Percentage).opt())),Ni=m("color-mix").next(_(m("in").skip(g).next(_(Ri,g.next(Oi).opt())),B(",").trim(g).next(pr),B(",").trim(g).next(pr)).trim(g).wrap(Et,It)).map(([[t,e],[n,r],[o,s]])=>{const i=bi[t]??"oklab",a=e??"shorter";let c=r!=null?r.value/100:-1,l=s!=null?s.value/100:-1;c<0&&l<0?(c=.5,l=.5):c<0?c=1-l:l<0&&(l=1-c);const p=Ht(n),u=Ht(o),b=Wo(p,u,c,l,i,a);return $(b)}),Bi=d(m("srgb-linear").map(()=>"srgb-linear"),m("srgb").map(()=>"srgb"),m("display-p3").map(()=>"display-p3"),m("a98-rgb").map(()=>"a98-rgb"),m("prophoto-rgb").map(()=>"prophoto-rgb"),m("rec2020").map(()=>"rec2020"),m("xyz-d65").map(()=>"xyz-d65"),m("xyz-d50").map(()=>"xyz-d50"),m("xyz").map(()=>"xyz")),vi=m("color").next(_(Bi.skip(g),X.skip(g),X.skip(g),d(_(X.skip(Tt.trim(g)),X),X.map(t=>[t,void 0]))).trim(g).wrap(Et,It)).map(([t,e,n,[r,o]])=>{const s=di[t];if(!s)throw new Error(`Unknown color() space: ${t}`);const i=o??new S(1);if(t==="srgb"){const c=l=>l.value*255;return $(new P(c(e),c(n),c(r),i.value))}const a=new s.ctor(e,n,r,i);return $(a)}),Pi=d(...Object.keys(Ft).sort((t,e)=>e.length-t.length).map(m)).chain(t=>{const e=Ft[t.toLowerCase()];if(e){const n=Hn(e);if(n)return Nr(n)}return Br()}),qo=d(Ni,vi,ki,Si,yi,Ci,xi,Ti,Ei,Ii,Ai,Mi,_i,Pi).trim(g),At={Value:qo,colorValue:X,componentExpr:_e,sep:nt,alphaSep:Ko,div:Tt};function Li(t){return Te(qo,t)}const zi=d(...Ne.map(m)),Ui=d(...ve.map(m)),Gi=d(...Be.map(m)),$i=d(...Pe.map(m)),Fi=d(...Sn.map(m)),Di=B(","),Vi=B(" "),Hi=d(Di,Vi).trim(g),Jo=_(q,zi).map(([t,e])=>{const n=["length"];return kn.includes(e)?n.push("relative"):wn.includes(e)&&n.push("absolute"),new S(t,e,n)}),Qo=_(q,Ui).map(([t,e])=>new S(t,e,["angle"])),Dn=_(q,Gi).map(([t,e])=>new S(t,e,["time"])),Xi=x.lazy(()=>d(Vn,Dn)),es=_(q,$i).map(([t,e])=>new S(t,e,["resolution"])),Vn=d(_(q,Fi),m("from").map(()=>[0,"%"]),m("to").map(()=>[100,"%"])).map(([t,e])=>new S(t,e,["percentage"])),ts=x.lazy(()=>At.Value),ns=B("/").trim(g).map(()=>new S("/","string")),rs=d(Jo,Qo,Dn,es,Vn,ts,ns,q.map(t=>new S(t)),ht.map(()=>new S(NaN))).trim(g),W={Length:Jo,Angle:Qo,Time:Dn,TimePercentage:Xi,Resolution:es,Percentage:Vn,Color:ts,Slash:ns,Value:rs,sep:Hi};function Hn(t){return Te(rs,t)}const ye=B("("),Ce=B(")"),Xt=B(","),os=x.lazy(()=>Yn.sepBy(d(Xt,g)).trim(g).map(t=>new xe(...t))),Xn=t=>_(t||Rr,os.wrap(ye,Ce)),Wi=()=>{const t=V(/[^)]+/);return B("var").next(t.trim(g).wrap(ye,Ce)).map(e=>new S(e,"var"))},ji=()=>{const t=x.lazy(()=>d(V(/[^()]+/),t.many(1).wrap(ye,Ce).map(e=>`(${e.join(" ")})`)).many(1));return B("calc").next(d(x.lazy(()=>Yn).trim(g).wrap(ye,Ce),t.wrap(ye,Ce).map(e=>e.join(" ")))).map(e=>e instanceof S?e:new S(e,"calc"))},Yi=["translate","scale","rotate","skew"],Wt=["x","y","z"],Zi=Wt.map(m),Ki=Yi.map(m),qi=()=>{const t=_(d(...Ki),d(...Zi,B(""))),e=(r,o)=>r+o.toUpperCase();return Xn(t).map(([[r,o],s])=>{const i=r.toLowerCase(),a={};if(o){const l=i+o.toUpperCase();a[l]=s[0]}else s.length===1?Wt.forEach(l=>{const p=e(i,l);a[p]=s[0]}):s.forEach((l,p)=>{const u=e(i,Wt[p]);a[u]=l});const c=Object.entries(a).map(([l,p])=>new se(l,[p]));return new xe(...c)})},Ji={left:"270",right:"90",top:"0",bottom:"180"},Qi=()=>{const t=d(...["linear-gradient","radial-gradient"].map(m)),e=_(B("to").skip(g),d(...["left","right","top","bottom"].map(m))).map(([,a])=>{const c=Ji[a.toLowerCase()];return new S(c,"deg")}),n=d(W.Angle,e),r=d(W.Length,W.Percentage),o=_(W.Color,r.sepBy(g)).map(([a,c])=>!c||c.length===0?[a]:[a,...c]),s=_(o,Xt.trim(g).next(d(o,r)).many()).map(([a,c])=>[a,...c]);return _(t,_(n.skip(Xt).opt(),s).trim(g).wrap(ye,Ce).map(([a,c])=>a?[a,...c].flat():[c])).map(([a,c])=>new se(a,c))},ea=()=>Xn(B("cubic-bezier")).map(t=>new se("cubic-bezier",t[1])),Wn=V(/[^\(\)\{\}\s,;]+/).map(t=>new S(t)),jn=d(qi(),Wi(),ji(),Qi(),ea(),Xn().map(([t,e])=>new se(t,e))),Yn=d(W.Value,jn,Wn).trim(g),ta={Function:jn,Value:Yn,FunctionArgs:os},ss=_(B("{"),V(/[^{}]+/),B("}")).map(t=>{const e=t.join(`
|
|
7
|
+
`).length:0}toString(){return Mr(this)}}function M(t,e,...n){return{name:t,parser:e,args:n}}let Us=0;const me=new Map,De=new Map;let Me;function G(t){return(!Me||t.offset>Me.offset)&&(Me=t),Me}function _r(t){return t.parser?t.parser:t.parser=t()}class x{constructor(e,n={}){this.parser=e,this.context=n}id=Us++;state;reset(){Me=void 0,me.clear(),De.clear()}parseState(e){this.reset();const n=this.parser(new Ke(e));return this.state=G(n),this.state.isError=n.isError,this.state.isError,n}parse(e){return this.parseState(e).value}getCijKey(e){return`${this.id}${e.offset}`}atLeftRecursionLimit(e){return(De.get(this.getCijKey(e))??0)>e.src.length-e.offset}memoize(){const e=n=>{const r=this.getCijKey(n),o=De.get(r)??0;let s=me.get(this.id);if(s&&s.offset>=n.offset)return s;if(this.atLeftRecursionLimit(n))return n.err(void 0);De.set(r,o+1);const i=this.parser(n);return s=me.get(this.id),s&&s.offset>i.offset?i.offset=s.offset:s||me.set(this.id,i),i};return new x(e,M("memoize",this))}mergeMemos(){const e=n=>{let r=me.get(this.id);if(r)return r;if(this.atLeftRecursionLimit(n))return n.err(void 0);const o=this.parser(n);return r=me.get(this.id),r||me.set(this.id,o),o};return new x(e,M("mergeMemo",this))}then(e){const n=r=>{const o=this.parser(r);if(!o.isError){const s=e.parser(o);if(!s.isError)return s.ok([o.value,s.value])}return G(r),r.err(void 0)};return new x(n,M("then",this,this,e))}or(e){const n=r=>{const o=this.parser(r);return o.isError?e.parser(r):o};return new x(n,M("or",this,this,e))}chain(e,n=!1){const r=o=>{const s=this.parser(o);return s.isError?s:s.value||n?e(s.value).parser(s):o};return new x(r,M("chain",this,e))}map(e,n=!1){const r=o=>{const s=this.parser(o);return!s.isError||n?s.ok(e(s.value)):s};return new x(r,M("map",this))}mapState(e){const n=r=>{const o=this.parser(r);return e(o,r)};return new x(n,M("mapState",this))}skip(e){const n=r=>{const o=this.parser(r);if(!o.isError){const s=e.parser(o);if(!s.isError)return s.ok(o.value)}return G(r),r.err(void 0)};return new x(n,M("skip",this,e))}next(e){const n=this.then(e).map(([,r])=>r);return n.context=M("next",this,e),n}opt(){const e=n=>{const r=this.parser(n);return r.isError?(G(n),n.ok(void 0)):r};return new x(e,M("opt",this))}not(e){const n=o=>this.parser(o).isError?(G(o),o.ok(o.value)):o.err(void 0),r=o=>{const s=this.parser(o);return s.isError?(G(o),s):e.parser(o).isError?s:(G(o),o.err(void 0))};return new x(e?r:n,M("not",this,e))}wrap(e,n,r=!0){if(!r)return _(e,this,n);const o=e.next(this).skip(n);return o.context=M("wrap",this,e,n),o}trim(e=g,n=!0){if(!n)return _(e,this,e);if(e.context?.name==="whitespace"){const r=o=>{const s=cr(o),i=this.parser(s);return i.isError?(G(o),o.err(void 0)):cr(i)};return new x(r,M("trimWhitespace",this))}return this.wrap(e,e)}many(e=0,n=1/0){const r=o=>{const s=[];let i=o;for(let a=0;a<n;a+=1){const c=this.parser(i);if(c.isError)break;s.push(c.value),i=c}return s.length>=e?i.ok(s):(G(o),o.err([]))};return new x(r,M("many",this,e,n))}sepBy(e,n=0,r=1/0){const o=s=>{const i=[];let a=s;for(let c=0;c<r;c+=1){const l=this.parser(a);if(l.isError)break;a=l,i.push(a.value);const p=e.parser(a);if(p.isError)break;a=p}return i.length>n?a.ok(i):(G(s),s.err([]))};return new x(o,M("sepBy",this,e))}eof(){const e=this.skip(Gs());return e.context=M("eof",this),e}debug(e="",n=!1,r=console.log){return zs(this,e,n,r)}toString(){return Ar(this)}static lazy(e){const n=r=>_r(e).parser(r);return new x(n,M("lazy",void 0,e))}}function Gs(){const t=e=>e.offset>=e.src.length?e.ok(void 0):(G(e),e.err());return new x(t,M("eof",void 0))}function d(...t){const e=n=>{for(const r of t){const o=r.parser(n);if(!o.isError)return o}return G(n),n.err(void 0)};return new x(t.length===1?t[0].parser:e,M("any",void 0,...t))}function _(...t){const e=n=>{const r=[];let o=n;for(const s of t){const i=s.parser(o);if(i.isError)return i;i.value!==void 0&&r.push(i.value),o=i}return G(o),o.ok(r)};return new x(t.length===1?t[0].parser:e,M("all",void 0,...t))}function B(t){const e=n=>{if(n.offset>=n.src.length)return n.err(void 0);const r=n.src.slice(n.offset,n.offset+t.length);return r===t?n.ok(r,r.length):(G(n),n.err(void 0))};return new x(e,M("string",void 0,t))}function V(t,e=n=>n?.[0]??null){const n=t.flags.replace(/y/g,""),r=new RegExp(t,n+"y"),o=s=>{if(s.offset>=s.src.length)return s.err(void 0);r.lastIndex=s.offset;const i=e(s.src.match(r));return i?s.ok(i,r.lastIndex-s.offset):i===""?s.ok(void 0):(G(s),s.err(void 0))};return new x(o,M("regex",void 0,t))}const ar=/\s*/y,cr=t=>{if(t.offset>=t.src.length)return t;ar.lastIndex=t.offset;const e=t.src.match(ar)?.[0]??"";return t.ok(t.value,e.length)},g=V(/\s*/);g.context.name="whitespace";const m=t=>{const e=new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i");return V(e)},Rr=V(/-?[a-zA-Z][a-zA-Z0-9-]*/),ht=m("none"),Or=V(/-?\d+/).map(Number),q=V(/-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/).map(Number);function Nr(t){return new x(e=>e.ok(t,0))}function Br(t){return new x(e=>e.err(void 0,0))}function Te(t,e){const n=t.parseState(e);if(n.isError)throw new Error(`Parse error at offset ${n.offset}`);return n.value}function $s(t,e){const n=t.parseState(e);return{status:!n.isError,value:n.value}}function O(t,e){const[n,r,o]=t;return[e[0]*n+e[1]*r+e[2]*o,e[3]*n+e[4]*r+e[5]*o,e[6]*n+e[7]*r+e[8]*o]}function Fs(t){return[t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]]}function Ds(t,e){return[t[0]*e[0]+t[1]*e[3]+t[2]*e[6],t[0]*e[1]+t[1]*e[4]+t[2]*e[7],t[0]*e[2]+t[1]*e[5]+t[2]*e[8],t[3]*e[0]+t[4]*e[3]+t[5]*e[6],t[3]*e[1]+t[4]*e[4]+t[5]*e[7],t[3]*e[2]+t[4]*e[5]+t[5]*e[8],t[6]*e[0]+t[7]*e[3]+t[8]*e[6],t[6]*e[1]+t[7]*e[4]+t[8]*e[7],t[6]*e[2]+t[7]*e[5]+t[8]*e[8]]}function J(t){const[e,n,r,o,s,i,a,c,l]=t,p=s*l-i*c,u=-(o*l-i*a),b=o*c-s*a,y=1/(e*p+n*u+r*b);return[p*y,(r*c-n*l)*y,(n*i-r*s)*y,u*y,(e*l-r*a)*y,(r*o-e*i)*y,b*y,(n*a-e*c)*y,(e*s-n*o)*y]}const N=255,h={"%":{min:0,max:100},number:{min:0,max:1}},Ve={"%":h["%"],number:{min:0,max:N}},L={"%":h["%"],number:h.number},Se={deg:{min:0,max:360},number:{min:0,max:360},"%":h["%"]},f={rgb:{r:Ve,g:Ve,b:Ve,alpha:h},hsl:{h:Se,s:{"%":h["%"],number:h.number},l:{"%":h["%"],number:h.number},alpha:h},hsv:{h:Se,s:{"%":h["%"],number:h.number},v:{"%":h["%"],number:h.number},alpha:h},hwb:{h:Se,w:{"%":h["%"],number:h.number},b:{"%":h["%"],number:h.number},alpha:h},lab:{l:{"%":h["%"],number:h["%"]},a:{number:{min:-125,max:125},"%":{min:-100,max:100}},b:{number:{min:-125,max:125},"%":{min:-100,max:100}},alpha:h},lch:{l:{"%":h["%"],number:h["%"]},c:{number:{min:0,max:150},"%":h["%"]},h:Se,alpha:h},oklab:{l:{"%":h["%"],number:h["%"]},a:{number:{min:-.4,max:.4},"%":{min:-100,max:100}},b:{number:{min:-.4,max:.4},"%":{min:-100,max:100}},alpha:h},oklch:{l:{"%":h["%"],number:h["%"]},c:{number:{min:0,max:.5},"%":h["%"]},h:Se,alpha:h},xyz:{x:{"%":h["%"],number:h.number},y:{"%":h["%"],number:h.number},z:{"%":h["%"],number:h.number},alpha:h},kelvin:{kelvin:{number:{min:1e3,max:4e4}},alpha:h},"srgb-linear":{r:L,g:L,b:L,alpha:h},"display-p3":{r:L,g:L,b:L,alpha:h},"a98-rgb":{r:L,g:L,b:L,alpha:h},"prophoto-rgb":{r:L,g:L,b:L,alpha:h},rec2020:{r:L,g:L,b:L,alpha:h}},z="%",In={rgb:{r:"",g:"",b:"",alpha:z},hsl:{h:"deg",s:"%",l:"%",alpha:z},hsv:{h:"deg",s:"%",v:"%",alpha:z},hwb:{h:"deg",w:"%",b:"%",alpha:z},lab:{l:"%",a:"",b:"",alpha:z},lch:{l:"%",c:"",h:"deg",alpha:z},oklab:{l:"%",a:"",b:"",alpha:z},oklch:{l:"%",c:"",h:"deg",alpha:z},xyz:{x:"%",y:"%",z:"%",alpha:z},kelvin:{kelvin:"K",alpha:z},"srgb-linear":{r:"",g:"",b:"",alpha:z},"display-p3":{r:"",g:"",b:"",alpha:z},"a98-rgb":{r:"",g:"",b:"",alpha:z},"prophoto-rgb":{r:"",g:"",b:"",alpha:z},rec2020:{r:"",g:"",b:"",alpha:z}},Vs={rgb:"RGB",hsl:"HSL",hsv:"HSV",hwb:"HWB",lab:"Lab",lch:"LCh",oklab:"OKLab",oklch:"OKLCh",xyz:"XYZ",kelvin:"Kelvin","srgb-linear":"sRGB Linear","display-p3":"Display P3","a98-rgb":"Adobe RGB","prophoto-rgb":"ProPhoto RGB",rec2020:"Rec. 2020"},vr=[.3127/.329,1,(1-.3127-.329)/.329],Pr=[.3457/.3585,1,(1-.3457-.3585)/.3585],ft=[1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],An=J(ft),Mn={D65:vr,D50:Pr},_n=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],Lr=J(_n),Rn=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774],zr=J(Rn),k=[4.0767416621,-3.3077115913,.2309699292,-1.2684380046,2.6097574011,-.3413193965,-.0041960863,-.7034186147,1.707614701],j=[.4122214708,.5363325363,.0514459929,.2119034982,.6806995451,.1073969566,.0883024619,.2817188376,.6299787005],v={l:[1,.3963377774,.2158037573],m:[1,-.1055613458,-.0638541728],s:[1,-.0894841775,-1.291485548]},Ur=[{test:(t,e)=>-1.88170328*t-.80936493*e>1,k0:1.19086277,k1:1.76576728,k2:.59662641,k3:.75515197,k4:.56771245,wl:4.0767416621,wm:-3.3077115913,ws:.2309699292},{test:(t,e)=>1.81444104*t-1.19445276*e>1,k0:.73956515,k1:-.45954404,k2:.08285427,k3:.1254107,k4:.14503204,wl:-1.2684380046,wm:2.6097574011,ws:-.3413193965},{test:()=>!0,k0:1.35733652,k1:-.00915799,k2:-1.1513021,k3:-.50559606,k4:.00692167,wl:-.0041960863,wm:-.7034186147,ws:1.707614701}],Ft={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"rgba(0, 0, 0, 0)",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",padaleckipink:"oklch(100% 0.42 360deg / 71.70%)","lodge-blu-color":"rgb(53 101 144)",lavendi:"oklch(79.90% 0.11 318.24deg / 100%)",shadyshroom:"oklch(53% 0.07 21.60deg / 100%)",patriarchalplum:"oklch(31.20% 0.11 19.80deg / 100%)"};function R(t,e,n){return Math.min(Math.max(t,e),n)}function A(t,e,n,r=0,o=1){const s=(o-r)/(n-e);if(n===e)throw new Error("fromMax and fromMin cannot be equal");return(t-e)*s+r}function qe(t,e,n){return(1-t)*e+t*n}function Hs(t,e,n){return e=e===0?1e-9:e,e*Math.pow(n/e,t)}function Le(t,e){const n=e.length-1,r=[...e];for(let o=1;o<=n;o++)for(let s=0;s<=n-o;s++)r[s]=qe(t,r[s],r[s+1]);return r[0]}function On(t,e,n,r,o){return[Le(t,[0,e,r,1]),Le(t,[0,n,o,1])]}function $e(t,e){const n=e.map(o=>o[0]),r=e.map(o=>o[1]);return[Le(t,n),Le(t,r)]}function Xs(t,e,n,r){let o="M0 0";for(let s=0;s<=1;s+=.001){const[i,a]=On(s,t,e,n,r);o+=` L${i} ${a}`}return`<path d="${o}"/>`}function Ws(t,e,n,r){const o=s=>s.toFixed(2);return`cubic-bezier(${o(t)}, ${o(e)}, ${o(n)}, ${o(r)})`}const Gr=2.4,Je=.055,Nn=12.92,js=.04045,$r=js/Nn;function Lt(t){const e=t<0?-1:1,n=t*e;return n<=$r?t/Nn:e*((n+Je)/(1+Je))**Gr}function zt(t){const e=t<0?-1:1,n=t*e;return n<=$r?t*Nn:e*((1+Je)*n**(1/Gr)-Je)}function Ut(t,e,n){return Math.min(Math.max(t,e),n)}const Ys=.02;function Zs(t,e,n,r,o,s){const i=t-r,a=e-o,c=n-s;return Math.sqrt(i*i+a*a+c*c)}function bt(t,e,n){const r=t+v.l[1]*e+v.l[2]*n,o=t+v.m[1]*e+v.m[2]*n,s=t+v.s[1]*e+v.s[2]*n,i=r*r*r,a=o*o*o,c=s*s*s;return[k[0]*i+k[1]*a+k[2]*c,k[3]*i+k[4]*a+k[5]*c,k[6]*i+k[7]*a+k[8]*c]}function Fr(t,e,n){return t>=0&&t<=1&&e>=0&&e<=1&&n>=0&&n<=1}function Dr(t,e){const n=Ur.find(T=>T.test(t,e)),{k0:r,k1:o,k2:s,k3:i,k4:a,wl:c,wm:l,ws:p}=n;let u=r+o*t+s*e+i*t*t+a*t*e;const b=v.l[1]*t+v.l[2]*e,C=v.m[1]*t+v.m[2]*e,y=v.s[1]*t+v.s[2]*e;{const T=1+u*b,w=1+u*C,E=1+u*y,I=T*T*T,U=w*w*w,H=E*E*E,ae=3*b*T*T,ce=3*C*w*w,le=3*y*E*E,Ee=6*b*b*T,Ie=6*C*C*w,Ae=6*y*y*E,be=c*I+l*U+p*H,ue=c*ae+l*ce+p*le,Fe=c*Ee+l*Ie+p*Ae;u=u-be*ue/(ue*ue-.5*be*Fe)}return u}function Vr(t,e){const n=Dr(t,e),[r,o,s]=bt(1,n*t,n*e),i=Math.cbrt(1/Math.max(r,o,s)),a=i*n;return{L:i,C:a}}function Hr(t,e,n,r,o,s){let i;if((n-o)*s.C-(s.L-o)*r<=0)i=s.C*o/(r*s.L+s.C*(o-n));else{i=s.C*(o-1)/(r*(s.L-1)+s.C*(o-n));const a=n-o,c=r,l=v.l[1]*t+v.l[2]*e,p=v.m[1]*t+v.m[2]*e,u=v.s[1]*t+v.s[2]*e,b=a+c*l,C=a+c*p,y=a+c*u;{const T=o*(1-i)+i*n,w=i*r,E=T+w*l,I=T+w*p,U=T+w*u,H=E*E*E,ae=I*I*I,ce=U*U*U,le=3*b*E*E,Ee=3*C*I*I,Ie=3*y*U*U,Ae=6*b*b*E,be=6*C*C*I,ue=6*y*y*U,Fe=k[0]*H+k[1]*ae+k[2]*ce-1,Rt=k[0]*le+k[1]*Ee+k[2]*Ie,ds=k[0]*Ae+k[1]*be+k[2]*ue,qn=Rt/(Rt*Rt-.5*Fe*ds);let Ot=-Fe*qn;const Jn=k[3]*H+k[4]*ae+k[5]*ce-1,Nt=k[3]*le+k[4]*Ee+k[5]*Ie,gs=k[3]*Ae+k[4]*be+k[5]*ue,Qn=Nt/(Nt*Nt-.5*Jn*gs);let Bt=-Jn*Qn;const er=k[6]*H+k[7]*ae+k[8]*ce-1,vt=k[6]*le+k[7]*Ee+k[8]*Ie,ws=k[6]*Ae+k[7]*be+k[8]*ue,tr=vt/(vt*vt-.5*er*ws);let Pt=-er*tr;Ot=qn>=0?Ot:1/0,Bt=Qn>=0?Bt:1/0,Pt=tr>=0?Pt:1/0,i+=Math.min(Ot,Bt,Pt)}}return i}const Ks=1e-5,qs=.05;function Xr(t,e,n){const[r,o,s]=bt(t,e,n);if(Fr(r,o,s))return[t,e,n];const i=Math.max(Ks,Math.sqrt(e*e+n*n)),a=e/i,c=n/i,l=Vr(a,c),p=t-.5,u=.5+Math.abs(p)+qs*i,b=.5*(1+Math.sign(p)*(u-Math.sqrt(u*u-2*Math.abs(p)))),C=Hr(a,c,t,i,b,l),y=b*(1-C)+C*t,T=C*i;return[y,T*a,T*c]}function Wr(t,e,n){const r=Lt(t),o=Lt(e),s=Lt(n),i=Math.cbrt(j[0]*r+j[1]*o+j[2]*s),a=Math.cbrt(j[3]*r+j[4]*o+j[5]*s),c=Math.cbrt(j[6]*r+j[7]*o+j[8]*s);return[.2104542553*i+.793617785*a-.0040720468*c,1.9779984951*i-2.428592205*a+.4505937099*c,.0259040371*i+.7827717662*a-.808675766*c]}function jr(t,e,n){if(t>=0&&t<=1&&e>=0&&e<=1&&n>=0&&n<=1)return[t,e,n];const[r,o,s]=Wr(t,e,n),[i,a,c]=Xr(r,o,s),[l,p,u]=bt(i,a,c);return[Ut(zt(l),0,1),Ut(zt(p),0,1),Ut(zt(u),0,1)]}const Js=t=>{const e=f[t],n=In[t];return Object.entries(e).reduce((r,[o,s])=>{const i=n[o];let{min:a,max:c}=s[i]??s.number;return a=`${a}${i}`,c=`${c}${i}`,r[o]={min:a,max:c},r},{})},Z=16,Yr=t=>{if(t=t.slice(1),t.length<=4){const e=parseInt(t[0]+t[0],Z),n=parseInt(t[1]+t[1],Z),r=parseInt(t[2]+t[2],Z),o=t[3]?parseInt(t[3]+t[3],Z)/N:1;return new P(e,n,r,o)}else{const e=parseInt(t.slice(0,2),Z),n=parseInt(t.slice(2,4),Z),r=parseInt(t.slice(4,6),Z),o=t.length===8?parseInt(t.slice(6,8),Z)/N:1;return new P(e,n,r,o)}},Qs=({r:t,g:e,b:n,alpha:r})=>{const o=s=>{const i=s.toString(Z);return i.length===1?"0"+i:i};return`#${o(t)}${o(e)}${o(n)}${r<1?o(Math.round(r*N)):""}`},Zr=1e3,Kr=4e4,qr=100,Bn=({kelvin:t,alpha:e})=>{t=R(t,Zr,Kr)/qr;let n,r,o;return t<=66?n=N:(n=t-60,n=329.698727446*n**-.1332047592),n=R(n,0,N)/N,t<=66?(r=t,r=99.4708025861*Math.log(r)-161.1195681661):(r=t-60,r=288.1221695283*r**-.0755148492),r=R(r,0,N)/N,t>=66?o=N:t<=19?o=0:(o=t-10,o=138.5177312231*Math.log(o)-305.0447927307),o=R(o,0,N)/N,new P(n,r,o,e)},Jr=({r:t,g:e,b:n,alpha:r})=>{t=R(t*N,0,N),e=R(e*N,0,N),n=R(n*N,0,N);let o;if(n===N?o=6600:n===0?o=1900:o=Math.exp((n+305.0447927307)/138.5177312231)+10,t<N){const i=(329.698727446/t)**-7.507239275877164+60;o=Math.max(o,i)}const s=o<=6600?Math.exp((e+161.1195681661)/99.4708025861):(288.1221695283/e)**(1/-.0755148492)+60;return o=(o+s)/2,o=R(Math.round(o*qr),Zr,Kr),new Cn(o,r)},vn=({h:t,s:e,v:n,alpha:r})=>{const o=n-n*e/2;let s;return o===0||o===1?s=0:s=(n-o)/Math.min(o,1-o),new fe(t,s,o,r)},Pn=({h:t,s:e,l:n,alpha:r})=>{const o=n+e*Math.min(n,1-n);let s;return o===0?s=0:s=2*(1-n/o),new rt(t,s,o,r)},Qr=({h:t,w:e,b:n,alpha:r})=>{let o,s;const i=e+n;return i>=1?(s=e/i,o=0):(s=1-n,o=s===0?0:1-e/s),vn(new rt(t,o,s,r))},eo=({h:t,s:e,l:n,alpha:r})=>{const{h:o,s,v:i}=Pn(new fe(t,e,n,r));return new ot(o,i*(1-s),1-i,r)},Ln=({r:t,g:e,b:n,alpha:r})=>{const o=Math.max(t,e,n),s=Math.min(t,e,n);let[i,a,c]=[0,0,(o+s)/2];const l=o-s;switch(a=l/(1-Math.abs(2*c-1)),o){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4;break}return i/=6,a<0&&(i=(i+.5)%1,a=Math.abs(a)%1),i>=1&&(i-=1),new fe(i,a,c,r)};function to({h:t,s:e,l:n,alpha:r}){const o=(1-Math.abs(2*n-1))*e,s=o*(1-Math.abs(t*6%2-1)),i=n-o/2;let a,c,l;return t<1/6?[a,c,l]=[o,s,0]:t<2/6?[a,c,l]=[s,o,0]:t<3/6?[a,c,l]=[0,o,s]:t<4/6?[a,c,l]=[0,s,o]:t<5/6?[a,c,l]=[s,0,o]:[a,c,l]=[o,0,s],new P(a+i,c+i,l+i,r)}const ei=216/24389,ti=24/116,Dt=24389/27,ni=8,Re=16,Oe=116,no=500,ro=200;function ri(t){if(t.whitePoint==="D50")return[t.x,t.y,t.z];if(t.whitePoint==="D65")return O([t.x,t.y,t.z],ft);throw new Error(`Unsupported white point: ${t.whitePoint}`)}function oi(t){if(t.whitePoint==="D65")return[t.x,t.y,t.z];if(t.whitePoint==="D50")return O([t.x,t.y,t.z],An);throw new Error(`Unsupported white point: ${t.whitePoint}`)}function dt(t,e="D50"){const n=E=>E>ei?Math.cbrt(E):(Dt*E+Re)/Oe,r=Mn[e],[o,s,i]=ri(t),a=o/r[0],c=s/r[1],l=i/r[2],p=n(a),u=n(c),b=n(l),C=Oe*u-Re,y=no*(p-u),T=ro*(u-b),w=new Ue(A(C,f.lab.l.number.min,f.lab.l.number.max),A(y,f.lab.a.number.min,f.lab.a.number.max),A(T,f.lab.b.number.min,f.lab.b.number.max),t.alpha);return w.whitePoint=e,w}function gt(t){const e=I=>I>ti?I**3:(Oe*I-Re)/Dt,n=I=>I>ni?((I+Re)/Oe)**3:I/Dt,r=Mn[t.whitePoint];let{l:o,a:s,b:i,alpha:a}=t;o=A(o,0,1,f.lab.l.number.min,f.lab.l.number.max),s=A(s,0,1,f.lab.a.number.min,f.lab.a.number.max),i=A(i,0,1,f.lab.b.number.min,f.lab.b.number.max);const c=(o+Re)/Oe,l=s/no+c,p=c-i/ro,[u,b,C]=[e(l),n(o),e(p)];let y=u*r[0],T=b*r[1],w=C*r[2];const E=new F(y,T,w,a);return E.whitePoint=t.whitePoint,[y,T,w]=oi(E),E.whitePoint="D65",E.x=y,E.y=T,E.z=w,E}const zn=[.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],oo=J(zn),so=2.4,Qe=.055,Un=12.92,si=.04045,io=si/Un;function he(t){const e=t<0?-1:1,n=t*e;return n<=io?t/Un:e*((n+Qe)/(1+Qe))**so}function Gn(t){const e=t<0?-1:1,n=t*e;return n<=io?t*Un:e*((1+Qe)*n**(1/so)-Qe)}function wt({r:t,g:e,b:n,alpha:r}){const o=[he(t),he(e),he(n)],[s,i,a]=O(o,zn);return new F(s,i,a,r)}const kt=({x:t,y:e,z:n,alpha:r},o=!0)=>{const s=O([t,e,n],oo),[i,a,c]=s.map(Gn);if(o){const l=Vo(new P(i,a,c,r));return new P(l.r,l.g,l.b,r)}else return new P(i,a,c,r)};function ao({l:t,c:e,h:n,alpha:r}){e=A(e,0,1,f.lch.c.number.min,f.lch.c.number.max);const o=n*2*Math.PI,s=Math.cos(o)*e,i=Math.sin(o)*e;return new Ue(t,A(s,f.lab.a.number.min,f.lab.a.number.max),A(i,f.lab.b.number.min,f.lab.b.number.max),r)}function co({l:t,a:e,b:n,alpha:r}){e=A(e,0,1,f.lab.a.number.min,f.lab.a.number.max),n=A(n,0,1,f.lab.b.number.min,f.lab.b.number.max);const o=Math.hypot(e,n);let s=Math.atan2(n,e)/(2*Math.PI);return s<0&&(s+=1),new st(t,A(o,f.lch.c.number.min,f.lch.c.number.max),s,r)}function St({l:t,a:e,b:n,alpha:r}){e=A(e,0,1,f.oklab.a.number.min,f.oklab.a.number.max),n=A(n,0,1,f.oklab.b.number.min,f.oklab.b.number.max);const o=O([t,e,n],zr),s=[o[0]*o[0]*o[0],o[1]*o[1]*o[1],o[2]*o[2]*o[2]],[i,a,c]=O(s,Lr);return new F(i,a,c,r)}function yt(t){const{x:e,y:n,z:r}=t,o=O([e,n,r],_n),s=[Math.cbrt(o[0]),Math.cbrt(o[1]),Math.cbrt(o[2])],[i,a,c]=O(s,Rn);return new Ge(i,A(a,f.oklab.a.number.min,f.oklab.a.number.max),A(c,f.oklab.b.number.min,f.oklab.b.number.max),t.alpha)}function lo(t){const e=St(t);return dt(e)}function uo(t){const e=gt(t);return yt(e)}function $n({l:t,a:e,b:n,alpha:r}){e=A(e,0,1,f.oklab.a.number.min,f.oklab.a.number.max),n=A(n,0,1,f.oklab.b.number.min,f.oklab.b.number.max);const o=Math.hypot(e,n);let s=Math.atan2(n,e)/(2*Math.PI);return s<0&&(s+=1),new it(t,A(o,f.oklch.c.number.min,f.oklch.c.number.max),s,r)}function Fn({l:t,c:e,h:n,alpha:r}){e=A(e,0,1,f.oklch.c.number.min,f.oklch.c.number.max);const o=n*2*Math.PI,s=Math.cos(o)*e,i=Math.sin(o)*e;return new Ge(t,A(s,f.oklab.a.number.min,f.oklab.a.number.max),A(i,f.oklab.b.number.min,f.oklab.b.number.max),r)}function ii(t){return lo(Fn(t))}function ai(t){return $n(uo(t))}function Ct(t){const e=to(t);return wt(e)}function xt(t){const e=kt(t);return Ln(e)}function po(t){const e=vn(t);return Ct(e)}function mo(t){const e=xt(t);return Pn(e)}function ho(t){const e=Qr(t);return Ct(e)}function fo(t){const e=xt(t);return eo(e)}function bo(t){const e=ao(t);return gt(e)}function go(t){const e=dt(t);return co(e)}function wo(t){const e=Fn(t);return St(e)}function ko(t){const e=yt(t);return $n(e)}function So(t){const e=Bn(t);return wt(e)}function yo(t){const e=kt(t);return Jr(e)}const Co=563/256;function He(t){return(t<0?-1:1)*Math.abs(t)**Co}function xo(t){return(t<0?-1:1)*Math.abs(t)**(1/Co)}const To=1/512,Eo=1.8;function Xe(t){const e=t<0?-1:1,n=Math.abs(t);return e*(n<=To*16?n/16:n**Eo)}function Io(t){const e=t<0?-1:1,n=Math.abs(t);return e*(n>=To?n**(1/Eo):n*16)}const et=1.09929682680944,Ao=.018053968510807;function We(t){const e=t<0?-1:1,n=Math.abs(t);return n<Ao*4.5?e*n/4.5:e*((n+et-1)/et)**(1/.45)}function Mo(t){const e=t<0?-1:1,n=Math.abs(t);return n>=Ao?e*(et*n**.45-(et-1)):e*4.5*n}const _o=[.4865709486482162,.26566769316909306,.1982172852343625,.22897456406974884,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],ci=J(_o),Ro=[.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.07529145849399788,.02703136138641234,.07068885253582723,.9913375368376388],li=J(Ro),Oo=[.7977604896723027,.13518583717574031,.0313493495815248,.2880711282292934,.7118432178101014,8565396060525902e-20,0,0,.8251046025104602],ui=J(Oo),No=[.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.0609850577107909],pi=J(No);function Bo({r:t,g:e,b:n,alpha:r}){const[o,s,i]=O([t,e,n],zn);return new F(o,s,i,r)}function vo({x:t,y:e,z:n,alpha:r}){const[o,s,i]=O([t,e,n],oo);return new at(o,s,i,r)}function Po({r:t,g:e,b:n,alpha:r}){const o=[he(t),he(e),he(n)],[s,i,a]=O(o,_o);return new F(s,i,a,r)}function Lo({x:t,y:e,z:n,alpha:r}){const o=O([t,e,n],ci),[s,i,a]=o.map(Gn);return new ct(s,i,a,r)}function zo({r:t,g:e,b:n,alpha:r}){const o=[He(t),He(e),He(n)],[s,i,a]=O(o,Ro);return new F(s,i,a,r)}function Uo({x:t,y:e,z:n,alpha:r}){const o=O([t,e,n],li),[s,i,a]=o.map(xo);return new lt(s,i,a,r)}function Go({r:t,g:e,b:n,alpha:r}){const o=[Xe(t),Xe(e),Xe(n)],s=O(o,Oo),[i,a,c]=O(s,An);return new F(i,a,c,r)}function $o({x:t,y:e,z:n,alpha:r}){const o=O([t,e,n],ft),s=O(o,ui),[i,a,c]=s.map(Io);return new ut(i,a,c,r)}function Fo({r:t,g:e,b:n,alpha:r}){const o=[We(t),We(e),We(n)],[s,i,a]=O(o,No);return new F(s,i,a,r)}function Do({x:t,y:e,z:n,alpha:r}){const o=O([t,e,n],pi),[s,i,a]=o.map(Mo);return new pt(s,i,a,r)}const lr={rgb:{to:wt,from:kt},hsl:{to:Ct,from:xt},hsv:{to:po,from:mo},hwb:{to:ho,from:fo},lab:{to:gt,from:dt},lch:{to:bo,from:go},oklab:{to:St,from:yt},oklch:{to:wo,from:ko},kelvin:{to:So,from:yo},xyz:{to:t=>t,from:t=>t},"srgb-linear":{to:Bo,from:vo},"display-p3":{to:Po,from:Lo},"a98-rgb":{to:zo,from:Uo},"prophoto-rgb":{to:Go,from:$o},rec2020:{to:Fo,from:Do}};function oe(t,e){if(t.colorSpace===e)return t;const n=lr[t.colorSpace];if(!n)throw new Error(`Unknown source color space: "${t.colorSpace}"`);const r=lr[e];if(!r)throw new Error(`Unknown target color space: "${e}"`);const o=n.to(t),s=r.from;return s(o)}const de=1e-6;function Vo(t){const e=oe(t,"rgb"),n=Number.isNaN(e.r)?0:e.r,r=Number.isNaN(e.g)?0:e.g,o=Number.isNaN(e.b)?0:e.b;if(n>=0&&n<=1&&r>=0&&r<=1&&o>=0&&o<=1)return t;if(n>=-de&&n<=1+de&&r>=-de&&r<=1+de&&o>=-de&&o<=1+de){const l=new P(R(n,0,1),R(r,0,1),R(o,0,1),t.alpha);return oe(l,t.colorSpace)}const[s,i,a]=jr(n,r,o),c=new P(s,i,a,t.alpha);return oe(c,t.colorSpace)}const Ho={hsl:"h",hsv:"h",hwb:"h",lch:"h",oklch:"h"};function Xo(t,e,n,r="shorter"){if(Number.isNaN(t)&&Number.isNaN(e))return 0;if(Number.isNaN(t))return e;if(Number.isNaN(e))return t;let o=e-t;switch(r){case"shorter":o>.5?t+=1:o<-.5&&(e+=1);break;case"longer":o>0&&o<.5?t+=1:o>-.5&&o<=0&&(e+=1);break;case"increasing":o<0&&(e+=1);break;case"decreasing":o>0&&(t+=1);break}let s=t+n*(e-t);return s=(s%1+1)%1,s}function Wo(t,e,n,r,o="oklab",s="shorter"){const i=oe(t,o),a=oe(e,o);n<0&&(n=0),r<0&&(r=0);const c=n+r;c===0?(n=.5,r=.5):c!==1&&(n=n/c,r=r/c);const l=Math.min(c,1),p=Ho[o],u=i.keys().filter(I=>I!=="alpha"),b=Number.isNaN(i.alpha)?a.alpha:i.alpha,C=Number.isNaN(a.alpha)?i.alpha:a.alpha,y=qe(r,b,C)*l,T=[];for(const I of u){let U=i[I],H=a[I];if(Number.isNaN(U)&&Number.isNaN(H)){T.push(0);continue}if(Number.isNaN(U)&&(U=H),Number.isNaN(H)&&(H=U),I===p)T.push(Xo(U,H,r,s));else{const ae=U*b,ce=H*C,le=qe(r,ae,ce);T.push(y>0?le/y:0)}}const w=i.constructor;return new w(...T,y)}const mi=(t,e,n)=>{const r=f[e][n];return r[t]??r.number},jo=(t,e,n,r,o=!1)=>{e=o?In[n][r]:e;const{min:s,max:i}=mi(e,n,r),[a,c,l,p]=o?[s,i,0,1]:[0,1,s,i],u=A(t,l,p,a,c);return new S(u,o?e:"")},Yo=(t,e=!1)=>{const n=t.colorSpace;return t.keys().forEach(r=>{const o=t[r]instanceof S?t[r].value:t[r];t[r]=jo(o,t[r]?.unit,n,r,e)}),t},tt=(t,e=!1,n=!1)=>{t=n?t:t.clone();const r=Yo(t.value,e);return n?t:new S(r).coalesce(t,!0)},Vt=(t,e="lab",n=!1,r=!1,o=!1)=>{const s=n?o?t:t.clone():tt(t,!1,o),i=oe(s.toJSON(),e);return i.entries().forEach(([a,c])=>{i[a]=new S(c)}),s.value=i,s.superType[1]=e,r?tt(s,!0,!0):s},Zo=(t,e,n="lab",r=!1,o=!1,s=!1)=>[Vt(t,n,r,o,s),Vt(e,n,r,o,s)],$=t=>new S(t,"color",["color",t.colorSpace],void 0,"color");function Ht(t){const n=tt(t).value,r=n.clone();for(const o of n.keys()){const s=n[o];r[o]=s instanceof S?s.value:s}return r}function hi(t){const e=t.replace(/[^0-9.+\-*/() e]/g,"");return new Function(`return (${e})`)()}function ur(t,e){switch(t.type){case"ref":return e[t.name]??0;case"literal":return t.value;case"none":return NaN;case"calc":{let n=t.expr;const r=Object.keys(e).sort((o,s)=>s.length-o.length);for(const o of r)n=n.replace(new RegExp(`\\b${o}\\b`,"g"),String(e[o]));return hi(n)}}}function fi(t,e,n,r){const o=Ht(t),s=oe(o,e),i={};for(const[b,C]of s.entries())i[b]=C;const a=n.map(b=>ur(b,i)),c=r?ur(r,i):i.alpha??1,p={rgb:P,hsl:fe,hwb:ot,lab:Ue,lch:st,oklab:Ge,oklch:it,xyz:F,"srgb-linear":at,"display-p3":ct,"a98-rgb":lt,"prophoto-rgb":ut,rec2020:pt}[e]??P,u=new p(...a,c);return $(u)}const bi={srgb:"rgb","srgb-linear":"srgb-linear","display-p3":"display-p3","a98-rgb":"a98-rgb","prophoto-rgb":"prophoto-rgb",rec2020:"rec2020",lab:"lab",oklab:"oklab",oklch:"oklch",hsl:"hsl",hwb:"hwb",lch:"lch",xyz:"xyz","xyz-d65":"xyz","xyz-d50":"xyz"},di={srgb:{space:"rgb",ctor:P},"srgb-linear":{space:"srgb-linear",ctor:at},"display-p3":{space:"display-p3",ctor:ct},"a98-rgb":{space:"a98-rgb",ctor:lt},"prophoto-rgb":{space:"prophoto-rgb",ctor:ut},rec2020:{space:"rec2020",ctor:pt},xyz:{space:"xyz",ctor:F},"xyz-d65":{space:"xyz",ctor:F},"xyz-d50":{space:"xyz",ctor:F}},gi=B(","),wi=V(/\s+/),Tt=B("/"),Et=B("("),It=B(")"),nt=d(gi.trim(g),wi),Ko=d(Tt.trim(g),nt),X=x.lazy(()=>d(W.Percentage,W.Angle.map(t=>{const e=mt(t.value,t.unit);return new S(e,"deg",["angle"])}),d(q,Or).map(t=>new S(t)),ht.map(()=>new S(NaN)))),_e=d(m("calc").next(V(/\(([^)]+)\)/,t=>t?.[1]??null)).map(t=>({type:"calc",expr:t})),ht.map(()=>({type:"none"})),V(/\b(alpha|r|g|b|h|s|l|c|w|a|x|y|z)\b/).map(t=>({type:"ref",name:t})),X.map(t=>({type:"literal",value:t.value}))),Q=t=>{const e=B(t).skip(m("a").opt()),n=d(_(X.skip(Ko),X),X.map(o=>[o])),r=_(X.skip(nt),X.skip(nt),n).trim(g).wrap(Et,It);return e.next(r).map(([o,s,[i,a]])=>[o,s,i,a??new S(1)])};function ie(t,e){return B(t).skip(m("a").opt()).next(_(m("from").skip(g).next(x.lazy(()=>At.Value)),g.next(_e),g.next(_e),g.next(_e),Tt.trim(g).next(_e).opt()).trim(g).wrap(Et,It)).map(([n,r,o,s,i])=>fi(n,e,[r,o,s],i))}const ki=V(/#[0-9a-fA-F]{3,8}/).map(t=>{const{r:e,g:n,b:r,alpha:o}=Yr(t);return $(new P(e,n,r,o))}),Si=q.skip(m("k")).map(t=>{const e=Bn(new Cn(t));return $(e)}),yi=d(ie("rgb","rgb"),Q("rgb").map(([t,e,n,r])=>$(new P(t,e,n,r)))),Ci=d(ie("hsl","hsl"),Q("hsl").map(([t,e,n,r])=>$(new fe(t,e,n,r)))),xi=Q("hsv").map(([t,e,n,r])=>$(new rt(t,e,n,r))),Ti=d(ie("hwb","hwb"),Q("hwb").map(([t,e,n,r])=>$(new ot(t,e,n,r)))),Ei=d(ie("lab","lab"),Q("lab").map(([t,e,n,r])=>$(new Ue(t,e,n,r)))),Ii=d(ie("lch","lch"),Q("lch").map(([t,e,n,r])=>$(new st(t,e,n,r)))),Ai=d(ie("oklab","oklab"),Q("oklab").map(([t,e,n,r])=>$(new Ge(t,e,n,r)))),Mi=d(ie("oklch","oklch"),Q("oklch").map(([t,e,n,r])=>$(new it(t,e,n,r)))),_i=d(ie("xyz","xyz"),Q("xyz").map(([t,e,n,r])=>$(new F(t,e,n,r)))),Ri=d(m("srgb-linear").map(()=>"srgb-linear"),m("srgb").map(()=>"srgb"),m("display-p3").map(()=>"display-p3"),m("a98-rgb").map(()=>"a98-rgb"),m("prophoto-rgb").map(()=>"prophoto-rgb"),m("rec2020").map(()=>"rec2020"),m("oklab").map(()=>"oklab"),m("oklch").map(()=>"oklch"),m("lab").map(()=>"lab"),m("lch").map(()=>"lch"),m("hsl").map(()=>"hsl"),m("hwb").map(()=>"hwb"),m("xyz-d65").map(()=>"xyz-d65"),m("xyz-d50").map(()=>"xyz-d50"),m("xyz").map(()=>"xyz")),Oi=d(m("shorter"),m("longer"),m("increasing"),m("decreasing")).skip(g).skip(m("hue")),pr=x.lazy(()=>_(At.Value,g.next(W.Percentage).opt())),Ni=m("color-mix").next(_(m("in").skip(g).next(_(Ri,g.next(Oi).opt())),B(",").trim(g).next(pr),B(",").trim(g).next(pr)).trim(g).wrap(Et,It)).map(([[t,e],[n,r],[o,s]])=>{const i=bi[t]??"oklab",a=e??"shorter";let c=r!=null?r.value/100:-1,l=s!=null?s.value/100:-1;c<0&&l<0?(c=.5,l=.5):c<0?c=1-l:l<0&&(l=1-c);const p=Ht(n),u=Ht(o),b=Wo(p,u,c,l,i,a);return $(b)}),Bi=d(m("srgb-linear").map(()=>"srgb-linear"),m("srgb").map(()=>"srgb"),m("display-p3").map(()=>"display-p3"),m("a98-rgb").map(()=>"a98-rgb"),m("prophoto-rgb").map(()=>"prophoto-rgb"),m("rec2020").map(()=>"rec2020"),m("xyz-d65").map(()=>"xyz-d65"),m("xyz-d50").map(()=>"xyz-d50"),m("xyz").map(()=>"xyz")),vi=m("color").next(_(Bi.skip(g),X.skip(g),X.skip(g),d(_(X.skip(Tt.trim(g)),X),X.map(t=>[t,void 0]))).trim(g).wrap(Et,It)).map(([t,e,n,[r,o]])=>{const s=di[t];if(!s)throw new Error(`Unknown color() space: ${t}`);const i=o??new S(1);if(t==="srgb"){const c=l=>l.value*255;return $(new P(c(e),c(n),c(r),i.value))}const a=new s.ctor(e,n,r,i);return $(a)}),Pi=d(...Object.keys(Ft).sort((t,e)=>e.length-t.length).map(m)).chain(t=>{const e=Ft[t.toLowerCase()];if(e){const n=Hn(e);if(n)return Nr(n)}return Br()}),qo=d(Ni,vi,ki,Si,yi,Ci,xi,Ti,Ei,Ii,Ai,Mi,_i,Pi).trim(g),At={Value:qo,colorValue:X,componentExpr:_e,sep:nt,alphaSep:Ko,div:Tt};function Li(t){return Te(qo,t)}const zi=d(...Ne.map(m)),Ui=d(...ve.map(m)),Gi=d(...Be.map(m)),$i=d(...Pe.map(m)),Fi=d(...Sn.map(m)),Di=B(","),Vi=B(" "),Hi=d(Di,Vi).trim(g),Jo=_(q,zi).map(([t,e])=>{const n=["length"];return kn.includes(e)?n.push("relative"):wn.includes(e)&&n.push("absolute"),new S(t,e,n)}),Qo=_(q,Ui).map(([t,e])=>new S(t,e,["angle"])),Dn=_(q,Gi).map(([t,e])=>new S(t,e,["time"])),Xi=x.lazy(()=>d(Vn,Dn)),es=_(q,$i).map(([t,e])=>new S(t,e,["resolution"])),Vn=d(_(q,Fi),m("from").map(()=>[0,"%"]),m("to").map(()=>[100,"%"])).map(([t,e])=>new S(t,e,["percentage"])),ts=x.lazy(()=>At.Value),ns=B("/").trim(g).map(()=>new S("/","string")),rs=d(Jo,Qo,Dn,es,Vn,ts,ns,q.map(t=>new S(t)),ht.map(()=>new S(NaN))).trim(g),W={Length:Jo,Angle:Qo,Time:Dn,TimePercentage:Xi,Resolution:es,Percentage:Vn,Color:ts,Slash:ns,Value:rs,sep:Hi};function Hn(t){return Te(rs,t)}const ye=B("("),Ce=B(")"),Xt=B(","),os=x.lazy(()=>Yn.sepBy(d(Xt,g)).trim(g).map(t=>new xe(...t))),Xn=t=>_(t||Rr,os.wrap(ye,Ce)),Wi=()=>{const t=V(/[^)]+/);return B("var").next(t.trim(g).wrap(ye,Ce)).map(e=>new S(e,"var"))},ji=()=>{const t=x.lazy(()=>d(V(/[^()]+/),t.many(1).wrap(ye,Ce).map(e=>`(${e.join(" ")})`)).many(1));return B("calc").next(d(x.lazy(()=>Yn).trim(g).wrap(ye,Ce),t.wrap(ye,Ce).map(e=>e.join(" ")))).map(e=>e instanceof S?e:new S(e,"calc"))},Yi=["translate","scale","rotate","skew"],Wt=["x","y","z"],Zi=Wt.map(m),Ki=Yi.map(m),qi=()=>{const t=_(d(...Ki),d(...Zi,B(""))),e=(r,o)=>r+o.toUpperCase();return Xn(t).map(([[r,o],s])=>{const i=r.toLowerCase(),a={};if(o){const l=i+o.toUpperCase();a[l]=s[0]}else s.length===1?Wt.forEach(l=>{const p=e(i,l);a[p]=s[0]}):s.forEach((l,p)=>{const u=e(i,Wt[p]);a[u]=l});const c=Object.entries(a).map(([l,p])=>new se(l,[p]));return new xe(...c)})},Ji={left:"270",right:"90",top:"0",bottom:"180"},Qi=()=>{const t=d(...["linear-gradient","radial-gradient"].map(m)),e=_(B("to").skip(g),d(...["left","right","top","bottom"].map(m))).map(([,a])=>{const c=Ji[a.toLowerCase()];return new S(c,"deg")}),n=d(W.Angle,e),r=d(W.Length,W.Percentage),o=_(W.Color,r.sepBy(g)).map(([a,c])=>!c||c.length===0?[a]:[a,...c]),s=_(o,Xt.trim(g).next(d(o,r)).many()).map(([a,c])=>[a,...c]);return _(t,_(n.skip(Xt).opt(),s).trim(g).wrap(ye,Ce).map(([a,c])=>a?[a,...c].flat():[c])).map(([a,c])=>new se(a,c))},ea=()=>Xn(B("cubic-bezier")).map(t=>new se("cubic-bezier",t[1])),Wn=V(/[^\(\)\{\}\s,;]+/).map(t=>new S(t)),jn=d(qi(),Wi(),ji(),Qi(),ea(),Xn().map(([t,e])=>new se(t,e))),Yn=d(W.Value,jn,Wn).trim(g),ta={Function:jn,Value:Yn,FunctionArgs:os},ss=_(B("{"),V(/[^{}]+/),B("}")).map(t=>{const e=t.join(`
|
|
8
8
|
`);let n=JSON.parse(e);return new S(n,"json")}),jt=d(W.Value,jn,ss,Wn).trim(g),na={Value:jt,Values:jt.sepBy(g)},is=ze(t=>Te(jt,t)),ra=ze(t=>Te(W.Percentage,String(t)).valueOf()),oa=ze(t=>Te(W.Time.map(e=>e.unit==="ms"?e.value:e.unit==="s"?e.value*1e3:e.value),t)),sa=ze((t,e)=>(()=>{if(!e)return t;if(t.unit==="var"){const o=getComputedStyle(e).getPropertyValue(t.value);return Hn(o)}if(t.unit==="calc"&&t.property&&t.subProperty&&t.value&&e){const o=t.property,s=e.style[o],i=t.subProperty?`${t.subProperty}(${t.toString()})`:t.toString();e.style[o]=i;const a=getComputedStyle(e).getPropertyValue(o);e.style[o]=s;const c=is(a);if(c instanceof S)return c;if(c.name.startsWith("matrix")){const p=Er(c)[t.subProperty];if(p!=null)return new S(p,"px",["length","absolute"])}}return t})().coalesce(t),{keyFn:(t,e)=>`${t.toString()}-${JSON.stringify(e)}`}),as=(t,e,n=!1)=>{if(t?.superType?.[0]!==e?.superType?.[0])return n?[t,e]:[t.clone(),e.clone()];const r=i=>{switch(i?.superType?.[0]){case"length":return{value:xn(i.value,i.unit,i.targets?.[0]),unit:"px"};case"angle":return{value:mt(i.value,i.unit),unit:"deg"};case"time":return{value:Tn(i.value,i.unit),unit:"ms"};case"resolution":return{value:En(i.value,i.unit),unit:"dpi"};default:return{value:i.value,unit:i.unit}}},[o,s]=[r(t),r(e)];return n?(t.value=o.value,t.unit=o.unit,e.value=s.value,e.unit=s.unit,[t,e]):[new S(o.value,o.unit,t.superType,t.subProperty,t.property,t.targets),new S(s.value,s.unit,e.superType,e.subProperty,e.property,e.targets)]};function ia(t,e){t=t.coalesce(e,!0),e=e.coalesce(t,!0);const n={start:t,stop:e,value:t.clone()};if(Ze(t)&&Ze(e)){const[r,o]=Zo(t,e,"lab",!0);n.start=r,n.stop=o,n.value=r.clone()}if(t.unit!==e.unit){const[r,o]=as(t,e,!0);n.start=r,n.stop=o,n.value=r.clone()}return n.computed=Ye.includes(t.unit)||Ye.includes(e.unit),n}function cs(t){const e=(n,r=1)=>Math.round(t[n]*r);return`invert(${e(0)}%) sepia(${e(1)}%) saturate(${e(2)}%) hue-rotate(${e(3,3.6)}deg) brightness(${e(4)}%) contrast(${e(5)}%)`}const Zn=t=>[t.r,t.g,t.b],Mt=(t,e,n)=>new P(t,e,n),aa=(t,e,n)=>new fe(t,e,n),ls=t=>{const e=Ln(t);return aa(e.h,e.s,e.l)},ca=1,la=1/6,ua=5,pa=15,ma=100,ha=7500,fa=200,Gt=360,ba=50,da=20,ga=3750,wa=50,ka=100,Sa=100,ee=.2126,te=.7152,ne=.0722;function ya(t,e=0){const n=Math.sin(e*Math.PI/180),r=Math.cos(e*Math.PI/180),o=[ee+r*(1-ee)-n*ee,te-r*te-n*te,ne-r*ne+n*(1-ne),ee-r*ee+n*.143,te+r*(1-te)+n*.14,ne-r*ne-n*.283,ee-r*ee-n*(1-ee),te-r*te+n*te,ne+r*(1-ne)+n*ne];return Kn(t,o)}const mr=.393,hr=.769,fr=.189,br=.349,dr=.686,gr=.168,wr=.272,kr=.534,Sr=.131;function Ca(t,e=1){const n=[mr+(1-mr)*(1-e),hr-hr*(1-e),fr-fr*(1-e),br-br*(1-e),dr+(1-dr)*(1-e),gr-gr*(1-e),wr-wr*(1-e),kr-kr*(1-e),Sr+(1-Sr)*(1-e)];return Kn(t,n)}const ge=.213,we=.715,ke=.072;function xa(t,e=1){const n=[ge+(1-ge)*e,we-we*e,ke-ke*e,ge-ge*e,we+(1-we)*e,ke-ke*e,ge-ge*e,we-we*e,ke+(1-ke)*e];return Kn(t,n)}function Kn(t,e){const n=O(Zn(t),e);return Mt(R(n[0],0,255),R(n[1],0,255),R(n[2],0,255))}function Ta(t,e=1){return us(t,e)}function Ea(t,e=1){return us(t,e,-(.5*e)+.5)}function us(t,e=1,n=0){const r=Zn(t);return Mt(R(r[0]*e+n*255,0,255),R(r[1]*e+n*255,0,255),R(r[2]*e+n*255,0,255))}function Ia(t,e=1){const n=Zn(t);return Mt(R((e+n[0]/255*(1-2*e))*255,0,255),R((e+n[1]/255*(1-2*e))*255,0,255),R((e+n[2]/255*(1-2*e))*255,0,255))}function $t(t,e,n){let r=Mt(0,0,0);r=Ia(r,t[0]/100),r=Ca(r,t[1]/100),r=xa(r,t[2]/100),r=ya(r,t[3]*3.6),r=Ta(r,t[4]/100),r=Ea(r,t[5]/100);const o=ls(r);return Math.abs(r.r-e.r)+Math.abs(r.g-e.g)+Math.abs(r.b-e.b)+Math.abs(o.h-n.h)+Math.abs(o.s-n.s)+Math.abs(o.l-n.l)}function ps(t,e,n,r,o,s,i){let a=null,c=1/0;const l=new Array(6),p=new Array(6),u=new Array(6);for(let b=0;b<o;b++){const C=n/Math.pow(b+1,la);for(let w=0;w<6;w++)l[w]=Math.random()>.5?1:-1,p[w]=r[w]+C*l[w],u[w]=r[w]-C*l[w];const y=$t(p,s,i)-$t(u,s,i);for(let w=0;w<6;w++){const E=y/(2*C)*l[w],I=e[w]/Math.pow(t+b+1,ca);r[w]=Aa(r[w]-I*E,w)}const T=$t(r,s,i);T<c&&(a=[...r],c=T)}return{values:a??[...r],loss:c}}function Aa(t,e){let n=ma;return e===2?n=ha:(e===4||e===5)&&(n=fa),e===3?(t%Gt+Gt)%Gt:R(t,0,n)}function Ma(t,e,n){const r=t.loss,o=2,s=r+1,i=[.25*s,.25*s,s,.25*s,.2*s,.2*s];return ps(r,i,o,t.values,500,e,n)}function _a(t,e){const n=[60,180,18e3,600,1.2,1.2];let r={loss:1/0,values:[]};for(let o=0;o<3;o++)if(r.loss>25){const i=ps(ua,n,pa,[ba,da,ga,wa,ka,Sa],1e3,t,e);i.loss<r.loss&&(r=i)}return r}function Ra(t){const e=ls(t),n=Ma(_a(t,e),t,e);return{values:n.values,loss:n.loss,filter:cs(n.values)}}function Oa(t){return Ra(t)}function ms(t){return t}function Yt(t){return t*t}function Zt(t){return-t*(t-2)}function Kt(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)}function qt(t){return t*t*t}function Jt(t){return(t=t-1)*t*t+1}function Qt(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function en(t){return t*t*(3-2*t)}const Y=(t,e,n,r)=>o=>(o=On(o,t,e,n,r)[1],o);function tn(t){return t=Y(.09,.91,.5,1.5)(t),t}function nn(t){return t=Y(.09,.91,.5,1.5)(t),t}function rn(t){return t=$e(t,[[0,0],[.026,1.746],[.633,1.06],[1,0]])[1],t}function on(t){return t=$e(t,[[0,0],[.367,.94],[.974,.254],[1,0]])[1],t}function sn(t){return t=$e(t,[[0,0],[.026,1.746],[.633,1.06],[1,0]])[1],t}function an(t){return t=$e(t,[[0,0],[.026,1.746],[.633,1.06],[1,0]])[1],t}function cn(t){return 1-Math.cos(t*Math.PI/2)}function ln(t){return Math.sin(t*Math.PI/2)}function un(t){return-(Math.cos(Math.PI*t)-1)/2}function pn(t){return 1-Math.sqrt(1-t*t)}function mn(t){return Math.sqrt(1- --t*t)}function hn(t){return(t/=.5)<1?-(Math.sqrt(1-t*t)-1)/2:(Math.sqrt(1-(t-=2)*t)+1)/2}function fn(t){return t===0?0:Math.pow(2,10*(t-1))}function bn(t){return t===1?1:1-Math.pow(2,-10*t)}function dn(t){return t===0?0:t===1?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))}const Na=["jump-start","jump-end","jump-none","jump-both","start","end","both"];function hs(t,e){return Math.floor(t*e)/e}function Ba(t,e){return Math.ceil(t*e)/e}function va(t,e){return t===0||t===1?t:hs(t,e)}function Pa(t,e){return Math.round(t*e)/e}function _t(t,e="jump-start"){switch(e){case"jump-none":return n=>Pa(n,t);case"jump-start":case"start":return n=>hs(n,t);case"jump-end":case"end":return n=>Ba(n,t);case"jump-both":case"both":return n=>va(n,t)}}function fs(){return _t(1,"jump-start")}function bs(){return _t(1,"jump-end")}const re={ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-back":[.6,-.28,.735,.045],"ease-out-back":[.175,.885,.32,1.275],"ease-in-out-back":[.68,-.55,.265,1.55]},La={linear:ms,easeInQuad:Yt,"ease-in-quad":Yt,easeOutQuad:Zt,"ease-out-quad":Zt,easeInOutQuad:Kt,"ease-in-out-quad":Kt,easeInCubic:qt,"ease-in-cubic":qt,easeOutCubic:Jt,"ease-out-cubic":Jt,easeInOutCubic:Qt,"ease-in-out-cubic":Qt,easeInBounce:tn,"ease-in-bounce":tn,bounceInEase:nn,"bounce-in-ease":nn,bounceInEaseHalf:rn,"bounce-in-ease-half":rn,bounceOutEase:on,"bounce-out-ease":on,bounceOutEaseHalf:sn,"bounce-out-ease-half":sn,bounceInOutEase:an,"bounce-in-out-ease":an,easeInSine:cn,"ease-in-sine":cn,easeOutSine:ln,"ease-out-sine":ln,easeInOutSine:un,"ease-in-out-sine":un,easeInCirc:pn,"ease-in-circ":pn,easeOutCirc:mn,"ease-out-circ":mn,easeInOutCirc:hn,"ease-in-out-circ":hn,easeInExpo:fn,"ease-in-expo":fn,easeOutExpo:bn,"ease-out-expo":bn,easeInOutExpo:dn,"ease-in-out-expo":dn,smoothStep3:en,"smooth-step-3":en,ease:Y(...re.ease),"ease-in":Y(...re["ease-in"]),"ease-out":Y(...re["ease-out"]),"ease-in-out":Y(...re["ease-in-out"]),"ease-in-back":Y(...re["ease-in-back"]),"ease-out-back":Y(...re["ease-out-back"]),"ease-in-out-back":Y(...re["ease-in-out-back"]),steps:_t,"step-start":fs,"step-end":bs};exports.ABSOLUTE_LENGTH_UNITS=wn;exports.ALPHA_DENORM_UNIT=z;exports.ALPHA_RANGE=h;exports.ANGLE_UNITS=ve;exports.AdobeRGBColor=lt;exports.BLACKLISTED_COALESCE_UNITS=xr;exports.COLOR_NAMES=Ft;exports.COLOR_SPACE_DENORM_UNITS=In;exports.COLOR_SPACE_NAMES=Vs;exports.COLOR_SPACE_RANGES=f;exports.COLOR_UNITS=Cr;exports.COMPUTED_UNITS=Ye;exports.CSSColor=At;exports.CSSCubicBezier=Y;exports.CSSFunction=ta;exports.CSSJSON=ss;exports.CSSString=Wn;exports.CSSValueUnit=W;exports.CSSValues=na;exports.CYLINDRICAL_HUE_COMPONENT=Ho;exports.Color=D;exports.DELTA_E_OK_JND=Ys;exports.DisplayP3Color=ct;exports.FRAME_RATE=je;exports.FunctionValue=se;exports.GAMUT_SECTOR_COEFFICIENTS=Ur;exports.HSLColor=fe;exports.HSVColor=rt;exports.HUE_RANGE=Se;exports.HWBColor=ot;exports.KelvinColor=Cn;exports.LABColor=Ue;exports.LCHColor=st;exports.LENGTH_UNITS=Ne;exports.LINEAR_SRGB_TO_LMS=j;exports.LMS_TO_LINEAR_SRGB=k;exports.LMS_TO_OKLAB_MATRIX=Rn;exports.LMS_TO_XYZ_MATRIX=Lr;exports.LinearSRGBColor=at;exports.OKLABColor=Ge;exports.OKLAB_TO_LMS_COEFF=v;exports.OKLAB_TO_LMS_MATRIX=zr;exports.OKLCHColor=it;exports.PERCENTAGE_UNITS=Sn;exports.ProPhotoRGBColor=ut;exports.RELATIVE_LENGTH_UNITS=kn;exports.RESOLUTION_UNITS=Pe;exports.RGBA_MAX=N;exports.RGBColor=P;exports.RGB_RANGE=Ve;exports.Rec2020Color=pt;exports.STRING_UNITS=yr;exports.STYLE_NAMES=Tr;exports.TIME_UNITS=Be;exports.UNITS=_s;exports.UNIT_RANGE=L;exports.ValueArray=xe;exports.ValueUnit=S;exports.WHITE_POINTS=Mn;exports.WHITE_POINT_D50=Pr;exports.WHITE_POINT_D50_D65=An;exports.WHITE_POINT_D65=vr;exports.WHITE_POINT_D65_D50=ft;exports.XYZColor=F;exports.XYZ_TO_LMS_MATRIX=_n;exports.adobeRgb2xyz=zo;exports.adobeRgbToLinear=He;exports.arrayEquals=ks;exports.bezierPresets=re;exports.bounceInEase=nn;exports.bounceInEaseHalf=rn;exports.bounceInOutEase=an;exports.bounceOutEase=on;exports.bounceOutEaseHalf=sn;exports.camelCaseToHyphen=Es;exports.cancelAnimationFrame=Ms;exports.clamp=R;exports.clone=K;exports.color2=oe;exports.colorUnit2=Vt;exports.computeMaxSaturation=Dr;exports.convert2=Ls;exports.convertAbsoluteUnitToPixels=Ir;exports.convertToDPI=En;exports.convertToDegrees=mt;exports.convertToMs=Tn;exports.convertToPixels=xn;exports.createHash=xs;exports.cssFiltersToString=cs;exports.cubicBezier=On;exports.cubicBezierToSVG=Xs;exports.cubicBezierToString=Ws;exports.deCasteljau=Le;exports.debounce=Cs;exports.deltaEOK=Zs;exports.displayP32xyz=Po;exports.easeInBounce=tn;exports.easeInCirc=pn;exports.easeInCubic=qt;exports.easeInExpo=fn;exports.easeInOutCirc=hn;exports.easeInOutCubic=Qt;exports.easeInOutExpo=dn;exports.easeInOutQuad=Kt;exports.easeInOutSine=un;exports.easeInQuad=Yt;exports.easeInSine=cn;exports.easeOutCirc=mn;exports.easeOutCubic=Jt;exports.easeOutExpo=bn;exports.easeOutQuad=Zt;exports.easeOutSine=ln;exports.fail=Br;exports.findCusp=Vr;exports.findGamutIntersection=Hr;exports.flattenObject=Rs;exports.gamutMap=Vo;exports.gamutMapOKLab=Xr;exports.gamutMapSRGB=jr;exports.getComputedValue=sa;exports.getFormattedColorSpaceRange=Js;exports.hex2rgb=Yr;exports.hsl2hsv=Pn;exports.hsl2hwb=eo;exports.hsl2rgb=to;exports.hsl2xyz=Ct;exports.hsv2hsl=vn;exports.hsv2xyz=po;exports.hwb2hsl=Qr;exports.hwb2xyz=ho;exports.hyphenToCamelCase=Ts;exports.identifier=Rr;exports.integer=Or;exports.interpBezier=$e;exports.interpolateHue=Xo;exports.invertMat3=J;exports.isCSSStyleName=vs;exports.isColorUnit=Ze;exports.isInSRGBGamut=Fr;exports.isObject=gn;exports.istring=m;exports.jumpTerms=Na;exports.kelvin2rgb=Bn;exports.kelvin2xyz=So;exports.lab2lch=co;exports.lab2oklab=uo;exports.lab2oklch=ai;exports.lab2xyz=gt;exports.lch2lab=ao;exports.lch2xyz=bo;exports.lerp=qe;exports.linear=ms;exports.linearSrgb2xyz=Bo;exports.linearToAdobeRgb=xo;exports.linearToProPhoto=Io;exports.linearToRec2020=Mo;exports.linearToSrgb=Gn;exports.logerp=Hs;exports.memoize=ze;exports.mixColors=Wo;exports.multiplyMat3=Ds;exports.none=ht;exports.normalizeColor=Yo;exports.normalizeColorUnit=tt;exports.normalizeColorUnitComponent=jo;exports.normalizeColorUnits=Zo;exports.normalizeNumericUnits=as;exports.normalizeValueUnits=ia;exports.number=q;exports.oklab2lab=lo;exports.oklab2oklch=$n;exports.oklab2xyz=St;exports.oklabToLinearSRGB=bt;exports.oklch2lab=ii;exports.oklch2oklab=Fn;exports.oklch2xyz=wo;exports.parseCSSColor=Li;exports.parseCSSPercent=ra;exports.parseCSSTime=oa;exports.parseCSSValue=is;exports.parseCSSValueUnit=Hn;exports.parseResult=$s;exports.proPhoto2xyz=Go;exports.proPhotoToLinear=Xe;exports.rec20202xyz=Fo;exports.rec2020ToLinear=We;exports.requestAnimationFrame=As;exports.rgb2ColorFilter=Oa;exports.rgb2hex=Qs;exports.rgb2hsl=Ln;exports.rgb2kelvin=Jr;exports.rgb2xyz=wt;exports.scale=A;exports.seekPreviousValue=Is;exports.sleep=Ss;exports.smoothStep3=en;exports.srgbToLinear=he;exports.srgbToOKLab=Wr;exports.stepEnd=bs;exports.stepStart=fs;exports.steppedEase=_t;exports.succeed=Nr;exports.timingFunctions=La;exports.transformMat3=O;exports.transposeMat3=Fs;exports.tryParse=Te;exports.unflattenObject=Os;exports.unflattenObjectToString=Ns;exports.unpackMatrixValues=Er;exports.waitUntil=ys;exports.xyz2adobeRgb=Uo;exports.xyz2displayP3=Lo;exports.xyz2hsl=xt;exports.xyz2hsv=mo;exports.xyz2hwb=fo;exports.xyz2kelvin=yo;exports.xyz2lab=dt;exports.xyz2lch=go;exports.xyz2linearSrgb=vo;exports.xyz2oklab=yt;exports.xyz2oklch=ko;exports.xyz2proPhoto=$o;exports.xyz2rec2020=Do;exports.xyz2rgb=kt;
|
package/dist/value.d.ts
CHANGED
|
@@ -225,6 +225,7 @@ export declare const COLOR_NAMES: {
|
|
|
225
225
|
readonly tan: "#d2b48c";
|
|
226
226
|
readonly teal: "#008080";
|
|
227
227
|
readonly thistle: "#d8bfd8";
|
|
228
|
+
readonly transparent: "rgba(0, 0, 0, 0)";
|
|
228
229
|
readonly tomato: "#ff6347";
|
|
229
230
|
readonly turquoise: "#40e0d0";
|
|
230
231
|
readonly violet: "#ee82ee";
|
package/dist/value.js
CHANGED
|
@@ -37,7 +37,7 @@ async function na(e, t) {
|
|
|
37
37
|
const n = new TextEncoder().encode(t), r = await crypto.subtle.digest(e, n);
|
|
38
38
|
return Array.from(new Uint8Array(r)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Wt(e, t = {}) {
|
|
41
41
|
const n = /* @__PURE__ */ new Map(), { maxCacheSize: r = 1 / 0, ttl: o = 1 / 0, keyFn: s = JSON.stringify } = t, i = function(...a) {
|
|
42
42
|
const c = s.apply(this, a), l = Date.now();
|
|
43
43
|
if (n.has(c)) {
|
|
@@ -846,7 +846,7 @@ class yt extends V {
|
|
|
846
846
|
this.setComponent("l", t);
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
|
-
class
|
|
849
|
+
class Ee extends V {
|
|
850
850
|
constructor(t, n, r, o) {
|
|
851
851
|
super("hsv", o), this.components.set("h", t), this.components.set("s", n), this.components.set("v", r);
|
|
852
852
|
}
|
|
@@ -869,7 +869,7 @@ class Te extends V {
|
|
|
869
869
|
this.setComponent("v", t);
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
|
-
class
|
|
872
|
+
class Te extends V {
|
|
873
873
|
constructor(t, n, r, o) {
|
|
874
874
|
super("hwb", o), this.components.set("h", t), this.components.set("w", n), this.components.set("b", r);
|
|
875
875
|
}
|
|
@@ -892,7 +892,7 @@ class Ee extends V {
|
|
|
892
892
|
this.setComponent("b", t);
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
|
-
class
|
|
895
|
+
class Xt extends xe {
|
|
896
896
|
constructor(t, n, r, o) {
|
|
897
897
|
super("lab", o, "D50"), this.components.set("l", t), this.components.set("a", n), this.components.set("b", r);
|
|
898
898
|
}
|
|
@@ -1934,7 +1934,7 @@ const _ = 255, h = {
|
|
|
1934
1934
|
}, z = {
|
|
1935
1935
|
"%": h["%"],
|
|
1936
1936
|
number: h.number
|
|
1937
|
-
},
|
|
1937
|
+
}, Tt = {
|
|
1938
1938
|
deg: { min: 0, max: 360 },
|
|
1939
1939
|
number: { min: 0, max: 360 },
|
|
1940
1940
|
"%": h["%"]
|
|
@@ -1946,19 +1946,19 @@ const _ = 255, h = {
|
|
|
1946
1946
|
alpha: h
|
|
1947
1947
|
},
|
|
1948
1948
|
hsl: {
|
|
1949
|
-
h:
|
|
1949
|
+
h: Tt,
|
|
1950
1950
|
s: { "%": h["%"], number: h.number },
|
|
1951
1951
|
l: { "%": h["%"], number: h.number },
|
|
1952
1952
|
alpha: h
|
|
1953
1953
|
},
|
|
1954
1954
|
hsv: {
|
|
1955
|
-
h:
|
|
1955
|
+
h: Tt,
|
|
1956
1956
|
s: { "%": h["%"], number: h.number },
|
|
1957
1957
|
v: { "%": h["%"], number: h.number },
|
|
1958
1958
|
alpha: h
|
|
1959
1959
|
},
|
|
1960
1960
|
hwb: {
|
|
1961
|
-
h:
|
|
1961
|
+
h: Tt,
|
|
1962
1962
|
w: { "%": h["%"], number: h.number },
|
|
1963
1963
|
b: { "%": h["%"], number: h.number },
|
|
1964
1964
|
alpha: h
|
|
@@ -1972,7 +1972,7 @@ const _ = 255, h = {
|
|
|
1972
1972
|
lch: {
|
|
1973
1973
|
l: { "%": h["%"], number: h["%"] },
|
|
1974
1974
|
c: { number: { min: 0, max: 150 }, "%": h["%"] },
|
|
1975
|
-
h:
|
|
1975
|
+
h: Tt,
|
|
1976
1976
|
alpha: h
|
|
1977
1977
|
},
|
|
1978
1978
|
oklab: {
|
|
@@ -1984,7 +1984,7 @@ const _ = 255, h = {
|
|
|
1984
1984
|
oklch: {
|
|
1985
1985
|
l: { "%": h["%"], number: h["%"] },
|
|
1986
1986
|
c: { number: { min: 0, max: 0.5 }, "%": h["%"] },
|
|
1987
|
-
h:
|
|
1987
|
+
h: Tt,
|
|
1988
1988
|
alpha: h
|
|
1989
1989
|
},
|
|
1990
1990
|
xyz: {
|
|
@@ -2197,7 +2197,7 @@ const _ = 255, h = {
|
|
|
2197
2197
|
l: [1, 0.3963377774, 0.2158037573],
|
|
2198
2198
|
m: [1, -0.1055613458, -0.0638541728],
|
|
2199
2199
|
s: [1, -0.0894841775, -1.291485548]
|
|
2200
|
-
},
|
|
2200
|
+
}, Eo = [
|
|
2201
2201
|
{
|
|
2202
2202
|
// Red sector: -1.88170328*a - 0.80936493*b > 1
|
|
2203
2203
|
test: (e, t) => -1.88170328 * e - 0.80936493 * t > 1,
|
|
@@ -2375,6 +2375,7 @@ const _ = 255, h = {
|
|
|
2375
2375
|
tan: "#d2b48c",
|
|
2376
2376
|
teal: "#008080",
|
|
2377
2377
|
thistle: "#d8bfd8",
|
|
2378
|
+
transparent: "rgba(0, 0, 0, 0)",
|
|
2378
2379
|
tomato: "#ff6347",
|
|
2379
2380
|
turquoise: "#40e0d0",
|
|
2380
2381
|
violet: "#ee82ee",
|
|
@@ -2430,7 +2431,7 @@ function ya(e, t, n, r) {
|
|
|
2430
2431
|
const o = (s) => s.toFixed(2);
|
|
2431
2432
|
return `cubic-bezier(${o(e)}, ${o(t)}, ${o(n)}, ${o(r)})`;
|
|
2432
2433
|
}
|
|
2433
|
-
const br = 2.4, Gt = 0.055, Le = 12.92,
|
|
2434
|
+
const br = 2.4, Gt = 0.055, Le = 12.92, To = 0.04045, dr = To / Le;
|
|
2434
2435
|
function se(e) {
|
|
2435
2436
|
const t = e < 0 ? -1 : 1, n = e * t;
|
|
2436
2437
|
return n <= dr ? e / Le : t * ((n + Gt) / (1 + Gt)) ** br;
|
|
@@ -2459,11 +2460,11 @@ function Ao(e, t, n) {
|
|
|
2459
2460
|
return e >= 0 && e <= 1 && t >= 0 && t <= 1 && n >= 0 && n <= 1;
|
|
2460
2461
|
}
|
|
2461
2462
|
function Mo(e, t) {
|
|
2462
|
-
const n =
|
|
2463
|
+
const n = Eo.find((E) => E.test(e, t)), { k0: r, k1: o, k2: s, k3: i, k4: a, wl: c, wm: l, ws: p } = n;
|
|
2463
2464
|
let u = r + o * e + s * t + i * e * e + a * e * t;
|
|
2464
2465
|
const f = P.l[1] * e + P.l[2] * t, C = P.m[1] * e + P.m[2] * t, y = P.s[1] * e + P.s[2] * t;
|
|
2465
2466
|
{
|
|
2466
|
-
const
|
|
2467
|
+
const E = 1 + u * f, w = 1 + u * C, T = 1 + u * y, A = E * E * E, L = w * w * w, W = T * T * T, ot = 3 * f * E * E, st = 3 * C * w * w, it = 3 * y * T * T, Ct = 6 * f * f * E, xt = 6 * C * C * w, Et = 6 * y * y * T, ht = c * A + l * L + p * W, at = c * ot + l * st + p * it, Nt = c * Ct + l * xt + p * Et;
|
|
2467
2468
|
u = u - ht * at / (at * at - 0.5 * ht * Nt);
|
|
2468
2469
|
}
|
|
2469
2470
|
return u;
|
|
@@ -2480,11 +2481,11 @@ function Ro(e, t, n, r, o, s) {
|
|
|
2480
2481
|
i = s.C * (o - 1) / (r * (s.L - 1) + s.C * (o - n));
|
|
2481
2482
|
const a = n - o, c = r, l = P.l[1] * e + P.l[2] * t, p = P.m[1] * e + P.m[2] * t, u = P.s[1] * e + P.s[2] * t, f = a + c * l, C = a + c * p, y = a + c * u;
|
|
2482
2483
|
{
|
|
2483
|
-
const
|
|
2484
|
+
const E = o * (1 - i) + i * n, w = i * r, T = E + w * l, A = E + w * p, L = E + w * u, W = T * T * T, ot = A * A * A, st = L * L * L, it = 3 * f * T * T, Ct = 3 * C * A * A, xt = 3 * y * L * L, Et = 6 * f * f * T, ht = 6 * C * C * A, at = 6 * y * y * L, Nt = k[0] * W + k[1] * ot + k[2] * st - 1, Jt = k[0] * it + k[1] * Ct + k[2] * xt, eo = k[0] * Et + k[1] * ht + k[2] * at, rn = Jt / (Jt * Jt - 0.5 * Nt * eo);
|
|
2484
2485
|
let Qt = -Nt * rn;
|
|
2485
|
-
const on = k[3] *
|
|
2486
|
+
const on = k[3] * W + k[4] * ot + k[5] * st - 1, te = k[3] * it + k[4] * Ct + k[5] * xt, no = k[3] * Et + k[4] * ht + k[5] * at, sn = te / (te * te - 0.5 * on * no);
|
|
2486
2487
|
let ee = -on * sn;
|
|
2487
|
-
const an = k[6] *
|
|
2488
|
+
const an = k[6] * W + k[7] * ot + k[8] * st - 1, ne = k[6] * it + k[7] * Ct + k[8] * xt, ro = k[6] * Et + k[7] * ht + k[8] * at, cn = ne / (ne * ne - 0.5 * an * ro);
|
|
2488
2489
|
let re = -an * cn;
|
|
2489
2490
|
Qt = rn >= 0 ? Qt : 1 / 0, ee = sn >= 0 ? ee : 1 / 0, re = cn >= 0 ? re : 1 / 0, i += Math.min(Qt, ee, re);
|
|
2490
2491
|
}
|
|
@@ -2496,8 +2497,8 @@ function No(e, t, n) {
|
|
|
2496
2497
|
const [r, o, s] = ze(e, t, n);
|
|
2497
2498
|
if (Ao(r, o, s))
|
|
2498
2499
|
return [e, t, n];
|
|
2499
|
-
const i = Math.max(vo, Math.sqrt(t * t + n * n)), a = t / i, c = n / i, l = Io(a, c), p = e - 0.5, u = 0.5 + Math.abs(p) + Bo * i, f = 0.5 * (1 + Math.sign(p) * (u - Math.sqrt(u * u - 2 * Math.abs(p)))), C = Ro(a, c, e, i, f, l), y = f * (1 - C) + C * e,
|
|
2500
|
-
return [y,
|
|
2500
|
+
const i = Math.max(vo, Math.sqrt(t * t + n * n)), a = t / i, c = n / i, l = Io(a, c), p = e - 0.5, u = 0.5 + Math.abs(p) + Bo * i, f = 0.5 * (1 + Math.sign(p) * (u - Math.sqrt(u * u - 2 * Math.abs(p)))), C = Ro(a, c, e, i, f, l), y = f * (1 - C) + C * e, E = C * i;
|
|
2501
|
+
return [y, E * a, E * c];
|
|
2501
2502
|
}
|
|
2502
2503
|
function _o(e, t, n) {
|
|
2503
2504
|
const r = se(e), o = se(t), s = se(n), i = Math.cbrt(j[0] * r + j[1] * o + j[2] * s), a = Math.cbrt(j[3] * r + j[4] * o + j[5] * s), c = Math.cbrt(j[6] * r + j[7] * o + j[8] * s);
|
|
@@ -2517,7 +2518,7 @@ function Po(e, t, n) {
|
|
|
2517
2518
|
ae(ie(u), 0, 1)
|
|
2518
2519
|
];
|
|
2519
2520
|
}
|
|
2520
|
-
const
|
|
2521
|
+
const Ea = (e) => {
|
|
2521
2522
|
const t = b[e], n = lr[e];
|
|
2522
2523
|
return Object.entries(t).reduce((r, [o, s]) => {
|
|
2523
2524
|
const i = n[o];
|
|
@@ -2532,7 +2533,7 @@ const Ta = (e) => {
|
|
|
2532
2533
|
const t = parseInt(e.slice(0, 2), Y), n = parseInt(e.slice(2, 4), Y), r = parseInt(e.slice(4, 6), Y), o = e.length === 8 ? parseInt(e.slice(6, 8), Y) / _ : 1;
|
|
2533
2534
|
return new O(t, n, r, o);
|
|
2534
2535
|
}
|
|
2535
|
-
},
|
|
2536
|
+
}, Ta = ({ r: e, g: t, b: n, alpha: r }) => {
|
|
2536
2537
|
const o = (s) => {
|
|
2537
2538
|
const i = s.toString(Y);
|
|
2538
2539
|
return i.length === 1 ? "0" + i : i;
|
|
@@ -2558,14 +2559,14 @@ const Ta = (e) => {
|
|
|
2558
2559
|
}, Cr = ({ h: e, s: t, l: n, alpha: r }) => {
|
|
2559
2560
|
const o = n + t * Math.min(n, 1 - n);
|
|
2560
2561
|
let s;
|
|
2561
|
-
return o === 0 ? s = 0 : s = 2 * (1 - n / o), new
|
|
2562
|
+
return o === 0 ? s = 0 : s = 2 * (1 - n / o), new Ee(e, s, o, r);
|
|
2562
2563
|
}, zo = ({ h: e, w: t, b: n, alpha: r }) => {
|
|
2563
2564
|
let o, s;
|
|
2564
2565
|
const i = t + n;
|
|
2565
|
-
return i >= 1 ? (s = t / i, o = 0) : (s = 1 - n, o = s === 0 ? 0 : 1 - t / s), yr(new
|
|
2566
|
+
return i >= 1 ? (s = t / i, o = 0) : (s = 1 - n, o = s === 0 ? 0 : 1 - t / s), yr(new Ee(e, o, s, r));
|
|
2566
2567
|
}, $o = ({ h: e, s: t, l: n, alpha: r }) => {
|
|
2567
2568
|
const { h: o, s, v: i } = Cr(new yt(e, t, n, r));
|
|
2568
|
-
return new
|
|
2569
|
+
return new Te(o, i * (1 - s), 1 - i, r);
|
|
2569
2570
|
}, xr = ({ r: e, g: t, b: n, alpha: r }) => {
|
|
2570
2571
|
const o = Math.max(e, t, n), s = Math.min(e, t, n);
|
|
2571
2572
|
let [i, a, c] = [0, 0, (o + s) / 2];
|
|
@@ -2588,19 +2589,19 @@ function Fo({ h: e, s: t, l: n, alpha: r }) {
|
|
|
2588
2589
|
let a, c, l;
|
|
2589
2590
|
return e < 1 / 6 ? [a, c, l] = [o, s, 0] : e < 2 / 6 ? [a, c, l] = [s, o, 0] : e < 3 / 6 ? [a, c, l] = [0, o, s] : e < 4 / 6 ? [a, c, l] = [0, s, o] : e < 5 / 6 ? [a, c, l] = [s, 0, o] : [a, c, l] = [o, 0, s], new O(a + i, c + i, l + i, r);
|
|
2590
2591
|
}
|
|
2591
|
-
const Go = 216 / 24389, Uo = 24 / 116, ge = 24389 / 27, Do = 8, It = 16, Rt = 116,
|
|
2592
|
+
const Go = 216 / 24389, Uo = 24 / 116, ge = 24389 / 27, Do = 8, It = 16, Rt = 116, Er = 500, Tr = 200;
|
|
2592
2593
|
function Vo(e) {
|
|
2593
2594
|
if (e.whitePoint === "D50") return [e.x, e.y, e.z];
|
|
2594
2595
|
if (e.whitePoint === "D65") return N([e.x, e.y, e.z], Oe);
|
|
2595
2596
|
throw new Error(`Unsupported white point: ${e.whitePoint}`);
|
|
2596
2597
|
}
|
|
2597
|
-
function
|
|
2598
|
+
function Wo(e) {
|
|
2598
2599
|
if (e.whitePoint === "D65") return [e.x, e.y, e.z];
|
|
2599
2600
|
if (e.whitePoint === "D50") return N([e.x, e.y, e.z], ur);
|
|
2600
2601
|
throw new Error(`Unsupported white point: ${e.whitePoint}`);
|
|
2601
2602
|
}
|
|
2602
2603
|
function $e(e, t = "D50") {
|
|
2603
|
-
const n = (
|
|
2604
|
+
const n = (T) => T > Go ? Math.cbrt(T) : (ge * T + It) / Rt, r = pr[t], [o, s, i] = Vo(e), a = o / r[0], c = s / r[1], l = i / r[2], p = n(a), u = n(c), f = n(l), C = Rt * u - It, y = Er * (p - u), E = Tr * (u - f), w = new Xt(
|
|
2604
2605
|
R(
|
|
2605
2606
|
C,
|
|
2606
2607
|
b.lab.l.number.min,
|
|
@@ -2612,7 +2613,7 @@ function $e(e, t = "D50") {
|
|
|
2612
2613
|
b.lab.a.number.max
|
|
2613
2614
|
),
|
|
2614
2615
|
R(
|
|
2615
|
-
|
|
2616
|
+
E,
|
|
2616
2617
|
b.lab.b.number.min,
|
|
2617
2618
|
b.lab.b.number.max
|
|
2618
2619
|
),
|
|
@@ -2642,10 +2643,10 @@ function Fe(e) {
|
|
|
2642
2643
|
b.lab.b.number.min,
|
|
2643
2644
|
b.lab.b.number.max
|
|
2644
2645
|
);
|
|
2645
|
-
const c = (o + It) / Rt, l = s /
|
|
2646
|
-
let y = u * r[0],
|
|
2647
|
-
const
|
|
2648
|
-
return
|
|
2646
|
+
const c = (o + It) / Rt, l = s / Er + c, p = c - i / Tr, [u, f, C] = [t(l), n(o), t(p)];
|
|
2647
|
+
let y = u * r[0], E = f * r[1], w = C * r[2];
|
|
2648
|
+
const T = new U(y, E, w, a);
|
|
2649
|
+
return T.whitePoint = e.whitePoint, [y, E, w] = Wo(T), T.whitePoint = "D65", T.x = y, T.y = E, T.z = w, T;
|
|
2649
2650
|
}
|
|
2650
2651
|
const Ge = [
|
|
2651
2652
|
0.41239079926595934,
|
|
@@ -2657,7 +2658,7 @@ const Ge = [
|
|
|
2657
2658
|
0.01933081871559182,
|
|
2658
2659
|
0.11919477979462598,
|
|
2659
2660
|
0.9505321522496607
|
|
2660
|
-
], Ar = nt(Ge), Mr = 2.4, Ut = 0.055, Ue = 12.92,
|
|
2661
|
+
], Ar = nt(Ge), Mr = 2.4, Ut = 0.055, Ue = 12.92, Xo = 0.04045, Ir = Xo / Ue;
|
|
2661
2662
|
function wt(e) {
|
|
2662
2663
|
const t = e < 0 ? -1 : 1, n = e * t;
|
|
2663
2664
|
return n <= Ir ? e / Ue : t * ((n + Ut) / (1 + Ut)) ** Mr;
|
|
@@ -2687,7 +2688,7 @@ function Ho({ l: e, c: t, h: n, alpha: r }) {
|
|
|
2687
2688
|
b.lch.c.number.max
|
|
2688
2689
|
);
|
|
2689
2690
|
const o = n * 2 * Math.PI, s = Math.cos(o) * t, i = Math.sin(o) * t;
|
|
2690
|
-
return new
|
|
2691
|
+
return new Xt(
|
|
2691
2692
|
e,
|
|
2692
2693
|
R(
|
|
2693
2694
|
s,
|
|
@@ -2729,7 +2730,7 @@ function jo({ l: e, a: t, b: n, alpha: r }) {
|
|
|
2729
2730
|
r
|
|
2730
2731
|
);
|
|
2731
2732
|
}
|
|
2732
|
-
function
|
|
2733
|
+
function We({ l: e, a: t, b: n, alpha: r }) {
|
|
2733
2734
|
t = R(
|
|
2734
2735
|
t,
|
|
2735
2736
|
0,
|
|
@@ -2746,7 +2747,7 @@ function Xe({ l: e, a: t, b: n, alpha: r }) {
|
|
|
2746
2747
|
const o = N([e, t, n], xo), s = [o[0] * o[0] * o[0], o[1] * o[1] * o[1], o[2] * o[2] * o[2]], [i, a, c] = N(s, Co);
|
|
2747
2748
|
return new U(i, a, c, r);
|
|
2748
2749
|
}
|
|
2749
|
-
function
|
|
2750
|
+
function Xe(e) {
|
|
2750
2751
|
const { x: t, y: n, z: r } = e, o = N([t, n, r], mr), s = [Math.cbrt(o[0]), Math.cbrt(o[1]), Math.cbrt(o[2])], [i, a, c] = N(s, hr);
|
|
2751
2752
|
return new Ht(
|
|
2752
2753
|
i,
|
|
@@ -2764,12 +2765,12 @@ function We(e) {
|
|
|
2764
2765
|
);
|
|
2765
2766
|
}
|
|
2766
2767
|
function Yo(e) {
|
|
2767
|
-
const t =
|
|
2768
|
+
const t = We(e);
|
|
2768
2769
|
return $e(t);
|
|
2769
2770
|
}
|
|
2770
2771
|
function Zo(e) {
|
|
2771
2772
|
const t = Fe(e);
|
|
2772
|
-
return
|
|
2773
|
+
return Xe(t);
|
|
2773
2774
|
}
|
|
2774
2775
|
function vr({ l: e, a: t, b: n, alpha: r }) {
|
|
2775
2776
|
t = R(t, 0, 1, b.oklab.a.number.min, b.oklab.a.number.max), n = R(n, 0, 1, b.oklab.b.number.min, b.oklab.b.number.max);
|
|
@@ -2832,10 +2833,10 @@ function es(e) {
|
|
|
2832
2833
|
}
|
|
2833
2834
|
function ns(e) {
|
|
2834
2835
|
const t = Br(e);
|
|
2835
|
-
return
|
|
2836
|
+
return We(t);
|
|
2836
2837
|
}
|
|
2837
2838
|
function rs(e) {
|
|
2838
|
-
const t =
|
|
2839
|
+
const t = Xe(e);
|
|
2839
2840
|
return vr(t);
|
|
2840
2841
|
}
|
|
2841
2842
|
function os(e) {
|
|
@@ -2959,7 +2960,7 @@ const gn = {
|
|
|
2959
2960
|
hwb: { to: Jo, from: Qo },
|
|
2960
2961
|
lab: { to: Fe, from: $e },
|
|
2961
2962
|
lch: { to: ts, from: es },
|
|
2962
|
-
oklab: { to:
|
|
2963
|
+
oklab: { to: We, from: Xe },
|
|
2963
2964
|
oklch: { to: ns, from: rs },
|
|
2964
2965
|
kelvin: { to: os, from: ss },
|
|
2965
2966
|
xyz: { to: (e) => e, from: (e) => e },
|
|
@@ -2972,8 +2973,14 @@ const gn = {
|
|
|
2972
2973
|
function pt(e, t) {
|
|
2973
2974
|
if (e.colorSpace === t)
|
|
2974
2975
|
return e;
|
|
2975
|
-
const n = gn[e.colorSpace]
|
|
2976
|
-
|
|
2976
|
+
const n = gn[e.colorSpace];
|
|
2977
|
+
if (!n)
|
|
2978
|
+
throw new Error(`Unknown source color space: "${e.colorSpace}"`);
|
|
2979
|
+
const r = gn[t];
|
|
2980
|
+
if (!r)
|
|
2981
|
+
throw new Error(`Unknown target color space: "${t}"`);
|
|
2982
|
+
const o = n.to(e), s = r.from;
|
|
2983
|
+
return s(o);
|
|
2977
2984
|
}
|
|
2978
2985
|
const ft = 1e-6;
|
|
2979
2986
|
function xs(e) {
|
|
@@ -2987,14 +2994,14 @@ function xs(e) {
|
|
|
2987
2994
|
const [s, i, a] = Po(n, r, o), c = new O(s, i, a, e.alpha);
|
|
2988
2995
|
return pt(c, e.colorSpace);
|
|
2989
2996
|
}
|
|
2990
|
-
const
|
|
2997
|
+
const Es = {
|
|
2991
2998
|
hsl: "h",
|
|
2992
2999
|
hsv: "h",
|
|
2993
3000
|
hwb: "h",
|
|
2994
3001
|
lch: "h",
|
|
2995
3002
|
oklch: "h"
|
|
2996
3003
|
};
|
|
2997
|
-
function
|
|
3004
|
+
function Ts(e, t, n, r = "shorter") {
|
|
2998
3005
|
if (Number.isNaN(e) && Number.isNaN(t)) return 0;
|
|
2999
3006
|
if (Number.isNaN(e)) return t;
|
|
3000
3007
|
if (Number.isNaN(t)) return e;
|
|
@@ -3021,22 +3028,22 @@ function As(e, t, n, r, o = "oklab", s = "shorter") {
|
|
|
3021
3028
|
n < 0 && (n = 0), r < 0 && (r = 0);
|
|
3022
3029
|
const c = n + r;
|
|
3023
3030
|
c === 0 ? (n = 0.5, r = 0.5) : c !== 1 && (n = n / c, r = r / c);
|
|
3024
|
-
const l = Math.min(c, 1), p =
|
|
3031
|
+
const l = Math.min(c, 1), p = Es[o], u = i.keys().filter((A) => A !== "alpha"), f = Number.isNaN(i.alpha) ? a.alpha : i.alpha, C = Number.isNaN(a.alpha) ? i.alpha : a.alpha, y = de(r, f, C) * l, E = [];
|
|
3025
3032
|
for (const A of u) {
|
|
3026
|
-
let L = i[A],
|
|
3027
|
-
if (Number.isNaN(L) && Number.isNaN(
|
|
3028
|
-
|
|
3033
|
+
let L = i[A], W = a[A];
|
|
3034
|
+
if (Number.isNaN(L) && Number.isNaN(W)) {
|
|
3035
|
+
E.push(0);
|
|
3029
3036
|
continue;
|
|
3030
3037
|
}
|
|
3031
|
-
if (Number.isNaN(L) && (L =
|
|
3032
|
-
|
|
3038
|
+
if (Number.isNaN(L) && (L = W), Number.isNaN(W) && (W = L), A === p)
|
|
3039
|
+
E.push(Ts(L, W, r, s));
|
|
3033
3040
|
else {
|
|
3034
|
-
const ot = L * f, st =
|
|
3035
|
-
|
|
3041
|
+
const ot = L * f, st = W * C, it = de(r, ot, st);
|
|
3042
|
+
E.push(y > 0 ? it / y : 0);
|
|
3036
3043
|
}
|
|
3037
3044
|
}
|
|
3038
3045
|
const w = i.constructor;
|
|
3039
|
-
return new w(...
|
|
3046
|
+
return new w(...E, y);
|
|
3040
3047
|
}
|
|
3041
3048
|
const Ms = (e, t, n) => {
|
|
3042
3049
|
const r = b[t][n];
|
|
@@ -3112,8 +3119,8 @@ function Ns(e, t, n, r) {
|
|
|
3112
3119
|
const a = n.map((f) => kn(f, i)), c = r ? kn(r, i) : i.alpha ?? 1, p = {
|
|
3113
3120
|
rgb: O,
|
|
3114
3121
|
hsl: yt,
|
|
3115
|
-
hwb:
|
|
3116
|
-
lab:
|
|
3122
|
+
hwb: Te,
|
|
3123
|
+
lab: Xt,
|
|
3117
3124
|
lch: Ae,
|
|
3118
3125
|
oklab: Ht,
|
|
3119
3126
|
oklch: Me,
|
|
@@ -3152,7 +3159,7 @@ const _s = {
|
|
|
3152
3159
|
xyz: { space: "xyz", ctor: U },
|
|
3153
3160
|
"xyz-d65": { space: "xyz", ctor: U },
|
|
3154
3161
|
"xyz-d50": { space: "xyz", ctor: U }
|
|
3155
|
-
}, Os = B(","), Ls = D(/\s+/), Yt = B("/"), Zt = B("("), qt = B(")"), Vt = d(Os.trim(g), Ls), Gr = d(Yt.trim(g), Vt),
|
|
3162
|
+
}, Os = B(","), Ls = D(/\s+/), Yt = B("/"), Zt = B("("), qt = B(")"), Vt = d(Os.trim(g), Ls), Gr = d(Yt.trim(g), Vt), X = x.lazy(() => d(
|
|
3156
3163
|
H.Percentage,
|
|
3157
3164
|
H.Angle.map((e) => {
|
|
3158
3165
|
const t = _e(e.value, e.unit);
|
|
@@ -3172,14 +3179,14 @@ const _s = {
|
|
|
3172
3179
|
(e) => ({ type: "ref", name: e })
|
|
3173
3180
|
),
|
|
3174
3181
|
// literal number / percentage / angle
|
|
3175
|
-
|
|
3182
|
+
X.map((e) => ({ type: "literal", value: e.value }))
|
|
3176
3183
|
), q = (e) => {
|
|
3177
3184
|
const t = B(e).skip(m("a").opt()), n = d(
|
|
3178
|
-
I(
|
|
3179
|
-
|
|
3185
|
+
I(X.skip(Gr), X),
|
|
3186
|
+
X.map((o) => [o])
|
|
3180
3187
|
), r = I(
|
|
3181
|
-
|
|
3182
|
-
|
|
3188
|
+
X.skip(Vt),
|
|
3189
|
+
X.skip(Vt),
|
|
3183
3190
|
n
|
|
3184
3191
|
).trim(g).wrap(Zt, qt);
|
|
3185
3192
|
return t.next(r).map(([o, s, [i, a]]) => [o, s, i, a ?? new S(1)]);
|
|
@@ -3212,23 +3219,23 @@ const zs = D(/#[0-9a-fA-F]{3,8}/).map((e) => {
|
|
|
3212
3219
|
([e, t, n, r]) => G(new yt(e, t, n, r))
|
|
3213
3220
|
)
|
|
3214
3221
|
), Us = q("hsv").map(
|
|
3215
|
-
([e, t, n, r]) => G(new
|
|
3222
|
+
([e, t, n, r]) => G(new Ee(e, t, n, r))
|
|
3216
3223
|
), Ds = d(
|
|
3217
3224
|
rt("hwb", "hwb"),
|
|
3218
3225
|
q("hwb").map(
|
|
3219
|
-
([e, t, n, r]) => G(new
|
|
3226
|
+
([e, t, n, r]) => G(new Te(e, t, n, r))
|
|
3220
3227
|
)
|
|
3221
3228
|
), Vs = d(
|
|
3222
3229
|
rt("lab", "lab"),
|
|
3223
3230
|
q("lab").map(
|
|
3224
|
-
([e, t, n, r]) => G(new
|
|
3231
|
+
([e, t, n, r]) => G(new Xt(e, t, n, r))
|
|
3225
3232
|
)
|
|
3226
|
-
),
|
|
3233
|
+
), Ws = d(
|
|
3227
3234
|
rt("lch", "lch"),
|
|
3228
3235
|
q("lch").map(
|
|
3229
3236
|
([e, t, n, r]) => G(new Ae(e, t, n, r))
|
|
3230
3237
|
)
|
|
3231
|
-
),
|
|
3238
|
+
), Xs = d(
|
|
3232
3239
|
rt("oklab", "oklab"),
|
|
3233
3240
|
q("oklab").map(
|
|
3234
3241
|
([e, t, n, r]) => G(new Ht(e, t, n, r))
|
|
@@ -3302,14 +3309,14 @@ const zs = D(/#[0-9a-fA-F]{3,8}/).map((e) => {
|
|
|
3302
3309
|
), Js = m("color").next(
|
|
3303
3310
|
I(
|
|
3304
3311
|
Ks.skip(g),
|
|
3305
|
-
|
|
3306
|
-
|
|
3312
|
+
X.skip(g),
|
|
3313
|
+
X.skip(g),
|
|
3307
3314
|
d(
|
|
3308
3315
|
I(
|
|
3309
|
-
|
|
3310
|
-
|
|
3316
|
+
X.skip(Yt.trim(g)),
|
|
3317
|
+
X
|
|
3311
3318
|
),
|
|
3312
|
-
|
|
3319
|
+
X.map((e) => [e, void 0])
|
|
3313
3320
|
)
|
|
3314
3321
|
).trim(g).wrap(Zt, qt)
|
|
3315
3322
|
).map(([e, t, n, [r, o]]) => {
|
|
@@ -3343,14 +3350,14 @@ const zs = D(/#[0-9a-fA-F]{3,8}/).map((e) => {
|
|
|
3343
3350
|
Us,
|
|
3344
3351
|
Ds,
|
|
3345
3352
|
Vs,
|
|
3346
|
-
Xs,
|
|
3347
3353
|
Ws,
|
|
3354
|
+
Xs,
|
|
3348
3355
|
Hs,
|
|
3349
3356
|
js,
|
|
3350
3357
|
Qs
|
|
3351
3358
|
).trim(g), Ye = {
|
|
3352
3359
|
Value: Ur,
|
|
3353
|
-
colorValue:
|
|
3360
|
+
colorValue: X,
|
|
3354
3361
|
componentExpr: Mt,
|
|
3355
3362
|
sep: Vt,
|
|
3356
3363
|
alphaSep: Gr,
|
|
@@ -3362,17 +3369,17 @@ function Ia(e) {
|
|
|
3362
3369
|
const ti = d(...Pt.map(m)), ei = d(...Lt.map(m)), ni = d(...Ot.map(m)), ri = d(...zt.map(m)), oi = d(...er.map(m)), si = B(","), ii = B(" "), ai = d(si, ii).trim(g), Dr = I(et, ti).map(([e, t]) => {
|
|
3363
3370
|
const n = ["length"];
|
|
3364
3371
|
return tr.includes(t) ? n.push("relative") : Qn.includes(t) && n.push("absolute"), new S(e, t, n);
|
|
3365
|
-
}), Vr = I(et, ei).map(([e, t]) => new S(e, t, ["angle"])), Ze = I(et, ni).map(([e, t]) => new S(e, t, ["time"])), ci = x.lazy(() => d(qe, Ze)),
|
|
3372
|
+
}), Vr = I(et, ei).map(([e, t]) => new S(e, t, ["angle"])), Ze = I(et, ni).map(([e, t]) => new S(e, t, ["time"])), ci = x.lazy(() => d(qe, Ze)), Wr = I(et, ri).map(([e, t]) => new S(e, t, ["resolution"])), qe = d(
|
|
3366
3373
|
I(et, oi),
|
|
3367
3374
|
m("from").map(() => [0, "%"]),
|
|
3368
3375
|
m("to").map(() => [100, "%"])
|
|
3369
|
-
).map(([e, t]) => new S(e, t, ["percentage"])),
|
|
3376
|
+
).map(([e, t]) => new S(e, t, ["percentage"])), Xr = x.lazy(() => Ye.Value), Hr = B("/").trim(g).map(() => new S("/", "string")), jr = d(
|
|
3370
3377
|
Dr,
|
|
3371
3378
|
Vr,
|
|
3372
3379
|
Ze,
|
|
3373
|
-
Xr,
|
|
3374
|
-
qe,
|
|
3375
3380
|
Wr,
|
|
3381
|
+
qe,
|
|
3382
|
+
Xr,
|
|
3376
3383
|
Hr,
|
|
3377
3384
|
et.map((e) => new S(e)),
|
|
3378
3385
|
Pe.map(() => new S(NaN))
|
|
@@ -3381,9 +3388,9 @@ const ti = d(...Pt.map(m)), ei = d(...Lt.map(m)), ni = d(...Ot.map(m)), ri = d(.
|
|
|
3381
3388
|
Angle: Vr,
|
|
3382
3389
|
Time: Ze,
|
|
3383
3390
|
TimePercentage: ci,
|
|
3384
|
-
Resolution:
|
|
3391
|
+
Resolution: Wr,
|
|
3385
3392
|
Percentage: qe,
|
|
3386
|
-
Color:
|
|
3393
|
+
Color: Xr,
|
|
3387
3394
|
Slash: Hr,
|
|
3388
3395
|
Value: jr,
|
|
3389
3396
|
sep: ai
|
|
@@ -3476,12 +3483,12 @@ const kt = B("("), St = B(")"), Se = B(","), Zr = x.lazy(
|
|
|
3476
3483
|
), Ce = d(H.Value, Je, wi, qr).trim(g), va = {
|
|
3477
3484
|
Value: Ce,
|
|
3478
3485
|
Values: Ce.sepBy(g)
|
|
3479
|
-
}, ki =
|
|
3486
|
+
}, ki = Wt((e) => Bt(Ce, e)), Ba = Wt(
|
|
3480
3487
|
(e) => Bt(H.Percentage, String(e)).valueOf()
|
|
3481
|
-
), Na =
|
|
3488
|
+
), Na = Wt((e) => Bt(
|
|
3482
3489
|
H.Time.map((t) => t.unit === "ms" ? t.value : t.unit === "s" ? t.value * 1e3 : t.value),
|
|
3483
3490
|
e
|
|
3484
|
-
)), _a =
|
|
3491
|
+
)), _a = Wt(
|
|
3485
3492
|
(e, t) => (() => {
|
|
3486
3493
|
if (!t)
|
|
3487
3494
|
return e;
|
|
@@ -3592,7 +3599,7 @@ function yi(e) {
|
|
|
3592
3599
|
const tn = (e) => [e.r, e.g, e.b], Kt = (e, t, n) => new O(e, t, n), Ci = (e, t, n) => new yt(e, t, n), Kr = (e) => {
|
|
3593
3600
|
const t = xr(e);
|
|
3594
3601
|
return Ci(t.h, t.s, t.l);
|
|
3595
|
-
}, xi = 1,
|
|
3602
|
+
}, xi = 1, Ei = 1 / 6, Ti = 5, Ai = 15, Mi = 100, Ii = 7500, Ri = 200, pe = 360, vi = 50, Bi = 20, Ni = 3750, _i = 50, Pi = 100, Oi = 100, K = 0.2126, J = 0.7152, Q = 0.0722;
|
|
3596
3603
|
function Li(e, t = 0) {
|
|
3597
3604
|
const n = Math.sin(t * Math.PI / 180), r = Math.cos(t * Math.PI / 180), o = [
|
|
3598
3605
|
K + r * (1 - K) - n * K,
|
|
@@ -3607,14 +3614,14 @@ function Li(e, t = 0) {
|
|
|
3607
3614
|
];
|
|
3608
3615
|
return en(e, o);
|
|
3609
3616
|
}
|
|
3610
|
-
const yn = 0.393, Cn = 0.769, xn = 0.189,
|
|
3617
|
+
const yn = 0.393, Cn = 0.769, xn = 0.189, En = 0.349, Tn = 0.686, An = 0.168, Mn = 0.272, In = 0.534, Rn = 0.131;
|
|
3611
3618
|
function zi(e, t = 1) {
|
|
3612
3619
|
const n = [
|
|
3613
3620
|
yn + (1 - yn) * (1 - t),
|
|
3614
3621
|
Cn - Cn * (1 - t),
|
|
3615
3622
|
xn - xn * (1 - t),
|
|
3616
|
-
|
|
3617
|
-
|
|
3623
|
+
En - En * (1 - t),
|
|
3624
|
+
Tn + (1 - Tn) * (1 - t),
|
|
3618
3625
|
An - An * (1 - t),
|
|
3619
3626
|
Mn - Mn * (1 - t),
|
|
3620
3627
|
In - In * (1 - t),
|
|
@@ -3673,16 +3680,16 @@ function Qr(e, t, n, r, o, s, i) {
|
|
|
3673
3680
|
let a = null, c = 1 / 0;
|
|
3674
3681
|
const l = new Array(6), p = new Array(6), u = new Array(6);
|
|
3675
3682
|
for (let f = 0; f < o; f++) {
|
|
3676
|
-
const C = n / Math.pow(f + 1,
|
|
3683
|
+
const C = n / Math.pow(f + 1, Ei);
|
|
3677
3684
|
for (let w = 0; w < 6; w++)
|
|
3678
3685
|
l[w] = Math.random() > 0.5 ? 1 : -1, p[w] = r[w] + C * l[w], u[w] = r[w] - C * l[w];
|
|
3679
3686
|
const y = me(p, s, i) - me(u, s, i);
|
|
3680
3687
|
for (let w = 0; w < 6; w++) {
|
|
3681
|
-
const
|
|
3682
|
-
r[w] = Di(r[w] - A *
|
|
3688
|
+
const T = y / (2 * C) * l[w], A = t[w] / Math.pow(e + f + 1, xi);
|
|
3689
|
+
r[w] = Di(r[w] - A * T, w);
|
|
3683
3690
|
}
|
|
3684
|
-
const
|
|
3685
|
-
|
|
3691
|
+
const E = me(r, s, i);
|
|
3692
|
+
E < c && (a = [...r], c = E);
|
|
3686
3693
|
}
|
|
3687
3694
|
return { values: a ?? [...r], loss: c };
|
|
3688
3695
|
}
|
|
@@ -3694,13 +3701,13 @@ function Vi(e, t, n) {
|
|
|
3694
3701
|
const r = e.loss, o = 2, s = r + 1, i = [0.25 * s, 0.25 * s, s, 0.25 * s, 0.2 * s, 0.2 * s];
|
|
3695
3702
|
return Qr(r, i, o, e.values, 500, t, n);
|
|
3696
3703
|
}
|
|
3697
|
-
function
|
|
3704
|
+
function Wi(e, t) {
|
|
3698
3705
|
const n = [60, 180, 18e3, 600, 1.2, 1.2];
|
|
3699
3706
|
let r = { loss: 1 / 0, values: [] };
|
|
3700
3707
|
for (let o = 0; o < 3; o++)
|
|
3701
3708
|
if (r.loss > 25) {
|
|
3702
3709
|
const i = Qr(
|
|
3703
|
-
|
|
3710
|
+
Ti,
|
|
3704
3711
|
n,
|
|
3705
3712
|
Ai,
|
|
3706
3713
|
[
|
|
@@ -3719,8 +3726,8 @@ function Xi(e, t) {
|
|
|
3719
3726
|
}
|
|
3720
3727
|
return r;
|
|
3721
3728
|
}
|
|
3722
|
-
function
|
|
3723
|
-
const t = Kr(e), n = Vi(
|
|
3729
|
+
function Xi(e) {
|
|
3730
|
+
const t = Kr(e), n = Vi(Wi(e, t), e, t);
|
|
3724
3731
|
return {
|
|
3725
3732
|
values: n.values,
|
|
3726
3733
|
loss: n.loss,
|
|
@@ -3728,7 +3735,7 @@ function Wi(e) {
|
|
|
3728
3735
|
};
|
|
3729
3736
|
}
|
|
3730
3737
|
function Oa(e) {
|
|
3731
|
-
return
|
|
3738
|
+
return Xi(e);
|
|
3732
3739
|
}
|
|
3733
3740
|
function Hi(e) {
|
|
3734
3741
|
return e;
|
|
@@ -3796,10 +3803,10 @@ function Dn(e) {
|
|
|
3796
3803
|
function Vn(e) {
|
|
3797
3804
|
return 1 - Math.cos(e * Math.PI / 2);
|
|
3798
3805
|
}
|
|
3799
|
-
function
|
|
3806
|
+
function Wn(e) {
|
|
3800
3807
|
return Math.sin(e * Math.PI / 2);
|
|
3801
3808
|
}
|
|
3802
|
-
function
|
|
3809
|
+
function Xn(e) {
|
|
3803
3810
|
return -(Math.cos(Math.PI * e) - 1) / 2;
|
|
3804
3811
|
}
|
|
3805
3812
|
function Hn(e) {
|
|
@@ -3902,10 +3909,10 @@ const ut = {
|
|
|
3902
3909
|
"bounce-in-out-ease": Dn,
|
|
3903
3910
|
easeInSine: Vn,
|
|
3904
3911
|
"ease-in-sine": Vn,
|
|
3905
|
-
easeOutSine:
|
|
3906
|
-
"ease-out-sine":
|
|
3907
|
-
easeInOutSine:
|
|
3908
|
-
"ease-in-out-sine":
|
|
3912
|
+
easeOutSine: Wn,
|
|
3913
|
+
"ease-out-sine": Wn,
|
|
3914
|
+
easeInOutSine: Xn,
|
|
3915
|
+
"ease-in-out-sine": Xn,
|
|
3909
3916
|
easeInCirc: Hn,
|
|
3910
3917
|
"ease-in-circ": Hn,
|
|
3911
3918
|
easeOutCirc: jn,
|
|
@@ -3951,19 +3958,19 @@ export {
|
|
|
3951
3958
|
qr as CSSString,
|
|
3952
3959
|
H as CSSValueUnit,
|
|
3953
3960
|
va as CSSValues,
|
|
3954
|
-
|
|
3961
|
+
Es as CYLINDRICAL_HUE_COMPONENT,
|
|
3955
3962
|
V as Color,
|
|
3956
3963
|
Ca as DELTA_E_OK_JND,
|
|
3957
3964
|
Re as DisplayP3Color,
|
|
3958
3965
|
he as FRAME_RATE,
|
|
3959
3966
|
mt as FunctionValue,
|
|
3960
|
-
|
|
3967
|
+
Eo as GAMUT_SECTOR_COEFFICIENTS,
|
|
3961
3968
|
yt as HSLColor,
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3969
|
+
Ee as HSVColor,
|
|
3970
|
+
Tt as HUE_RANGE,
|
|
3971
|
+
Te as HWBColor,
|
|
3965
3972
|
nr as KelvinColor,
|
|
3966
|
-
|
|
3973
|
+
Xt as LABColor,
|
|
3967
3974
|
Ae as LCHColor,
|
|
3968
3975
|
Pt as LENGTH_UNITS,
|
|
3969
3976
|
j as LINEAR_SRGB_TO_LMS,
|
|
@@ -4036,14 +4043,14 @@ export {
|
|
|
4036
4043
|
On as easeInOutCubic,
|
|
4037
4044
|
Kn as easeInOutExpo,
|
|
4038
4045
|
Nn as easeInOutQuad,
|
|
4039
|
-
|
|
4046
|
+
Xn as easeInOutSine,
|
|
4040
4047
|
vn as easeInQuad,
|
|
4041
4048
|
Vn as easeInSine,
|
|
4042
4049
|
jn as easeOutCirc,
|
|
4043
4050
|
Pn as easeOutCubic,
|
|
4044
4051
|
qn as easeOutExpo,
|
|
4045
4052
|
Bn as easeOutQuad,
|
|
4046
|
-
|
|
4053
|
+
Wn as easeOutSine,
|
|
4047
4054
|
ko as fail,
|
|
4048
4055
|
Io as findCusp,
|
|
4049
4056
|
Ro as findGamutIntersection,
|
|
@@ -4052,7 +4059,7 @@ export {
|
|
|
4052
4059
|
No as gamutMapOKLab,
|
|
4053
4060
|
Po as gamutMapSRGB,
|
|
4054
4061
|
_a as getComputedValue,
|
|
4055
|
-
|
|
4062
|
+
Ea as getFormattedColorSpaceRange,
|
|
4056
4063
|
Oo as hex2rgb,
|
|
4057
4064
|
Cr as hsl2hsv,
|
|
4058
4065
|
$o as hsl2hwb,
|
|
@@ -4066,7 +4073,7 @@ export {
|
|
|
4066
4073
|
bo as identifier,
|
|
4067
4074
|
go as integer,
|
|
4068
4075
|
jt as interpBezier,
|
|
4069
|
-
|
|
4076
|
+
Ts as interpolateHue,
|
|
4070
4077
|
nt as invertMat3,
|
|
4071
4078
|
ha as isCSSStyleName,
|
|
4072
4079
|
be as isColorUnit,
|
|
@@ -4090,7 +4097,7 @@ export {
|
|
|
4090
4097
|
cs as linearToRec2020,
|
|
4091
4098
|
Rr as linearToSrgb,
|
|
4092
4099
|
ka as logerp,
|
|
4093
|
-
|
|
4100
|
+
Wt as memoize,
|
|
4094
4101
|
As as mixColors,
|
|
4095
4102
|
ga as multiplyMat3,
|
|
4096
4103
|
Pe as none,
|
|
@@ -4103,7 +4110,7 @@ export {
|
|
|
4103
4110
|
et as number,
|
|
4104
4111
|
Yo as oklab2lab,
|
|
4105
4112
|
vr as oklab2oklch,
|
|
4106
|
-
|
|
4113
|
+
We as oklab2xyz,
|
|
4107
4114
|
ze as oklabToLinearSRGB,
|
|
4108
4115
|
Aa as oklch2lab,
|
|
4109
4116
|
Br as oklch2oklab,
|
|
@@ -4120,7 +4127,7 @@ export {
|
|
|
4120
4127
|
ue as rec2020ToLinear,
|
|
4121
4128
|
ia as requestAnimationFrame,
|
|
4122
4129
|
Oa as rgb2ColorFilter,
|
|
4123
|
-
|
|
4130
|
+
Ta as rgb2hex,
|
|
4124
4131
|
xr as rgb2hsl,
|
|
4125
4132
|
Lo as rgb2kelvin,
|
|
4126
4133
|
De as rgb2xyz,
|
|
@@ -4151,7 +4158,7 @@ export {
|
|
|
4151
4158
|
$e as xyz2lab,
|
|
4152
4159
|
es as xyz2lch,
|
|
4153
4160
|
fs as xyz2linearSrgb,
|
|
4154
|
-
|
|
4161
|
+
Xe as xyz2oklab,
|
|
4155
4162
|
rs as xyz2oklch,
|
|
4156
4163
|
Ss as xyz2proPhoto,
|
|
4157
4164
|
Cs as xyz2rec2020,
|