// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define(["exports","../../core/has","../../core/mathUtils","../../core/imageUtils"],function(p,W,C,N){function D(a,b){const {format:d,quality:e,rotation:g,disableDecorations:k}=a||{};var c=z(a,b.padding);var f=b.width-c.left-c.right;b=b.height-c.top-c.bottom;c={x:0,y:0,width:f,height:b};if(a?.area){null!=a.area.x&&(c.x=Math.floor(a.area.x));null!=a.area.y&&(c.y=Math.floor(a.area.y));var h=null!=a.area.width?Math.floor(a.area.width):null,m=null!=a.area.height?Math.floor(a.area.height):null;c.width= f-c.x;c.height=b-c.y;null!=h&&null!=m?(c.width=Math.min(c.width,h),c.height=Math.min(c.height,m)):null==h&&null!=m?(h=Math.min(c.width,h),c.height*=h/c.width,c.width=h):null!=h&&null==m&&(h=Math.min(c.height,m),c.width*=h/c.height,c.height=h)}c=O(c,a);h=Math.floor(Math.max(c.x,0));m=Math.floor(Math.max(c.y,0));f={x:h,y:m,width:Math.floor(Math.min(c.width,f-h)),height:Math.floor(Math.min(c.height,b-m))};b=f.width/f.height;c=c.width/c.height;c!==b&&(c>b?(b=Math.floor(f.width/c),f={x:f.x,y:Math.floor(f.y+ (f.height-b)/2),width:f.width,height:b}):(b=Math.floor(f.height*c),f={x:Math.floor(f.x+(f.width-b)/2),y:f.y,width:b,height:f.height}));const {width:n,height:r}=P(a,f);b=E(d);c=F[b];c=C.clamp(null!=e?e:c,0,100);return{format:b,quality:c,area:f,width:n,height:r,rotation:g,disableDecorations:!!k,ignoreBackground:!!a?.ignoreBackground,ignorePadding:!!a?.ignorePadding}}function G(a,b){null==A&&(A=document.createElement("canvas"));var d=A;if(b.premultipliedAlpha){var e=a.data;const k=e.length;for(let c= 0;ch[u+3]&&(l=l*h[u+3]/255);J+=l*h[u];K+=l*h[u+1];L+=l*h[u+2];w+=l}}r[v]=J/w;r[v+1]=K/w;r[v+2]=L/w;r[v+3]=M/I}return b};p.screenshotSuperSampleSettings=function(a,b,d){if(!b)return a;const {framebufferWidth:e,framebufferHeight:g,pixelRatio:k, region:c}=a;b=z(a,d);d=b.left+b.right;const f=b.top+b.bottom,h=e-d,m=g-f,n=Math.min(8,Math.min((2048-d)/h,(2048-f)/m));return 1.5>n?a:{...a,framebufferWidth:Math.round(h*n)+d,framebufferHeight:Math.round(m*n)+f,pixelRatio:k*n,resample:{region:{x:Math.round((c.x-b.left)*n)+b.left,y:Math.round((c.y-b.top)*n)+b.top,width:Math.round(c.width*n),height:Math.round(c.height*n)},width:e,height:g}}};p.toDataUrl=H;p.toRenderSettings=function(a,b){const d=D(a,b),e=d.area,g=d.width/e.width,k=z(d,b.padding),c= k.left+k.right,f=k.top+k.bottom;return{framebufferWidth:Math.floor((b.width-c)*g+c),framebufferHeight:Math.floor((b.height-f)*g+f),region:{x:Math.floor(e.x*g)+k.left,y:Math.floor(e.y*g)+k.top,width:d.width,height:d.height},format:d.format,quality:d.quality,rotation:d.rotation,pixelRatio:g,layers:a?.layers??[],disableDecorations:d.disableDecorations,ignoreBackground:d.ignoreBackground,ignorePadding:d.ignorePadding,objectAndLayerIdColor:!1}};Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});