!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.CS_worker=e()}}(function(){return function e(n,t,r){function o(f,a){if(!t[f]){if(!n[f]){var u="function"==typeof require&&require;if(!a&&u)return u(f,!0);if(i)return i(f,!0);var s=new Error("Cannot find module '"+f+"'");throw s.code="MODULE_NOT_FOUND",s}var d=t[f]={exports:{}};n[f][0].call(d.exports,function(e){var t=n[f][1][e];return o(t||e)},d,d.exports,e,n,t,r)}return t[f].exports}for(var i="function"==typeof require&&require,f=0;f<r.length;f++)o(r[f]);return o}({1:[function(e,n,t){"use strict";function r(e){var n=e.imageData,t=o(n.data),r=t.dominant;postMessage({dominant:r})}function o(e,n){function t(e){return"transparent"===e||-1!==e.indexOf("rgb")||-1!==e.indexOf("hsl")?e:["rgb(",e,")"].join("")}function r(e,n){return{name:t(e),count:n}}n=n||{};for(var o=n.exclude||[],i=n.paletteSize||10,f={},a="",u=[],s=0;s<e.length;s+=4)u[0]=e[s],u[1]=e[s+1],u[2]=e[s+2],a=u.join(","),-1===u.indexOf(void 0)&&(e[s+3]<85&&(a="transparent"),-1===o.indexOf(t(a))&&(f[a]=a in f?f[a]+1:1));var d=function(e,n){if(e.length>n)return e.slice(0,n);for(var t=e.length-1;t<n-1;t++)e.push(r("0,0,0",0));return e}(function(e){var n=[];for(var t in e)n.push(r(t,e[t]));return n.sort(function(e,n){return n.count-e.count}),n}(f),i+1);return{dominant:d[0].name,secondary:d[1].name,palette:d.map(function(e){return e.name}).slice(1)}}var i={"image-contrast":r};onmessage=function(e){var n=e.data,t=n.task,r=n.data;i[t]?i[t](r):postMessage({error:"Task not registered"})}},{}]},{},[1])(1)});