/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../core/Error.js";import{EsriPromise as s}from"../core/Promise.js";import{createResolver as i,isPromiseLike as r}from"../core/promiseUtils.js";import{property as o,subclass as n}from"../core/accessorSupport/decorators.js";let a=class extends s{constructor(t){super(t),this.state="running",this.target=null,this._resolver=null}initialize(){this._resolver=i(),this.addResolvingPromise(this._resolver.promise)}get done(){return"finished"===this.state||"stopped"===this.state}stop(){"stopped"!==this.state&&"finished"!==this.state&&(this._set("state","stopped"),this._resolver?.reject(new e("view:animation-stopped","ViewAnimation stopped")))}finish(){"stopped"!==this.state&&"finished"!==this.state&&(this._set("state","finished"),this._resolver?.resolve())}update(t,e){e||(e=r(t)?"waiting-for-target":"running"),this._set("target",t),this._set("state",e)}static{this.state={RUNNING:"running",STOPPED:"stopped",FINISHED:"finished",WAITING_FOR_TARGET:"waiting-for-target"}}};t([o({readOnly:!0})],a.prototype,"done",null),t([o({readOnly:!0,type:String})],a.prototype,"state",void 0),t([o()],a.prototype,"target",void 0),a=t([n("esri.views.ViewAnimation")],a);const p=a;export{p as default};
