/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{maxMapSizeGpu as n}from"../../../../../../../../../layers/raster/functions/pixelUtils.js";import{step as t,Vec3 as e,sign as r,dot as l,abs as o,Vec4 as u,floor as i,Float as s,mix as c}from"../../../../graph/glsl.js";function w(n){const t=r(n),e=n.add(o(t).subtract(1));return t.multiply(t).divide(e)}function a(n){return new u(i(n.rgb.add(.5)),n.a)}function d(n,e){return t(e.x,n).multiply(t(n,e.y))}function f(o,u){let i=new e(0,0,0);const s=new e(o);for(let r=0;r<n/3;r++){const n=6*r,l=new e(u[n],u[n+2],u[n+4]),o=new e(u[n+1],u[n+3],u[n+5]);i=i.add(t(l,s).multiply(t(s,o)))}return r(l(i,new e(1,1,1)))}function p(n,o,u){const i=new e(n);let w=new e(0,0,0),a=new s(0);for(let r=0;r<u/3;r++){const n=9*r,l=new e(o[n],o[n+3],o[n+6]),u=new e(o[n+1],o[n+4],o[n+7]),s=t(l,i).multiply(t(i,u)),d=new e(o[n+2],o[n+5],o[n+8]);a=c(a,d.x,s.x),a=c(a,d.y,s.y),a=c(a,d.z,s.z),w=w.add(s)}return{mapValue:a,includeMask:r(l(w,new e(1,1,1)))}}export{p as computeMapValue,f as computeSingleBandRangeFactor,d as getRangeClipFactor,w as invertValue,a as roundOutput};
