/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{b as d}from"./RFGSSUZF.js";import{F as a,G as n,H as r,h as i,i as s}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([m])=>{var p=i`:host{display:block}`,t=class extends r{constructor(){super(...arguments),this._legendElement=a()}static{this.properties={mapView:0,legendWidget:0}}static{this.styles=p}willUpdate(e){e.has("mapView")&&this.mapViewWatchHandler()}async mapViewWatchHandler(){await this.mapView?.when(()=>{this.mapView&&this._initLegend(this.mapView)})}render(){return s`<div ${n(this._legendElement)}></div>`}async loaded(){this.mapView&&await this.mapViewWatchHandler()}_initLegend(e){e&&(this.legendWidget?this.legendWidget.view=e:this.legendWidget=new m({container:this._legendElement.value,respectLayerDefinitionExpression:!0,view:e}))}};d("map-legend",t);return t},"widgets/Legend")