/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t,__param as o}from"tslib";import{location as e,option as s,input as r}from"../../GraphShaderModule.js";import{Vec4 as i,Vec2 as l,Vec3 as p,Float as n,ifElse as a,greaterThan as m}from"../../graph/glsl.js";import{BaseHittestVertexInput as u,FeatureFragmentInput as h,FeatureVertexInput as c,AFeatureShader as d}from"./AFeatureShader.js";import{noHit as y,trueHit as f}from"./constants.js";import{isRectHittest as v,hittestFill as g,hittestScreenRect as x}from"./hittestUtils.js";import{VisualVariableColor as b}from"./VisualVariableColor.js";import{VisualVariableOpacity as j}from"./VisualVariableOpacity.js";import{getVisualVariableOpacity as w,getVisualVariableColor as V}from"./vvUtils.js";class R extends c{}t([e(3,i)],R.prototype,"color",void 0),t([e(4,l)],R.prototype,"zoomRange",void 0);class S extends d{constructor(){super(...arguments),this.type="FillShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,o){const e=w(this,t.id),s=V(this,t.id,t.color).multiply(e),r=this.view.displayViewScreenMat3.multiply(new p(t.pos.xy,1)),l=this.clip(t.id,t.zoomRange);return{glPosition:new i(r.xy,l,1),color:s,...this.maybeRunHittest(t,o,null)}}fragment(t){return this.getFragmentOutput(t.color,t,new n(0))}hittest(t,o){const{pos0:e,pos1:s,pos2:r}=this.computeHittestTriangle(t,o,null),i=v(this.hittestRequest);return a(i,()=>{const{tlbr:t}=this.hittestRequest;return x(e,s,r,t)},()=>{const e=g(this,t,o);return a(m(e,this.hittestRequest.distance),new n(y),new n(f))})}}t([s(b)],S.prototype,"visualVariableColor",void 0),t([s(j)],S.prototype,"visualVariableOpacity",void 0),t([o(0,r(R)),o(1,r(u))],S.prototype,"vertex",null),t([o(0,r(h))],S.prototype,"fragment",null);export{S as FillShader,R as FillVertexInput};
