/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../chunks/_rollupPluginBabelHelpers","../../../../chunks/tslib.es6","../../../../core/maybe","../../../../core/promiseUtils","../../../../core/Logger","../../../../core/accessorSupport/ensureType","../../../../core/arrayUtils","../../../../core/has","../../../../core/accessorSupport/set","../../../../core/accessorSupport/decorators/subclass","../../../ViewAnimation","./CameraController"],(function(t,e,i,s,n,o,r,a,c,l,h,u,S){"use strict";t.AnimationController=function(t){function i(){return t.apply(this,arguments)||this}e._inheritsLoose(i,t);var o=i.prototype;return o.onControllerStart=function(){this.state=S.State.Running,s.isSome(this.viewAnimation)&&this.viewAnimation.when((()=>this.updateStateFromViewAnimation()),(()=>this.updateStateFromViewAnimation()))},o.updateStateFromViewAnimation=function(){!s.isSome(this.viewAnimation)||this.state!==S.State.Ready&&this.state!==S.State.Running||(this.viewAnimation.state===u.State.FINISHED?this.finish():this.viewAnimation.state===u.State.STOPPED&&(this.state=S.State.Stopped))},o.onControllerEnd=function(){s.isSome(this.viewAnimation)&&!this.viewAnimation.done&&(this.state===S.State.Finished?this.viewAnimation.finish():this.state===S.State.Stopped&&this.viewAnimation.stop()),this._asyncResult&&(this.state===S.State.Finished?this._asyncResult.resolve():this._asyncResult.reject(n.createAbortError()))},o.finish=function(){this.finishController()},e._createClass(i,[{key:"canStop",get:function(){return!0}},{key:"asyncResult",get:function(){return this._asyncResult},set:function(t){this._asyncResult&&(this._asyncResult.reject(n.createAbortError()),this._asyncResult=null),this.state===S.State.Finished||this.state===S.State.Stopped?this.state===S.State.Finished?t.resolve():t.reject(n.createAbortError()):this._asyncResult=t}}]),i}(S.CameraController),t.AnimationController=i.__decorate([h.subclass("esri.views.3d.state.controllers.AnimationController")],t.AnimationController),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
