/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{CIMSymbolUnits as i}from"../../../../../../../symbols/cim/types.js";import{spritePadding as r,gradientTextureExternalPadding as s}from"../../../definitions.js";import{packBitset as o}from"../fill/meshWriterUtils.js";import{bitset as n}from"./gradientStrokeConstants.js";import{LineMeshWriter as a,LineVertexSpec as c}from"./LineMeshWriter.js";import{DataType as p}from"../../../../../../webgl/enums.js";const m={createComputedParams:t=>t,optionalAttributes:c.optionalAttributes,attributes:{...c.attributes,bitset:{type:p.UNSIGNED_BYTE,count:1,pack:({gradientMethod:t,gradientSizeUnits:e,gradientType:r})=>o([[n.isAlongLine,"alongline"===t.toLowerCase()],[n.isAbsoluteSize,e===i.Absolute],[n.isDiscrete,"discrete"===r.toLowerCase()]])},tlbr:{type:p.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:i,height:o}=t,n=e.x+r+s,a=e.y+r;return[n,a,n+i-2*s,a+o]}},accumulatedDistance:{type:p.HALF_FLOAT,count:1,packTessellation:({distance:t,pathLength:e,distanceOffset:i})=>(i+t)/e},gradientSize:{type:p.HALF_FLOAT,count:1,pack:({gradientSize:e,gradientSizeUnits:r})=>r===i.Relative?e/100:t(e)},totalLength:{type:p.HALF_FLOAT,count:1,packTessellation:({pathLength:t})=>t},segmentDirection:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]}}};class l extends a{get _preventEffectClipping(){return!0}constructor(t,e,i,r){super(t,e,i,r),this.vertexSpec=m,this._tessellationOptions.textured=!0}_write(t,i,r){const s=r??e.fromFeatureSetReaderCIM(i);if(!s)return;const{sprite:o}=this.evaluatedMeshParams;this._writeGeometry(t,i,s,o?.textureBinding)}}export{l as GradientStrokeMeshWriter,m as GradientStrokeVertexSpec};
