/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import a from"./3AEP2FXT.js";import{d as m}from"./IJQZON2Z.js";import{O as v,P as c,Q as f,R as n,U as b,a as h,b as s}from"./IXZEUVT2.js";import"./H6RQVSYM.js";export default $arcgis.t(([{a:o,b:$,d:u,g:d,h:g}])=>{var _=h`:host{contain:content}.layer-table{display:table;width:100%}.layer-caption{display:table-caption;padding:var(--calcite-spacing-sm) 0;word-break:break-word}.layer-body{margin-left:var(--calcite-spacing-sm)}:dir(rtl) .layer-body{margin-right:var(--calcite-spacing-sm);margin-left:0;overflow:auto}.layer-row{display:table-row}.layer-cell{padding:var(--calcite-spacing-xxs) 0;vertical-align:middle;word-break:break-word;display:table-cell}.layer-cell-info{padding-right:var(--calcite-spacing-sm);padding-left:var(--calcite-spacing-sm);max-width:250px;word-break:normal;word-wrap:normal;font-size:var(--calcite-font-size-sm)}.imagery-layer-stretched-image{display:block;margin-bottom:-2px}.imagery-layer-info-stretched{padding:0 2px;vertical-align:top}.layer-cell-symbols{text-align:center}.symbol{display:flex;justify-content:center}`,p=class extends v{static{this.properties={cssEffectFilter:1,layer:0,legendElement:0,messages:0}}static{this.styles=_}render(){let e=this._renderLegendElement(),a=$(this.legendElement,this.messages),i=a?s`<div class="layer-caption">${a}</div>`:null;return s`<section class="layer-table">${i}${e}</section>`}_renderLegendElement(){switch(this.legendElement.type){case"symbol-table":return this._renderSymbolTable(this.legendElement);case"size-ramp":return s`<arcgis-legend-classic-size-ramp .legendElement=${this.legendElement} .messages=${this.messages}></arcgis-legend-classic-size-ramp>`;case"color-ramp":case"opacity-ramp":case"heatmap-ramp":case"stretch-ramp":return s`<arcgis-legend-classic-color-ramp .legendElement=${this.legendElement} .messages=${this.messages} .opacity=${this.layer.opacity}></arcgis-legend-classic-color-ramp>`;case"relationship-ramp":return s`<arcgis-legend-relationship-ramp .cssEffectFilter=${this.cssEffectFilter} .legendElement=${this.legendElement} .opacity=${this.layer.opacity} .messages=${this.messages}></arcgis-legend-relationship-ramp>`;case"pie-chart-ramp":{let{preview:e}=this.legendElement;return g(e,this.messages.previewPieChartAriaLabel),s`<div>${e}</div>`}case"univariate-above-and-below-ramp":return s`<arcgis-legend-classic-univariate-above-and-below-ramp .cssEffectFilter=${this.cssEffectFilter} .legendElement=${this.legendElement} .messages=${this.messages} .opacity=${this.layer.opacity}></arcgis-legend-classic-univariate-above-and-below-ramp>`;case"univariate-color-size-ramp":return s`<arcgis-legend-classic-univariate-color-size-ramp .cssEffectFilter=${this.cssEffectFilter} .legendElement=${this.legendElement} .messages=${this.messages} .opacity=${this.layer.opacity}></arcgis-legend-classic-univariate-color-size-ramp>`;default:return null}}_renderSymbolTable(e){let a=e.infos.map(i=>this._renderElementInfo(i,e.legendType)).filter(Boolean);return a.length?s`<div class="layer-body">${a}</div>`:null}_renderElementInfo(e,a){let{layer:i}=this,r="label"in e?e.label:null;if("type"in e&&e.type)return e?s`<arcgis-legend-classic-element .cssEffectFilter=${this.cssEffectFilter} .layer=${i} .legendElement=${e} .messages=${this.messages}></arcgis-legend-classic-element>`:null;if(!("preview"in e&&e.preview)&&!("src"in e&&e.src))return null;let l=u(i,a),t={"imagery-layer-info-stretched":l};return s`<div class="layer-row"><div class=${c(m("layer-cell","layer-cell-symbols",{"imagery-layer-info-stretched":l}))}>${this._renderPreview(e,l)}</div><div class=${c(m("layer-cell","layer-cell-info",t))}>${o(this.messages,r,!1)||""}</div></div>`}_renderPreview(e,a){let{layer:i}=this;if("preview"in e&&e.preview){let{preview:r}=e,l="previewAriaLabel"in e?e.previewAriaLabel:null,t="label"in e?o(this.messages,e.label,!1):null;return g(r,d(this.messages,l||t)),s`<div class="symbol">${r}</div>`}return"src"in e&&e.src?this._renderImage(e,i,a):null}_renderImage(e,a,i){let{previewAriaLabel:r,src:l,opacity:t}=e,w=o(this.messages,e.label,!1),E={"imagery-layer-stretched-image":i,symbol:!i},L={opacity:`${t??a.opacity}`},y=d(this.messages,r||w);return s`<img alt=${y??n} .ariaLabel=${y} class=${c(m(E))} height=${e.height??void 0??n} src=${l??n} style=${f(L)} width=${e.width??void 0??n}>`}};b("arcgis-legend-classic-element",p);return p},a)