Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

centrifuge

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

centrifuge - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

2

bower.json
{
"name": "centrifuge",
"version": "1.3.4",
"version": "1.3.5",
"ignore": [

@@ -5,0 +5,0 @@ "gulp",

@@ -1,2 +0,2 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.Centrifuge=e()}}(function(){var e;return function t(e,n,r){function i(o,c){if(!n[o]){if(!e[o]){var a="function"==typeof require&&require;if(!c&&a)return a(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var h=n[o]={exports:{}};e[o][0].call(h.exports,function(t){var n=e[o][1][t];return i(n?n:t)},h,h.exports,t,e,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t){function n(){}var r=t.exports={};r.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.MutationObserver,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};var r=[];if(t){var i=document.createElement("div"),s=new MutationObserver(function(){var e=r.slice();r.length=0,e.forEach(function(e){e()})});return s.observe(i,{attributes:!0}),function(e){r.length||i.setAttribute("yes","no"),r.push(e)}}return n?(window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),r.length>0)){var n=r.shift();n()}},!0),function(e){r.push(e),window.postMessage("process-tick","*")}):function(e){setTimeout(e,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],2:[function(t,n){(function(r,i){(function(){"use strict";function s(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function c(e){return"object"==typeof e&&null!==e}function a(e){V=e}function u(e){$=e}function h(){return function(){r.nextTick(g)}}function f(){return function(){z(g)}}function l(){var e=0,t=new Z(g),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function _(){var e=new MessageChannel;return e.port1.onmessage=g,function(){e.port2.postMessage(0)}}function d(){return function(){setTimeout(g,1)}}function g(){for(var e=0;Y>e;e+=2){var t=nt[e],n=nt[e+1];t(n),nt[e]=void 0,nt[e+1]=void 0}Y=0}function p(){try{var e=t,n=e("vertx");return z=n.runOnLoop||n.runOnContext,f()}catch(r){return d()}}function b(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function m(){return new TypeError("A promises callback cannot return that same promise.")}function y(e){try{return e.then}catch(t){return ot.error=t,ot}}function w(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function S(e,t,n){$(function(e){var r=!1,i=w(n,t,function(n){r||(r=!0,t!==n?O(e,n):x(e,n))},function(t){r||(r=!0,C(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,C(e,i))},e)}function k(e,t){t._state===it?x(e,t._result):t._state===st?C(e,t._result):R(t,void 0,function(t){O(e,t)},function(t){C(e,t)})}function j(e,t){if(t.constructor===e.constructor)k(e,t);else{var n=y(t);n===ot?C(e,ot.error):void 0===n?x(e,t):o(n)?S(e,t,n):x(e,t)}}function O(e,t){e===t?C(e,v()):s(t)?j(e,t):x(e,t)}function E(e){e._onerror&&e._onerror(e._result),M(e)}function x(e,t){e._state===rt&&(e._result=t,e._state=it,0!==e._subscribers.length&&$(M,e))}function C(e,t){e._state===rt&&(e._state=st,e._result=t,$(E,e))}function R(e,t,n,r){var i=e._subscribers,s=i.length;e._onerror=null,i[s]=t,i[s+it]=n,i[s+st]=r,0===s&&e._state&&$(M,e)}function M(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,s=e._result,o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?L(n,r,i,s):i(s);e._subscribers.length=0}}function A(){this.error=null}function T(e,t){try{return e(t)}catch(n){return ct.error=n,ct}}function L(e,t,n,r){var i,s,c,a,u=o(n);if(u){if(i=T(n,r),i===ct?(a=!0,s=i.error,i=null):c=!0,t===i)return void C(t,m())}else i=r,c=!0;t._state!==rt||(u&&c?O(t,i):a?C(t,s):e===it?x(t,i):e===st&&C(t,i))}function I(e,t){try{t(function(t){O(e,t)},function(t){C(e,t)})}catch(n){C(e,n)}}function P(e,t){var n=this;n._instanceConstructor=e,n.promise=new e(b),n._validateInput(t)?(n._input=t,n.length=t.length,n._remaining=t.length,n._init(),0===n.length?x(n.promise,n._result):(n.length=n.length||0,n._enumerate(),0===n._remaining&&x(n.promise,n._result))):C(n.promise,n._validationError())}function D(e){return new at(this,e).promise}function U(e){function t(e){O(i,e)}function n(e){C(i,e)}var r=this,i=new r(b);if(!K(e))return C(i,new TypeError("You must pass an array to race.")),i;for(var s=e.length,o=0;i._state===rt&&s>o;o++)R(r.resolve(e[o]),void 0,t,n);return i}function q(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(b);return O(n,e),n}function B(e){var t=this,n=new t(b);return C(n,e),n}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function J(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function H(e){this._id=_t++,this._state=void 0,this._result=void 0,this._subscribers=[],b!==e&&(o(e)||N(),this instanceof H||J(),I(this,e))}function F(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=dt)}var X;X=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var z,V,W,K=X,Y=0,$=({}.toString,function(e,t){nt[Y]=e,nt[Y+1]=t,Y+=2,2===Y&&(V?V(g):W())}),G="undefined"!=typeof window?window:void 0,Q=G||{},Z=Q.MutationObserver||Q.WebKitMutationObserver,et="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),tt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);W=et?h():Z?l():tt?_():void 0===G&&"function"==typeof t?p():d();var rt=void 0,it=1,st=2,ot=new A,ct=new A;P.prototype._validateInput=function(e){return K(e)},P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._init=function(){this._result=new Array(this.length)};var at=P;P.prototype._enumerate=function(){for(var e=this,t=e.length,n=e.promise,r=e._input,i=0;n._state===rt&&t>i;i++)e._eachEntry(r[i],i)},P.prototype._eachEntry=function(e,t){var n=this,r=n._instanceConstructor;c(e)?e.constructor===r&&e._state!==rt?(e._onerror=null,n._settledAt(e._state,t,e._result)):n._willSettleAt(r.resolve(e),t):(n._remaining--,n._result[t]=e)},P.prototype._settledAt=function(e,t,n){var r=this,i=r.promise;i._state===rt&&(r._remaining--,e===st?C(i,n):r._result[t]=n),0===r._remaining&&x(i,r._result)},P.prototype._willSettleAt=function(e,t){var n=this;R(e,void 0,function(e){n._settledAt(it,t,e)},function(e){n._settledAt(st,t,e)})};var ut=D,ht=U,ft=q,lt=B,_t=0,dt=H;H.all=ut,H.race=ht,H.resolve=ft,H.reject=lt,H._setScheduler=a,H._setAsap=u,H._asap=$,H.prototype={constructor:H,then:function(e,t){var n=this,r=n._state;if(r===it&&!e||r===st&&!t)return this;var i=new this.constructor(b),s=n._result;if(r){var o=arguments[r-1];$(function(){L(r,i,o,s)})}else R(n,i,e,t);return i},"catch":function(e){return this.then(null,e)}};var gt=F,pt={Promise:dt,polyfill:gt};"function"==typeof e&&e.amd?e(function(){return pt}):"undefined"!=typeof n&&n.exports?n.exports=pt:"undefined"!=typeof this&&(this.ES6Promise=pt),gt()}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:1}],3:[function(t,n){(function(){"use strict";function t(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}var s=t.prototype,o=this,c=o.EventEmitter;s.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},s.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},s.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},s.addListener=function(e,t){var n,i=this.getListenersAsObject(e),s="object"==typeof t;for(n in i)i.hasOwnProperty(n)&&-1===r(i[n],t)&&i[n].push(s?t:{listener:t,once:!1});return this},s.on=i("addListener"),s.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},s.once=i("addOnceListener"),s.defineEvent=function(e){return this.getListeners(e),this},s.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},s.removeListener=function(e,t){var n,i,s=this.getListenersAsObject(e);for(i in s)s.hasOwnProperty(i)&&(n=r(s[i],t),-1!==n&&s[i].splice(n,1));return this},s.off=i("removeListener"),s.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},s.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},s.manipulateListeners=function(e,t,n){var r,i,s=e?this.removeListener:this.addListener,o=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)s.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?s.call(this,r,i):o.call(this,r,i));return this},s.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},s.removeAllListeners=i("removeEvent"),s.emitEvent=function(e,t){var n,r,i,s,o,c=this.getListenersAsObject(e);for(s in c)if(c.hasOwnProperty(s))for(n=c[s].slice(0),i=n.length;i--;)r=n[i],r.once===!0&&this.removeListener(e,r.listener),o=r.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},s.trigger=i("emitEvent"),s.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},s.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},s._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},s._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return o.EventEmitter=c,t},"function"==typeof e&&e.amd?e(function(){return t}):"object"==typeof n&&n.exports?n.exports=t:o.EventEmitter=t}).call(this)},{}],4:[function(e,t){function n(e,t){return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,t.prototype}function r(e,t){try{return e[t]}catch(n){return void 0}}function i(e,t){for(var n=t||{},s=2;s<arguments.length;++s){var o=arguments[s];if(void 0!==o&&null!==o)for(var c in o){var a=r(o,c),u=r(n,c);if(a!==t&&void 0!==a)if(e&&"object"==typeof a&&null!==a)if(a instanceof Array)n[c]=i(e,u instanceof Array?u:[],a);else{var h="object"!=typeof u||u instanceof Array?{}:u;n[c]=i(e,h,a)}else n[c]=a}}return n}function s(e,t){return-1!==e.indexOf(t,e.length-t.length)}function o(e,t){return 0===e.lastIndexOf(t,0)}function c(e){return"/"==e.substring(e.length-1)&&(e=e.substring(0,e.length-1)),e}function a(e){return void 0===e||null===e?!1:"string"==typeof e||e instanceof String}function u(e){return void 0===e||null===e?!1:"function"==typeof e}function h(e,t){if(window.console){var n=window.console[e];u(n)&&n.apply(window.console,t)}}function f(e,t,n){var r=.5*Math.random(),i=t*Math.pow(2,e+1);return i>n&&(i=n),Math.floor((1-r)*i)}function l(e){return"error"in e&&null!==e.error&&""!==e.error}function _(e){this._sockjs=!1,this._status="disconnected",this._reconnect=!0,this._reconnecting=!1,this._transport=null,this._transportName=null,this._messageId=0,this._clientID=null,this._subs={},this._lastMessageID={},this._messages=[],this._isBatching=!1,this._isAuthBatching=!1,this._authChannels={},this._refreshTimeout=null,this._retries=0,this._callbacks={},this._latency=null,this._latencyStart=null,this._config={retry:1e3,maxRetry:2e4,timeout:5e3,info:"",resubscribe:!0,debug:!1,insecure:!1,server:null,privateChannelPrefix:"$",transports:["websocket","xdr-streaming","xhr-streaming","eventsource","iframe-eventsource","iframe-htmlfile","xdr-polling","xhr-polling","iframe-xhr-polling","jsonp-polling"],refreshEndpoint:"/centrifuge/refresh/",refreshHeaders:{},refreshParams:{},refreshTransport:"ajax",authEndpoint:"/centrifuge/auth/",authHeaders:{},authParams:{},authTransport:"ajax"},e&&this.configure(e)}function d(e,t,n){this._status=v,this._error=null,this._centrifuge=e,this.channel=t,this._setEvents(n),this._isResubscribe=!1,this._ready=!1,this._promise=null,this._initializePromise()}var g=e("es6-promise").Promise,p=e("wolfy87-eventemitter");Object.create||(Object.create=function(){function e(){}return function(t){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return e.prototype=t,new e}}()),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t,n,r=Object(this),i=r.length>>>0;if(0===i)return-1;if(t=0,arguments.length>1&&(t=Number(arguments[1]),t!=t?t=0:0!=t&&1/0!=t&&t!=-1/0&&(t=(t>0||-1)*Math.floor(Math.abs(t)))),t>=i)return-1;for(n=t>=0?t:Math.max(i-Math.abs(t),0);i>n;n++)if(n in r&&r[n]===e)return n;return-1}),n(_,p),_._authCallbacks={},_._nextAuthCallbackID=1;var b=_.prototype;b._jsonp=function(e,t,n,r,i){n.length>0&&this._log("Only AJAX request allows to send custom headers, it's not possible with JSONP."),self._debug("sending JSONP request to",e);var s=_._nextAuthCallbackID.toString();_._nextAuthCallbackID++;var o=window.document,c=o.createElement("script");_._authCallbacks[s]=function(e){i(!1,e),delete _[s]};var a="";for(var u in t)a.length>0&&(a+="&"),a+=encodeURIComponent(u)+"="+encodeURIComponent(t[u]);var h="Centrifuge._authCallbacks['"+s+"']";c.src=this._config.authEndpoint+"?callback="+encodeURIComponent(h)+"&data="+encodeURIComponent(JSON.stringify(r))+"&"+a;var f=o.getElementsByTagName("head")[0]||o.documentElement;f.insertBefore(c,f.firstChild)},b._ajax=function(e,t,n,r,i){var s=this;s._debug("sending AJAX request to",e);var o=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),c="";for(var a in t)c.length>0&&(c+="&"),c+=encodeURIComponent(a)+"="+encodeURIComponent(t[a]);c.length>0&&(c="?"+c),o.open("POST",e+c,!0),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.setRequestHeader("Content-Type","application/json");for(var u in n)o.setRequestHeader(u,n[u]);return o.onreadystatechange=function(){if(4===o.readyState)if(200===o.status){var e,t=!1;try{e=JSON.parse(o.responseText),t=!0}catch(n){i(!0,"JSON returned was invalid, yet status code was 200. Data was: "+o.responseText)}t&&i(!1,e)}else s._log("Couldn't get auth info from application",o.status),i(!0,o.status)},setTimeout(function(){o.send(JSON.stringify(r))},20),o},b._log=function(){h("info",arguments)},b._debug=function(){this._config.debug===!0&&h("debug",arguments)},b._configure=function(e){if(this._debug("Configuring centrifuge object with",e),e||(e={}),this._config=i(!1,this._config,e),!this._config.url)throw"Missing required configuration parameter 'url' specifying server URL";if(!this._config.user&&""!==this._config.user){if(!this._config.insecure)throw"Missing required configuration parameter 'user' specifying user's unique ID in your application";this._debug("user not found but this is OK for insecure mode - anonymous access will be used"),this._config.user=""}if(!this._config.timestamp){if(!this._config.insecure)throw"Missing required configuration parameter 'timestamp'";this._debug("token not found but this is OK for insecure mode")}if(!this._config.token){if(!this._config.insecure)throw"Missing required configuration parameter 'token' specifying the sign of authorization request";this._debug("timestamp not found but this is OK for insecure mode")}if(this._config.url=c(this._config.url),s(this._config.url,"connection")){if(this._debug("client will connect to SockJS endpoint"),"undefined"==typeof SockJS)throw"include SockJS client library before Centrifuge javascript client library or use raw Websocket connection endpoint";this._sockjs=!0}else s(this._config.url,"connection/websocket")?(this._debug("client will connect to raw Websocket endpoint"),this._config.url=this._config.url.replace("http://","ws://"),this._config.url=this._config.url.replace("https://","wss://")):(this._debug("client will detect connection endpoint itself"),"undefined"==typeof SockJS?(this._debug("no SockJS found, client will connect to raw Websocket endpoint"),this._config.url+="/connection/websocket",this._config.url=this._config.url.replace("http://","ws://"),this._config.url=this._config.url.replace("https://","wss://")):(this._debug("SockJS found, client will connect to SockJS endpoint"),this._config.url+="/connection",this._sockjs=!0))},b._setStatus=function(e){this._status!==e&&(this._debug("Status",this._status,"->",e),this._status=e)},b._isDisconnected=function(){return"disconnected"===this._status},b._isConnecting=function(){return"connecting"===this._status},b._isConnected=function(){return"connected"===this._status},b._nextMessageId=function(){return++this._messageId},b._resetRetry=function(){this._debug("reset retries count to 0"),this._retries=0},b._getRetryInterval=function(){var e=f(this._retries,this._config.retry,this._config.maxRetry);return this._retries+=1,e},b._clearConnectedState=function(e){self._clientID=null;for(var t in this._callbacks){var n=this._callbacks[t],r=n.errback;r&&r(this._createErrorObject("disconnected","retry"))}this._callbacks={};for(var i in this._subs){var s=this._subs[i];e?(s._isSuccess()&&s._triggerUnsubscribe(),s._setSubscribing()):s._setUnsubscribed()}this._config.resubscribe&&this._reconnect||(this._subs={})},b._send=function(e){0!==e.length&&(this._debug("Send",e),this._transport.send(JSON.stringify(e)))},b._connect=function(e){if(this.isConnected())return void this._debug("connect called when already connected");this._setStatus("connecting"),this._clientID=null,this._reconnect=!0;var t=this;if(e&&this.on("connect",e),this._sockjs===!0){var n={transports:this._config.transports};null!==this._config.server&&(n.server=this._config.server),this._transport=new SockJS(this._config.url,null,n)}else this._transport=new WebSocket(this._config.url);this._transport.onopen=function(){t._reconnecting=!1,t._transportName=t._sockjs?t._transport._transport.transportName:"raw-websocket",t._resetRetry(),a(t._config.user)||t._log("user expected to be string"),a(t._config.info)||t._log("info expected to be string");var e={method:"connect",params:{user:t._config.user,info:t._config.info}};t._config.insecure||(e.params.timestamp=t._config.timestamp,e.params.token=t._config.token,a(t._config.timestamp)||t._log("timestamp expected to be string"),a(t._config.token)||t._log("token expected to be string")),t._addMessage(e),t._latencyStart=new Date},this._transport.onerror=function(e){t._debug("transport level error",e)},this._transport.onclose=function(){t._disconnect("connection closed",!0,!1)},this._transport.onmessage=function(e){var n;n=JSON.parse(e.data),t._debug("Received",n),t._receive(n)}},b._disconnect=function(e,t,n){this._debug("disconnected:",e,t);var r=t||!1;if(r===!1&&(this._reconnect=!1),this._clearConnectedState(t),!this.isDisconnected()){this._setStatus("disconnected");var i={reason:e,reconnect:r};this._reconnecting===!1&&this.trigger("disconnect",[i])}n&&this._transport.close();var s=this;if(t===!0&&s._reconnect===!0){s._reconnecting=!0;var o=s._getRetryInterval();s._debug("reconnect after "+o+" milliseconds"),window.setTimeout(function(){s._reconnect===!0&&s._connect.call(s)},o)}},b._refresh=function(){var e=this;this._debug("refresh credentials");var t=function(t,n){if(t===!0)return e._debug("error getting connect parameters",n),e._refreshTimeout&&window.clearTimeout(e._refreshTimeout),void(e._refreshTimeout=window.setTimeout(function(){e._refresh.call(e)},3e3));if(e._config.user=n.user,e._config.timestamp=n.timestamp,e._config.info=n.info,e._config.token=n.token,e.isDisconnected())e._debug("credentials refreshed, connect from scratch"),e._connect();else{e._debug("send refreshed credentials");var r={method:"refresh",params:{user:e._config.user,timestamp:e._config.timestamp,info:e._config.info,token:e._config.token}};e._addMessage(r)}},n=this._config.refreshTransport.toLowerCase();if("ajax"===n)this._ajax(this._config.refreshEndpoint,this._config.refreshParams,this._config.refreshHeaders,{},t);else{if("jsonp"!==n)throw"Unknown refresh transport "+n;this._jsonp(this._config.refreshEndpoint,this._config.refreshParams,this._config.refreshHeaders,{},t)}},b._subscribe=function(e){var t=e.channel;if(t in this._subs||(this._subs[t]=e),!this.isConnected())return void e._setNew();e._setSubscribing();var n={method:"subscribe",params:{channel:t}};if(o(t,this._config.privateChannelPrefix))this._isAuthBatching?this._authChannels[t]=!0:(this.startAuthBatching(),this._subscribe(e),this.stopAuthBatching());else{var r=this._recover(t);r===!0&&(n.params.recover=!0,n.params.last=this._getLastID(t)),this._addMessage(n)}},b._unsubscribe=function(e){if(this.isConnected()){var t={method:"unsubscribe",params:{channel:e.channel}};this._addMessage(t)}},b._getSub=function(e){var t=this._subs[e];return t?t:null},b._connectResponse=function(e){if(!this.isConnected())if(l(e))this.trigger("error",[{message:e}]);else{if(null!==this._latencyStart&&(this._latency=(new Date).getTime()-this._latencyStart.getTime(),this._latencyStart=null),!e.body)return;if(e.body.expires){var t=e.body.expired;if(t)return void this._refresh()}if(this._clientID=e.body.client,this._setStatus("connected"),this._refreshTimeout&&window.clearTimeout(this._refreshTimeout),e.body.expires){var n=this;this._refreshTimeout=window.setTimeout(function(){n._refresh.call(n)},1e3*e.body.ttl)}if(this._config.resubscribe){this.startBatching(),this.startAuthBatching();for(var r in this._subs){var i=this._subs[r];this._subscribe(i)}this.stopAuthBatching(),this.stopBatching(!0)}var s={client:e.body.client,transport:this._transportName,latency:this._latency};this.trigger("connect",[s])}},b._disconnectResponse=function(e){if(l(e))this.trigger("error",[{message:e}]);else{var t=!1;"reconnect"in e.body&&(t=e.body.reconnect);var n="";"reason"in e.body&&(n=e.body.reason),this._disconnect(n,t,!0)}},b._subscribeResponse=function(e){var t=e.body;if(null!==t){var n=t.channel,r=this._getSub(n);if(r&&r._isSubscribing())if(l(e))this.trigger("error",[{message:e}]),r._setSubscribeError(this._errorObjectFromMessage(e));else{r._setSubscribeSuccess();var i=t.messages;if(i&&i.length>0)for(var s in i.reverse())this._messageResponse({body:i[s]});else"last"in t&&(this._lastMessageID[n]=t.last)}}},b._unsubscribeResponse=function(e){var t=e.uid,n=e.body,r=n.channel,i=this._getSub(r);i&&(l(e)?this.trigger("error",[{message:e}]):t||i._setUnsubscribed())},b._publishResponse=function(e){var t=e.uid,n=e.body;if(t in this._callbacks){var r=this._callbacks[t];if(delete this._callbacks[t],l(e)){var i=r.errback;if(!i)return;i(this._errorObjectFromMessage(e)),this.trigger("error",[{message:e}])}else{var s=r.callback;if(!s)return;s(n)}}},b._presenceResponse=function(e){var t=e.uid,n=e.body;if(t in this._callbacks){var r=this._callbacks[t];if(delete this._callbacks[t],l(e)){var i=r.errback;if(!i)return;i(this._errorObjectFromMessage(e)),this.trigger("error",[{message:e}])}else{var s=r.callback;if(!s)return;s(n)}}},b._historyResponse=function(e){var t=e.uid,n=e.body;if(t in this._callbacks){var r=this._callbacks[t];if(delete this._callbacks[t],l(e)){var i=r.errback;if(!i)return;i(this._errorObjectFromMessage(e)),this.trigger("error",[{message:e}])}else{var s=r.callback;if(!s)return;s(n)}}},b._joinResponse=function(e){var t=e.body,n=t.channel,r=this._getSub(n);r&&r.trigger("join",[t])},b._leaveResponse=function(e){var t=e.body,n=t.channel,r=this._getSub(n);r&&r.trigger("leave",[t])},b._messageResponse=function(e){var t=e.body,n=t.channel;this._lastMessageID[n]=t.uid;var r=this._getSub(n);r&&r.trigger("message",[t])},b._refreshResponse=function(e){if(this._refreshTimeout&&window.clearTimeout(this._refreshTimeout),l(e))this.trigger("error",[{message:e}]);else if(e.body.expires){var t=this,n=e.body.expired;if(n)return void(t._refreshTimeout=window.setTimeout(function(){t._refresh.call(t)},3e3+Math.round(1e3*Math.random())));this._clientID=e.body.client,t._refreshTimeout=window.setTimeout(function(){t._refresh.call(t)},1e3*e.body.ttl)}},b._dispatchMessage=function(e){if(void 0===e||null===e)return void this._debug("dispatch: got undefined or null message");var t=e.method;if(!t)return void this._debug("dispatch: got message with empty method");switch(t){case"connect":this._connectResponse(e);break;case"disconnect":this._disconnectResponse(e);break;case"subscribe":this._subscribeResponse(e);break;case"unsubscribe":this._unsubscribeResponse(e);break;case"publish":this._publishResponse(e);break;case"presence":this._presenceResponse(e);break;case"history":this._historyResponse(e);break;case"join":this._joinResponse(e);break;case"leave":this._leaveResponse(e);break;case"ping":break;case"refresh":this._refreshResponse(e);break;case"message":this._messageResponse(e);break;default:this._debug("dispatch: got message with unknown method"+t)}},b._receive=function(e){if(Object.prototype.toString.call(e)===Object.prototype.toString.call([])){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];this._dispatchMessage(n)}}else Object.prototype.toString.call(e)===Object.prototype.toString.call({})&&this._dispatchMessage(e)},b._flush=function(){var e=this._messages.slice(0);this._messages=[],this._send(e)},b._ping=function(){var e={method:"ping",params:{}};this._addMessage(e)},b._recover=function(e){return e in this._lastMessageID},b._getLastID=function(e){var t=this._lastMessageID[e];return t?(this._debug("last uid found and sent for channel",e),t):(this._debug("no last uid found for channel",e),"")},b._createErrorObject=function(e,t){var n={error:e};return t&&(n.advice=t),n},b._errorObjectFromMessage=function(e){var t=e.error,n=e.advice;return this._createErrorObject(t,n)},b._registerCall=function(e,t,n){var r=this;this._callbacks[e]={callback:t,errback:n},setTimeout(function(){delete r._callbacks[e],u(n)&&n(r._createErrorObject("timeout","retry"))},this._config.timeout)},b._addMessage=function(e){var t=""+this._nextMessageId();return e.uid=t,this._isBatching===!0?this._messages.push(e):this._send([e]),t},b.getClientId=function(){return this._clientID},b.isConnected=b._isConnected,b.isDisconnected=b._isDisconnected,b.configure=function(e){this._configure.call(this,e)},b.connect=b._connect,b.disconnect=function(){this._disconnect("client",!1,!0)},b.ping=b._ping,b.startBatching=function(){this._isBatching=!0},b.stopBatching=function(e){e=e||!1,this._isBatching=!1,e===!0&&this.flush()},b.flush=function(){this._flush()},b.startAuthBatching=function(){this._isAuthBatching=!0},b.stopAuthBatching=function(){this._isAuthBatching=!1;var e=this._authChannels;this._authChannels={};var t=[];for(var n in e){var r=this._getSub(n);r&&t.push(n)}if(0!=t.length){var i={client:this.getClientId(),channels:t},s=this,o=function(e,n){if(e!==!0){var r=!1;s._isBatching||(s.startBatching(),r=!0);for(var i in t){var o=t[i],c=n[o];if(c)if(c.status&&200!==c.status)s._subscribeResponse({error:c.status,body:{channel:o}});else{var a={method:"subscribe",params:{channel:o,client:s.getClientId(),info:c.info,sign:c.sign}},u=s._recover(o);u===!0&&(a.params.recover=!0,a.params.last=s._getLastID(o)),s._addMessage(a)}else s._subscribeResponse({error:"channel not found in authorization response",advice:"fix",body:{channel:o}})}r&&s.stopBatching(!0)}else{s._debug("authorization request failed");for(var i in t){var o=t[i];s._subscribeResponse({error:"authorization request failed",advice:"fix",body:{channel:o}})}}},c=this._config.authTransport.toLowerCase();if("ajax"===c)this._ajax(this._config.authEndpoint,this._config.authParams,this._config.authHeaders,i,o);else{if("jsonp"!==c)throw"Unknown auth transport "+c;this._jsonp(this._config.authEndpoint,this._config.authParams,this._config.authHeaders,i,o)}}},b.subscribe=function(e,t){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(!a(e))throw"Illegal argument type: channel must be a string";if(!this._config.resubscribe&&!this.isConnected())throw"Can not only subscribe in connected state when resubscribe option is off";var n=this._getSub(e);if(null!==n)return n._setEvents(t),n._isUnsubscribed()&&n.subscribe(),n;var r=new d(this,e,t);return this._subs[e]=r,r.subscribe(),r};var v=0,m=1,y=2,w=3,S=4;n(d,p);var k=d.prototype;k._initializePromise=function(){this._ready=!1;var e=this;this._promise=new g(function(t,n){e._resolve=function(n){e._ready=!0,t(n)},e._reject=function(t){e._ready=!0,n(t)}})},k._setEvents=function(e){if(e)if(u(e))this.on("message",e);else if(Object.prototype.toString.call(e)===Object.prototype.toString.call({})){var t=["message","join","leave","unsubscribe","subscribe","error"];for(var n in t){var r=t[n];r in e&&this.on(r,e[r])}}},k._isNew=function(){return this._status===v},k._isUnsubscribed=function(){return this._status===S},k._isSubscribing=function(){return this._status===m},k._isReady=function(){return this._status===y||this._status===w},k._isSuccess=function(){return this._status===y},k._isError=function(){return this._status===w},k._setNew=function(){this._status=v},k._setSubscribing=function(){this._ready===!0&&(this._initializePromise(),this._isResubscribe=!0),this._status=m},k._setSubscribeSuccess=function(){if(this._status!=y){this._status=y;var e=this._getSubscribeSuccessContext();this.trigger("subscribe",[e]),this._resolve(e)}},k._setSubscribeError=function(e){if(this._status!=w){this._status=w,this._error=e;var t=this._getSubscribeErrorContext();this.trigger("error",[t]),this._reject(t)}},k._triggerUnsubscribe=function(){var e={channel:this.channel};this.trigger("unsubscribe",[e])},k._setUnsubscribed=function(){this._status!=S&&(this._status=S,this._triggerUnsubscribe())},k._getSubscribeSuccessContext=function(){return{channel:this.channel,isResubscribe:this._isResubscribe}},k._getSubscribeErrorContext=function(){var e=this._error;return e.channel=this.channel,e.isResubscribe=this._isResubscribe,e},k.ready=function(e,t){this._ready&&(this._isSuccess()?e(this._getSubscribeSuccessContext()):t(this._getSubscribeErrorContext()))},k.subscribe=function(){return this._status!=y?(this._centrifuge._subscribe(this),this):void 0},k.unsubscribe=function(){this._setUnsubscribed(),this._centrifuge._unsubscribe(this)},k.publish=function(e){var t=this;return new g(function(n,r){return t._isUnsubscribed()?void r(t._centrifuge._createErrorObject("subscription unsubscribed","fix")):void t._promise.then(function(){if(!t._centrifuge.isConnected())return void r(t._centrifuge._createErrorObject("disconnected","retry"));var i={method:"publish",params:{channel:t.channel,data:e}},s=t._centrifuge._addMessage(i);t._centrifuge._registerCall(s,n,r)},function(e){r(e)})})},k.presence=function(){var e=this;return new g(function(t,n){return e._isUnsubscribed()?void n(e._centrifuge._createErrorObject("subscription unsubscribed","fix")):void e._promise.then(function(){if(!e._centrifuge.isConnected())return void n(e._centrifuge._createErrorObject("disconnected","retry"));var r={method:"presence",params:{channel:e.channel}},i=e._centrifuge._addMessage(r);e._centrifuge._registerCall(i,t,n)
},function(e){n(e)})})},k.history=function(){var e=this;return new g(function(t,n){return e._isUnsubscribed()?void n(e._centrifuge._createErrorObject("subscription unsubscribed","fix")):void e._promise.then(function(){if(!e._centrifuge.isConnected())return void n(e._centrifuge._createErrorObject("disconnected","retry"));var r={method:"history",params:{channel:e.channel}},i=e._centrifuge._addMessage(r);e._centrifuge._registerCall(i,t,n)},function(e){n(e)})})},t.exports=_},{"es6-promise":2,"wolfy87-eventemitter":3}]},{},[4])(4)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.Centrifuge=e()}}(function(){var e;return function t(e,n,r){function i(o,c){if(!n[o]){if(!e[o]){var a="function"==typeof require&&require;if(!c&&a)return a(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[o]={exports:{}};e[o][0].call(f.exports,function(t){var n=e[o][1][t];return i(n?n:t)},f,f.exports,t,e,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t){function n(){}var r=t.exports={};r.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.MutationObserver,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};var r=[];if(t){var i=document.createElement("div"),s=new MutationObserver(function(){var e=r.slice();r.length=0,e.forEach(function(e){e()})});return s.observe(i,{attributes:!0}),function(e){r.length||i.setAttribute("yes","no"),r.push(e)}}return n?(window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),r.length>0)){var n=r.shift();n()}},!0),function(e){r.push(e),window.postMessage("process-tick","*")}):function(e){setTimeout(e,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],2:[function(t,n){(function(r,i){(function(){"use strict";function s(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function c(e){return"object"==typeof e&&null!==e}function a(e){V=e}function u(e){$=e}function f(){return function(){r.nextTick(g)}}function h(){return function(){z(g)}}function l(){var e=0,t=new Z(g),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function _(){var e=new MessageChannel;return e.port1.onmessage=g,function(){e.port2.postMessage(0)}}function d(){return function(){setTimeout(g,1)}}function g(){for(var e=0;Y>e;e+=2){var t=nt[e],n=nt[e+1];t(n),nt[e]=void 0,nt[e+1]=void 0}Y=0}function p(){try{var e=t,n=e("vertx");return z=n.runOnLoop||n.runOnContext,h()}catch(r){return d()}}function b(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function m(){return new TypeError("A promises callback cannot return that same promise.")}function y(e){try{return e.then}catch(t){return ot.error=t,ot}}function w(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function S(e,t,n){$(function(e){var r=!1,i=w(n,t,function(n){r||(r=!0,t!==n?O(e,n):x(e,n))},function(t){r||(r=!0,C(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,C(e,i))},e)}function k(e,t){t._state===it?x(e,t._result):t._state===st?C(e,t._result):R(t,void 0,function(t){O(e,t)},function(t){C(e,t)})}function j(e,t){if(t.constructor===e.constructor)k(e,t);else{var n=y(t);n===ot?C(e,ot.error):void 0===n?x(e,t):o(n)?S(e,t,n):x(e,t)}}function O(e,t){e===t?C(e,v()):s(t)?j(e,t):x(e,t)}function E(e){e._onerror&&e._onerror(e._result),M(e)}function x(e,t){e._state===rt&&(e._result=t,e._state=it,0!==e._subscribers.length&&$(M,e))}function C(e,t){e._state===rt&&(e._state=st,e._result=t,$(E,e))}function R(e,t,n,r){var i=e._subscribers,s=i.length;e._onerror=null,i[s]=t,i[s+it]=n,i[s+st]=r,0===s&&e._state&&$(M,e)}function M(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,s=e._result,o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?L(n,r,i,s):i(s);e._subscribers.length=0}}function A(){this.error=null}function T(e,t){try{return e(t)}catch(n){return ct.error=n,ct}}function L(e,t,n,r){var i,s,c,a,u=o(n);if(u){if(i=T(n,r),i===ct?(a=!0,s=i.error,i=null):c=!0,t===i)return void C(t,m())}else i=r,c=!0;t._state!==rt||(u&&c?O(t,i):a?C(t,s):e===it?x(t,i):e===st&&C(t,i))}function I(e,t){try{t(function(t){O(e,t)},function(t){C(e,t)})}catch(n){C(e,n)}}function P(e,t){var n=this;n._instanceConstructor=e,n.promise=new e(b),n._validateInput(t)?(n._input=t,n.length=t.length,n._remaining=t.length,n._init(),0===n.length?x(n.promise,n._result):(n.length=n.length||0,n._enumerate(),0===n._remaining&&x(n.promise,n._result))):C(n.promise,n._validationError())}function D(e){return new at(this,e).promise}function U(e){function t(e){O(i,e)}function n(e){C(i,e)}var r=this,i=new r(b);if(!K(e))return C(i,new TypeError("You must pass an array to race.")),i;for(var s=e.length,o=0;i._state===rt&&s>o;o++)R(r.resolve(e[o]),void 0,t,n);return i}function q(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(b);return O(n,e),n}function B(e){var t=this,n=new t(b);return C(n,e),n}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function J(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function H(e){this._id=_t++,this._state=void 0,this._result=void 0,this._subscribers=[],b!==e&&(o(e)||N(),this instanceof H||J(),I(this,e))}function F(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=dt)}var X;X=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var z,V,W,K=X,Y=0,$=({}.toString,function(e,t){nt[Y]=e,nt[Y+1]=t,Y+=2,2===Y&&(V?V(g):W())}),G="undefined"!=typeof window?window:void 0,Q=G||{},Z=Q.MutationObserver||Q.WebKitMutationObserver,et="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),tt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);W=et?f():Z?l():tt?_():void 0===G&&"function"==typeof t?p():d();var rt=void 0,it=1,st=2,ot=new A,ct=new A;P.prototype._validateInput=function(e){return K(e)},P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._init=function(){this._result=new Array(this.length)};var at=P;P.prototype._enumerate=function(){for(var e=this,t=e.length,n=e.promise,r=e._input,i=0;n._state===rt&&t>i;i++)e._eachEntry(r[i],i)},P.prototype._eachEntry=function(e,t){var n=this,r=n._instanceConstructor;c(e)?e.constructor===r&&e._state!==rt?(e._onerror=null,n._settledAt(e._state,t,e._result)):n._willSettleAt(r.resolve(e),t):(n._remaining--,n._result[t]=e)},P.prototype._settledAt=function(e,t,n){var r=this,i=r.promise;i._state===rt&&(r._remaining--,e===st?C(i,n):r._result[t]=n),0===r._remaining&&x(i,r._result)},P.prototype._willSettleAt=function(e,t){var n=this;R(e,void 0,function(e){n._settledAt(it,t,e)},function(e){n._settledAt(st,t,e)})};var ut=D,ft=U,ht=q,lt=B,_t=0,dt=H;H.all=ut,H.race=ft,H.resolve=ht,H.reject=lt,H._setScheduler=a,H._setAsap=u,H._asap=$,H.prototype={constructor:H,then:function(e,t){var n=this,r=n._state;if(r===it&&!e||r===st&&!t)return this;var i=new this.constructor(b),s=n._result;if(r){var o=arguments[r-1];$(function(){L(r,i,o,s)})}else R(n,i,e,t);return i},"catch":function(e){return this.then(null,e)}};var gt=F,pt={Promise:dt,polyfill:gt};"function"==typeof e&&e.amd?e(function(){return pt}):"undefined"!=typeof n&&n.exports?n.exports=pt:"undefined"!=typeof this&&(this.ES6Promise=pt),gt()}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:1}],3:[function(t,n){(function(){"use strict";function t(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}var s=t.prototype,o=this,c=o.EventEmitter;s.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},s.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},s.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},s.addListener=function(e,t){var n,i=this.getListenersAsObject(e),s="object"==typeof t;for(n in i)i.hasOwnProperty(n)&&-1===r(i[n],t)&&i[n].push(s?t:{listener:t,once:!1});return this},s.on=i("addListener"),s.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},s.once=i("addOnceListener"),s.defineEvent=function(e){return this.getListeners(e),this},s.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},s.removeListener=function(e,t){var n,i,s=this.getListenersAsObject(e);for(i in s)s.hasOwnProperty(i)&&(n=r(s[i],t),-1!==n&&s[i].splice(n,1));return this},s.off=i("removeListener"),s.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},s.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},s.manipulateListeners=function(e,t,n){var r,i,s=e?this.removeListener:this.addListener,o=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)s.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?s.call(this,r,i):o.call(this,r,i));return this},s.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},s.removeAllListeners=i("removeEvent"),s.emitEvent=function(e,t){var n,r,i,s,o,c=this.getListenersAsObject(e);for(s in c)if(c.hasOwnProperty(s))for(n=c[s].slice(0),i=n.length;i--;)r=n[i],r.once===!0&&this.removeListener(e,r.listener),o=r.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},s.trigger=i("emitEvent"),s.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},s.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},s._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},s._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return o.EventEmitter=c,t},"function"==typeof e&&e.amd?e(function(){return t}):"object"==typeof n&&n.exports?n.exports=t:o.EventEmitter=t}).call(this)},{}],4:[function(e,t){(function(n){function r(e,t){return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,t.prototype}function i(e,t){try{return e[t]}catch(n){return void 0}}function s(e,t){for(var n=t||{},r=2;r<arguments.length;++r){var o=arguments[r];if(void 0!==o&&null!==o)for(var c in o){var a=i(o,c),u=i(n,c);if(a!==t&&void 0!==a)if(e&&"object"==typeof a&&null!==a)if(a instanceof Array)n[c]=s(e,u instanceof Array?u:[],a);else{var f="object"!=typeof u||u instanceof Array?{}:u;n[c]=s(e,f,a)}else n[c]=a}}return n}function o(e,t){return-1!==e.indexOf(t,e.length-t.length)}function c(e,t){return 0===e.lastIndexOf(t,0)}function a(e){return"/"==e.substring(e.length-1)&&(e=e.substring(0,e.length-1)),e}function u(e){return void 0===e||null===e?!1:"string"==typeof e||e instanceof String}function f(e){return void 0===e||null===e?!1:"function"==typeof e}function h(e,t){if(n.console){var r=n.console[e];f(r)&&r.apply(n.console,t)}}function l(e,t,n){var r=.5*Math.random(),i=t*Math.pow(2,e+1);return i>n&&(i=n),Math.floor((1-r)*i)}function _(e){return"error"in e&&null!==e.error&&""!==e.error}function d(e){this._sockjs=!1,this._status="disconnected",this._reconnect=!0,this._reconnecting=!1,this._transport=null,this._transportName=null,this._messageId=0,this._clientID=null,this._subs={},this._lastMessageID={},this._messages=[],this._isBatching=!1,this._isAuthBatching=!1,this._authChannels={},this._refreshTimeout=null,this._retries=0,this._callbacks={},this._latency=null,this._latencyStart=null,this._config={retry:1e3,maxRetry:2e4,timeout:5e3,info:"",resubscribe:!0,debug:!1,insecure:!1,server:null,privateChannelPrefix:"$",transports:["websocket","xdr-streaming","xhr-streaming","eventsource","iframe-eventsource","iframe-htmlfile","xdr-polling","xhr-polling","iframe-xhr-polling","jsonp-polling"],refreshEndpoint:"/centrifuge/refresh/",refreshHeaders:{},refreshParams:{},refreshTransport:"ajax",authEndpoint:"/centrifuge/auth/",authHeaders:{},authParams:{},authTransport:"ajax"},e&&this.configure(e)}function g(e,t,n){this._status=m,this._error=null,this._centrifuge=e,this.channel=t,this._setEvents(n),this._isResubscribe=!1,this._ready=!1,this._promise=null,this._initializePromise()}var p=e("es6-promise").Promise,b=e("wolfy87-eventemitter");Object.create||(Object.create=function(){function e(){}return function(t){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return e.prototype=t,new e}}()),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t,n,r=Object(this),i=r.length>>>0;if(0===i)return-1;if(t=0,arguments.length>1&&(t=Number(arguments[1]),t!=t?t=0:0!=t&&1/0!=t&&t!=-1/0&&(t=(t>0||-1)*Math.floor(Math.abs(t)))),t>=i)return-1;for(n=t>=0?t:Math.max(i-Math.abs(t),0);i>n;n++)if(n in r&&r[n]===e)return n;return-1}),r(d,b),d._authCallbacks={},d._nextAuthCallbackID=1;var v=d.prototype;v._jsonp=function(e,t,r,i,s){r.length>0&&this._log("Only AJAX request allows to send custom headers, it's not possible with JSONP."),self._debug("sending JSONP request to",e);var o=d._nextAuthCallbackID.toString();d._nextAuthCallbackID++;var c=n.document,a=c.createElement("script");d._authCallbacks[o]=function(e){s(!1,e),delete d[o]};var u="";for(var f in t)u.length>0&&(u+="&"),u+=encodeURIComponent(f)+"="+encodeURIComponent(t[f]);var h="Centrifuge._authCallbacks['"+o+"']";a.src=this._config.authEndpoint+"?callback="+encodeURIComponent(h)+"&data="+encodeURIComponent(JSON.stringify(i))+"&"+u;var l=c.getElementsByTagName("head")[0]||c.documentElement;l.insertBefore(a,l.firstChild)},v._ajax=function(e,t,r,i,s){var o=this;o._debug("sending AJAX request to",e);var c=n.XMLHttpRequest?new n.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),a="";for(var u in t)a.length>0&&(a+="&"),a+=encodeURIComponent(u)+"="+encodeURIComponent(t[u]);a.length>0&&(a="?"+a),c.open("POST",e+a,!0),c.setRequestHeader("X-Requested-With","XMLHttpRequest"),c.setRequestHeader("Content-Type","application/json");for(var f in r)c.setRequestHeader(f,r[f]);return c.onreadystatechange=function(){if(4===c.readyState)if(200===c.status){var e,t=!1;try{e=JSON.parse(c.responseText),t=!0}catch(n){s(!0,"JSON returned was invalid, yet status code was 200. Data was: "+c.responseText)}t&&s(!1,e)}else o._log("Couldn't get auth info from application",c.status),s(!0,c.status)},setTimeout(function(){c.send(JSON.stringify(i))},20),c},v._log=function(){h("info",arguments)},v._debug=function(){this._config.debug===!0&&h("debug",arguments)},v._configure=function(e){if(this._debug("Configuring centrifuge object with",e),e||(e={}),this._config=s(!1,this._config,e),!this._config.url)throw"Missing required configuration parameter 'url' specifying server URL";if(!this._config.user&&""!==this._config.user){if(!this._config.insecure)throw"Missing required configuration parameter 'user' specifying user's unique ID in your application";this._debug("user not found but this is OK for insecure mode - anonymous access will be used"),this._config.user=""}if(!this._config.timestamp){if(!this._config.insecure)throw"Missing required configuration parameter 'timestamp'";this._debug("token not found but this is OK for insecure mode")}if(!this._config.token){if(!this._config.insecure)throw"Missing required configuration parameter 'token' specifying the sign of authorization request";this._debug("timestamp not found but this is OK for insecure mode")}if(this._config.url=a(this._config.url),o(this._config.url,"connection")){if(this._debug("client will connect to SockJS endpoint"),"undefined"==typeof SockJS)throw"include SockJS client library before Centrifuge javascript client library or use raw Websocket connection endpoint";this._sockjs=!0}else o(this._config.url,"connection/websocket")?(this._debug("client will connect to raw Websocket endpoint"),this._config.url=this._config.url.replace("http://","ws://"),this._config.url=this._config.url.replace("https://","wss://")):(this._debug("client will detect connection endpoint itself"),"undefined"==typeof SockJS?(this._debug("no SockJS found, client will connect to raw Websocket endpoint"),this._config.url+="/connection/websocket",this._config.url=this._config.url.replace("http://","ws://"),this._config.url=this._config.url.replace("https://","wss://")):(this._debug("SockJS found, client will connect to SockJS endpoint"),this._config.url+="/connection",this._sockjs=!0))},v._setStatus=function(e){this._status!==e&&(this._debug("Status",this._status,"->",e),this._status=e)},v._isDisconnected=function(){return"disconnected"===this._status},v._isConnecting=function(){return"connecting"===this._status},v._isConnected=function(){return"connected"===this._status},v._nextMessageId=function(){return++this._messageId},v._resetRetry=function(){this._debug("reset retries count to 0"),this._retries=0},v._getRetryInterval=function(){var e=l(this._retries,this._config.retry,this._config.maxRetry);return this._retries+=1,e},v._clearConnectedState=function(e){self._clientID=null;for(var t in this._callbacks){var n=this._callbacks[t],r=n.errback;r&&r(this._createErrorObject("disconnected","retry"))}this._callbacks={};for(var i in this._subs){var s=this._subs[i];e?(s._isSuccess()&&s._triggerUnsubscribe(),s._setSubscribing()):s._setUnsubscribed()}this._config.resubscribe&&this._reconnect||(this._subs={})},v._send=function(e){0!==e.length&&(this._debug("Send",e),this._transport.send(JSON.stringify(e)))},v._connect=function(e){if(this.isConnected())return void this._debug("connect called when already connected");this._setStatus("connecting"),this._clientID=null,this._reconnect=!0;var t=this;if(e&&this.on("connect",e),this._sockjs===!0){var n={transports:this._config.transports};null!==this._config.server&&(n.server=this._config.server),this._transport=new SockJS(this._config.url,null,n)}else this._transport=new WebSocket(this._config.url);this._transport.onopen=function(){t._reconnecting=!1,t._transportName=t._sockjs?t._transport._transport.transportName:"raw-websocket",t._resetRetry(),u(t._config.user)||t._log("user expected to be string"),u(t._config.info)||t._log("info expected to be string");var e={method:"connect",params:{user:t._config.user,info:t._config.info}};t._config.insecure||(e.params.timestamp=t._config.timestamp,e.params.token=t._config.token,u(t._config.timestamp)||t._log("timestamp expected to be string"),u(t._config.token)||t._log("token expected to be string")),t._addMessage(e),t._latencyStart=new Date},this._transport.onerror=function(e){t._debug("transport level error",e)},this._transport.onclose=function(e){var n="connection closed";e&&"reason"in e&&e.reason&&(n=e.reason),t._disconnect(n,!0,!1)},this._transport.onmessage=function(e){var n;n=JSON.parse(e.data),t._debug("Received",n),t._receive(n)}},v._disconnect=function(e,t,n){this._debug("disconnected:",e,t);var r=t||!1;if(r===!1&&(this._reconnect=!1),this._clearConnectedState(t),!this.isDisconnected()){this._setStatus("disconnected");var i={reason:e,reconnect:r};this._reconnecting===!1&&this.trigger("disconnect",[i])}n&&this._transport.close();var s=this;if(t===!0&&s._reconnect===!0){s._reconnecting=!0;var o=s._getRetryInterval();s._debug("reconnect after "+o+" milliseconds"),setTimeout(function(){s._reconnect===!0&&s._connect.call(s)},o)}},v._refresh=function(){var e=this;this._debug("refresh credentials");var t=function(t,n){if(t===!0)return e._debug("error getting connect parameters",n),e._refreshTimeout&&clearTimeout(e._refreshTimeout),void(e._refreshTimeout=setTimeout(function(){e._refresh.call(e)},3e3));if(e._config.user=n.user,e._config.timestamp=n.timestamp,e._config.info=n.info,e._config.token=n.token,e.isDisconnected())e._debug("credentials refreshed, connect from scratch"),e._connect();else{e._debug("send refreshed credentials");var r={method:"refresh",params:{user:e._config.user,timestamp:e._config.timestamp,info:e._config.info,token:e._config.token}};e._addMessage(r)}},n=this._config.refreshTransport.toLowerCase();if("ajax"===n)this._ajax(this._config.refreshEndpoint,this._config.refreshParams,this._config.refreshHeaders,{},t);else{if("jsonp"!==n)throw"Unknown refresh transport "+n;this._jsonp(this._config.refreshEndpoint,this._config.refreshParams,this._config.refreshHeaders,{},t)}},v._subscribe=function(e){var t=e.channel;if(t in this._subs||(this._subs[t]=e),!this.isConnected())return void e._setNew();e._setSubscribing();var n={method:"subscribe",params:{channel:t}};if(c(t,this._config.privateChannelPrefix))this._isAuthBatching?this._authChannels[t]=!0:(this.startAuthBatching(),this._subscribe(e),this.stopAuthBatching());else{var r=this._recover(t);r===!0&&(n.params.recover=!0,n.params.last=this._getLastID(t)),this._addMessage(n)}},v._unsubscribe=function(e){if(this.isConnected()){var t={method:"unsubscribe",params:{channel:e.channel}};this._addMessage(t)}},v._getSub=function(e){var t=this._subs[e];return t?t:null},v._connectResponse=function(e){if(!this.isConnected())if(_(e))this.trigger("error",[{message:e}]);else{if(null!==this._latencyStart&&(this._latency=(new Date).getTime()-this._latencyStart.getTime(),this._latencyStart=null),!e.body)return;if(e.body.expires){var t=e.body.expired;if(t)return void this._refresh()}if(this._clientID=e.body.client,this._setStatus("connected"),this._refreshTimeout&&clearTimeout(this._refreshTimeout),e.body.expires){var n=this;this._refreshTimeout=setTimeout(function(){n._refresh.call(n)},1e3*e.body.ttl)}if(this._config.resubscribe){this.startBatching(),this.startAuthBatching();for(var r in this._subs){var i=this._subs[r];this._subscribe(i)}this.stopAuthBatching(),this.stopBatching(!0)}var s={client:e.body.client,transport:this._transportName,latency:this._latency};this.trigger("connect",[s])}},v._disconnectResponse=function(e){if(_(e))this.trigger("error",[{message:e}]);else{var t=!1;"reconnect"in e.body&&(t=e.body.reconnect);var n="";"reason"in e.body&&(n=e.body.reason),this._disconnect(n,t,!0)}},v._subscribeResponse=function(e){var t=e.body;if(null!==t){var n=t.channel,r=this._getSub(n);if(r&&r._isSubscribing())if(_(e))this.trigger("error",[{message:e}]),r._setSubscribeError(this._errorObjectFromMessage(e));else{r._setSubscribeSuccess();var i=t.messages;if(i&&i.length>0)for(var s in i.reverse())this._messageResponse({body:i[s]});else"last"in t&&(this._lastMessageID[n]=t.last)}}},v._unsubscribeResponse=function(e){var t=e.uid,n=e.body,r=n.channel,i=this._getSub(r);i&&(_(e)?this.trigger("error",[{message:e}]):t||i._setUnsubscribed())},v._publishResponse=function(e){var t=e.uid,n=e.body;if(t in this._callbacks){var r=this._callbacks[t];if(delete this._callbacks[t],_(e)){var i=r.errback;if(!i)return;i(this._errorObjectFromMessage(e)),this.trigger("error",[{message:e}])}else{var s=r.callback;if(!s)return;s(n)}}},v._presenceResponse=function(e){var t=e.uid,n=e.body;if(t in this._callbacks){var r=this._callbacks[t];if(delete this._callbacks[t],_(e)){var i=r.errback;if(!i)return;i(this._errorObjectFromMessage(e)),this.trigger("error",[{message:e}])}else{var s=r.callback;if(!s)return;s(n)}}},v._historyResponse=function(e){var t=e.uid,n=e.body;if(t in this._callbacks){var r=this._callbacks[t];if(delete this._callbacks[t],_(e)){var i=r.errback;if(!i)return;i(this._errorObjectFromMessage(e)),this.trigger("error",[{message:e}])}else{var s=r.callback;if(!s)return;s(n)}}},v._joinResponse=function(e){var t=e.body,n=t.channel,r=this._getSub(n);r&&r.trigger("join",[t])},v._leaveResponse=function(e){var t=e.body,n=t.channel,r=this._getSub(n);r&&r.trigger("leave",[t])},v._messageResponse=function(e){var t=e.body,n=t.channel;this._lastMessageID[n]=t.uid;var r=this._getSub(n);r&&r.trigger("message",[t])},v._refreshResponse=function(e){if(this._refreshTimeout&&clearTimeout(this._refreshTimeout),_(e))this.trigger("error",[{message:e}]);else if(e.body.expires){var t=this,n=e.body.expired;if(n)return void(t._refreshTimeout=setTimeout(function(){t._refresh.call(t)},3e3+Math.round(1e3*Math.random())));this._clientID=e.body.client,t._refreshTimeout=setTimeout(function(){t._refresh.call(t)},1e3*e.body.ttl)}},v._dispatchMessage=function(e){if(void 0===e||null===e)return void this._debug("dispatch: got undefined or null message");var t=e.method;if(!t)return void this._debug("dispatch: got message with empty method");switch(t){case"connect":this._connectResponse(e);break;case"disconnect":this._disconnectResponse(e);break;case"subscribe":this._subscribeResponse(e);break;case"unsubscribe":this._unsubscribeResponse(e);break;case"publish":this._publishResponse(e);break;case"presence":this._presenceResponse(e);break;case"history":this._historyResponse(e);break;case"join":this._joinResponse(e);break;case"leave":this._leaveResponse(e);break;case"ping":break;case"refresh":this._refreshResponse(e);break;case"message":this._messageResponse(e);break;default:this._debug("dispatch: got message with unknown method"+t)}},v._receive=function(e){if(Object.prototype.toString.call(e)===Object.prototype.toString.call([])){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];this._dispatchMessage(n)}}else Object.prototype.toString.call(e)===Object.prototype.toString.call({})&&this._dispatchMessage(e)},v._flush=function(){var e=this._messages.slice(0);this._messages=[],this._send(e)},v._ping=function(){var e={method:"ping",params:{}};this._addMessage(e)},v._recover=function(e){return e in this._lastMessageID},v._getLastID=function(e){var t=this._lastMessageID[e];return t?(this._debug("last uid found and sent for channel",e),t):(this._debug("no last uid found for channel",e),"")},v._createErrorObject=function(e,t){var n={error:e};return t&&(n.advice=t),n},v._errorObjectFromMessage=function(e){var t=e.error,n=e.advice;return this._createErrorObject(t,n)},v._registerCall=function(e,t,n){var r=this;this._callbacks[e]={callback:t,errback:n},setTimeout(function(){delete r._callbacks[e],f(n)&&n(r._createErrorObject("timeout","retry"))},this._config.timeout)},v._addMessage=function(e){var t=""+this._nextMessageId();return e.uid=t,this._isBatching===!0?this._messages.push(e):this._send([e]),t},v.getClientId=function(){return this._clientID},v.isConnected=v._isConnected,v.isDisconnected=v._isDisconnected,v.configure=function(e){this._configure.call(this,e)},v.connect=v._connect,v.disconnect=function(){this._disconnect("client",!1,!0)},v.ping=v._ping,v.startBatching=function(){this._isBatching=!0},v.stopBatching=function(e){e=e||!1,this._isBatching=!1,e===!0&&this.flush()},v.flush=function(){this._flush()},v.startAuthBatching=function(){this._isAuthBatching=!0},v.stopAuthBatching=function(){this._isAuthBatching=!1;var e=this._authChannels;this._authChannels={};var t=[];for(var n in e){var r=this._getSub(n);r&&t.push(n)}if(0!=t.length){var i={client:this.getClientId(),channels:t},s=this,o=function(e,n){if(e!==!0){var r=!1;s._isBatching||(s.startBatching(),r=!0);for(var i in t){var o=t[i],c=n[o];if(c)if(c.status&&200!==c.status)s._subscribeResponse({error:c.status,body:{channel:o}});else{var a={method:"subscribe",params:{channel:o,client:s.getClientId(),info:c.info,sign:c.sign}},u=s._recover(o);u===!0&&(a.params.recover=!0,a.params.last=s._getLastID(o)),s._addMessage(a)}else s._subscribeResponse({error:"channel not found in authorization response",advice:"fix",body:{channel:o}})}r&&s.stopBatching(!0)}else{s._debug("authorization request failed");for(var i in t){var o=t[i];s._subscribeResponse({error:"authorization request failed",advice:"fix",body:{channel:o}})}}},c=this._config.authTransport.toLowerCase();if("ajax"===c)this._ajax(this._config.authEndpoint,this._config.authParams,this._config.authHeaders,i,o);else{if("jsonp"!==c)throw"Unknown auth transport "+c;this._jsonp(this._config.authEndpoint,this._config.authParams,this._config.authHeaders,i,o)}}},v.subscribe=function(e,t){if(arguments.length<1)throw"Illegal arguments number: required 1, got "+arguments.length;if(!u(e))throw"Illegal argument type: channel must be a string";if(!this._config.resubscribe&&!this.isConnected())throw"Can not only subscribe in connected state when resubscribe option is off";var n=this._getSub(e);if(null!==n)return n._setEvents(t),n._isUnsubscribed()&&n.subscribe(),n;var r=new g(this,e,t);return this._subs[e]=r,r.subscribe(),r};var m=0,y=1,w=2,S=3,k=4;r(g,b);var j=g.prototype;j._initializePromise=function(){this._ready=!1;var e=this;this._promise=new p(function(t,n){e._resolve=function(n){e._ready=!0,t(n)},e._reject=function(t){e._ready=!0,n(t)}})},j._setEvents=function(e){if(e)if(f(e))this.on("message",e);else if(Object.prototype.toString.call(e)===Object.prototype.toString.call({})){var t=["message","join","leave","unsubscribe","subscribe","error"];for(var n in t){var r=t[n];r in e&&this.on(r,e[r])}}},j._isNew=function(){return this._status===m},j._isUnsubscribed=function(){return this._status===k},j._isSubscribing=function(){return this._status===y},j._isReady=function(){return this._status===w||this._status===S},j._isSuccess=function(){return this._status===w},j._isError=function(){return this._status===S},j._setNew=function(){this._status=m},j._setSubscribing=function(){this._ready===!0&&(this._initializePromise(),this._isResubscribe=!0),this._status=y},j._setSubscribeSuccess=function(){if(this._status!=w){this._status=w;var e=this._getSubscribeSuccessContext();this.trigger("subscribe",[e]),this._resolve(e)}},j._setSubscribeError=function(e){if(this._status!=S){this._status=S,this._error=e;var t=this._getSubscribeErrorContext();this.trigger("error",[t]),this._reject(t)}},j._triggerUnsubscribe=function(){var e={channel:this.channel};this.trigger("unsubscribe",[e])},j._setUnsubscribed=function(){this._status!=k&&(this._status=k,this._triggerUnsubscribe())},j._getSubscribeSuccessContext=function(){return{channel:this.channel,isResubscribe:this._isResubscribe}},j._getSubscribeErrorContext=function(){var e=this._error;return e.channel=this.channel,e.isResubscribe=this._isResubscribe,e},j.ready=function(e,t){this._ready&&(this._isSuccess()?e(this._getSubscribeSuccessContext()):t(this._getSubscribeErrorContext()))},j.subscribe=function(){return this._status!=w?(this._centrifuge._subscribe(this),this):void 0},j.unsubscribe=function(){this._setUnsubscribed(),this._centrifuge._unsubscribe(this)},j.publish=function(e){var t=this;return new p(function(n,r){return t._isUnsubscribed()?void r(t._centrifuge._createErrorObject("subscription unsubscribed","fix")):void t._promise.then(function(){if(!t._centrifuge.isConnected())return void r(t._centrifuge._createErrorObject("disconnected","retry"));var i={method:"publish",params:{channel:t.channel,data:e}},s=t._centrifuge._addMessage(i);t._centrifuge._registerCall(s,n,r)},function(e){r(e)})})},j.presence=function(){var e=this;return new p(function(t,n){return e._isUnsubscribed()?void n(e._centrifuge._createErrorObject("subscription unsubscribed","fix")):void e._promise.then(function(){if(!e._centrifuge.isConnected())return void n(e._centrifuge._createErrorObject("disconnected","retry"));var r={method:"presence",params:{channel:e.channel}},i=e._centrifuge._addMessage(r);e._centrifuge._registerCall(i,t,n)
},function(e){n(e)})})},j.history=function(){var e=this;return new p(function(t,n){return e._isUnsubscribed()?void n(e._centrifuge._createErrorObject("subscription unsubscribed","fix")):void e._promise.then(function(){if(!e._centrifuge.isConnected())return void n(e._centrifuge._createErrorObject("disconnected","retry"));var r={method:"history",params:{channel:e.channel}},i=e._centrifuge._addMessage(r);e._centrifuge._registerCall(i,t,n)},function(e){n(e)})})},t.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"es6-promise":2,"wolfy87-eventemitter":3}]},{},[4])(4)});

@@ -0,1 +1,6 @@

1.3.5
=====
* fix using centrifuge-js in SharedWorker - there is no `window` object, so using `self` instead of `window` when we in SharedWorker context.
1.3.4

@@ -2,0 +7,0 @@ =====

{
"name": "centrifuge",
"version": "1.3.4",
"version": "1.3.5",
"description": "Centrifuge javascript client",

@@ -5,0 +5,0 @@ "main": "centrifuge.js",

@@ -102,6 +102,6 @@ var Promise = require('es6-promise').Promise;

function log(level, args) {
if (window.console) {
var logger = window.console[level];
if (global.console) {
var logger = global.console[level];
if (isFunction(logger)) {
logger.apply(window.console, args);
logger.apply(global.console, args);
}

@@ -196,3 +196,3 @@ }

var document = window.document;
var document = global.document;
var script = document.createElement("script");

@@ -226,3 +226,3 @@ Centrifuge._authCallbacks[callbackName] = function (data) {

var xhr = (window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
var xhr = (global.XMLHttpRequest ? new global.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));

@@ -503,4 +503,8 @@ var query = "";

this._transport.onclose = function () {
self._disconnect("connection closed", true, false);
this._transport.onclose = function (closeEvent) {
var reason = "connection closed";
if (closeEvent && "reason" in closeEvent && closeEvent["reason"]) {
reason = closeEvent["reason"];
}
self._disconnect(reason, true, false);
};

@@ -545,3 +549,3 @@

self._debug("reconnect after " + interval + " milliseconds");
window.setTimeout(function () {
setTimeout(function () {
if (self._reconnect === true) {

@@ -566,5 +570,5 @@ self._connect.call(self);

if (self._refreshTimeout) {
window.clearTimeout(self._refreshTimeout);
clearTimeout(self._refreshTimeout);
}
self._refreshTimeout = window.setTimeout(function(){
self._refreshTimeout = setTimeout(function(){
self._refresh.call(self);

@@ -700,7 +704,7 @@ }, 3000);

if (this._refreshTimeout) {
window.clearTimeout(this._refreshTimeout);
clearTimeout(this._refreshTimeout);
}
if (message.body.expires) {
var self = this;
this._refreshTimeout = window.setTimeout(function() {
this._refreshTimeout = setTimeout(function() {
self._refresh.call(self);

@@ -916,3 +920,3 @@ }, message.body.ttl * 1000);

if (this._refreshTimeout) {
window.clearTimeout(this._refreshTimeout);
clearTimeout(this._refreshTimeout);
}

@@ -924,3 +928,3 @@ if (!errorExists(message)) {

if (isExpired) {
self._refreshTimeout = window.setTimeout(function () {
self._refreshTimeout = setTimeout(function () {
self._refresh.call(self);

@@ -931,3 +935,3 @@ }, 3000 + Math.round(Math.random() * 1000));

this._clientID = message.body.client;
self._refreshTimeout = window.setTimeout(function () {
self._refreshTimeout = setTimeout(function () {
self._refresh.call(self);

@@ -934,0 +938,0 @@ }, message.body.ttl * 1000);

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc