UNPKG

@playbasis1/playbasis

Version:
26 lines 283 kB
"use strict";var _typeof2="function"==typeof Symbol&&"symbol"==typeof("function"==typeof Symbol?Symbol.iterator:"@@iterator")?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==("function"==typeof Symbol?Symbol.prototype:"@@prototype")?"symbol":typeof e};!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof2(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Playbasis=e()}}(function(){var e,t,n;return function(){function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){return o(t[a][1][e]||e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}return e}()({1:[function(e,t,n){function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function o(e){var t=r(e),n=t[0],o=t[1];return 3*(n+o)/4-o}function i(e,t,n){return 3*(t+n)/4-n}function a(e){for(var t,n=r(e),o=n[0],a=n[1],s=new h(i(e,o,a)),u=0,l=a>0?o-4:o,c=0;c<l;c+=4)t=f[e.charCodeAt(c)]<<18|f[e.charCodeAt(c+1)]<<12|f[e.charCodeAt(c+2)]<<6|f[e.charCodeAt(c+3)],s[u++]=t>>16&255,s[u++]=t>>8&255,s[u++]=255&t;return 2===a&&(t=f[e.charCodeAt(c)]<<2|f[e.charCodeAt(c+1)]>>4,s[u++]=255&t),1===a&&(t=f[e.charCodeAt(c)]<<10|f[e.charCodeAt(c+1)]<<4|f[e.charCodeAt(c+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t),s}function s(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function u(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(s(r));return o.join("")}function l(e){for(var t,n=e.length,r=n%3,o=[],i=0,a=n-r;i<a;i+=16383)o.push(u(e,i,i+16383>a?a:i+16383));return 1===r?(t=e[n-1],o.push(c[t>>2]+c[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(c[t>>10]+c[t>>4&63]+c[t<<2&63]+"=")),o.join("")}n.byteLength=o,n.toByteArray=a,n.fromByteArray=l;for(var c=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,y=p.length;d<y;++d)c[d]=p[d],f[p.charCodeAt(d)]=d;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},{}],2:[function(t,n,r){(function(t,o,i){/* @preserve * The MIT License (MIT) * * Copyright (c) 2013-2018 Petka Antonov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ !function(t){if("object"==(void 0===r?"undefined":_typeof2(r))&&void 0!==n)n.exports=t();else if("function"==typeof e&&e.amd)e([],t);else{var i;"undefined"!=typeof window?i=window:void 0!==o?i=o:"undefined"!=typeof self&&(i=self),i.Promise=t()}}(function(){var e,n,r;return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof _dereq_&&_dereq_;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n||e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof _dereq_&&_dereq_,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){t.exports=function(e){function t(e){var t=new n(e),r=t.promise();return t.setHowMany(1),t.setUnwrap(),t.init(),r}var n=e._SomePromiseArray;e.any=function(e){return t(e)},e.prototype.any=function(){return t(this)}}},{}],2:[function(e,n,r){function o(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new h(16),this._normalQueue=new h(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var e=this;this.drainQueues=function(){e._drainQueues()},this._schedule=f}function i(e,t,n){this._lateQueue.push(e,t,n),this._queueTick()}function a(e,t,n){this._normalQueue.push(e,t,n),this._queueTick()}function s(e){this._normalQueue._pushOne(e),this._queueTick()}function u(e){for(;e.length()>0;)l(e)}function l(e){var t=e.shift();if("function"!=typeof t)t._settlePromises();else{var n=e.shift(),r=e.shift();t.call(n,r)}}var c;try{throw new Error}catch(e){c=e}var f=e("./schedule"),h=e("./queue"),p=e("./util");o.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},o.prototype.hasCustomScheduler=function(){return this._customScheduler},o.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},o.prototype.disableTrampolineIfNecessary=function(){p.hasDevTools&&(this._trampolineEnabled=!1)},o.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},o.prototype.fatalError=function(e,n){n?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),t.exit(2)):this.throwLater(e)},o.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},p.hasDevTools?(o.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?i.call(this,e,t,n):this._schedule(function(){setTimeout(function(){e.call(t,n)},100)})},o.prototype.invoke=function(e,t,n){this._trampolineEnabled?a.call(this,e,t,n):this._schedule(function(){e.call(t,n)})},o.prototype.settlePromises=function(e){this._trampolineEnabled?s.call(this,e):this._schedule(function(){e._settlePromises()})}):(o.prototype.invokeLater=i,o.prototype.invoke=a,o.prototype.settlePromises=s),o.prototype._drainQueues=function(){u(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,u(this._lateQueue)},o.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},o.prototype._reset=function(){this._isTickUsed=!1},n.exports=o,n.exports.firstLineError=c},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,n){t.exports=function(e,t,n,r){var o=!1,i=function(e,t){this._reject(t)},a=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(i,i,null,this,e)},s=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},u=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(i){o||(o=!0,e.prototype._propagateFrom=r.propagateFromFunction(),e.prototype._boundValue=r.boundValueFunction());var l=n(i),c=new e(t);c._propagateFrom(this,1);var f=this._target();if(c._setBoundTo(l),l instanceof e){var h={promiseRejectionQueued:!1,promise:c,target:f,bindingPromise:l};f._then(t,a,void 0,c,h),l._then(s,u,void 0,c,h),c._setOnCancel(l)}else c._resolveCallback(f);return c},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},e.bind=function(t,n){return e.resolve(n).bind(t)}}},{}],4:[function(e,t,n){function r(){try{Promise===i&&(Promise=o)}catch(e){}return i}var o;"undefined"!=typeof Promise&&(o=Promise);var i=e("./promise")();i.noConflict=r,t.exports=i},{"./promise":22}],5:[function(e,t,n){var r=Object.create;if(r){var o=r(null),i=r(null);o[" size"]=i[" size"]=0}t.exports=function(t){function n(e,n){var r;if(null!=e&&(r=e[n]),"function"!=typeof r){var o="Object "+s.classString(e)+" has no method '"+s.toString(n)+"'";throw new t.TypeError(o)}return r}function r(e){return n(e,this.pop()).apply(e,this)}function o(e){return e[this]}function i(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}var a,s=e("./util"),u=s.canEvaluate;s.isIdentifier;t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(r,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t,n="number"==typeof e;if(n)t=i;else if(u){var r=a(e);t=null!==r?r:o}else t=o;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,n){t.exports=function(t,n,r,o){var i=e("./util"),a=i.tryCatch,s=i.errorObj,u=t._async;t.prototype.break=t.prototype.cancel=function(){if(!o.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var n=e._cancellationParent;if(null==n||!n._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=n}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(i.isArray(e))for(var n=0;n<e.length;++n)this._doInvokeOnCancel(e[n],t);else if(void 0!==e)if("function"==typeof e){if(!t){var r=a(e).call(this._boundValue());r===s&&(this._attachExtraTrace(r.e),u.throwLater(r.e))}}else e._resultCancelled(this)},t.prototype._invokeOnCancel=function(){var e=this._onCancel();this._unsetOnCancel(),u.invoke(this._doInvokeOnCancel,this,e)},t.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},t.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(e,t,n){t.exports=function(t){function n(e,n,s){return function(u){var l=s._boundValue();e:for(var c=0;c<e.length;++c){var f=e[c];if(f===Error||null!=f&&f.prototype instanceof Error){if(u instanceof f)return i(n).call(l,u)}else if("function"==typeof f){var h=i(f).call(l,u);if(h===a)return h;if(h)return i(n).call(l,u)}else if(r.isObject(u)){for(var p=o(f),d=0;d<p.length;++d){var y=p[d];if(f[y]!=u[y])continue e}return i(n).call(l,u)}}return t}}var r=e("./util"),o=e("./es5").keys,i=r.tryCatch,a=r.errorObj;return n}},{"./es5":13,"./util":36}],8:[function(e,t,n){t.exports=function(e){function t(){this._trace=new t.CapturedTrace(r())}function n(){if(o)return new t}function r(){var e=i.length-1;if(e>=0)return i[e]}var o=!1,i=[];return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},t.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,i.push(this._trace))},t.prototype._popContext=function(){if(void 0!==this._trace){var e=i.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},t.CapturedTrace=null,t.create=n,t.deactivateLongStackTraces=function(){},t.activateLongStackTraces=function(){var n=e.prototype._pushContext,i=e.prototype._popContext,a=e._peekContext,s=e.prototype._peekContext,u=e.prototype._promiseCreated;t.deactivateLongStackTraces=function(){e.prototype._pushContext=n,e.prototype._popContext=i,e._peekContext=a,e.prototype._peekContext=s,e.prototype._promiseCreated=u,o=!1},o=!0,e.prototype._pushContext=t.prototype._pushContext,e.prototype._popContext=t.prototype._popContext,e._peekContext=e.prototype._peekContext=r,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},t}},{}],9:[function(e,n,r){n.exports=function(n,r){function o(e,t){return{promise:t}}function i(){return!1}function a(e,t,n){var r=this;try{e(t,n,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+D.toString(e));r._attachCancellationCallback(e)})}catch(e){return e}}function s(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?D.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function u(){return this._onCancelField}function l(e){this._onCancelField=e}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function f(e,t){if(0!=(1&t)){this._cancellationParent=e;var n=e._branchesRemainingToCancel;void 0===n&&(n=0),e._branchesRemainingToCancel=n+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function h(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function p(){var e=this._boundTo;return void 0!==e&&e instanceof n?e.isFulfilled()?e.value():void 0:e}function d(){this._trace=new U(this._peekContext())}function y(e,t){if(H(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var r=O(e);D.notEnumerableProp(e,"stack",r.message+"\n"+r.stack.join("\n")),D.notEnumerableProp(e,"__stackCleaned__",!0)}}}function v(){this._trace=void 0}function _(e,t,n,r,o){if(void 0===e&&null!==t&&K){if(void 0!==o&&o._returnedNonUndefined())return;if(0==(65535&r._bitField))return;n&&(n+=" ");var i="",a="";if(t._trace){for(var s=t._trace.stack.split("\n"),u=E(s),l=u.length-1;l>=0;--l){var c=u[l];if(!G.test(c)){var f=c.match(z);f&&(i="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(u.length>0)for(var h=u[0],l=0;l<s.length;++l)if(s[l]===h){l>0&&(a="\n"+s[l-1]);break}}var p="a promise was created in a "+n+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(p,!0,t)}}function g(e,t){var n=e+" is deprecated and will be removed in a future version.";return t&&(n+=" Use "+t+" instead."),m(n)}function m(e,t,r){if(ue.warnings){var o,i=new B(e);if(t)r._attachExtraTrace(i);else if(ue.longStackTraces&&(o=n._peekContext()))o.attachExtraTrace(i);else{var a=O(i);i.stack=a.message+"\n"+a.stack.join("\n")}re("warning",i)||k(i,"",!0)}}function b(e,t){for(var n=0;n<t.length-1;++n)t[n].push("From previous event:"),t[n]=t[n].join("\n");return n<t.length&&(t[n]=t[n].join("\n")),e+"\n"+t.join("\n")}function w(e){for(var t=0;t<e.length;++t)(0===e[t].length||t+1<e.length&&e[t][0]===e[t+1][0])&&(e.splice(t,1),t--)}function A(e){for(var t=e[0],n=1;n<e.length;++n){for(var r=e[n],o=t.length-1,i=t[o],a=-1,s=r.length-1;s>=0;--s)if(r[s]===i){a=s;break}for(var s=a;s>=0;--s){var u=r[s];if(t[o]!==u)break;t.pop(),o--}t=r}}function E(e){for(var t=[],n=0;n<e.length;++n){var r=e[n],o=" (No stack trace)"===r||V.test(r),i=o&&ie(r);o&&!i&&(Q&&" "!==r.charAt(0)&&(r=" "+r),t.push(r))}return t}function C(e){for(var t=e.stack.replace(/\s+$/g,"").split("\n"),n=0;n<t.length;++n){var r=t[n];if(" (No stack trace)"===r||V.test(r))break}return n>0&&"SyntaxError"!=e.name&&(t=t.slice(n)),t}function O(e){var t=e.stack,n=e.toString();return t="string"==typeof t&&t.length>0?C(e):[" (No stack trace)"],{message:n,stack:"SyntaxError"==e.name?t:E(t)}}function k(e,t,n){if("undefined"!=typeof console){var r;if(D.isObject(e)){var o=e.stack;r=t+X(o,e)}else r=t+String(e);"function"==typeof N?N(r,n):"function"!=typeof console.log&&"object"!==_typeof2(console.log)||console.log(r)}}function P(e,t,n,r){var o=!1;try{"function"==typeof t&&(o=!0,"rejectionHandled"===e?t(r):t(n,r))}catch(e){F.throwLater(e)}"unhandledRejection"===e?re(e,n,r)||o||k(n,"Unhandled rejection "):re(e,r)}function S(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{t=e&&"function"==typeof e.toString?e.toString():D.toString(e);if(/\[object [a-zA-Z0-9$_]+\]/.test(t))try{t=JSON.stringify(e)}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+T(t)+">, no stack trace)"}function T(e){return e.length<41?e:e.substr(0,38)+"..."}function x(){return"function"==typeof se}function j(e){var t=e.match(ae);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function R(e,t){if(x()){for(var n,r,o=e.stack.split("\n"),i=t.stack.split("\n"),a=-1,s=-1,u=0;u<o.length;++u){var l=j(o[u]);if(l){n=l.fileName,a=l.line;break}}for(var u=0;u<i.length;++u){var l=j(i[u]);if(l){r=l.fileName,s=l.line;break}}a<0||s<0||!n||!r||n!==r||a>=s||(ie=function(e){if(q.test(e))return!0;var t=j(e);return!!(t&&t.fileName===n&&a<=t.line&&t.line<=s)})}}function U(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);se(this,U),t>32&&this.uncycle()}var M,I,N,L=n._getDomain,F=n._async,B=e("./errors").Warning,D=e("./util"),J=e("./es5"),H=D.canAttachTrace,q=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,G=/\((?:timers\.js):\d+:\d+\)/,z=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,V=null,X=null,Q=!1,$=!(0==D.env("BLUEBIRD_DEBUG")),Y=!(0==D.env("BLUEBIRD_WARNINGS")||!$&&!D.env("BLUEBIRD_WARNINGS")),W=!(0==D.env("BLUEBIRD_LONG_STACK_TRACES")||!$&&!D.env("BLUEBIRD_LONG_STACK_TRACES")),K=0!=D.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(Y||!!D.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var e=this;setTimeout(function(){e._notifyUnhandledRejection()},1)}},n.prototype._notifyUnhandledRejectionIsHandled=function(){P("rejectionHandled",M,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),P("unhandledRejection",I,e,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(e,t,n){return m(e,t,n||this)},n.onPossiblyUnhandledRejection=function(e){var t=L();I="function"==typeof e?null===t?e:D.domainBind(t,e):void 0},n.onUnhandledRejectionHandled=function(e){var t=L();M="function"==typeof e?null===t?e:D.domainBind(t,e):void 0};var Z=function(){};n.longStackTraces=function(){if(F.haveItemsQueued()&&!ue.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ue.longStackTraces&&x()){var e=n.prototype._captureStackTrace,t=n.prototype._attachExtraTrace,o=n.prototype._dereferenceTrace;ue.longStackTraces=!0,Z=function(){if(F.haveItemsQueued()&&!ue.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=e,n.prototype._attachExtraTrace=t,n.prototype._dereferenceTrace=o,r.deactivateLongStackTraces(),F.enableTrampoline(),ue.longStackTraces=!1},n.prototype._captureStackTrace=d,n.prototype._attachExtraTrace=y,n.prototype._dereferenceTrace=v,r.activateLongStackTraces(),F.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return ue.longStackTraces&&x()};var ee=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return D.global.dispatchEvent(e),function(e,t){var n={detail:t,cancelable:!0};J.defineProperty(n,"promise",{value:t.promise}),J.defineProperty(n,"reason",{value:t.reason});var r=new CustomEvent(e.toLowerCase(),n);return!D.global.dispatchEvent(r)}}if("function"==typeof Event){var e=new Event("CustomEvent");return D.global.dispatchEvent(e),function(e,t){var n=new Event(e.toLowerCase(),{cancelable:!0});return n.detail=t,J.defineProperty(n,"promise",{value:t.promise}),J.defineProperty(n,"reason",{value:t.reason}),!D.global.dispatchEvent(n)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),D.global.dispatchEvent(e),function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e.toLowerCase(),!1,!0,t),!D.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),te=function(){return D.isNode?function(){return t.emit.apply(t,arguments)}:D.global?function(e){var t="on"+e.toLowerCase(),n=D.global[t];return!!n&&(n.apply(D.global,[].slice.call(arguments,1)),!0)}:function(){return!1}}(),ne={promiseCreated:o,promiseFulfilled:o,promiseRejected:o,promiseResolved:o,promiseCancelled:o,promiseChained:function(e,t,n){return{promise:t,child:n}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,n){return{reason:t,promise:n}},rejectionHandled:o},re=function(e){var t=!1;try{t=te.apply(null,arguments)}catch(e){F.throwLater(e),t=!0}var n=!1;try{n=ee(e,ne[e].apply(null,arguments))}catch(e){F.throwLater(e),n=!0}return n||t};n.config=function(e){if(e=Object(e),"longStackTraces"in e&&(e.longStackTraces?n.longStackTraces():!e.longStackTraces&&n.hasLongStackTraces()&&Z()),"warnings"in e){var t=e.warnings;ue.warnings=!!t,K=ue.warnings,D.isObject(t)&&"wForgottenReturn"in t&&(K=!!t.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!ue.cancellation){if(F.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=c,n.prototype._propagateFrom=f,n.prototype._onCancel=u,n.prototype._setOnCancel=l,n.prototype._attachCancellationCallback=s,n.prototype._execute=a,oe=f,ue.cancellation=!0}return"monitoring"in e&&(e.monitoring&&!ue.monitoring?(ue.monitoring=!0,n.prototype._fireEvent=re):!e.monitoring&&ue.monitoring&&(ue.monitoring=!1,n.prototype._fireEvent=i)),n},n.prototype._fireEvent=i,n.prototype._execute=function(e,t,n){try{e(t,n)}catch(e){return e}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(e){},n.prototype._attachCancellationCallback=function(e){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._dereferenceTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(e,t){};var oe=h,ie=function(){return!1},ae=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;D.inherits(U,Error),r.CapturedTrace=U,U.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],n={},r=0,o=this;void 0!==o;++r)t.push(o),o=o._parent;e=this._length=r;for(var r=e-1;r>=0;--r){var i=t[r].stack;void 0===n[i]&&(n[i]=r)}for(var r=0;r<e;++r){var a=t[r].stack,s=n[a];if(void 0!==s&&s!==r){s>0&&(t[s-1]._parent=void 0,t[s-1]._length=1),t[r]._parent=void 0,t[r]._length=1;var u=r>0?t[r-1]:this;s<e-1?(u._parent=t[s+1],u._parent.uncycle(),u._length=u._parent._length+1):(u._parent=void 0,u._length=1);for(var l=u._length+1,c=r-2;c>=0;--c)t[c]._length=l,l++;return}}}},U.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=O(e),n=t.message,r=[t.stack],o=this;void 0!==o;)r.push(E(o.stack.split("\n"))),o=o._parent;A(r),w(r),D.notEnumerableProp(e,"stack",b(n,r)),D.notEnumerableProp(e,"__stackCleaned__",!0)}};var se=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():S(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,V=e,X=t;var n=Error.captureStackTrace;return ie=function(e){return q.test(e)},function(e,t){Error.stackTraceLimit+=6,n(e,t),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return V=/@/,X=t,Q=!0,function(e){e.stack=(new Error).stack};var o;try{throw new Error}catch(e){o="stack"in e}return"stack"in r||!o||"number"!=typeof Error.stackTraceLimit?(X=function(e,t){return"string"==typeof e?e:"object"!==(void 0===t?"undefined":_typeof2(t))&&"function"!=typeof t||void 0===t.name||void 0===t.message?S(t):t.toString()},null):(V=e,X=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(N=function(e){console.warn(e)},D.isNode&&t.stderr.isTTY?N=function(e,t){var n=t?"":"";console.warn(n+e+"\n")}:D.isNode||"string"!=typeof(new Error).stack||(N=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var ue={warnings:Y,longStackTraces:!1,cancellation:!1,monitoring:!1};return W&&n.longStackTraces(),{longStackTraces:function(){return ue.longStackTraces},warnings:function(){return ue.warnings},cancellation:function(){return ue.cancellation},monitoring:function(){return ue.monitoring},propagateFromFunction:function(){return oe},boundValueFunction:function(){return p},checkForgottenReturns:_,setBounds:R,warn:m,deprecated:g,CapturedTrace:U,fireDomEvent:ee,fireGlobalEvent:te}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(e,t,n){t.exports=function(e){function t(){return this.value}function n(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(n,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:e},void 0);var t=arguments[1],r=function(){throw t};return this.caught(e,r)},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var r=arguments[1];r instanceof e&&r.suppressUnhandledRejections();var o=function(){return r};return this.caught(n,o)}}},{}],11:[function(e,t,n){t.exports=function(e,t){function n(){return i(this)}function r(e,n){return o(e,n,t,t)}var o=e.reduce,i=e.all;e.prototype.each=function(e){return o(this,e,t,0)._then(n,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return o(this,e,t,t)},e.each=function(e,r){return o(e,r,t,0)._then(n,void 0,void 0,e,void 0)},e.mapSeries=r}},{}],12:[function(e,t,n){function r(e,t){function n(r){if(!(this instanceof n))return new n(r);f(this,"message","string"==typeof r?r:t),f(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return c(n,Error),n}function o(e){if(!(this instanceof o))return new o(e);f(this,"name","OperationalError"),f(this,"message",e),this.cause=e,this.isOperational=!0,e instanceof Error?(f(this,"message",e.message),f(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var i,a,s=e("./es5"),u=s.freeze,l=e("./util"),c=l.inherits,f=l.notEnumerableProp,h=r("Warning","warning"),p=r("CancellationError","cancellation error"),d=r("TimeoutError","timeout error"),y=r("AggregateError","aggregate error");try{i=TypeError,a=RangeError}catch(e){i=r("TypeError","type error"),a=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),_=0;_<v.length;++_)"function"==typeof Array.prototype[v[_]]&&(y.prototype[v[_]]=Array.prototype[v[_]]);s.defineProperty(y.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),y.prototype.isOperational=!0;var g=0;y.prototype.toString=function(){var e=Array(4*g+1).join(" "),t="\n"+e+"AggregateError of:\n";g++,e=Array(4*g+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",o=r.split("\n"),i=0;i<o.length;++i)o[i]=e+o[i];r=o.join("\n"),t+=r+"\n"}return g--,t},c(o,Error);var m=Error.__BluebirdErrorTypes__;m||(m=u({CancellationError:p,TimeoutError:d,OperationalError:o,RejectionError:o,AggregateError:y}),s.defineProperty(Error,"__BluebirdErrorTypes__",{value:m,writable:!1,enumerable:!1,configurable:!1})),t.exports={Error:Error,TypeError:i,RangeError:a,CancellationError:m.CancellationError,OperationalError:m.OperationalError,TimeoutError:m.TimeoutError,AggregateError:m.AggregateError,Warning:h}},{"./es5":13,"./util":36}],13:[function(e,t,n){var r=function(){return void 0===this}();if(r)t.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!(n&&!n.writable&&!n.set)}};else{var o={}.hasOwnProperty,i={}.toString,a={}.constructor.prototype,s=function(e){var t=[];for(var n in e)o.call(e,n)&&t.push(n);return t},u=function(e,t){return{value:e[t]}},l=function(e,t,n){return e[t]=n.value,e},c=function(e){return e},f=function(e){try{return Object(e).constructor.prototype}catch(e){return a}},h=function(e){try{return"[object Array]"===i.call(e)}catch(e){return!1}};t.exports={isArray:h,keys:s,names:s,defineProperty:l,getDescriptor:u,freeze:c,getPrototypeOf:f,isES5:r,propertyIsWritable:function(){return!0}}}},{}],14:[function(e,t,n){t.exports=function(e,t){var n=e.map;e.prototype.filter=function(e,r){return n(this,e,r,t)},e.filter=function(e,r,o){return n(e,r,o,t)}}},{}],15:[function(e,t,n){t.exports=function(t,n,r){function o(e,t,n){this.promise=e,this.type=t,this.handler=n,this.called=!1,this.cancelPromise=null}function i(e){this.finallyHandler=e}function a(e,t){return null!=e.cancelPromise&&(arguments.length>1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function s(){return l.call(this,this.promise._target()._settledValue())}function u(e){if(!a(this,e))return h.e=e,h}function l(e){var o=this.promise,l=this.handler;if(!this.called){this.called=!0;var c=this.isFinallyHandler()?l.call(o._boundValue()):l.call(o._boundValue(),e);if(c===r)return c;if(void 0!==c){o._setReturnedNonUndefined();var p=n(c,o);if(p instanceof t){if(null!=this.cancelPromise){if(p._isCancelled()){var d=new f("late cancellation observer");return o._attachExtraTrace(d),h.e=d,h}p.isPending()&&p._attachCancellationCallback(new i(this))}return p._then(s,u,void 0,this,void 0)}}}return o.isRejected()?(a(this),h.e=e,h):(a(this),e)}var c=e("./util"),f=t.CancellationError,h=c.errorObj,p=e("./catch_filter")(r);return o.prototype.isFinallyHandler=function(){return 0===this.type},i.prototype._resultCancelled=function(){a(this.finallyHandler)},t.prototype._passThrough=function(e,t,n,r){return"function"!=typeof e?this.then():this._then(n,r,void 0,new o(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,l,l)},t.prototype.tap=function(e){return this._passThrough(e,1,l)},t.prototype.tapCatch=function(e){var n=arguments.length;if(1===n)return this._passThrough(e,1,void 0,l);var r,o=new Array(n-1),i=0;for(r=0;r<n-1;++r){var a=arguments[r];if(!c.isObject(a))return t.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+c.classString(a)));o[i++]=a}o.length=i;var s=arguments[r];return this._passThrough(p(o,s,this),1,void 0,l)},o}},{"./catch_filter":7,"./util":36}],16:[function(e,t,n){t.exports=function(t,n,r,o,i,a){function s(e,n,r){for(var i=0;i<n.length;++i){r._pushContext();var a=p(n[i])(e);if(r._popContext(),a===h){r._pushContext();var s=t.reject(h.e);return r._popContext(),s}var u=o(a,r);if(u instanceof t)return u}return null}function u(e,n,o,i){if(a.cancellation()){var s=new t(r),u=this._finallyPromise=new t(r);this._promise=s.lastly(function(){return u}),s._captureStackTrace(),s._setOnCancel(this)}else{(this._promise=new t(r))._captureStackTrace()}this._stack=i,this._generatorFunction=e,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof o?[o].concat(d):d,this._yieldedPromise=null,this._cancellationPhase=!1}var l=e("./errors"),c=l.TypeError,f=e("./util"),h=f.errorObj,p=f.tryCatch,d=[];f.inherits(u,i),u.prototype._isResolved=function(){return null===this._promise},u.prototype._cleanup=function(){this._promise=this._generator=null,a.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},u.prototype._promiseCancelled=function(){if(!this._isResolved()){var e,n=void 0!==this._generator.return;if(n)this._promise._pushContext(),e=p(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var r=new t.CancellationError("generator .return() sentinel");t.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),e=p(this._generator.throw).call(this._generator,r),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(e)}},u.prototype._promiseFulfilled=function(e){this._yieldedPromise=null,this._promise._pushContext();var t=p(this._generator.next).call(this._generator,e);this._promise._popContext(),this._continue(t)},u.prototype._promiseRejected=function(e){this._yieldedPromise=null,this._promise._attachExtraTrace(e),this._promise._pushContext();var t=p(this._generator.throw).call(this._generator,e);this._promise._popContext(),this._continue(t)},u.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof t){var e=this._yieldedPromise;this._yieldedPromise=null,e.cancel()}},u.prototype.promise=function(){return this._promise},u.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},u.prototype._continue=function(e){var n=this._promise;if(e===h)return this._cleanup(),this._cancellationPhase?n.cancel():n._rejectCallback(e.e,!1);var r=e.value;if(!0===e.done)return this._cleanup(),this._cancellationPhase?n.cancel():n._resolveCallback(r);var i=o(r,this._promise);if(!(i instanceof t)&&null===(i=s(i,this._yieldHandlers,this._promise)))return void this._promiseRejected(new c("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(r))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")));i=i._target();var a=i._bitField;0==(50397184&a)?(this._yieldedPromise=i, i._proxy(this,null)):0!=(33554432&a)?t._async.invoke(this._promiseFulfilled,this,i._value()):0!=(16777216&a)?t._async.invoke(this._promiseRejected,this,i._reason()):this._promiseCancelled()},t.coroutine=function(e,t){if("function"!=typeof e)throw new c("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=Object(t).yieldHandler,r=u,o=(new Error).stack;return function(){var t=e.apply(this,arguments),i=new r(void 0,void 0,n,o),a=i.promise();return i._generator=t,i._promiseFulfilled(void 0),a}},t.coroutine.addYieldHandler=function(e){if("function"!=typeof e)throw new c("expecting a function but got "+f.classString(e));d.push(e)},t.spawn=function(e){if(a.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof e)return n("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var r=new u(e,this),o=r.promise();return r._run(t.spawn),o}}},{"./errors":12,"./util":36}],17:[function(e,t,n){t.exports=function(t,n,r,o,i,a){var s=e("./util");s.canEvaluate,s.tryCatch,s.errorObj;t.join=function(){var e,t=arguments.length-1;if(t>0&&"function"==typeof arguments[t]){e=arguments[t];var r}var o=[].slice.call(arguments);e&&o.pop();var r=new n(o).promise();return void 0!==e?r.spread(e):r}}},{"./util":36}],18:[function(e,t,n){t.exports=function(t,n,r,o,i,a){function s(e,t,n,r){this.constructor$(e),this._promise._captureStackTrace();var o=l();this._callback=null===o?t:c.domainBind(o,t),this._preservedValues=r===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],p.invoke(this._asyncInit,this,void 0)}function u(e,n,o,i){if("function"!=typeof n)return r("expecting a function but got "+c.classString(n));var a=0;if(void 0!==o){if("object"!==(void 0===o?"undefined":_typeof2(o))||null===o)return t.reject(new TypeError("options argument must be an object but it is "+c.classString(o)));if("number"!=typeof o.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+c.classString(o.concurrency)));a=o.concurrency}return a="number"==typeof a&&isFinite(a)&&a>=1?a:0,new s(e,n,a,i).promise()}var l=t._getDomain,c=e("./util"),f=c.tryCatch,h=c.errorObj,p=t._async;c.inherits(s,n),s.prototype._asyncInit=function(){this._init$(void 0,-2)},s.prototype._init=function(){},s.prototype._promiseFulfilled=function(e,n){var r=this._values,i=this.length(),s=this._preservedValues,u=this._limit;if(n<0){if(n=-1*n-1,r[n]=e,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return r[n]=e,this._queue.push(n),!1;null!==s&&(s[n]=e);var l=this._promise,c=this._callback,p=l._boundValue();l._pushContext();var d=f(c).call(p,e,n,i),y=l._popContext();if(a.checkForgottenReturns(d,y,null!==s?"Promise.filter":"Promise.map",l),d===h)return this._reject(d.e),!0;var v=o(d,this._promise);if(v instanceof t){v=v._target();var _=v._bitField;if(0==(50397184&_))return u>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0==(33554432&_))return 0!=(16777216&_)?(this._reject(v._reason()),!0):(this._cancel(),!0);d=v._value()}r[n]=d}return++this._totalResolved>=i&&(null!==s?this._filter(r,s):this._resolve(r),!0)},s.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight<t;){if(this._isResolved())return;var r=e.pop();this._promiseFulfilled(n[r],r)}},s.prototype._filter=function(e,t){for(var n=t.length,r=new Array(n),o=0,i=0;i<n;++i)e[i]&&(r[o++]=t[i]);r.length=o,this._resolve(r)},s.prototype.preservedValues=function(){return this._preservedValues},t.prototype.map=function(e,t){return u(this,e,t,null)},t.map=function(e,t,n,r){return u(e,t,n,r)}}},{"./util":36}],19:[function(e,t,n){t.exports=function(t,n,r,o,i){var a=e("./util"),s=a.tryCatch;t.method=function(e){if("function"!=typeof e)throw new t.TypeError("expecting a function but got "+a.classString(e));return function(){var r=new t(n);r._captureStackTrace(),r._pushContext();var o=s(e).apply(this,arguments),a=r._popContext();return i.checkForgottenReturns(o,a,"Promise.method",r),r._resolveFromSyncValue(o),r}},t.attempt=t.try=function(e){if("function"!=typeof e)return o("expecting a function but got "+a.classString(e));var r=new t(n);r._captureStackTrace(),r._pushContext();var u;if(arguments.length>1){i.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],c=arguments[2];u=a.isArray(l)?s(e).apply(c,l):s(e).call(c,l)}else u=s(e)();var f=r._popContext();return i.checkForgottenReturns(u,f,"Promise.try",r),r._resolveFromSyncValue(u),r},t.prototype._resolveFromSyncValue=function(e){e===a.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,n){function r(e){return e instanceof Error&&c.getPrototypeOf(e)===Error.prototype}function o(e){var t;if(r(e)){t=new l(e),t.name=e.name,t.message=e.message,t.stack=e.stack;for(var n=c.keys(e),o=0;o<n.length;++o){var i=n[o];f.test(i)||(t[i]=e[i])}return t}return a.markAsOriginatingFromRejection(e),e}function i(e,t){return function(n,r){if(null!==e){if(n){var i=o(s(n));e._attachExtraTrace(i),e._reject(i)}else if(t){var a=[].slice.call(arguments,1);e._fulfill(a)}else e._fulfill(r);e=null}}}var a=e("./util"),s=a.maybeWrapAsError,u=e("./errors"),l=u.OperationalError,c=e("./es5"),f=/^(?:name|message|stack|cause)$/;t.exports=i},{"./errors":12,"./es5":13,"./util":36}],21:[function(e,t,n){t.exports=function(t){function n(e,t){var n=this;if(!i.isArray(e))return r.call(n,e,t);var o=s(t).apply(n._boundValue(),[null].concat(e));o===u&&a.throwLater(o.e)}function r(e,t){var n=this,r=n._boundValue(),o=void 0===e?s(t).call(r,null):s(t).call(r,null,e);o===u&&a.throwLater(o.e)}function o(e,t){var n=this;if(!e){var r=new Error(e+"");r.cause=e,e=r}var o=s(t).call(n._boundValue(),e);o===u&&a.throwLater(o.e)}var i=e("./util"),a=t._async,s=i.tryCatch,u=i.errorObj;t.prototype.asCallback=t.prototype.nodeify=function(e,t){if("function"==typeof e){var i=r;void 0!==t&&Object(t).spread&&(i=n),this._then(i,o,void 0,this,e)}return this}}},{"./util":36}],22:[function(e,n,r){n.exports=function(){function r(){}function o(e,t){if(null==e||e.constructor!==i)throw new m("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof t)throw new m("expecting a function but got "+d.classString(t))}function i(e){e!==w&&o(this,e),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(e),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function a(e){this.promise._resolveCallback(e)}function s(e){this.promise._rejectCallback(e,!1)}function u(e){var t=new i(w);t._fulfillmentHandler0=e,t._rejectionHandler0=e,t._promise0=e,t._receiver0=e}var l,c=function(){return new m("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},f=function(){return new i.PromiseInspection(this._target())},h=function(e){return i.reject(new m(e))},p={},d=e("./util");l=d.isNode?function(){var e=t.domain;return void 0===e&&(e=null),e}:function(){return null},d.notEnumerableProp(i,"_getDomain",l);var y=e("./es5"),v=e("./async"),_=new v;y.defineProperty(i,"_async",{value:_});var g=e("./errors"),m=i.TypeError=g.TypeError;i.RangeError=g.RangeError;var b=i.CancellationError=g.CancellationError;i.TimeoutError=g.TimeoutError,i.OperationalError=g.OperationalError,i.RejectionError=g.OperationalError,i.AggregateError=g.AggregateError;var w=function(){},A={},E={},C=e("./thenables")(i,w),O=e("./promise_array")(i,w,C,h,r),k=e("./context")(i),P=k.create,S=e("./debuggability")(i,k),T=(S.CapturedTrace,e("./finally")(i,C,E)),x=e("./catch_filter")(E),j=e("./nodeback"),R=d.errorObj,U=d.tryCatch;return i.prototype.toString=function(){return"[object Promise]"},i.prototype.caught=i.prototype.catch=function(e){var t=arguments.length;if(t>1){var n,r=new Array(t-1),o=0;for(n=0;n<t-1;++n){var i=arguments[n];if(!d.isObject(i))return h("Catch statement predicate: expecting an object but got "+d.classString(i));r[o++]=i}return r.length=o,e=arguments[n],this.then(void 0,x(r,e,this))}return this.then(void 0,e)},i.prototype.reflect=function(){return this._then(f,f,void 0,this,void 0)},i.prototype.then=function(e,t){if(S.warnings()&&arguments.length>0&&"function"!=typeof e&&"function"!=typeof t){var n=".then() only accepts functions but was passed: "+d.classString(e);arguments.length>1&&(n+=", "+d.classString(t)),this._warn(n)}return this._then(e,t,void 0,void 0,void 0)},i.prototype.done=function(e,t){this._then(e,t,void 0,void 0,void 0)._setIsFinal()},i.prototype.spread=function(e){return"function"!=typeof e?h("expecting a function but got "+d.classString(e)):this.all()._then(e,void 0,void 0,A,void 0)},i.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new O(this).promise()},i.prototype.error=function(e){return this.caught(d.originatesFromRejection,e)},i.getNewLibraryCopy=n.exports,i.is=function(e){return e instanceof i},i.fromNode=i.fromCallback=function(e){var t=new i(w);t._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=U(e)(j(t,n));return r===R&&t._rejectCallback(r.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},i.all=function(e){return new O(e).promise()},i.cast=function(e){var t=C(e);return t instanceof i||(t=new i(w),t._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(e){var t=new i(w);return t._captureStackTrace(),t._rejectCallback(e,!0),t},i.setScheduler=function(e){if("function"!=typeof e)throw new m("expecting a function but got "+d.classString(e));return _.setScheduler(e)},i.prototype._then=function(e,t,n,r,o){var a=void 0!==o,s=a?o:new i(w),u=this._target(),c=u._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&c)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var f=l();if(0!=(50397184&c)){var h,p,y=u._settlePromiseCtx;0!=(33554432&c)?(p=u._rejectionHandler0,h=e):0!=(16777216&c)?(p=u._fulfillmentHandler0,h=t,u._unsetRejectionIsUnhandled()):(y=u._settlePromiseLateCancellationObserver,p=new b("late cancellation observer"),u._attachExtraTrace(p),h=t),_.invoke(y,u,{handler:null===f?h:"function"==typeof h&&d.domainBind(f,h),promise:s,receiver:r,value:p})}else u._addCallbacks(e,t,s,r,f);return s},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(e){this._bitField=-65536&this._bitField|65535&e},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(){_.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==p)return void 0===t&&this._isBound()?this._boundValue():t},i.prototype._promiseAt=function(e){return this[4*e-4+2]},i.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},i.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(e){var t=(e._bitField,e._fulfillmentHandler0),n=e._rejectionHandler0,r=e._promise0,o=e._receiverAt(0);void 0===o&&(o=p),this._addCallbacks(t,n,r,o,null)},i.prototype._migrateCallbackAt=function(e,t){var n=e._fulfillmentHandlerAt(t),r=e._rejectionHandlerAt(t),o=e._promiseAt(t),i=e._receiverAt(t);void 0===i&&(i=p),this._addCallbacks(n,r,o,i,null)},i.prototype._addCallbacks=function(e,t,n,r,o){var i=this._length();if(i>=65531&&(i=0,this._setLength(0)),0===i)this._promise0=n,this._receiver0=r,"function"==typeof e&&(this._fulfillmentHandler0=null===o?e:d.domainBind(o,e)),"function"==typeof t&&(this._rejectionHandler0=null===o?t:d.domainBind(o,t));else{var a=4*i-4;this[a+2]=n,this[a+3]=r,"function"==typeof e&&(this[a+0]=null===o?e:d.domainBind(o,e)),"function"==typeof t&&(this[a+1]=null===o?t:d.domainBind(o,t))}return this._setLength(i+1),i},i.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},i.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(c(),!1);var n=C(e,this);if(!(n instanceof i))return this._fulfill(e);t&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(c());var o=r._bitField;if(0==(50397184&o)){var a=this._length();a>0&&r._migrateCallback0(this);for(var s=1;s<a;++s)r._migrateCallbackAt(this,s);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 u=new b("late cancellation observer");r._attachExtraTrace(u),this._reject(u)}}},i.prototype._rejectCallback=function(e,t,n){var r=d.ensureErrorObject(e),o=r===e;if(!o&&!n&&S.warnings()){var i="a promise was rejected with a non-error: "+d.classString(e);this._warn(i,!0)}this._attachExtraTrace(r,!!t&&o),this._reject(e)},i.prototype._resolveFromExecutor=function(e){if(e!==w){var t=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(e,function(e){t._resolveCallback(e)},function(e){t._rejectCallback(e,n)});n=!1,this._popContext(),void