/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{b as o}from"./ABSRNM72.js";import{F as n,G as a,H as r,h as t,i as s}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([l])=>{var d=t`/**
 * @license
 * Copyright 2025 Esri
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* TODO update all of these :host */
:host {
  display: block;
}`,i=class extends r{constructor(){super(...arguments),this._legendElement=n()}static{this.properties={mapView:[0,{},{attribute:!1}],legendWidget:[0,{},{attribute:!1}]}}static{this.styles=d}willUpdate(e){e.has("mapView")&&this.mapViewWatchHandler()}async mapViewWatchHandler(){await this.mapView?.when(()=>{this.mapView&&this._initLegend(this.mapView)})}render(){return s`<div ${a(this._legendElement)}></div>`}async loaded(){this.mapView&&await this.mapViewWatchHandler()}_initLegend(e){e&&(this.legendWidget?this.legendWidget.view=e:this.legendWidget=new l({container:this._legendElement.value,respectLayerDefinitionExpression:!0,view:e}))}};o("map-legend",i);return i},"widgets/Legend")