/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import d from"./GZOUQRDW.js";import c from"./ALDQUO5D.js";import b from"./UWNOOVZA.js";import a from"./57L6ONED.js";import{a as p}from"./I5GF7UR6.js";import{a as _}from"./BJW2H6TX.js";import{b as h}from"./YMMGYOOO.js";import"./5IZMQFRP.js";import"./FOQPGXXA.js";import{H as v,J as u,h as m,i as r}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([f,,,{a:s,b:x},{c:d,e:y,h:I,m:$,n:C,p:T,q:b,t:L}])=>{var w=m`:host{display:flex;align-items:center}.instant-apps-interactive-legend__total-feature-count{font-weight:var(--calcite-font-weight-medium);font-size:var(--calcite-font-size-0)}.instant-apps-interactive-legend__info-count-text{font-size:var(--instant-apps-interactive-legend-info-font-size);color:var(--instant-apps-interactive-legend-secondary-color)}.calcite-mode-dark.instant-apps-interactive-legend__info-count-text.instant-apps-interactive-legend__info-count-text--selected{color:var(--calcite-color-text-inverse)}.instant-apps-interactive-legend-count--compact .instant-apps-interactive-legend__total-feature-count{font-size:.75rem}:host:dir(rtl){margin-left:0;margin-right:auto}`,c={countText:" instant-apps-interactive-legend__info-count-text",countTextSelected:" instant-apps-interactive-legend__info-count-text--selected",totalFeatureCount:"instant-apps-interactive-legend__total-feature-count",compact:"instant-apps-interactive-legend-count--compact"},g=class extends v{constructor(){super(...arguments),this._messages=_({name:"instant-apps-interactive-legend"}),this.showTotal=!1,this.categoryId=""}static{this.properties={showTotal:5,legendvm:0,activeLayerInfo:0,categoryId:1,infoIndex:9,selected:5,legendElement:0}}static{this.styles=w}load(){new MutationObserver(()=>{this.requestUpdate()}).observe(this.el,{attributes:!0})}getCount(){let{categoryId:e}=this,a=this.activeLayerInfo.layer.id,o=s.data[a]?.categories?.size;if((!s.data||!a||!e)&&!o)return"";let i=s.data[a];if(!i)return;let{categories:l}=i,t=l.get(e),n;return t?.nestedInfos?n=T(t,this.infoIndex):n=t,Number.isNaN(n.count)?"":f.formatNumber(n.count)}getTotalFeatureCount(){let e=this.activeLayerInfo.layer.id;if(!s.data||!e)return"";let a=s.data[e];if(!a)return;let{categories:o}=a,i=d(o),l=b(o),t;if(l)t=C(i);else if(I(this.activeLayerInfo)){let n=y(this.activeLayerInfo.layer);t=d(n.categories)[1].count}else t=$(i);return f.formatNumber(t)}render(){let e=x.get("compact")?c.compact:"";return p("int-legend-count",r`<div class=${u(e)}>${this.showTotal?r`<span class=${u(c.totalFeatureCount)}>${this._messages?.totalFeatureCount}: ${this.getTotalFeatureCount()}</span>`:p("element-info-count",r`<span class=${`${c.countText} ${L(this.el)}${this.selected?c.countTextSelected:""}`}>${this.getCount()}</span>`)}</div>`)}};h("instant-apps-interactive-legend-count",g);return g},"intl",a,b,c,d)