/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../../Color.js";import{deprecateWidget as i}from"../../core/deprecate.js";import s from"../../core/Logger.js";import{property as r,cast as o,subclass as a}from"../../core/accessorSupport/decorators.js";import l from"./SmartMappingSliderBase.js";import n from"./OpacitySlider/OpacitySliderViewModel.js";import{globalCss as p}from"../support/globalCss.js";import{messageBundle as d,tsx as m}from"../support/widget.js";var c;const g="esri-opacity-slider",h={base:g,rampElement:`${g}__ramp`,sliderContainer:`${g}__slider-container`,histogramContainer:`${g}__histogram-container`,track:`${g}--interactive-track`},v={trackFillColor:new e([0,121,193])};let u=c=class extends l{constructor(t,e){super(t,e),this.messages=null,this.style={...v},this.viewModel=new n,this._rampFillId=`${this.id}-ramp-fill`,this._bgFillId=`${this.id}-bg-fill`,this.announceDeprecation=()=>{i(s.getLogger(this),"Slider Opacity","arcgis-slider-opacity-legacy",{version:"5.0"})}}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get stops(){return this.viewModel.stops}set stops(t){this.viewModel.stops=t}castStyle(t){return{...v,...t}}static fromVisualVariableResult(t,e){const{visualVariable:{stops:i},statistics:s}=t,{avg:r,max:o,min:a,stddev:l}=s;return new c({max:o??void 0,min:a??void 0,stops:i,histogramConfig:{average:r??void 0,standardDeviation:l??void 0,bins:e?e.bins:[]}})}updateFromVisualVariableResult(t,e){const{visualVariable:{stops:i},statistics:s}=t,{avg:r,max:o,min:a,stddev:l}=s;this.set({max:o,min:a,stops:i,histogramConfig:{...this.histogramConfig,average:r,standardDeviation:l,bins:e?e.bins:[]}})}render(){const{state:t,label:e,visibleElements:i}=this,s="disabled"===t,r=this.classes(h.base,p.widget,p.panel,{[p.disabled]:s,[h.track]:!!i.interactiveTrack});return m("div",{"aria-label":e,class:r},s?null:this.renderContent(this._renderRamp(),h.sliderContainer,h.histogramContainer))}_renderRamp(){const{_bgFillId:t,_rampFillId:e,style:{trackFillColor:i},viewModel:s,zoomOptions:r}=this,o=s.getStopInfo(i);return m("div",{class:h.rampElement},m("svg",{xmlns:"http://www.w3.org/2000/svg"},m("defs",null,this.renderRampFillDefinition(e,o),this.renderBackgroundFillDefinition(t)),m("rect",{fill:`url(#${t})`,height:"100%",width:"100%",x:"0",y:"0"}),m("rect",{fill:`url(#${e})`,height:"100%",width:"100%",x:"0",y:"0"})),r?this.renderZoomCaps():null)}};t([r()],u.prototype,"label",null),t([r(),d("esri/widgets/smartMapping/OpacitySlider/t9n/OpacitySlider")],u.prototype,"messages",void 0),t([r()],u.prototype,"stops",null),t([r()],u.prototype,"style",void 0),t([o("style")],u.prototype,"castStyle",null),t([r({type:n})],u.prototype,"viewModel",void 0),u=c=t([a("esri.widgets.smartMapping.OpacitySlider")],u);const b=u;export{b as default};
