/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../Color","../../core/maybe"],(function(t,e,n,r){"use strict";function o(t){return a.apply(this,arguments)}function a(){return(a=e._asyncToGenerator((function*(t){yield t.whenReady();const e=t.basemapView.baseLayerViews.map((t=>t.layer));if(!e.length){const e=getComputedStyle(t.container).backgroundColor,r=e&&new n(e);return t.get("background.color")||(r&&0!==r.a?r:null)||null}const r=(yield t.takeScreenshot({format:"png",layers:e.toArray()})).data.data,o=r.length;let a=0,u=0,l=0,i=0,c=0,s=0;for(let n=0;n<o;n+=4){const t=r[n],e=r[n+1],o=r[n+2],d=r[n+3],h=d/255;a+=t*t*h,u+=e*e*h,l+=o*o*h,c+=h,d&&(i+=d,s++)}a=Math.round(Math.sqrt(a/c)),u=Math.round(Math.sqrt(u/c)),l=Math.round(Math.sqrt(l/c));return new n([a,u,l,i/s/255])}))).apply(this,arguments)}function u(t){return l.apply(this,arguments)}function l(){return(l=e._asyncToGenerator((function*(t){if(!t)return null;const e=yield o(t);return r.isSome(e)?i(e):null}))).apply(this,arguments)}function i(t){return c(t).isBright?"light":"dark"}function c(t){let{r:e,g:r,b:o,a}=t;return a<1&&(e=Math.round(a*e+255*(1-a)),r=Math.round(a*r+255*(1-a)),o=Math.round(a*o+255*(1-a))),new n({r:e,g:r,b:o})}function s(t){const{r:e,g:n,b:r}=c(t);return.2126*e+.7152*n+.0722*r}t.getBackgroundColor=o,t.getBackgroundColorTheme=u,t.getColorLuminance=s,t.getColorTheme=i,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
