// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/geoenrichment/utils/progress/SmoothProgress",["dojo/_base/declare","dojo/aspect","../DelayUtil"],function(d,b,e){return d(null,{elasticTime:1E3,fireInterval:30,runAheadSpeed:2.5E-4,_intervalHandle:null,_progressH:null,_doneH:null,_realProgress:0,_smoothProgress:0,_currentSpeed:0,constructor:function(a){var c=this;this._progressH=b.after(a,"onChange",function(a){c._updateProgress(a)},!0);this._doneH=b.after(a,"onDone",function(a){c.finalize()},!0)},_setIntervalHandle:function(a){a&&
this._intervalHandle||(a?this._intervalHandle=setInterval(this._tryFireProgress.bind(this),this.fireInterval):(clearInterval(this._intervalHandle),this._intervalHandle=null))},_updateProgress:function(a){this._realProgress=a;0>=this._realProgress?(this._currentSpeed=this._smoothProgress=0,this._setIntervalHandle(!1),this.onChange(0)):(this._setIntervalHandle(!0),this._currentSpeed=this._smoothProgress>=this._realProgress?this.runAheadSpeed:(this._realProgress-this._smoothProgress)*this.fireInterval/
this.elasticTime)},_tryFireProgress:function(){0!==this._currentSpeed&&(this._smoothProgress+=this._currentSpeed,this._smoothProgress=Math.min(1,this._smoothProgress),this._smoothProgress>=this._realProgress&&(this._currentSpeed=this.runAheadSpeed),this.onChange(this._smoothProgress))},finalize:function(){this._smoothProgress=1;this.onChange(this._smoothProgress);return e.delay(100)},onChange:function(a){},destroy:function(){this._progressH.remove();this._doneH.remove();this._setIntervalHandle(!1)}})});