/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { proxyExports as r, GenericController as i } from "@arcgis/lumina/controllers";
import { watch as a } from "@arcgis/core/core/reactiveUtils.js";
import * as n from "@arcgis/core/geometry/operators/projectOperator.js";
class s extends i {
  constructor(o) {
    super(o), this.exports = void 0;
  }
  hostLoaded() {
    this.component.manager.onLifecycle(
      () => a(
        () => {
          const { view: o, trackLocation: t, location: e } = this.component;
          return t && o && e ? [t, e, o.size, o.type === "3d" ? o.camera : o.viewpoint] : null;
        },
        () => {
          this._updateScreenLocation();
        },
        { initial: !0 }
      )
    );
  }
  async _updateScreenLocation() {
    {
      n.isLoaded() || await n.load();
      const { location: o, view: t } = this.component, e = t?.spatialReference, c = e && o ? n.execute(o, e) : null;
      this.exports = this.component.trackLocation && c && t?.ready ? t.toScreen(c) : null;
    }
  }
}
const m = r(s);
export {
  m as t
};
