!function(e,t){if("function"===typeof define){return define(function(){return t})}else if("function"===typeof require&&typeof exports===typeof module){return module.exports=t}return e["async"]=t}(this,function(){var e,t,n;e=function(){if(typeof this.serial==="undefined"){var n=new e,r;for(r in arguments[0]){n[r](arguments[0][r])}return n}this.a=[];this._reset();this.beginning_results=[].slice.call(arguments,0)};e.prototype._reset=function(){this.beginning_results=[];this.beginning_length=0;this.processing=false;return this.processed=0};e.prototype._apply=function(e){if(this.a.length){return(e[0]?this.a.splice(0,this.a.length)[0]:this.a[this.a.length-1]).apply({},e)}};e.prototype._next=function(e){return function(t){return function(){t.processed++;if(arguments[0]){return t._apply(arguments)}t.afterEach_callback.apply(t._next(!t.afterEach_callback.length),arguments);if(!e||t.processed===t.beginning_length){while(t._apply(arguments)&&e){}}}}(this)};e.prototype._push=function(e,t){var n,r,i,s;i=e[0];"[object Function]"===Object.prototype.toString.call(i)&&(n=i=[i]);s=function(t){return function(n,r){t.beginning_length++;return t.a.push(function(){var i;t.a.pop();t.beforeEach_callback.apply(t._next(!t.beforeEach_callback.length),arguments);e=Array.prototype.slice.apply(arguments).slice(1);n.apply(i=t._next(r),e.concat(i));return r&&(1===t.a.length||!!t._apply(arguments))})}}(this);for(r in i){s(i[r],t===null?!i[r].length:t)}return n?this:this.end(typeof e[1]==="function"?e[1]:function(){})};e.prototype.end=e.prototype["finally"]=e.prototype.ensure=e.prototype.afterAll=e.prototype.after=e.prototype.complete=e.prototype.done=e.prototype.go=function(e){if(this.processing){return}this.processing=true;this.a.push(function(t){return function(){t.a.pop();if(arguments[0]){t.error_callback.apply(t._next(!t.error_callback.length),arguments)}else{t.success_callback.apply(t._next(!t.success_callback.length),arguments)}if(typeof e==="function"){e.apply(null,arguments)}return t._reset()}}(this));this.a.reverse();(this.begin_callback=this.begin_callback||function(){})&&(this.beforeAll_callback=this.beforeAll_callback||function(){})&&(this.beforeEach_callback=this.beforeEach_callback||function(){})&&(this.afterEach_callback=this.afterEach_callback||function(){})&&(this.error_callback=this.error_callback||function(){})&&(this.success_callback=this.success_callback||function(){});this.beforeAll_callback.apply(this._next(!this.beforeAll_callback.length),arguments);this._apply([null].concat(this.beginning_results));return this};e.prototype.serial=e.prototype.series=e.prototype.blocking=e.prototype.waterfall=function(){return this._push(arguments,false)};e.prototype.parallel=e.prototype.nonblocking=function(){return this._push(arguments,true)};e.prototype["do"]=e.prototype.then=e.prototype["try"]=e.prototype.begin=e.prototype.start=e.prototype.auto=function(){return this._push(arguments,null)};e.prototype["new"]=e.prototype.flow=e.prototype["with"]=function(){this.beginning_results=[].slice.call(arguments,0);return this};(t=function(e){return function(t){this[e+"_callback"]=t;return this}})&&(e.prototype.beforeAll=e.prototype.before=t("beforeAll"))&&(e.prototype.beforeEach=t("beforeEach"))&&(e.prototype.afterEach=e.prototype.between=e.prototype.inbetween=t("afterEach"))&&(e.prototype.error=e.prototype["catch"]=e.prototype.rescue=t("error"))&&(e.prototype.success=e.prototype["else"]=t("success"));(n=function(t){return function(){var n;return(n=new e)[t].apply(n,arguments)}})&&(e.serial=e.series=e.blocking=e.waterfall=n("serial"))&&(e.parallel=e.nonblocking=n("parallel"))&&(e["do"]=e.then=e["try"]=e.begin=e.start=e.auto=n("do"))&&(e.end=e["finally"]=e.ensure=e.afterAll=e.after=e.complete=e.done=e.go=n("end"))&&(e["new"]=e.flow=e["with"]=n("new"))&&(e.beforeAll=e.before=n("beforeAll"))&&(e.beforeEach=n("beforeEach"))&&(e.afterEach=e.between=e.inbetween=n("afterEach"))&&(e.error=e["catch"]=e.rescue=n("error"))&&(e.success=e["else"]=n("success"));e.q={};e.nextTickGroup=e.push=function(t,n){e.q[t]=e.q[t]||new e;e.q[t].serial(n).go();return e};e.whilst=function(e,t,n){e()&&t(function(r){return function(i){return!!i&&n(i)||r.whilst(e,t,n)}}(this))||n()};e.delay=function(e,t){return setTimeout(t,e)};return e}())