/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t}from"tslib";import{define as o,uniform as e}from"../../../../GraphShaderModule.js";import{max as r,abs as s,Vec4 as i}from"../../../../graph/glsl.js";import{BaseRasterProcessorShader as a}from"./BaseRasterProcessorShader.js";import{DomainRangeConfig as p}from"./LocalShader.js";import{invertValue as m,getRangeClipFactor as d,roundOutput as n}from"./math.js";import{MultiRasterMixin as u}from"./MultiRasterMixin.js";class h extends(u(a)){constructor(){super(...arguments),this.type="ComputeChangeShader",this.isOutputRounded=!1}_process(t){const{a:o,b:e,alpha:a}=this._getRasterValues(t);let p=o.subtract(e);"relative-difference"===this.method&&(p=p.multiply(m(r(s(o),s(e)))));const u=d(p,this.domainRangeConfig.domainRange),h=new i(p,p,p,a).multiply(u);return this.isOutputRounded?n(h):h}}t([o],h.prototype,"method",void 0),t([o],h.prototype,"isOutputRounded",void 0),t([e(p)],h.prototype,"domainRangeConfig",void 0);export{h as ComputeChangeShader};
