/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{a as g}from"./2IJD7J75.js";import"./XNN7SCKW.js";import"./DHVEHATY.js";import{b as d}from"./ZNBKMZP7.js";import{O as l,P as c,U as o,a as n,b as i}from"./7H4DKXI2.js";import"./ALDX5YZO.js";var f=n`.esri-widget__heading{color:var(--calcite-color-text-2);margin:0 0 .5rem;font-weight:var(--calcite-font-weight-semibold)}h1.esri-widget__heading{font-size:var(--calcite-font-size-xl)}h2.esri-widget__heading{font-size:var(--calcite-font-size-md)}h3.esri-widget__heading,h4.esri-widget__heading,h5.esri-widget__heading,h6.esri-widget__heading{font-size:var(--calcite-font-size)}:host{display:block}.no-legend{padding:var(--calcite-spacing-sm) var(--calcite-spacing-md)}.layer{border-bottom:1px solid var(--calcite-color-border-2);padding:var(--arcgis-internal-padding, var(--calcite-spacing-md) var(--calcite-spacing-lg));word-wrap:break-word}.layer:last-child{border-bottom:none}.layer-elements{margin-left:var(--calcite-spacing-sm);overflow:auto}.layer-child{margin-left:var(--calcite-spacing-sm);padding-right:0;padding-left:0}:dir(rtl) .layer-elements,:dir(rtl) .layer-child{margin-right:var(--calcite-spacing-sm);margin-left:0;overflow:auto}`,a=class extends l{constructor(){super(...arguments),this.headingLevel=3,this.type="classic"}static{this.properties={activeLayerInfos:0,headingLevel:9,type:32,messages:0}}static{this.styles=f}render(){let e=this.activeLayerInfos?.toArray().map(r=>this._renderLegendForLayer(r)).filter(Boolean);return e?.length?i`<section>${e}</section>`:i`<div class="no-legend">${this.messages.noLegend}</div>`}_renderLegendForLayer(e){if(!e.ready)return null;let r=e.title?g({level:this.headingLevel,children:e.title}):null;if(e.children.length){let s=e.children.toArray().map(t=>this._renderLegendForLayer(t));return i`<section class="layer">${r}${s}</section>`}return this._renderLegendElementsForLayer(e,r)}_renderLegendElementsForLayer(e,r){let s=e.legendElements?.filter(Boolean);if(!s?.length)return null;let t=s.map(h=>i`<arcgis-legend-classic-element .cssEffectFilter=${e.cssEffectFilter??void 0} .layer=${e.layer} .legendElement=${h} .messages=${this.messages}></arcgis-legend-classic-element>`),m={"layer-child":!!e.parent};return i`<section class=${c(d("layer",m))}>${r}<div class="layer-elements">${t}</div></section>`}};o("arcgis-legend-classic-view",a);export{a as LegendClassicView};
