/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as t,__param as e}from"tslib";import{GraphShaderModule as o,FragmentOutput as r,location as s,uniform as i,input as n,VertexInput as p,UniformGroup as u,FragmentInput as l}from"../../GraphShaderModule.js";import{Vec4 as a,texture2D as m,texelFetch as x,Int as c,IVec2 as d,step as f,Float as v,Vec2 as y,Sampler2D as g}from"../../graph/glsl.js";import{uvToClip as T}from"./utils.js";class w extends p{}t([s(0,y)],w.prototype,"position",void 0);class h extends l{}class b extends u{}t([i(g)],b.prototype,"inputTexture",void 0),t([i(g)],b.prototype,"sumTexture",void 0),t([i(g)],b.prototype,"numOfNoDataTexture",void 0),t([i(v)],b.prototype,"numTexels",void 0);class j extends o{constructor(){super(...arguments),this.type="TextureStatisticsDiffShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new a(T(e),0,1)}}fragment(t){const{inputTexture:e,numOfNoDataTexture:o,sumTexture:s}=this.config,i=new r,n=m(e,t.uv),p=x(s,new d(0,0),new c(0)),u=x(o,new d(0,0),new c(0)).r,l=this.config.numTexels.subtract(u),a=p.divide(l),y=f(n.a,new v(0)),g=new v(1).subtract(y).multiply(n.subtract(a));return i.fragColor=g.multiply(g),i}}t([i(b)],j.prototype,"config",void 0),t([e(0,n(w))],j.prototype,"vertex",null),t([e(0,n(h))],j.prototype,"fragment",null);export{j as TextureStatisticsDiffShader};
