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