/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import o from"../../../core/Collection.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{watch as s,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as c,subclass as a}from"../../../core/accessorSupport/decorators.js";import{updateDirectionalNodesGeneric as l}from"./imageNavigationUtils.js";let p=class extends t{constructor(e){super(e),this._compileTask=null,this.currentNode=null,this.currentBestFeature=null,this.nodes=new o}initialize(){this.addHandles(this.createCompileHandle())}createCompileHandle(){return s(()=>({nodes:this.nodes,currentNode:this.currentNode,length:this.nodes.length,currentHeading:this.currentNode?.currentHeading,currentPitch:this.currentNode?.currentPitch}),()=>{this._compileTask?.abort(),this._compileTask=r(async e=>{i(e),this.compile()})},n)}get state(){const e=this._compileTask;return e?e.finished?e.error?"error":"compiled":"compiling":"ready"}compile(){const{nodes:e}=this;e.length&&e.forEach(t=>l(t,e))}};e([c()],p.prototype,"_compileTask",void 0),e([c()],p.prototype,"currentNode",void 0),e([c()],p.prototype,"currentBestFeature",void 0),e([c()],p.prototype,"nodes",void 0),e([c()],p.prototype,"state",null),p=e([a("esri.widgets.OrientedImageryViewer.components.NavigationUIPanoramicViewModel")],p);const d=p;export{d as default};
