/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../../chunks/_rollupPluginBabelHelpers","../../../../../core/maybe","../enums","../Utils","./WGLGeometryBrush","../materialKey/MaterialKey","../../../../webgl/enums"],(function(e,t,a,o,n,i,r){"use strict";const s=e=>o.createProgramDescriptor(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.DataType.SHORT},{location:1,name:"a_id",count:4,type:r.DataType.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.DataType.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:r.DataType.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texFontSize",count:4,type:r.DataType.UNSIGNED_BYTE},{location:5,name:"a_aux",count:4,type:r.DataType.BYTE},{location:6,name:"a_zoomRange",count:2,type:r.DataType.UNSIGNED_SHORT},{location:7,name:"a_vertexOffset",count:2,type:r.DataType.SHORT},{location:8,name:"a_texCoords",count:2,type:r.DataType.UNSIGNED_SHORT}]});let y=function(o){function n(){return o.apply(this,arguments)||this}e._inheritsLoose(n,o);var y=n.prototype;return y.dispose=function(){},y.getGeometryType=function(){return a.WGLGeometryType.TEXT},y.supportsSymbology=function(e){return!0},y.drawGeometry=function(e,a,o,n){const{context:y,painter:p,rendererInfo:m,state:u,passOptions:l,requestRender:c}=e,T=i.TextMaterialKey.load(o.materialKey),_=t.isSome(l)&&"hittest"===l.type,{bufferLayouts:d,attributes:f}=s(T),E=p.materialManager.getMaterialProgram(e,T,"materials/text",f,n);if(t.isSome(c)&&!_&&!E.isCompiled)return void c();y.useProgram(E);let N=r.PrimitiveType.TRIANGLES;_&&(N=r.PrimitiveType.POINTS),this._setSharedUniforms(E,e,a),p.textureManager.bindTextures(y,E,T),E.setUniformMatrix3fv("u_displayMat3",u.displayMat3),E.setUniformMatrix3fv("u_displayViewMat3",u.displayViewMat3),this._setSizeVVUniforms(T,E,m,a),this._setColorAndOpacityVVUniforms(T,E,m),this._setRotationVVUniforms(T,E,m),E.setUniform1f("u_isHalo",1);const S=o.target.getVAO(y,d,f),D=o.indexFrom*Uint32Array.BYTES_PER_ELEMENT;y.bindVAO(S),y.drawElements(r.PrimitiveType.TRIANGLES,o.indexCount,r.DataType.UNSIGNED_INT,D),E.setUniform1f("u_isHalo",0),y.drawElements(N,o.indexCount,r.DataType.UNSIGNED_INT,D)},n}(n);return y}));
