import { c as i } from "../../chunks/runtime.js";
import { usePropertyChange as e } from "@arcgis/lumina/controllers";
import { watch as o } from "@geoscene/core/core/reactiveUtils.js";
import s from "@geoscene/core/widgets/UtilityNetworkValidateTopology.js";
import { LitElement as a, createEvent as r, noShadowRoot as l } from "@arcgis/lumina";
import { m as h } from "../../chunks/useWidget.js";
/*! All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
v4.33.18 */
const w = h(
  
  s
);
class d extends a {
  constructor() {
    super(...arguments), this.widget = w(this), this.viewModel = this.widget.viewModel, this.view = this.widget.view, this.autoDestroyDisabled = !1, this.extentToValidate = this.widget.extentToValidate, this.icon = this.widget.icon, this.label = this.widget.label, this.position = "top-right", this.state = this.viewModel.state, this.utilityNetwork = this.widget.utilityNetwork, this.geoscenePropertyChange = e()("state"), this.geosceneReady = r();
  }
  static {
    this.properties = { view: 16, autoDestroyDisabled: 5, extentToValidate: 1, icon: 1, label: 1, position: 1, referenceElement: 1, state: 3, utilityNetwork: 0 };
  }
  static {
    this.shadowRootOptions = l;
  }
  async destroy() {
    await this.manager.destroy();
  }
  async loaded() {
    await this._loadUtilityNetwork(), this.manager.onLifecycle(() => [
      o(() => this.view, () => {
        this._loadUtilityNetwork();
      })
    ]);
  }
  async _loadUtilityNetwork() {
    if (this.view?.map && this.view.map.portalItem) {
      await this.view.map.load();
      const t = this.view.map.utilityNetworks?.getItemAt(0);
      await t?.load(), this.utilityNetwork = t;
    }
  }
}
i("geoscene-utility-network-validate-topology", d);
export {
  d as GeosceneUtilityNetworkValidateTopology
};