/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{when as o,watch as i}from"../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{projectOrLoad as s}from"../../geometry/projectionUtils.js";const c=t=>{const c=t;let l=class extends c{constructor(e){super(e),this.location=null,this.screenLocationEnabled=!1,this.view=null}initialize(){this.addHandles([o(()=>{const e=this.screenLocationEnabled?this.view:null;return e?[e.size,"3d"===e.type?e.camera:e.viewpoint]:null},()=>this.notifyChange("screenLocation")),i(()=>this.screenLocation,(e,t)=>{null!=e&&null!=t&&this.emit("view-change")})])}destroy(){this.view=null}get screenLocation(){const{location:e,view:t,screenLocationEnabled:o}=this,i=t?.spatialReference,n=i?s(e,i).geometry:null;return o&&n&&t?.ready?t.toScreen(n):null}};return e([n()],l.prototype,"location",void 0),e([n()],l.prototype,"screenLocation",null),e([n()],l.prototype,"screenLocationEnabled",void 0),e([n()],l.prototype,"view",void 0),l=e([r("esri.widgets.support.AnchorElementViewModel")],l),l},l=c(t);export{l as AnchorElementViewModel,c as AnchorElementViewModelMixin};
