css-color-parser-h 3.0.4 → 3.0.5
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/@types/CssColorParser.d.ts +219 -0
- package/@types/CssColorParserPlus.d.ts +175 -0
- package/@types/index.d.ts +10 -388
- package/example.html +1 -1
- package/lib/css-color-parser-h.cjs.js +893 -0
- package/lib/css-color-parser-h.esm.js +890 -0
- package/lib/css-color-parser-h.umd.js +1 -0
- package/package.json +59 -50
- package/readme.md +4 -4
- package/LICENSE +0 -21
- package/dist/css-color-parser-h.cjs +0 -2550
- package/dist/css-color-parser-h.esm.js +0 -2532
- package/dist/css-color-parser-h.esm.min.js +0 -1
- package/dist/css-color-parser-h.min.cjs +0 -1
- package/dist/css-color-parser-h.umd.js +0 -2559
- package/dist/css-color-parser-h.umd.min.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Parser=t():r.Parser=t()}(this,(function(){return function(){var r={208:function(r,t,e){function n(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,a,o,i,s=[],u=!0,c=!1;try{if(o=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=o.call(e)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(r){c=!0,a=r}finally{try{if(!u&&null!=e.return&&(i=e.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(r,t)||function(r,t){if(r){if("string"==typeof r)return a(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}for(var o=e(101),i={},s=0,u=Object.keys(o);s<u.length;s++){var c=u[s];i[o[c]]=c}var l={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};r.exports=l;for(var h=0,p=Object.keys(l);h<p.length;h++){var f=p[h];if(!("channels"in l[f]))throw new Error("missing channels property: "+f);if(!("labels"in l[f]))throw new Error("missing channel labels property: "+f);if(l[f].labels.length!==l[f].channels)throw new Error("channel and label counts mismatch: "+f);var b=l[f],g=b.channels,y=b.labels;delete l[f].channels,delete l[f].labels,Object.defineProperty(l[f],"channels",{value:g}),Object.defineProperty(l[f],"labels",{value:y})}l.rgb.hsl=function(r){var t,e=r[0]/255,n=r[1]/255,a=r[2]/255,o=Math.min(e,n,a),i=Math.max(e,n,a),s=i-o;i===o?t=0:e===i?t=(n-a)/s:n===i?t=2+(a-e)/s:a===i&&(t=4+(e-n)/s),(t=Math.min(60*t,360))<0&&(t+=360);var u=(o+i)/2;return[t,100*(i===o?0:u<=.5?s/(i+o):s/(2-i-o)),100*u]},l.rgb.hsv=function(r){var t,e,n,a,o,i=r[0]/255,s=r[1]/255,u=r[2]/255,c=Math.max(i,s,u),l=c-Math.min(i,s,u),h=function(r){return(c-r)/6/l+.5};return 0===l?(a=0,o=0):(o=l/c,t=h(i),e=h(s),n=h(u),i===c?a=n-e:s===c?a=1/3+t-n:u===c&&(a=2/3+e-t),a<0?a+=1:a>1&&(a-=1)),[360*a,100*o,100*c]},l.rgb.hwb=function(r){var t=r[0],e=r[1],n=r[2];return[l.rgb.hsl(r)[0],1/255*Math.min(t,Math.min(e,n))*100,100*(n=1-1/255*Math.max(t,Math.max(e,n)))]},l.rgb.cmyk=function(r){var t=r[0]/255,e=r[1]/255,n=r[2]/255,a=Math.min(1-t,1-e,1-n);return[100*((1-t-a)/(1-a)||0),100*((1-e-a)/(1-a)||0),100*((1-n-a)/(1-a)||0),100*a]},l.rgb.keyword=function(r){var t=i[r];if(t)return t;for(var e,n,a,s=1/0,u=0,c=Object.keys(o);u<c.length;u++){var l=c[u],h=(n=r,a=o[l],Math.pow(n[0]-a[0],2)+Math.pow(n[1]-a[1],2)+Math.pow(n[2]-a[2],2));h<s&&(s=h,e=l)}return e},l.keyword.rgb=function(r){return o[r]},l.rgb.xyz=function(r){var t=r[0]/255,e=r[1]/255,n=r[2]/255;return[100*(.4124*(t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*t+.7152*e+.0722*n),100*(.0193*t+.1192*e+.9505*n)]},l.rgb.lab=function(r){var t=l.rgb.xyz(r),e=t[0],n=t[1],a=t[2];return n/=100,a/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]},l.hsl.rgb=function(r){var t,e,n,a=r[0]/360,o=r[1]/100,i=r[2]/100;if(0===o)return[n=255*i,n,n];for(var s=2*i-(t=i<.5?i*(1+o):i+o-i*o),u=[0,0,0],c=0;c<3;c++)(e=a+1/3*-(c-1))<0&&e++,e>1&&e--,n=6*e<1?s+6*(t-s)*e:2*e<1?t:3*e<2?s+(t-s)*(2/3-e)*6:s,u[c]=255*n;return u},l.hsl.hsv=function(r){var t=r[0],e=r[1]/100,n=r[2]/100,a=e,o=Math.max(n,.01);return e*=(n*=2)<=1?n:2-n,a*=o<=1?o:2-o,[t,100*(0===n?2*a/(o+a):2*e/(n+e)),(n+e)/2*100]},l.hsv.rgb=function(r){var t=r[0]/60,e=r[1]/100,n=r[2]/100,a=Math.floor(t)%6,o=t-Math.floor(t),i=255*n*(1-e),s=255*n*(1-e*o),u=255*n*(1-e*(1-o));switch(n*=255,a){case 0:return[n,u,i];case 1:return[s,n,i];case 2:return[i,n,u];case 3:return[i,s,n];case 4:return[u,i,n];case 5:return[n,i,s]}},l.hsv.hsl=function(r){var t,e,n=r[0],a=r[1]/100,o=r[2]/100,i=Math.max(o,.01);e=(2-a)*o;var s=(2-a)*i;return t=a*i,[n,100*(t=(t/=s<=1?s:2-s)||0),100*(e/=2)]},l.hwb.rgb=function(r){var t,e=r[0]/360,n=r[1]/100,a=r[2]/100,o=n+a;o>1&&(n/=o,a/=o);var i=Math.floor(6*e),s=1-a;t=6*e-i,0!=(1&i)&&(t=1-t);var u,c,l,h=n+t*(s-n);switch(i){default:case 6:case 0:u=s,c=h,l=n;break;case 1:u=h,c=s,l=n;break;case 2:u=n,c=s,l=h;break;case 3:u=n,c=h,l=s;break;case 4:u=h,c=n,l=s;break;case 5:u=s,c=n,l=h}return[255*u,255*c,255*l]},l.cmyk.rgb=function(r){var t=r[0]/100,e=r[1]/100,n=r[2]/100,a=r[3]/100;return[255*(1-Math.min(1,t*(1-a)+a)),255*(1-Math.min(1,e*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a))]},l.xyz.rgb=function(r){var t,e,n,a=r[0]/100,o=r[1]/100,i=r[2]/100;return e=-.9689*a+1.8758*o+.0415*i,n=.0557*a+-.204*o+1.057*i,t=(t=3.2406*a+-1.5372*o+-.4986*i)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(t=Math.min(Math.max(0,t),1)),255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1))]},l.xyz.lab=function(r){var t=r[0],e=r[1],n=r[2];return e/=100,n/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(t-e),200*(e-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},l.lab.xyz=function(r){var t,e,n,a=r[0];t=r[1]/500+(e=(a+16)/116),n=e-r[2]/200;var o=Math.pow(e,3),i=Math.pow(t,3),s=Math.pow(n,3);return e=o>.008856?o:(e-16/116)/7.787,t=i>.008856?i:(t-16/116)/7.787,n=s>.008856?s:(n-16/116)/7.787,[t*=95.047,e*=100,n*=108.883]},l.lab.lch=function(r){var t,e=r[0],n=r[1],a=r[2];return(t=360*Math.atan2(a,n)/2/Math.PI)<0&&(t+=360),[e,Math.sqrt(n*n+a*a),t]},l.lch.lab=function(r){var t=r[0],e=r[1],n=r[2]/360*2*Math.PI;return[t,e*Math.cos(n),e*Math.sin(n)]},l.rgb.ansi16=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=n(r,3),a=e[0],o=e[1],i=e[2],s=null===t?l.rgb.hsv(r)[2]:t;if(0===(s=Math.round(s/50)))return 30;var u=30+(Math.round(i/255)<<2|Math.round(o/255)<<1|Math.round(a/255));return 2===s&&(u+=60),u},l.hsv.ansi16=function(r){return l.rgb.ansi16(l.hsv.rgb(r),r[2])},l.rgb.ansi256=function(r){var t=r[0],e=r[1],n=r[2];return t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(n/255*5)},l.ansi16.rgb=function(r){var t=r%10;if(0===t||7===t)return r>50&&(t+=3.5),[t=t/10.5*255,t,t];var e=.5*(1+~~(r>50));return[(1&t)*e*255,(t>>1&1)*e*255,(t>>2&1)*e*255]},l.ansi256.rgb=function(r){if(r>=232){var t=10*(r-232)+8;return[t,t,t]}var e;return r-=16,[Math.floor(r/36)/5*255,Math.floor((e=r%36)/6)/5*255,e%6/5*255]},l.rgb.hex=function(r){var t=(((255&Math.round(r[0]))<<16)+((255&Math.round(r[1]))<<8)+(255&Math.round(r[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},l.hex.rgb=function(r){var t=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var e=t[0];3===t[0].length&&(e=e.split("").map((function(r){return r+r})).join(""));var n=parseInt(e,16);return[n>>16&255,n>>8&255,255&n]},l.rgb.hcg=function(r){var t,e=r[0]/255,n=r[1]/255,a=r[2]/255,o=Math.max(Math.max(e,n),a),i=Math.min(Math.min(e,n),a),s=o-i;return t=s<=0?0:o===e?(n-a)/s%6:o===n?2+(a-e)/s:4+(e-n)/s,t/=6,[360*(t%=1),100*s,100*(s<1?i/(1-s):0)]},l.hsl.hcg=function(r){var t=r[1]/100,e=r[2]/100,n=e<.5?2*t*e:2*t*(1-e),a=0;return n<1&&(a=(e-.5*n)/(1-n)),[r[0],100*n,100*a]},l.hsv.hcg=function(r){var t=r[1]/100,e=r[2]/100,n=t*e,a=0;return n<1&&(a=(e-n)/(1-n)),[r[0],100*n,100*a]},l.hcg.rgb=function(r){var t=r[0]/360,e=r[1]/100,n=r[2]/100;if(0===e)return[255*n,255*n,255*n];var a,o=[0,0,0],i=t%1*6,s=i%1,u=1-s;switch(Math.floor(i)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=u,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=u,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=u}return a=(1-e)*n,[255*(e*o[0]+a),255*(e*o[1]+a),255*(e*o[2]+a)]},l.hcg.hsv=function(r){var t=r[1]/100,e=t+r[2]/100*(1-t),n=0;return e>0&&(n=t/e),[r[0],100*n,100*e]},l.hcg.hsl=function(r){var t=r[1]/100,e=r[2]/100*(1-t)+.5*t,n=0;return e>0&&e<.5?n=t/(2*e):e>=.5&&e<1&&(n=t/(2*(1-e))),[r[0],100*n,100*e]},l.hcg.hwb=function(r){var t=r[1]/100,e=t+r[2]/100*(1-t);return[r[0],100*(e-t),100*(1-e)]},l.hwb.hcg=function(r){var t=r[1]/100,e=1-r[2]/100,n=e-t,a=0;return n<1&&(a=(e-n)/(1-n)),[r[0],100*n,100*a]},l.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]},l.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]},l.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]},l.gray.hsl=function(r){return[0,0,r[0]]},l.gray.hsv=l.gray.hsl,l.gray.hwb=function(r){return[0,100,r[0]]},l.gray.cmyk=function(r){return[0,0,0,r[0]]},l.gray.lab=function(r){return[r[0],0,0]},l.gray.hex=function(r){var t=255&Math.round(r[0]/100*255),e=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(e.length)+e},l.rgb.gray=function(r){return[(r[0]+r[1]+r[2])/3/255*100]}},907:function(r,t,e){function n(r){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},n(r)}var a=e(208),o=e(171),i={};Object.keys(a).forEach((function(r){i[r]={},Object.defineProperty(i[r],"channels",{value:a[r].channels}),Object.defineProperty(i[r],"labels",{value:a[r].labels});var t=o(r);Object.keys(t).forEach((function(e){var a=t[e];i[r][e]=function(r){var t=function(){for(var t=arguments.length,e=new Array(t),a=0;a<t;a++)e[a]=arguments[a];var o=e[0];if(null==o)return o;o.length>1&&(e=o);var i=r(e);if("object"===n(i))for(var s=i.length,u=0;u<s;u++)i[u]=Math.round(i[u]);return i};return"conversion"in r&&(t.conversion=r.conversion),t}(a),i[r][e].raw=function(r){var t=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var a=e[0];return null==a?a:(a.length>1&&(e=a),r(e))};return"conversion"in r&&(t.conversion=r.conversion),t}(a)}))})),r.exports=i},171:function(r,t,e){var n=e(208);function a(r,t){return function(e){return t(r(e))}}function o(r,t){for(var e=[t[r].parent,r],o=n[t[r].parent][r],i=t[r].parent;t[i].parent;)e.unshift(t[i].parent),o=a(n[t[i].parent][i],o),i=t[i].parent;return o.conversion=e,o}r.exports=function(r){for(var t=function(r){var t=function(){for(var r={},t=Object.keys(n),e=t.length,a=0;a<e;a++)r[t[a]]={distance:-1,parent:null};return r}(),e=[r];for(t[r].distance=0;e.length;)for(var a=e.pop(),o=Object.keys(n[a]),i=o.length,s=0;s<i;s++){var u=o[s],c=t[u];-1===c.distance&&(c.distance=t[a].distance+1,c.parent=a,e.unshift(u))}return t}(r),e={},a=Object.keys(t),i=a.length,s=0;s<i;s++){var u=a[s];null!==t[u].parent&&(e[u]=o(u,t))}return e}},101:function(r){"use strict";r.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}}},t={};function e(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return r[n](o,o.exports,e),o.exports}e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,{a:t}),t},e.d=function(r,t){for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var n={};return function(){"use strict";e.r(n),e.d(n,{CssColorParser:function(){return s},CssColorParserPlus:function(){return p}});var r=function(){function r(){}return r.type=function(r,t,e){var n=typeof t;if(n!==e)throw new Error("Expected ".concat(r," to be typeof ").concat(e,", actual typeof was ").concat(n))},r.types=function(r,t,e){var n=typeof t;if(!e.includes(n))throw new Error("Expected ".concat(r," to be typeof ").concat(e.join("|"),", actual typeof was ").concat(n))},r.numValue=function(t,e,n,a){r.numMinValue(t,e,n),r.numMaxValue(t,e,a)},r.numMinValue=function(r,t,e){if(t<e)throw new Error("Expected ".concat(r," to > ").concat(e,", actual value was ").concat(t))},r.numMaxValue=function(r,t,e){if(t>e)throw new Error("Expected ".concat(r," to < ").concat(e,", actual value was ").concat(t))},r.numIsInt=function(r,t,e){var n=Math.floor(t)===t;if(n!==e)throw new Error("Expected ".concat(r," to ").concat(e?"Integer":"Float",", actual value was ").concat(n?"Integer":"Float"))},r}();function t(r,t){return null==r||isNaN(r)&&"number"==typeof t?t:r}function a(r,t,e){return e>t?e=t:e<r&&(e=r),e}function o(r,t){void 0===r&&(r=0);var e=Math.pow(10,t);return Math.round(r*e)/e}var i=function(){function r(){}return r.clearStrSpace=function(r){return r.replace(/\s/g,"")},r.trimStr=function(r){return(r=r.replace(/\s+/g," ")).trim()},r.parse3BitsHEX=function(e){var n=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i.exec(e);if(n){var a=t(n[4],"f");return[r._parseResStrForRgb(parseInt(n[1]+n[1],16)),r._parseResStrForRgb(parseInt(n[2]+n[2],16)),r._parseResStrForRgb(parseInt(n[3]+n[3],16)),r._parsePercent(parseInt(a+a,16)/255)]}return null},r.parse6BitsHEX=function(e){var n=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i.exec(e);if(n){var a=t(n[4],"ff");return[r._parseResStrForRgb(parseInt(n[1],16)),r._parseResStrForRgb(parseInt(n[2],16)),r._parseResStrForRgb(parseInt(n[3],16)),r._parsePercent(parseInt(a,16)/255)]}return null},r.parseRGBA=function(t){var e=/^rgba?\(([0-9.]+%?),([0-9.]+%?),([0-9.]+%?)(?:,([0-9.]+%?))?\)$/i.exec(t);return e?[r._parseResStrForRgb(e[1]),r._parseResStrForRgb(e[2]),r._parseResStrForRgb(e[3]),r._parsePercent(e[4])]:null},r.parseHSLA=function(t){var e=/^hsla?\(([0-9.]+)(?:deg)?,([0-9.]+%?),([0-9.]+%?)(?:,([0-9.]+%?))?\)$/i.exec(t);return e?[r._parseResStrForHue(e[1]),r._parsePercent(e[2]),r._parsePercent(e[3]),r._parsePercent(e[4])]:null},r.parseHWB=function(t){var e=/^hwb\s?\(\s?([0-9.]+)(?:deg)?\s([0-9.]+%?)\s([0-9.]+%?)\s?(?:\/\s?([0-9.]+%?))?\s?\)$/i.exec(t);return e?[r._parseResStrForHue(e[1]),r._parsePercent(e[2]),r._parsePercent(e[3]),r._parsePercent(e[4])]:null},r.parseRGBA2=function(t){var e=/^rgba?\s?\(\s?([0-9.]+%?)\s?([0-9.]+%?)\s?([0-9.]+%?)(?:\s?\/\s?([0-9.]+%?))?\s?\)$/i.exec(t);return e?[r._parseResStrForRgb(e[1]),r._parseResStrForRgb(e[2]),r._parseResStrForRgb(e[3]),r._parsePercent(e[4])]:null},r.parseHSLA2=function(t){var e=/^hsla?\s?\(\s?([0-9.]+)(?:deg)?\s([0-9.]+%?)\s([0-9.]+%?)\s?(?:\/\s?([0-9.]+%?))?\s?\)$/i.exec(t);return e?[r._parseResStrForHue(e[1]),r._parsePercent(e[2]),r._parsePercent(e[3]),r._parsePercent(e[4])]:null},r._parseResStrForRgb=function(r){return"string"==typeof r&&(r=parseFloat(r)/("%"===r.substr(-1)?100/255:1)),isNaN(r)&&(r=1),a(0,255,r)},r._parseResStrForHue=function(r){return"string"==typeof r&&(r=parseFloat(r)),isNaN(r)&&(r=0),a(0,360,r)},r._parsePercent=function(r){return"string"==typeof r&&(r=parseFloat(r)/("%"===r.substr(-1)?100:1)),isNaN(r)&&(r=1),a(0,1,r)},r}(),s=function(){function e(r,t,e,n){this.r=255,this.g=255,this.b=255,this.a=1,this._outColorPrecision=2,this._outAlphaPrecision=2,this.setColor(r,t,e,n)}return e.prototype.setOutPrecision=function(t,e){return r.type("colorPrecision",t,"number"),r.type("outAlphaPrecision",e,"number"),r.numMinValue("colorPrecision",t,0),r.numMinValue("outAlphaPrecision",e,0),r.numIsInt("colorPrecision",t,!0),r.numIsInt("outAlphaPrecision",e,!0),this._outColorPrecision=t,this._outAlphaPrecision=e,this},e.prototype.setColor=function(r,e,n,o){return this.r=a(0,255,t(Number(r),0)),this.g=a(0,255,t(Number(e),0)),this.b=a(0,255,t(Number(n),0)),this.a=a(0,1,t(Number(o),1)),this},e.prototype.setAlpha=function(r){return this.a=a(0,1,t(Number(r),1)),this},e.prototype.setRed=function(r){return this.r=a(0,255,t(Number(r),0)),this},e.prototype.setGreen=function(r){return this.g=a(0,255,t(Number(r),0)),this},e.prototype.setBlue=function(r){return this.b=a(0,255,t(Number(r),0)),this},e.prototype.toRGBA=function(){var r=this.toJson();return 1===r.a?"rgb(".concat(r.r,",").concat(r.g,",").concat(r.b,")"):"rgba(".concat(r.r,",").concat(r.g,",").concat(r.b,",").concat(r.a,")")},e.prototype.toString=function(){return this.toRGBA()},e.prototype.toNormalize=function(){return[o(this.r/255,this._outColorPrecision),o(this.g/255,this._outColorPrecision),o(this.b/255,this._outColorPrecision),o(this.a,this._outAlphaPrecision)]},e.prototype.toHEX=function(){var r=this.toJson(),t=r.r.toString(16);t.length<2&&(t="0".concat(t));var e=r.g.toString(16);e.length<2&&(e="0".concat(e));var n=r.b.toString(16);if(n.length<2&&(n="0".concat(n)),this.a<1){var a=parseInt((255*this.a).toFixed()).toString(16);return a.length<2&&(a="0".concat(a)),"#".concat(t).concat(e).concat(n).concat(a)}return"#".concat(t).concat(e).concat(n)},e.prototype.toArray=function(){var r=this.toJson();return[r.r,r.g,r.b,r.a]},e.prototype.toJson=function(){return{r:o(this.r,this._outColorPrecision),g:o(this.g,this._outColorPrecision),b:o(this.b,this._outColorPrecision),a:o(this.a,this._outAlphaPrecision)}},e.prototype.toInvert=function(){return new e(255-this.r,255-this.g,255-this.b,1-this.a)},e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.a)},e.prototype.equals=function(r){if(this===r)return!0;var t=this.toJson(),e=r.toJson();return t.r===e.r&&t.g===e.g&&t.b===e.g&&t.a===e.a},e.prototype.setInvert=function(){return this.r=255-this.r,this.g=255-this.g,this.b=255-this.b,this.a=1-this.a,this},e.prototype.multiplyByScalar=function(r,t){void 0===t&&(t=!0);var e=this.r*r,n=this.g*r,a=this.b*r,o=t?this.a*r:this.a;return this.setColor(e,n,a,o)},e.prototype.divideByScalar=function(r,t){void 0===t&&(t=!0);var e=this.r/r,n=this.g/r,a=this.b/r,o=t?this.a/r:this.a;return this.setColor(e,n,a,o)},e.prototype.add=function(r,t){void 0===t&&(t=!0);var e=this.r+r.r,n=this.g+r.g,a=this.b+r.b,o=t?this.a+r.a:this.a;return this.setColor(e,n,a,o)},e.prototype.subtract=function(r,t){void 0===t&&(t=!0);var e=this.r-r.r,n=this.g-r.g,a=this.b-r.b,o=t?this.a-r.a:this.a;return this.setColor(e,n,a,o)},e.prototype.multiply=function(r,t){void 0===t&&(t=!0);var e=this.r*r.r,n=this.g*r.g,a=this.b*r.b,o=t?this.a*r.a:this.a;return this.setColor(e,n,a,o)},e.prototype.divide=function(r,t){void 0===t&&(t=!0);var e=this.r/r.r,n=this.g/r.g,a=this.b/r.b,o=t?this.a/r.a:this.a;return this.setColor(e,n,a,o)},e.prototype.addNumberForRGB=function(r){return this.r=this.r+r,this.g=this.g+r,this.b=this.b+r,this},e.prototype.addNumberForAlpha=function(r){return this.a=this.a+r,this},e.parseHEX=function(r){var t=i.clearStrSpace(r),n=i.parse3BitsHEX(t);return n||(n=i.parse6BitsHEX(t)),n&&e.fromArray(n)},e.parseRGBA=function(r){var t=i.clearStrSpace(r),n=i.parseRGBA(t);if(!n){var a=i.trimStr(r);n=i.parseRGBA2(a)}return n&&e.fromArray(n)},e.fromJson=function(r){return new e(r.r,r.g,r.b,r.a)},e.fromArray=function(r){return new e(r[0],r[1],r[2],r[3])},e.fromRandom=function(r,t){return new e(Math.random()*Math.abs(t.r-r.r)+Math.min(r.r,t.r),Math.random()*Math.abs(t.g-r.g)+Math.min(r.g,t.g),Math.random()*Math.abs(t.b-r.b)+Math.min(r.b,t.b),Math.random()*Math.abs(t.a-r.a)+Math.min(r.a,t.a))},e.fromNormalize=function(r){var t=255*r[0],n=255*r[1],a=255*r[2],o=r[3];return e.fromArray([t,n,a,o])},e}(),u=function(r,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])},u(r,t)};Object.create,Object.create;var c=e(907),l=e.n(c),h=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=r}u(r,t),r.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}(n,e),n.prototype.toInvert=function(){return new n(255-this.r,255-this.g,255-this.b,1-this.a)},n.prototype.clone=function(){return new n(this.r,this.g,this.b,this.a)},n.prototype.equals=function(r){if(this===(r=n.parseColor(r)))return!0;var t=this.toJson(),e=r.toJson();return t.r===e.r&&t.g===e.g&&t.b===e.g&&t.a===e.a},n.prototype.add=function(r,t){void 0===t&&(t=!0);var a=n.parseColor(r);return e.prototype.add.call(this,a,t)},n.prototype.subtract=function(r,t){void 0===t&&(t=!0);var a=n.parseColor(r);return e.prototype.subtract.call(this,a,t)},n.prototype.multiply=function(r,t){void 0===t&&(t=!0);var a=n.parseColor(r);return e.prototype.multiply.call(this,a,t)},n.prototype.divide=function(r,t){void 0===t&&(t=!0);var a=n.parseColor(r);return e.prototype.divide.call(this,a,t)},n.parseColor=function(r){return r instanceof s?r:n.parseCssColorStr(r)},n.parseCssColorStr=function(t){return r.type("color",t,"string"),n.parseHEX(t)||n.parseRGBA(t)||n.parseKeyWord(t)||n.parseHSLA(t)||n.parseHWB(t)},n.parseKeyWord=function(r){var t=i.clearStrSpace(r),e=l().keyword.rgb(t);return e&&n.fromArray(e)},n.parseHSLA=function(r){var t=i.clearStrSpace(r),e=i.parseHSLA(t);if(!e){var a=i.trimStr(r);e=i.parseHSLA2(a)}return e&&n.fromHSL(e[0],e[1],e[2],e[3])},n.parseHWB=function(r){var t=i.trimStr(r),e=i.parseHWB(t);return e&&n.fromHWB(e[0],e[1],e[2],e[3])},n.fromHSL=function(r,e,o,i){var s=l().hsl.rgb(a(0,360,r),a(0,100,100*e),a(0,100,100*o));return new n(s[0],s[1],s[2],t(Number(i),1))},n.fromHWB=function(r,e,o,i){var s=l().hwb.rgb(a(0,360,r),a(0,100,100*e),a(0,100,100*o));return new n(s[0],s[1],s[2],t(Number(i),1))},n.parseHEX=function(r){var t=i.clearStrSpace(r),e=i.parse3BitsHEX(t);return e||(e=i.parse6BitsHEX(t)),e&&n.fromArray(e)},n.parseRGBA=function(r){var t=i.clearStrSpace(r),e=i.parseRGBA(t);if(!e){var a=i.trimStr(r);e=i.parseRGBA2(a)}return e&&n.fromArray(e)},n.fromJson=function(r){return new n(r.r,r.g,r.b,r.a)},n.fromArray=function(r){return new n(r[0],r[1],r[2],r[3])},n.fromRandom=function(r,t){return r=n.parseColor(r),t=n.parseColor(t),new n(Math.random()*Math.abs(t.r-r.r)+Math.min(r.r,t.r),Math.random()*Math.abs(t.g-r.g)+Math.min(r.g,t.g),Math.random()*Math.abs(t.b-r.b)+Math.min(r.b,t.b),Math.random()*Math.abs(t.a-r.a)+Math.min(r.a,t.a))},n.fromNormalize=function(r){var t=255*r[0],e=255*r[1],a=255*r[2],o=r[3];return n.fromArray([t,e,a,o])},n}(s),p=h}(),n}()}));
|