/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t}from"tslib";import{define as o,option as e,uniform as a,UniformGroup as i}from"../../../../GraphShaderModule.js";import{texture2D as r,Vec3 as s,Sampler2D as n,Float as p,Mat3 as g}from"../../../../graph/glsl.js";class u extends i{}t([a(n)],u.prototype,"image1",void 0),t([a(p)],u.prototype,"image1Const",void 0),t([a(g)],u.prototype,"imageSwap",void 0);class l extends i{}t([a(n)],l.prototype,"image1",void 0),t([a(n)],l.prototype,"image2",void 0),t([a(p)],l.prototype,"image1Const",void 0),t([a(p)],l.prototype,"image2Const",void 0),t([a(g)],l.prototype,"imageSwap",void 0);const m=a=>{const i=a;class n extends i{constructor(){super(...arguments),this.constantCount=0,this.imageCount=1}_getRasterValues(t){const{imageCount:o}=this;if(1===o){const o=r(this.config.texture,t);return{a:o.r,b:o.g,c:o.b,alpha:o.a}}if(2===o){const o=this._getTwoValues(t);return{a:o.a,b:o.b,c:o.b,alpha:o.alpha}}return this._getThreeValues(t)}_getTwoValues(t){const o=r(this.config.texture,t);if(1===this.constantCount){const{imageSwap:t,image1Const:e}=this.twoRasterConfig,a=t.multiply(new s(o.r,e,0));return{a:a.x,b:a.y,alpha:o.a}}const{image1:e}=this.twoRasterConfig,a=r(e,t);return{a:o.r,b:a.r,alpha:o.a.multiply(a.a)}}_getThreeValues(t){const o=r(this.config.texture,t),{imageSwap:e,image1:a,image2:i,image1Const:n,image2Const:p}=this.threeRasterConfig;if(2===this.constantCount){const t=e.multiply(new s(o.r,n,p));return{a:t.x,b:t.y,c:t.z,alpha:o.a}}if(1===this.constantCount){const i=r(a,t),p=e.multiply(new s(o.r,i.r,n));return{a:p.x,b:p.y,c:p.z,alpha:o.a.multiply(i.a)}}const g=r(a,t),u=r(i,t);return{a:o.r,b:g.r,c:u.r,alpha:o.a.multiply(g.a).multiply(u.a)}}}return t([o],n.prototype,"constantCount",void 0),t([o],n.prototype,"imageCount",void 0),t([e(u)],n.prototype,"twoRasterConfig",void 0),t([e(l)],n.prototype,"threeRasterConfig",void 0),n};export{m as MultiRasterMixin};
