-
Notifications
You must be signed in to change notification settings - Fork 4
/
asyngular-client.min.js
4 lines (4 loc) · 90.3 KB
/
asyngular-client.min.js
1
2
3
4
/**
* Asyngular JavaScript client v6.2.4
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).asyngularClient=t()}}(function(){return function(){return function t(e,r,n){function o(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var h=r[s]={exports:{}};e[s][0].call(h.exports,function(t){return o(e[s][1][t]||t)},h,h.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}}()({1:[function(t,e){(function(t){function r(){this._internalStorage={},this.isLocalStorageEnabled=this._checkLocalStorageEnabled()}r.prototype._checkLocalStorageEnabled=function(){let e;try{t.localStorage,t.localStorage.setItem("__scLocalStorageTest",1),t.localStorage.removeItem("__scLocalStorageTest")}catch(t){e=t}return!e},r.prototype.saveToken=function(e,r){return this.isLocalStorageEnabled&&t.localStorage?t.localStorage.setItem(e,r):this._internalStorage[e]=r,Promise.resolve(r)},r.prototype.removeToken=function(e){let r=this.loadToken(e);return this.isLocalStorageEnabled&&t.localStorage?t.localStorage.removeItem(e):delete this._internalStorage[e],r},r.prototype.loadToken=function(e){let r;return r=this.isLocalStorageEnabled&&t.localStorage?t.localStorage.getItem(e):this._internalStorage[e]||null,Promise.resolve(r)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e){(function(r){const n=t("stream-demux"),o=t("async-stream-emitter"),i=t("ag-channel"),s=t("./auth"),a=t("sc-formatter"),u=t("./transport"),c=t("querystring"),h=t("linked-list"),l=t("lodash.clonedeep"),p=t("buffer/").Buffer,f=t("./wait"),d=t("sc-errors"),m=d.InvalidArgumentsError,y=d.InvalidMessageError;d.InvalidActionError;const g=d.SocketProtocolError,b=d.TimeoutError,v=d.BadConnectionError,_="undefined"!=typeof window;function k(t){o.call(this);let e=Object.assign({path:"/asyngular/",secure:!1,autoConnect:!0,autoReconnect:!0,autoSubscribeOnConnect:!0,connectTimeout:2e4,ackTimeout:1e4,timestampRequests:!1,timestampParam:"t",authTokenName:"asyngular.authToken",binaryType:"arraybuffer",batchOnHandshake:!1,batchOnHandshakeDuration:100,batchInterval:50,protocolVersion:2,wsOptions:{},cloneData:!1},t);this.id=null,this.version=e.version||null,this.protocolVersion=e.protocolVersion,this.state=this.CLOSED,this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null,this.pendingReconnect=!1,this.pendingReconnectTimeout=null,this.preparingPendingSubscriptions=!1,this.clientId=e.clientId,this.wsOptions=e.wsOptions,this.connectTimeout=e.connectTimeout,this.ackTimeout=e.ackTimeout,this.channelPrefix=e.channelPrefix||null,this.disconnectOnUnload=null==e.disconnectOnUnload||e.disconnectOnUnload,this.authTokenName=e.authTokenName,e.pingTimeout=e.connectTimeout,this.pingTimeout=e.pingTimeout,this.pingTimeoutDisabled=!!e.pingTimeoutDisabled;let i=Math.pow(2,31)-1,u=t=>{if(this[t]>i)throw new m(`The ${t} value provided exceeded the maximum amount allowed`)};if(u("connectTimeout"),u("ackTimeout"),u("pingTimeout"),this.connectAttempts=0,this.isBatching=!1,this.batchOnHandshake=e.batchOnHandshake,this.batchOnHandshakeDuration=e.batchOnHandshakeDuration,this._batchingIntervalId=null,this._outboundBuffer=new h,this._channelMap={},this._channelEventDemux=new n,this._channelDataDemux=new n,this._receiverDemux=new n,this._procedureDemux=new n,this.options=e,this._cid=1,this.options.callIdGenerator=(()=>this._cid++),this.options.autoReconnect){null==this.options.autoReconnectOptions&&(this.options.autoReconnectOptions={});let t=this.options.autoReconnectOptions;null==t.initialDelay&&(t.initialDelay=1e4),null==t.randomness&&(t.randomness=1e4),null==t.multiplier&&(t.multiplier=1.5),null==t.maxDelay&&(t.maxDelay=6e4)}if(null==this.options.subscriptionRetryOptions&&(this.options.subscriptionRetryOptions={}),this.options.authEngine?this.auth=this.options.authEngine:this.auth=new s,this.options.codecEngine?this.codec=this.options.codecEngine:this.codec=a,this.options.protocol){let t=new m('The "protocol" option does not affect asyngular-client - If you want to utilize SSL/TLS, use "secure" option instead');this._onError(t)}this.options.query=e.query||{},"string"==typeof this.options.query&&(this.options.query=c.parse(this.options.query)),_&&this.disconnectOnUnload&&r.addEventListener&&r.removeEventListener&&this._handleBrowserUnload(),this.options.autoConnect&&this.connect()}k.prototype=Object.create(o.prototype),k.CONNECTING=k.prototype.CONNECTING=u.prototype.CONNECTING,k.OPEN=k.prototype.OPEN=u.prototype.OPEN,k.CLOSED=k.prototype.CLOSED=u.prototype.CLOSED,k.AUTHENTICATED=k.prototype.AUTHENTICATED="authenticated",k.UNAUTHENTICATED=k.prototype.UNAUTHENTICATED="unauthenticated",k.SUBSCRIBED=k.prototype.SUBSCRIBED=i.SUBSCRIBED,k.PENDING=k.prototype.PENDING=i.PENDING,k.UNSUBSCRIBED=k.prototype.UNSUBSCRIBED=i.UNSUBSCRIBED,k.ignoreStatuses=d.socketProtocolIgnoreStatuses,k.errorStatuses=d.socketProtocolErrorStatuses,Object.defineProperty(k.prototype,"isBufferingBatch",{get:function(){return this.transport.isBufferingBatch}}),k.prototype.getBackpressure=function(){return Math.max(this.getAllListenersBackpressure(),this.getAllReceiversBackpressure(),this.getAllProceduresBackpressure(),this.getAllChannelsBackpressure())},k.prototype._handleBrowserUnload=async function(){let t=()=>{this.disconnect()},e=!1;(async()=>{let n=this.listener("connecting").createConsumer();for(;;){if((await n.next()).done)break;e||(e=!0,r.addEventListener("beforeunload",t,!1))}})(),(async()=>{let n=this.listener("close").createConsumer();for(;;){if((await n.next()).done)break;e&&(e=!1,r.removeEventListener("beforeunload",t,!1))}})()},k.prototype._setAuthToken=function(t){this._changeToAuthenticatedState(t.token),(async()=>{try{await this.auth.saveToken(this.authTokenName,t.token,{})}catch(t){this._onError(t)}})()},k.prototype._removeAuthToken=function(){(async()=>{let t;try{t=await this.auth.removeToken(this.authTokenName)}catch(t){return void this._onError(t)}this.emit("removeAuthToken",{oldAuthToken:t})})(),this._changeToUnauthenticatedStateAndClearTokens()},k.prototype._privateDataHandlerMap={"#publish":function(t){let e=this._undecorateChannelName(t.channel);this.isSubscribed(e,!0)&&this._channelDataDemux.write(e,t.data)},"#kickOut":function(t){let e=this._undecorateChannelName(t.channel),r=this._channelMap[e];r&&(this.emit("kickOut",{channel:e,message:t.message}),this._channelEventDemux.write(`${e}/kickOut`,{message:t.message}),this._triggerChannelUnsubscribe(r))},"#setAuthToken":function(t){t&&this._setAuthToken(t)},"#removeAuthToken":function(t){this._removeAuthToken(t)}},k.prototype._privateRPCHandlerMap={"#setAuthToken":function(t,e){t?(this._setAuthToken(t),e.end()):e.error(new y("No token data provided by #setAuthToken event"))},"#removeAuthToken":function(t,e){this._removeAuthToken(t),e.end()}},k.prototype.getState=function(){return this.state},k.prototype.getBytesReceived=function(){return this.transport.getBytesReceived()},k.prototype.deauthenticate=async function(){(async()=>{let t;try{t=await this.auth.removeToken(this.authTokenName)}catch(t){return void this._onError(t)}this.emit("removeAuthToken",{oldAuthToken:t})})(),this.state!==this.CLOSED&&this.transmit("#removeAuthToken"),this._changeToUnauthenticatedStateAndClearTokens(),await f(0)},k.prototype.connect=function(){this.state===this.CLOSED&&(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this.state=this.CONNECTING,this.emit("connecting",{}),this.transport&&this.transport.clearAllListeners(),this.transport=new u(this.auth,this.codec,this.options,this.wsOptions,{onOpen:t=>{this.state=this.OPEN,this._onOpen(t)},onOpenAbort:t=>{this.state!==this.CLOSED&&(this.state=this.CLOSED,this._destroy(t.code,t.reason,!0))},onClose:t=>{this.state!==this.CLOSED&&(this.state=this.CLOSED,this._destroy(t.code,t.reason))},onEvent:t=>{this.emit(t.event,t.data)},onError:t=>{this._onError(t.error)},onInboundInvoke:t=>{this._onInboundInvoke(t)},onInboundTransmit:t=>{this._onInboundTransmit(t.event,t.data)}}))},k.prototype.reconnect=function(t,e){this.disconnect(t,e),this.connect()},k.prototype.disconnect=function(t,e){if("number"!=typeof(t=t||1e3))throw new m("If specified, the code argument must be a number");let r=this.state===this.CONNECTING;r||this.state===this.OPEN?(this.state=this.CLOSED,this._destroy(t,e,r),this.transport.close(t,e)):(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef))},k.prototype._changeToUnauthenticatedStateAndClearTokens=function(){if(this.authState!==this.UNAUTHENTICATED){let t=this.authState,e=this.authToken,r=this.signedAuthToken;this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null;let n={oldAuthState:t,newAuthState:this.authState};this.emit("authStateChange",n),this.emit("deauthenticate",{oldSignedAuthToken:r,oldAuthToken:e})}},k.prototype._changeToAuthenticatedState=function(t){if(this.signedAuthToken=t,this.authToken=this._extractAuthTokenData(t),this.authState!==this.AUTHENTICATED){let e=this.authState;this.authState=this.AUTHENTICATED;let r={oldAuthState:e,newAuthState:this.authState,signedAuthToken:t,authToken:this.authToken};this.preparingPendingSubscriptions||this.processPendingSubscriptions(),this.emit("authStateChange",r)}this.emit("authenticate",{signedAuthToken:t,authToken:this.authToken})},k.prototype.decodeBase64=function(t){return p.from(t,"base64").toString("utf8")},k.prototype.encodeBase64=function(t){return p.from(t,"utf8").toString("base64")},k.prototype._extractAuthTokenData=function(t){let e=(t||"").split(".")[1];if(null!=e){let t=e;try{return t=this.decodeBase64(t),JSON.parse(t)}catch(e){return t}}return null},k.prototype.getAuthToken=function(){return this.authToken},k.prototype.getSignedAuthToken=function(){return this.signedAuthToken},k.prototype.authenticate=async function(t){let e;try{e=await this.invoke("#authenticate",t)}catch(t){throw"BadConnectionError"!==t.name&&"TimeoutError"!==t.name&&this._changeToUnauthenticatedStateAndClearTokens(),await f(0),t}return e&&null!=e.isAuthenticated?e.authError&&(e.authError=d.hydrateError(e.authError)):e={isAuthenticated:this.authState,authError:null},e.isAuthenticated?this._changeToAuthenticatedState(t):this._changeToUnauthenticatedStateAndClearTokens(),(async()=>{try{await this.auth.saveToken(this.authTokenName,t,{})}catch(t){this._onError(t)}})(),await f(0),e},k.prototype._tryReconnect=function(t){let e,r=this.connectAttempts++,n=this.options.autoReconnectOptions;if(null==t||r>0){let t=Math.round(n.initialDelay+(n.randomness||0)*Math.random());e=Math.round(t*Math.pow(n.multiplier,r))}else e=t;e>n.maxDelay&&(e=n.maxDelay),clearTimeout(this._reconnectTimeoutRef),this.pendingReconnect=!0,this.pendingReconnectTimeout=e,this._reconnectTimeoutRef=setTimeout(()=>{this.connect()},e)},k.prototype._onOpen=function(t){this.isBatching?this._startBatching():this.batchOnHandshake&&(this._startBatching(),setTimeout(()=>{this.isBatching||this._stopBatching()},this.batchOnHandshakeDuration)),this.preparingPendingSubscriptions=!0,t?(this.id=t.id,this.pingTimeout=t.pingTimeout,t.isAuthenticated?this._changeToAuthenticatedState(t.authToken):this._changeToUnauthenticatedStateAndClearTokens()):this._changeToUnauthenticatedStateAndClearTokens(),this.connectAttempts=0,this.options.autoSubscribeOnConnect&&this.processPendingSubscriptions(),this.emit("connect",{...t,processPendingSubscriptions:()=>{this.processPendingSubscriptions()}}),this.state===this.OPEN&&this._flushOutboundBuffer()},k.prototype._onError=function(t){this.emit("error",{error:t})},k.prototype._suspendSubscriptions=function(){Object.keys(this._channelMap).forEach(t=>{let e=this._channelMap[t];this._triggerChannelUnsubscribe(e,!0)})},k.prototype._abortAllPendingEventsDueToBadConnection=function(t){let e,r=this._outboundBuffer.head;for(;r;){e=r.next;let n=r.data;clearTimeout(n.timeout),delete n.timeout,r.detach(),r=e;let o=n.callback;if(o){delete n.callback;let e=`Event "${n.event}" was aborted due to a bad connection`,r=new v(e,t);o.call(n,r,n)}n.cid&&this.transport.cancelPendingResponse(n.cid)}},k.prototype._destroy=function(t,e,r){if(this.id=null,this._cancelBatching(),this.transport&&this.transport.clearAllListeners(),this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this._suspendSubscriptions(),r?this.emit("connectAbort",{code:t,reason:e}):this.emit("disconnect",{code:t,reason:e}),this.emit("close",{code:t,reason:e}),!k.ignoreStatuses[t]){let r;r=e?"Socket connection closed with status code "+t+" and reason: "+e:"Socket connection closed with status code "+t;let n=new g(k.errorStatuses[t]||r,t);this._onError(n)}this._abortAllPendingEventsDueToBadConnection(r?"connectAbort":"disconnect"),this.options.autoReconnect&&(4e3===t||4001===t||1005===t?this._tryReconnect(0):1e3!==t&&t<4500&&this._tryReconnect())},k.prototype._onInboundTransmit=function(t,e){let r=this._privateDataHandlerMap[t];r?r.call(this,e):this._receiverDemux.write(t,e)},k.prototype._onInboundInvoke=function(t){let{procedure:e,data:r}=t,n=this._privateRPCHandlerMap[e];n?n.call(this,r,t):this._procedureDemux.write(e,t)},k.prototype.decode=function(t){return this.transport.decode(t)},k.prototype.encode=function(t){return this.transport.encode(t)},k.prototype._flushOutboundBuffer=function(){let t,e=this._outboundBuffer.head;for(;e;){t=e.next;let r=e.data;e.detach(),this.transport.transmitObject(r),e=t}},k.prototype._handleEventAckTimeout=function(t,e){e&&e.detach(),delete t.timeout;let r=t.callback;if(r){delete t.callback;let e=new b(`Event response for "${t.event}" timed out`);r.call(t,e,t)}t.cid&&this.transport.cancelPendingResponse(t.cid)},k.prototype._processOutboundEvent=function(t,e,r,n){r=r||{},this.state===this.CLOSED&&this.connect();let o,i={event:t};o=n?new Promise((t,e)=>{i.callback=((r,n)=>{r?e(r):t(n)})}):Promise.resolve();let s=new h.Item;this.options.cloneData?i.data=l(e):i.data=e,s.data=i;let a=null==r.ackTimeout?this.ackTimeout:r.ackTimeout;return i.timeout=setTimeout(()=>{this._handleEventAckTimeout(i,s)},a),this._outboundBuffer.append(s),this.state===this.OPEN&&this._flushOutboundBuffer(),o},k.prototype.send=function(t){this.transport.send(t)},k.prototype.transmit=function(t,e,r){return this._processOutboundEvent(t,e,r)},k.prototype.invoke=function(t,e,r){return this._processOutboundEvent(t,e,r,!0)},k.prototype.transmitPublish=function(t,e){let r={channel:this._decorateChannelName(t),data:e};return this.transmit("#publish",r)},k.prototype.invokePublish=function(t,e){let r={channel:this._decorateChannelName(t),data:e};return this.invoke("#publish",r)},k.prototype._triggerChannelSubscribe=function(t,e){let r=t.name;if(t.state!==i.SUBSCRIBED){let n=t.state;t.state=i.SUBSCRIBED;let o={oldChannelState:n,newChannelState:t.state,subscriptionOptions:e};this._channelEventDemux.write(`${r}/subscribeStateChange`,o),this._channelEventDemux.write(`${r}/subscribe`,{subscriptionOptions:e}),this.emit("subscribeStateChange",{channel:r,...o}),this.emit("subscribe",{channel:r,subscriptionOptions:e})}},k.prototype._triggerChannelSubscribeFail=function(t,e,r){let n=e.name,o=!e.options.waitForAuth||this.authState===this.AUTHENTICATED;!!this._channelMap[n]&&o&&(delete this._channelMap[n],this._channelEventDemux.write(`${n}/subscribeFail`,{error:t,subscriptionOptions:r}),this.emit("subscribeFail",{error:t,channel:n,subscriptionOptions:r}))},k.prototype._cancelPendingSubscribeCallback=function(t){null!=t._pendingSubscriptionCid&&(this.transport.cancelPendingResponse(t._pendingSubscriptionCid),delete t._pendingSubscriptionCid)},k.prototype._decorateChannelName=function(t){return this.channelPrefix&&(t=this.channelPrefix+t),t},k.prototype._undecorateChannelName=function(t){return this.channelPrefix&&0===t.indexOf(this.channelPrefix)?t.replace(this.channelPrefix,""):t},k.prototype.startBatch=function(){this.transport.startBatch()},k.prototype.flushBatch=function(){this.transport.flushBatch()},k.prototype.cancelBatch=function(){this.transport.cancelBatch()},k.prototype._startBatching=function(){null==this._batchingIntervalId&&(this.startBatch(),this._batchingIntervalId=setInterval(()=>{this.flushBatch(),this.startBatch()},this.options.batchInterval))},k.prototype.startBatching=function(){this.isBatching=!0,this._startBatching()},k.prototype._stopBatching=function(){null!=this._batchingIntervalId&&clearInterval(this._batchingIntervalId),this._batchingIntervalId=null,this.flushBatch()},k.prototype.stopBatching=function(){this.isBatching=!1,this._stopBatching()},k.prototype._cancelBatching=function(){null!=this._batchingIntervalId&&clearInterval(this._batchingIntervalId),this._batchingIntervalId=null,this.cancelBatch()},k.prototype.cancelBatching=function(){this.isBatching=!1,this._cancelBatching()},k.prototype._trySubscribe=function(t){let e=!t.options.waitForAuth||this.authState===this.AUTHENTICATED;if(this.state===this.OPEN&&!this.preparingPendingSubscriptions&&null==t._pendingSubscriptionCid&&e){let e={noTimeout:!0},r={};t.options.waitForAuth&&(e.waitForAuth=!0,r.waitForAuth=e.waitForAuth),t.options.data&&(r.data=t.options.data),t._pendingSubscriptionCid=this.transport.invokeRaw("#subscribe",{channel:this._decorateChannelName(t.name),...r},e,e=>{if(e){if("BadConnectionError"===e.name)return;delete t._pendingSubscriptionCid,this._triggerChannelSubscribeFail(e,t,r)}else delete t._pendingSubscriptionCid,this._triggerChannelSubscribe(t,r)}),this.emit("subscribeRequest",{channel:t.name,subscriptionOptions:r})}},k.prototype.subscribe=function(t,e){e=e||{};let r=this._channelMap[t],n={waitForAuth:!!e.waitForAuth};return null!=e.priority&&(n.priority=e.priority),void 0!==e.data&&(n.data=e.data),r?e&&(r.options=n):(r={name:t,state:i.PENDING,options:n},this._channelMap[t]=r,this._trySubscribe(r)),new i(t,this,this._channelEventDemux,this._channelDataDemux)},k.prototype._triggerChannelUnsubscribe=function(t,e){let r=t.name;if(this._cancelPendingSubscribeCallback(t),t.state===i.SUBSCRIBED){let n={oldChannelState:t.state,newChannelState:e?i.PENDING:i.UNSUBSCRIBED};this._channelEventDemux.write(`${r}/subscribeStateChange`,n),this._channelEventDemux.write(`${r}/unsubscribe`,{}),this.emit("subscribeStateChange",{channel:r,...n}),this.emit("unsubscribe",{channel:r})}e?t.state=i.PENDING:delete this._channelMap[r]},k.prototype._tryUnsubscribe=function(t){if(this.state===this.OPEN){this._cancelPendingSubscribeCallback(t);let e=this._decorateChannelName(t.name);this.transport.transmit("#unsubscribe",e,{noTimeout:!0})}},k.prototype.unsubscribe=function(t){let e=this._channelMap[t];e&&(this._triggerChannelUnsubscribe(e),this._tryUnsubscribe(e))},k.prototype.receiver=function(t){return this._receiverDemux.stream(t)},k.prototype.closeReceiver=function(t){this._receiverDemux.close(t)},k.prototype.closeAllReceivers=function(){this._receiverDemux.closeAll()},k.prototype.killReceiver=function(t){this._receiverDemux.kill(t)},k.prototype.killAllReceivers=function(){this._receiverDemux.killAll()},k.prototype.killReceiverConsumer=function(t){this._receiverDemux.killConsumer(t)},k.prototype.getReceiverConsumerStats=function(t){return this._receiverDemux.getConsumerStats(t)},k.prototype.getReceiverConsumerStatsList=function(t){return this._receiverDemux.getConsumerStatsList(t)},k.prototype.getAllReceiversConsumerStatsList=function(){return this._receiverDemux.getConsumerStatsListAll()},k.prototype.getReceiverBackpressure=function(t){return this._receiverDemux.getBackpressure(t)},k.prototype.getAllReceiversBackpressure=function(){return this._receiverDemux.getBackpressureAll()},k.prototype.getReceiverConsumerBackpressure=function(t){return this._receiverDemux.getConsumerBackpressure(t)},k.prototype.hasReceiverConsumer=function(t,e){return this._receiverDemux.hasConsumer(t,e)},k.prototype.hasAnyReceiverConsumer=function(t){return this._receiverDemux.hasConsumerAll(t)},k.prototype.procedure=function(t){return this._procedureDemux.stream(t)},k.prototype.closeProcedure=function(t){this._procedureDemux.close(t)},k.prototype.closeAllProcedures=function(){this._procedureDemux.closeAll()},k.prototype.killProcedure=function(t){this._procedureDemux.kill(t)},k.prototype.killAllProcedures=function(){this._procedureDemux.killAll()},k.prototype.killProcedureConsumer=function(t){this._procedureDemux.killConsumer(t)},k.prototype.getProcedureConsumerStats=function(t){return this._procedureDemux.getConsumerStats(t)},k.prototype.getProcedureConsumerStatsList=function(t){return this._procedureDemux.getConsumerStatsList(t)},k.prototype.getAllProceduresConsumerStatsList=function(){return this._procedureDemux.getConsumerStatsListAll()},k.prototype.getProcedureBackpressure=function(t){return this._procedureDemux.getBackpressure(t)},k.prototype.getAllProceduresBackpressure=function(){return this._procedureDemux.getBackpressureAll()},k.prototype.getProcedureConsumerBackpressure=function(t){return this._procedureDemux.getConsumerBackpressure(t)},k.prototype.hasProcedureConsumer=function(t,e){return this._procedureDemux.hasConsumer(t,e)},k.prototype.hasAnyProcedureConsumer=function(t){return this._procedureDemux.hasConsumerAll(t)},k.prototype.channel=function(t){return this._channelMap[t],new i(t,this,this._channelEventDemux,this._channelDataDemux)},k.prototype.closeChannel=function(t){this.channelCloseOutput(t),this.channelCloseAllListeners(t)},k.prototype.closeAllChannelOutputs=function(){this._channelDataDemux.closeAll()},k.prototype.closeAllChannelListeners=function(){this._channelEventDemux.closeAll()},k.prototype.closeAllChannels=function(){this.closeAllChannelOutputs(),this.closeAllChannelListeners()},k.prototype.killChannel=function(t){this.channelKillOutput(t),this.channelKillAllListeners(t)},k.prototype.killAllChannelOutputs=function(){this._channelDataDemux.killAll()},k.prototype.killAllChannelListeners=function(){this._channelEventDemux.killAll()},k.prototype.killAllChannels=function(){this.killAllChannelOutputs(),this.killAllChannelListeners()},k.prototype.killChannelOutputConsumer=function(t){this._channelDataDemux.killConsumer(t)},k.prototype.killChannelListenerConsumer=function(t){this._channelEventDemux.killConsumer(t)},k.prototype.getChannelOutputConsumerStats=function(t){return this._channelDataDemux.getConsumerStats(t)},k.prototype.getChannelListenerConsumerStats=function(t){return this._channelEventDemux.getConsumerStats(t)},k.prototype.getAllChannelOutputsConsumerStatsList=function(){return this._channelDataDemux.getConsumerStatsListAll()},k.prototype.getAllChannelListenersConsumerStatsList=function(){return this._channelEventDemux.getConsumerStatsListAll()},k.prototype.getChannelBackpressure=function(t){return Math.max(this.channelGetOutputBackpressure(t),this.channelGetAllListenersBackpressure(t))},k.prototype.getAllChannelOutputsBackpressure=function(){return this._channelDataDemux.getBackpressureAll()},k.prototype.getAllChannelListenersBackpressure=function(){return this._channelEventDemux.getBackpressureAll()},k.prototype.getAllChannelsBackpressure=function(){return Math.max(this.getAllChannelOutputsBackpressure(),this.getAllChannelListenersBackpressure())},k.prototype.getChannelListenerConsumerBackpressure=function(t){return this._channelEventDemux.getConsumerBackpressure(t)},k.prototype.getChannelOutputConsumerBackpressure=function(t){return this._channelDataDemux.getConsumerBackpressure(t)},k.prototype.hasAnyChannelOutputConsumer=function(t){return this._channelDataDemux.hasConsumerAll(t)},k.prototype.hasAnyChannelListenerConsumer=function(t){return this._channelEventDemux.hasConsumerAll(t)},k.prototype.getChannelState=function(t){let e=this._channelMap[t];return e?e.state:i.UNSUBSCRIBED},k.prototype.getChannelOptions=function(t){let e=this._channelMap[t];return e?{...e.options}:{}},k.prototype._getAllChannelStreamNames=function(t){let e=this._channelEventDemux.getConsumerStatsListAll().filter(e=>0===e.stream.indexOf(`${t}/`)).reduce((t,e)=>(t[e.stream]=!0,t),{});return Object.keys(e)},k.prototype.channelCloseOutput=function(t){this._channelDataDemux.close(t)},k.prototype.channelCloseListener=function(t,e){this._channelEventDemux.close(`${t}/${e}`)},k.prototype.channelCloseAllListeners=function(t){this._getAllChannelStreamNames(t).forEach(t=>{this._channelEventDemux.close(t)})},k.prototype.channelKillOutput=function(t){this._channelDataDemux.kill(t)},k.prototype.channelKillListener=function(t,e){this._channelEventDemux.kill(`${t}/${e}`)},k.prototype.channelKillAllListeners=function(t){this._getAllChannelStreamNames(t).forEach(t=>{this._channelEventDemux.kill(t)})},k.prototype.channelGetOutputConsumerStatsList=function(t){return this._channelDataDemux.getConsumerStatsList(t)},k.prototype.channelGetListenerConsumerStatsList=function(t,e){return this._channelEventDemux.getConsumerStatsList(`${t}/${e}`)},k.prototype.channelGetAllListenersConsumerStatsList=function(t){return this._getAllChannelStreamNames(t).map(t=>this._channelEventDemux.getConsumerStatsList(t)).reduce((t,e)=>(e.forEach(e=>{t.push(e)}),t),[])},k.prototype.channelGetOutputBackpressure=function(t){return this._channelDataDemux.getBackpressure(t)},k.prototype.channelGetListenerBackpressure=function(t,e){return this._channelEventDemux.getBackpressure(`${t}/${e}`)},k.prototype.channelGetAllListenersBackpressure=function(t){let e=this._getAllChannelStreamNames(t).map(t=>this._channelEventDemux.getBackpressure(t));return Math.max(...e.concat(0))},k.prototype.channelHasOutputConsumer=function(t,e){return this._channelDataDemux.hasConsumer(t,e)},k.prototype.channelHasListenerConsumer=function(t,e,r){return this._channelEventDemux.hasConsumer(`${t}/${e}`,r)},k.prototype.channelHasAnyListenerConsumer=function(t,e){return this._getAllChannelStreamNames(t).some(t=>this._channelEventDemux.hasConsumer(t,e))},k.prototype.subscriptions=function(t){let e=[];return Object.keys(this._channelMap).forEach(r=>{(t||this._channelMap[r].state===i.SUBSCRIBED)&&e.push(r)}),e},k.prototype.isSubscribed=function(t,e){let r=this._channelMap[t];return e?!!r:!!r&&r.state===i.SUBSCRIBED},k.prototype.processPendingSubscriptions=function(){this.preparingPendingSubscriptions=!1;let t=[];Object.keys(this._channelMap).forEach(e=>{let r=this._channelMap[e];r.state===i.PENDING&&t.push(r)}),t.sort((t,e)=>{let r=t.options.priority||0,n=e.options.priority||0;return r>n?-1:r<n?1:0}),t.forEach(t=>{this._trySubscribe(t)})},e.exports=k}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./auth":1,"./transport":4,"./wait":5,"ag-channel":7,"async-stream-emitter":9,"buffer/":11,"linked-list":15,"lodash.clonedeep":16,querystring:19,"sc-errors":21,"sc-formatter":22,"stream-demux":24}],3:[function(t,e){(function(r){const n=t("./clientsocket"),o=t("uuid"),i=t("sc-errors").InvalidArgumentsError;e.exports={create:function(t){if((t=t||{}).host&&!t.host.match(/[^:]+:\d{2,5}/))throw new i('The host option should include both the hostname and the port number in the format "hostname:port"');if(t.host&&t.hostname)throw new i('The host option should already include the hostname and the port number in the format "hostname:port" - Because of this, you should never use host and hostname options together');if(t.host&&t.port)throw new i('The host option should already include the hostname and the port number in the format "hostname:port" - Because of this, you should never use host and port options together');let e=r.location&&"https:"===location.protocol,s={clientId:o.v4(),port:function(t,e){let n=null==t.secure?e:t.secure;return t.port||(r.location&&location.port?location.port:n?443:80)}(t,e),hostname:r.location&&location.hostname||"localhost",secure:e};return Object.assign(s,t),new n(s)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./clientsocket":2,"sc-errors":21,uuid:25}],4:[function(t,e){(function(r){const n=t("ag-request"),o=t("querystring");let i,s;r.WebSocket?(i=r.WebSocket,s=function(t){return new i(t)}):(i=t("ws"),s=function(t,e){return new i(t,null,e)});const a=t("sc-errors"),u=a.TimeoutError,c=a.BadConnectionError;function h(t,e,r,n,o){this.state=this.CLOSED,this.auth=t,this.codec=e,this.options=r,this.wsOptions=n,this.protocolVersion=r.protocolVersion,this.connectTimeout=r.connectTimeout,this.pingTimeout=r.pingTimeout,this.pingTimeoutDisabled=!!r.pingTimeoutDisabled,this.callIdGenerator=r.callIdGenerator,this.authTokenName=r.authTokenName,this.isBufferingBatch=!1,this._pingTimeoutTicker=null,this._callbackMap={},this._batchBuffer=[],o||(o={}),this._onOpenHandler=o.onOpen||function(){},this._onOpenAbortHandler=o.onOpenAbort||function(){},this._onCloseHandler=o.onClose||function(){},this._onEventHandler=o.onEvent||function(){},this._onErrorHandler=o.onError||function(){},this._onInboundInvokeHandler=o.onInboundInvoke||function(){},this._onInboundTransmitHandler=o.onInboundTransmit||function(){},this.state=this.CONNECTING;let i=this.uri(),a=s(i,n);a.binaryType=this.options.binaryType,this.socket=a,a.onopen=(()=>{this._onOpen()}),a.onclose=(async t=>{let e;e=null==t.code?1005:t.code,this._destroy(e,t.reason)}),a.onmessage=(t=>{this._onMessage(t.data)}),a.onerror=(()=>{this.state===this.CONNECTING&&this._destroy(1006)}),this._connectTimeoutRef=setTimeout(()=>{this._destroy(4007),this.socket.close(4007)},this.connectTimeout),1===this.protocolVersion?this._handlePing=(t=>"#1"===t&&(this._resetPingTimeout(),this.socket.readyState===this.socket.OPEN&&this.send("#2"),!0)):this._handlePing=(t=>""===t&&(this._resetPingTimeout(),this.socket.readyState===this.socket.OPEN&&this.send(""),!0))}h.CONNECTING=h.prototype.CONNECTING="connecting",h.OPEN=h.prototype.OPEN="open",h.CLOSED=h.prototype.CLOSED="closed",h.prototype.uri=function(){let t,e=this.options.query||{},r=this.options.secure?"wss":"ws";if(this.options.timestampRequests&&(e[this.options.timestampParam]=(new Date).getTime()),(e=o.encode(e)).length&&(e="?"+e),this.options.host)t=this.options.host;else{let e="";this.options.port&&("wss"===r&&443!==this.options.port||"ws"===r&&80!==this.options.port)&&(e=":"+this.options.port),t=this.options.hostname+e}return r+"://"+t+this.options.path+e},h.prototype._onOpen=async function(){let t;clearTimeout(this._connectTimeoutRef),this._resetPingTimeout();try{t=await this._handshake()}catch(t){return null==t.statusCode&&(t.statusCode=4003),this._onError(t),this._destroy(t.statusCode,t.toString()),void this.socket.close(t.statusCode)}this.state=this.OPEN,t&&(this.pingTimeout=t.pingTimeout),this._resetPingTimeout(),this._onOpenHandler(t)},h.prototype._handshake=async function(){let t=await this.auth.loadToken(this.authTokenName),e=await this.invoke("#handshake",{authToken:t},{force:!0});return e&&(e.authToken=t,e.authError&&(e.authError=a.hydrateError(e.authError))),e},h.prototype._abortAllPendingEventsDueToBadConnection=function(t){Object.keys(this._callbackMap||{}).forEach(e=>{let r=this._callbackMap[e];delete this._callbackMap[e],clearTimeout(r.timeout),delete r.timeout;let n=`Event "${r.event}" was aborted due to a bad connection`,o=new c(n,t),i=r.callback;delete r.callback,i.call(r,o,r)})},h.prototype._destroy=function(t,e){a.socketProtocolErrorStatuses[t],!e&&a.socketProtocolErrorStatuses[t]&&(e=a.socketProtocolErrorStatuses[t]),delete this.socket.onopen,delete this.socket.onclose,delete this.socket.onmessage,delete this.socket.onerror,clearTimeout(this._connectTimeoutRef),clearTimeout(this._pingTimeoutTicker),this.state===this.OPEN?(this.state=this.CLOSED,this._abortAllPendingEventsDueToBadConnection("disconnect"),this._onCloseHandler({code:t,reason:e})):this.state===this.CONNECTING?(this.state=this.CLOSED,this._abortAllPendingEventsDueToBadConnection("connectAbort"),this._onOpenAbortHandler({code:t,reason:e})):this.state===this.CLOSED&&this._abortAllPendingEventsDueToBadConnection("connectAbort")},h.prototype._processInboundPacket=function(t,e){if(t&&null!=t.event)if(null==t.cid)this._onInboundTransmitHandler({...t});else{let e=new n(this,t.cid,t.event,t.data);this._onInboundInvokeHandler(e)}else if(t&&null!=t.rid){let e=this._callbackMap[t.rid];if(e&&(clearTimeout(e.timeout),delete e.timeout,delete this._callbackMap[t.rid],e.callback)){let r=a.hydrateError(t.error);e.callback(r,t.data)}}else this._onEventHandler({event:"raw",data:{message:e}})},h.prototype._onMessage=function(t){if(this._onEventHandler({event:"message",data:{message:t}}),this._handlePing(t))return;let e=this.decode(t);if(Array.isArray(e)){let r=e.length;for(let n=0;n<r;n++)this._processInboundPacket(e[n],t)}else this._processInboundPacket(e,t)},h.prototype._onError=function(t){this._onErrorHandler({error:t})},h.prototype._resetPingTimeout=function(){this.pingTimeoutDisabled||((new Date).getTime(),clearTimeout(this._pingTimeoutTicker),this._pingTimeoutTicker=setTimeout(()=>{this._destroy(4e3),this.socket.close(4e3)},this.pingTimeout))},h.prototype.clearAllListeners=function(){this._onOpenHandler=function(){},this._onOpenAbortHandler=function(){},this._onCloseHandler=function(){},this._onEventHandler=function(){},this._onErrorHandler=function(){},this._onInboundInvokeHandler=function(){},this._onInboundTransmitHandler=function(){}},h.prototype.startBatch=function(){this.isBufferingBatch=!0,this._batchBuffer=[]},h.prototype.flushBatch=function(){if(this.isBufferingBatch=!1,!this._batchBuffer.length)return;let t=this.serializeObject(this._batchBuffer);this._batchBuffer=[],this.send(t)},h.prototype.cancelBatch=function(){this.isBufferingBatch=!1,this._batchBuffer=[]},h.prototype.getBytesReceived=function(){return this.socket.bytesReceived},h.prototype.close=function(t,e){this.state!==this.OPEN&&this.state!==this.CONNECTING||(t=t||1e3,this._destroy(t,e),this.socket.close(t,e))},h.prototype.transmitObject=function(t){let e={event:t.event,data:t.data};return t.callback&&(e.cid=t.cid=this.callIdGenerator(),this._callbackMap[t.cid]=t),this.sendObject(e),t.cid||null},h.prototype._handleEventAckTimeout=function(t){t.cid&&delete this._callbackMap[t.cid],delete t.timeout;let e=t.callback;if(e){delete t.callback;let r=new u(`Event response for "${t.event}" timed out`);e.call(t,r,t)}},h.prototype.transmit=function(t,e,r){return(this.state===this.OPEN||r.force)&&this.transmitObject({event:t,data:e}),Promise.resolve()},h.prototype.invokeRaw=function(t,e,r,n){let o={event:t,data:e,callback:n};r.noTimeout||(o.timeout=setTimeout(()=>{this._handleEventAckTimeout(o)},this.options.ackTimeout));let i=null;return(this.state===this.OPEN||r.force)&&(i=this.transmitObject(o)),i},h.prototype.invoke=function(t,e,r){return new Promise((n,o)=>{this.invokeRaw(t,e,r,(t,e)=>{t?o(t):n(e)})})},h.prototype.cancelPendingResponse=function(t){delete this._callbackMap[t]},h.prototype.decode=function(t){return this.codec.decode(t)},h.prototype.encode=function(t){return this.codec.encode(t)},h.prototype.send=function(t){this.socket.readyState!==this.socket.OPEN?this._destroy(1005):this.socket.send(t)},h.prototype.serializeObject=function(t){let e;try{e=this.encode(t)}catch(t){return this._onError(t),null}return e},h.prototype.sendObject=function(t){if(this.isBufferingBatch)return void this._batchBuffer.push(t);let e=this.serializeObject(t);null!=e&&this.send(e)},e.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"ag-request":8,querystring:19,"sc-errors":21,ws:6}],5:[function(t,e){e.exports=function(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}},{}],6:[function(t,e){let r;const n=(r="undefined"!=typeof WorkerGlobalScope?self:"undefined"!=typeof window&&window||function(){return this}()).WebSocket||r.MozWebSocket;function o(t,e){let r;return r=e?new n(t,e):new n(t)}n&&(o.prototype=n.prototype),e.exports=n?o:null},{}],7:[function(t,e){const r=t("consumable-stream");class n extends r{constructor(t,e,r,o){super(),this.PENDING=n.PENDING,this.SUBSCRIBED=n.SUBSCRIBED,this.UNSUBSCRIBED=n.UNSUBSCRIBED,this.name=t,this.client=e,this._eventDemux=r,this._dataStream=o.stream(this.name)}createConsumer(t){return this._dataStream.createConsumer(t)}listener(t){return this._eventDemux.stream(`${this.name}/${t}`)}close(){this.client.closeChannel(this.name)}kill(){this.client.killChannel(this.name)}killOutputConsumer(t){this.hasOutputConsumer(t)&&this.client.killChannelOutputConsumer(t)}killListenerConsumer(t){this.hasAnyListenerConsumer(t)&&this.client.killChannelListenerConsumer(t)}getOutputConsumerStats(t){if(this.hasOutputConsumer(t))return this.client.getChannelOutputConsumerStats(t)}getListenerConsumerStats(t){if(this.hasAnyListenerConsumer(t))return this.client.getChannelListenerConsumerStats(t)}getBackpressure(){return this.client.getChannelBackpressure(this.name)}getListenerConsumerBackpressure(t){return this.hasAnyListenerConsumer(t)?this.client.getChannelListenerConsumerBackpressure(t):0}getOutputConsumerBackpressure(t){return this.hasOutputConsumer(t)?this.client.getChannelOutputConsumerBackpressure(t):0}closeOutput(){this.client.channelCloseOutput(this.name)}closeListener(t){this.client.channelCloseListener(this.name,t)}closeAllListeners(){this.client.channelCloseAllListeners(this.name)}killOutput(){this.client.channelKillOutput(this.name)}killListener(t){this.client.channelKillListener(this.name,t)}killAllListeners(){this.client.channelKillAllListeners(this.name)}getOutputConsumerStatsList(){return this.client.channelGetOutputConsumerStatsList(this.name)}getListenerConsumerStatsList(t){return this.client.channelGetListenerConsumerStatsList(this.name,t)}getAllListenersConsumerStatsList(){return this.client.channelGetAllListenersConsumerStatsList(this.name)}getOutputBackpressure(){return this.client.channelGetOutputBackpressure(this.name)}getListenerBackpressure(t){return this.client.channelGetListenerBackpressure(this.name,t)}getAllListenersBackpressure(){return this.client.channelGetAllListenersBackpressure(this.name)}hasOutputConsumer(t){return this.client.channelHasOutputConsumer(this.name,t)}hasListenerConsumer(t,e){return this.client.channelHasListenerConsumer(this.name,t,e)}hasAnyListenerConsumer(t){return this.client.channelHasAnyListenerConsumer(this.name,t)}get state(){return this.client.getChannelState(this.name)}set state(t){throw new Error("Cannot directly set channel state")}get options(){return this.client.getChannelOptions(this.name)}set options(t){throw new Error("Cannot directly set channel options")}subscribe(t){this.client.subscribe(this.name,t)}unsubscribe(){this.client.unsubscribe(this.name)}isSubscribed(t){return this.client.isSubscribed(this.name,t)}transmitPublish(t){return this.client.transmitPublish(this.name,t)}invokePublish(t){return this.client.invokePublish(this.name,t)}}n.PENDING="pending",n.SUBSCRIBED="subscribed",n.UNSUBSCRIBED="unsubscribed",e.exports=n},{"consumable-stream":12}],8:[function(t,e){const r=t("sc-errors"),n=r.InvalidActionError;e.exports=function(t,e,o,i){this.socket=t,this.id=e,this.procedure=o,this.data=i,this.sent=!1,this._respond=((t,e)=>{if(this.sent)throw new n(`Response to request ${this.id} has already been sent`);this.sent=!0,this.socket.sendObject(t,e)}),this.end=((t,e)=>{let r={rid:this.id};void 0!==t&&(r.data=t),this._respond(r,e)}),this.error=((t,e)=>{let n={rid:this.id,error:r.dehydrateError(t)};this._respond(n,e)})}},{"sc-errors":21}],9:[function(t,e){const r=t("stream-demux");function n(){this._listenerDemux=new r}n.prototype.emit=function(t,e){this._listenerDemux.write(t,e)},n.prototype.listener=function(t){return this._listenerDemux.stream(t)},n.prototype.closeListener=function(t){this._listenerDemux.close(t)},n.prototype.closeAllListeners=function(){this._listenerDemux.closeAll()},n.prototype.getListenerConsumerStats=function(t){return this._listenerDemux.getConsumerStats(t)},n.prototype.getListenerConsumerStatsList=function(t){return this._listenerDemux.getConsumerStatsList(t)},n.prototype.getAllListenersConsumerStatsList=function(){return this._listenerDemux.getConsumerStatsListAll()},n.prototype.killListener=function(t){this._listenerDemux.kill(t)},n.prototype.killAllListeners=function(){this._listenerDemux.killAll()},n.prototype.killListenerConsumer=function(t){this._listenerDemux.killConsumer(t)},n.prototype.getListenerBackpressure=function(t){return this._listenerDemux.getBackpressure(t)},n.prototype.getAllListenersBackpressure=function(){return this._listenerDemux.getBackpressureAll()},n.prototype.getListenerConsumerBackpressure=function(t){return this._listenerDemux.getConsumerBackpressure(t)},n.prototype.hasListenerConsumer=function(t,e){return this._listenerDemux.hasConsumer(t,e)},n.prototype.hasAnyListenerConsumer=function(t){return this._listenerDemux.hasConsumerAll(t)},e.exports=n},{"stream-demux":24}],10:[function(t,e,r){"use strict";r.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=c(t),s=n[0],a=n[1],u=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],u[h++]=e>>16&255,u[h++]=e>>8&255,u[h++]=255&e;2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,u[h++]=255&e);1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,u[h++]=e>>8&255,u[h++]=255&e);return u},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=0,a=r-o;s<a;s+=16383)i.push(h(t,s,s+16383>a?a:s+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],11:[function(t,e,r){(function(e){"use strict";var n=t("base64-js"),o=t("ieee754"),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;var s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return Object.setPrototypeOf(r,e.prototype),r}function e(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return u(t,e,r)}function u(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|f(t,r),o=a(n),i=o.write(t,r);i!==n&&(o=o.slice(0,i));return o}(t,r);if(ArrayBuffer.isView(t))return l(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');var o;o=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);return Object.setPrototypeOf(o,e.prototype),o}(t,r,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return e.from(o,r,n);var i=function(t){if(e.isBuffer(t)){var r=0|p(t.length),n=a(r);return 0===n.length?n:(t.copy(n,0,0,r),n)}if(void 0!==t.length)return"number"!=typeof t.length||G(t.length)?a(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return e.from(t[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return c(t),a(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function f(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return R(t).length;default:if(i)return o?-1:U(t).length;r=(""+r).toLowerCase(),i=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(t,r,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof r&&(r=e.from(r,o)),e.isBuffer(r))return 0===r.length?-1:y(t,r,n,o,i);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):y(t,[r],n,o,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,o){var i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var h=-1;for(i=r;i<a;i++)if(c(t,i)===c(e,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===u)return h*s}else-1!==h&&(i-=i-h),h=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var l=!0,p=0;p<u;p++)if(c(t,i+p)!==c(e,p)){l=!1;break}if(l)return i}return-1}function g(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(G(a))return s;t[r+s]=a}return s}function b(t,e,r,n){return M(U(e,t.length-r),t,r,n)}function v(t,e,r,n){return M(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function _(t,e,r,n){return v(t,e,r,n)}function k(t,e,r,n){return M(R(e),t,r,n)}function E(t,e,r,n){return M(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function w(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,u,c=t[o],h=null,l=c>239?4:c>223?3:c>191?2:1;if(o+l<=r)switch(l){case 1:c<128&&(h=c);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&c)<<6|63&i)>127&&(h=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&c)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=l}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=S));return r}(n)}r.kMaxLength=s,e.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),e.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(e.prototype,"parent",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.buffer}}),Object.defineProperty(e.prototype,"offset",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),e.poolSize=8192,e.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(e.prototype,Uint8Array.prototype),Object.setPrototypeOf(e,Uint8Array),e.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},e.allocUnsafe=function(t){return h(t)},e.allocUnsafeSlow=function(t){return h(t)},e.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==e.prototype},e.compare=function(t,r){if(H(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),H(r,Uint8Array)&&(r=e.from(r,r.offset,r.byteLength)),!e.isBuffer(t)||!e.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var n=t.length,o=r.length,i=0,s=Math.min(n,o);i<s;++i)if(t[i]!==r[i]){n=t[i],o=r[i];break}return n<o?-1:o<n?1:0},e.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},e.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return e.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<t.length;++n)r+=t[n].length;var o=e.allocUnsafe(r),i=0;for(n=0;n<t.length;++n){var s=t[n];if(H(s,Uint8Array)&&(s=e.from(s)),!e.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(o,i),i+=s.length}return o},e.byteLength=f,e.prototype._isBuffer=!0,e.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},e.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},e.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},e.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?C(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return B(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return w(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},i&&(e.prototype[i]=e.prototype.inspect),e.prototype.compare=function(t,r,n,o,i){if(H(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),r<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===t)return 0;for(var s=i-o,a=n-r,u=Math.min(s,a),c=this.slice(o,i),h=t.slice(r,n),l=0;l<u;++l)if(c[l]!==h[l]){s=c[l],a=h[l];break}return s<a?-1:a<s?1:0},e.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},e.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},e.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},e.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function T(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function A(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function B(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=j(t[i]);return o}function O(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function x(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function I(t,r,n,o,i,s){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<s)throw new RangeError('"value" argument is out of bounds');if(n+o>t.length)throw new RangeError("Index out of range")}function D(t,e,r,n){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,8),o.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;t=~~t,r=void 0===r?n:~~r,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),r<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t);var o=this.subarray(t,r);return Object.setPrototypeOf(o,e.prototype),o},e.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},e.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},e.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||x(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||x(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||x(t,4,this.length),o.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),o.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),o.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),o.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},e.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);I(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);I(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,o){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),o||0===o||(o=this.length),r>=t.length&&(r=t.length),r||(r=0),o>0&&o<n&&(o=n),o===n)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-r<o-n&&(o=t.length-r+n);var i=o-n;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(r,n,o);else if(this===t&&n<r&&r<o)for(var s=i-1;s>=0;--s)t[s+r]=this[s+n];else Uint8Array.prototype.set.call(t,this.subarray(n,o),r);return i},e.prototype.fill=function(t,r,n,o){if("string"==typeof t){if("string"==typeof r?(o=r,r=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!e.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;var s;if(r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=r;s<n;++s)this[s]=t;else{var a=e.isBuffer(t)?t:e.from(t,o),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=a[s%u]}return this};var P=/[^+/0-9A-Za-z-_]/g;function j(t){return t<16?"0"+t.toString(16):t.toString(16)}function U(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function R(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function G(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":10,buffer:11,ieee754:13}],12:[function(t,e){e.exports=class{async next(t){let e=this.createConsumer(t),r=await e.next();return e.return(),r}async once(t){let e=await this.next(t);return e.done&&await new Promise(()=>{}),e.value}createConsumer(){throw new TypeError("Method must be overriden by subclass")}createConsumable(t){let e=this.createConsumer(t);return{[Symbol.asyncIterator]:()=>e}}[Symbol.asyncIterator](){return this.createConsumer()}}},{}],13:[function(t,e,r){r.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,c=u>>1,h=-7,l=r?o-1:0,p=r?-1:1,f=t[e+l];for(l+=p,i=f&(1<<-h)-1,f>>=-h,h+=a;h>0;i=256*i+t[e+l],l+=p,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=p,h-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),i-=c}return(f?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var s,a,u,c=8*i-o-1,h=(1<<c)-1,l=h>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?p/u:p*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*u-1)*Math.pow(2,o),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;t[r+f]=255&a,f+=d,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;t[r+f]=255&s,f+=d,s/=256,c-=8);t[r+f-d]|=128*m}},{}],14:[function(t,e){"use strict";var r="An argument without append, prepend, or detach methods was given to `List";function n(){if(arguments.length)return n.from(arguments)}var o=n.prototype;function i(){}n.of=function(){return n.from.call(this,arguments)},n.from=function(t){var e,r,n,o=new this;if(t&&(e=t.length))for(r=-1;++r<e;)null!==(n=t[r])&&void 0!==n&&o.append(n);return o},o.head=null,o.tail=null,o.toArray=function(){for(var t=this.head,e=[];t;)e.push(t),t=t.next;return e},o.prepend=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(r+"#prepend`.");var e;return this,(e=this.head)?e.prepend(t):(t.detach(),t.list=this,this.head=t,t)},o.append=function(t){if(!t)return!1;if(!t.append||!t.prepend||!t.detach)throw new Error(r+"#append`.");var e,n;return this,(n=this.tail)?n.append(t):(e=this.head)?e.append(t):(t.detach(),t.list=this,this.head=t,t)},n.Item=i;var s=i.prototype;s.next=null,s.prev=null,s.list=null,s.detach=function(){var t=this.list,e=this.prev,r=this.next;return t?(t.tail===this&&(t.tail=e),t.head===this&&(t.head=r),t.tail===t.head&&(t.tail=null),e&&(e.next=r),r&&(r.prev=e),this.prev=this.next=this.list=null,this):this},s.prepend=function(t){if(!(t&&t.append&&t.prepend&&t.detach))throw new Error(r+"Item#prepend`.");var e=this.list,n=this.prev;return!!e&&(t.detach(),n&&(t.prev=n,n.next=t),t.next=this,t.list=e,this.prev=t,this===e.head&&(e.head=t),e.tail||(e.tail=this),t)},s.append=function(t){if(!(t&&t.append&&t.prepend&&t.detach))throw new Error(r+"Item#append`.");var e=this.list,n=this.next;return!!e&&(t.detach(),n&&(t.next=n,n.prev=t),t.prev=this,t.list=e,this.next=t,this!==e.tail&&e.tail||(e.tail=t),t)},e.exports=n},{}],15:[function(t,e){"use strict";e.exports=t("./_source/linked-list.js")},{"./_source/linked-list.js":14}],16:[function(t,e,r){(function(t){var n=9007199254740991,o="[object Arguments]",i="[object Boolean]",s="[object Date]",a="[object Function]",u="[object GeneratorFunction]",c="[object Map]",h="[object Number]",l="[object Object]",p="[object RegExp]",f="[object Set]",d="[object String]",m="[object Symbol]",y="[object ArrayBuffer]",g="[object DataView]",b="[object Float32Array]",v="[object Float64Array]",_="[object Int8Array]",k="[object Int16Array]",E="[object Int32Array]",w="[object Uint8Array]",C="[object Uint8ClampedArray]",S="[object Uint16Array]",T="[object Uint32Array]",A=/\w*$/,B=/^\[object .+?Constructor\]$/,O=/^(?:0|[1-9]\d*)$/,x={};x[o]=x["[object Array]"]=x[y]=x[g]=x[i]=x[s]=x[b]=x[v]=x[_]=x[k]=x[E]=x[c]=x[h]=x[l]=x[p]=x[f]=x[d]=x[m]=x[w]=x[C]=x[S]=x[T]=!0,x["[object Error]"]=x[a]=x["[object WeakMap]"]=!1;var I="object"==typeof t&&t&&t.Object===Object&&t,D="object"==typeof self&&self&&self.Object===Object&&self,L=I||D||Function("return this")(),N="object"==typeof r&&r&&!r.nodeType&&r,P=N&&"object"==typeof e&&e&&!e.nodeType&&e,j=P&&P.exports===N;function U(t,e){return t.set(e[0],e[1]),t}function R(t,e){return t.add(e),t}function M(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function H(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function G(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function $(t,e){return function(r){return t(e(r))}}function F(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}var q,z=Array.prototype,V=Function.prototype,W=Object.prototype,K=L["__core-js_shared__"],Y=(q=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+q:"",J=V.toString,X=W.hasOwnProperty,Z=W.toString,Q=RegExp("^"+J.call(X).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tt=j?L.Buffer:void 0,et=L.Symbol,rt=L.Uint8Array,nt=$(Object.getPrototypeOf,Object),ot=Object.create,it=W.propertyIsEnumerable,st=z.splice,at=Object.getOwnPropertySymbols,ut=tt?tt.isBuffer:void 0,ct=$(Object.keys,Object),ht=Pt(L,"DataView"),lt=Pt(L,"Map"),pt=Pt(L,"Promise"),ft=Pt(L,"Set"),dt=Pt(L,"WeakMap"),mt=Pt(Object,"create"),yt=Ht(ht),gt=Ht(lt),bt=Ht(pt),vt=Ht(ft),_t=Ht(dt),kt=et?et.prototype:void 0,Et=kt?kt.valueOf:void 0;function wt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ct(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function St(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){this.__data__=new Ct(t)}function At(t,e){var r=$t(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Ft(t)}(t)&&X.call(t,"callee")&&(!it.call(t,"callee")||Z.call(t)==o)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length;for(var i in t)!e&&!X.call(t,i)||n&&("length"==i||Rt(i,n))||r.push(i);return r}function Bt(t,e,r){var n=t[e];X.call(t,e)&&Gt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Ot(t,e){for(var r=t.length;r--;)if(Gt(t[r][0],e))return r;return-1}function xt(t,e,r,n,B,O,I){var D;if(n&&(D=O?n(t,B,O,I):n(t)),void 0!==D)return D;if(!Vt(t))return t;var L=$t(t);if(L){if(D=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&X.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(t,D)}else{var N=Ut(t),P=N==a||N==u;if(qt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(N==l||N==o||P&&!O){if(H(t))return O?t:{};if(D=function(t){return"function"!=typeof t.constructor||Mt(t)?{}:(e=nt(t),Vt(e)?ot(e):{});var e}(P?{}:t),!e)return function(t,e){return Lt(t,jt(t),e)}(t,function(t,e){return t&&Lt(e,Wt(e),t)}(D,t))}else{if(!x[N])return O?t:{};D=function(t,e,r,n){var o=t.constructor;switch(e){case y:return Dt(t);case i:case s:return new o(+t);case g:return function(t,e){var r=e?Dt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case b:case v:case _:case k:case E:case w:case C:case S:case T:return function(t,e){var r=e?Dt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case c:return function(t,e,r){return M(e?r(G(t),!0):G(t),U,new t.constructor)}(t,n,r);case h:case d:return new o(t);case p:return(l=new(u=t).constructor(u.source,A.exec(u))).lastIndex=u.lastIndex,l;case f:return function(t,e,r){return M(e?r(F(t),!0):F(t),R,new t.constructor)}(t,n,r);case m:return a=t,Et?Object(Et.call(a)):{}}var a;var u,l}(t,N,xt,e)}}I||(I=new Tt);var j=I.get(t);if(j)return j;if(I.set(t,D),!L)var $=r?function(t){return function(t,e,r){var n=e(t);return $t(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Wt,jt)}(t):Wt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}($||t,function(o,i){$&&(o=t[i=o]),Bt(D,i,xt(o,e,r,n,i,t,I))}),D}function It(t){return!(!Vt(t)||Y&&Y in t)&&(zt(t)||H(t)?Q:B).test(Ht(t))}function Dt(t){var e=new t.constructor(t.byteLength);return new rt(e).set(new rt(t)),e}function Lt(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var s=e[o],a=n?n(r[s],t[s],s,r,t):void 0;Bt(r,s,void 0===a?t[s]:a)}return r}function Nt(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Pt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return It(r)?r:void 0}wt.prototype.clear=function(){this.__data__=mt?mt(null):{}},wt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},wt.prototype.get=function(t){var e=this.__data__;if(mt){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return X.call(e,t)?e[t]:void 0},wt.prototype.has=function(t){var e=this.__data__;return mt?void 0!==e[t]:X.call(e,t)},wt.prototype.set=function(t,e){return this.__data__[t]=mt&&void 0===e?"__lodash_hash_undefined__":e,this},Ct.prototype.clear=function(){this.__data__=[]},Ct.prototype.delete=function(t){var e=this.__data__,r=Ot(e,t);return!(r<0)&&(r==e.length-1?e.pop():st.call(e,r,1),!0)},Ct.prototype.get=function(t){var e=this.__data__,r=Ot(e,t);return r<0?void 0:e[r][1]},Ct.prototype.has=function(t){return Ot(this.__data__,t)>-1},Ct.prototype.set=function(t,e){var r=this.__data__,n=Ot(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},St.prototype.clear=function(){this.__data__={hash:new wt,map:new(lt||Ct),string:new wt}},St.prototype.delete=function(t){return Nt(this,t).delete(t)},St.prototype.get=function(t){return Nt(this,t).get(t)},St.prototype.has=function(t){return Nt(this,t).has(t)},St.prototype.set=function(t,e){return Nt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new Ct},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Ct){var n=r.__data__;if(!lt||n.length<199)return n.push([t,e]),this;r=this.__data__=new St(n)}return r.set(t,e),this};var jt=at?$(at,Object):function(){return[]},Ut=function(t){return Z.call(t)};function Rt(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||O.test(t))&&t>-1&&t%1==0&&t<e}function Mt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||W)}function Ht(t){if(null!=t){try{return J.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Gt(t,e){return t===e||t!=t&&e!=e}(ht&&Ut(new ht(new ArrayBuffer(1)))!=g||lt&&Ut(new lt)!=c||pt&&"[object Promise]"!=Ut(pt.resolve())||ft&&Ut(new ft)!=f||dt&&"[object WeakMap]"!=Ut(new dt))&&(Ut=function(t){var e=Z.call(t),r=e==l?t.constructor:void 0,n=r?Ht(r):void 0;if(n)switch(n){case yt:return g;case gt:return c;case bt:return"[object Promise]";case vt:return f;case _t:return"[object WeakMap]"}return e});var $t=Array.isArray;function Ft(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}(t.length)&&!zt(t)}var qt=ut||function(){return!1};function zt(t){var e=Vt(t)?Z.call(t):"";return e==a||e==u}function Vt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return Ft(t)?At(t):function(t){if(!Mt(t))return ct(t);var e=[];for(var r in Object(t))X.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}e.exports=function(t){return xt(t,!0,!0)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],17:[function(t,e){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,o,i){e=e||"&",o=o||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var h=0;h<c;++h){var l,p,f,d,m=t[h].replace(a,"%20"),y=m.indexOf(o);y>=0?(l=m.substr(0,y),p=m.substr(y+1)):(l=m,p=""),f=decodeURIComponent(l),d=decodeURIComponent(p),r(s,f)?n(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],18:[function(t,e){"use strict";var r=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,s,a){return e=e||"&",s=s||"=",null===t&&(t=void 0),"object"==typeof t?o(i(t),function(i){var a=encodeURIComponent(r(i))+s;return n(t[i])?o(t[i],function(t){return a+encodeURIComponent(r(t))}).join(e):a+encodeURIComponent(r(t[i]))}).join(e):a?encodeURIComponent(r(a))+s+encodeURIComponent(r(t)):""};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var i=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},{}],19:[function(t,e,r){"use strict";r.decode=r.parse=t("./decode"),r.encode=r.stringify=t("./encode")},{"./decode":17,"./encode":18}],20:[function(t,e){e.exports=function(t){var e=[],r=[];return function t(n,o){var i,s,a;if(!("object"!=typeof n||null===n||n instanceof Boolean||n instanceof Date||n instanceof Number||n instanceof RegExp||n instanceof String)){for(i=0;i<e.length;i+=1)if(e[i]===n)return{$ref:r[i]};if(e.push(n),r.push(o),"[object Array]"===Object.prototype.toString.apply(n))for(a=[],i=0;i<n.length;i+=1)a[i]=t(n[i],o+"["+i+"]");else for(s in a={},n)Object.prototype.hasOwnProperty.call(n,s)&&(a[s]=t(n[s],o+"["+JSON.stringify(s)+"]"));return a}return n}(t,"$")}},{}],21:[function(t,e){var r=t("./decycle"),n=function(){return!this}();function o(t,e){this.name="AuthTokenExpiredError",this.message=t,this.expiry=e,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function i(t){this.name="AuthTokenInvalidError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function s(t,e){this.name="AuthTokenNotBeforeError",this.message=t,this.date=e,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function a(t){this.name="AuthTokenError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function u(t){this.name="AuthError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function c(t,e){this.name="SilentMiddlewareBlockedError",this.message=t,this.type=e,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function h(t){this.name="InvalidActionError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function l(t){this.name="InvalidArgumentsError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function p(t){this.name="InvalidOptionsError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function f(t){this.name="InvalidMessageError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function d(t,e){this.name="SocketProtocolError",this.message=t,this.code=e,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function m(t){this.name="ServerProtocolError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function y(t){this.name="HTTPServerError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function g(t){this.name="ResourceLimitError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function b(t){this.name="TimeoutError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function v(t,e){this.name="BadConnectionError",this.message=t,this.type=e,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function _(t){this.name="BrokerError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function k(t,e){this.name="ProcessExitError",this.message=t,this.code=e,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}function E(t){this.name="UnknownError",this.message=t,Error.captureStackTrace&&!n?Error.captureStackTrace(this,arguments.callee):this.stack=(new Error).stack}o.prototype=Object.create(Error.prototype),i.prototype=Object.create(Error.prototype),s.prototype=Object.create(Error.prototype),a.prototype=Object.create(Error.prototype),u.prototype=Object.create(Error.prototype),c.prototype=Object.create(Error.prototype),h.prototype=Object.create(Error.prototype),l.prototype=Object.create(Error.prototype),p.prototype=Object.create(Error.prototype),f.prototype=Object.create(Error.prototype),d.prototype=Object.create(Error.prototype),m.prototype=Object.create(Error.prototype),y.prototype=Object.create(Error.prototype),g.prototype=Object.create(Error.prototype),b.prototype=Object.create(Error.prototype),v.prototype=Object.create(Error.prototype),_.prototype=Object.create(Error.prototype),k.prototype=Object.create(Error.prototype),E.prototype=Object.create(Error.prototype),e.exports={AuthTokenExpiredError:o,AuthTokenInvalidError:i,AuthTokenNotBeforeError:s,AuthTokenError:a,AuthError:u,SilentMiddlewareBlockedError:c,InvalidActionError:h,InvalidArgumentsError:l,InvalidOptionsError:p,InvalidMessageError:f,SocketProtocolError:d,ServerProtocolError:m,HTTPServerError:y,ResourceLimitError:g,TimeoutError:b,BadConnectionError:v,BrokerError:_,ProcessExitError:k,UnknownError:E},e.exports.socketProtocolErrorStatuses={1001:"Socket was disconnected",1002:"A WebSocket protocol error was encountered",1003:"Server terminated socket because it received invalid data",1005:"Socket closed without status code",1006:"Socket hung up",1007:"Message format was incorrect",1008:"Encountered a policy violation",1009:"Message was too big to process",1010:"Client ended the connection because the server did not comply with extension requirements",1011:"Server encountered an unexpected fatal condition",4000:"Server ping timed out",4001:"Client pong timed out",4002:"Server failed to sign auth token",4003:"Failed to complete handshake",4004:"Client failed to save auth token",4005:"Did not receive #handshake from client before timeout",4006:"Failed to bind socket to message broker",4007:"Client connection establishment timed out",4008:"Server rejected handshake from client",4009:"Server received a message before the client handshake"},e.exports.socketProtocolIgnoreStatuses={1000:"Socket closed normally",1001:"Socket hung up"};var w={domain:1,domainEmitter:1,domainThrown:1};e.exports.dehydrateError=function(t,e){var n;if(t&&"object"==typeof t)for(var o in n={message:t.message},e&&(n.stack=t.stack),t)w[o]||(n[o]=t[o]);else n="function"==typeof t?"[function "+(t.name||"anonymous")+"]":t;return r(n)},e.exports.hydrateError=function(t){var e=null;if(null!=t)if("object"==typeof t)for(var r in e=new Error(t.message),t)t.hasOwnProperty(r)&&(e[r]=t[r]);else e=t;return e},e.exports.decycle=r},{"./decycle":20}],22:[function(t,e){(function(t){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=/^[ \n\r\t]*[{\[]/,o=function(e,n){if(t.ArrayBuffer&&n instanceof t.ArrayBuffer)return{base64:!0,data:function(t){for(var e=new Uint8Array(t),n=e.length,o="",i=0;i<n;i+=3)o+=r[e[i]>>2],o+=r[(3&e[i])<<4|e[i+1]>>4],o+=r[(15&e[i+1])<<2|e[i+2]>>6],o+=r[63&e[i+2]];return n%3==2?o=o.substring(0,o.length-1)+"=":n%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(n)};if(t.Buffer){if(n instanceof t.Buffer)return{base64:!0,data:n.toString("base64")};if(n&&"Buffer"===n.type&&Array.isArray(n.data))return{base64:!0,data:(t.Buffer.from?t.Buffer.from(n.data):new t.Buffer(n.data)).toString("base64")}}return n};e.exports.decode=function(t){if(null==t)return null;if("#1"===t||"#2"===t)return t;var e=t.toString();if(!n.test(e))return e;try{return JSON.parse(e)}catch(t){}return e},e.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,o)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(t,e){const r=t("consumable-stream");e.exports=class extends r{constructor(t,e){super(),this.name=e,this._streamDemux=t}createConsumer(t){return this._streamDemux.createConsumer(this.name,t)}}},{"consumable-stream":12}],24:[function(t,e){const r=t("writable-consumable-stream"),n=t("./demuxed-consumable-stream");e.exports=class{constructor(){this._mainStream=new r}write(t,e){this._mainStream.write({stream:t,data:{value:e,done:!1}})}close(t,e){this._mainStream.write({stream:t,data:{value:e,done:!0}})}closeAll(t){this._mainStream.close(t)}writeToConsumer(t,e){this._mainStream.writeToConsumer(t,{consumerId:t,data:{value:e,done:!1}})}closeConsumer(t,e){this._mainStream.closeConsumer(t,{consumerId:t,data:{value:e,done:!0}})}getConsumerStats(t){return this._mainStream.getConsumerStats(t)}getConsumerStatsList(t){return this._mainStream.getConsumerStatsList().filter(e=>e.stream===t)}getConsumerStatsListAll(){return this._mainStream.getConsumerStatsList()}kill(t,e){let r=this.getConsumerStatsList(t),n=r.length;for(let t=0;t<n;t++)this.killConsumer(r[t].id,e)}killAll(t){this._mainStream.kill(t)}killConsumer(t,e){this._mainStream.killConsumer(t,e)}getBackpressure(t){let e=this.getConsumerStatsList(t),r=e.length,n=0;for(let t=0;t<r;t++){let r=e[t];r.backpressure>n&&(n=r.backpressure)}return n}getBackpressureAll(){return this._mainStream.getBackpressure()}getConsumerBackpressure(t){return this._mainStream.getConsumerBackpressure(t)}hasConsumer(t,e){let r=this._mainStream.getConsumerStats(e);return!!r&&r.stream===t}hasConsumerAll(t){return this._mainStream.hasConsumer(t)}createConsumer(t,e){let r=this._mainStream.createConsumer(e),n=r.next;r.next=async function(){for(;;){let e=await n.apply(this,arguments);if(e.value&&(e.value.stream===t||e.value.consumerId===this.id))return e.value.data.done&&this.return(),e.value.data;if(e.done)return e}};let o=r.getStats;r.getStats=function(){let e=o.apply(this,arguments);return e.stream=t,e};let i=r.applyBackpressure;r.applyBackpressure=function(e){!e.value||e.value.stream!==t&&e.value.consumerId!==this.id?e.done&&i.apply(this,arguments):i.apply(this,arguments)};let s=r.releaseBackpressure;return r.releaseBackpressure=function(e){!e.value||e.value.stream!==t&&e.value.consumerId!==this.id?e.done&&s.apply(this,arguments):s.apply(this,arguments)},r}stream(t){return new n(this,t)}}},{"./demuxed-consumable-stream":23,"writable-consumable-stream":31}],25:[function(t,e){var r=t("./v1"),n=t("./v4"),o=n;o.v1=r,o.v4=n,e.exports=o},{"./v1":28,"./v4":29}],26:[function(t,e){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);e.exports=function(t,e){var n=e||0,o=r;return[o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]]].join("")}},{}],27:[function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);e.exports=function(){return r(n),n}}else{var o=new Array(16);e.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},{}],28:[function(t,e){var r,n,o=t("./lib/rng"),i=t("./lib/bytesToUuid"),s=0,a=0;e.exports=function(t,e,u){var c=e&&u||0,h=e||[],l=(t=t||{}).node||r,p=void 0!==t.clockseq?t.clockseq:n;if(null==l||null==p){var f=o();null==l&&(l=r=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==p&&(p=n=16383&(f[6]<<8|f[7]))}var d=void 0!==t.msecs?t.msecs:(new Date).getTime(),m=void 0!==t.nsecs?t.nsecs:a+1,y=d-s+(m-a)/1e4;if(y<0&&void 0===t.clockseq&&(p=p+1&16383),(y<0||d>s)&&void 0===t.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=d,a=m,n=p;var g=(1e4*(268435455&(d+=122192928e5))+m)%4294967296;h[c++]=g>>>24&255,h[c++]=g>>>16&255,h[c++]=g>>>8&255,h[c++]=255&g;var b=d/4294967296*1e4&268435455;h[c++]=b>>>8&255,h[c++]=255&b,h[c++]=b>>>24&15|16,h[c++]=b>>>16&255,h[c++]=p>>>8|128,h[c++]=255&p;for(var v=0;v<6;++v)h[c+v]=l[v];return e||i(h)}},{"./lib/bytesToUuid":26,"./lib/rng":27}],29:[function(t,e){var r=t("./lib/rng"),n=t("./lib/bytesToUuid");e.exports=function(t,e,o){var i=e&&o||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var s=(t=t||{}).random||(t.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[i+a]=s[a];return e||n(s)}},{"./lib/bytesToUuid":26,"./lib/rng":27}],30:[function(t,e){e.exports=class{constructor(t,e,r,n){this.id=e,this._backpressure=0,this.stream=t,this.currentNode=r,this.timeout=n,this._isIterating=!1,this.stream.setConsumer(this.id,this)}getStats(){let t={id:this.id,backpressure:this._backpressure};return null!=this.timeout&&(t.timeout=this.timeout),t}resetBackpressure(){this._backpressure=0}applyBackpressure(t){this._backpressure++}releaseBackpressure(t){this._backpressure--}getBackpressure(){return this._backpressure}write(t){void 0!==this._timeoutId&&(clearTimeout(this._timeoutId),delete this._timeoutId),this.applyBackpressure(t),this._resolve&&(this._resolve(),delete this._resolve)}kill(t){void 0!==this._timeoutId&&(clearTimeout(this._timeoutId),delete this._timeoutId),this._isIterating?(this._killPacket={value:t,done:!0},this.applyBackpressure(this._killPacket)):(this.stream.removeConsumer(this.id),this.resetBackpressure()),this._resolve&&(this._resolve(),delete this._resolve)}async _waitForNextItem(t){return new Promise((e,r)=>{let n;if(this._resolve=e,void 0!==t){let e=new Error("Stream consumer iteration timed out");(async()=>{let o=function(t){let e,r=new Promise(r=>{e=setTimeout(r,t)});return{timeoutId:e,promise:r}}(t);n=o.timeoutId,await o.promise,e.name="TimeoutError",delete this._resolve,r(e)})()}this._timeoutId=n})}async next(){for(this._isIterating=!0,this.stream.setConsumer(this.id,this);;){if(!this.currentNode.next)try{await this._waitForNextItem(this.timeout)}catch(t){throw this._isIterating=!1,this.stream.removeConsumer(this.id),t}if(this._killPacket){this._isIterating=!1,this.stream.removeConsumer(this.id),this.resetBackpressure();let t=this._killPacket;return delete this._killPacket,t}if(this.currentNode=this.currentNode.next,this.releaseBackpressure(this.currentNode.data),!this.currentNode.consumerId||this.currentNode.consumerId===this.id)return this.currentNode.data.done&&(this._isIterating=!1,this.stream.removeConsumer(this.id)),this.currentNode.data}}return(){return delete this.currentNode,this._isIterating=!1,this.stream.removeConsumer(this.id),this.resetBackpressure(),{}}}},{}],31:[function(t,e){const r=t("consumable-stream"),n=t("./consumer");e.exports=class extends r{constructor(){super(),this.nextConsumerId=1,this._consumers={},this._tailNode={next:null,data:{value:void 0,done:!1}}}_write(t,e,r){let n={data:{value:t,done:e},next:null};r&&(n.consumerId=r),this._tailNode.next=n,this._tailNode=n;let o=Object.values(this._consumers),i=o.length;for(let t=0;t<i;t++){o[t].write(n.data)}}write(t){this._write(t,!1)}close(t){this._write(t,!0)}writeToConsumer(t,e){this._write(e,!1,t)}closeConsumer(t,e){this._write(e,!0,t)}kill(t){let e=Object.keys(this._consumers),r=e.length;for(let n=0;n<r;n++)this.killConsumer(e[n],t)}killConsumer(t,e){let r=this._consumers[t];r&&r.kill(e)}getBackpressure(){let t=Object.values(this._consumers),e=t.length,r=0;for(let n=0;n<e;n++){let e=t[n].getBackpressure();e>r&&(r=e)}return r}getConsumerBackpressure(t){let e=this._consumers[t];return e?e.getBackpressure():0}hasConsumer(t){return!!this._consumers[t]}setConsumer(t,e){this._consumers[t]=e,e.currentNode||(e.currentNode=this._tailNode)}removeConsumer(t){delete this._consumers[t]}getConsumerStats(t){let e=this._consumers[t];if(e)return e.getStats()}getConsumerStatsList(){let t=[],e=Object.values(this._consumers),r=e.length;for(let n=0;n<r;n++){let r=e[n];t.push(r.getStats())}return t}createConsumer(t){return new n(this,this.nextConsumerId++,this._tailNode,t)}}},{"./consumer":30,"consumable-stream":12}],"asyngular-client":[function(t,e){const r=t("./lib/clientsocket"),n=t("./lib/factory");e.exports.factory=n,e.exports.AGClientSocket=r,e.exports.create=function(t){return n.create({...t,version:"6.2.4"})},e.exports.version="6.2.4"},{"./lib/clientsocket":2,"./lib/factory":3}]},{},["asyngular-client"])("asyngular-client")});