UNPKG

colorjs.io

Version:

Let’s get serious about color

1 lines 102 kB
var e,t,r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={};function o(){if(t)return e;t=1;var n=function(e){return e&&e.Math===Math&&e};return e=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r&&r)||n("object"==typeof r&&r)||function(){return this}()||Function("return this")()}var a,i,u,s,c,l,f,h,p={};function d(){return i?a:(i=1,a=function(e){try{return!!e()}catch(e){return!0}})}function m(){if(s)return u;s=1;var e=d();return u=!e((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}function g(){if(l)return c;l=1;var e=d();return c=!e((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))}function v(){if(h)return f;h=1;var e=g(),t=Function.prototype.call;return f=e?t.bind(t):function(){return t.apply(t,arguments)},f}var b,y,w,M,S,R,C,E,O,j,_,k,B,x,I,P,A,T,z,L,D,$,H,N,q,F,W,G,X,Y,Z,J,U,V,K,Q,ee,te,re,ne,oe,ae={};function ie(){return w?y:(w=1,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function ue(){if(S)return M;S=1;var e=g(),t=Function.prototype,r=t.call,n=e&&t.bind.bind(r,r);return M=e?n:function(e){return function(){return r.apply(e,arguments)}},M}function se(){if(C)return R;C=1;var e=ue(),t=e({}.toString),r=e("".slice);return R=function(e){return r(t(e),8,-1)}}function ce(){return _?j:(_=1,j=function(e){return null==e})}function le(){if(B)return k;B=1;var e=ce(),t=TypeError;return k=function(r){if(e(r))throw new t("Can't call method on "+r);return r}}function fe(){if(I)return x;I=1;var e=function(){if(O)return E;O=1;var e=ue(),t=d(),r=se(),n=Object,o=e("".split);return E=t((function(){return!n("z").propertyIsEnumerable(0)}))?function(e){return"String"===r(e)?o(e,""):n(e)}:n}(),t=le();return x=function(r){return e(t(r))}}function he(){if(A)return P;A=1;var e="object"==typeof document&&document.all;return P=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function pe(){if(z)return T;z=1;var e=he();return T=function(t){return"object"==typeof t?null!==t:e(t)}}function de(){if(D)return L;D=1;var e=o(),t=he();return L=function(r,n){return arguments.length<2?(o=e[r],t(o)?o:void 0):e[r]&&e[r][n];var o},L}function me(){if(H)return $;H=1;var e=ue();return $=e({}.isPrototypeOf)}function ge(){if(W)return F;W=1;var e,t,r=o(),n=function(){if(q)return N;q=1;var e=o().navigator,t=e&&e.userAgent;return N=t?String(t):""}(),a=r.process,i=r.Deno,u=a&&a.versions||i&&i.version,s=u&&u.v8;return s&&(t=(e=s.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&n&&(!(e=n.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=n.match(/Chrome\/(\d+)/))&&(t=+e[1]),F=t}function ve(){if(X)return G;X=1;var e=ge(),t=d(),r=o().String;return G=!!Object.getOwnPropertySymbols&&!t((function(){var t=Symbol("symbol detection");return!r(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41}))}function be(){if(Z)return Y;Z=1;var e=ve();return Y=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function ye(){if(U)return J;U=1;var e=de(),t=he(),r=me(),n=be(),o=Object;return J=n?function(e){return"symbol"==typeof e}:function(n){var a=e("Symbol");return t(a)&&r(a.prototype,o(n))}}function we(){if(K)return V;K=1;var e=String;return V=function(t){try{return e(t)}catch(e){return"Object"}}}function Me(){if(ee)return Q;ee=1;var e=he(),t=we(),r=TypeError;return Q=function(n){if(e(n))return n;throw new r(t(n)+" is not a function")}}function Se(){if(re)return te;re=1;var e=Me(),t=ce();return te=function(r,n){var o=r[n];return t(o)?void 0:e(o)}}function Re(){if(oe)return ne;oe=1;var e=v(),t=he(),r=pe(),n=TypeError;return ne=function(o,a){var i,u;if("string"===a&&t(i=o.toString)&&!r(u=e(i,o)))return u;if(t(i=o.valueOf)&&!r(u=e(i,o)))return u;if("string"!==a&&t(i=o.toString)&&!r(u=e(i,o)))return u;throw new n("Can't convert object to primitive value")}}var Ce,Ee,Oe,je,_e,ke,Be,xe,Ie,Pe,Ae,Te,ze,Le,De,$e,He,Ne,qe,Fe,We,Ge,Xe,Ye,Ze={exports:{}};function Je(){return Ee?Ce:(Ee=1,Ce=!1)}function Ue(){if(je)return Oe;je=1;var e=o(),t=Object.defineProperty;return Oe=function(r,n){try{t(e,r,{value:n,configurable:!0,writable:!0})}catch(t){e[r]=n}return n}}function Ve(){if(_e)return Ze.exports;_e=1;var e=Je(),t=o(),r=Ue(),n="__core-js_shared__",a=Ze.exports=t[n]||r(n,{});return(a.versions||(a.versions=[])).push({version:"3.39.0",mode:e?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"}),Ze.exports}function Ke(){if(Be)return ke;Be=1;var e=Ve();return ke=function(t,r){return e[t]||(e[t]=r||{})}}function Qe(){if(Ie)return xe;Ie=1;var e=le(),t=Object;return xe=function(r){return t(e(r))}}function et(){if(Ae)return Pe;Ae=1;var e=ue(),t=Qe(),r=e({}.hasOwnProperty);return Pe=Object.hasOwn||function(e,n){return r(t(e),n)}}function tt(){if(ze)return Te;ze=1;var e=ue(),t=0,r=Math.random(),n=e(1..toString);return Te=function(e){return"Symbol("+(void 0===e?"":e)+")_"+n(++t+r,36)}}function rt(){if(De)return Le;De=1;var e=o(),t=Ke(),r=et(),n=tt(),a=ve(),i=be(),u=e.Symbol,s=t("wks"),c=i?u.for||u:u&&u.withoutSetter||n;return Le=function(e){return r(s,e)||(s[e]=a&&r(u,e)?u[e]:c("Symbol."+e)),s[e]}}function nt(){if(He)return $e;He=1;var e=v(),t=pe(),r=ye(),n=Se(),o=Re(),a=rt(),i=TypeError,u=a("toPrimitive");return $e=function(a,s){if(!t(a)||r(a))return a;var c,l=n(a,u);if(l){if(void 0===s&&(s="default"),c=e(l,a,s),!t(c)||r(c))return c;throw new i("Can't convert object to primitive value")}return void 0===s&&(s="number"),o(a,s)}}function ot(){if(qe)return Ne;qe=1;var e=nt(),t=ye();return Ne=function(r){var n=e(r,"string");return t(n)?n:n+""}}function at(){if(We)return Fe;We=1;var e=o(),t=pe(),r=e.document,n=t(r)&&t(r.createElement);return Fe=function(e){return n?r.createElement(e):{}}}function it(){if(Xe)return Ge;Xe=1;var e=m(),t=d(),r=at();return Ge=!e&&!t((function(){return 7!==Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}))}function ut(){if(Ye)return p;Ye=1;var e=m(),t=v(),r=function(){if(b)return ae;b=1;var e={}.propertyIsEnumerable,t=Object.getOwnPropertyDescriptor,r=t&&!e.call({1:2},1);return ae.f=r?function(e){var r=t(this,e);return!!r&&r.enumerable}:e,ae}(),n=ie(),o=fe(),a=ot(),i=et(),u=it(),s=Object.getOwnPropertyDescriptor;return p.f=e?s:function(e,c){if(e=o(e),c=a(c),u)try{return s(e,c)}catch(e){}if(i(e,c))return n(!t(r.f,e,c),e[c])},p}var st,ct,lt,ft,ht,pt,dt,mt={};function gt(){if(ct)return st;ct=1;var e=m(),t=d();return st=e&&t((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}function vt(){if(ft)return lt;ft=1;var e=pe(),t=String,r=TypeError;return lt=function(n){if(e(n))return n;throw new r(t(n)+" is not an object")}}function bt(){if(ht)return mt;ht=1;var e=m(),t=it(),r=gt(),n=vt(),o=ot(),a=TypeError,i=Object.defineProperty,u=Object.getOwnPropertyDescriptor,s="enumerable",c="configurable",l="writable";return mt.f=e?r?function(e,t,r){if(n(e),t=o(t),n(r),"function"==typeof e&&"prototype"===t&&"value"in r&&l in r&&!r[l]){var a=u(e,t);a&&a[l]&&(e[t]=r.value,r={configurable:c in r?r[c]:a[c],enumerable:s in r?r[s]:a[s],writable:!1})}return i(e,t,r)}:i:function(e,r,u){if(n(e),r=o(r),n(u),t)try{return i(e,r,u)}catch(e){}if("get"in u||"set"in u)throw new a("Accessors not supported");return"value"in u&&(e[r]=u.value),e},mt}function yt(){if(dt)return pt;dt=1;var e=m(),t=bt(),r=ie();return pt=e?function(e,n,o){return t.f(e,n,r(1,o))}:function(e,t,r){return e[t]=r,e}}var wt,Mt,St,Rt,Ct,Et,Ot,jt,_t,kt,Bt,xt,It,Pt,At,Tt={exports:{}};function zt(){if(Rt)return St;Rt=1;var e=ue(),t=he(),r=Ve(),n=e(Function.toString);return t(r.inspectSource)||(r.inspectSource=function(e){return n(e)}),St=r.inspectSource}function Lt(){if(jt)return Ot;jt=1;var e=Ke(),t=tt(),r=e("keys");return Ot=function(e){return r[e]||(r[e]=t(e))}}function Dt(){return kt?_t:(kt=1,_t={})}function $t(){if(xt)return Bt;xt=1;var e,t,r,n=function(){if(Et)return Ct;Et=1;var e=o(),t=he(),r=e.WeakMap;return Ct=t(r)&&/native code/.test(String(r))}(),a=o(),i=pe(),u=yt(),s=et(),c=Ve(),l=Lt(),f=Dt(),h="Object already initialized",p=a.TypeError,d=a.WeakMap;if(n||c.state){var m=c.state||(c.state=new d);m.get=m.get,m.has=m.has,m.set=m.set,e=function(e,t){if(m.has(e))throw new p(h);return t.facade=e,m.set(e,t),t},t=function(e){return m.get(e)||{}},r=function(e){return m.has(e)}}else{var g=l("state");f[g]=!0,e=function(e,t){if(s(e,g))throw new p(h);return t.facade=e,u(e,g,t),t},t=function(e){return s(e,g)?e[g]:{}},r=function(e){return s(e,g)}}return Bt={set:e,get:t,has:r,enforce:function(n){return r(n)?t(n):e(n,{})},getterFor:function(e){return function(r){var n;if(!i(r)||(n=t(r)).type!==e)throw new p("Incompatible receiver, "+e+" required");return n}}}}function Ht(){if(It)return Tt.exports;It=1;var e=ue(),t=d(),r=he(),n=et(),o=m(),a=function(){if(Mt)return wt;Mt=1;var e=m(),t=et(),r=Function.prototype,n=e&&Object.getOwnPropertyDescriptor,o=t(r,"name"),a=o&&"something"===function(){}.name,i=o&&(!e||e&&n(r,"name").configurable);return wt={EXISTS:o,PROPER:a,CONFIGURABLE:i}}().CONFIGURABLE,i=zt(),u=$t(),s=u.enforce,c=u.get,l=String,f=Object.defineProperty,h=e("".slice),p=e("".replace),g=e([].join),v=o&&!t((function(){return 8!==f((function(){}),"length",{value:8}).length})),b=String(String).split("String"),y=Tt.exports=function(e,t,r){"Symbol("===h(l(t),0,7)&&(t="["+p(l(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!n(e,"name")||a&&e.name!==t)&&(o?f(e,"name",{value:t,configurable:!0}):e.name=t),v&&r&&n(r,"arity")&&e.length!==r.arity&&f(e,"length",{value:r.arity});try{r&&n(r,"constructor")&&r.constructor?o&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=s(e);return n(i,"source")||(i.source=g(b,"string"==typeof t?t:"")),e};return Function.prototype.toString=y((function(){return r(this)&&c(this).source||i(this)}),"toString"),Tt.exports}function Nt(){if(At)return Pt;At=1;var e=he(),t=bt(),r=Ht(),n=Ue();return Pt=function(o,a,i,u){u||(u={});var s=u.enumerable,c=void 0!==u.name?u.name:a;if(e(i)&&r(i,c,u),u.global)s?o[a]=i:n(a,i);else{try{u.unsafe?o[a]&&(s=!0):delete o[a]}catch(e){}s?o[a]=i:t.f(o,a,{value:i,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return o}}var qt,Ft,Wt,Gt,Xt,Yt,Zt,Jt,Ut,Vt,Kt,Qt,er,tr,rr,nr,or,ar={};function ir(){if(Gt)return Wt;Gt=1;var e=function(){if(Ft)return qt;Ft=1;var e=Math.ceil,t=Math.floor;return qt=Math.trunc||function(r){var n=+r;return(n>0?t:e)(n)},qt}();return Wt=function(t){var r=+t;return r!=r||0===r?0:e(r)}}function ur(){if(Yt)return Xt;Yt=1;var e=ir(),t=Math.max,r=Math.min;return Xt=function(n,o){var a=e(n);return a<0?t(a+o,0):r(a,o)}}function sr(){if(Jt)return Zt;Jt=1;var e=ir(),t=Math.min;return Zt=function(r){var n=e(r);return n>0?t(n,9007199254740991):0}}function cr(){if(Vt)return Ut;Vt=1;var e=sr();return Ut=function(t){return e(t.length)}}function lr(){if(tr)return er;tr=1;var e=ue(),t=et(),r=fe(),n=function(){if(Qt)return Kt;Qt=1;var e=fe(),t=ur(),r=cr(),n=function(n){return function(o,a,i){var u=e(o),s=r(u);if(0===s)return!n&&-1;var c,l=t(i,s);if(n&&a!=a){for(;s>l;)if((c=u[l++])!=c)return!0}else for(;s>l;l++)if((n||l in u)&&u[l]===a)return n||l||0;return!n&&-1}};return Kt={includes:n(!0),indexOf:n(!1)}}().indexOf,o=Dt(),a=e([].push);return er=function(e,i){var u,s=r(e),c=0,l=[];for(u in s)!t(o,u)&&t(s,u)&&a(l,u);for(;i.length>c;)t(s,u=i[c++])&&(~n(l,u)||a(l,u));return l}}function fr(){return nr?rr:(nr=1,rr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}var hr,pr,dr,mr,gr,vr,br,yr,wr,Mr,Sr,Rr={};function Cr(){if(dr)return pr;dr=1;var e=de(),t=ue(),r=function(){if(or)return ar;or=1;var e=lr(),t=fr().concat("length","prototype");return ar.f=Object.getOwnPropertyNames||function(r){return e(r,t)},ar}(),n=(hr||(hr=1,Rr.f=Object.getOwnPropertySymbols),Rr),o=vt(),a=t([].concat);return pr=e("Reflect","ownKeys")||function(e){var t=r.f(o(e)),i=n.f;return i?a(t,i(e)):t}}function Er(){if(gr)return mr;gr=1;var e=et(),t=Cr(),r=ut(),n=bt();return mr=function(o,a,i){for(var u=t(a),s=n.f,c=r.f,l=0;l<u.length;l++){var f=u[l];e(o,f)||i&&e(i,f)||s(o,f,c(a,f))}}}function Or(){if(wr)return yr;wr=1;var e=o(),t=ut().f,r=yt(),n=Nt(),a=Ue(),i=Er(),u=function(){if(br)return vr;br=1;var e=d(),t=he(),r=/#|\.prototype\./,n=function(r,n){var s=a[o(r)];return s===u||s!==i&&(t(n)?e(n):!!n)},o=n.normalize=function(e){return String(e).replace(r,".").toLowerCase()},a=n.data={},i=n.NATIVE="N",u=n.POLYFILL="P";return vr=n}();return yr=function(o,s){var c,l,f,h,p,d=o.target,m=o.global,g=o.stat;if(c=m?e:g?e[d]||a(d,{}):e[d]&&e[d].prototype)for(l in s){if(h=s[l],f=o.dontCallGetSet?(p=t(c,l))&&p.value:c[l],!u(m?l:d+(g?".":"#")+l,o.forced)&&void 0!==f){if(typeof h==typeof f)continue;i(h,f)}(o.sham||f&&f.sham)&&r(h,"sham",!0),n(c,l,h,o)}}}function jr(){return Sr?Mr:(Sr=1,Mr=function(e){return{iterator:e,next:e.next,done:!1}})}var _r,kr,Br,xr,Ir,Pr,Ar,Tr,zr,Lr,Dr,$r,Hr,Nr,qr,Fr,Wr,Gr,Xr,Yr,Zr,Jr,Ur,Vr,Kr,Qr,en,tn={};function rn(){if(kr)return _r;kr=1;var e=lr(),t=fr();return _r=Object.keys||function(r){return e(r,t)}}function nn(){if(Ir)return xr;Ir=1;var e=de();return xr=e("document","documentElement")}function on(){if(Ar)return Pr;Ar=1;var e,t=vt(),r=function(){if(Br)return tn;Br=1;var e=m(),t=gt(),r=bt(),n=vt(),o=fe(),a=rn();return tn.f=e&&!t?Object.defineProperties:function(e,t){n(e);for(var i,u=o(t),s=a(t),c=s.length,l=0;c>l;)r.f(e,i=s[l++],u[i]);return e},tn}(),n=fr(),o=Dt(),a=nn(),i=at(),u=Lt(),s="prototype",c="script",l=u("IE_PROTO"),f=function(){},h=function(e){return"<"+c+">"+e+"</"+c+">"},p=function(e){e.write(h("")),e.close();var t=e.parentWindow.Object;return e=null,t},d=function(){try{e=new ActiveXObject("htmlfile")}catch(e){}var t,r,o;d="undefined"!=typeof document?document.domain&&e?p(e):(r=i("iframe"),o="java"+c+":",r.style.display="none",a.appendChild(r),r.src=String(o),(t=r.contentWindow.document).open(),t.write(h("document.F=Object")),t.close(),t.F):p(e);for(var u=n.length;u--;)delete d[s][n[u]];return d()};return o[l]=!0,Pr=Object.create||function(e,n){var o;return null!==e?(f[s]=t(e),o=new f,f[s]=null,o[l]=e):o=d(),void 0===n?o:r.f(o,n)}}function an(){if(zr)return Tr;zr=1;var e=Nt();return Tr=function(t,r,n){for(var o in r)e(t,o,r[o],n);return t}}function un(){if(Hr)return $r;Hr=1;var e=et(),t=he(),r=Qe(),n=Lt(),o=function(){if(Dr)return Lr;Dr=1;var e=d();return Lr=!e((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))}(),a=n("IE_PROTO"),i=Object,u=i.prototype;return $r=o?i.getPrototypeOf:function(n){var o=r(n);if(e(o,a))return o[a];var s=o.constructor;return t(s)&&o instanceof s?s.prototype:o instanceof i?u:null}}function sn(){if(qr)return Nr;qr=1;var e,t,r,n=d(),o=he(),a=pe(),i=on(),u=un(),s=Nt(),c=rt(),l=Je(),f=c("iterator"),h=!1;return[].keys&&("next"in(r=[].keys())?(t=u(u(r)))!==Object.prototype&&(e=t):h=!0),!a(e)||n((function(){var t={};return e[f].call(t)!==t}))?e={}:l&&(e=i(e)),o(e[f])||s(e,f,(function(){return this})),Nr={IteratorPrototype:e,BUGGY_SAFARI_ITERATORS:h}}function cn(){return Wr?Fr:(Wr=1,Fr=function(e,t){return{value:e,done:t}})}function ln(){if(Xr)return Gr;Xr=1;var e=v(),t=vt(),r=Se();return Gr=function(n,o,a){var i,u;t(n);try{if(!(i=r(n,"return"))){if("throw"===o)throw a;return a}i=e(i,n)}catch(e){u=!0,i=e}if("throw"===o)throw a;if(u)throw i;return t(i),a}}function fn(){if(Ur)return Jr;Ur=1;var e=vt(),t=ln();return Jr=function(r,n,o,a){try{return a?n(e(o)[0],o[1]):n(o)}catch(e){t(r,"throw",e)}}}function hn(){if(Kr)return Vr;Kr=1;var e=v(),t=Me(),r=vt(),n=jr(),o=function(){if(Zr)return Yr;Zr=1;var e=v(),t=on(),r=yt(),n=an(),o=rt(),a=$t(),i=Se(),u=sn().IteratorPrototype,s=cn(),c=ln(),l=o("toStringTag"),f="IteratorHelper",h="WrapForValidIterator",p=a.set,d=function(r){var o=a.getterFor(r?h:f);return n(t(u),{next:function(){var e=o(this);if(r)return e.nextHandler();try{var t=e.done?void 0:e.nextHandler();return s(t,e.done)}catch(t){throw e.done=!0,t}},return:function(){var t=o(this),n=t.iterator;if(t.done=!0,r){var a=i(n,"return");return a?e(a,n):s(void 0,!0)}if(t.inner)try{c(t.inner.iterator,"normal")}catch(e){return c(n,"throw",e)}return n&&c(n,"normal"),s(void 0,!0)}})},m=d(!0),g=d(!1);return r(g,l,"Iterator Helper"),Yr=function(e,t){var r=function(r,n){n?(n.iterator=r.iterator,n.next=r.next):n=r,n.type=t?h:f,n.nextHandler=e,n.counter=0,n.done=!1,p(this,n)};return r.prototype=t?m:g,r}}(),a=fn(),i=o((function(){var t=this.iterator,n=r(e(this.next,t));if(!(this.done=!!n.done))return a(t,this.mapper,[n.value,this.counter++],!0)}));return Vr=function(e){return r(this),t(e),new i(n(this),{mapper:e})}}function pn(e,t){let r,n,o=e.length,a=!1,i=!1;Array.isArray(e[0])?r=e:(r=[e],o=r.length,a=!0),Array.isArray(t[0])?n=t:(n=t.length>0?t.map((e=>[e])):[[]],i=!0);let u=n[0].length,s=n[0].map(((e,t)=>n.map((e=>e[t])))),c=r.map((e=>s.map((t=>{let r=0;if(!Array.isArray(e)){for(let n of t)r+=e*n;return r}for(let n=0;n<e.length;n++)r+=e[n]*(t[n]||0);return r}))));return 1===o&&a&&(c=c[0]),1===u&&i?1===o&&a?c[0]:c.map((e=>e[0])):c}function dn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function mn(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0];const n=dn(e,t[0]),o=dn(e,t[1]),a=dn(e,t[2]);return r[0]=n,r[1]=o,r[2]=a,r}function gn(e){return"string"===vn(e)}function vn(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function bn(e,t){let{precision:r=16,unit:n}=t;return yn(e)?"none":(e=+Mn(e,r))+(null!=n?n:"")}function yn(e){return null===e}function wn(e){return yn(e)?0:e}function Mn(e,t){if(0===e)return 0;let r=~~e,n=0;r&&t&&(n=1+~~Math.log10(Math.abs(r)));const o=10**(t-n);return Math.floor(e*o+.5)/o}function Sn(e,t,r){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*r}function Rn(e,t,r){return(r-e)/(t-e)}function Cn(e,t,r){return!e||!t||e===t||e[0]===t[0]&&e[1]===t[1]||isNaN(r)||null===r?r:Sn(t[0],t[1],Rn(e[0],e[1],r))}function En(e,t,r){return Math.max(Math.min(r,t),e)}function On(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function jn(e,t){return On(Math.abs(e)**t,e)}function _n(e,t){return 0===t?0:e/t}function kn(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length;for(;r<n;){const o=r+n>>1;e[o]<t?r=o+1:n=o}return r}function Bn(e,t){if(e instanceof t)return!0;const r=t.name;for(;e;){var n;const t=Object.getPrototypeOf(e),o=null==t||null===(n=t.constructor)||void 0===n?void 0:n.name;if(o===r)return!0;if(!o||"Object"===o)return!1;e=t}return!1}en||(en=1,function(){if(Qr)return n;Qr=1;var e=Or(),t=hn();e({target:"Iterator",proto:!0,real:!0,forced:Je()},{map:t})}());var xn,In,Pn,An,Tn,zn,Ln,Dn,$n=Object.freeze({__proto__:null,bisectLeft:kn,clamp:En,copySign:On,interpolate:Sn,interpolateInv:Rn,isInstance:Bn,isNone:yn,isString:gn,mapRange:Cn,multiplyMatrices:pn,multiply_v3_m3x3:mn,serializeNumber:bn,skipNone:wn,spow:jn,toPrecision:Mn,type:vn,zdiv:_n}),Hn={};function Nn(){if(In)return xn;In=1;var e=me(),t=TypeError;return xn=function(r,n){if(e(n,r))return r;throw new t("Incorrect invocation")}}function qn(){if(An)return Pn;An=1;var e=Ht(),t=bt();return Pn=function(r,n,o){return o.get&&e(o.get,n,{getter:!0}),o.set&&e(o.set,n,{setter:!0}),t.f(r,n,o)}}function Fn(){if(zn)return Tn;zn=1;var e=m(),t=bt(),r=ie();return Tn=function(n,o,a){e?t.f(n,o,r(0,a)):n[o]=a}}Dn||(Dn=1,function(){if(Ln)return Hn;Ln=1;var e=Or(),t=o(),r=Nn(),n=vt(),a=he(),i=un(),u=qn(),s=Fn(),c=d(),l=et(),f=rt(),h=sn().IteratorPrototype,p=m(),g=Je(),v="constructor",b="Iterator",y=f("toStringTag"),w=TypeError,M=t[b],S=g||!a(M)||M.prototype!==h||!c((function(){M({})})),R=function(){if(r(this,h),i(this)===h)throw new w("Abstract class Iterator not directly constructable")},C=function(e,t){p?u(h,e,{configurable:!0,get:function(){return t},set:function(t){if(n(this),this===h)throw new w("You can't redefine this property");l(this,e)?this[e]=t:s(this,e,t)}}):h[e]=t};l(h,y)||C(y,b),!S&&l(h,v)&&h[v]!==Object||C(v,R),R.prototype=h,e({global:!0,constructor:!0,forced:S},{Iterator:R})}());var Wn,Gn,Xn,Yn,Zn,Jn,Un,Vn,Kn,Qn,eo,to,ro,no,oo,ao,io,uo,so,co,lo={};function fo(){if(Yn)return Xn;Yn=1;var e=function(){if(Gn)return Wn;Gn=1;var e=se(),t=ue();return Wn=function(r){if("Function"===e(r))return t(r)}}(),t=Me(),r=g(),n=e(e.bind);return Xn=function(e,o){return t(e),void 0===o?e:r?n(e,o):function(){return e.apply(o,arguments)}},Xn}function ho(){return Jn?Zn:(Jn=1,Zn={})}function po(){if(Vn)return Un;Vn=1;var e=rt(),t=ho(),r=e("iterator"),n=Array.prototype;return Un=function(e){return void 0!==e&&(t.Array===e||n[r]===e)}}function mo(){if(to)return eo;to=1;var e=function(){if(Qn)return Kn;Qn=1;var e={};return e[rt()("toStringTag")]="z",Kn="[object z]"===String(e)}(),t=he(),r=se(),n=rt()("toStringTag"),o=Object,a="Arguments"===r(function(){return arguments}());return eo=e?r:function(e){var i,u,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(u=function(e,t){try{return e[t]}catch(e){}}(i=o(e),n))?u:a?r(i):"Object"===(s=r(i))&&t(i.callee)?"Arguments":s}}function go(){if(no)return ro;no=1;var e=mo(),t=Se(),r=ce(),n=ho(),o=rt()("iterator");return ro=function(a){if(!r(a))return t(a,o)||t(a,"@@iterator")||n[e(a)]}}function vo(){if(ao)return oo;ao=1;var e=v(),t=Me(),r=vt(),n=we(),o=go(),a=TypeError;return oo=function(i,u){var s=arguments.length<2?o(i):u;if(t(s))return r(e(s,i));throw new a(n(i)+" is not iterable")},oo}function bo(){if(uo)return io;uo=1;var e=fo(),t=v(),r=vt(),n=we(),o=po(),a=cr(),i=me(),u=vo(),s=go(),c=ln(),l=TypeError,f=function(e,t){this.stopped=e,this.result=t},h=f.prototype;return io=function(p,d,m){var g,v,b,y,w,M,S,R=m&&m.that,C=!(!m||!m.AS_ENTRIES),E=!(!m||!m.IS_RECORD),O=!(!m||!m.IS_ITERATOR),j=!(!m||!m.INTERRUPTED),_=e(d,R),k=function(e){return g&&c(g,"normal",e),new f(!0,e)},B=function(e){return C?(r(e),j?_(e[0],e[1],k):_(e[0],e[1])):j?_(e,k):_(e)};if(E)g=p.iterator;else if(O)g=p;else{if(!(v=s(p)))throw new l(n(p)+" is not iterable");if(o(v)){for(b=0,y=a(p);y>b;b++)if((w=B(p[b]))&&i(h,w))return w;return new f(!1)}g=u(p,v)}for(M=E?p.next:g.next;!(S=t(M,g)).done;){try{w=B(S.value)}catch(e){c(g,"throw",e)}if("object"==typeof w&&w&&i(h,w))return w}return new f(!1)}}co||(co=1,function(){if(so)return lo;so=1;var e=Or(),t=bo(),r=Me(),n=vt(),o=jr();e({target:"Iterator",proto:!0,real:!0},{forEach:function(e){n(this),r(e);var a=o(this),i=0;t(a,(function(t){e(t,i++)}),{IS_RECORD:!0})}})}());const yo=new class{add(e,t,r){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)}),this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}};var wo,Mo,So,Ro,Co,Eo,Oo,jo,_o,ko,Bo,xo,Io,Po,Ao,To,zo,Lo,Do,$o,Ho,No,qo,Fo,Wo,Go,Xo,Yo,Zo,Jo,Uo={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==(null===globalThis||void 0===globalThis||null===(wo=globalThis.process)||void 0===wo||null===(wo=wo.env)||void 0===wo||null===(wo=wo.NODE_ENV)||void 0===wo?void 0:wo.toLowerCase()),warn:function(e){var t,r;this.verbose&&(null===globalThis||void 0===globalThis||null===(t=globalThis.console)||void 0===t||null===(r=t.warn)||void 0===r||r.call(t,e))}},Vo={};function Ko(){if(Co)return Ro;Co=1;var e=ue(),t=Me();return Ro=function(r,n,o){try{return e(t(Object.getOwnPropertyDescriptor(r,n)[o]))}catch(e){}}}function Qo(){if(Oo)return Eo;Oo=1;var e=pe();return Eo=function(t){return e(t)||null===t}}function ea(){if(_o)return jo;_o=1;var e=Qo(),t=String,r=TypeError;return jo=function(n){if(e(n))return n;throw new r("Can't set "+t(n)+" as a prototype")}}function ta(){if(Bo)return ko;Bo=1;var e=Ko(),t=pe(),r=le(),n=ea();return ko=Object.setPrototypeOf||("__proto__"in{}?function(){var o,a=!1,i={};try{(o=e(Object.prototype,"__proto__","set"))(i,[]),a=i instanceof Array}catch(e){}return function(e,i){return r(e),n(i),t(e)?(a?o(e,i):e.__proto__=i,e):e}}():void 0)}function ra(){if(Io)return xo;Io=1;var e=bt().f;return xo=function(t,r,n){n in t||e(t,n,{configurable:!0,get:function(){return r[n]},set:function(e){r[n]=e}})}}function na(){if(Ao)return Po;Ao=1;var e=he(),t=pe(),r=ta();return Po=function(n,o,a){var i,u;return r&&e(i=o.constructor)&&i!==a&&t(u=i.prototype)&&u!==a.prototype&&r(n,u),n}}function oa(){if(zo)return To;zo=1;var e=mo(),t=String;return To=function(r){if("Symbol"===e(r))throw new TypeError("Cannot convert a Symbol value to a string");return t(r)}}function aa(){if(Do)return Lo;Do=1;var e=oa();return Lo=function(t,r){return void 0===t?arguments.length<2?"":r:e(t)},Lo}function ia(){if(Ho)return $o;Ho=1;var e=pe(),t=yt();return $o=function(r,n){e(n)&&"cause"in n&&t(r,"cause",n.cause)}}function ua(){if(Xo)return Go;Xo=1;var e=yt(),t=function(){if(qo)return No;qo=1;var e=ue(),t=Error,r=e("".replace),n=String(new t("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,a=o.test(n);return No=function(e,n){if(a&&"string"==typeof e&&!t.prepareStackTrace)for(;n--;)e=r(e,o,"");return e}}(),r=function(){if(Wo)return Fo;Wo=1;var e=d(),t=ie();return Fo=!e((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",t(1,7)),7!==e.stack)}))}(),n=Error.captureStackTrace;return Go=function(o,a,i,u){r&&(n?n(o,a):e(o,"stack",t(i,u)))}}function sa(){if(Zo)return Yo;Zo=1;var e=de(),t=et(),r=yt(),n=me(),o=ta(),a=Er(),i=ra(),u=na(),s=aa(),c=ia(),l=ua(),f=m(),h=Je();return Yo=function(p,d,m,g){var v="stackTraceLimit",b=g?2:1,y=p.split("."),w=y[y.length-1],M=e.apply(null,y);if(M){var S=M.prototype;if(!h&&t(S,"cause")&&delete S.cause,!m)return M;var R=e("Error"),C=d((function(e,t){var o=s(g?t:e,void 0),a=g?new M(e):new M;return void 0!==o&&r(a,"message",o),l(a,C,a.stack,2),this&&n(S,this)&&u(a,this,C),arguments.length>b&&c(a,arguments[b]),a}));if(C.prototype=S,"Error"!==w?o?o(C,R):a(C,R,{name:!0}):f&&v in M&&(i(C,M,v),i(C,M,"prepareStackTrace")),a(C,M),!h)try{S.name!==w&&r(S,"name",w),S.constructor=C}catch(e){}return C}},Yo}!function(){if(Jo)return Vo;Jo=1;var e=Or(),t=o(),r=function(){if(So)return Mo;So=1;var e=g(),t=Function.prototype,r=t.apply,n=t.call;return Mo="object"==typeof Reflect&&Reflect.apply||(e?n.bind(r):function(){return n.apply(r,arguments)}),Mo}(),n=sa(),a="WebAssembly",i=t[a],u=7!==new Error("e",{cause:7}).cause,s=function(t,r){var o={};o[t]=n(t,r,u),e({global:!0,constructor:!0,arity:1,forced:u},o)},c=function(t,r){if(i&&i[t]){var o={};o[t]=n(a+"."+t,r,u),e({target:a,stat:!0,constructor:!0,arity:1,forced:u},o)}};s("Error",(function(e){return function(t){return r(e,this,arguments)}})),s("EvalError",(function(e){return function(t){return r(e,this,arguments)}})),s("RangeError",(function(e){return function(t){return r(e,this,arguments)}})),s("ReferenceError",(function(e){return function(t){return r(e,this,arguments)}})),s("SyntaxError",(function(e){return function(t){return r(e,this,arguments)}})),s("TypeError",(function(e){return function(t){return r(e,this,arguments)}})),s("URIError",(function(e){return function(t){return r(e,this,arguments)}})),c("CompileError",(function(e){return function(t){return r(e,this,arguments)}})),c("LinkError",(function(e){return function(t){return r(e,this,arguments)}})),c("RuntimeError",(function(e){return function(t){return r(e,this,arguments)}}))}();var ca,la,fa,ha,pa,da,ma,ga={};function va(){if(la)return ca;la=1;var e=se();return ca=Array.isArray||function(t){return"Array"===e(t)}}function ba(){if(ha)return fa;ha=1;var e=m(),t=va(),r=TypeError,n=Object.getOwnPropertyDescriptor,o=e&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();return fa=o?function(e,o){if(t(e)&&!n(e,"length").writable)throw new r("Cannot set read only .length");return e.length=o}:function(e,t){return e.length=t}}function ya(){if(da)return pa;da=1;var e=TypeError;return pa=function(t){if(t>9007199254740991)throw e("Maximum allowed index exceeded");return t}}!function(){if(ma)return ga;ma=1;var e=Or(),t=Qe(),r=cr(),n=ba(),o=ya();e({target:"Array",proto:!0,arity:1,forced:d()((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var a=t(this),i=r(a),u=arguments.length;o(i+u);for(var s=0;s<u;s++)a[i]=arguments[s],i++;return n(a,i),i}})}();var wa,Ma,Sa={};Ma||(Ma=1,function(){if(wa)return Sa;wa=1;var e=Or(),t=bo(),r=Me(),n=vt(),o=jr();e({target:"Iterator",proto:!0,real:!0},{every:function(e){n(this),r(e);var a=o(this),i=0;return!t(a,(function(t,r){if(!e(t,i++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}());var Ra,Ca,Ea={};Ca||(Ca=1,function(){if(Ra)return Ea;Ra=1;var e=Or(),t=bo(),r=Me(),n=vt(),o=jr();e({target:"Iterator",proto:!0,real:!0},{some:function(e){n(this),r(e);var a=o(this),i=0;return t(a,(function(t,r){if(e(t,i++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}());var Oa,ja,_a,ka,Ba,xa,Ia,Pa,Aa,Ta,za,La,Da,$a,Ha,Na,qa,Fa,Wa,Ga,Xa={};function Ya(){if(ja)return Oa;ja=1;var e=ue(),t=Set.prototype;return Oa={Set:Set,add:e(t.add),has:e(t.has),remove:e(t.delete),proto:t}}function Za(){if(ka)return _a;ka=1;var e=Ya().has;return _a=function(t){return e(t),t}}function Ja(){if(xa)return Ba;xa=1;var e=v();return Ba=function(t,r,n){for(var o,a,i=n?t:t.iterator,u=t.next;!(o=e(u,i)).done;)if(void 0!==(a=r(o.value)))return a}}function Ua(){if(Pa)return Ia;Pa=1;var e=ue(),t=Ja(),r=Ya(),n=r.Set,o=r.proto,a=e(o.forEach),i=e(o.keys),u=i(new n).next;return Ia=function(e,r,n){return n?t({iterator:i(e),next:u},r):a(e,r)},Ia}function Va(){if(Ta)return Aa;Ta=1;var e=Ya(),t=Ua(),r=e.Set,n=e.add;return Aa=function(e){var o=new r;return t(e,(function(e){n(o,e)})),o},Aa}function Ka(){if(La)return za;La=1;var e=Ko(),t=Ya();return za=e(t.proto,"size","get")||function(e){return e.size},za}function Qa(){if($a)return Da;$a=1;var e=Me(),t=vt(),r=v(),n=ir(),o=jr(),a="Invalid size",i=RangeError,u=TypeError,s=Math.max,c=function(t,r){this.set=t,this.size=s(r,0),this.has=e(t.has),this.keys=e(t.keys)};return c.prototype={getIterator:function(){return o(t(r(this.keys,this.set)))},includes:function(e){return r(this.has,this.set,e)}},Da=function(e){t(e);var r=+e.size;if(r!=r)throw new u(a);var o=n(r);if(o<0)throw new i(a);return new c(e,o)}}function ei(){if(Fa)return qa;Fa=1;var e=de(),t=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};return qa=function(r){var n=e("Set");try{(new n)[r](t(0));try{return(new n)[r](t(-1)),!1}catch(e){return!0}}catch(e){return!1}}}function ti(){if(Wa)return Xa;Wa=1;var e=Or(),t=function(){if(Na)return Ha;Na=1;var e=Za(),t=Ya(),r=Va(),n=Ka(),o=Qa(),a=Ua(),i=Ja(),u=t.has,s=t.remove;return Ha=function(t){var c=e(this),l=o(t),f=r(c);return n(c)<=l.size?a(c,(function(e){l.includes(e)&&s(f,e)})):i(l.getIterator(),(function(e){u(c,e)&&s(f,e)})),f}}();return e({target:"Set",proto:!0,real:!0,forced:!ei()("difference")},{difference:t}),Xa}Ga||(Ga=1,ti());var ri,ni,oi,ai,ii={};function ui(){if(oi)return ii;oi=1;var e=Or(),t=d(),r=function(){if(ni)return ri;ni=1;var e=Za(),t=Ya(),r=Ka(),n=Qa(),o=Ua(),a=Ja(),i=t.Set,u=t.add,s=t.has;return ri=function(t){var c=e(this),l=n(t),f=new i;return r(c)>l.size?a(l.getIterator(),(function(e){s(c,e)&&u(f,e)})):o(c,(function(e){l.includes(e)&&u(f,e)})),f}}();return e({target:"Set",proto:!0,real:!0,forced:!ei()("intersection")||t((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:r}),ii}ai||(ai=1,ui());var si,ci,li,fi,hi={};function pi(){if(li)return hi;li=1;var e=Or(),t=function(){if(ci)return si;ci=1;var e=Za(),t=Ya().has,r=Ka(),n=Qa(),o=Ua(),a=Ja(),i=ln();return si=function(u){var s=e(this),c=n(u);if(r(s)<=c.size)return!1!==o(s,(function(e){if(c.includes(e))return!1}),!0);var l=c.getIterator();return!1!==a(l,(function(e){if(t(s,e))return i(l,"normal",!1)}))}}();return e({target:"Set",proto:!0,real:!0,forced:!ei()("isDisjointFrom")},{isDisjointFrom:t}),hi}fi||(fi=1,pi());var di,mi,gi,vi,bi={};function yi(){if(gi)return bi;gi=1;var e=Or(),t=function(){if(mi)return di;mi=1;var e=Za(),t=Ka(),r=Ua(),n=Qa();return di=function(o){var a=e(this),i=n(o);return!(t(a)>i.size)&&!1!==r(a,(function(e){if(!i.includes(e))return!1}),!0)}}();return e({target:"Set",proto:!0,real:!0,forced:!ei()("isSubsetOf")},{isSubsetOf:t}),bi}vi||(vi=1,yi());var wi,Mi,Si,Ri,Ci={};function Ei(){if(Si)return Ci;Si=1;var e=Or(),t=function(){if(Mi)return wi;Mi=1;var e=Za(),t=Ya().has,r=Ka(),n=Qa(),o=Ja(),a=ln();return wi=function(i){var u=e(this),s=n(i);if(r(u)<s.size)return!1;var c=s.getIterator();return!1!==o(c,(function(e){if(!t(u,e))return a(c,"normal",!1)}))}}();return e({target:"Set",proto:!0,real:!0,forced:!ei()("isSupersetOf")},{isSupersetOf:t}),Ci}Ri||(Ri=1,Ei());var Oi,ji,_i,ki,Bi={};function xi(){if(_i)return Bi;_i=1;var e=Or(),t=function(){if(ji)return Oi;ji=1;var e=Za(),t=Ya(),r=Va(),n=Qa(),o=Ja(),a=t.add,i=t.has,u=t.remove;return Oi=function(t){var s=e(this),c=n(t).getIterator(),l=r(s);return o(c,(function(e){i(s,e)?u(l,e):a(l,e)})),l}}();return e({target:"Set",proto:!0,real:!0,forced:!ei()("symmetricDifference")},{symmetricDifference:t}),Bi}ki||(ki=1,xi());var Ii,Pi,Ai,Ti,zi={};function Li(){if(Ai)return zi;Ai=1;var e=Or(),t=function(){if(Pi)return Ii;Pi=1;var e=Za(),t=Ya().add,r=Va(),n=Qa(),o=Ja();return Ii=function(a){var i=e(this),u=n(a).getIterator(),s=r(i);return o(u,(function(e){t(s,e)})),s}}();return e({target:"Set",proto:!0,real:!0,forced:!ei()("union")},{union:t}),zi}Ti||(Ti=1,Li());var Di,$i,Hi={};$i||($i=1,function(){if(Di)return Hi;Di=1;var e=Or(),t=bo(),r=Me(),n=vt(),o=jr();e({target:"Iterator",proto:!0,real:!0},{find:function(e){n(this),r(e);var a=o(this),i=0;return t(a,(function(t,r){if(e(t,i++))return r(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})}());class Ni{type;coordMeta;coordRange;range;constructor(e,t){var r;("object"==typeof e&&(this.coordMeta=e),t)&&(this.coordMeta=t,this.coordRange=null!==(r=t.range)&&void 0!==r?r:t.refRange);if("string"==typeof e){let t=e.trim().match(/^(?<type><[a-z]+>)(\[(?<min>-?[.\d]+),\s*(?<max>-?[.\d]+)\])?$/);if(!t)throw new TypeError(`Cannot parse ${e} as a type definition.`);this.type=t.groups.type;let{min:r,max:n}=t.groups;(r||n)&&(this.range=[+r,+n])}}get computedRange(){return this.range?this.range:"<percentage>"===this.type?this.percentageRange():"<angle>"===this.type?[0,360]:null}get unit(){return"<percentage>"===this.type?"%":"<angle>"===this.type?"deg":""}resolve(e){if("<angle>"===this.type)return e;let t=this.computedRange,r=this.coordRange;var n;"<percentage>"===this.type&&(null!==(n=r)&&void 0!==n||(r=this.percentageRange()));return Cn(t,r,e)}serialize(e,t){let r="<percentage>"===this.type?this.percentageRange(100):this.computedRange,n=this.unit;return bn(e=Cn(this.coordRange,r,e),{unit:n,precision:t})}toString(){let e=this.type;if(this.range){let[t="",r=""]=this.range;e+=`[${t},${r}]`}return e}percentageRange(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e=this.coordMeta&&this.coordMeta.range||this.coordRange&&this.coordRange[0]>=0?[0,1]:[-1,1],[e[0]*t,e[1]*t]}static get(e,t){return Bn(e,this)?e:new this(e,t)}}const qi=Symbol("instance");class Fi{type;name;spaceCoords;coords;id;alpha;constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.space;e[qi]=this,this.type="function",this.name="color",Object.assign(this,e),this.space=t,"custom"!==this.type&&(this.spaceCoords=Object.values(t.coords),this.coords||(this.coords=this.spaceCoords.map((e=>{let t=["<number>","<percentage>"];return"angle"===e.type&&t.push("<angle>"),t}))),this.coords=this.coords.map(((e,t)=>{let r=this.spaceCoords[t];return"string"==typeof e&&(e=e.trim().split(/\s*\|\s*/)),e.map((e=>Ni.get(e,r)))})))}serializeCoords(e,t,r){return r=e.map(((e,t)=>{var n,o;return Ni.get(null!==(n=null===(o=r)||void 0===o?void 0:o[t])&&void 0!==n?n:this.coords[t][0],this.spaceCoords[t])})),e.map(((e,n)=>r[n].serialize(e,t)))}coerceCoords(e,t){return Object.entries(this.space.coords).map(((r,n)=>{let[o,a]=r,i=e[n];if(yn(i)||isNaN(i))return i;let u=t[n],s=this.coords[n].find((e=>e.type==u));if(!s){var c,l;let e=a.name||o;throw new TypeError(`${null!==(c=null!=u?u:null===(l=i)||void 0===l?void 0:l.raw)&&void 0!==c?c:i} not allowed for ${e} in ${this.name}()`)}return i=s.resolve(i),s.range&&(t[n]=s.toString()),i}))}canSerialize(){return"function"===this.type||this.serialize}parse(e){return null}static get(e){if(!e||Bn(e,this))return e;if(e[qi])return e[qi];for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return new Fi(e,...r)}}const Wi={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function Gi(e){return Array.isArray(e)?e:Wi[e]}function Xi(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e=Gi(e),t=Gi(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return r;let o={W1:e,W2:t,XYZ:r,options:n};if(yo.run("chromatic-adaptation-start",o),o.M||(o.W1===Wi.D65&&o.W2===Wi.D50?o.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:o.W1===Wi.D50&&o.W2===Wi.D65&&(o.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),yo.run("chromatic-adaptation-end",o),o.M)return mn(o.XYZ,o.M);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}function Yi(e,t){var r,n;let o,a={str:null===(r=String(e))||void 0===r?void 0:r.trim(),options:t};if(yo.run("parse-start",a),a.color)return a.color;a.parsed=function(e){if(!e)return;e=e.trim();let t=e.match(Ji.function);if(t){let e=[],r=[],n=!1,o=t[1].toLowerCase(),a=t[2].replace(Ji.singleArgument,((t,a)=>{let{value:i,meta:u}=function(e){var t;let r={},n=null===(t=e.match(Ji.unitValue))||void 0===t?void 0:t[0],o=r.raw=e;n?(r.type="%"===n?"<percentage>":"<angle>",r.unit=n,r.unitless=Number(o.slice(0,-n.length)),o=r.unitless*Zi[n]):Ji.number.test(o)?(o=Number(o),r.type="<number>"):"none"===o?o=null:"NaN"===o||"calc(NaN)"===o?(o=NaN,r.type="<number>"):r.type="<ident>";return{value:o,meta:r}}(a);return(t.startsWith("/")||"color"!==o&&3===e.length)&&(n=!0),e.push(i),r.push(u),""}));return{name:o,args:e,argMeta:r,lastAlpha:n,commas:a.includes(","),rawName:t[1],rawArgs:t[2]}}}(a.str);let i=a.options?null!==(n=a.options.parseMeta)&&void 0!==n?n:a.options.meta:null;if(a.parsed){let t,r,n=a.parsed.name,c=a.parsed.args,l=c.map(((e,t)=>{var r;return null===(r=a.parsed.argMeta[t])||void 0===r?void 0:r.type}));if("color"===n){let o=c.shift();l.shift();let i=o.startsWith("--")?o.substring(2):`--${o}`,f=[o,i];if(t=Ki.findFormat({name:n,id:f,type:"function"}),!t){var u;let t,r=o in Ki.registry?o:i;if(r in Ki.registry){var s;let n=null===(s=Ki.registry[r].formats)||void 0===s||null===(s=s.color)||void 0===s?void 0:s.id;if(n){t=`Did you mean ${e.replace("color("+o,"color("+n)}?`}}throw new TypeError(`Cannot parse ${a.str}. `+(null!==(u=t)&&void 0!==u?u:"Missing a plugin?"))}r=t.space,t.id.startsWith("--")&&!o.startsWith("--")&&Uo.warn(`${r.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${t.id}) instead of color(${o}).`),o.startsWith("--")&&!t.id.startsWith("--")&&Uo.warn(`${r.name} is a standard space and supported in the CSS spec. Use color(${t.id}) instead of prefixed color(${o}).`)}else t=Ki.findFormat({name:n,type:"function"}),r=t.space;i&&Object.assign(i,{format:t,formatId:t.name,types:l,commas:a.parsed.commas});let f=1;a.parsed.lastAlpha&&(f=a.parsed.args.pop(),i&&(i.alphaType=l.pop()));let h=t.coords.length;if(c.length!==h)throw new TypeError(`Expected ${h} coordinates for ${r.id} in ${a.str}), got ${c.length}`);c=t.coerceCoords(c,l),o={spaceId:r.id,coords:c,alpha:f}}else e:for(let e of Ki.all)for(let t in e.formats){let r=e.formats[t];if("custom"!==r.type)continue;if(r.test&&!r.test(a.str))continue;let n=e.getFormat(r),u=n.parse(a.str);if(u){i&&Object.assign(i,{format:n,formatId:t}),o=u;break e}}if(!o)throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`);return o.alpha=yn(o.alpha)?o.alpha:void 0===o.alpha?1:En(0,o.alpha,1),o}const Zi={"%":.01,deg:1,grad:.9,rad:180/Math.PI,turn:360},Ji={function:/^([a-z]+)\(((?:calc\(NaN\)|.)+?)\)$/i,number:/^([-+]?(?:[0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?)$/i,unitValue:RegExp(`(${Object.keys(Zi).join("|")})$`),singleArgument:/\/?\s*(none|NaN|calc\(NaN\)|[-+\w.]+(?:%|deg|g?rad|turn)?)/g};function Ui(e,t){if(Array.isArray(e))return e.map((e=>Ui(e,t)));if(!e)throw new TypeError("Empty color reference");gn(e)&&(e=Yi(e,t));let r=e.space||e.spaceId;return"string"==typeof r&&(e.space=Ki.get(r)),void 0===e.alpha&&(e.alpha=1),e}const Vi=75e-6;class Ki{constructor(e){var t,r,n,o,a;this.id=e.id,this.name=e.name,this.base=e.base?Ki.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let i=null!==(t=e.coords)&&void 0!==t?t:this.base.coords;for(let e in i)"name"in i[e]||(i[e].name=e);this.coords=i;let u=null!==(r=null!==(n=e.white)&&void 0!==n?n:this.base.white)&&void 0!==r?r:"D65";this.white=Gi(u),this.formats=null!==(o=e.formats)&&void 0!==o?o:{};for(let e in this.formats){let t=this.formats[e];t.type||(t.type="function"),t.name||(t.name=e)}var s;null!==(a=this.formats.color)&&void 0!==a&&a.id||(this.formats.color={...null!==(s=this.formats.color)&&void 0!==s?s:{},id:e.cssId||this.id});e.gamutSpace?this.gamutSpace="self"===e.gamutSpace?this:Ki.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:Qi(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),yo.run("colorspace-init-end",this)}inGamut(e){let{epsilon:t=Vi}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every(((e,n)=>{let o=r[n];if("angle"!==o.type&&o.range){if(yn(e))return!0;let[r,n]=o.range;return(void 0===r||e>=r-t)&&(void 0===n||e<=n+t)}return!0}))}get isUnbounded(){return Object.values(this.coords).every((e=>!("range"in e)))}get cssId(){var e;return(null===(e=this.formats)||void 0===e||null===(e=e.color)||void 0===e?void 0:e.id)||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if(!e)return null;"default"===e?e=Object.values(this.formats)[0]:"string"==typeof e&&(e=this.formats[e]);let t=Fi.get(e,this);return t!==e&&e.name in this.formats&&(this.formats[e.name]=t),t}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(e,t){if(1===arguments.length){const r=Ui(e);[e,t]=[r.space,r.coords]}if(e=Ki.get(e),this.equals(e))return t;t=t.map((e=>yn(e)?0:e));let r,n,o=this.path,a=e.path;for(let e=0;e<o.length&&o[e].equals(a[e]);e++)r=o[e],n=e;if(!r)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let e=o.length-1;e>n;e--)t=o[e].toBase(t);for(let e=n+1;e<a.length;e++)t=a[e].fromBase(t);return t}from(e,t){if(1===arguments.length){const r=Ui(e);[e,t]=[r.space,r.coords]}return(e=Ki.get(e)).to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let r in this.coords){var t;let n=this.coords[r],o=n.range||n.refRange;e.push(null!==(t=null==o?void 0:o.min)&&void 0!==t?t:0)}return e}static registry={};static get all(){return[...new Set(Object.values(Ki.registry))]}static register(e,t){if(1===arguments.length&&(e=(t=arguments[0]).id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,1===arguments.length&&t.aliases)for(let e of t.aliases)this.register(e,t);return t}static get(e){if(!e||Bn(e,this))return e;if("string"===vn(e)){let t=Ki.registry[e.toLowerCase()];if(!t)throw new TypeError(`No color space found with id = "${e}"`);return t}for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(r.length)return Ki.get(...r);throw new TypeError(`${e} is not a valid color space`)}static findFormat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ki.all;if(!e)return null;"string"==typeof e&&(e={name:e});for(let o of t)for(let[t,a]of Object.entries(o.formats)){var r,n;null!==(r=a.name)&&void 0!==r||(a.name=t),null!==(n=a.type)&&void 0!==n||(a.type="function");let i=!(e.name&&a.name!==e.name||e.type&&a.type!==e.type);if(e.id){let t=a.ids||[a.id],r=Array.isArray(e.id)?e.id:[e.id];i&&(i=r.some((e=>t.includes(e))))}if(i){let e=Fi.get(a,o);return e!==a&&(o.formats[a.name]=e),e}}return null}static resolveCoord(e,t){let r,n,o=vn(e);if("string"===o?e.includes(".")?[r,n]=e.split("."):[r,n]=[,e]:Array.isArray(e)?[r,n]=e:(r=e.space,n=e.coordId),r=Ki.get(r),r||(r=t),!r)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(o=vn(n),"number"===o||"string"===o&&n>=0){let e=Object.entries(r.coords)[n];if(e)return{space:r,id:e[0],index:n,...e[1]}}r=Ki.get(r);let a=n.toLowerCase(),i=0;for(let e in r.coords){var u;let t=r.coords[e];if(e.toLowerCase()===a||(null===(u=t.name)||void 0===u?void 0:u.toLowerCase())===a)return{space:r,id:e,index:i,...t};i++}throw new TypeError(`No "${n}" coordinate found in ${r.name}. Its coordinates are: ${Object.keys(r.coords).join(", ")}`)}static DEFAULT_FORMAT={type:"functions",name:"color"}}function Qi(e){let t=[e];for(let r=e;r=r.base;)t.push(r);return t}var eu=new Ki({id:"xyz-d65",name:"XYZ D65",coords:{x:{refRange:[0,1],name:"X"},y:{refRange:[0,1],name:"Y"},z:{refRange:[0,1],name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class tu extends Ki{constructor(e){var t,r,n;(e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=eu),e.toXYZ_M&&e.fromXYZ_M)&&(null!==(r=e.toBase)&&void 0!==r||(e.toBase=t=>{let r=mn(t,e.toXYZ_M);return this.white!==this.base.white&&(r=Xi(this.white,this.base.white,r)),r}),null!==(n=e.fromBase)&&void 0!==n||(e.fromBase=t=>mn(t=Xi(this.base.white,this.white,t),e.fromXYZ_M)));null!==(t=e.referred)&&void 0!==t||(e.referred="display"),super(e)}}function ru(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Array.isArray(e))return e.map((e=>ru(e,t)));let{cssProperty:r="background-color",element:n,...o}=t,a=null;try{return Ui(e,o)}catch(e){a=e}let{CSS:i,getComputedStyle:u}=globalThis;if(gn(e)&&n&&i&&u&&i.supports(r,e)){let t=n.style[r];e!==t&&(n.style[r]=e);let i=u(n).getPropertyValue(r);if(e!==t&&(n.style[r]=t),i!==e)try{return Ui(i,o)}catch(e){a=e}else a={message:"Color value is a valid CSS color, but it could not be resolved :("}}return t.errorMeta&&(t.errorMeta.error=a),null}function nu(e,t){e=Ui(e);let r,n=Ki.get(t,null==t?void 0:t.space),o=null==t?void 0:t.precision;return r=!n||e.space.equals(n)?e.coords.slice():n.from(e),void 0===o?r:r.map((e=>Mn(e,o)))}function ou(e,t){var r;if(e=Ui(e),"alpha"===t)return null!==(r=e.alpha)&&void 0!==r?r:1;let{space:n,index:o}=Ki.resolveCoord(t,e.space);return nu(e,n)[o]}function au(e,t,r,n){return e=Ui(e),Array.isArray(t)&&([t,r,n]=[e.space,t,r]),t=Ki.get(t),e.coords=t===e.space?r.slice():t.to(e.space,r),void 0!==n&&(e.alpha=n),e}function iu(e,t,r){if(e=Ui(e),2===arguments.length&&"object"===vn(arguments[1])){let t=arguments[1];for(let r in t)iu(e,r,t[r])}else if("function"==typeof r&&(r=r(ou(e,t))),"alpha"===t)e.alpha=r;else{let{space:n,index:o}=Ki.resolveCoord(t,e.space),a=nu(e,n);a[o]=r,au(e,n,a)}return e}au.returns="color",iu.returns="color";var uu=new Ki({id:"xyz-d50",name:"XYZ D50",white:"D50",base:eu,fromBase:e=>Xi(eu.white,"D50",e),toBase:e=>Xi("D50",eu.white,e)});const su=216/24389,cu=24/116,lu=24389/27;let fu=Wi.D50;var hu=new Ki({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:fu,base:uu,fromBase(e){let t=e.map(((e,t)=>e/fu[t])).map((e=>e>su?Math.cbrt(e):(lu*e+16)/116));return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let[t,r,n]=e,o=[];return o[1]=(t+16)/116,o[0]=r/500+o[1],o[2]=o[1]-n/200,[o[0]>cu?Math.pow(o[0],3):(116*o[0]-16)/lu,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/lu,o[2]>cu?Math.pow(o[2],3):(116*o[2]-16)/lu].map(((e,t)=>e*fu[t]))},formats:{lab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function pu(e){return"number"!=typeof e?e:(e%360+360)%360}function du(e,t){let[r,n]=t,o=yn(r),a=yn(n);if(o&&a)return[r,n];if(o?r=n:a&&(n=r),"raw"===e)return t;r=pu(r),n=pu(n);let i=n-r;return"increasing"===e?i<0&&(n+=360):"decreasing"===e?i>0&&(r+=360):"longer"===e?-180<i&&i<180&&(i>0?r+=360:n+=360):"shorter"===e&&(i>180?r+=360:i<-180&&(n+=360)),[r,n]}var mu=new Ki({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:hu,fromBase(e){if(void 0===this.ε){let e=Object.values(this.base.coords)[1].refRange,t=e[1]-e[0];this.ε=t/1e5}let[t,r,n]=e,o=Math.abs(r)<this.ε&&Math.abs(n)<this.ε,a=o?null:pu(180*Math.atan2(n,r)/Math.PI);return[t,o?0:Math.sqrt(r**2+n**2),a]},toBase(e){let[t,r,n]=e,o=null,a=null;return yn(n)||(r=r<0?0:r,o=r*Math.cos(n*Math.PI/180),a=r*Math.sin(n*Math.PI/180)),[t,o,a]},formats:{lch:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}