/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../../core/accessorSupport/decorators.js";import l from"../../../Widget.js";import{css as i}from"./css.js";import{getUnivariateAboveAndBelowRampElements as a,getUnivariateColorRampSize as r,getUnivariateColorRampPreview as o,getUnivariateColorRampMargin as p,univariateColorRampContainerStyles as n,univariateColorRampStyles as d,univariateRampContainerStyles as c}from"../support/univariateUtils.js";import{attachToNode as m}from"../../support/styleUtils.js";import{tsx as v}from"../../../support/widget.js";let y=class extends l{constructor(e,t){super(e,t),this.cssEffectFilter=null,this.legendElement=null,this.opacity=1}render(){const{legendElement:e,opacity:t,cssEffectFilter:s,key:l}=this,{sizeRampElement:y,colorRampElement:b}=a(e,t);if(!y)return null;const f=this.messages.previewColorRampAriaLabel,u=r(y,"above",!0),g=r(y,"below",!0),h=12,w=o(b,{width:h,height:u,rampAlignment:"vertical",opacity:t,type:"above",cssEffectFilter:s,ariaLabel:f}),A=o(b,{width:h,height:g,rampAlignment:"vertical",opacity:t,type:"below",cssEffectFilter:s,ariaLabel:f}),E=p(y),L=y.infos.map(e=>e.label),$=L.map((e,t)=>{const s=2===t;return 0===t?v("div",{class:e?w?i.univariateAboveAndBelowLabel:i.rampLabel:void 0,key:`${l}-color-ramp-above-label-${e??t}`},e):s?v("div",null):null}),C=L.length-1,j=Math.floor(L.length/2),R=L.map((e,t)=>t===j||t===C?v("div",{class:e?w?i.univariateAboveAndBelowLabel:i.rampLabel:void 0,key:`${l}-color-ramp-below-label-${e??t}`},e):null),k={display:"table-cell",verticalAlign:"middle"},x={marginTop:`${E}px`},F={height:`${u}px`},B={height:`${g}px`};return v("div",{key:`${l}-container`,styles:c},v("div",{class:i.layerBody},y.infos.map((e,t)=>v("div",{class:this.classes(i.layerRow,i.sizeRamp),key:`${l}-row-${t}`},v("div",{afterCreate:m,bind:e.preview,class:i.symbol,styles:k}),w||t%2!=0?null:v("div",{class:i.layerInfo},L[t])))),w?v("div",{styles:x},v("div",{styles:n},v("div",{styles:d},v("div",{afterCreate:m,bind:w,class:i.rampContainer})),v("div",{styles:d},v("div",{class:i.rampLabelsContainer,styles:F},$))),v("div",{styles:n},v("div",{styles:d},v("div",{afterCreate:m,bind:A,class:i.rampContainer})),v("div",{styles:d},v("div",{class:i.rampLabelsContainer,styles:B},R)))):null)}};e([t()],y.prototype,"cssEffectFilter",void 0),e([t()],y.prototype,"legendElement",void 0),e([t()],y.prototype,"messages",void 0),e([t()],y.prototype,"opacity",void 0),y=e([s("esri.widgets.Legend.styles.classic.UnivariateAboveAndBelowRamp")],y);export{y as default};
