!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(s,a){if(!e[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=new error("cannot find module '"+s+"'");throw l.code="module_not_found",l}var u=e[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return i(n?n:e)},u,u.exports,r,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlepromises()}},r.prototype._drainqueues=function(){this._drainqueue(this._normalqueue),this._reset(),this._havedrainedqueues=!0,this._drainqueue(this._latequeue)},r.prototype._queuetick=function(){this._istickused||(this._istickused=!0,this._schedule(this.drainqueues))},r.prototype._reset=function(){this._istickused=!1},e.exports=r,e.exports.firstlineerror=a},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiserejectionqueued=!0,e.bindingpromise._then(o,o,null,this,t)},a=function(t,e){0===(50397184&this._bitfield)&&this._resolvecallback(e.target)},c=function(t,e){e.promiserejectionqueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagatefrom=r.propagatefromfunction(),t.prototype._boundvalue=r.boundvaluefunction());var l=n(o),u=new t(e);u._propagatefrom(this,1);var p=this._target();if(u._setboundto(l),l instanceof t){var h={promiserejectionqueued:!1,promise:u,target:p,bindingpromise:l};p._then(e,s,void 0,u,h),l._then(a,c,void 0,u,h),u._setoncancel(l)}else u._resolvecallback(p);return u},t.prototype._setboundto=function(t){void 0!==t?(this._bitfield=2097152|this._bitfield,this._boundto=t):this._bitfield=-2097153&this._bitfield},t.prototype._isbound=function(){return 2097152===(2097152&this._bitfield)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{promise===o&&(promise=i)}catch(t){}return o}var i;"undefined"!=typeof promise&&(i=promise);var o=t("./promise")();o.noconflict=r,e.exports=o},{"./promise":22}],5:[function(t,e,n){"use strict";var r=object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="object "+a.classstring(t)+" has no method '"+a.tostring(n)+"'";throw new e.typeerror(i)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=math.max(0,e+t.length)),t[e]}var s,a=t("./util"),c=a.canevaluate;a.isidentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(c){var r=s(t);e=null!==r?r:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),s=o.trycatch,a=o.errorobj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._iscancellable();){if(!t._cancelby(e)){e._isfollowing()?e._followee().cancel():e._cancelbranched();break}var n=t._cancellationparent;if(null==n||!n._iscancellable()){t._isfollowing()?t._followee().cancel():t._cancelbranched();break}t._isfollowing()&&t._followee().cancel(),t._setwillbecancelled(),e=t,t=n}},e.prototype._branchhascancelled=function(){this._branchesremainingtocancel--},e.prototype._enoughbrancheshavecancelled=function(){return void 0===this._branchesremainingtocancel||this._branchesremainingtocancel<=0},e.prototype._cancelby=function(t){return t===this?(this._branchesremainingtocancel=0,this._invokeoncancel(),!0):(this._branchhascancelled(),this._enoughbrancheshavecancelled()?(this._invokeoncancel(),!0):!1)},e.prototype._cancelbranched=function(){this._enoughbrancheshavecancelled()&&this._cancel()},e.prototype._cancel=function(){this._iscancellable()&&(this._setcancelled(),c.invoke(this._cancelpromises,this,void 0))},e.prototype._cancelpromises=function(){this._length()>0&&this._settlepromises()},e.prototype._unsetoncancel=function(){this._oncancelfield=void 0},e.prototype._iscancellable=function(){return this.ispending()&&!this._iscancelled()},e.prototype.iscancellable=function(){return this.ispending()&&!this.iscancelled()},e.prototype._doinvokeoncancel=function(t,e){if(o.isarray(t))for(var n=0;n=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promisecreated=function(){},t.prototype._pushcontext=function(){},t.prototype._popcontext=function(){return null},t._peekcontext=t.prototype._peekcontext=function(){},e.prototype._pushcontext=function(){void 0!==this._trace&&(this._trace._promisecreated=null,o.push(this._trace))},e.prototype._popcontext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promisecreated;return t._promisecreated=null,e}return null},e.capturedtrace=null,e.create=n,e.deactivatelongstacktraces=function(){},e.activatelongstacktraces=function(){var n=t.prototype._pushcontext,o=t.prototype._popcontext,s=t._peekcontext,a=t.prototype._peekcontext,c=t.prototype._promisecreated;e.deactivatelongstacktraces=function(){t.prototype._pushcontext=n,t.prototype._popcontext=o,t._peekcontext=s,t.prototype._peekcontext=a,t.prototype._promisecreated=c,i=!1},i=!0,t.prototype._pushcontext=e.prototype._pushcontext,t.prototype._popcontext=e.prototype._popcontext,t._peekcontext=t.prototype._peekcontext=r,t.prototype._promisecreated=function(){var t=this._peekcontext();t&&null==t._promisecreated&&(t._promisecreated=this)}},e}},{}],9:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,e){return{promise:e}}function i(){return!1}function o(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new typeerror("oncancel must be a function, got: "+h.tostring(t));r._attachcancellationcallback(t)})}catch(i){return i}}function s(t){if(!this._iscancellable())return this;var e=this._oncancel();void 0!==e?h.isarray(e)?e.push(t):this._setoncancel([e,t]):this._setoncancel(t)}function a(){return this._oncancelfield}function c(t){this._oncancelfield=t}function l(){this._cancellationparent=void 0,this._oncancelfield=void 0}function u(t,e){if(0!==(1&e)){this._cancellationparent=t;var n=t._branchesremainingtocancel;void 0===n&&(n=0),t._branchesremainingtocancel=n+1}0!==(2&e)&&t._isbound()&&this._setboundto(t._boundto)}function p(t,e){0!==(2&e)&&t._isbound()&&this._setboundto(t._boundto)}function h(){var t=this._boundto;return void 0!==t&&t instanceof e?t.isfulfilled()?t.value():void 0:t}function f(){this._trace=new s(this._peekcontext())}function _(t,e){if(n(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachextratrace(t);else if(!t.__stackcleaned__){var r=j(t);h.notenumerableprop(t,"stack",r.message+"\n"+r.stack.join("\n")),h.notenumerableprop(t,"__stackcleaned__",!0)}}}function d(t,e,n,r,i){if(void 0===t&&null!==e&&w){if(void 0!==i&&i._returnednonundefined())return;if(0===(65535&r._bitfield))return;n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=w(a),l=c.length-1;l>=0;--l){var u=c[l];if(!u.test(u)){var p=u.match(m);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var h=c[0],l=0;l0&&(s="\n"+a[l-1]);break}}var f="a promise was created in a "+n+"handler "+o+"but was not returned from it, see "+s;r._warn(f,!0,e)}}function v(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" use "+e+" instead."),y(n)}function y(t,n,r){if(ot.warnings){var i,o=new l(t);if(n)r._attachextratrace(o);else if(ot.longstacktraces&&(i=e._peekcontext()))i.attachextratrace(o);else{var s=j(o);o.stack=s.message+"\n"+s.stack.join("\n")}tt("warning",o)||e(o,"",!0)}}function m(t,e){for(var n=0;n=0;--a)if(r[a]===o){s=a;break}for(var a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}function w(t){for(var e=[],n=0;n0&&"syntaxerror"!=t.name&&(e=e.slice(n)),e}function j(t){var e=t.stack,n=t.tostring();return e="string"==typeof e&&e.length>0?c(t):[" (no stack trace)"],{message:n,stack:"syntaxerror"==t.name?e:w(e)}}function e(t,e,n){if("undefined"!=typeof console){var r;if(h.isobject(t)){var i=t.stack;r=e+q(i,t)}else r=e+string(t);"function"==typeof d?d(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function k(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionhandled"===t?e(r):e(n,r))}catch(o){i.throwlater(o)}"unhandledrejection"===t?tt(t,n,r)||i||e(n,"unhandled rejection "):tt(t,r)}function f(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.tostring?t.tostring():h.tostring(t);var n=/\[object [a-za-z0-9$_]+\]/;if(n.test(e))try{var r=json.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+x(e)+">, no stack trace)"}function x(t){var e=41;return t.lengths||0>a||!n||!r||n!==r||s>=a||(nt=function(t){if(b.test(t))return!0;var e=p(t);return e&&e.filename===n&&s<=e.line&&e.line<=a?!0:!1})}}function s(t){this._parent=t,this._promisescreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,s),e>32&&this.uncycle()}var o,a,d,v=e._getdomain,i=e._async,l=t("./errors").warning,h=t("./util"),n=h.canattachtrace,b=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,u=/\((?:timers\.js):\d+:\d+\)/,m=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,q=null,q=null,$=!1,g=!(0==h.env("bluebird_debug")||!h.env("bluebird_debug")&&"development"!==h.env("node_env")),z=!(0==h.env("bluebird_warnings")||!g&&!h.env("bluebird_warnings")),x=!(0==h.env("bluebird_long_stack_traces")||!g&&!h.env("bluebird_long_stack_traces")),w=0!=h.env("bluebird_w_forgotten_return")&&(z||!!h.env("bluebird_w_forgotten_return"));e.prototype.suppressunhandledrejections=function(){var t=this._target();t._bitfield=-1048577&t._bitfield|524288},e.prototype._ensurepossiblerejectionhandled=function(){0===(524288&this._bitfield)&&(this._setrejectionisunhandled(),i.invokelater(this._notifyunhandledrejection,this,void 0))},e.prototype._notifyunhandledrejectionishandled=function(){k("rejectionhandled",o,void 0,this)},e.prototype._setreturnednonundefined=function(){this._bitfield=268435456|this._bitfield},e.prototype._returnednonundefined=function(){return 0!==(268435456&this._bitfield)},e.prototype._notifyunhandledrejection=function(){if(this._isrejectionunhandled()){var t=this._settledvalue();this._setunhandledrejectionisnotified(),k("unhandledrejection",a,t,this)}},e.prototype._setunhandledrejectionisnotified=function(){this._bitfield=262144|this._bitfield},e.prototype._unsetunhandledrejectionisnotified=function(){this._bitfield=-262145&this._bitfield},e.prototype._isunhandledrejectionnotified=function(){return(262144&this._bitfield)>0},e.prototype._setrejectionisunhandled=function(){this._bitfield=1048576|this._bitfield},e.prototype._unsetrejectionisunhandled=function(){this._bitfield=-1048577&this._bitfield,this._isunhandledrejectionnotified()&&(this._unsetunhandledrejectionisnotified(),this._notifyunhandledrejectionishandled())},e.prototype._isrejectionunhandled=function(){return(1048576&this._bitfield)>0},e.prototype._warn=function(t,e,n){return y(t,e,n||this)},e.onpossiblyunhandledrejection=function(t){var e=v();a="function"==typeof t?null===e?t:h.domainbind(e,t):void 0},e.onunhandledrejectionhandled=function(t){var e=v();o="function"==typeof t?null===e?t:h.domainbind(e,t):void 0};var k=function(){};e.longstacktraces=function(){if(i.haveitemsqueued()&&!ot.longstacktraces)throw new error("cannot enable long stack traces after promises have been created\n\n see \n");if(!ot.longstacktraces&&t()){var t=e.prototype._capturestacktrace,r=e.prototype._attachextratrace;ot.longstacktraces=!0,k=function(){if(i.haveitemsqueued()&&!ot.longstacktraces)throw new error("cannot enable long stack traces after promises have been created\n\n see \n");e.prototype._capturestacktrace=t,e.prototype._attachextratrace=r,n.deactivatelongstacktraces(),i.enabletrampoline(),ot.longstacktraces=!1},e.prototype._capturestacktrace=f,e.prototype._attachextratrace=_,n.activatelongstacktraces(),i.disabletrampolineifnecessary()}},e.haslongstacktraces=function(){return ot.longstacktraces&&t()};var j=function(){try{if("function"==typeof customevent){var t=new customevent("customevent");return h.global.dispatchevent(t),function(t,e){var n=new customevent(t.tolowercase(),{detail:e,cancelable:!0});return!h.global.dispatchevent(n)}}if("function"==typeof event){var t=new event("customevent");return h.global.dispatchevent(t),function(t,e){var n=new event(t.tolowercase(),{cancelable:!0});return n.detail=e,!h.global.dispatchevent(n)}}var t=document.createevent("customevent");return t.initcustomevent("testingtheevent",!1,!0,{}),h.global.dispatchevent(t),function(t,e){var n=document.createevent("customevent");return n.initcustomevent(t.tolowercase(),!1,!0,e),!h.global.dispatchevent(n)}}catch(e){}return function(){return!1}}(),y=function(){return h.isnode?function(){return process.emit.apply(process,arguments)}:h.global?function(t){var e="on"+t.tolowercase(),n=h.global[e];return n?(n.apply(h.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),z={promisecreated:r,promisefulfilled:r,promiserejected:r,promiseresolved:r,promisecancelled:r,promisechained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledrejection:function(t,e,n){return{reason:e,promise:n}},rejectionhandled:r},tt=function(t){var e=!1;try{e=y.apply(null,arguments)}catch(n){i.throwlater(n),e=!0}var r=!1;try{r=j(t,z[t].apply(null,arguments))}catch(n){i.throwlater(n),r=!0}return r||e};e.config=function(t){if(t=object(t),"longstacktraces"in t&&(t.longstacktraces?e.longstacktraces():!t.longstacktraces&&e.haslongstacktraces()&&k()),"warnings"in t){var n=t.warnings;ot.warnings=!!n,w=ot.warnings,h.isobject(n)&&"wforgottenreturn"in n&&(w=!!n.wforgottenreturn)}if("cancellation"in t&&t.cancellation&&!ot.cancellation){if(i.haveitemsqueued())throw new error("cannot enable cancellation after promises are in use");e.prototype._clearcancellationdata=l,e.prototype._propagatefrom=u,e.prototype._oncancel=a,e.prototype._setoncancel=c,e.prototype._attachcancellationcallback=s,e.prototype._execute=o,et=u,ot.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!ot.monitoring?(ot.monitoring=!0,e.prototype._fireevent=tt):!t.monitoring&&ot.monitoring&&(ot.monitoring=!1,e.prototype._fireevent=i)),e},e.prototype._fireevent=i,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._oncancel=function(){},e.prototype._setoncancel=function(t){},e.prototype._attachcancellationcallback=function(t){},e.prototype._capturestacktrace=function(){},e.prototype._attachextratrace=function(){},e.prototype._clearcancellationdata=function(){},e.prototype._propagatefrom=function(t,e){};var et=p,nt=function(){return!1},rt=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;h.inherits(s,error),n.capturedtrace=s,s.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>a?(c._parent=e[a+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},s.prototype.attachextratrace=function(t){if(!t.__stackcleaned__){this.uncycle();for(var e=j(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(w(i.stack.split("\n"))),i=i._parent;b(r),g(r),h.notenumerableprop(t,"stack",m(n,r)),h.notenumerableprop(t,"__stackcleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.tostring():f(e)};if("number"==typeof error.stacktracelimit&&"function"==typeof error.capturestacktrace){error.stacktracelimit+=6,q=t,q=e;var n=error.capturestacktrace;return nt=function(t){return b.test(t)},function(t,e){error.stacktracelimit+=6,n(t,e),error.stacktracelimit-=6}}var r=new error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexof("stackdetection@")>=0)return q=/@/,q=e,$=!0,function(t){t.stack=(new error).stack};var i;try{throw new error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof error.stacktracelimit?(q=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?f(e):e.tostring()},null):(q=t,q=e,function(t){error.stacktracelimit+=6;try{throw new error}catch(e){t.stack=e.stack}error.stacktracelimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(d=function(t){console.warn(t)},h.isnode&&process.stderr.istty?d=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:h.isnode||"string"!=typeof(new error).stack||(d=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ot={warnings:z,longstacktraces:!1,cancellation:!1,monitoring:!1};return x&&e.longstacktraces(),{longstacktraces:function(){return ot.longstacktraces},warnings:function(){return ot.warnings},cancellation:function(){return ot.cancellation},monitoring:function(){return ot.monitoring},propagatefromfunction:function(){return et},boundvaluefunction:function(){return h},checkforgottenreturns:d,setbounds:r,warn:y,deprecated:v,capturedtrace:s,firedomevent:j,fireglobalevent:y}}},{"./errors":12,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenreturn=function(n){return n instanceof t&&n.suppressunhandledrejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenthrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchthrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchreturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressunhandledrejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressunhandledrejections();var i=function(){return r};return this.caught(n,i)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return o(this)}function r(t,n){return i(t,n,e,e)}var i=t.reduce,o=t.all;t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapseries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapseries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(error.capturestacktrace?error.capturestacktrace(this,this.constructor):error.call(this))):new n(r)}return u(n,error),n}function i(t){return this instanceof i?(p(this,"name","operationalerror"),p(this,"message",t),this.cause=t,this.isoperational=!0,void(t instanceof error?(p(this,"message",t.message),p(this,"stack",t.stack)):error.capturestacktrace&&error.capturestacktrace(this,this.constructor))):new i(t)}var o,s,a=t("./es5"),c=a.freeze,l=t("./util"),u=l.inherits,p=l.notenumerableprop,h=r("warning","warning"),f=r("cancellationerror","cancellation error"),_=r("timeouterror","timeout error"),d=r("aggregateerror","aggregate error");try{o=typeerror,s=rangeerror}catch(v){o=r("typeerror","type error"),s=r("rangeerror","range error")}for(var y="join pop push shift unshift slice filter foreach some every map indexof lastindexof reduce reduceright sort reverse".split(" "),m=0;m1?t.cancelpromise._reject(e):t.cancelpromise._cancel(),t.cancelpromise=null,!0):!1}function a(){return l.call(this,this.promise._target()._settledvalue())}function c(t){return s(this,t)?void 0:(h.e=t,h)}function l(t){var i=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isfinallyhandler()?l.call(i._boundvalue()):l.call(i._boundvalue(),t);if(u===r)return u;if(void 0!==u){i._setreturnednonundefined();var f=n(u,i);if(f instanceof e){if(null!=this.cancelpromise){if(f._iscancelled()){var _=new p("late cancellation observer");return i._attachextratrace(_),h.e=_,h}f.ispending()&&f._attachcancellationcallback(new o(this))}return f._then(a,c,void 0,this,void 0)}}}return i.isrejected()?(s(this),h.e=t,h):(s(this),t)}var u=t("./util"),p=e.cancellationerror,h=u.errorobj,f=t("./catch_filter")(r);return i.prototype.isfinallyhandler=function(){return 0===this.type},o.prototype._resultcancelled=function(){s(this.finallyhandler)},e.prototype._passthrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passthrough(t,0,l,l)},e.prototype.tap=function(t){return this._passthrough(t,1,l)},e.prototype.tapcatch=function(t){var n=arguments.length;if(1===n)return this._passthrough(t,1,void 0,l);var r,i=new array(n-1),o=0;for(r=0;n-1>r;++r){var s=arguments[r];if(!u.isobject(s))return e.reject(new typeerror("tapcatch statement predicate: expecting an object but got "+u.classstring(s)));i[o++]=s}i.length=o;var a=arguments[r];return this._passthrough(f(i,a,this),1,void 0,l)},i}},{"./catch_filter":7,"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r){for(var o=0;o0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,e,n,r){this.constructor$(t),this._promise._capturestacktrace();var i=l();this._callback=null===i?e:u.domainbind(i,e),this._preservedvalues=r===o?new array(this.length()):null,this._limit=n,this._inflight=0,this._queue=[],f.invoke(this._asyncinit,this,void 0)}function c(t,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+u.classstring(n));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new typeerror("options argument must be an object but it is "+u.classstring(i)));if("number"!=typeof i.concurrency)return e.reject(new typeerror("'concurrency' must be a number but it is "+u.classstring(i.concurrency)));s=i.concurrency}return s="number"==typeof s&&isfinite(s)&&s>=1?s:0,new a(t,n,s,o).promise()}var l=e._getdomain,u=t("./util"),p=u.trycatch,h=u.errorobj,f=e._async;u.inherits(a,n),a.prototype._asyncinit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promisefulfilled=function(t,n){var r=this._values,o=this.length(),a=this._preservedvalues,c=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,c>=1&&(this._inflight--,this._drainqueue(),this._isresolved()))return!0}else{if(c>=1&&this._inflight>=c)return r[n]=t,this._queue.push(n),!1;null!==a&&(a[n]=t);var l=this._promise,u=this._callback,f=l._boundvalue();l._pushcontext();var _=p(u).call(f,t,n,o),d=l._popcontext();if(s.checkforgottenreturns(_,d,null!==a?"promise.filter":"promise.map",l),_===h)return this._reject(_.e),!0;var v=i(_,this._promise);if(v instanceof e){v=v._target();var y=v._bitfield;if(0===(50397184&y))return c>=1&&this._inflight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);_=v._value()}r[n]=_}var m=++this._totalresolved;return m>=o?(null!==a?this._filter(r,a):this._resolve(r),!0):!1},a.prototype._drainqueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inflighto;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},a.prototype.preservedvalues=function(){return this._preservedvalues},e.prototype.map=function(t,e){return c(this,t,e,null)},e.map=function(t,e,n,r){return c(t,e,n,r)}}},{"./util":36}],19:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util"),a=s.trycatch;e.method=function(t){if("function"!=typeof t)throw new e.typeerror("expecting a function but got "+s.classstring(t));return function(){var r=new e(n);r._capturestacktrace(),r._pushcontext();var i=a(t).apply(this,arguments),s=r._popcontext();return o.checkforgottenreturns(i,s,"promise.method",r),r._resolvefromsyncvalue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+s.classstring(t));var r=new e(n);r._capturestacktrace(),r._pushcontext();var c;if(arguments.length>1){o.deprecated("calling promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=s.isarray(l)?a(t).apply(u,l):a(t).call(u,l)}else c=a(t)();var p=r._popcontext();return o.checkforgottenreturns(c,p,"promise.try",r),r._resolvefromsyncvalue(c),r},e.prototype._resolvefromsyncvalue=function(t){t===s.errorobj?this._rejectcallback(t.e,!1):this._resolvecallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof error&&u.getprototypeof(t)===error.prototype}function i(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),i=0;i1){var n,r=new array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!f.isobject(o))return p("catch statement predicate: expecting an object but got "+f.classstring(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,p(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(x.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+f.classstring(t);arguments.length>1&&(n+=", "+f.classstring(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setisfinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+f.classstring(t)):this.all()._then(t,void 0,void 0,w,void 0)},i.prototype.tojson=function(){var t={isfulfilled:!1,isrejected:!1,fulfillmentvalue:void 0,rejectionreason:void 0};return this.isfulfilled()?(t.fulfillmentvalue=this.value(),t.isfulfilled=!0):this.isrejected()&&(t.rejectionreason=this.reason(),t.isrejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new e(this).promise()},i.prototype.error=function(t){return this.caught(f.originatesfromrejection,t)},i.getnewlibrarycopy=e.exports,i.is=function(t){return t instanceof i},i.fromnode=i.fromcallback=function(t){var e=new i(b);e._capturestacktrace();var n=arguments.length>1?!!object(arguments[1]).multiargs:!1,r=o(t)(r(e,n));return r===s&&e._rejectcallback(r.e,!0),e._isfatesealed()||e._setasyncguaranteed(),e},i.all=function(t){return new e(t).promise()},i.cast=function(t){var e=j(t);return e instanceof i||(e=new i(b),e._capturestacktrace(),e._setfulfilled(),e._rejectionhandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(b);return e._capturestacktrace(),e._rejectcallback(t,!0),e},i.setscheduler=function(t){if("function"!=typeof t)throw new m("expecting a function but got "+f.classstring(t));return v.setscheduler(t)},i.prototype._then=function(t,e,n,r,o){var s=void 0!==o,a=s?o:new i(b),l=this._target(),u=l._bitfield;s||(a._propagatefrom(this,3),a._capturestacktrace(),void 0===r&&0!==(2097152&this._bitfield)&&(r=0!==(50397184&u)?this._boundvalue():l===this?void 0:this._boundto),this._fireevent("promisechained",this,a));var p=c();if(0!==(50397184&u)){var h,_,d=l._settlepromisectx;0!==(33554432&u)?(_=l._rejectionhandler0,h=t):0!==(16777216&u)?(_=l._fulfillmenthandler0,h=e,l._unsetrejectionisunhandled()):(d=l._settlepromiselatecancellationobserver,_=new g("late cancellation observer"),l._attachextratrace(_),h=e),v.invoke(d,l,{handler:null===p?h:"function"==typeof h&&f.domainbind(p,h),promise:a,receiver:r,value:_})}else l._addcallbacks(t,e,a,r,p);return a},i.prototype._length=function(){return 65535&this._bitfield},i.prototype._isfatesealed=function(){return 0!==(117506048&this._bitfield)},i.prototype._isfollowing=function(){return 67108864===(67108864&this._bitfield)},i.prototype._setlength=function(t){this._bitfield=-65536&this._bitfield|65535&t},i.prototype._setfulfilled=function(){this._bitfield=33554432|this._bitfield,this._fireevent("promisefulfilled",this)},i.prototype._setrejected=function(){this._bitfield=16777216|this._bitfield,this._fireevent("promiserejected",this)},i.prototype._setfollowing=function(){this._bitfield=67108864|this._bitfield,this._fireevent("promiseresolved",this)},i.prototype._setisfinal=function(){this._bitfield=4194304|this._bitfield},i.prototype._isfinal=function(){return(4194304&this._bitfield)>0},i.prototype._unsetcancelled=function(){this._bitfield=-65537&this._bitfield},i.prototype._setcancelled=function(){this._bitfield=65536|this._bitfield,this._fireevent("promisecancelled",this)},i.prototype._setwillbecancelled=function(){this._bitfield=8388608|this._bitfield},i.prototype._setasyncguaranteed=function(){v.hascustomscheduler()||(this._bitfield=134217728|this._bitfield)},i.prototype._receiverat=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===h?void 0:void 0===e&&this._isbound()?this._boundvalue():e},i.prototype._promiseat=function(t){return this[4*t-4+2]},i.prototype._fulfillmenthandlerat=function(t){return this[4*t-4+0]},i.prototype._rejectionhandlerat=function(t){return this[4*t-4+1]},i.prototype._boundvalue=function(){},i.prototype._migratecallback0=function(t){var e=(t._bitfield,t._fulfillmenthandler0),n=t._rejectionhandler0,r=t._promise0,i=t._receiverat(0);void 0===i&&(i=h),this._addcallbacks(e,n,r,i,null)},i.prototype._migratecallbackat=function(t,e){var n=t._fulfillmenthandlerat(e),r=t._rejectionhandlerat(e),i=t._promiseat(e),o=t._receiverat(e);void 0===o&&(o=h),this._addcallbacks(n,r,i,o,null)},i.prototype._addcallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setlength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmenthandler0=null===i?t:f.domainbind(i,t)),"function"==typeof e&&(this._rejectionhandler0=null===i?e:f.domainbind(i,e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:f.domainbind(i,t)),"function"==typeof e&&(this[s+1]=null===i?e:f.domainbind(i,e))}return this._setlength(o+1),o},i.prototype._proxy=function(t,e){this._addcallbacks(void 0,void 0,e,t,null)},i.prototype._resolvecallback=function(t,e){if(0===(117506048&this._bitfield)){if(t===this)return this._rejectcallback(l(),!1);var n=j(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagatefrom(n,2);var r=n._target();if(r===this)return void this._reject(l());var o=r._bitfield;if(0===(50397184&o)){var s=this._length();s>0&&r._migratecallback0(this);for(var a=1;s>a;++a)r._migratecallbackat(this,a);this._setfollowing(),this._setlength(0),this._setfollowee(r)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var c=new g("late cancellation observer");r._attachextratrace(c),this._reject(c)}}},i.prototype._rejectcallback=function(t,e,n){var r=f.ensureerrorobject(t),i=r===t;if(!i&&!n&&x.warnings()){var o="a promise was rejected with a non-error: "+f.classstring(t);this._warn(o,!0)}this._attachextratrace(r,e?i:!1),this._reject(t)},i.prototype._resolvefromexecutor=function(t){if(t!==b){var e=this;this._capturestacktrace(),this._pushcontext();var n=!0,r=this._execute(t,function(t){e._resolvecallback(t)},function(t){e._rejectcallback(t,n)});n=!1,this._popcontext(),void 0!==r&&e._rejectcallback(r,!0)}},i.prototype._settlepromisefromhandler=function(t,e,n,r){var i=r._bitfield;if(0===(65536&i)){r._pushcontext();var o;e===w?n&&"number"==typeof n.length?o=o(t).apply(this._boundvalue(),n):(o=s,o.e=new m("cannot .spread() a non-array: "+f.classstring(n))):o=o(t).call(e,n);var s=r._popcontext();i=r._bitfield,0===(65536&i)&&(o===c?r._reject(n):o===s?r._rejectcallback(o.e,!1):(x.checkforgottenreturns(o,s,"",r,this),r._resolvecallback(o)))}},i.prototype._target=function(){for(var t=this;t._isfollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionhandler0},i.prototype._setfollowee=function(t){this._rejectionhandler0=t},i.prototype._settlepromise=function(t,e,r,o){var s=t instanceof i,a=this._bitfield,c=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeinternaloncancel(),r instanceof t&&r.isfinallyhandler()?(r.cancelpromise=t,o(e).call(r,o)===s&&t._reject(s.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promisecancelled(t):s||t instanceof e?t._cancel():r.cancel()):"function"==typeof e?s?(c&&t._setasyncguaranteed(),this._settlepromisefromhandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isresolved()||(0!==(33554432&a)?r._promisefulfilled(o,t):r._promiserejected(o,t)):s&&(c&&t._setasyncguaranteed(),0!==(33554432&a)?t._fulfill(o):t._reject(o))},i.prototype._settlepromiselatecancellationobserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlepromisefromhandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlepromisectx=function(t){this._settlepromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlepromise0=function(t,e,n){var r=this._promise0,i=this._receiverat(0);this._promise0=void 0,this._receiver0=void 0,this._settlepromise(r,t,i,e)},i.prototype._clearcallbackdataatindex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitfield;if(!((117506048&e)>>>16)){if(t===this){var n=l();return this._attachextratrace(n),this._reject(n)}this._setfulfilled(),this._rejectionhandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlepromises():v.settlepromises(this))}},i.prototype._reject=function(t){var e=this._bitfield;if(!((117506048&e)>>>16))return this._setrejected(),this._fulfillmenthandler0=t,this._isfinal()?v.fatalerror(t,f.isnode):void((65535&e)>0?v.settlepromises(this):this._ensurepossiblerejectionhandled())},i.prototype._fulfillpromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmenthandlerat(n),i=this._promiseat(n),o=this._receiverat(n);this._clearcallbackdataatindex(n),this._settlepromise(i,r,o,e)}},i.prototype._rejectpromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionhandlerat(n),i=this._promiseat(n),o=this._receiverat(n);this._clearcallbackdataatindex(n),this._settlepromise(i,r,o,e)}},i.prototype._settlepromises=function(){var t=this._bitfield,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmenthandler0;this._settlepromise0(this._rejectionhandler0,n,t),this._rejectpromises(e,n)}else{var r=this._rejectionhandler0;this._settlepromise0(this._fulfillmenthandler0,r,t),this._fulfillpromises(e,r)}this._setlength(0)}this._clearcancellationdata()},i.prototype._settledvalue=function(){var t=this._bitfield;return 0!==(33554432&t)?this._rejectionhandler0:0!==(16777216&t)?this._fulfillmenthandler0:void 0},i.defer=i.pending=function(){x.deprecated("promise.defer","new promise");var t=new i(b);return{promise:t,resolve:o,reject:s}},f.notenumerableprop(i,"_makeselfresolutionerror",l),t("./method")(i,b,j,p,x),t("./bind")(i,b,j,x),t("./cancel")(i,e,p,x),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,e,j,b,v,c),i.promise=i,i.version="3.5.0",t("./map.js")(i,e,p,j,b,x),t("./call_get.js")(i),t("./using.js")(i,p,j,f,b,x),t("./timers.js")(i,b,x),t("./generators.js")(i,p,b,j,n,x),t("./nodeify.js")(i),t("./promisify.js")(i,b),t("./props.js")(i,e,j,p),t("./race.js")(i,b,j,p),t("./reduce.js")(i,e,p,j,b,x),t("./settle.js")(i,e,x),t("./some.js")(i,e,p),t("./filter.js")(i,b),t("./each.js")(i,b),t("./any.js")(i),f.tofastproperties(i),f.tofastproperties(i.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new i(b)),x.setbounds(d.firstlineerror,f.lastlineerror),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new map}}function a(t){var r=this._promise=new e(n);t instanceof e&&r._propagatefrom(t,3),r._setoncancel(this),this._values=t,this._length=0,this._totalresolved=0,this._init(void 0,-2)}var c=t("./util");c.isarray;return c.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function l(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var a=o._bitfield;if(this._values=o,0===(50397184&a))return this._promise._setasyncguaranteed(),o._then(l,this._reject,void 0,this,n);if(0===(33554432&a))return 0!==(16777216&a)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asarray(o),null===o){var u=i("expecting an array or an iterable object but got "+c.classstring(o)).reason();return void this._promise._rejectcallback(u,!1)}return 0===o.length?void(-5===n?this._resolveemptyarray():this._resolve(s(n))):void this._iterate(o)},a.prototype._iterate=function(t){var n=this.getactuallength(t.length);this._length=n,this._values=this.shouldcopyvalues()?new array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;n>a;++a){var c=r(t[a],i);c instanceof e?(c=c._target(),s=c._bitfield):s=null,o?null!==s&&c.suppressunhandledrejections():null!==s?0===(50397184&s)?(c._proxy(this,a),this._values[a]=c):o=0!==(33554432&s)?this._promisefulfilled(c._value(),a):0!==(16777216&s)?this._promiserejected(c._reason(),a):this._promisecancelled(a):o=this._promisefulfilled(c,a)}o||i._setasyncguaranteed()},a.prototype._isresolved=function(){return null===this._values},a.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},a.prototype._cancel=function(){!this._isresolved()&&this._promise._iscancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(t){this._values=null,this._promise._rejectcallback(t,!1)},a.prototype._promisefulfilled=function(t,e){this._values[e]=t;var n=++this._totalresolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promisecancelled=function(){return this._cancel(),!0},a.prototype._promiserejected=function(t){return this._totalresolved++,this._reject(t),!0},a.prototype._resultcancelled=function(){if(!this._isresolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;nc;c+=2){var u=s[c],p=s[c+1],_=u+e;if(r===k)t[_]=k(u,h,u,p,e,i);else{var d=r(p,function(){return k(u,h,u,p,e,i)});f.notenumerableprop(d,"__ispromisified__",!0),t[_]=d}}return f.tofastproperties(t),t}function u(t,e,n){return k(t,e,void 0,t,null,n)}var p,h={},f=t("./util"),_=t("./nodeback"),d=f.withappended,v=f.maybewrapaserror,y=f.canevaluate,m=t("./errors").typeerror,g="async",b={__ispromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__ispromisified__"],c=new regexp("^(?:"+w.join("|")+")$"),j=function(t){return f.isidentifier(t)&&"_"!==t.charat(0)&&"constructor"!==t},e=function(t){return t.replace(/([$])/,"\\$")},k=y?p:c;e.promisify=function(t,e){if("function"!=typeof t)throw new m("expecting a function but got "+f.classstring(t));if(i(t))return t;e=object(e);var n=void 0===e.context?h:e.context,o=!!e.multiargs,s=u(t,n,o);return f.copydescriptors(t,s,r),s},e.promisifyall=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new m("the target of promisifyall must be an object or a function\n\n see \n");e=object(e);var n=!!e.multiargs,r=e.suffix;"string"!=typeof r&&(r=g);var i=e.filter;"function"!=typeof i&&(i=j);var o=e.promisifier;if("function"!=typeof o&&(o=k),!f.isidentifier(r))throw new rangeerror("suffix must be a valid identifier\n\n see \n");for(var s=f.inheriteddatakeys(t),a=0;ao;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._ismap=n,this._init$(void 0,n?-6:-3)}function s(t){var n,s=r(t);return l(s)?(n=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&n._propagatefrom(s,2),n):i("cannot await properties of a non-object\n\n see \n")}var a,c=t("./util"),l=c.isobject,u=t("./es5");"function"==typeof map&&(a=map);var p=function(){function t(t,r){this[e]=t,this[e+n]=r,e++}var e=0,n=0;return function(r){n=r.size,e=0;var i=new array(2*r.size);return r.foreach(t,i),i}}(),h=function(t){for(var e=new a,n=t.length/2|0,r=0;n>r;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e};c.inherits(o,n),o.prototype._init=function(){},o.prototype._promisefulfilled=function(t,e){this._values[e]=t;var n=++this._totalresolved;if(n>=this._length){var r;if(this._ismap)r=h(this._values);else{r={};for(var i=this.length(),o=0,s=this.length();s>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},o.prototype.shouldcopyvalues=function(){return!1},o.prototype.getactuallength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willbeovercapacity=function(t){return this._capacityh;++h){var _=t[h];(void 0!==_||h in t)&&e.cast(_)._then(u,p,void 0,l,null)}return l}var s=t("./util"),a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t);var s=h();this._fn=null===s?n:f.domainbind(s,n),void 0!==r&&(r=e.resolve(r),r._attachcancellationcallback(this)),this._initialvalue=r,this._currentcancellable=null,i===o?this._eachvalues=array(this._length):0===i?this._eachvalues=null:this._eachvalues=void 0,this._promise._capturestacktrace(),this._init$(void 0,-5)}function c(t,e){this.isfulfilled()?e._resolve(t):e._reject(t)}function l(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+f.classstring(e));var o=new a(t,e,n,i);return o.promise()}function u(t){this.accum=t,this.array._gotaccum(t);var n=i(this.value,this.array._promise);return n instanceof e?(this.array._currentcancellable=n,n._then(p,void 0,void 0,this,void 0)):p.call(this,n)}function p(t){var n=this.array,r=n._promise,i=_(n._fn);r._pushcontext();var o;o=void 0!==n._eachvalues?i.call(r._boundvalue(),t,this.index,this.length):i.call(r._boundvalue(),this.accum,t,this.index,this.length),o instanceof e&&(n._currentcancellable=o);var a=r._popcontext();return s.checkforgottenreturns(o,a,void 0!==n._eachvalues?"promise.each":"promise.reduce",r),o}var h=e._getdomain,f=t("./util"),_=f.trycatch;f.inherits(a,n),a.prototype._gotaccum=function(t){void 0!==this._eachvalues&&null!==this._eachvalues&&t!==o&&this._eachvalues.push(t)},a.prototype._eachcomplete=function(t){return null!==this._eachvalues&&this._eachvalues.push(t),this._eachvalues},a.prototype._init=function(){},a.prototype._resolveemptyarray=function(){this._resolve(void 0!==this._eachvalues?this._eachvalues:this._initialvalue)},a.prototype.shouldcopyvalues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolvecallback(t),this._values=null},a.prototype._resultcancelled=function(t){return t===this._initialvalue?this._cancel():void(this._isresolved()||(this._resultcancelled$(),this._currentcancellable instanceof e&&this._currentcancellable.cancel(),this._initialvalue instanceof e&&this._initialvalue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;if(void 0!==this._initialvalue?(n=this._initialvalue,r=0):(n=e.resolve(t[0]),r=1),this._currentcancellable=n,!n.isrejected())for(;i>r;++r){var o={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(u,void 0,void 0,o,void 0)}void 0!==this._eachvalues&&(n=n._then(this._eachcomplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},e.prototype.reduce=function(t,e){return l(this,t,e,null)},e.reduce=function(t,e,n,r){return l(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new error("no async scheduler available\n\n see \n")},s=i.getnativepromise();if(i.isnode&&"undefined"==typeof mutationobserver){var a=global.setimmediate,c=process.nexttick;r=i.isrecentnode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof s&&"function"==typeof s.resolve){var l=s.resolve();r=function(t){l.then(t)}}else r="undefined"==typeof mutationobserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setimmediate?function(t){setimmediate(t)}:"undefined"!=typeof settimeout?function(t){settimeout(t,0)}:o:function(){var t=document.createelement("div"),e={attributes:!0},n=!1,r=document.createelement("div"),i=new mutationobserver(function(){t.classlist.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classlist.toggle("foo"))};return function(n){var r=new mutationobserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}();e.exports=r},{"./util":36}],30:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t)}var o=e.promiseinspection,s=t("./util");s.inherits(i,n),i.prototype._promiseresolved=function(t,e){this._values[t]=e;var n=++this._totalresolved;return n>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promisefulfilled=function(t,e){var n=new o;return n._bitfield=33554432,n._settledvaluefield=t,this._promiseresolved(e,n)},i.prototype._promiserejected=function(t,e){var n=new o;return n._bitfield=16777216,n._settledvaluefield=t,this._promiseresolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t), this._howmany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return r("expecting a positive integer\n\n see \n");var n=new i(t),o=n.promise();return n.sethowmany(e),n.init(),o}var s=t("./util"),a=t("./errors").rangeerror,c=t("./errors").aggregateerror,l=s.isarray,u={};s.inherits(i,n),i.prototype._init=function(){if(this._initialized){if(0===this._howmany)return void this._resolve([]);this._init$(void 0,-5);var t=l(this._values);!this._isresolved()&&t&&this._howmany>this._canpossiblyfulfill()&&this._reject(this._getrangeerror(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setunwrap=function(){this._unwrap=!0},i.prototype.howmany=function(){return this._howmany},i.prototype.sethowmany=function(t){this._howmany=t},i.prototype._promisefulfilled=function(t){return this._addfulfilled(t),this._fulfilled()===this.howmany()?(this._values.length=this.howmany(),1===this.howmany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},i.prototype._promiserejected=function(t){return this._addrejected(t),this._checkoutcome()},i.prototype._promisecancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addrejected(u),this._checkoutcome())},i.prototype._checkoutcome=function(){if(this.howmany()>this._canpossiblyfulfill()){for(var t=new c,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalresolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addrejected=function(t){this._values.push(t)},i.prototype._addfulfilled=function(t){this._values[this._totalresolved++]=t},i.prototype._canpossiblyfulfill=function(){return this.length()-this._rejected()},i.prototype._getrangeerror=function(t){var e="input array must contain at least "+this._howmany+" items but contains only "+t+" items";return new a(e)},i.prototype._resolveemptyarray=function(){this._reject(this._getrangeerror(0))},e.some=function(t,e){return o(t,e)},e.prototype.some=function(t){return o(this,t)},e._somepromisearray=i}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitfield=t._bitfield,this._settledvaluefield=t._isfatesealed()?t._settledvalue():void 0):(this._bitfield=0,this._settledvaluefield=void 0)}e.prototype._settledvalue=function(){return this._settledvaluefield};var n=e.prototype.value=function(){if(!this.isfulfilled())throw new typeerror("cannot get fulfillment value of a non-fulfilled promise\n\n see \n");return this._settledvalue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isrejected())throw new typeerror("cannot get rejection reason of a non-rejected promise\n\n see \n");return this._settledvalue()},i=e.prototype.isfulfilled=function(){return 0!==(33554432&this._bitfield)},o=e.prototype.isrejected=function(){return 0!==(16777216&this._bitfield)},s=e.prototype.ispending=function(){return 0===(50397184&this._bitfield)},a=e.prototype.isresolved=function(){return 0!==(50331648&this._bitfield)};e.prototype.iscancelled=function(){return 0!==(8454144&this._bitfield)},t.prototype.__iscancelled=function(){return 65536===(65536&this._bitfield)},t.prototype._iscancelled=function(){return this._target().__iscancelled()},t.prototype.iscancelled=function(){return 0!==(8454144&this._target()._bitfield)},t.prototype.ispending=function(){return s.call(this._target())},t.prototype.isrejected=function(){return o.call(this._target())},t.prototype.isfulfilled=function(){return i.call(this._target())},t.prototype.isresolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetrejectionisunhandled(),r.call(t)},t.prototype._value=function(){return this._settledvalue()},t.prototype._reason=function(){return this._unsetrejectionisunhandled(),this._settledvalue()},t.promiseinspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(u(t)){if(t instanceof e)return t;var i=o(t);if(i===l){r&&r._pushcontext();var c=e.reject(i.e);return r&&r._popcontext(),c}if("function"==typeof i){if(s(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return a(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return l.e=e,l}}function s(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function a(t,r,i){function o(t){a&&(a._resolvecallback(t),a=null)}function s(t){a&&(a._rejectcallback(t,p,!0),a=null)}var a=new e(n),u=a;i&&i._pushcontext(),a._capturestacktrace(),i&&i._popcontext();var p=!0,h=c.trycatch(r).call(t,o,s);return p=!1,a&&h===l&&(a._rejectcallback(h.e,!0,!0),a=null),u}var c=t("./util"),l=c.errorobj,u=c.isobject,p={}.hasownproperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.handle=t}function o(t){return cleartimeout(this.handle),t}function s(t){throw cleartimeout(this.handle),t}var a=t("./util"),c=e.timeouterror;i.prototype._resultcancelled=function(){cleartimeout(this.handle)};var l=function(t){return u(+this).thenreturn(t)},u=e.delay=function(t,o){var s,a;return void 0!==o?(s=e.resolve(o)._then(l,null,null,t,void 0),r.cancellation()&&o instanceof e&&s._setoncancel(o)):(s=new e(n),a=settimeout(function(){s._fulfill()},+t),r.cancellation()&&s._setoncancel(new i(a)),s._capturestacktrace()),s._setasyncguaranteed(),s};e.prototype.delay=function(t){return u(t,this)};var p=function(t,e,n){var r;r="string"!=typeof e?e instanceof error?e:new c("operation timed out"):new c(e),a.markasoriginatingfromrejection(r),t._attachextratrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,a,c=new i(settimeout(function(){n.ispending()&&p(n,e,a)},t));return r.cancellation()?(a=this.then(),n=a._then(o,s,void 0,c,void 0),n._setoncancel(c)):n=this._then(o,s,void 0,c,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t){settimeout(function(){throw t},0)}function c(t){var e=r(t);return e!==t&&"function"==typeof t._isdisposable&&"function"==typeof t._getdisposer&&t._isdisposable()&&e._setdisposable(t._getdisposer()),e}function l(t,n){function i(){if(s>=l)return u._fulfill();var o=c(t[s++]);if(o instanceof e&&o._isdisposable()){try{o=r(o._getdisposer().trydispose(n),t.promise)}catch(p){return a(p)}if(o instanceof e)return o._then(i,a,null,null,null)}i()}var s=0,l=t.length,u=new e(o);return i(),u}function u(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function h(t){return u.isdisposer(t)?(this.resources[this.index]._setdisposable(t),t.promise()):t}function f(t){this.length=t,this.promise=null,this[t-1]=null}var _=t("./util"),d=t("./errors").typeerror,v=t("./util").inherits,y=_.errorobj,m=_.trycatch,g={};u.prototype.data=function(){return this._data},u.prototype.promise=function(){return this._promise},u.prototype.resource=function(){return this.promise().isfulfilled()?this.promise().value():g},u.prototype.trydispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushcontext();var r=e!==g?this.dodispose(e,t):null;return void 0!==n&&n._popcontext(),this._promise._unsetdisposable(),this._data=null,r},u.isdisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.trydispose},v(p,u),p.prototype.dodispose=function(t,e){var n=this.data();return n.call(t,t,e)},f.prototype._resultcancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var t=arguments.length;if(2>t)return n("you must pass at least 2 arguments to promise.using");var i=arguments[t-1];if("function"!=typeof i)return n("expecting a function but got "+_.classstring(i));var o,a=!0;2===t&&array.isarray(arguments[0])?(o=arguments[0],t=o.length,a=!1):(o=arguments,t--);for(var c=new f(t),p=0;t>p;++p){var d=o[p];if(u.isdisposer(d)){var v=d;d=d.promise(),d._setdisposable(v)}else{var g=r(d);g instanceof e&&(d=g._then(h,null,null,{resources:c,index:p},void 0))}c[p]=d}for(var b=new array(c.length),p=0;p0},e.prototype._getdisposer=function(){return this._disposer},e.prototype._unsetdisposable=function(){this._bitfield=-131073&this._bitfield,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";function r(){try{var t=p;return p=null,t.apply(this,arguments)}catch(e){return t.e=e,t}}function i(t){return p=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return o(t)?new error(v(t)):t}function c(t,e){var n,r=t.length,i=new array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function l(t,e,n){if(!f.ises5)return{}.hasownproperty.call(t,e)?t[e]:void 0;var r=object.getownpropertydescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return f.defineproperty(t,e,r),t}function p(t){throw t}function h(t){try{if("function"==typeof t){var e=f.names(t.prototype),n=f.ises5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=a.test(t+"")&&f.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function f(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function _(t){return d.test(t)}function d(t,e,n){for(var r=new array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function m(t){try{u(t,"isoperational",!0)}catch(e){}}function g(t){return null==t?!1:t instanceof error.__bluebirderrortypes__.operationalerror||t.isoperational===!0}function b(t){return y(t)&&f.propertyiswritable(t,"stack")}function w(t){return{}.tostring.call(t)}function c(t,e,n){for(var r=f.names(t),i=0;i10||t[0]>0}(),b.isnode&&b.tofastproperties(process);try{throw new error}catch(u){b.lastlineerror=u}e.exports=b},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.p=window.promise:"undefined"!=typeof self&&null!==self&&(self.p=self.promise);