/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import e from"../Color.js";import{clone as o}from"../core/lang.js";import{property as i,subclass as r}from"../core/accessorSupport/decorators.js";import{collectArcadeFieldNames as s}from"../layers/support/fieldUtils.js";import n from"./Renderer.js";import{VisualVariablesMixin as l}from"./mixins/VisualVariablesMixin.js";import a from"./support/AttributeColorInfo.js";import d from"./support/DotDensityLegendOptions.js";import p from"../symbols/SimpleFillSymbol.js";import u from"../symbols/SimpleLineSymbol.js";import{enumeration as h}from"../core/accessorSupport/decorators/enumeration.js";var y;let c=y=class extends(l(n)){constructor(t){super(t),this.attributes=null,this.backgroundColor=new e([0,0,0,0]),this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new u,this.dotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}calculateDotValue(t){if(null==this.referenceScale)return this.dotValue;const e=t/this.referenceScale*this.dotValue;return e<1?1:e}getSymbol(){return new p({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}getAttributeHash(){return this.attributes?.reduce((t,e)=>t+e.getAttributeHash(),"")??""}getMeshHash(){return JSON.stringify(this.outline)}clone(){return new y({attributes:o(this.attributes),backgroundColor:o(this.backgroundColor),dotBlendingEnabled:o(this.dotBlendingEnabled),dotShape:o(this.dotShape),dotSize:o(this.dotSize),dotValue:o(this.dotValue),legendOptions:o(this.legendOptions),outline:o(this.outline),referenceScale:o(this.referenceScale),seed:o(this.seed),visualVariables:o(this.visualVariables),authoringInfo:o(this.authoringInfo)})}getControllerHash(){const t=this.attributes?.map(t=>t.field||t.valueExpression||"");return`${t}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(t,e){await this.collectVVRequiredFields(t,e);for(const o of this.attributes??[])o.valueExpression&&await s(t,e,null,o.valueExpression),o.field&&t.add(o.field)}};t([i({type:[a],json:{write:!0}})],c.prototype,"attributes",void 0),t([i({type:e,json:{write:!0}})],c.prototype,"backgroundColor",void 0),t([i({type:Boolean,json:{write:!0}})],c.prototype,"dotBlendingEnabled",void 0),t([i({type:String,json:{write:!1}})],c.prototype,"dotShape",void 0),t([i({type:Number,json:{write:!0}})],c.prototype,"dotSize",void 0),t([i({type:d,json:{write:!0}})],c.prototype,"legendOptions",void 0),t([i({type:u,json:{default:null,write:!0}})],c.prototype,"outline",void 0),t([i({type:Number,json:{write:!0}})],c.prototype,"dotValue",void 0),t([i({type:Number,json:{write:!0}})],c.prototype,"referenceScale",void 0),t([i({type:Number,json:{write:!0}})],c.prototype,"seed",void 0),t([h({dotDensity:"dot-density"})],c.prototype,"type",void 0),c=y=t([r("esri.renderers.DotDensityRenderer")],c);export{c as default};
