UNPKG

hive-js-dev

Version:

Steem.js the JavaScript API for Steem blockchain

2 lines 542 kB
!function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}(function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(typeof t[e]){case"function":break;case"object":t[e]=function(e){var r=e.slice(1),n=t[e[0]];return function(t,e,i){n.apply(this,[t,e,i].concat(r))}}(t[e]);break;default:t[e]=t[t[e]]}return t}([function(t,e,r){(function(n){"use strict";var i=r(1),o=r(242),s=r(243),a=r(244),u=r(42),f=r(246)(i),c=r(97),l={api:i,auth:o,memo:s,broadcast:a,config:u,formatter:f,utils:c};"undefined"!=typeof window&&(window.steem=l),"undefined"!=typeof n&&(n.steem=l),e=t.exports=l}).call(e,function(){return this}())},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),f=r(2),c=n(f),l=r(3),h=n(l),p=r(42),d=n(p),y=r(83),v=n(y),_=r(84),m=n(_),g=r(85),b=r(97),w=r(98),E=r(195),S=r(206),k=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var r=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r._setTransport(t),r._setLogger(t),r.options=t,r.seqNo=0,r.error_count=0,r.api_index=0,r.error_threshold=5,r.alternative_api_endpoints=["https://api.hive.blog","https://anyx.io"],v.default.forEach(function(t){var e=t.method_name||(0,b.camelCase)(t.method),n=t.params||[];r[e+"With"]=function(e,i){return r.send(t.api,{method:t.method,params:n.map(function(t){return e[t]})},i)},r[e]=function(){for(var t=arguments.length,i=Array(t),o=0;o<t;o++)i[o]=arguments[o];var s=n.reduce(function(t,e,r){return t[e]=i[r],t},{}),a=i[n.length];return r[e+"With"](s,a)},r[e+"WithAsync"]=h.default.promisify(r[e+"With"]),r[e+"Async"]=h.default.promisify(r[e])}),r.callAsync=h.default.promisify(r.call),r.signedCallAsync=h.default.promisify(r.signedCall),console.log("Alternate endpoitns: ",r.options.alternative_api_endpoints),console.log("Error Failover Threshold: ",r.options.failover_threshold),r.notifyError=r.notifyError.bind(r),r}return s(e,t),u(e,[{key:"_setTransport",value:function(t){if(t.url&&t.url.match("^((http|https)?://)"))t.uri=t.url,t.transport="http",this._transportType=t.transport,this.options=t,this.transport=new m.default.http(t);else if(t.url&&t.url.match("^((ws|wss)?://)"))t.websocket=t.url,t.transport="ws",this._transportType=t.transport,this.options=t,this.transport=new m.default.ws(t);else if(t.transport)if(this.transport&&this._transportType!==t.transport&&this.transport.stop(),this._transportType=t.transport,"string"==typeof t.transport){if(!m.default[t.transport])throw new TypeError("Invalid `transport`, valid values are `http`, `ws` or a class");this.transport=new m.default[t.transport](t)}else this.transport=new t.transport(t);else this.transport=new m.default.ws(t)}},{key:"_setLogger",value:function(t){if(t.hasOwnProperty("logger"))switch(a(t.logger)){case"function":this.__logger={log:t.logger};break;case"object":if("function"!=typeof t.logger.log)throw new Error("setOptions({logger:{}}) must have a property .log of type function");this.__logger=t.logger;break;case"undefined":if(this.__logger)break;default:this.__logger=!1}}},{key:"log",value:function(t){if(this.__logger)if(arguments.length>1&&"function"==typeof this.__logger[t]){var e=Array.prototype.slice.call(arguments,1);this.__logger[t].apply(this.__logger,e)}else this.__logger.log.apply(this.__logger,arguments)}},{key:"start",value:function(){return this.transport.start()}},{key:"stop",value:function(){return this.transport.stop()}},{key:"send",value:function(t,e,r){var n=r;if(this.__logger){var i=Math.random(),o=this;this.log("xmit:"+i+":",e),n=function(t,e){t?o.log("error","rsp:"+i+":\n\n",t,e):o.log("rsp:"+i+":",e),r&&r.apply(o,arguments)}}return this.transport.send(t,e,n)}},{key:"call",value:function(t,e,r){var n=this;if("http"!==this._transportType)return void r(new Error("RPC methods can only be called when using http transport"));var i=++this.seqNo;(0,g.jsonRpc)(this.options.uri,{method:t,params:e,id:i}).then(function(t){r(null,t)},function(t){n.notifyError(t,t instanceof g.RPCError),r(t)})}},{key:"signedCall",value:function(t,e,r,n,i){var o=this;if("http"!==this._transportType)return void i(new Error("RPC methods can only be called when using http transport"));var s=++this.seqNo,a=void 0;try{a=(0,S.sign)({method:t,params:e,id:s},r,[n])}catch(t){return void i(t)}(0,g.jsonRpc)(this.options.uri,a).then(function(t){i(null,t)},function(t){i(t),o.notifyError(t)})}},{key:"setOptions",value:function(t){if(Object.assign(this.options,t),t.hasOwnProperty("failover_threshold")&&(this.failover_threshold=t.failover_threshold),t.hasOwnProperty("alternative_api_endpoints")&&(this.alternative_api_endpoints=t.alternative_api_endpoints),this._setLogger(t),this._setTransport(t),this.transport.setOptions(t),t.hasOwnProperty("useTestNet")&&d.default.set("address_prefix",t.useTestNet?"TST":"STM"),t.hasOwnProperty("url")){for(var e=0,r=0;r<this.alternative_api_endpoints.length;r++){var n=this.alternative_api_endpoints[r];if(n===t.url){e=r;break}}this.api_index=e;this.alternative_api_endpoints[this.api_index]}}},{key:"setWebSocket",value:function(t){this.setOptions({websocket:t})}},{key:"setUri",value:function(t){this.setOptions({uri:t})}},{key:"streamBlockNumber",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"head",e=this,r=arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;"function"==typeof t&&(r=t,t="head");var i="",o=!0,s=function s(){o&&e.getDynamicGlobalPropertiesAsync().then(function(e){var o="irreversible"===t?e.last_irreversible_block_num:e.head_block_number;if(o!==i)if(i)for(var a=i;a<o;a++)a!==i&&r(null,a),i=a;else i=o,r(null,o);h.default.delay(n).then(function(){s()})},function(t){r(t)})};return s(),function(){o=!1}}},{key:"streamBlock",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"head",r=arguments[1];"function"==typeof e&&(r=e,e="head");var n="",i="",o=this.streamBlockNumber(e,function(e,s){return e?(o(),void r(e)):(n=s,void(n!==i&&(i=n,t.getBlock(n,r))))});return o}},{key:"streamTransactions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"head",e=arguments[1];"function"==typeof t&&(e=t,t="head");var r=this.streamBlock(t,function(t,n){return t?(r(),void e(t)):void(n&&n.transactions&&n.transactions.forEach(function(t){e(null,t)}))});return r}},{key:"streamOperations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"head",e=arguments[1];"function"==typeof t&&(e=t,t="head");var r=this.streamTransactions(t,function(t,n){return t?(r(),void e(t)):void n.operations.forEach(function(t){e(null,t)})});return r}},{key:"broadcastTransactionSynchronousWith",value:function(t,e){var r=t.trx;return this.send("network_broadcast_api",{method:"broadcast_transaction_synchronous",params:[r]},function(t,n){if(t){var i=E.ops.signed_transaction,o=i.toObject(r),s=i.toBuffer(r);t.digest=w.hash.sha256(s).toString("hex"),t.transaction_id=s.toString("hex"),t.transaction=JSON.stringify(o),e(t,"")}else e("",n)})}},{key:"notifyError",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e&&void 0!==this.failover_threshold&&void 0!==this.alternative_api_endpoints){if(t&&t.toString().includes("overseer"))return void console.log("ignoring an overseer error, as this doesn't exist in hive");if(this.error_count++,this.error_count>=this.failover_threshold){var r=this.options.url;this.error_count=0,this.api_index++,this.api_index>=this.alternative_api_endpoints.length&&(this.api_index=0);var n=this.alternative_api_endpoints[this.api_index];console.log("failing over. old endpoint was: ",r," new one is: ",n),this.setOptions({url:n})}}}}]),e}(c.default),B=new k(d.default);e=t.exports=B,e.Steem=k},function(t,e){"use strict";function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function i(t){return"number"==typeof t}function o(t){return"object"===("undefined"==typeof t?"undefined":a(t))&&null!==t}function s(t){return void 0===t}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!i(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,i,a,u,f;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(r=this._events[t],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(o(r))for(a=Array.prototype.slice.call(arguments,1),f=r.slice(),i=f.length,u=0;u<i;u++)f[u].apply(this,a);return!0},r.prototype.addListener=function(t,e){var i;if(!n(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,i,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,i=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],n(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){"use strict";function n(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=r(4)();o.noConflict=n,t.exports=o},function(t,e,r){(function(e){"use strict";t.exports=function(){function n(){}function i(t,e){if(null==t||t.constructor!==o)throw new T("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new T("expecting a function but got "+p.classString(e))}function o(t){t!==A&&i(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function s(t){this.promise._resolveCallback(t)}function a(t){this.promise._rejectCallback(t,!1)}function u(t){var e=new o(A);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}var f=function(){return new T("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},c=function(){return new o.PromiseInspection(this._target())},l=function(t){return o.reject(new T(t))},h={},p=r(6);p.setReflectHandler(c);var d=function(){var t=e.domain;return void 0===t?null:t},y=function(){return null},v=function(){return{domain:d(),async:null}},_=p.isNode&&p.nodeSupportsAsyncResource?r(!function(){var t=new Error('Cannot find module "async_hooks"');throw t.code="MODULE_NOT_FOUND",t}()).AsyncResource:null,m=function(){return{domain:d(),async:new _("Bluebird::Promise")}},g=p.isNode?v:y;p.notEnumerableProp(o,"_getContext",g);var b=function(){g=m,p.notEnumerableProp(o,"_getContext",m)},w=function(){g=v,p.notEnumerableProp(o,"_getContext",v)},E=r(7),S=r(8),k=new S;E.defineProperty(o,"_async",{value:k});var B=r(13),T=o.TypeError=B.TypeError;o.RangeError=B.RangeError;var x=o.CancellationError=B.CancellationError;o.TimeoutError=B.TimeoutError,o.OperationalError=B.OperationalError,o.RejectionError=B.OperationalError,o.AggregateError=B.AggregateError;var A=function(){},I={},O={},j=r(14)(o,A),C=r(15)(o,A,j,l,n),R=r(16)(o),U=R.create,F=r(17)(o,R,b,w),P=(F.CapturedTrace,r(18)(o,j,O)),L=r(19)(O),M=r(20),D=p.errorObj,N=p.tryCatch;return o.prototype.toString=function(){return"[object Promise]"},o.prototype.caught=o.prototype.catch=function(t){var e=arguments.length;if(e>1){var r,n=new Array(e-1),i=0;for(r=0;r<e-1;++r){var o=arguments[r];if(!p.isObject(o))return l("Catch statement predicate: expecting an object but got "+p.classString(o));n[i++]=o}if(n.length=i,t=arguments[r],"function"!=typeof t)throw new T("The last argument to .catch() must be a function, got "+p.toString(t));return this.then(void 0,L(n,t,this))}return this.then(void 0,t)},o.prototype.reflect=function(){return this._then(c,c,void 0,this,void 0)},o.prototype.then=function(t,e){if(F.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var r=".then() only accepts functions but was passed: "+p.classString(t);arguments.length>1&&(r+=", "+p.classString(e)),this._warn(r)}return this._then(t,e,void 0,void 0,void 0)},o.prototype.done=function(t,e){var r=this._then(t,e,void 0,void 0,void 0);r._setIsFinal()},o.prototype.spread=function(t){return"function"!=typeof t?l("expecting a function but got "+p.classString(t)):this.all()._then(t,void 0,void 0,I,void 0)},o.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},o.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new C(this).promise()},o.prototype.error=function(t){return this.caught(p.originatesFromRejection,t)},o.getNewLibraryCopy=t.exports,o.is=function(t){return t instanceof o},o.fromNode=o.fromCallback=function(t){var e=new o(A);e._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=N(t)(M(e,r));return n===D&&e._rejectCallback(n.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},o.all=function(t){return new C(t).promise()},o.cast=function(t){var e=j(t);return e instanceof o||(e=new o(A),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},o.resolve=o.fulfilled=o.cast,o.reject=o.rejected=function(t){var e=new o(A);return e._captureStackTrace(),e._rejectCallback(t,!0),e},o.setScheduler=function(t){if("function"!=typeof t)throw new T("expecting a function but got "+p.classString(t));return k.setScheduler(t)},o.prototype._then=function(t,e,r,n,i){var s=void 0!==i,a=s?i:new o(A),u=this._target(),f=u._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===n&&0!==(2097152&this._bitField)&&(n=0!==(50397184&f)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var c=g();if(0!==(50397184&f)){var l,h,d=u._settlePromiseCtx;0!==(33554432&f)?(h=u._rejectionHandler0,l=t):0!==(16777216&f)?(h=u._fulfillmentHandler0,l=e,u._unsetRejectionIsUnhandled()):(d=u._settlePromiseLateCancellationObserver,h=new x("late cancellation observer"),u._attachExtraTrace(h),l=e),k.invoke(d,u,{handler:p.contextBind(c,l),promise:a,receiver:n,value:h})}else u._addCallbacks(t,e,a,n,c);return a},o.prototype._length=function(){return 65535&this._bitField},o.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},o.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},o.prototype._setLength=function(t){this._bitField=this._bitField&-65536|65535&t},o.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},o.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},o.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},o.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},o.prototype._isFinal=function(){return(4194304&this._bitField)>0},o.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},o.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},o.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},o.prototype._setAsyncGuaranteed=function(){if(!k.hasCustomScheduler()){var t=this._bitField;this._bitField=t|(536870912&t)>>2^134217728}},o.prototype._setNoAsyncGuarantee=function(){this._bitField=(536870912|this._bitField)&-134217729},o.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==h)return void 0===e&&this._isBound()?this._boundValue():e},o.prototype._promiseAt=function(t){return this[4*t-4+2]},o.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},o.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},o.prototype._boundValue=function(){},o.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),r=t._rejectionHandler0,n=t._promise0,i=t._receiverAt(0);void 0===i&&(i=h),this._addCallbacks(e,r,n,i,null)},o.prototype._migrateCallbackAt=function(t,e){var r=t._fulfillmentHandlerAt(e),n=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=h),this._addCallbacks(r,n,i,o,null)},o.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=r,this._receiver0=n,"function"==typeof t&&(this._fulfillmentHandler0=p.contextBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=p.contextBind(i,e));else{var s=4*o-4;this[s+2]=r,this[s+3]=n,"function"==typeof t&&(this[s+0]=p.contextBind(i,t)),"function"==typeof e&&(this[s+1]=p.contextBind(i,e))}return this._setLength(o+1),o},o.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},o.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(f(),!1);var r=j(t,this);if(!(r instanceof o))return this._fulfill(t);e&&this._propagateFrom(r,2);var n=r._target();if(n===this)return void this._reject(f());var i=n._bitField;if(0===(50397184&i)){var s=this._length();s>0&&n._migrateCallback0(this);for(var a=1;a<s;++a)n._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!==(33554432&i))this._fulfill(n._value());else if(0!==(16777216&i))this._reject(n._reason());else{var u=new x("late cancellation observer");n._attachExtraTrace(u),this._reject(u)}}},o.prototype._rejectCallback=function(t,e,r){var n=p.ensureErrorObject(t),i=n===t;if(!i&&!r&&F.warnings()){var o="a promise was rejected with a non-error: "+p.classString(t);this._warn(o,!0)}this._attachExtraTrace(n,!!e&&i),this._reject(t)},o.prototype._resolveFromExecutor=function(t){if(t!==A){var e=this;this._captureStackTrace(),this._pushContext();var r=!0,n=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,r)});r=!1,this._popContext(),void 0!==n&&e._rejectCallback(n,!0)}},o.prototype._settlePromiseFromHandler=function(t,e,r,n){var i=n._bitField;if(0===(65536&i)){n._pushContext();var o;e===I?r&&"number"==typeof r.length?o=N(t).apply(this._boundValue(),r):(o=D,o.e=new T("cannot .spread() a non-array: "+p.classString(r))):o=N(t).call(e,r);var s=n._popContext();i=n._bitField,0===(65536&i)&&(o===O?n._reject(r):o===D?n._rejectCallback(o.e,!1):(F.checkForgottenReturns(o,s,"",n,this),n._resolveCallback(o)))}},o.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},o.prototype._followee=function(){return this._rejectionHandler0},o.prototype._setFollowee=function(t){this._rejectionHandler0=t},o.prototype._settlePromise=function(t,e,r,i){var s=t instanceof o,a=this._bitField,u=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeInternalOnCancel(),r instanceof P&&r.isFinallyHandler()?(r.cancelPromise=t,N(e).call(r,i)===D&&t._reject(D.e)):e===c?t._fulfill(c.call(r)):r instanceof n?r._promiseCancelled(t):s||t instanceof C?t._cancel():r.cancel()):"function"==typeof e?s?(u&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,i,t)):e.call(r,i,t):r instanceof n?r._isResolved()||(0!==(33554432&a)?r._promiseFulfilled(i,t):r._promiseRejected(i,t)):s&&(u&&t._setAsyncGuaranteed(),0!==(33554432&a)?t._fulfill(i):t._reject(i))},o.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,r=t.promise,n=t.receiver,i=t.value;"function"==typeof e?r instanceof o?this._settlePromiseFromHandler(e,n,i,r):e.call(n,i,r):r instanceof o&&r._reject(i)},o.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},o.prototype._settlePromise0=function(t,e,r){var n=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(n,t,i,e)},o.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},o.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var r=f();return this._attachExtraTrace(r),this._reject(r)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():k.settlePromises(this),this._dereferenceTrace())}},o.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?k.fatalError(t,p.isNode):void((65535&e)>0?k.settlePromises(this):this._ensurePossibleRejectionHandled())},o.prototype._fulfillPromises=function(t,e){for(var r=1;r<t;r++){var n=this._fulfillmentHandlerAt(r),i=this._promiseAt(r),o=this._receiverAt(r);this._clearCallbackDataAtIndex(r),this._settlePromise(i,n,o,e)}},o.prototype._rejectPromises=function(t,e){for(var r=1;r<t;r++){var n=this._rejectionHandlerAt(r),i=this._promiseAt(r),o=this._receiverAt(r);this._clearCallbackDataAtIndex(r),this._settlePromise(i,n,o,e)}},o.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,t),this._rejectPromises(e,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,t),this._fulfillPromises(e,n)}this._setLength(0)}this._clearCancellationData()},o.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},"undefined"!=typeof Symbol&&Symbol.toStringTag&&E.defineProperty(o.prototype,Symbol.toStringTag,{get:function(){return"Object"}}),o.defer=o.pending=function(){F.deprecated("Promise.defer","new Promise");var t=new o(A);return{promise:t,resolve:s,reject:a}},p.notEnumerableProp(o,"_makeSelfResolutionError",f),r(21)(o,A,j,l,F),r(22)(o,A,j,F),r(23)(o,C,l,F),r(24)(o),r(25)(o),r(26)(o,C,j,A,k),o.Promise=o,o.version="3.7.2",r(27)(o),r(28)(o,l,A,j,n,F),r(29)(o,C,l,j,A,F),r(30)(o),r(31)(o,A),r(32)(o,C,j,l),r(33)(o,A,j,l),r(34)(o,C,l,j,A,F),r(35)(o,C,F),r(36)(o,C,l),r(37)(o,A,F),r(38)(o,l,j,U,A,F),r(39)(o),r(40)(o,A),r(41)(o,A),p.toFastProperties(o),p.toFastProperties(o.prototype),u({a:1}),u({b:2}),u({c:3}),u(1),u(function(){}),u(void 0),u(!1),u(new o(A)),F.setBounds(S.firstLineError,p.lastLineError),o}}).call(e,r(5))},function(t,e){"use strict";function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(t){if(c===setTimeout)return setTimeout(t,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function o(t){if(l===clearTimeout)return clearTimeout(t);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function s(){y&&p&&(y=!1,p.length?d=p.concat(d):v=-1,d.length&&a())}function a(){if(!y){var t=i(s);y=!0;for(var e=d.length;e;){for(p=d,d=[];++v<e;)p&&p[v].run();v=-1,e=d.length}p=null,y=!1,o(t)}}function u(t,e){this.fun=t,this.array=e}function f(){}var c,l,h=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(t){c=r}try{l="function"==typeof clearTimeout?clearTimeout:n}catch(t){l=n}}();var p,d=[],y=!1,v=-1;h.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];d.push(new u(t,e)),1!==d.length||y||i(a)},u.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.prependListener=f,h.prependOnceListener=f,h.listeners=function(t){return[]},h.binding=function(t){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(t){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(t,e,r){(function(e,n){"use strict";function i(){try{var t=j;return j=null,t.apply(this,arguments)}catch(t){return O.e=t,O}}function o(t){return j=t,i}function s(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function a(t){return"function"==typeof t||"object"===("undefined"==typeof t?"undefined":x(t))&&null!==t}function u(t){return s(t)?new Error(_(t)):t}function f(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;r<n;++r)i[r]=t[r];return i[r]=e,i}function c(t,e,r){if(!A.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var n=Object.getOwnPropertyDescriptor(t,e);return null!=n?null==n.get&&null==n.set?n.value:r:void 0}function l(t,e,r){if(s(t))return t;var n={value:r,configurable:!0,enumerable:!1,writable:!0};return A.defineProperty(t,e,n),t}function h(t){throw t}function p(t){try{if("function"==typeof t){var e=A.names(t.prototype),r=A.isES5&&e.length>1,n=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=F.test(t+"")&&A.names(t).length>0;if(r||n||i)return!0}return!1}catch(t){return!1}}function d(t){function e(){}function r(){return x(n.foo)}e.prototype=t;var n=new e;return r(),r(),t}function y(t){return P.test(t)}function v(t,e,r){for(var n=new Array(t),i=0;i<t;++i)n[i]=e+i+r;return n}function _(t){try{return t+""}catch(t){return"[no string representation]"}}function m(t){return t instanceof Error||null!==t&&"object"===("undefined"==typeof t?"undefined":x(t))&&"string"==typeof t.message&&"string"==typeof t.name}function g(t){try{l(t,"isOperational",!0)}catch(t){}}function b(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0)}function w(t){return m(t)&&A.propertyIsWritable(t,"stack")}function E(t){return{}.toString.call(t)}function S(t,e,r){for(var n=A.names(t),i=0;i<n.length;++i){var o=n[i];if(r(o))try{A.defineProperty(e,o,A.getDescriptor(t,o))}catch(t){}}}function k(t){return q?n.env[t]:void 0}function B(){if("function"==typeof Promise)try{var t=new Promise(function(){});if("[object Promise]"===E(t))return Promise}catch(t){}}function T(t,e){if(null===t||"function"!=typeof e||e===z)return e;null!==t.domain&&(e=t.domain.bind(e));var r=t.async;if(null!==r){var n=e;e=function(){for(var t=arguments.length+2,e=new Array(t),i=2;i<t;++i)e[i]=arguments[i-2];return e[0]=n,e[1]=this,r.runInAsyncScope.apply(r,e)}}return e}var x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A=r(7),I="undefined"==typeof navigator,O={e:{}},j,C="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof e?e:null,R=function(t,e){function r(){this.constructor=t,this.constructor$=e;for(var r in e.prototype)n.call(e.prototype,r)&&"$"!==r.charAt(r.length-1)&&(this[r+"$"]=e.prototype[r])}var n={}.hasOwnProperty;return r.prototype=e.prototype,t.prototype=new r,t.prototype},U=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var r=0;r<t.length;++r)if(t[r]===e)return!0;return!1};if(A.isES5){var r=Object.getOwnPropertyNames;return function(t){for(var n=[],i=Object.create(null);null!=t&&!e(t);){var o;try{o=r(t)}catch(t){return n}for(var s=0;s<o.length;++s){var a=o[s];if(!i[a]){i[a]=!0;var u=Object.getOwnPropertyDescriptor(t,a);null!=u&&null==u.get&&null==u.set&&n.push(a)}}t=A.getPrototypeOf(t)}return n}}var n={}.hasOwnProperty;return function(r){if(e(r))return[];var i=[];t:for(var o in r)if(n.call(r,o))i.push(o);else{for(var s=0;s<t.length;++s)if(n.call(t[s],o))continue t;i.push(o)}return i}}(),F=/this\s*\.\s*\S+\s*=/,P=/^[a-z$_][a-z$_0-9]*$/i,L=function(){return"stack"in new Error?function(t){return w(t)?t:new Error(_(t))}:function(t){if(w(t))return t;try{throw new Error(_(t))}catch(t){return t}}}(),M=function(t){return A.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var D="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,r=[],n=t[Symbol.iterator]();!(e=n.next()).done;)r.push(e.value);return r};M=function(t){return A.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?D(t):null}}var N="undefined"!=typeof n&&"[object process]"===E(n).toLowerCase(),q="undefined"!=typeof n&&"undefined"!=typeof n.env,z,V={setReflectHandler:function(t){ z=t},isClass:p,isIdentifier:y,inheritedDataKeys:U,getDataPropertyOrDefault:c,thrower:h,isArray:A.isArray,asArray:M,notEnumerableProp:l,isPrimitive:s,isObject:a,isError:m,canEvaluate:I,errorObj:O,tryCatch:o,inherits:R,withAppended:f,maybeWrapAsError:u,toFastProperties:d,filledRange:v,toString:_,canAttachTrace:w,ensureErrorObject:L,originatesFromRejection:b,markAsOriginatingFromRejection:g,classString:E,copyDescriptors:S,isNode:N,hasEnvVariables:q,env:k,global:C,getNativePromise:B,contextBind:T};V.isRecentNode=V.isNode&&function(){var t;return n.versions&&n.versions.node?t=n.versions.node.split(".").map(Number):n.version&&(t=n.version.split(".").map(Number)),0===t[0]&&t[1]>10||t[0]>0}(),V.nodeSupportsAsyncResource=V.isNode&&function(){var t=!1;try{var e=r(!function(){var t=new Error('Cannot find module "async_hooks"');throw t.code="MODULE_NOT_FOUND",t}()).AsyncResource;t="function"==typeof e.prototype.runInAsyncScope}catch(e){t=!1}return t}(),V.isNode&&V.toFastProperties(n);try{throw new Error}catch(t){V.lastLineError=t}t.exports=V}).call(e,function(){return this}(),r(5))},function(t,e){"use strict";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(t,e){var r=Object.getOwnPropertyDescriptor(t,e);return!(r&&!r.writable&&!r.set)}};else{var n={}.hasOwnProperty,i={}.toString,o={}.constructor.prototype,s=function(t){var e=[];for(var r in t)n.call(t,r)&&e.push(r);return e},a=function(t,e){return{value:t[e]}},u=function(t,e,r){return t[e]=r.value,t},f=function(t){return t},c=function(t){try{return Object(t).constructor.prototype}catch(t){return o}},l=function(t){try{return"[object Array]"===i.call(t)}catch(t){return!1}};t.exports={isArray:l,keys:s,names:s,defineProperty:u,getDescriptor:a,freeze:f,getPrototypeOf:c,isES5:r,propertyIsWritable:function(){return!0}}}},function(t,e,r){(function(e){"use strict";function n(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new l(16),this._normalQueue=new l(16),this._haveDrainedQueues=!1;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=c}function i(t,e,r){this._lateQueue.push(t,e,r),this._queueTick()}function o(t,e,r){this._normalQueue.push(t,e,r),this._queueTick()}function s(t){this._normalQueue._pushOne(t),this._queueTick()}function a(t){for(;t.length()>0;)u(t)}function u(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var r=t.shift(),n=t.shift();e.call(r,n)}}var f;try{throw new Error}catch(t){f=t}var c=r(9),l=r(12);n.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},n.prototype.hasCustomScheduler=function(){return this._customScheduler},n.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},n.prototype.fatalError=function(t,r){r?(e.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),e.exit(2)):this.throwLater(t)},n.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},n.prototype.invokeLater=i,n.prototype.invoke=o,n.prototype.settlePromises=s,n.prototype._drainQueues=function(){a(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,a(this._lateQueue)},n.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},n.prototype._reset=function(){this._isTickUsed=!1},t.exports=n,t.exports.firstLineError=f}).call(e,r(5))},function(t,e,r){(function(e,n,i){"use strict";var o,s=r(6),a=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},u=s.getNativePromise();if(s.isNode&&"undefined"==typeof MutationObserver){var f=e.setImmediate,c=n.nextTick;o=s.isRecentNode?function(t){f.call(e,t)}:function(t){c.call(n,t)}}else if("function"==typeof u&&"function"==typeof u.resolve){var l=u.resolve();o=function(t){l.then(t)}}else o="undefined"!=typeof MutationObserver&&("undefined"==typeof window||!window.navigator||!window.navigator.standalone&&!window.cordova)&&"classList"in document.documentElement?function(){var t=document.createElement("div"),e={attributes:!0},r=!1,n=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),r=!1});i.observe(n,e);var o=function(){r||(r=!0,n.classList.toggle("foo"))};return function(r){var n=new MutationObserver(function(){n.disconnect(),r()});n.observe(t,e),o()}}():"undefined"!=typeof i?function(t){i(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:a;t.exports=o}).call(e,function(){return this}(),r(5),r(10).setImmediate)},function(t,e,r){(function(t){"use strict";function n(t,e){this._id=t,this._clearFn=e}var i="undefined"!=typeof t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;e.setTimeout=function(){return new n(o.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new n(o.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r(11),e.setImmediate="undefined"!=typeof self&&self.setImmediate||"undefined"!=typeof t&&t.setImmediate||void 0,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||"undefined"!=typeof t&&t.clearImmediate||void 0}).call(e,function(){return this}())},function(t,e,r){(function(t,e){"use strict";!function(t,r){function n(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var n={callback:t,args:e};return y[d]=n,p(d),d++}function i(t){delete y[t]}function o(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(r,n)}}function s(t){if(v)setTimeout(s,0,t);else{var e=y[t];if(e){v=!0;try{o(e)}finally{i(t),v=!1}}}}function a(){p=function(t){e.nextTick(function(){s(t)})}}function u(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}function f(){var e="setImmediate$"+Math.random()+"$",r=function(r){r.source===t&&"string"==typeof r.data&&0===r.data.indexOf(e)&&s(+r.data.slice(e.length))};t.addEventListener?t.addEventListener("message",r,!1):t.attachEvent("onmessage",r),p=function(r){t.postMessage(e+r,"*")}}function c(){var t=new MessageChannel;t.port1.onmessage=function(t){var e=t.data;s(e)},p=function(e){t.port2.postMessage(e)}}function l(){var t=_.documentElement;p=function(e){var r=_.createElement("script");r.onreadystatechange=function(){s(e),r.onreadystatechange=null,t.removeChild(r),r=null},t.appendChild(r)}}function h(){p=function(t){setTimeout(s,0,t)}}if(!t.setImmediate){var p,d=1,y={},v=!1,_=t.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(t);m=m&&m.setTimeout?m:t,"[object process]"==={}.toString.call(t.process)?a():u()?f():t.MessageChannel?c():_&&"onreadystatechange"in _.createElement("script")?l():h(),m.setImmediate=n,m.clearImmediate=i}}("undefined"==typeof self?"undefined"==typeof t?void 0:t:self)}).call(e,function(){return this}(),r(5))},function(t,e){"use strict";function r(t,e,r,n,i){for(var o=0;o<i;++o)r[o+n]=t[o+e],t[o+e]=void 0}function n(t){this._capacity=t,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(t){return this._capacity<t},n.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1);var r=this._front+e&this._capacity-1;this[r]=t,this._length=e+1},n.prototype.push=function(t,e,r){var n=this.length()+3;if(this._willBeOverCapacity(n))return this._pushOne(t),this._pushOne(e),void this._pushOne(r);var i=this._front+n-3;this._checkCapacity(n);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=r,this._length=n},n.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},n.prototype.length=function(){return this._length},n.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},n.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t;var n=this._front,i=this._length,o=n+i&e-1;r(this,0,this,e,o)},t.exports=n},function(t,e,r){"use strict";function n(t,e){function r(n){return this instanceof r?(l(this,"message","string"==typeof n?n:e),l(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new r(n)}return c(r,Error),r}function i(t){return this instanceof i?(l(this,"name","OperationalError"),l(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(l(this,"message",t.message),l(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,s,a=r(7),u=a.freeze,f=r(6),c=f.inherits,l=f.notEnumerableProp,h=n("Warning","warning"),p=n("CancellationError","cancellation error"),d=n("TimeoutError","timeout error"),y=n("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(t){o=n("TypeError","type error"),s=n("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[_]]);a.defineProperty(y.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),y.prototype.isOperational=!0;var m=0;y.prototype.toString=function(){var t=Array(4*m+1).join(" "),e="\n"+t+"AggregateError of:\n";m++,t=Array(4*m+1).join(" ");for(var r=0;r<this.length;++r){for(var n=this[r]===this?"[Circular AggregateError]":this[r]+"",i=n.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];n=i.join("\n"),e+=n+"\n"}return m--,e},c(i,Error);var g=Error.__BluebirdErrorTypes__;g||(g=u({CancellationError:p,TimeoutError:d,OperationalError:i,RejectionError:i,AggregateError:y}),a.defineProperty(Error,"__BluebirdErrorTypes__",{value:g,writable:!1,enumerable:!1,configurable:!1})),t.exports={Error:Error,TypeError:o,RangeError:s,CancellationError:g.CancellationError,OperationalError:g.OperationalError,TimeoutError:g.TimeoutError,AggregateError:g.AggregateError,Warning:h}},function(t,e,r){"use strict";t.exports=function(t,e){function n(r,n){if(c(r)){if(r instanceof t)return r;var i=o(r);if(i===f){n&&n._pushContext();var u=t.reject(i.e);return n&&n._popContext(),u}if("function"==typeof i){if(s(r)){var u=new t(e);return r._then(u._fulfill,u._reject,void 0,u,null),u}return a(r,i,n)}}return r}function i(t){return t.then}function o(t){try{return i(t)}catch(t){return f.e=t,f}}function s(t){try{return l.call(t,"_promise0")}catch(t){return!1}}function a(r,n,i){function o(t){a&&(a._resolveCallback(t),a=null)}function s(t){a&&(a._rejectCallback(t,l,!0),a=null)}var a=new t(e),c=a;i&&i._pushContext(),a._captureStackTrace(),i&&i._popContext();var l=!0,h=u.tryCatch(n).call(r,o,s);return l=!1,a&&h===f&&(a._rejectCallback(h.e,!0,!0),a=null),c}var u=r(6),f=u.errorObj,c=u.isObject,l={}.hasOwnProperty;return n}},function(t,e,r){"use strict";t.exports=function(t,e,n,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function a(r){var n=this._promise=new t(e);r instanceof t&&(n._propagateFrom(r,3),r.suppressUnhandledRejections()),n._setOnCancel(this),this._values=r,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var u=r(6);u.isArray;return u.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function e(r,o){var a=n(this._values,this._promise);if(a instanceof t){a=a._target();var f=a._bitField;if(this._values=a,0===(50397184&f))return this._promise._setAsyncGuaranteed(),a._then(e,this._reject,void 0,this,o);if(0===(33554432&f))return 0!==(16777216&f)?this._reject(a._reason()):this._cancel();a=a._value()}if(a=u.asArray(a),null===a){var c=i("expecting an array or an iterable object but got "+u.classString(a)).reason();return void this._promise._rejectCallback(c,!1)}return 0===a.length?void(o===-5?this._resolveEmptyArray():this._resolve(s(o))):void this._iterate(a)},a.prototype._iterate=function(e){var r=this.getActualLength(e.length);this._length=r,this._values=this.shouldCopyValues()?new Array(r):this._values;for(var i=this._promise,o=!1,s=null,a=0;a<r;++a){var u=n(e[a],i);u instanceof t?(u=u._target(),s=u._bitField):s=null,o?null!==s&&u.suppressUnhandledRejections():null!==s?0===(50397184&s)?(u._proxy(this,a),this._values[a]=u):o=0!==(33554432&s)?this._promiseFulfilled(u._value(),a):0!==(16777216&s)?this._promiseRejected(u._reason(),a):this._promiseCancelled(a):o=this._promiseFulfilled(u,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 r=++this._totalResolved;return r>=this._length&&(this._resolve(this._values),!0)},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 e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var r=0;r<e.length;++r)e[r]instanceof t&&e[r].cancel()}},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(t){return t},a}},function(t,e){"use strict";t.exports=function(t){function e(){this._trace=new e.CapturedTrace(n())}function r(){if(i)return new e}function n(){var t=o.length-1;if(t>=0)return o[t]}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=r,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var r=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,u=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=r,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=u,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=n,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},function(t,e,r){(function(e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t,i,o,s){function a(t,e){return{promise:e}}function u(){return!1}function f(t,e,r){var n=this;try{t(e,r,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+V.toString(t));n._attachCancellationCallback(t)})}catch(t){return t}}function c(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?V.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function l(){return this._onCancelField}function h(t){this._onCancelField=t}function p(){this._cancellationParent=void 0,this._onCancelField=void 0}function d(t,e){if(0!==(1&e)){this._cancellationParent=t;var r=t._branchesRemainingToCancel;void 0===r&&(r=0),t._branchesRemainingToCancel=r+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function y(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function v(){var e=this._boundTo;return void 0!==e&&e instanceof t?e.isFulfilled()?e.value():void 0:e}function _(){this._trace=new P(this._peekContext())}function m(t,e){if(K(t)){var r=this._trace;if(void 0!==r&&e&&(r=r._parent),void 0!==r)r.attachExtraTrace(t);else if(!t.__stackCleaned__){var n=A(t);V.notEnumerableProp(t,"stack",n.message+"\n"+n.stack.join("\n")),V.notEnumerableProp(t,"__stackCleaned__",!0)}}}function g(){this._trace=void 0}function b(t,e,r,n,i){if(void 0===t&&null!==e&&et){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&n._bitField))return;r&&(r+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),u=T(a),f=u.length-1;f>=0;--f){var c=u[f];if(!X.test(c)){var l=c.match(G);l&&(o="at "+l[1]+":"+l[2]+":"+l[3]+" ");break}}if(u.length>0)for(var h=u[0],f=0;f<a.length;++f)if(a[f]===h){f>0&&(s="\n"+a[f-1]);break}}var p="a promise was created in a "+r+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;n._warn(p,!0,e)}}function w(t,e){var r=t+" is deprecated and will be removed in a future version.";return e&&(r+=" Use "+e+" instead."),E(r)}function E(e,r,n){if(ht.warnings){var i,o=new z(e);if(r)n._attachExtraTrace(o);else if(ht.longStackTraces&&(i=t._peekCont