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

node-vibrant

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-vibrant - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

gulp-task/clean.coffee

4

dist/vibrant.min.js

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

!function t(r,n,e){function o(s,a){if(!n[s]){if(!r[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var c=n[s]={exports:{}};r[s][0].call(c.exports,function(t){var n=r[s][1][t];return o(n?n:t)},c,c.exports,t,r,n,e)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<e.length;s++)o(e[s]);return o}({1:[function(t,r,n){(function(t){!function(e){function o(t){throw RangeError(V[t])}function i(t,r){for(var n=t.length,e=[];n--;)e[n]=r(t[n]);return e}function s(t,r){var n=t.split("@"),e="";n.length>1&&(e=n[0]+"@",t=n[1]),t=t.replace(O,".");var o=t.split("."),s=i(o,r).join(".");return e+s}function a(t){for(var r,n,e=[],o=0,i=t.length;i>o;)r=t.charCodeAt(o++),r>=55296&&56319>=r&&i>o?(n=t.charCodeAt(o++),56320==(64512&n)?e.push(((1023&r)<<10)+(1023&n)+65536):(e.push(r),o--)):e.push(r);return e}function u(t){return i(t,function(t){var r="";return t>65535&&(t-=65536,r+=E(t>>>10&1023|55296),t=56320|1023&t),r+=E(t)}).join("")}function h(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:C}function c(t,r){return t+22+75*(26>t)-((0!=r)<<5)}function p(t,r,n){var e=0;for(t=n?j(t/q):t>>1,t+=j(t/r);t>k*_>>1;e+=C)t=j(t/k);return j(e+(k+1)*t/(t+M))}function f(t){var r,n,e,i,s,a,c,f,l,g,v=[],m=t.length,d=0,y=z,b=I;for(n=t.lastIndexOf(A),0>n&&(n=0),e=0;n>e;++e)t.charCodeAt(e)>=128&&o("not-basic"),v.push(t.charCodeAt(e));for(i=n>0?n+1:0;m>i;){for(s=d,a=1,c=C;i>=m&&o("invalid-input"),f=h(t.charCodeAt(i++)),(f>=C||f>j((x-d)/a))&&o("overflow"),d+=f*a,l=b>=c?S:c>=b+_?_:c-b,!(l>f);c+=C)g=C-l,a>j(x/g)&&o("overflow"),a*=g;r=v.length+1,b=p(d-s,r,0==s),j(d/r)>x-y&&o("overflow"),y+=j(d/r),d%=r,v.splice(d++,0,y)}return u(v)}function l(t){var r,n,e,i,s,u,h,f,l,g,v,m,d,y,b,w=[];for(t=a(t),m=t.length,r=z,n=0,s=I,u=0;m>u;++u)v=t[u],128>v&&w.push(E(v));for(e=i=w.length,i&&w.push(A);m>e;){for(h=x,u=0;m>u;++u)v=t[u],v>=r&&h>v&&(h=v);for(d=e+1,h-r>j((x-n)/d)&&o("overflow"),n+=(h-r)*d,r=h,u=0;m>u;++u)if(v=t[u],r>v&&++n>x&&o("overflow"),v==r){for(f=n,l=C;g=s>=l?S:l>=s+_?_:l-s,!(g>f);l+=C)b=f-g,y=C-g,w.push(E(c(g+b%y,0))),f=j(b/y);w.push(E(c(f,0))),s=p(n,d,e==i),n=0,++e}++n,++r}return w.join("")}function g(t){return s(t,function(t){return L.test(t)?f(t.slice(4).toLowerCase()):t})}function v(t){return s(t,function(t){return D.test(t)?"xn--"+l(t):t})}var m="object"==typeof n&&n&&!n.nodeType&&n,d="object"==typeof r&&r&&!r.nodeType&&r,y="object"==typeof t&&t;(y.global===y||y.window===y||y.self===y)&&(e=y);var b,w,x=2147483647,C=36,S=1,_=26,M=38,q=700,I=72,z=128,A="-",L=/^xn--/,D=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,V={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=C-S,j=Math.floor,E=String.fromCharCode;if(b={version:"1.3.2",ucs2:{decode:a,encode:u},decode:f,encode:l,toASCII:v,toUnicode:g},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return b});else if(m&&d)if(r.exports==m)d.exports=b;else for(w in b)b.hasOwnProperty(w)&&(m[w]=b[w]);else e.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,r,n){"use strict";function e(t,r){return Object.prototype.hasOwnProperty.call(t,r)}r.exports=function(t,r,n,i){r=r||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(r);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var h=t.length;u>0&&h>u&&(h=u);for(var c=0;h>c;++c){var p,f,l,g,v=t[c].replace(a,"%20"),m=v.indexOf(n);m>=0?(p=v.substr(0,m),f=v.substr(m+1)):(p=v,f=""),l=decodeURIComponent(p),g=decodeURIComponent(f),e(s,l)?o(s[l])?s[l].push(g):s[l]=[s[l],g]:s[l]=g}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],3:[function(t,r,n){"use strict";function e(t,r){if(t.map)return t.map(r);for(var n=[],e=0;e<t.length;e++)n.push(r(t[e],e));return n}var o=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};r.exports=function(t,r,n,a){return r=r||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?e(s(t),function(s){var a=encodeURIComponent(o(s))+n;return i(t[s])?e(t[s],function(t){return a+encodeURIComponent(o(t))}).join(r):a+encodeURIComponent(o(t[s]))}).join(r):a?encodeURIComponent(o(a))+n+encodeURIComponent(o(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=Object.keys||function(t){var r=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.push(n);return r}},{}],4:[function(t,r,n){"use strict";n.decode=n.parse=t("./decode"),n.encode=n.stringify=t("./encode")},{"./decode":2,"./encode":3}],5:[function(t,r,n){function e(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,r,n){if(t&&h(t)&&t instanceof e)return t;var o=new e;return o.parse(t,r,n),o}function i(t){return u(t)&&(t=o(t)),t instanceof e?t.format():e.prototype.format.call(t)}function s(t,r){return o(t,!1,!0).resolve(r)}function a(t,r){return t?o(t,!1,!0).resolveObject(r):r}function u(t){return"string"==typeof t}function h(t){return"object"==typeof t&&null!==t}function c(t){return null===t}function p(t){return null==t}var f=t("punycode");n.parse=o,n.resolve=s,n.resolveObject=a,n.format=i,n.Url=e;var l=/^([a-z0-9.+-]+:)/i,g=/:[0-9]*$/,v=["<",">",'"',"`"," ","\r","\n"," "],m=["{","}","|","\\","^","`"].concat(v),d=["'"].concat(m),y=["%","/","?",";","#"].concat(d),b=["/","?","#"],w=255,x=/^[a-z0-9A-Z_-]{0,63}$/,C=/^([a-z0-9A-Z_-]{0,63})(.*)$/,S={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},q=t("querystring");e.prototype.parse=function(t,r,n){if(!u(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var e=t;e=e.trim();var o=l.exec(e);if(o){o=o[0];var i=o.toLowerCase();this.protocol=i,e=e.substr(o.length)}if(n||o||e.match(/^\/\/[^@\/]+@[^@\/]+/)){var s="//"===e.substr(0,2);!s||o&&_[o]||(e=e.substr(2),this.slashes=!0)}if(!_[o]&&(s||o&&!M[o])){for(var a=-1,h=0;h<b.length;h++){var c=e.indexOf(b[h]);-1!==c&&(-1===a||a>c)&&(a=c)}var p,g;g=-1===a?e.lastIndexOf("@"):e.lastIndexOf("@",a),-1!==g&&(p=e.slice(0,g),e=e.slice(g+1),this.auth=decodeURIComponent(p)),a=-1;for(var h=0;h<y.length;h++){var c=e.indexOf(y[h]);-1!==c&&(-1===a||a>c)&&(a=c)}-1===a&&(a=e.length),this.host=e.slice(0,a),e=e.slice(a),this.parseHost(),this.hostname=this.hostname||"";var v="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!v)for(var m=this.hostname.split(/\./),h=0,I=m.length;I>h;h++){var z=m[h];if(z&&!z.match(x)){for(var A="",L=0,D=z.length;D>L;L++)A+=z.charCodeAt(L)>127?"x":z[L];if(!A.match(x)){var O=m.slice(0,h),V=m.slice(h+1),k=z.match(C);k&&(O.push(k[1]),V.unshift(k[2])),V.length&&(e="/"+V.join(".")+e),this.hostname=O.join(".");break}}}if(this.hostname=this.hostname.length>w?"":this.hostname.toLowerCase(),!v){for(var j=this.hostname.split("."),E=[],h=0;h<j.length;++h){var R=j[h];E.push(R.match(/[^A-Za-z0-9_-]/)?"xn--"+f.encode(R):R)}this.hostname=E.join(".")}var T=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+T,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==e[0]&&(e="/"+e))}if(!S[i])for(var h=0,I=d.length;I>h;h++){var U=d[h],B=encodeURIComponent(U);B===U&&(B=escape(U)),e=e.split(U).join(B)}var N=e.indexOf("#");-1!==N&&(this.hash=e.substr(N),e=e.slice(0,N));var H=e.indexOf("?");if(-1!==H?(this.search=e.substr(H),this.query=e.substr(H+1),r&&(this.query=q.parse(this.query)),e=e.slice(0,H)):r&&(this.search="",this.query={}),e&&(this.pathname=e),M[i]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var T=this.pathname||"",R=this.search||"";this.path=T+R}return this.href=this.format(),this},e.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var r=this.protocol||"",n=this.pathname||"",e=this.hash||"",o=!1,i="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&h(this.query)&&Object.keys(this.query).length&&(i=q.stringify(this.query));var s=this.search||i&&"?"+i||"";return r&&":"!==r.substr(-1)&&(r+=":"),this.slashes||(!r||M[r])&&o!==!1?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),e&&"#"!==e.charAt(0)&&(e="#"+e),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),s=s.replace("#","%23"),r+o+n+s+e},e.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},e.prototype.resolveObject=function(t){if(u(t)){var r=new e;r.parse(t,!1,!0),t=r}var n=new e;if(Object.keys(this).forEach(function(t){n[t]=this[t]},this),n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(r){"protocol"!==r&&(n[r]=t[r])}),M[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n;if(t.protocol&&t.protocol!==n.protocol){if(!M[t.protocol])return Object.keys(t).forEach(function(r){n[r]=t[r]}),n.href=n.format(),n;if(n.protocol=t.protocol,t.host||_[t.protocol])n.pathname=t.pathname;else{for(var o=(t.pathname||"").split("/");o.length&&!(t.host=o.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==o[0]&&o.unshift(""),o.length<2&&o.unshift(""),n.pathname=o.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var i=n.pathname||"",s=n.search||"";n.path=i+s}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var a=n.pathname&&"/"===n.pathname.charAt(0),h=t.host||t.pathname&&"/"===t.pathname.charAt(0),f=h||a||n.host&&t.pathname,l=f,g=n.pathname&&n.pathname.split("/")||[],o=t.pathname&&t.pathname.split("/")||[],v=n.protocol&&!M[n.protocol];if(v&&(n.hostname="",n.port=null,n.host&&(""===g[0]?g[0]=n.host:g.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===o[0]?o[0]=t.host:o.unshift(t.host)),t.host=null),f=f&&(""===o[0]||""===g[0])),h)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,g=o;else if(o.length)g||(g=[]),g.pop(),g=g.concat(o),n.search=t.search,n.query=t.query;else if(!p(t.search)){if(v){n.hostname=n.host=g.shift();var m=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;m&&(n.auth=m.shift(),n.host=n.hostname=m.shift())}return n.search=t.search,n.query=t.query,c(n.pathname)&&c(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!g.length)return n.pathname=null,n.path=n.search?"/"+n.search:null,n.href=n.format(),n;for(var d=g.slice(-1)[0],y=(n.host||t.host)&&("."===d||".."===d)||""===d,b=0,w=g.length;w>=0;w--)d=g[w],"."==d?g.splice(w,1):".."===d?(g.splice(w,1),b++):b&&(g.splice(w,1),b--);if(!f&&!l)for(;b--;b)g.unshift("..");!f||""===g[0]||g[0]&&"/"===g[0].charAt(0)||g.unshift(""),y&&"/"!==g.join("/").substr(-1)&&g.push("");var x=""===g[0]||g[0]&&"/"===g[0].charAt(0);if(v){n.hostname=n.host=x?"":g.length?g.shift():"";var m=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;m&&(n.auth=m.shift(),n.host=n.hostname=m.shift())}return f=f||n.host&&g.length,f&&!x&&g.unshift(""),g.length?n.pathname=g.join("/"):(n.pathname=null,n.path=null),c(n.pathname)&&c(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},e.prototype.parseHost=function(){var t=this.host,r=g.exec(t);r&&(r=r[0],":"!==r&&(this.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(this.hostname=t)}},{punycode:1,querystring:4}],6:[function(t,r,n){if(!e)var e={map:function(t,r){var n={};return r?t.map(function(t,e){return n.index=e,r.call(n,t)}):t.slice()},naturalOrder:function(t,r){return r>t?-1:t>r?1:0},sum:function(t,r){var n={};return t.reduce(r?function(t,e,o){return n.index=o,t+r.call(n,e)}:function(t,r){return t+r},0)},max:function(t,r){return Math.max.apply(null,r?e.map(t,r):t)}};var o=function(){function t(t,r,n){return(t<<2*h)+(r<<h)+n}function r(t){function r(){n.sort(t),e=!0}var n=[],e=!1;return{push:function(t){n.push(t),e=!1},peek:function(t){return e||r(),void 0===t&&(t=n.length-1),n[t]},pop:function(){return e||r(),n.pop()},size:function(){return n.length},map:function(t){return n.map(t)},debug:function(){return e||r(),n}}}function n(t,r,n,e,o,i,s){var a=this;a.r1=t,a.r2=r,a.g1=n,a.g2=e,a.b1=o,a.b2=i,a.histo=s}function o(){this.vboxes=new r(function(t,r){return e.naturalOrder(t.vbox.count()*t.vbox.volume(),r.vbox.count()*r.vbox.volume())})}function i(r){var n,e,o,i,s=1<<3*h,a=new Array(s);return r.forEach(function(r){e=r[0]>>c,o=r[1]>>c,i=r[2]>>c,n=t(e,o,i),a[n]=(a[n]||0)+1}),a}function s(t,r){var e,o,i,s=1e6,a=0,u=1e6,h=0,p=1e6,f=0;return t.forEach(function(t){e=t[0]>>c,o=t[1]>>c,i=t[2]>>c,s>e?s=e:e>a&&(a=e),u>o?u=o:o>h&&(h=o),p>i?p=i:i>f&&(f=i)}),new n(s,a,u,h,p,f,r)}function a(r,n){function o(t){var r,e,o,i,s,a=t+"1",u=t+"2",c=0;for(h=n[a];h<=n[u];h++)if(v[h]>g/2){for(o=n.copy(),i=n.copy(),r=h-n[a],e=n[u]-h,s=e>=r?Math.min(n[u]-1,~~(h+e/2)):Math.max(n[a],~~(h-1-r/2));!v[s];)s++;for(c=m[s];!c&&v[s-1];)c=m[--s];return o[u]=s,i[a]=o[u]+1,[o,i]}}if(n.count()){var i=n.r2-n.r1+1,s=n.g2-n.g1+1,a=n.b2-n.b1+1,u=e.max([i,s,a]);if(1==n.count())return[n.copy()];var h,c,p,f,l,g=0,v=[],m=[];if(u==i)for(h=n.r1;h<=n.r2;h++){for(f=0,c=n.g1;c<=n.g2;c++)for(p=n.b1;p<=n.b2;p++)l=t(h,c,p),f+=r[l]||0;g+=f,v[h]=g}else if(u==s)for(h=n.g1;h<=n.g2;h++){for(f=0,c=n.r1;c<=n.r2;c++)for(p=n.b1;p<=n.b2;p++)l=t(c,h,p),f+=r[l]||0;g+=f,v[h]=g}else for(h=n.b1;h<=n.b2;h++){for(f=0,c=n.r1;c<=n.r2;c++)for(p=n.g1;p<=n.g2;p++)l=t(c,p,h),f+=r[l]||0;g+=f,v[h]=g}return v.forEach(function(t,r){m[r]=g-t}),o(u==i?"r":u==s?"g":"b")}}function u(t,n){function u(t,r){for(var n,e=1,o=0;p>o;)if(n=t.pop(),n.count()){var i=a(h,n),s=i[0],u=i[1];if(!s)return;if(t.push(s),u&&(t.push(u),e++),e>=r)return;if(o++>p)return}else t.push(n),o++}if(!t.length||2>n||n>256)return!1;var h=i(t),c=0;h.forEach(function(){c++});var l=s(t,h),g=new r(function(t,r){return e.naturalOrder(t.count(),r.count())});g.push(l),u(g,f*n);for(var v=new r(function(t,r){return e.naturalOrder(t.count()*t.volume(),r.count()*r.volume())});g.size();)v.push(g.pop());u(v,n-v.size());for(var m=new o;v.size();)m.push(v.pop());return m}var h=5,c=8-h,p=1e3,f=.75;return n.prototype={volume:function(t){var r=this;return(!r._volume||t)&&(r._volume=(r.r2-r.r1+1)*(r.g2-r.g1+1)*(r.b2-r.b1+1)),r._volume},count:function(r){var n=this,e=n.histo;if(!n._count_set||r){var o,i,s,a=0;for(o=n.r1;o<=n.r2;o++)for(i=n.g1;i<=n.g2;i++)for(s=n.b1;s<=n.b2;s++)index=t(o,i,s),a+=e[index]||0;n._count=a,n._count_set=!0}return n._count},copy:function(){var t=this;return new n(t.r1,t.r2,t.g1,t.g2,t.b1,t.b2,t.histo)},avg:function(r){var n=this,e=n.histo;if(!n._avg||r){var o,i,s,a,u,c=0,p=1<<8-h,f=0,l=0,g=0;for(i=n.r1;i<=n.r2;i++)for(s=n.g1;s<=n.g2;s++)for(a=n.b1;a<=n.b2;a++)u=t(i,s,a),o=e[u]||0,c+=o,f+=o*(i+.5)*p,l+=o*(s+.5)*p,g+=o*(a+.5)*p;n._avg=c?[~~(f/c),~~(l/c),~~(g/c)]:[~~(p*(n.r1+n.r2+1)/2),~~(p*(n.g1+n.g2+1)/2),~~(p*(n.b1+n.b2+1)/2)]}return n._avg},contains:function(t){var r=this,n=t[0]>>c;return gval=t[1]>>c,bval=t[2]>>c,n>=r.r1&&n<=r.r2&&gval>=r.g1&&gval<=r.g2&&bval>=r.b1&&bval<=r.b2}},o.prototype={push:function(t){this.vboxes.push({vbox:t,color:t.avg()})},palette:function(){return this.vboxes.map(function(t){return t.color})},size:function(){return this.vboxes.size()},map:function(t){for(var r=this.vboxes,n=0;n<r.size();n++)if(r.peek(n).vbox.contains(t))return r.peek(n).color;return this.nearest(t)},nearest:function(t){for(var r,n,e,o=this.vboxes,i=0;i<o.size();i++)n=Math.sqrt(Math.pow(t[0]-o.peek(i).color[0],2)+Math.pow(t[1]-o.peek(i).color[1],2)+Math.pow(t[2]-o.peek(i).color[2],2)),(r>n||void 0===r)&&(r=n,e=o.peek(i).color);return e},forcebw:function(){var t=this.vboxes;t.sort(function(t,r){return e.naturalOrder(e.sum(t.color),e.sum(r.color))});var r=t[0].color;r[0]<5&&r[1]<5&&r[2]<5&&(t[0].color=[0,0,0]);var n=t.length-1,o=t[n].color;o[0]>251&&o[1]>251&&o[2]>251&&(t[n].color=[255,255,255])}},{quantize:u}}();r.exports=o.quantize},{}],7:[function(t,r,n){var e;e=t("./vibrant"),e.DefaultOpts.Image=t("./image/browser"),r.exports=e},{"./image/browser":13,"./vibrant":26}],8:[function(t,r,n){var e;window.Vibrant=e=t("./browser")},{"./browser":7}],9:[function(t,r,n){r.exports=function(t,r,n,e){return e>=125&&!(t>250&&r>250&&n>250)}},{}],10:[function(t,r,n){r.exports.Default=t("./default")},{"./default":9}],11:[function(t,r,n){var e,o,i,s,a,u=function(t,r){function n(){this.constructor=t}for(var e in r)h.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},h={}.hasOwnProperty,c=[].slice;s=t("../swatch"),a=t("../util"),i=t("./index"),o={targetDarkLuma:.26,maxDarkLuma:.45,minLightLuma:.55,targetLightLuma:.74,minNormalLuma:.3,targetNormalLuma:.5,maxNormalLuma:.7,targetMutesSaturation:.3,maxMutesSaturation:.4,targetVibrantSaturation:1,minVibrantSaturation:.35,weightSaturation:3,weightLuma:6,weightPopulation:1},r.exports=e=function(t){function r(t){this.opts=a.defaults(t,o),this.VibrantSwatch=null,this.LightVibrantSwatch=null,this.DarkVibrantSwatch=null,this.MutedSwatch=null,this.LightMutedSwatch=null,this.DarkMutedSwatch=null}return u(r,t),r.prototype.HighestPopulation=0,r.prototype.generate=function(t){return this.swatches=t,this.maxPopulation=this.findMaxPopulation,this.generateVarationColors(),this.generateEmptySwatches()},r.prototype.getVibrantSwatch=function(){return this.VibrantSwatch},r.prototype.getLightVibrantSwatch=function(){return this.LightVibrantSwatch},r.prototype.getDarkVibrantSwatch=function(){return this.DarkVibrantSwatch},r.prototype.getMutedSwatch=function(){return this.MutedSwatch},r.prototype.getLightMutedSwatch=function(){return this.LightMutedSwatch},r.prototype.getDarkMutedSwatch=function(){return this.DarkMutedSwatch},r.prototype.generateVarationColors=function(){return this.VibrantSwatch=this.findColorVariation(this.opts.targetNormalLuma,this.opts.minNormalLuma,this.opts.maxNormalLuma,this.opts.targetVibrantSaturation,this.opts.minVibrantSaturation,1),this.LightVibrantSwatch=this.findColorVariation(this.opts.targetLightLuma,this.opts.minLightLuma,1,this.opts.targetVibrantSaturation,this.opts.minVibrantSaturation,1),this.DarkVibrantSwatch=this.findColorVariation(this.opts.targetDarkLuma,0,this.opts.maxDarkLuma,this.opts.targetVibrantSaturation,this.opts.minVibrantSaturation,1),this.MutedSwatch=this.findColorVariation(this.opts.targetNormalLuma,this.opts.minNormalLuma,this.opts.maxNormalLuma,this.opts.targetMutesSaturation,0,this.opts.maxMutesSaturation),this.LightMutedSwatch=this.findColorVariation(this.opts.targetLightLuma,this.opts.minLightLuma,1,this.opts.targetMutesSaturation,0,this.opts.maxMutesSaturation),this.DarkMutedSwatch=this.findColorVariation(this.opts.targetDarkLuma,0,this.opts.maxDarkLuma,this.opts.targetMutesSaturation,0,this.opts.maxMutesSaturation)},r.prototype.generateEmptySwatches=function(){var t;return null===this.VibrantSwatch&&null!==this.DarkVibrantSwatch&&(t=this.DarkVibrantSwatch.getHsl(),t[2]=this.opts.targetNormalLuma,this.VibrantSwatch=new s(a.hslToRgb(t[0],t[1],t[2]),0)),null===this.DarkVibrantSwatch&&null!==this.VibrantSwatch?(t=this.VibrantSwatch.getHsl(),t[2]=this.opts.targetDarkLuma,this.DarkVibrantSwatch=new s(a.hslToRgb(t[0],t[1],t[2]),0)):void 0},r.prototype.findMaxPopulation=function(){var t,r,n,e,o;for(n=0,e=this.swatches,t=0,r=e.length;r>t;t++)o=e[t],n=Math.max(n,o.getPopulation());return n},r.prototype.findColorVariation=function(t,r,n,e,o,i){var s,a,u,h,c,p,f,l,g;for(h=null,c=0,p=this.swatches,s=0,a=p.length;a>s;s++)l=p[s],f=l.getHsl()[1],u=l.getHsl()[2],f>=o&&i>=f&&u>=r&&n>=u&&!this.isAlreadySelected(l)&&(g=this.createComparisonValue(f,e,u,t,l.getPopulation(),this.HighestPopulation),(null===h||g>c)&&(h=l,c=g));return h},r.prototype.createComparisonValue=function(t,r,n,e,o,i){return this.weightedMean(this.invertDiff(t,r),this.opts.weightSaturation,this.invertDiff(n,e),this.opts.weightLuma,o/i,this.opts.weightPopulation)},r.prototype.invertDiff=function(t,r){return 1-Math.abs(t-r)},r.prototype.weightedMean=function(){var t,r,n,e,o,i;for(o=1<=arguments.length?c.call(arguments,0):[],r=0,n=0,t=0;t<o.length;)e=o[t],i=o[t+1],r+=e*i,n+=i,t+=2;return r/n},r.prototype.isAlreadySelected=function(t){return this.VibrantSwatch===t||this.DarkVibrantSwatch===t||this.LightVibrantSwatch===t||this.MutedSwatch===t||this.DarkMutedSwatch===t||this.LightMutedSwatch===t},r}(i)},{"../swatch":24,"../util":25,"./index":12}],12:[function(t,r,n){var e;r.exports=e=function(){function t(){}return t.prototype.generate=function(t){},t.prototype.getVibrantSwatch=function(){},t.prototype.getLightVibrantSwatch=function(){},t.prototype.getDarkVibrantSwatch=function(){},t.prototype.getMutedSwatch=function(){},t.prototype.getLightMutedSwatch=function(){},t.prototype.getDarkMutedSwatch=function(){},t}(),r.exports.Default=t("./default")},{"./default":11}],13:[function(t,r,n){var e,o,i,s,a,u=function(t,r){function n(){this.constructor=t}for(var e in r)h.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},h={}.hasOwnProperty;o=t("./index"),i=t("url"),s=function(t){var r;return r=i.parse(t),null===r.protocol&&null===r.host&&null===r.port},a=function(t,r){var n,e;return n=i.parse(t),e=i.parse(r),n.protocol===e.protocol&&n.hostname===e.hostname&&n.port===e.port},r.exports=e=function(t){function r(t,r){this.img=document.createElement("img"),s(t)||a(window.location.href,t)||(this.img.crossOrigin="anonymous"),this.img.src=t,this.img.onload=function(t){return function(){return t._initCanvas(),"function"==typeof r?r(null,t):void 0}}(this),this.img.onerror=function(n){return function(n){var e;return e=new Error("Fail to load image: "+t),e.raw=n,"function"==typeof r?r(e):void 0}}(this)}return u(r,t),r.prototype._initCanvas=function(){return this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),document.body.appendChild(this.canvas),this.width=this.canvas.width=this.img.width,this.height=this.canvas.height=this.img.height,this.context.drawImage(this.img,0,0,this.width,this.height)},r.prototype.clear=function(){return this.context.clearRect(0,0,this.width,this.height)},r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.resize=function(t,r,n){return this.width=this.canvas.width=t,this.height=this.canvas.height=r,this.context.scale(n,n),this.context.drawImage(this.img,0,0)},r.prototype.update=function(t){return this.context.putImageData(t,0,0)},r.prototype.getPixelCount=function(){return this.width*this.height},r.prototype.getImageData=function(){return this.context.getImageData(0,0,this.width,this.height)},r.prototype.removeCanvas=function(){return this.canvas.parentNode.removeChild(this.canvas)},r}(o)},{"./index":14,url:5}],14:[function(t,r,n){var e;r.exports=e=function(){function t(){}return t.prototype.clear=function(){},t.prototype.update=function(t){},t.prototype.getWidth=function(){},t.prototype.getHeight=function(){},t.prototype.scaleDown=function(t){var r,n,e,o;return o=this.getWidth(),r=this.getHeight(),e=1,null!=t.maxDimension?(n=Math.max(o,r),n>t.maxDimension&&(e=t.maxDimension/n)):e=1/t.quality,1>e?this.resize(o*e,r*e,e):void 0},t.prototype.resize=function(t,r,n){},t.prototype.getPixelCount=function(){},t.prototype.getImageData=function(){},t.prototype.removeCanvas=function(){},t}()},{}],15:[function(t,r,n){var e,o,i,s,a=function(t,r){function n(){this.constructor=t}for(var e in r)u.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},u={}.hasOwnProperty;i=t("../swatch"),o=t("./index"),s=t("quantize"),r.exports=e=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return a(r,t),r.prototype.initialize=function(t,r){var n,e,o,a,u,h,c,p,f;for(this.opts=r,p=t.length/4,e=[],h=0;p>h;)c=4*h,f=t[c+0],u=t[c+1],o=t[c+2],n=t[c+3],n>=125&&(f>250&&u>250&&o>250||e.push([f,u,o])),h+=this.opts.quality;return a=s(e,this.opts.colorCount),this.swatches=a.vboxes.map(function(t){return function(t){return new i(t.color,t.vbox.count())}}(this))},r.prototype.getQuantizedColors=function(){return this.swatches},r}(o)},{"../swatch":24,"./index":21,quantize:6}],16:[function(t,r,n){var e,o,i,s,a=function(t,r){function n(){this.constructor=t}for(var e in r)u.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},u={}.hasOwnProperty;s=t("../swatch"),i=t("./index"),e=t("./impl/color-cut"),r.exports=o=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return a(r,t),r.prototype.initialize=function(t,r){var n,o,i;return this.opts=r,n=new ArrayBuffer(t.length),o=new Uint8ClampedArray(n),i=new Uint32Array(n),o.set(t),this.quantizer=new e(i,this.opts)},r.prototype.getQuantizedColors=function(){return this.quantizer.getQuantizedColors()},r}(i)},{"../swatch":24,"./impl/color-cut":17,"./index":21}],17:[function(t,r,n){var e,o,i,s,a,u,h,c,p,f,l,g,v,m,d,y,b,w,x,C;f=t("../../swatch"),C=function(t,r,n){var e,o,i;return i=function(r,n){var e;return e=t[r],t[r]=t[n],t[n]=e},e=function(r,n,e){var o,s,a,u,h,c;for(o=n,c=t[r],i(r,e),h=s=a=n,u=e-1;u>=a?u>=s:s>=u;h=u>=a?++s:--s)t[h]>c&&(i(h,o),o++);return i(e,o),o},n>r?(o=r+Math.ceil((n-r)/2),o=e(o,r,n),C(t,r,o-1),C(t,o+1,n)):void 0},s=-3,i=-2,o=-1,c=5,h=(1<<c)-1,p={red:function(t){return t>>24},green:function(t){return t<<8>>24},blue:function(t){return t<<16>>24},alpha:function(t){return t<<24>>24}},e={red:function(t){return t<<24>>24},green:function(t){return t<<16>>24},blue:function(t){return t<<8>>24},alpha:function(t){return t>>24}},v=function(){var t,r,n;if(t=new ArrayBuffer(4),r=new Uint8Array(t),n=new Uint32Array(t),r[0]=161,r[1]=178,r[2]=195,r[3]=212,3569595041===n[0])return!0;if(2712847316===n[0])return!1;throw new Error("Failed to determin endianness")},a=v()?e:p,d=function(t,r,n){var e;return e=0,e=n>r?t<<n-r:t>>r-n,e&(1<<n)-1},m=function(t,r,n,e){var a,u,h,p,f,l,g,v;switch(r){case s:break;case i:for(u=h=f=n,l=e;l>=f?l>=h:h>=l;u=l>=f?++h:--h)a=t[u],t[u]=w(a)<<c+c|x(a)<<c|b(a);break;case o:for(u=p=g=n,v=e;v>=g?v>=p:p>=v;u=v>=g?++p:--p)a=t[u],t[u]=b(a)<<c+c|w(a)<<c|x(a)}},y=function(t){var r,n,e;return e=d(a.red(t),8,c),n=d(a.green(t),8,c),r=d(a.blue(t),8,c),e<<c+c|n<<c|r},g=function(t,r,n){var e;return(null==r||null==n)&&(e=t,t=x(e),r=w(e),n=b(e)),[d(t,c,8),d(r,c,8),d(n,c,8)]},x=function(t){return t>>c+c&h},w=function(t){return t>>c&h},b=function(t){return t&h},r.exports=u=function(){function t(t,r){var n,e,o,i,s,a,u,h,p,l,v,m,d,b;for(this.opts=r,this.hist=new Uint32Array(1<<3*c),this.pixels=new Uint32Array(t.length),s=a=0,v=t.length-1;v>=0?v>=a:a>=v;s=v>=0?++a:--a)this.pixels[s]=l=y(t[s]),this.hist[l]++;for(o=0,e=u=0,m=this.hist.length-1;m>=0?m>=u:u>=m;e=m>=0?++u:--u)this.hist[e]>0&&o++;for(this.colors=new Uint32Array(o),i=0,e=h=0,d=this.hist.length-1;d>=0?d>=h:h>=d;e=d>=0?++h:--h)this.hist[e]>0&&(this.colors[i++]=e);if(o<=this.opts.colorCount)for(this.quantizedColors=[],s=p=0,b=this.colors.length-1;b>=0?b>=p:p>=b;s=b>=0?++p:--p)n=this.colors[s],this.quantizedColors.push(new f(g(n),this.hist[n]));else this.quantizedColors=this.quantizePixels(this.opts.colorCount)}return t.prototype.getQuantizedColors=function(){return this.quantizedColors},t.prototype.quantizePixels=function(t){var r;return r=new PriorityQueue({comparator:l.comparator}),r.queue(new l(this.colors,this.hist,0,this.colors.length-1)),this.splitBoxes(r,t),this.generateAverageColors(r)},t.prototype.splitBoxes=function(t,r){for(var n;t.length<r;){if(n=t.dequeue(),null!=n?!n.canSplit():!0)return;t.queue(n.splitBox()),t.queue(n)}},t.prototype.generateAverageColors=function(t){var r;for(r=[];t.length>0;)r.push(t.dequeue().getAverageColor());return r},t}(),l=function(){function t(t,r,n,e){this.colors=t,this.hist=r,this.lowerIndex=n,this.upperIndex=e,this.fitBox()}return t.comparator=function(t,r){return t.getVolume()-r.getVolume()},t.prototype.getVolume=function(){return(this.maxRed-this.minRed+1)*(this.maxGreen-this.minGreen+1)*(this.maxBlue-this.minBlue+1)},t.prototype.canSplit=function(){return this.getColorCount()>1},t.prototype.getColorCount=function(){return 1+this.upperIndex-this.lowerIndex},t.prototype.fitBox=function(){var t,r,n,e,o,i,s,a,u;for(this.minRed=this.minGreen=this.minBlue=Number.MAX_VALUE,this.maxRed=this.maxGreen=this.maxBlue=Number.MIN_VALUE,this.population=0,n=0,o=i=a=this.lowerIndex,u=this.upperIndex;u>=a?u>=i:i>=u;o=u>=a?++i:--i)r=this.colors[o],n+=this.hist[r],s=x(r),e=w(r),t=b(r),s>this.maxRed&&(this.maxRed=s),s<this.minRed&&(this.minRed=s),e>this.maxGreen&&(this.maxGreen=e),e<this.minGreen&&(this.minGreen=e),t>this.maxBlue&&(this.maxRed=t),t<this.minBlue&&(this.minRed=t);return this.population=n},t.prototype.splitBox=function(){var r,n;if(!this.canSplit())throw new Error("Cannot split a box with only 1 color");return n=this.findSplitPoint(),r=new t(this.colors,this.hist,n+1,this.upperIndex),this.upperIndex=n,this.fitBox(),r},t.prototype.getLongestColorDimension=function(){var t,r,n;return n=this.maxRed-this.minRed,r=this.maxGreen-this.minGreen,t=this.maxBlue-this.minBlue,n>=r&&n>=t?s:r>=n&&r>=t?i:o},t.prototype.findSplitPoint=function(){var t,r,n,e,o,i,s;for(e=this.getLongestColorDimension(),m(this.colors,e,this.lowerIndex,this.upperIndex),C(this.colors,this.lowerIndex,this.upperIndex+1),m(this.colors,e,this.lowerIndex,this.upperIndex),o=this.population/2,t=0,r=n=i=this.lowerIndex,s=this.upperIndex;s>=i?s>=n:n>=s;r=s>=i?++n:--n)if(t+=this.hist[this.colors[r]],t>=o)return r;return this.lowerIndex},t.prototype.getAverageColor=function(){var t,r,n,e,o,i,s,a,u,h,c,p,l;for(h=i=r=0,l=0,s=a=c=this.lowerIndex,p=this.upperIndex;p>=c?p>=a:a>=p;s=p>=c?++a:--a)n=this.colors[s],e=this.hist[n],l+=e,h+=e*x(n),i+=e*w(n),r+=e*b(n);return u=Math.round(h/l),o=Math.round(i/l),t=Math.round(r/l),new f(g(u,o,t),l)},t}()},{"../../swatch":24}],18:[function(t,r,n){var e,o,i,s,a,u,h,c,p;c=p=t("../../util"),h=c.getColorIndex,s=c.SIGBITS,i=c.RSHIFT,a=t("../../swatch"),u=t("./vbox"),o=t("./pqueue"),r.exports=e=function(){function t(t){this.opts=p.defaults(t,this.constructor.DefaultOpts)}return t.DefaultOpts={maxIterations:1e3,fractByPopulations:.75},t.prototype.quantize=function(t,r){var n,e,i,s,h,c,p,f,l;if(0===t.length||r.colorCount<2||r.colorCount>256)throw new Error("Wrong MMCQ parameters");for(c=function(){return!1},Array.isArray(r.filters)&&r.filters.length>0&&(c=function(t,n,e,o){var i,s,a,u;for(u=r.filters,s=0,a=u.length;a>s;s++)if(i=u[s],!i(t,n,e,o))return!0;return!1}),l=u.build(t,c),i=l.hist,e=Object.keys(i).length,s=new o(function(t,r){return t.count()-r.count()}),s.push(l),this._splitBoxes(s,this.opts.fractByPopulations*r.colorCount),h=new o(function(t,r){return t.count()*t.volume()-r.count()*r.volume()}),h.contents=s.contents,this._splitBoxes(h,r.colorCount-h.size()),p=[],this.vboxes=[];h.size();)f=h.pop(),n=f.avg(),("function"==typeof c?c(n[0],n[1],n[2],255):void 0)||(this.vboxes.push(f),p.push(new a(n,f.count())));return p},t.prototype._splitBoxes=function(t,r){var n,e,o,i,s,a,u;for(n=1,e=0,o=this.opts.maxIterations;o>e;)if(e++,s=t.pop(),s.count()&&(i=s.split(),a=i[0],u=i[1],t.push(a),u&&(t.push(u),n++),n>=r||e>o))return},t}()},{"../../swatch":24,"../../util":25,"./pqueue":19,"./vbox":20}],19:[function(t,r,n){var e;r.exports=e=function(){function t(t){this.comparator=t,this.contents=[],this.sorted=!1}return t.prototype._sort=function(){return this.contents.sort(this.comparator),
this.sorted=!0},t.prototype.push=function(t){return this.contents.push(t),this.sorted=!1},t.prototype.peek=function(t){return this.sorted||this._sort(),null==t&&(t=this.contents.length-1),this.contents[t]},t.prototype.pop=function(){return this.sorted||this._sort(),this.contents.pop()},t.prototype.size=function(){return this.contents.length},t.prototype.map=function(t){return this.sorted||this._sort(),this.contents.map(t)},t}()},{}],20:[function(t,r,n){var e,o,i,s,a,u;a=u=t("../../util"),s=a.getColorIndex,o=a.SIGBITS,e=a.RSHIFT,r.exports=i=function(){function t(t,r,n,e,o,i,s){this.r1=t,this.r2=r,this.g1=n,this.g2=e,this.b1=o,this.b2=i,this.hist=s}return t.build=function(r,n){var i,a,u,h,c,p,f,l,g,v,m,d,y,b,w,x;for(g=1<<3*o,l=new Uint32Array(g),w=p=u=0,x=f=h=Number.MAX_VALUE,d=r.length/4,v=0;d>v;)y=4*v,v++,b=r[y+0],c=r[y+1],a=r[y+2],i=r[y+3],n(b,c,a,i)||(b>>=e,c>>=e,a>>=e,m=s(b,c,a),l[m]+=1,b>w&&(w=b),x>b&&(x=b),c>p&&(p=c),f>c&&(f=c),a>u&&(u=a),h>a&&(h=a));return new t(x,w,f,p,h,u,l)},t.prototype.invalidate=function(){return delete this._count,delete this._avg,delete this._volume},t.prototype.volume=function(){return null==this._volume&&(this._volume=(this.r2-this.r1+1)*(this.g2-this.g1+1)*(this.b2-this.b1+1)),this._volume},t.prototype.count=function(){var t,r;if(null==this._count){r=this.hist,t=0;for(var n=this.r1;n<=this.r2;n++)for(var e=this.g1;e<=this.g2;e++)for(var o=this.b1;o<=this.b2;o++){var i=s(n,e,o);t+=r[i]}this._count=t}return this._count},t.prototype.clone=function(){return new t(this.r1,this.r2,this.g1,this.g2,this.b1,this.b2,this.hist)},t.prototype.avg=function(){var t,r,n,e,i,a;if(null==this._avg){n=this.hist,i=0,e=1<<8-o,a=r=t=0;for(var u=this.r1;u<=this.r2;u++)for(var h=this.g1;h<=this.g2;h++)for(var c=this.b1;c<=this.b2;c++){var p=s(u,h,c),f=n[p];i+=f,a+=f*(u+.5)*e,r+=f*(h+.5)*e,t+=f*(c+.5)*e}this._avg=i?[~~(a/i),~~(r/i),~~(t/i)]:[~~(e*(this.r1+this.r2+1)/2),~~(e*(this.g1+this.g2+1)/2),~~(e*(this.b1+this.b2+1)/2)]}return this._avg},t.prototype.split=function(){var t,r,n,e,o,i,a,u,h,c,p,f,l,g,v,m,d;if(i=this.hist,!this.count())return null;if(1===this.count())return[this.clone()];switch(l=this.r2-this.r1+1,o=this.g2-this.g1+1,r=this.b2-this.b1+1,c=Math.max(l,o,r),t=null,v=m=0,h=null,c){case l:h="r",t=new Uint32Array(this.r2+1);for(var y=this.r1;y<=this.r2;y++){v=0;for(var b=this.g1;b<=this.g2;b++)for(var w=this.b1;w<=this.b2;w++){var x=s(y,b,w);v+=i[x]}m+=v,t[y]=m}break;case o:h="g",t=new Uint32Array(this.g2+1);for(var b=this.g1;b<=this.g2;b++){v=0;for(var y=this.r1;y<=this.r2;y++)for(var w=this.b1;w<=this.b2;w++){var x=s(y,b,w);v+=i[x]}m+=v,t[b]=m}break;case r:h="b",t=new Uint32Array(this.b2+1);for(var w=this.b1;w<=this.b2;w++){v=0;for(var y=this.r1;y<=this.r2;y++)for(var b=this.g1;b<=this.g2;b++){var x=s(y,b,w);v+=i[x]}m+=v,t[w]=m}}for(g=-1,f=new Uint32Array(t.length),a=u=0,p=t.length-1;p>=0?p>=u:u>=p;a=p>=0?++u:--u)n=t[a],0>g&&n>m/2&&(g=a),f[a]=m-n;return d=this,(e=function(r){var n,e,o,i,s,a,u,h,c;for(i=r+"1",s=r+"2",e=d[i],o=d[s],h=d.clone(),c=d.clone(),a=g-e,u=o-g,u>=a?(o=Math.min(o-1,~~(g+u/2)),o=Math.max(0,o)):(o=Math.max(e,~~(g-1-a/2)),o=Math.min(d[s],o));!t[o];)o++;for(n=f[o];!n&&t[o-1];)n=f[--o];return h[s]=o,c[i]=o+1,[h,c]})(h)},t.prototype.contains=function(t){var r,n,o;return o=t[0]>>e,n=t[1]>>e,r=t[2]>>e,o>=this.r1&&o<=this.r2&&n>=this.g1&&n<=this.g2&&r>=this.b1&&r<=this.b2},t}()},{"../../util":25}],21:[function(t,r,n){var e;r.exports=e=function(){function t(){}return t.prototype.initialize=function(t,r){},t.prototype.getQuantizedColors=function(){},t}(),r.exports.Baseline=t("./baseline"),r.exports.NoCopy=t("./nocopy"),r.exports.ColorCut=t("./color-cut"),r.exports.MMCQ=t("./mmcq")},{"./baseline":15,"./color-cut":16,"./mmcq":22,"./nocopy":23}],22:[function(t,r,n){var e,o,i,s,a=function(t,r){function n(){this.constructor=t}for(var e in r)u.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},u={}.hasOwnProperty;s=t("../swatch"),i=t("./index"),o=t("./impl/mmcq"),r.exports=e=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return a(r,t),r.prototype.initialize=function(t,r){var n;return this.opts=r,n=new o,this.swatches=n.quantize(t,this.opts)},r.prototype.getQuantizedColors=function(){return this.swatches},r}(i)},{"../swatch":24,"./impl/mmcq":18,"./index":21}],23:[function(t,r,n){var e,o,i,s,a=function(t,r){function n(){this.constructor=t}for(var e in r)u.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},u={}.hasOwnProperty;i=t("../swatch"),o=t("./index"),s=t("../../vendor-mod/quantize"),r.exports=e=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return a(r,t),r.prototype.initialize=function(t,r){var n;return this.opts=r,n=s(t,this.opts),this.swatches=n.vboxes.map(function(t){return function(t){return new i(t.color,t.vbox.count())}}(this))},r.prototype.getQuantizedColors=function(){return this.swatches},r}(o)},{"../../vendor-mod/quantize":27,"../swatch":24,"./index":21}],24:[function(t,r,n){var e,o;o=t("./util"),r.exports=e=function(){function t(t,r){this.rgb=t,this.population=r}return t.prototype.hsl=void 0,t.prototype.rgb=void 0,t.prototype.population=1,t.prototype.yiq=0,t.prototype.getHsl=function(){return this.hsl?this.hsl:this.hsl=o.rgbToHsl(this.rgb[0],this.rgb[1],this.rgb[2])},t.prototype.getPopulation=function(){return this.population},t.prototype.getRgb=function(){return this.rgb},t.prototype.getHex=function(){return o.rgbToHex(this.rgb[0],this.rgb[1],this.rgb[2])},t.prototype.getTitleTextColor=function(){return this._ensureTextColors(),this.yiq<200?"#fff":"#000"},t.prototype.getBodyTextColor=function(){return this._ensureTextColors(),this.yiq<150?"#fff":"#000"},t.prototype._ensureTextColors=function(){return this.yiq?void 0:this.yiq=(299*this.rgb[0]+587*this.rgb[1]+114*this.rgb[2])/1e3},t}()},{"./util":25}],25:[function(t,r,n){var e,o,i;e={NA:0,PERFECT:1,CLOSE:2,GOOD:10,SIMILAR:50},i=5,o=8-i,r.exports={clone:function(t){var r,n,e;if("object"==typeof t){if(Array.isArray(t))return t.map(function(t){return function(r){return t.clone(r)}}(this));r={};for(n in t)e=t[n],r[n]=this.clone(e);return r}return t},defaults:function(){var t,r,n,e,o,i;for(o={},r=0,e=arguments.length;e>r;r++){t=arguments[r];for(n in t)i=t[n],null==o[n]&&(o[n]=this.clone(i))}return o},hexToRgb:function(t){var r;return r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),null!=r?[r[1],r[2],r[3]].map(function(t){return parseInt(t,16)}):null},rgbToHex:function(t,r,n){return"#"+((1<<24)+(t<<16)+(r<<8)+n).toString(16).slice(1,7)},rgbToHsl:function(t,r,n){var e,o,i,s,a,u;if(t/=255,r/=255,n/=255,s=Math.max(t,r,n),a=Math.min(t,r,n),o=void 0,u=void 0,i=(s+a)/2,s===a)o=u=0;else{switch(e=s-a,u=i>.5?e/(2-s-a):e/(s+a),s){case t:o=(r-n)/e+(n>r?6:0);break;case r:o=(n-t)/e+2;break;case n:o=(t-r)/e+4}o/=6}return[o,u,i]},hslToRgb:function(t,r,n){var e,o,i,s,a,u;return u=void 0,o=void 0,e=void 0,i=function(t,r,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(r-t)*n:.5>n?r:2/3>n?t+(r-t)*(2/3-n)*6:t},0===r?u=o=e=n:(a=.5>n?n*(1+r):n+r-n*r,s=2*n-a,u=i(s,a,t+1/3),o=i(s,a,t),e=i(s,a,t-1/3)),[255*u,255*o,255*e]},rgbToXyz:function(t,r,n){var e,o,i;return t/=255,r/=255,n/=255,t=t>.04045?Math.pow((t+.005)/1.055,2.4):t/12.92,r=r>.04045?Math.pow((r+.005)/1.055,2.4):r/12.92,n=n>.04045?Math.pow((n+.005)/1.055,2.4):n/12.92,t*=100,r*=100,n*=100,e=.4124*t+.3576*r+.1805*n,o=.2126*t+.7152*r+.0722*n,i=.0193*t+.1192*r+.9505*n,[e,o,i]},xyzToCIELab:function(t,r,n){var e,o,i,s,a,u;return o=95.047,i=100,s=108.883,t/=o,r/=i,n/=s,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,e=116*r-16,a=500*(t-r),u=200*(r-n),[e,a,u]},rgbToCIELab:function(t,r,n){var e,o,i,s;return e=this.rgbToXyz(t,r,n),o=e[0],i=e[1],s=e[2],this.xyzToCIELab(o,i,s)},deltaE94:function(t,r){var n,e,o,i,s,a,u,h,c,p,f,l,g,v,m,d,y,b,w,x;return s=1,o=1,i=1,n=t[0],a=t[1],h=t[2],e=r[0],u=r[1],c=r[2],p=n-e,f=a-u,l=h-c,g=Math.sqrt(a*a+h*h),v=Math.sqrt(u*u+c*c),b=e-n,m=v-g,d=Math.sqrt(p*p+f*f+l*l),y=Math.sqrt(d)>Math.sqrt(Math.abs(b))+Math.sqrt(Math.abs(m))?Math.sqrt(d*d-b*b-m*m):0,w=1+.045*g,x=1+.015*g,b/=s,m/=o*w,y/=i*x,Math.sqrt(b*b+m*m+y*y)},rgbDiff:function(t,r){var n,e;return n=this.rgbToCIELab.apply(this,t),e=this.rgbToCIELab.apply(this,r),this.deltaE94(n,e)},hexDiff:function(t,r){var n,e;return n=this.hexToRgb(t),e=this.hexToRgb(r),this.rgbDiff(n,e)},DELTAE94_DIFF_STATUS:e,getColorDiffStatus:function(t){return t<e.NA?"N/A":t<=e.PERFECT?"Perfect":t<=e.CLOSE?"Close":t<=e.GOOD?"Good":t<e.SIMILAR?"Similar":"Wrong"},SIGBITS:i,RSHIFT:o,getColorIndex:function(t,r,n){return(t<<2*i)+(r<<i)+n}}},{}],26:[function(t,r,n){var e,o,i,s,a,u,h=function(t,r){return function(){return t.apply(r,arguments)}};s=t("./swatch"),u=t("./util"),o=t("./generator").Default,i=t("./filter"),r.exports=a=function(){function r(t,r){this.sourceImage=t,null==r&&(r={}),this.swatches=h(this.swatches,this),this.opts=u.defaults(r,this.constructor.DefaultOpts),this.generator=this.opts.generator}return r.DefaultOpts={colorCount:64,quality:5,generator:new o,Image:null,Quantizer:t("./quantizer").MMCQ,filters:[]},r.from=function(t){return new e(t)},r.prototype.quantize=t("quantize"),r.prototype._swatches=[],r.prototype.getPalette=function(t){var r;return r=new this.opts.Image(this.sourceImage,function(r){return function(n,e){var o;if(null!=n)return t(n);try{return r._process(e,r.opts),t(null,r.swatches())}catch(i){return o=i,t(o)}}}(this))},r.prototype.getSwatches=function(t){return this.getPalette(t)},r.prototype._process=function(t,r){var n,e,o;return t.scaleDown(this.opts),n=t.getImageData(),e=new this.opts.Quantizer,e.initialize(n.data,this.opts),o=e.getQuantizedColors(),this.generator.generate(o),t.removeCanvas()},r.prototype.swatches=function(){return{Vibrant:this.generator.getVibrantSwatch(),Muted:this.generator.getMutedSwatch(),DarkVibrant:this.generator.getDarkVibrantSwatch(),DarkMuted:this.generator.getDarkMutedSwatch(),LightVibrant:this.generator.getLightVibrantSwatch(),LightMuted:this.generator.getLightMutedSwatch()}},r}(),r.exports.Builder=e=function(){function t(t,r){this.src=t,this.opts=null!=r?r:{},this.opts.filters=u.clone(a.DefaultOpts.filters)}return t.prototype.maxColorCount=function(t){return this.opts.colorCount=t,this},t.prototype.maxDimension=function(t){return this.opts.maxDimension=t,this},t.prototype.addFilter=function(t){return"function"==typeof t&&this.opts.filters.push(t),this},t.prototype.removeFilter=function(t){var r;return(r=this.opts.filters.indexOf(t))>0&&this.opts.filters.splice(r),this},t.prototype.clearFilters=function(){return this.opts.filters=[],this},t.prototype.quality=function(t){return this.opts.quality=t,this},t.prototype.useImage=function(t){return this.opts.Image=t,this},t.prototype.useGenerator=function(t){return this.opts.generator=t,this},t.prototype.useQuantizer=function(t){return this.opts.Quantizer=t,this},t.prototype.build=function(){return null==this.v&&(this.v=new a(this.src,this.opts)),this.v},t.prototype.getSwatches=function(t){return this.build().getPalette(t)},t.prototype.getPalette=function(t){return this.build().getPalette(t)},t.prototype.from=function(t){return new a(t,this.opts)},t}(),r.exports.Util=u,r.exports.Swatch=s,r.exports.Quantizer=t("./quantizer/"),r.exports.Generator=t("./generator/"),r.exports.Filter=t("./filter/")},{"./filter":10,"./filter/":10,"./generator":12,"./generator/":12,"./quantizer":21,"./quantizer/":21,"./swatch":24,"./util":25,quantize:6}],27:[function(t,n,e){if(!o)var o={map:function(t,r){var n={};return r?t.map(function(t,e){return n.index=e,r.call(n,t)}):t.slice()},naturalOrder:function(t,r){return t-r},sum:function(t,r){var n={};return t.reduce(r?function(t,e,o){return n.index=o,t+r.call(n,e)}:function(t,r){return t+r},0)},max:function(t,r){return Math.max.apply(null,r?o.map(t,r):t)}};var i=function(){function t(t,r,n){return(t<<2*c)+(r<<c)+n}function n(t){function r(){n.sort(t),e=!0}var n=[],e=!1;return{push:function(t){n.push(t),e=!1},peek:function(t){return e||r(),void 0===t&&(t=n.length-1),n[t]},pop:function(){return e||r(),n.pop()},size:function(){return n.length},map:function(t){return n.map(t)},debug:function(){return e||r(),n}}}function e(t,r,n,e,o,i,s){var a=this;a.r1=t,a.r2=r,a.g1=n,a.g2=e,a.b1=o,a.b2=i,a.histo=s}function i(){this.vboxes=new n(function(t,r){return o.naturalOrder(t.vbox.count()*t.vbox.volume(),r.vbox.count()*r.vbox.volume())})}function s(n,o){var i,s,u,h,f=1<<3*c,l=new Uint32Array(f),v=1e6,m=0,d=1e6,y=0,w=1e6,x=0,C=n.length/4,S=0;if("function"==typeof o)for(;C>S;)offset=4*S,S++,r=n[offset+0],g=n[offset+1],b=n[offset+2],a=n[offset+3],o(r,g,b,a)||(s=r>>p,u=g>>p,h=b>>p,i=t(s,u,h),l[i]++,v>s?v=s:s>m&&(m=s),d>u?d=u:u>y&&(y=u),w>h?w=h:h>x&&(x=h));else for(;C>S;)offset=4*S,S++,r=n[offset+0],g=n[offset+1],b=n[offset+2],a=n[offset+3],s=r>>p,u=g>>p,h=b>>p,i=t(s,u,h),l[i]++,v>s?v=s:s>m&&(m=s),d>u?d=u:u>y&&(y=u),w>h?w=h:h>x&&(x=h);return{histo:l,vbox:new e(v,m,d,y,w,x,l)}}function u(r,n){function e(t){var r,e,o,i,s,a=t+"1",u=t+"2",p=0,f=y;for(o=n.copy(),i=n.copy(),r=f-n[a],e=n[u]-f,e>=r?(s=Math.min(n[u]-1,~~(f+e/2)),s=Math.max(0,s)):(s=Math.max(n[a],~~(f-1-r/2)),s=Math.min(n[u],s));!h[s];)s++;for(p=c[s];!p&&h[s-1];)p=c[--s];return o[u]=s,i[a]=o[u]+1,[o,i]}if(n.count()){var i=n.r2-n.r1+1,s=n.g2-n.g1+1,a=n.b2-n.b1+1,u=o.max([i,s,a]);if(1==n.count())return[n.copy()];var h,c,p,f,l,g,v,m=0,d="b";if(u==i)for(d="r",h=new Uint32Array(n.r2+1),p=n.r1;p<=n.r2;p++){for(g=0,f=n.g1;f<=n.g2;f++)for(l=n.b1;l<=n.b2;l++)v=t(p,f,l),g+=r[v];m+=g,h[p]=m}else if(u==s)for(d="g",h=new Uint32Array(n.g2+1),p=n.g1;p<=n.g2;p++){for(g=0,f=n.r1;f<=n.r2;f++)for(l=n.b1;l<=n.b2;l++)v=t(f,p,l),g+=r[v];m+=g,h[p]=m}else for(h=new Uint32Array(n.b2+1),p=n.b1;p<=n.b2;p++){for(g=0,f=n.r1;f<=n.r2;f++)for(l=n.g1;l<=n.g2;l++)v=t(f,l,p),g+=r[v];m+=g,h[p]=m}var y=-1;for(c=new Uint32Array(h.length),p=0;p<h.length;p++){var b=h[p];0>y&&b>m/2&&(y=p),c[p]=m-b}return e(d)}}function h(t,r){function e(t,n,e,o){for(var i=0;i<r.filters.length;i++){var s=r.filters[i];if(!s(t,n,e,o))return!0}return!1}function a(t,r){for(var n,e=1,o=0;f>o;)if(n=t.pop(),n.count()){var i=u(g,n),s=i[0],a=i[1];if(!s)return;if(t.push(s),a&&(t.push(a),e++),e>=r)return;if(o++>f)return}else o++}var h=r.colorCount;if(!t.length||2>h||h>256)return!1;var c=Array.isArray(r.filters)&&r.filters.length>0,p=s(t,c?houldIgnore:null),g=p.histo,v=(Object.keys(g).length,p.vbox),m=new n(function(t,r){return o.naturalOrder(t.count(),r.count())});m.push(v),a(m,l*h);for(var d=new n(function(t,r){return o.naturalOrder(t.count()*t.volume(),r.count()*r.volume())});m.size();)d.push(m.pop());a(d,h-d.size());for(var y=new i;d.size();){var b=d.pop(),w=v.avg();c&&e(w[0],w[1],w[2],255)||y.push(b)}return y}var c=5,p=8-c,f=1e3,l=.75;return e.prototype={volume:function(t){var r=this;return(!r._volume||t)&&(r._volume=(r.r2-r.r1+1)*(r.g2-r.g1+1)*(r.b2-r.b1+1)),r._volume},count:function(r){var n=this,e=n.histo;if(!n._count_set||r){var o,i,s,a=0;for(o=n.r1;o<=n.r2;o++)for(i=n.g1;i<=n.g2;i++)for(s=n.b1;s<=n.b2;s++)index=t(o,i,s),a+=e[index];n._count=a,n._count_set=!0}return n._count},copy:function(){var t=this;return new e(t.r1,t.r2,t.g1,t.g2,t.b1,t.b2,t.histo)},avg:function(r){var n=this,e=n.histo;if(!n._avg||r){var o,i,s,a,u,h=0,p=1<<8-c,f=0,l=0,g=0;for(i=n.r1;i<=n.r2;i++)for(s=n.g1;s<=n.g2;s++)for(a=n.b1;a<=n.b2;a++)u=t(i,s,a),o=e[u],h+=o,f+=o*(i+.5)*p,l+=o*(s+.5)*p,g+=o*(a+.5)*p;n._avg=h?[~~(f/h),~~(l/h),~~(g/h)]:[~~(p*(n.r1+n.r2+1)/2),~~(p*(n.g1+n.g2+1)/2),~~(p*(n.b1+n.b2+1)/2)]}return n._avg},contains:function(t){var r=this,n=t[0]>>p;return gval=t[1]>>p,bval=t[2]>>p,n>=r.r1&&n<=r.r2&&gval>=r.g1&&gval<=r.g2&&bval>=r.b1&&bval<=r.b2}},i.prototype={push:function(t){this.vboxes.push({vbox:t,color:t.avg()})},palette:function(){return this.vboxes.map(function(t){return t.color})},size:function(){return this.vboxes.size()},map:function(t){for(var r=this.vboxes,n=0;n<r.size();n++)if(r.peek(n).vbox.contains(t))return r.peek(n).color;return this.nearest(t)},nearest:function(t){for(var r,n,e,o=this.vboxes,i=0;i<o.size();i++)n=Math.sqrt(Math.pow(t[0]-o.peek(i).color[0],2)+Math.pow(t[1]-o.peek(i).color[1],2)+Math.pow(t[2]-o.peek(i).color[2],2)),(r>n||void 0===r)&&(r=n,e=o.peek(i).color);return e},forcebw:function(){var t=this.vboxes;t.sort(function(t,r){return o.naturalOrder(o.sum(t.color),o.sum(r.color))});var r=t[0].color;r[0]<5&&r[1]<5&&r[2]<5&&(t[0].color=[0,0,0]);var n=t.length-1,e=t[n].color;e[0]>251&&e[1]>251&&e[2]>251&&(t[n].color=[255,255,255])}},{quantize:h,getAll:s,medianCutApply:u}}();n.exports=i.quantize,n.exports.getAll=i.getAll,n.exports.splitBox=i.medianCutApply},{}]},{},[8]);
!function t(r,n,e){function o(s,a){if(!n[s]){if(!r[s]){var h="function"==typeof require&&require;if(!a&&h)return h(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[s]={exports:{}};r[s][0].call(c.exports,function(t){var n=r[s][1][t];return o(n?n:t)},c,c.exports,t,r,n,e)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<e.length;s++)o(e[s]);return o}({1:[function(t,r,n){function e(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,r,n){if(t&&u(t)&&t instanceof e)return t;var o=new e;return o.parse(t,r,n),o}function i(t){return h(t)&&(t=o(t)),t instanceof e?t.format():e.prototype.format.call(t)}function s(t,r){return o(t,!1,!0).resolve(r)}function a(t,r){return t?o(t,!1,!0).resolveObject(r):r}function h(t){return"string"==typeof t}function u(t){return"object"==typeof t&&null!==t}function c(t){return null===t}function p(t){return null==t}var f=t("punycode");n.parse=o,n.resolve=s,n.resolveObject=a,n.format=i,n.Url=e;var l=/^([a-z0-9.+-]+:)/i,g=/:[0-9]*$/,m=["<",">",'"',"`"," ","\r","\n"," "],v=["{","}","|","\\","^","`"].concat(m),y=["'"].concat(v),d=["%","/","?",";","#"].concat(y),b=["/","?","#"],w=255,x=/^[a-z0-9A-Z_-]{0,63}$/,S=/^([a-z0-9A-Z_-]{0,63})(.*)$/,M={javascript:!0,"javascript:":!0},C={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},L=t("querystring");e.prototype.parse=function(t,r,n){if(!h(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var e=t;e=e.trim();var o=l.exec(e);if(o){o=o[0];var i=o.toLowerCase();this.protocol=i,e=e.substr(o.length)}if(n||o||e.match(/^\/\/[^@\/]+@[^@\/]+/)){var s="//"===e.substr(0,2);!s||o&&C[o]||(e=e.substr(2),this.slashes=!0)}if(!C[o]&&(s||o&&!_[o])){for(var a=-1,u=0;u<b.length;u++){var c=e.indexOf(b[u]);-1!==c&&(-1===a||a>c)&&(a=c)}var p,g;g=-1===a?e.lastIndexOf("@"):e.lastIndexOf("@",a),-1!==g&&(p=e.slice(0,g),e=e.slice(g+1),this.auth=decodeURIComponent(p)),a=-1;for(var u=0;u<d.length;u++){var c=e.indexOf(d[u]);-1!==c&&(-1===a||a>c)&&(a=c)}-1===a&&(a=e.length),this.host=e.slice(0,a),e=e.slice(a),this.parseHost(),this.hostname=this.hostname||"";var m="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!m)for(var v=this.hostname.split(/\./),u=0,D=v.length;D>u;u++){var q=v[u];if(q&&!q.match(x)){for(var I="",O=0,V=q.length;V>O;O++)I+=q.charCodeAt(O)>127?"x":q[O];if(!I.match(x)){var k=v.slice(0,u),A=v.slice(u+1),z=q.match(S);z&&(k.push(z[1]),A.unshift(z[2])),A.length&&(e="/"+A.join(".")+e),this.hostname=k.join(".");break}}}if(this.hostname.length>w?this.hostname="":this.hostname=this.hostname.toLowerCase(),!m){for(var j=this.hostname.split("."),T=[],u=0;u<j.length;++u){var E=j[u];T.push(E.match(/[^A-Za-z0-9_-]/)?"xn--"+f.encode(E):E)}this.hostname=T.join(".")}var P=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+P,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==e[0]&&(e="/"+e))}if(!M[i])for(var u=0,D=y.length;D>u;u++){var U=y[u],H=encodeURIComponent(U);H===U&&(H=escape(U)),e=e.split(U).join(H)}var F=e.indexOf("#");-1!==F&&(this.hash=e.substr(F),e=e.slice(0,F));var N=e.indexOf("?");if(-1!==N?(this.search=e.substr(N),this.query=e.substr(N+1),r&&(this.query=L.parse(this.query)),e=e.slice(0,N)):r&&(this.search="",this.query={}),e&&(this.pathname=e),_[i]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",E=this.search||"";this.path=P+E}return this.href=this.format(),this},e.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var r=this.protocol||"",n=this.pathname||"",e=this.hash||"",o=!1,i="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&u(this.query)&&Object.keys(this.query).length&&(i=L.stringify(this.query));var s=this.search||i&&"?"+i||"";return r&&":"!==r.substr(-1)&&(r+=":"),this.slashes||(!r||_[r])&&o!==!1?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),e&&"#"!==e.charAt(0)&&(e="#"+e),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),s=s.replace("#","%23"),r+o+n+s+e},e.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},e.prototype.resolveObject=function(t){if(h(t)){var r=new e;r.parse(t,!1,!0),t=r}var n=new e;if(Object.keys(this).forEach(function(t){n[t]=this[t]},this),n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(r){"protocol"!==r&&(n[r]=t[r])}),_[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n;if(t.protocol&&t.protocol!==n.protocol){if(!_[t.protocol])return Object.keys(t).forEach(function(r){n[r]=t[r]}),n.href=n.format(),n;if(n.protocol=t.protocol,t.host||C[t.protocol])n.pathname=t.pathname;else{for(var o=(t.pathname||"").split("/");o.length&&!(t.host=o.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==o[0]&&o.unshift(""),o.length<2&&o.unshift(""),n.pathname=o.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var i=n.pathname||"",s=n.search||"";n.path=i+s}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var a=n.pathname&&"/"===n.pathname.charAt(0),u=t.host||t.pathname&&"/"===t.pathname.charAt(0),f=u||a||n.host&&t.pathname,l=f,g=n.pathname&&n.pathname.split("/")||[],o=t.pathname&&t.pathname.split("/")||[],m=n.protocol&&!_[n.protocol];if(m&&(n.hostname="",n.port=null,n.host&&(""===g[0]?g[0]=n.host:g.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===o[0]?o[0]=t.host:o.unshift(t.host)),t.host=null),f=f&&(""===o[0]||""===g[0])),u)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,g=o;else if(o.length)g||(g=[]),g.pop(),g=g.concat(o),n.search=t.search,n.query=t.query;else if(!p(t.search)){if(m){n.hostname=n.host=g.shift();var v=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;v&&(n.auth=v.shift(),n.host=n.hostname=v.shift())}return n.search=t.search,n.query=t.query,c(n.pathname)&&c(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!g.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var y=g.slice(-1)[0],d=(n.host||t.host)&&("."===y||".."===y)||""===y,b=0,w=g.length;w>=0;w--)y=g[w],"."==y?g.splice(w,1):".."===y?(g.splice(w,1),b++):b&&(g.splice(w,1),b--);if(!f&&!l)for(;b--;b)g.unshift("..");!f||""===g[0]||g[0]&&"/"===g[0].charAt(0)||g.unshift(""),d&&"/"!==g.join("/").substr(-1)&&g.push("");var x=""===g[0]||g[0]&&"/"===g[0].charAt(0);if(m){n.hostname=n.host=x?"":g.length?g.shift():"";var v=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;v&&(n.auth=v.shift(),n.host=n.hostname=v.shift())}return f=f||n.host&&g.length,f&&!x&&g.unshift(""),g.length?n.pathname=g.join("/"):(n.pathname=null,n.path=null),c(n.pathname)&&c(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},e.prototype.parseHost=function(){var t=this.host,r=g.exec(t);r&&(r=r[0],":"!==r&&(this.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(this.hostname=t)}},{punycode:2,querystring:6}],2:[function(t,r,n){(function(t){!function(e){function o(t){throw RangeError(A[t])}function i(t,r){for(var n=t.length,e=[];n--;)e[n]=r(t[n]);return e}function s(t,r){var n=t.split("@"),e="";n.length>1&&(e=n[0]+"@",t=n[1]),t=t.replace(k,".");var o=t.split("."),s=i(o,r).join(".");return e+s}function a(t){for(var r,n,e=[],o=0,i=t.length;i>o;)r=t.charCodeAt(o++),r>=55296&&56319>=r&&i>o?(n=t.charCodeAt(o++),56320==(64512&n)?e.push(((1023&r)<<10)+(1023&n)+65536):(e.push(r),o--)):e.push(r);return e}function h(t){return i(t,function(t){var r="";return t>65535&&(t-=65536,r+=T(t>>>10&1023|55296),t=56320|1023&t),r+=T(t)}).join("")}function u(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function c(t,r){return t+22+75*(26>t)-((0!=r)<<5)}function p(t,r,n){var e=0;for(t=n?j(t/L):t>>1,t+=j(t/r);t>z*C>>1;e+=S)t=j(t/z);return j(e+(z+1)*t/(t+_))}function f(t){var r,n,e,i,s,a,c,f,l,g,m=[],v=t.length,y=0,d=q,b=D;for(n=t.lastIndexOf(I),0>n&&(n=0),e=0;n>e;++e)t.charCodeAt(e)>=128&&o("not-basic"),m.push(t.charCodeAt(e));for(i=n>0?n+1:0;v>i;){for(s=y,a=1,c=S;i>=v&&o("invalid-input"),f=u(t.charCodeAt(i++)),(f>=S||f>j((x-y)/a))&&o("overflow"),y+=f*a,l=b>=c?M:c>=b+C?C:c-b,!(l>f);c+=S)g=S-l,a>j(x/g)&&o("overflow"),a*=g;r=m.length+1,b=p(y-s,r,0==s),j(y/r)>x-d&&o("overflow"),d+=j(y/r),y%=r,m.splice(y++,0,d)}return h(m)}function l(t){var r,n,e,i,s,h,u,f,l,g,m,v,y,d,b,w=[];for(t=a(t),v=t.length,r=q,n=0,s=D,h=0;v>h;++h)m=t[h],128>m&&w.push(T(m));for(e=i=w.length,i&&w.push(I);v>e;){for(u=x,h=0;v>h;++h)m=t[h],m>=r&&u>m&&(u=m);for(y=e+1,u-r>j((x-n)/y)&&o("overflow"),n+=(u-r)*y,r=u,h=0;v>h;++h)if(m=t[h],r>m&&++n>x&&o("overflow"),m==r){for(f=n,l=S;g=s>=l?M:l>=s+C?C:l-s,!(g>f);l+=S)b=f-g,d=S-g,w.push(T(c(g+b%d,0))),f=j(b/d);w.push(T(c(f,0))),s=p(n,y,e==i),n=0,++e}++n,++r}return w.join("")}function g(t){return s(t,function(t){return O.test(t)?f(t.slice(4).toLowerCase()):t})}function m(t){return s(t,function(t){return V.test(t)?"xn--"+l(t):t})}var v="object"==typeof n&&n&&!n.nodeType&&n,y="object"==typeof r&&r&&!r.nodeType&&r,d="object"==typeof t&&t;d.global!==d&&d.window!==d&&d.self!==d||(e=d);var b,w,x=2147483647,S=36,M=1,C=26,_=38,L=700,D=72,q=128,I="-",O=/^xn--/,V=/[^\x20-\x7E]/,k=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=S-M,j=Math.floor,T=String.fromCharCode;if(b={version:"1.3.2",ucs2:{decode:a,encode:h},decode:f,encode:l,toASCII:m,toUnicode:g},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return b});else if(v&&y)if(r.exports==v)y.exports=b;else for(w in b)b.hasOwnProperty(w)&&(v[w]=b[w]);else e.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(t,r,n){if(!e)var e={map:function(t,r){var n={};return r?t.map(function(t,e){return n.index=e,r.call(n,t)}):t.slice()},naturalOrder:function(t,r){return r>t?-1:t>r?1:0},sum:function(t,r){var n={};return t.reduce(r?function(t,e,o){return n.index=o,t+r.call(n,e)}:function(t,r){return t+r},0)},max:function(t,r){return Math.max.apply(null,r?e.map(t,r):t)}};var o=function(){function t(t,r,n){return(t<<2*u)+(r<<u)+n}function r(t){function r(){n.sort(t),e=!0}var n=[],e=!1;return{push:function(t){n.push(t),e=!1},peek:function(t){return e||r(),void 0===t&&(t=n.length-1),n[t]},pop:function(){return e||r(),n.pop()},size:function(){return n.length},map:function(t){return n.map(t)},debug:function(){return e||r(),n}}}function n(t,r,n,e,o,i,s){var a=this;a.r1=t,a.r2=r,a.g1=n,a.g2=e,a.b1=o,a.b2=i,a.histo=s}function o(){this.vboxes=new r(function(t,r){return e.naturalOrder(t.vbox.count()*t.vbox.volume(),r.vbox.count()*r.vbox.volume())})}function i(r){var n,e,o,i,s=1<<3*u,a=new Array(s);return r.forEach(function(r){e=r[0]>>c,o=r[1]>>c,i=r[2]>>c,n=t(e,o,i),a[n]=(a[n]||0)+1}),a}function s(t,r){var e,o,i,s=1e6,a=0,h=1e6,u=0,p=1e6,f=0;return t.forEach(function(t){e=t[0]>>c,o=t[1]>>c,i=t[2]>>c,s>e?s=e:e>a&&(a=e),h>o?h=o:o>u&&(u=o),p>i?p=i:i>f&&(f=i)}),new n(s,a,h,u,p,f,r)}function a(r,n){function o(t){var r,e,o,i,s,a=t+"1",h=t+"2",c=0;for(u=n[a];u<=n[h];u++)if(m[u]>g/2){for(o=n.copy(),i=n.copy(),r=u-n[a],e=n[h]-u,s=e>=r?Math.min(n[h]-1,~~(u+e/2)):Math.max(n[a],~~(u-1-r/2));!m[s];)s++;for(c=v[s];!c&&m[s-1];)c=v[--s];return o[h]=s,i[a]=o[h]+1,[o,i]}}if(n.count()){var i=n.r2-n.r1+1,s=n.g2-n.g1+1,a=n.b2-n.b1+1,h=e.max([i,s,a]);if(1==n.count())return[n.copy()];var u,c,p,f,l,g=0,m=[],v=[];if(h==i)for(u=n.r1;u<=n.r2;u++){for(f=0,c=n.g1;c<=n.g2;c++)for(p=n.b1;p<=n.b2;p++)l=t(u,c,p),f+=r[l]||0;g+=f,m[u]=g}else if(h==s)for(u=n.g1;u<=n.g2;u++){for(f=0,c=n.r1;c<=n.r2;c++)for(p=n.b1;p<=n.b2;p++)l=t(c,u,p),f+=r[l]||0;g+=f,m[u]=g}else for(u=n.b1;u<=n.b2;u++){for(f=0,c=n.r1;c<=n.r2;c++)for(p=n.g1;p<=n.g2;p++)l=t(c,p,u),f+=r[l]||0;g+=f,m[u]=g}return m.forEach(function(t,r){v[r]=g-t}),o(h==i?"r":h==s?"g":"b")}}function h(t,n){function h(t,r){for(var n,e=1,o=0;p>o;)if(n=t.pop(),n.count()){var i=a(u,n),s=i[0],h=i[1];if(!s)return;if(t.push(s),h&&(t.push(h),e++),e>=r)return;if(o++>p)return}else t.push(n),o++}if(!t.length||2>n||n>256)return!1;var u=i(t),c=0;u.forEach(function(){c++});var l=s(t,u),g=new r(function(t,r){return e.naturalOrder(t.count(),r.count())});g.push(l),h(g,f*n);for(var m=new r(function(t,r){return e.naturalOrder(t.count()*t.volume(),r.count()*r.volume())});g.size();)m.push(g.pop());h(m,n-m.size());for(var v=new o;m.size();)v.push(m.pop());return v}var u=5,c=8-u,p=1e3,f=.75;return n.prototype={volume:function(t){var r=this;return r._volume&&!t||(r._volume=(r.r2-r.r1+1)*(r.g2-r.g1+1)*(r.b2-r.b1+1)),r._volume},count:function(r){var n=this,e=n.histo;if(!n._count_set||r){var o,i,s,a=0;for(o=n.r1;o<=n.r2;o++)for(i=n.g1;i<=n.g2;i++)for(s=n.b1;s<=n.b2;s++)index=t(o,i,s),a+=e[index]||0;n._count=a,n._count_set=!0}return n._count},copy:function(){var t=this;return new n(t.r1,t.r2,t.g1,t.g2,t.b1,t.b2,t.histo)},avg:function(r){var n=this,e=n.histo;if(!n._avg||r){var o,i,s,a,h,c=0,p=1<<8-u,f=0,l=0,g=0;for(i=n.r1;i<=n.r2;i++)for(s=n.g1;s<=n.g2;s++)for(a=n.b1;a<=n.b2;a++)h=t(i,s,a),o=e[h]||0,c+=o,f+=o*(i+.5)*p,l+=o*(s+.5)*p,g+=o*(a+.5)*p;c?n._avg=[~~(f/c),~~(l/c),~~(g/c)]:n._avg=[~~(p*(n.r1+n.r2+1)/2),~~(p*(n.g1+n.g2+1)/2),~~(p*(n.b1+n.b2+1)/2)]}return n._avg},contains:function(t){var r=this,n=t[0]>>c;return gval=t[1]>>c,bval=t[2]>>c,n>=r.r1&&n<=r.r2&&gval>=r.g1&&gval<=r.g2&&bval>=r.b1&&bval<=r.b2}},o.prototype={push:function(t){this.vboxes.push({vbox:t,color:t.avg()})},palette:function(){return this.vboxes.map(function(t){return t.color})},size:function(){return this.vboxes.size()},map:function(t){for(var r=this.vboxes,n=0;n<r.size();n++)if(r.peek(n).vbox.contains(t))return r.peek(n).color;return this.nearest(t)},nearest:function(t){for(var r,n,e,o=this.vboxes,i=0;i<o.size();i++)n=Math.sqrt(Math.pow(t[0]-o.peek(i).color[0],2)+Math.pow(t[1]-o.peek(i).color[1],2)+Math.pow(t[2]-o.peek(i).color[2],2)),(r>n||void 0===r)&&(r=n,e=o.peek(i).color);return e},forcebw:function(){var t=this.vboxes;t.sort(function(t,r){return e.naturalOrder(e.sum(t.color),e.sum(r.color))});var r=t[0].color;r[0]<5&&r[1]<5&&r[2]<5&&(t[0].color=[0,0,0]);var n=t.length-1,o=t[n].color;o[0]>251&&o[1]>251&&o[2]>251&&(t[n].color=[255,255,255])}},{quantize:h}}();r.exports=o.quantize},{}],4:[function(t,r,n){"use strict";function e(t,r){return Object.prototype.hasOwnProperty.call(t,r)}r.exports=function(t,r,n,i){r=r||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(r);var h=1e3;i&&"number"==typeof i.maxKeys&&(h=i.maxKeys);var u=t.length;h>0&&u>h&&(u=h);for(var c=0;u>c;++c){var p,f,l,g,m=t[c].replace(a,"%20"),v=m.indexOf(n);v>=0?(p=m.substr(0,v),f=m.substr(v+1)):(p=m,f=""),l=decodeURIComponent(p),g=decodeURIComponent(f),e(s,l)?o(s[l])?s[l].push(g):s[l]=[s[l],g]:s[l]=g}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],5:[function(t,r,n){"use strict";function e(t,r){if(t.map)return t.map(r);for(var n=[],e=0;e<t.length;e++)n.push(r(t[e],e));return n}var o=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};r.exports=function(t,r,n,a){return r=r||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?e(s(t),function(s){var a=encodeURIComponent(o(s))+n;return i(t[s])?e(t[s],function(t){return a+encodeURIComponent(o(t))}).join(r):a+encodeURIComponent(o(t[s]))}).join(r):a?encodeURIComponent(o(a))+n+encodeURIComponent(o(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=Object.keys||function(t){var r=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.push(n);return r}},{}],6:[function(t,r,n){"use strict";n.decode=n.parse=t("./decode"),n.encode=n.stringify=t("./encode")},{"./decode":4,"./encode":5}],7:[function(t,r,n){var e;e=t("./vibrant"),e.DefaultOpts.Image=t("./image/browser"),r.exports=e},{"./image/browser":13,"./vibrant":22}],8:[function(t,r,n){var e;window.Vibrant=e=t("./browser")},{"./browser":7}],9:[function(t,r,n){r.exports=function(t,r,n,e){return e>=125&&!(t>250&&r>250&&n>250)}},{}],10:[function(t,r,n){r.exports.Default=t("./default")},{"./default":9}],11:[function(t,r,n){var e,o,i,s,a,h=function(t,r){function n(){this.constructor=t}for(var e in r)u.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},u={}.hasOwnProperty,c=[].slice;s=t("../swatch"),a=t("../util"),i=t("./index"),o={targetDarkLuma:.26,maxDarkLuma:.45,minLightLuma:.55,targetLightLuma:.74,minNormalLuma:.3,targetNormalLuma:.5,maxNormalLuma:.7,targetMutesSaturation:.3,maxMutesSaturation:.4,targetVibrantSaturation:1,minVibrantSaturation:.35,weightSaturation:3,weightLuma:6,weightPopulation:1},r.exports=e=function(t){function r(t){this.opts=a.defaults(t,o),this.VibrantSwatch=null,this.LightVibrantSwatch=null,this.DarkVibrantSwatch=null,this.MutedSwatch=null,this.LightMutedSwatch=null,this.DarkMutedSwatch=null}return h(r,t),r.prototype.HighestPopulation=0,r.prototype.generate=function(t){return this.swatches=t,this.maxPopulation=this.findMaxPopulation,this.generateVarationColors(),this.generateEmptySwatches()},r.prototype.getVibrantSwatch=function(){return this.VibrantSwatch},r.prototype.getLightVibrantSwatch=function(){return this.LightVibrantSwatch},r.prototype.getDarkVibrantSwatch=function(){return this.DarkVibrantSwatch},r.prototype.getMutedSwatch=function(){return this.MutedSwatch},r.prototype.getLightMutedSwatch=function(){return this.LightMutedSwatch},r.prototype.getDarkMutedSwatch=function(){return this.DarkMutedSwatch},r.prototype.generateVarationColors=function(){return this.VibrantSwatch=this.findColorVariation(this.opts.targetNormalLuma,this.opts.minNormalLuma,this.opts.maxNormalLuma,this.opts.targetVibrantSaturation,this.opts.minVibrantSaturation,1),this.LightVibrantSwatch=this.findColorVariation(this.opts.targetLightLuma,this.opts.minLightLuma,1,this.opts.targetVibrantSaturation,this.opts.minVibrantSaturation,1),this.DarkVibrantSwatch=this.findColorVariation(this.opts.targetDarkLuma,0,this.opts.maxDarkLuma,this.opts.targetVibrantSaturation,this.opts.minVibrantSaturation,1),this.MutedSwatch=this.findColorVariation(this.opts.targetNormalLuma,this.opts.minNormalLuma,this.opts.maxNormalLuma,this.opts.targetMutesSaturation,0,this.opts.maxMutesSaturation),this.LightMutedSwatch=this.findColorVariation(this.opts.targetLightLuma,this.opts.minLightLuma,1,this.opts.targetMutesSaturation,0,this.opts.maxMutesSaturation),this.DarkMutedSwatch=this.findColorVariation(this.opts.targetDarkLuma,0,this.opts.maxDarkLuma,this.opts.targetMutesSaturation,0,this.opts.maxMutesSaturation)},r.prototype.generateEmptySwatches=function(){var t;return null===this.VibrantSwatch&&null!==this.DarkVibrantSwatch&&(t=this.DarkVibrantSwatch.getHsl(),t[2]=this.opts.targetNormalLuma,this.VibrantSwatch=new s(a.hslToRgb(t[0],t[1],t[2]),0)),null===this.DarkVibrantSwatch&&null!==this.VibrantSwatch?(t=this.VibrantSwatch.getHsl(),t[2]=this.opts.targetDarkLuma,this.DarkVibrantSwatch=new s(a.hslToRgb(t[0],t[1],t[2]),0)):void 0},r.prototype.findMaxPopulation=function(){var t,r,n,e,o;for(n=0,e=this.swatches,t=0,r=e.length;r>t;t++)o=e[t],n=Math.max(n,o.getPopulation());return n},r.prototype.findColorVariation=function(t,r,n,e,o,i){var s,a,h,u,c,p,f,l,g;for(u=null,c=0,p=this.swatches,s=0,a=p.length;a>s;s++)l=p[s],f=l.getHsl()[1],h=l.getHsl()[2],f>=o&&i>=f&&h>=r&&n>=h&&!this.isAlreadySelected(l)&&(g=this.createComparisonValue(f,e,h,t,l.getPopulation(),this.HighestPopulation),(null===u||g>c)&&(u=l,c=g));return u},r.prototype.createComparisonValue=function(t,r,n,e,o,i){return this.weightedMean(this.invertDiff(t,r),this.opts.weightSaturation,this.invertDiff(n,e),this.opts.weightLuma,o/i,this.opts.weightPopulation)},r.prototype.invertDiff=function(t,r){return 1-Math.abs(t-r)},r.prototype.weightedMean=function(){var t,r,n,e,o,i;for(o=1<=arguments.length?c.call(arguments,0):[],r=0,n=0,t=0;t<o.length;)e=o[t],i=o[t+1],r+=e*i,n+=i,t+=2;return r/n},r.prototype.isAlreadySelected=function(t){return this.VibrantSwatch===t||this.DarkVibrantSwatch===t||this.LightVibrantSwatch===t||this.MutedSwatch===t||this.DarkMutedSwatch===t||this.LightMutedSwatch===t},r}(i)},{"../swatch":20,"../util":21,"./index":12}],12:[function(t,r,n){var e;r.exports=e=function(){function t(){}return t.prototype.generate=function(t){},t.prototype.getVibrantSwatch=function(){},t.prototype.getLightVibrantSwatch=function(){},t.prototype.getDarkVibrantSwatch=function(){},t.prototype.getMutedSwatch=function(){},t.prototype.getLightMutedSwatch=function(){},t.prototype.getDarkMutedSwatch=function(){},t}(),r.exports.Default=t("./default")},{"./default":11}],13:[function(t,r,n){var e,o,i,s,a,h=function(t,r){function n(){this.constructor=t}for(var e in r)u.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},u={}.hasOwnProperty;o=t("./index"),i=t("url"),s=function(t){var r;return r=i.parse(t),null===r.protocol&&null===r.host&&null===r.port},a=function(t,r){var n,e;return n=i.parse(t),e=i.parse(r),n.protocol===e.protocol&&n.hostname===e.hostname&&n.port===e.port},r.exports=e=function(t){function r(t,r){"object"==typeof t&&t instanceof HTMLImageElement?(this.img=t,t=this.img.src):(this.img=document.createElement("img"),this.img.src=t),s(t)||a(window.location.href,t)||(this.img.crossOrigin="anonymous"),this.img.onload=function(t){return function(){return t._initCanvas(),"function"==typeof r?r(null,t):void 0}}(this),this.img.complete&&this.img.onload(),this.img.onerror=function(n){return function(n){var e;return e=new Error("Fail to load image: "+t),e.raw=n,"function"==typeof r?r(e):void 0}}(this)}return h(r,t),r.prototype._initCanvas=function(){return this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),document.body.appendChild(this.canvas),this.width=this.canvas.width=this.img.width,this.height=this.canvas.height=this.img.height,this.context.drawImage(this.img,0,0,this.width,this.height)},r.prototype.clear=function(){return this.context.clearRect(0,0,this.width,this.height)},r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.resize=function(t,r,n){return this.width=this.canvas.width=t,this.height=this.canvas.height=r,this.context.scale(n,n),this.context.drawImage(this.img,0,0)},r.prototype.update=function(t){return this.context.putImageData(t,0,0)},r.prototype.getPixelCount=function(){return this.width*this.height},r.prototype.getImageData=function(){return this.context.getImageData(0,0,this.width,this.height)},r.prototype.removeCanvas=function(){return this.canvas.parentNode.removeChild(this.canvas)},r}(o)},{"./index":14,url:1}],14:[function(t,r,n){var e;r.exports=e=function(){function t(){}return t.prototype.clear=function(){},t.prototype.update=function(t){},t.prototype.getWidth=function(){},t.prototype.getHeight=function(){},t.prototype.scaleDown=function(t){var r,n,e,o;return o=this.getWidth(),r=this.getHeight(),e=1,null!=t.maxDimension?(n=Math.max(o,r),n>t.maxDimension&&(e=t.maxDimension/n)):e=1/t.quality,1>e?this.resize(o*e,r*e,e):void 0},t.prototype.resize=function(t,r,n){},t.prototype.getPixelCount=function(){},t.prototype.getImageData=function(){},t.prototype.removeCanvas=function(){},t}()},{}],15:[function(t,r,n){var e,o,i,s,a,h,u,c,p;c=p=t("../../util"),u=c.getColorIndex,s=c.SIGBITS,i=c.RSHIFT,a=t("../../swatch"),h=t("./vbox"),o=t("./pqueue"),r.exports=e=function(){function t(t){this.opts=p.defaults(t,this.constructor.DefaultOpts)}return t.DefaultOpts={maxIterations:1e3,fractByPopulations:.75},t.prototype.quantize=function(t,r){var n,e,i,s,u,c,p,f,l;if(0===t.length||r.colorCount<2||r.colorCount>256)throw new Error("Wrong MMCQ parameters");for(c=function(){return!1},Array.isArray(r.filters)&&r.filters.length>0&&(c=function(t,n,e,o){var i,s,a,h;for(h=r.filters,s=0,a=h.length;a>s;s++)if(i=h[s],!i(t,n,e,o))return!0;return!1}),l=h.build(t,c),i=l.hist,e=Object.keys(i).length,s=new o(function(t,r){return t.count()-r.count()}),s.push(l),this._splitBoxes(s,this.opts.fractByPopulations*r.colorCount),u=new o(function(t,r){return t.count()*t.volume()-r.count()*r.volume()}),u.contents=s.contents,this._splitBoxes(u,r.colorCount-u.size()),p=[],this.vboxes=[];u.size();)f=u.pop(),n=f.avg(),("function"==typeof c?c(n[0],n[1],n[2],255):void 0)||(this.vboxes.push(f),p.push(new a(n,f.count())));return p},t.prototype._splitBoxes=function(t,r){var n,e,o,i,s,a,h;for(n=1,e=0,o=this.opts.maxIterations;o>e;)if(e++,s=t.pop(),s.count()&&(i=s.split(),a=i[0],h=i[1],t.push(a),h&&(t.push(h),n++),n>=r||e>o))return},t}()},{"../../swatch":20,"../../util":21,"./pqueue":16,"./vbox":17}],16:[function(t,r,n){var e;r.exports=e=function(){function t(t){this.comparator=t,this.contents=[],this.sorted=!1}return t.prototype._sort=function(){return this.contents.sort(this.comparator),this.sorted=!0},t.prototype.push=function(t){return this.contents.push(t),this.sorted=!1},t.prototype.peek=function(t){return this.sorted||this._sort(),null==t&&(t=this.contents.length-1),this.contents[t]},t.prototype.pop=function(){return this.sorted||this._sort(),this.contents.pop()},t.prototype.size=function(){return this.contents.length},t.prototype.map=function(t){return this.sorted||this._sort(),this.contents.map(t)},t}()},{}],17:[function(t,r,n){var e,o,i,s,a,h;a=h=t("../../util"),s=a.getColorIndex,o=a.SIGBITS,e=a.RSHIFT,r.exports=i=function(){function t(t,r,n,e,o,i,s){this.r1=t,this.r2=r,this.g1=n,this.g2=e,this.b1=o,this.b2=i,this.hist=s}return t.build=function(r,n){var i,a,h,u,c,p,f,l,g,m,v,y,d,b,w,x;for(g=1<<3*o,l=new Uint32Array(g),w=p=h=0,x=f=u=Number.MAX_VALUE,y=r.length/4,m=0;y>m;)d=4*m,m++,b=r[d+0],c=r[d+1],a=r[d+2],i=r[d+3],n(b,c,a,i)||(b>>=e,c>>=e,a>>=e,v=s(b,c,a),l[v]+=1,b>w&&(w=b),x>b&&(x=b),c>p&&(p=c),f>c&&(f=c),a>h&&(h=a),u>a&&(u=a));return new t(x,w,f,p,u,h,l)},t.prototype.invalidate=function(){return delete this._count,delete this._avg,delete this._volume},t.prototype.volume=function(){return null==this._volume&&(this._volume=(this.r2-this.r1+1)*(this.g2-this.g1+1)*(this.b2-this.b1+1)),this._volume},t.prototype.count=function(){var t,r;if(null==this._count){r=this.hist,t=0;for(var n=this.r1;n<=this.r2;n++)for(var e=this.g1;e<=this.g2;e++)for(var o=this.b1;o<=this.b2;o++){var i=s(n,e,o);t+=r[i]}this._count=t}return this._count},t.prototype.clone=function(){return new t(this.r1,this.r2,this.g1,this.g2,this.b1,this.b2,this.hist)},t.prototype.avg=function(){var t,r,n,e,i,a;if(null==this._avg){n=this.hist,i=0,e=1<<8-o,a=r=t=0;for(var h=this.r1;h<=this.r2;h++)for(var u=this.g1;u<=this.g2;u++)for(var c=this.b1;c<=this.b2;c++){var p=s(h,u,c),f=n[p];i+=f,a+=f*(h+.5)*e,r+=f*(u+.5)*e,t+=f*(c+.5)*e}i?this._avg=[~~(a/i),~~(r/i),~~(t/i)]:this._avg=[~~(e*(this.r1+this.r2+1)/2),~~(e*(this.g1+this.g2+1)/2),~~(e*(this.b1+this.b2+1)/2)]}return this._avg},t.prototype.split=function(){var t,r,n,e,o,i,a,h,u,c,p,f,l,g,m,v,y;if(i=this.hist,!this.count())return null;if(1===this.count())return[this.clone()];switch(l=this.r2-this.r1+1,o=this.g2-this.g1+1,r=this.b2-this.b1+1,c=Math.max(l,o,r),t=null,m=v=0,u=null,c){case l:u="r",t=new Uint32Array(this.r2+1);for(var d=this.r1;d<=this.r2;d++){m=0;for(var b=this.g1;b<=this.g2;b++)for(var w=this.b1;w<=this.b2;w++){var x=s(d,b,w);m+=i[x]}v+=m,t[d]=v}break;case o:u="g",t=new Uint32Array(this.g2+1);for(var b=this.g1;b<=this.g2;b++){m=0;for(var d=this.r1;d<=this.r2;d++)for(var w=this.b1;w<=this.b2;w++){var x=s(d,b,w);m+=i[x]}v+=m,t[b]=v}break;case r:u="b",t=new Uint32Array(this.b2+1);for(var w=this.b1;w<=this.b2;w++){m=0;for(var d=this.r1;d<=this.r2;d++)for(var b=this.g1;b<=this.g2;b++){var x=s(d,b,w);m+=i[x]}v+=m,t[w]=v}}for(g=-1,f=new Uint32Array(t.length),a=h=0,p=t.length-1;p>=0?p>=h:h>=p;a=p>=0?++h:--h)n=t[a],0>g&&n>v/2&&(g=a),f[a]=v-n;return y=this,(e=function(r){var n,e,o,i,s,a,h,u,c;for(i=r+"1",s=r+"2",e=y[i],o=y[s],u=y.clone(),c=y.clone(),a=g-e,h=o-g,h>=a?(o=Math.min(o-1,~~(g+h/2)),o=Math.max(0,o)):(o=Math.max(e,~~(g-1-a/2)),o=Math.min(y[s],o));!t[o];)o++;for(n=f[o];!n&&t[o-1];)n=f[--o];return u[s]=o,c[i]=o+1,[u,c]})(u)},t.prototype.contains=function(t){var r,n,o;return o=t[0]>>e,n=t[1]>>e,r=t[2]>>e,o>=this.r1&&o<=this.r2&&n>=this.g1&&n<=this.g2&&r>=this.b1&&r<=this.b2},t}()},{"../../util":21}],18:[function(t,r,n){var e;r.exports=e=function(){function t(){}return t.prototype.initialize=function(t,r){},t.prototype.getQuantizedColors=function(){},t}(),r.exports.MMCQ=t("./mmcq")},{"./mmcq":19}],19:[function(t,r,n){var e,o,i,s,a=function(t,r){function n(){this.constructor=t}for(var e in r)h.call(r,e)&&(t[e]=r[e]);return n.prototype=r.prototype,t.prototype=new n,t.__super__=r.prototype,t},h={}.hasOwnProperty;s=t("../swatch"),i=t("./index"),o=t("./impl/mmcq"),r.exports=e=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return a(r,t),r.prototype.initialize=function(t,r){var n;return this.opts=r,n=new o,this.swatches=n.quantize(t,this.opts)},r.prototype.getQuantizedColors=function(){return this.swatches},r}(i)},{"../swatch":20,"./impl/mmcq":15,"./index":18}],20:[function(t,r,n){var e,o;o=t("./util"),r.exports=e=function(){function t(t,r){this.rgb=t,this.population=r}return t.prototype.hsl=void 0,t.prototype.rgb=void 0,t.prototype.population=1,t.prototype.yiq=0,t.prototype.getHsl=function(){return this.hsl?this.hsl:this.hsl=o.rgbToHsl(this.rgb[0],this.rgb[1],this.rgb[2])},t.prototype.getPopulation=function(){return this.population},t.prototype.getRgb=function(){return this.rgb},t.prototype.getHex=function(){return o.rgbToHex(this.rgb[0],this.rgb[1],this.rgb[2])},t.prototype.getTitleTextColor=function(){return this._ensureTextColors(),this.yiq<200?"#fff":"#000"},t.prototype.getBodyTextColor=function(){return this._ensureTextColors(),this.yiq<150?"#fff":"#000"},t.prototype._ensureTextColors=function(){return this.yiq?void 0:this.yiq=(299*this.rgb[0]+587*this.rgb[1]+114*this.rgb[2])/1e3},t}()},{"./util":21}],21:[function(t,r,n){var e,o,i;e={NA:0,PERFECT:1,CLOSE:2,GOOD:10,SIMILAR:50},i=5,o=8-i,r.exports={clone:function(t){var r,n,e;if("object"==typeof t){if(Array.isArray(t))return t.map(function(t){return function(r){return t.clone(r)}}(this));r={};for(n in t)e=t[n],r[n]=this.clone(e);return r}return t},defaults:function(){var t,r,n,e,o,i;for(o={},r=0,e=arguments.length;e>r;r++){t=arguments[r];for(n in t)i=t[n],null==o[n]&&(o[n]=this.clone(i))}return o},hexToRgb:function(t){var r;return r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),null!=r?[r[1],r[2],r[3]].map(function(t){return parseInt(t,16)}):null},rgbToHex:function(t,r,n){return"#"+((1<<24)+(t<<16)+(r<<8)+n).toString(16).slice(1,7)},rgbToHsl:function(t,r,n){var e,o,i,s,a,h;if(t/=255,r/=255,n/=255,s=Math.max(t,r,n),a=Math.min(t,r,n),o=void 0,h=void 0,i=(s+a)/2,s===a)o=h=0;else{switch(e=s-a,h=i>.5?e/(2-s-a):e/(s+a),s){case t:o=(r-n)/e+(n>r?6:0);break;case r:o=(n-t)/e+2;break;case n:o=(t-r)/e+4}o/=6}return[o,h,i]},hslToRgb:function(t,r,n){var e,o,i,s,a,h;return h=void 0,o=void 0,e=void 0,i=function(t,r,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(r-t)*n:.5>n?r:2/3>n?t+(r-t)*(2/3-n)*6:t},0===r?h=o=e=n:(a=.5>n?n*(1+r):n+r-n*r,s=2*n-a,h=i(s,a,t+1/3),o=i(s,a,t),e=i(s,a,t-1/3)),[255*h,255*o,255*e];
},rgbToXyz:function(t,r,n){var e,o,i;return t/=255,r/=255,n/=255,t=t>.04045?Math.pow((t+.005)/1.055,2.4):t/12.92,r=r>.04045?Math.pow((r+.005)/1.055,2.4):r/12.92,n=n>.04045?Math.pow((n+.005)/1.055,2.4):n/12.92,t*=100,r*=100,n*=100,e=.4124*t+.3576*r+.1805*n,o=.2126*t+.7152*r+.0722*n,i=.0193*t+.1192*r+.9505*n,[e,o,i]},xyzToCIELab:function(t,r,n){var e,o,i,s,a,h;return o=95.047,i=100,s=108.883,t/=o,r/=i,n/=s,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,e=116*r-16,a=500*(t-r),h=200*(r-n),[e,a,h]},rgbToCIELab:function(t,r,n){var e,o,i,s;return e=this.rgbToXyz(t,r,n),o=e[0],i=e[1],s=e[2],this.xyzToCIELab(o,i,s)},deltaE94:function(t,r){var n,e,o,i,s,a,h,u,c,p,f,l,g,m,v,y,d,b,w,x;return s=1,o=1,i=1,n=t[0],a=t[1],u=t[2],e=r[0],h=r[1],c=r[2],p=n-e,f=a-h,l=u-c,g=Math.sqrt(a*a+u*u),m=Math.sqrt(h*h+c*c),b=e-n,v=m-g,y=Math.sqrt(p*p+f*f+l*l),d=Math.sqrt(y)>Math.sqrt(Math.abs(b))+Math.sqrt(Math.abs(v))?Math.sqrt(y*y-b*b-v*v):0,w=1+.045*g,x=1+.015*g,b/=s,v/=o*w,d/=i*x,Math.sqrt(b*b+v*v+d*d)},rgbDiff:function(t,r){var n,e;return n=this.rgbToCIELab.apply(this,t),e=this.rgbToCIELab.apply(this,r),this.deltaE94(n,e)},hexDiff:function(t,r){var n,e;return n=this.hexToRgb(t),e=this.hexToRgb(r),this.rgbDiff(n,e)},DELTAE94_DIFF_STATUS:e,getColorDiffStatus:function(t){return t<e.NA?"N/A":t<=e.PERFECT?"Perfect":t<=e.CLOSE?"Close":t<=e.GOOD?"Good":t<e.SIMILAR?"Similar":"Wrong"},SIGBITS:i,RSHIFT:o,getColorIndex:function(t,r,n){return(t<<2*i)+(r<<i)+n}}},{}],22:[function(t,r,n){var e,o,i,s,a,h,u=function(t,r){return function(){return t.apply(r,arguments)}};s=t("./swatch"),h=t("./util"),o=t("./generator").Default,i=t("./filter"),r.exports=a=function(){function r(t,r){this.sourceImage=t,null==r&&(r={}),this.swatches=u(this.swatches,this),this.opts=h.defaults(r,this.constructor.DefaultOpts),this.generator=this.opts.generator}return r.DefaultOpts={colorCount:64,quality:5,generator:new o,Image:null,Quantizer:t("./quantizer").MMCQ,filters:[]},r.from=function(t){return new e(t)},r.prototype.quantize=t("quantize"),r.prototype._swatches=[],r.prototype.getPalette=function(t){var r;return r=new this.opts.Image(this.sourceImage,function(r){return function(n,e){var o,i;if(null!=n)return t(n);try{return r._process(e,r.opts),t(null,r.swatches())}catch(i){return o=i,t(o)}}}(this))},r.prototype.getSwatches=function(t){return this.getPalette(t)},r.prototype._process=function(t,r){var n,e,o;return t.scaleDown(this.opts),n=t.getImageData(),e=new this.opts.Quantizer,e.initialize(n.data,this.opts),o=e.getQuantizedColors(),this.generator.generate(o),t.removeCanvas()},r.prototype.swatches=function(){return{Vibrant:this.generator.getVibrantSwatch(),Muted:this.generator.getMutedSwatch(),DarkVibrant:this.generator.getDarkVibrantSwatch(),DarkMuted:this.generator.getDarkMutedSwatch(),LightVibrant:this.generator.getLightVibrantSwatch(),LightMuted:this.generator.getLightMutedSwatch()}},r}(),r.exports.Builder=e=function(){function t(t,r){this.src=t,this.opts=null!=r?r:{},this.opts.filters=h.clone(a.DefaultOpts.filters)}return t.prototype.maxColorCount=function(t){return this.opts.colorCount=t,this},t.prototype.maxDimension=function(t){return this.opts.maxDimension=t,this},t.prototype.addFilter=function(t){return"function"==typeof t&&this.opts.filters.push(t),this},t.prototype.removeFilter=function(t){var r;return(r=this.opts.filters.indexOf(t))>0&&this.opts.filters.splice(r),this},t.prototype.clearFilters=function(){return this.opts.filters=[],this},t.prototype.quality=function(t){return this.opts.quality=t,this},t.prototype.useImage=function(t){return this.opts.Image=t,this},t.prototype.useGenerator=function(t){return this.opts.generator=t,this},t.prototype.useQuantizer=function(t){return this.opts.Quantizer=t,this},t.prototype.build=function(){return null==this.v&&(this.v=new a(this.src,this.opts)),this.v},t.prototype.getSwatches=function(t){return this.build().getPalette(t)},t.prototype.getPalette=function(t){return this.build().getPalette(t)},t.prototype.from=function(t){return new a(t,this.opts)},t}(),r.exports.Util=h,r.exports.Swatch=s,r.exports.Quantizer=t("./quantizer/"),r.exports.Generator=t("./generator/"),r.exports.Filter=t("./filter/")},{"./filter":10,"./filter/":10,"./generator":12,"./generator/":12,"./quantizer":18,"./quantizer/":18,"./swatch":20,"./util":21,quantize:3}]},{},[8]);
{
"name": "node-vibrant",
"version": "2.0.3",
"version": "2.1.0",
"description": "Node.js port of vibrant.js. Get color variations from an image. Basically a JS port of Android's Palette",

@@ -23,2 +23,3 @@ "main": "lib/index.js",

"colors": "^1.1.2",
"del": "^2.2.0",
"finalhandler": "^0.4.0",

@@ -45,2 +46,4 @@ "gulp": "^3.9.0",

"scripts": {
"prepublish": "gulp clean && gulp clean:browser && gulp coffee && gulp browser",
"pretest": "gulp coffee && gulp browser",
"test": "gulp test"

@@ -47,0 +50,0 @@ },

@@ -77,3 +77,3 @@ # node-vibrant

------- | ---------------------------------- | ---------------------------------------
`image` | `string` or `Buffer`(node.js only) | Path to image file (support HTTP/HTTPs)
`image` | `string`, `HTMLImageElement`(browser only), or `Buffer`(node.js only) | Path to image file (support HTTP/HTTPs)

@@ -97,3 +97,3 @@ #### `constructor(image, opts)`

`Image` | `Image.Node` or `Image.Browser` | An `Image` implementation class
`Quantizer` | `Vibrant.Quantizer.NoCopy` | A `Quantizer` implementation class
`Quantizer` | `Vibrant.Quantizer.MMCQ` | A `Quantizer` implementation class

@@ -237,10 +237,4 @@ #### `getPalette(cb)`

#### `Quantizer.MMCQ`
Default quantizer. ~4x faster than baseline quantizer. (Rewritten version of `NoCopy`)
Default quantizer. ~4x faster than baseline quantizer.
#### `Quantizer.NoCopy`
Optimized quantizer. ~4x faster than baseline quantizer.
#### `Quantizer.Baseline`
Original `vibrant.js` quantizer. Used for tests and benchmarks only. It does not support downsampling nor filters.
### `Vibrant.Generator`

@@ -247,0 +241,0 @@ Base class for `Generator`.

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc