/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as t } from "../../chunks/runtime.js";
import { css as e, html as s } from "lit";
import { LitElement as l, safeStyleMap as r } from "@arcgis/lumina";
import { createRef as a, ref as c } from "lit-html/directives/ref.js";
const o = e`:host{display:block}`;
class y extends l {
  constructor() {
    super(...arguments), this.layerListRef = a(), this.visibilityIcon = "eyeball";
  }
  static {
    this.properties = { mapView: 0, layerListRef: 0, visibilityIcon: 1 };
  }
  static {
    this.styles = o;
  }
  willUpdate(i) {
    i.has("visibilityIcon") && this.visibilityIconWatchHandler();
  }
  async visibilityIconWatchHandler() {
    this.layerListRef.value && (this.layerListRef.value.visibilityAppearance = this.visibilityIcon === "checkbox" ? "checkbox" : "default");
  }
  render() {
    return this.mapView && s`<arcgis-layer-list style=${r(document.dir === "rtl" ? "direction: rtl;" : "direction: ltr;")} auto-destroy-disabled .view=${this.mapView} .visibilityAppearance=${this.visibilityIcon === "checkbox" ? "checkbox" : "default"} ${c(this.layerListRef)}></arcgis-layer-list>` || "";
  }
}
t("layer-list-widget", y);
export {
  y as LayerListWidget
};
