/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as o,__param as t}from"tslib";import{uniform as e,texture as i,input as r,define as s,UniformGroup as l,FragmentOutput as p,TextureGroup as u}from"../../GraphShaderModule.js";import{Vec3 as m,Float as n,Sampler2D as d,FixedArray as y,texture2D as a,dot as h,Vec4 as g,smoothstep as c,mix as v,clamp as f}from"../../graph/glsl.js";import{PostProcessingFragmentInput as b,PostProcessingShader as x}from"./PostProcessingShader.js";class T extends l{}o([e(m)],T.prototype,"defaultColor",void 0),o([e(n)],T.prototype,"defaultOpacity",void 0),o([e(n)],T.prototype,"luminosityThreshold",void 0),o([e(n)],T.prototype,"smoothWidth",void 0);class C extends x{constructor(){super(...arguments),this.type="LuminosityHighPassShader"}fragment(o){const t=new p,e=a(this.luminosityHighPassTexture,o.uv),i=new m(.299,.587,.114),r=h(e.xyz,i),s=new g(this.luminosityHighPassConfig.defaultColor.rgb,this.luminosityHighPassConfig.defaultOpacity),l=c(this.luminosityHighPassConfig.luminosityThreshold,this.luminosityHighPassConfig.luminosityThreshold.add(this.luminosityHighPassConfig.smoothWidth),r);return t.fragColor=v(s,e,l),t}}o([e(T)],C.prototype,"luminosityHighPassConfig",void 0),o([i(d)],C.prototype,"luminosityHighPassTexture",void 0),o([t(0,r(b))],C.prototype,"fragment",null);class w extends l{}o([e(n)],w.prototype,"bloomStrength",void 0),o([e(n)],w.prototype,"bloomRadius",void 0),o([e(y.ofType(n,5))],w.prototype,"bloomFactors",void 0),o([e(m)],w.prototype,"bloomTintColor",void 0);class P extends u{}o([i(d)],P.prototype,"blurTexture1",void 0),o([i(d)],P.prototype,"blurTexture2",void 0),o([i(d)],P.prototype,"blurTexture3",void 0),o([i(d)],P.prototype,"blurTexture4",void 0),o([i(d)],P.prototype,"blurTexture5",void 0);class H extends x{constructor(){super(...arguments),this.type="CompositeShader"}fragment(o){const t=new p,{blurTexture1:e,blurTexture2:i,blurTexture3:r,blurTexture4:s,blurTexture5:l}=this.compositeTextures,{bloomStrength:u,bloomFactors:m,bloomTintColor:d,bloomRadius:y}=this.compositeConfig,h=f(y,new n(0),new n(1)),c=this._lerpBloomFactor(m.get(0),h).multiply(new g(d,1).multiply(a(e,o.uv))),v=this._lerpBloomFactor(m.get(1),h).multiply(new g(d,1).multiply(a(i,o.uv))),b=this._lerpBloomFactor(m.get(2),h).multiply(new g(d,1).multiply(a(r,o.uv))),x=this._lerpBloomFactor(m.get(3),h).multiply(new g(d,1).multiply(a(s,o.uv))),T=this._lerpBloomFactor(m.get(4),h).multiply(new g(d,1).multiply(a(l,o.uv))),C=u.multiply(c.add(v.add(b.add(x.add(T)))));return t.fragColor=C,t}_lerpBloomFactor(o,t){const e=new n(1.2).subtract(o);return v(o,e,t)}}o([s],H.prototype,"numMips",void 0),o([e(w)],H.prototype,"compositeConfig",void 0),o([i(P)],H.prototype,"compositeTextures",void 0),o([t(0,r(b))],H.prototype,"fragment",null);export{H as BloomCompositeShader,C as LuminosityHighPassShader};
