/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t}from"tslib";import{assertIsSome as s}from"../../../../core/maybe.js";import{createAbortError as i}from"../../../../core/promiseUtils.js";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import n from"../../../ViewAnimation.js";import{CameraController as o}from"./CameraController.js";let a=class extends o{constructor(){super(...arguments),this._asyncResult=null}get canStop(){return!0}set asyncResult(t){this._asyncResult&&(this._asyncResult.reject(i()),this._asyncResult=null),4===this.state||3===this.state?(s(t),4===this.state?t.resolve():t.reject(i())):this._asyncResult=t}get asyncResult(){return this._asyncResult}onControllerStart(){this.state=2,null!=this.viewAnimation&&this.viewAnimation.when(()=>this.updateStateFromViewAnimation(),()=>this.updateStateFromViewAnimation())}updateStateFromViewAnimation(){!this.viewAnimation||0!==this.state&&2!==this.state||(this.viewAnimation.state===n.state.FINISHED?this.finish():this.viewAnimation.state===n.state.STOPPED&&(this.state=3))}onControllerEnd(t){null==this.viewAnimation||this.viewAnimation.done||(4===this.state?this.viewAnimation.finish():3===this.state&&this.viewAnimation.stop()),this._asyncResult&&(4===this.state?this._asyncResult.resolve():this._asyncResult.reject(i()))}finish(){this.finishController()}};a=t([e("esri.views.3d.state.controllers.AnimationController")],a);export{a as AnimationController};
