/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import{a as g}from"./AC3GTCHJ.js";import"./JD74LG7K.js";import{d}from"./IJQZON2Z.js";import{O as n,P as c,U as o,a as s,b as a}from"./IXZEUVT2.js";import"./H6RQVSYM.js";var y=s`.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}.layers{display:flex;flex-direction:column;gap:var(--arcgis-internal-legend-layer-gap)}.layers>.layer{position:relative}.layers>.layer:not(:last-child):after{content:"";position:absolute;left:0;right:0;bottom:calc(var(--arcgis-internal-legend-layer-gap) / -2);border-bottom:1px solid var(--calcite-color-border-2)}.layers>.layer:last-child{padding-bottom:var(--arcgis-internal-legend-layer-gap)}.layer>.esri-widget__heading{margin:var(--arcgis-internal-legend-heading-margin)}.no-legend{padding:var(--calcite-spacing-sm) var(--calcite-spacing-md)}.layer{padding:var(--arcgis-internal-legend-layer-padding);word-wrap:break-word}.layer-elements{margin-left:var(--calcite-spacing-sm);display:flex;flex-direction:column;gap:var(--arcgis-internal-legend-layer-element-gap);overflow:auto}.layer-children{display:flex;flex-direction:column;gap:var(--arcgis-internal-legend-layer-gap)}.layer-children>.layer{position:relative}.layer-children>.layer:not(:last-child):after{content:"";position:absolute;left:0;right:0;bottom:calc(var(--arcgis-internal-legend-layer-gap) / -2);border-bottom:1px solid var(--calcite-color-border-2)}.layer-child{margin-left:var(--calcite-spacing-sm);padding:0}:dir(rtl) .layer-elements,:dir(rtl) .layer-child{margin-right:var(--calcite-spacing-sm);margin-left:0;overflow:auto}`,t=class extends n{constructor(){super(...arguments),this.headingLevel=3,this.type="classic"}static{this.properties={activeLayerInfos:0,headingLevel:9,type:32,messages:0}}static{this.styles=y}render(){let e=this.activeLayerInfos?.toArray().map(r=>this._renderLegendForLayer(r)).filter(Boolean);return e?.length?a`<section class="layers">${e}</section>`:a`<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 i=e.children.toArray().map(l=>this._renderLegendForLayer(l));return a`<section class="layer">${r}<div class="layer-children">${i}</div></section>`}return this._renderLegendElementsForLayer(e,r)}_renderLegendElementsForLayer(e,r){let i=e.legendElements?.filter(Boolean);if(!i?.length)return null;let l=i.map(h=>a`<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 a`<section class=${c(d("layer",m))}>${r}<div class="layer-elements">${l}</div></section>`}};o("arcgis-legend-classic-view",t);export{t as LegendClassicView};
