/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import i from"../../core/Accessor.js";import{deprecateUnnecessaryViewModel as o}from"../../core/deprecate.js";import e from"../../core/Logger.js";import{when as a}from"../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";let s=class extends i{constructor(t){super(t),this._navigationMode="pan",this.view=null,t?.isDefaultViewModel||o(e.getLogger(this),"Navigation Toggle","arcgis-navigation-toggle",{version:"4.33"})}normalizeCtorArgs(t={}){const{isDefaultViewModel:i,...o}=t;return o}initialize(){this.addHandles(a(()=>this.view?.navigation?.actionMap,()=>this._updateNavigationActionMap()))}destroy(){this.view=null}get state(){return this.view?.ready&&"3d"===this.view?.type?"ready":"disabled"}get navigationMode(){return this._navigationMode}set navigationMode(t){this._navigationMode=t,this._updateNavigationActionMap()}toggle(){"disabled"!==this.state&&(this.navigationMode="pan"!==this.navigationMode?"pan":"rotate")}_updateNavigationActionMap(){const t=this.view?.navigation?.actionMap;if(!t)return;const i="pan"===this._navigationMode;t.dragPrimary=i?"pan":"rotate",t.dragSecondary=i?"rotate":"pan"}};t([n({readOnly:!0})],s.prototype,"state",null),t([n()],s.prototype,"_navigationMode",void 0),t([n()],s.prototype,"view",void 0),s=t([r("esri.widgets.NavigationToggle.NavigationToggleViewModel")],s);const g=s;export{g as default};
