(()=>{importScripts("../../vendor_js/chroma.min.js"),addEventListener("message",function(t){var r=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return n.k(r),n.iterations(i),n.data(t),n.clusters()}(function(n,t){var r,i,o,e=[],a=4,u=0;for(r=0,i=n.length;r<i;r+=a){if(0!==(o=n.slice(r,r+a))[3]){var c=chroma([o[0],o[1],o[2]]),l=c.lab();c.luminance()>.05&&e.push(l)}u<t-1?u+=1:(u=0,1)}return e}(t.data.imageData),5,10);r.sort(function(n,t){return n.points.length>t.points.length?-1:n.points.length<t.points.length?1:0}),r.splice(3);var i,o,e=r.map(function(n){return chroma(n.centroid,"lab").rgb()});i="Palette",o=e,self.postMessage({type:"palette",label:i,colors:o})});var n={data:i([],function(n){var t=n[0].length;return n.map(function(n){return n.length===t}).reduce(function(n,t){return n&t},!0)}),clusters:function(){var n=function(n,i){for(var o=i.k||Math.round(Math.sqrt(n.length/2)),e=i.iterations,a=n.map(function(n){return new t(n)}),u=[],c=0;c<o;c++)u.push(new r(a[c%a.length].location(),c));for(var l=0;l<e;l++)a.forEach(function(n){n.updateLabel(u)}),u.forEach(function(n){n.updateLocation(a)});return{points:a,centroids:u}}(this.data(),{k:this.k(),iterations:this.iterations()}),i=n.points;return n.centroids.map(function(n){return{centroid:n.location(),points:i.filter(function(t){return t.label()===n.label()}).map(function(n){return n.location()})}})},k:i(void 0,function(n){return n%1==0&n>0}),iterations:i(Math.pow(10,3),function(n){return n%1==0&n>0})};function t(n){var t=this;this.location=i(n),this.label=i(),this.updateLabel=function(n){var r,i,o=n.map(function(n){return r=t.location(),i=n.location(),r.map(function(n,t){return Math.pow(n-i[t],2)}).reduce(function(n,t){return n+t},0);var r,i});t.label((i=(r=o).reduce(function(n,t){return Math.min(n,t)}),r.indexOf(i)))}}function r(n,t){var r=this;this.location=i(n),this.label=i(t),this.updateLocation=function(n){var t=n.filter(function(n){return n.label()===r.label()});t.length>0&&r.location(function(n){var t=n[0].location().map(function(){return 0}),r=n.map(function(n){return n.location()});return r.reduce(function(n,t){return function(n,t){return n.map(function(n,r){return n+t[r]})}(n,t)},t).map(function(t){return t/n.length})}(t))}}function i(n,t){var r=n,i=t||function(n){return!0};return function(n){if(void 0===n)return r;i(n)&&(r=n)}}(window.sm=window.sm||{})["customizer-worker"]={}})();