diff --git a/nodejshelper/bootstrap/bootstrap.php b/nodejshelper/bootstrap/bootstrap.php index 67c034d..0a45c7d 100644 --- a/nodejshelper/bootstrap/bootstrap.php +++ b/nodejshelper/bootstrap/bootstrap.php @@ -52,7 +52,11 @@ public function messageReceivedAdmin($params) { if (isset($params['ou']) && $params['ou'] instanceof erLhcoreClassModelChatOnlineUser && $params['chat']->user_status == erLhcoreClassModelChat::USER_STATUS_PENDING_REOPEN) { erLhcoreClassNodeJSRedis::instance()->publish('uo_' . $params['ou']->vid,'o:' . json_encode(array('op' => 'check_message'))); } else { - erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('op' => 'cmsg'))); + if(erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('automated_hosting')){ + erLhcoreClassNodeJSRedis::instance()->publish('chat_' . erLhcoreClassInstance::getInstance()->id . '_' . $params['chat']->id,'o:' . json_encode(array('op' => 'cmsg'))); + } else{ + erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('op' => 'cmsg'))); + } } } @@ -76,6 +80,10 @@ public function getSettingVariable($var) { return $this->settings['public_settings']['secure']; break; + case 'automated_hosting': + return $this->settings['automated_hosting']; + break; + default: return null; ; @@ -113,12 +121,20 @@ public function proactiveInvitationSend($params) public function messageReceived($params) { - erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('op' => 'cmsg'))); + if(erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('automated_hosting')){ + erLhcoreClassNodeJSRedis::instance()->publish('chat_' . erLhcoreClassInstance::getInstance()->id . '_' . $params['chat']->id,'o:' . json_encode(array('op' => 'cmsg'))); + } else{ + erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('op' => 'cmsg'))); + } } public function statusChange($params) { - erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('op' => 'schange'))); + if(erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('automated_hosting')){ + erLhcoreClassNodeJSRedis::instance()->publish('chat_' . erLhcoreClassInstance::getInstance()->id . '_' . $params['chat']->id,'o:' . json_encode(array('op' => 'schange'))); + } else{ + erLhcoreClassNodeJSRedis::instance()->publish('chat_' . $params['chat']->id,'o:' . json_encode(array('op' => 'schange'))); + } } diff --git a/nodejshelper/design/nodejshelpertheme/js/customjs-admin.js b/nodejshelper/design/nodejshelpertheme/js/customjs-admin.js index 780ee11..ab555a1 100644 --- a/nodejshelper/design/nodejshelpertheme/js/customjs-admin.js +++ b/nodejshelper/design/nodejshelpertheme/js/customjs-admin.js @@ -15,6 +15,14 @@ var channelList = []; socketOptions.secure = true; } + var chanelName; + + if (lh.nodejsHelperOptions.instance_id > 0) { + chanelName = ('chat_'+lh.nodejsHelperOptions.instance_id+'_'+lhinst.chat_id); + } else { + chanelName = ('chat_'+lhinst.chat_id); + } + // Initiate the connection to the server var socket = socketCluster.connect(socketOptions); @@ -26,7 +34,11 @@ var channelList = []; try { if (typeof channelList[chat_id] === 'undefined') { - channelList[chat_id] = socket.subscribe('chat_' + chat_id); + if (lh.nodejsHelperOptions.instance_id > 0) { + channelList[chat_id] = socket.subscribe('chat_'+lh.nodejsHelperOptions.instance_id+'_'+ chat_id); + } else { + channelList[chat_id] = socket.subscribe('chat_' + chat_id); + } channelList[chat_id].on('subscribeFail', function (err) { console.error('Failed to subscribe to the sample channel due to error: ' + err); @@ -52,7 +64,11 @@ var channelList = []; function operatorTypingListener(data) { data.ttx = lh.nodejsHelperOptions.typer; ee.emitEvent('nodeJsTypingOperator', [data]); - socket.publish('chat_'+data.chat_id,{'op':'ot','data':data}); // Operator typing + if (lh.nodejsHelperOptions.instance_id > 0) { + socket.publish('chat_'+lh.nodejsHelperOptions.instance_id+'_'+data.chat_id,{'op':'ot','data':data}); // Operator typing + } else{ + socket.publish('chat_'+data.chat_id,{'op':'ot','data':data}); // Operator typing + } } function removeSynchroChatListener(chat_id) { @@ -68,7 +84,6 @@ var channelList = []; socket.on('close', function() { try { - lhinst.nodeJsMode = false; channelList.forEach(function(channel){ if (typeof channel !== 'undefined') { @@ -89,11 +104,9 @@ var channelList = []; } }); - socket.on('connect', function () { - + function connectAdmin(){ try { lhinst.nodeJsMode = true; - lhinst.chatsSynchronising.forEach(function (chat_id) { addChatToNodeJS(chat_id); }); @@ -101,11 +114,26 @@ var channelList = []; ee.addListener('chatTabLoaded', addChatToNodeJS); ee.addListener('operatorTyping', operatorTypingListener); ee.addListener('removeSynchroChat', removeSynchroChatListener); - + confLH.chat_message_sinterval = 15000; + } catch (e) { console.log(e); } + } + + socket.on('connect', function (status) { + if (status.isAuthenticated) { + connectAdmin(); + } else { + socket.emit('login', {hash:lh.nodejsHelperOptions.hash, chanelName: chanelName}, function (err) { + if (err) { + console.log(err); + } else { + connectAdmin(); + } + }); + } }); $(window).on('beforeunload', function () { diff --git a/nodejshelper/design/nodejshelpertheme/js/customjs-widget.js b/nodejshelper/design/nodejshelpertheme/js/customjs-widget.js index f2585a2..8ba7a29 100644 --- a/nodejshelper/design/nodejshelpertheme/js/customjs-widget.js +++ b/nodejshelper/design/nodejshelpertheme/js/customjs-widget.js @@ -13,6 +13,14 @@ setTimeout(function() { socketOptions.secure = true; } + var chanelName; + + if (lh.nodejsHelperOptions.instance_id > 0) { + chanelName = ('chat_'+lh.nodejsHelperOptions.instance_id+'_'+lhinst.chat_id); + } else{ + chanelName = ('chat_'+lhinst.chat_id); + } + // Initiate the connection to the server var socket = socketCluster.connect(socketOptions); @@ -24,12 +32,20 @@ setTimeout(function() { function visitorTypingListener(data) { - socket.publish('chat_'+lhinst.chat_id,{'op':'vt','msg':data.msg}); + if (lh.nodejsHelperOptions.instance_id > 0) { + socket.publish('chat_'+lh.nodejsHelperOptions.instance_id+'_'+lhinst.chat_id,{'op':'vt','msg':data.msg}); + } else { + socket.publish('chat_'+lhinst.chat_id,{'op':'vt','msg':data.msg}); + } } function visitorTypingStoppedListener() { - socket.publish('chat_'+lhinst.chat_id,{'op':'vts'}); + if (lh.nodejsHelperOptions.instance_id > 0) { + socket.publish('chat_'+lh.nodejsHelperOptions.instance_id+'_'+lhinst.chat_id,{'op':'vts'}); + } else { + socket.publish('chat_'+lhinst.chat_id,{'op':'vts'}); + } } socket.on('close', function(){ @@ -45,43 +61,58 @@ setTimeout(function() { confLH.chat_message_sinterval = confLH.defaut_chat_message_sinterval; }); - socket.on('connect', function () { - - if (lhinst.chat_id > 0) { + function connectVisitor(){ + if (lh.nodejsHelperOptions.instance_id > 0) { + sampleChannel = socket.subscribe('chat_'+lh.nodejsHelperOptions.instance_id+'_'+lhinst.chat_id); + } else { sampleChannel = socket.subscribe('chat_' + lhinst.chat_id); + } - sampleChannel.on('subscribeFail', function (err) { - console.error('Failed to subscribe to the sample channel due to error: ' + err); - }); - - sampleChannel.watch(function (op) { - if (op.op == 'ot') { // Operator Typing Message - var instStatus = $('#id-operator-typing'); - if (op.data.status == true) { - instStatus.text(op.data.ttx); - instStatus.css('visibility','visible'); - } else { - instStatus.css('visibility','hidden'); - } - } else if (op.op == 'cmsg') { - lhinst.syncusercall(); - } else if (op.op == 'schange') { - lhinst.chatsyncuserpending(); - lhinst.syncusercall(); + sampleChannel.on('subscribeFail', function (err) { + console.error('Failed to subscribe to the sample channel due to error: ' + err); + }); + + sampleChannel.watch(function (op) { + if (op.op == 'ot') { // Operator Typing Message + var instStatus = $('#id-operator-typing'); + if (op.data.status == true) { + instStatus.text(op.data.ttx); + instStatus.css('visibility','visible'); + } else { + instStatus.css('visibility','hidden'); } - }); + } else if (op.op == 'cmsg') { + lhinst.syncusercall(); + } else if (op.op == 'schange') { + lhinst.chatsyncuserpending(); + lhinst.syncusercall(); + } + }); - // Disable default method - LHCCallbacks.initTypingMonitoringUserInform = true; + // Disable default method + LHCCallbacks.initTypingMonitoringUserInform = true; - ee.addListener('visitorTyping', visitorTypingListener); - ee.addListener('visitorTypingStopped', visitorTypingStoppedListener); + ee.addListener('visitorTyping', visitorTypingListener); + ee.addListener('visitorTypingStopped', visitorTypingStoppedListener); - // Make larger sync interval - confLH.chat_message_sinterval = 10000; + // Make larger sync interval + confLH.chat_message_sinterval = 10000; - // Force one time check - lhinst.syncusercall(); + // Force one time check + lhinst.syncusercall(); + } + + socket.on('connect', function (status) { + if (status.isAuthenticated && lhinst.chat_id > 0) { + connectVisitor(); + } else { + socket.emit('login', {hash:lh.nodejsHelperOptions.hash, chanelName: chanelName}, function (err) { + if (err) { + console.log(err); + } else { + connectVisitor(); + } + }); } }); diff --git a/nodejshelper/design/nodejshelpertheme/js/customjs.js b/nodejshelper/design/nodejshelpertheme/js/customjs.js index d0e0b6e..e33b9c2 100644 --- a/nodejshelper/design/nodejshelpertheme/js/customjs.js +++ b/nodejshelper/design/nodejshelpertheme/js/customjs.js @@ -13,26 +13,41 @@ socketOptions.secure = true; } - // Initiate the connection to the server - var socket = socketCluster.connect(socketOptions); + // Initiate the connection to the server + var socket = socketCluster.connect(socketOptions); - socket.on('error', function (err) { - console.error(err); - }); + socket.on('error', function (err) { + console.error(err); + }); - socket.on('connect', function () { - //console.log('Socket is connected'); - }); + function connectSiteVisitor(){ + var sampleChannel = socket.subscribe('uo_' + lh_inst.cookieDataPers.vid); - var sampleChannel = socket.subscribe('uo_' + lh_inst.cookieDataPers.vid); + sampleChannel.on('subscribeFail', function (err) { + console.error('Failed to subscribe to the sample channel due to error: ' + err); + }); - sampleChannel.on('subscribeFail', function (err) { - console.error('Failed to subscribe to the sample channel due to error: ' + err); - }); + sampleChannel.watch(function (op) { + if (op.op == 'check_message') { + lh_inst.startNewMessageCheckSingle(); + } + }); + } + + var chanelName = ('chat_'+'uo_' + lh_inst.cookieDataPers.vid); + + socket.on('connect', function (status) { + if (status.isAuthenticated) { + connectSiteVisitor(); + } else { + socket.emit('login', {hash:lh_inst.nodejsHelperOptions.hash, chanelName: chanelName}, function (err) { + if (err) { + console.log(err); + } else { + connectSiteVisitor(); + } + }); + } + }); - sampleChannel.watch(function (op) { - if (op.op == 'check_message') { - lh_inst.startNewMessageCheckSingle(); - } - }); })(); diff --git a/nodejshelper/design/nodejshelpertheme/js/nodejshelper.admin.min.js b/nodejshelper/design/nodejshelpertheme/js/nodejshelper.admin.min.js index 502cc5e..d9a9d45 100644 --- a/nodejshelper/design/nodejshelpertheme/js/nodejshelper.admin.min.js +++ b/nodejshelper/design/nodejshelpertheme/js/nodejshelper.admin.min.js @@ -1,8 +1,8 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.socketCluster=t()}}(function(){var t;return function(){function t(e,r,n){function o(s,a){if(!r[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[s]={exports:{}};e[s][0].call(h.exports,function(t){var r=e[s][1][t];return o(r||t)},h,h.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;sn)throw new d("The "+t+" value provided exceeded the maximum amount allowed")};if(i("connectTimeout"),i("ackTimeout"),this._localEvents={connect:1,connectAbort:1,close:1,disconnect:1,message:1,error:1,raw:1,kickOut:1,subscribe:1,unsubscribe:1,subscribeStateChange:1,authStateChange:1,authenticate:1,deauthenticate:1,removeAuthToken:1,subscribeRequest:1},this.connectAttempts=0,this._emitBuffer=new h,this.channels={},this.options=t,this._cid=1,this.options.callIdGenerator=function(){return e._cid++},this.options.autoReconnect){null==this.options.autoReconnectOptions&&(this.options.autoReconnectOptions={});var c=this.options.autoReconnectOptions;null==c.initialDelay&&(c.initialDelay=1e4),null==c.randomness&&(c.randomness=1e4),null==c.multiplier&&(c.multiplier=1.5),null==c.maxDelay&&(c.maxDelay=6e4)}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.path=this.options.path.replace(/\/$/,"")+"/",this.options.query=t.query||{},"string"==typeof this.options.query&&(this.options.query=u.parse(this.options.query)),this._channelEmitter=new o,this._unloadHandler=function(){e.disconnect()},E&&this.disconnectOnUnload&&r.addEventListener&&r.addEventListener("beforeunload",this._unloadHandler,!1),this._clientMap[this.clientId]=this,this.options.autoConnect&&this.connect()};w.prototype=Object.create(o.prototype),w.CONNECTING=w.prototype.CONNECTING=c.prototype.CONNECTING,w.OPEN=w.prototype.OPEN=c.prototype.OPEN,w.CLOSED=w.prototype.CLOSED=c.prototype.CLOSED,w.AUTHENTICATED=w.prototype.AUTHENTICATED="authenticated",w.UNAUTHENTICATED=w.prototype.UNAUTHENTICATED="unauthenticated",w.PENDING=w.prototype.PENDING="pending",w.ignoreStatuses=f.socketProtocolIgnoreStatuses,w.errorStatuses=f.socketProtocolErrorStatuses,w.prototype._privateEventHandlerMap={"#publish":function(t){var e=this._undecorateChannelName(t.channel),r=this.isSubscribed(e,!0);r&&this._channelEmitter.emit(e,t.data)},"#kickOut":function(t){var e=this._undecorateChannelName(t.channel),r=this.channels[e];r&&(o.prototype.emit.call(this,"kickOut",t.message,e),r.emit("kickOut",t.message,e),this._triggerChannelUnsubscribe(r))},"#setAuthToken":function(t,e){var r=this;if(t){var n=function(n){n?(e.error(n),r._onSCError(n)):(r._changeToAuthenticatedState(t.token),e.end())};this.auth.saveToken(this.authTokenName,t.token,{},n)}else e.error(new y("No token data provided by #setAuthToken event"))},"#removeAuthToken":function(t,e){var r=this;this.auth.removeToken(this.authTokenName,function(t,n){t?(e.error(t),r._onSCError(t)):(o.prototype.emit.call(r,"removeAuthToken",n),r._changeToUnauthenticatedStateAndClearTokens(),e.end())})},"#disconnect":function(t){this.transport.close(t.code,t.data)}},w.prototype.getState=function(){return this.state},w.prototype.getBytesReceived=function(){return this.transport.getBytesReceived()},w.prototype.deauthenticate=function(t){var e=this;this.auth.removeToken(this.authTokenName,function(r,n){r?e._onSCError(r):(o.prototype.emit.call(e,"removeAuthToken",n),e.state!=e.CLOSED&&e.emit("#removeAuthToken"),e._changeToUnauthenticatedStateAndClearTokens()),t&&t(r)})},w.prototype.connect=w.prototype.open=function(){var t=this;if(!this.active){var e=new g("Cannot connect a destroyed client");return void this._onSCError(e)}this.state==this.CLOSED&&(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this.state=this.CONNECTING,o.prototype.emit.call(this,"connecting"),this.transport&&this.transport.off(),this.transport=new c(this.auth,this.codec,this.options),this.transport.on("open",function(e){t.state=t.OPEN,t._onSCOpen(e)}),this.transport.on("error",function(e){t._onSCError(e)}),this.transport.on("close",function(e,r){t.state=t.CLOSED,t._onSCClose(e,r)}),this.transport.on("openAbort",function(e,r){t.state=t.CLOSED,t._onSCClose(e,r,!0)}),this.transport.on("event",function(e,r,n){t._onSCEvent(e,r,n)}))},w.prototype.reconnect=function(t,e){this.disconnect(t,e),this.connect()},w.prototype.disconnect=function(t,e){if(t=t||1e3,"number"!=typeof t)throw new d("If specified, the code argument must be a number");this.state==this.OPEN||this.state==this.CONNECTING?this.transport.close(t,e):(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef))},w.prototype.destroy=function(t,e){E&&r.removeEventListener&&r.removeEventListener("beforeunload",this._unloadHandler,!1),this.active=!1,this.disconnect(t,e),delete this._clientMap[this.clientId]},w.prototype._changeToUnauthenticatedStateAndClearTokens=function(){if(this.authState!=this.UNAUTHENTICATED){var t=this.authState,e=this.signedAuthToken;this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null;var r={oldState:t,newState:this.authState};o.prototype.emit.call(this,"authStateChange",r),o.prototype.emit.call(this,"deauthenticate",e)}},w.prototype._changeToAuthenticatedState=function(t){if(this.signedAuthToken=t,this.authToken=this._extractAuthTokenData(t),this.authState!=this.AUTHENTICATED){var e=this.authState;this.authState=this.AUTHENTICATED;var r={oldState:e,newState:this.authState,signedAuthToken:t,authToken:this.authToken};this.preparingPendingSubscriptions||this.processPendingSubscriptions(),o.prototype.emit.call(this,"authStateChange",r)}o.prototype.emit.call(this,"authenticate",t)},w.prototype.decodeBase64=function(t){var e;if("undefined"==typeof n)e=r.atob?r.atob(t):p.decode(t);else{var o=new n(t,"base64");e=o.toString("utf8")}return e},w.prototype.encodeBase64=function(t){var e;if("undefined"==typeof n)e=r.btoa?r.btoa(t):p.encode(t);else{var o=new n(t,"utf8");e=o.toString("base64")}return e},w.prototype._extractAuthTokenData=function(t){var e=(t||"").split("."),r=e[1];if(null!=r){var n=r;try{return n=this.decodeBase64(n),JSON.parse(n)}catch(o){return n}}return null},w.prototype.getAuthToken=function(){return this.authToken},w.prototype.getSignedAuthToken=function(){return this.signedAuthToken},w.prototype.authenticate=function(t,e){var r=this;this.emit("#authenticate",t,function(n,o){o&&null!=o.isAuthenticated?o.authError&&(o.authError=f.hydrateError(o.authError)):o={isAuthenticated:r.authState,authError:null},n?("BadConnectionError"!=n.name&&"TimeoutError"!=n.name&&r._changeToUnauthenticatedStateAndClearTokens(),e&&e(n,o)):r.auth.saveToken(r.authTokenName,t,{},function(n){n&&r._onSCError(n),o.isAuthenticated?r._changeToAuthenticatedState(t):r._changeToUnauthenticatedStateAndClearTokens(),e&&e(n,o)})})},w.prototype._tryReconnect=function(t){var e,r=this,n=this.connectAttempts++,o=this.options.autoReconnectOptions;if(null==t||n>0){var i=Math.round(o.initialDelay+(o.randomness||0)*Math.random());e=Math.round(i*Math.pow(o.multiplier,n))}else e=t;e>o.maxDelay&&(e=o.maxDelay),clearTimeout(this._reconnectTimeoutRef),this.pendingReconnect=!0,this.pendingReconnectTimeout=e,this._reconnectTimeoutRef=setTimeout(function(){r.connect()},e)},w.prototype._onSCOpen=function(t){var e=this;this.preparingPendingSubscriptions=!0,t?(this.id=t.id,this.pingTimeout=t.pingTimeout,this.transport.pingTimeout=this.pingTimeout,t.isAuthenticated?this._changeToAuthenticatedState(t.authToken):this._changeToUnauthenticatedStateAndClearTokens()):this._changeToUnauthenticatedStateAndClearTokens(),this.connectAttempts=0,this.options.autoSubscribeOnConnect&&this.processPendingSubscriptions(),o.prototype.emit.call(this,"connect",t,function(){e.processPendingSubscriptions()}),this.state==this.OPEN&&this._flushEmitBuffer()},w.prototype._onSCError=function(t){var e=this;setTimeout(function(){if(e.listeners("error").length<1)throw t;o.prototype.emit.call(e,"error",t)},0)},w.prototype._suspendSubscriptions=function(){var t,e;for(var r in this.channels)this.channels.hasOwnProperty(r)&&(t=this.channels[r],e=t.state==t.SUBSCRIBED||t.state==t.PENDING?t.PENDING:t.UNSUBSCRIBED,this._triggerChannelUnsubscribe(t,e))},w.prototype._abortAllPendingEventsDueToBadConnection=function(t){for(var e,r=this._emitBuffer.head;r;){e=r.next;var n=r.data;clearTimeout(n.timeout),delete n.timeout,r.detach(),r=e;var o=n.callback;if(o){delete n.callback;var i="Event '"+n.event+"' was aborted due to a bad connection",s=new v(i,t);o.call(n,s,n)}n.cid&&this.transport.cancelPendingResponse(n.cid)}},w.prototype._onSCClose=function(t,e,r){var n=this;if(this.id=null,this.transport&&this.transport.off(),this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this._suspendSubscriptions(),this._abortAllPendingEventsDueToBadConnection(r?"connectAbort":"disconnect"),this.options.autoReconnect&&(4e3==t||4001==t||1005==t?this._tryReconnect(0):1e3!=t&&t<4500&&this._tryReconnect()),r?o.prototype.emit.call(n,"connectAbort",t,e):o.prototype.emit.call(n,"disconnect",t,e),o.prototype.emit.call(n,"close",t,e),!w.ignoreStatuses[t]){var i;i=e?"Socket connection closed with status code "+t+" and reason: "+e:"Socket connection closed with status code "+t;var s=new m(w.errorStatuses[t]||i,t);this._onSCError(s)}},w.prototype._onSCEvent=function(t,e,r){var n=this._privateEventHandlerMap[t];n?n.call(this,e,r):o.prototype.emit.call(this,t,e,function(){r&&r.callback.apply(r,arguments)})},w.prototype.decode=function(t){return this.transport.decode(t)},w.prototype.encode=function(t){return this.transport.encode(t)},w.prototype._flushEmitBuffer=function(){for(var t,e=this._emitBuffer.head;e;){t=e.next;var r=e.data;e.detach(),this.transport.emitObject(r),e=t}},w.prototype._handleEventAckTimeout=function(t,e){e&&e.detach(),delete t.timeout;var r=t.callback;if(r){delete t.callback;var n=new b("Event response for '"+t.event+"' timed out");r.call(t,n,t)}t.cid&&this.transport.cancelPendingResponse(t.cid)},w.prototype._emit=function(t,e,r){var n=this;this.state==this.CLOSED&&this.connect();var o={event:t,callback:r},i=new h.Item;this.options.cloneData?o.data=l(e):o.data=e,i.data=o,o.timeout=setTimeout(function(){n._handleEventAckTimeout(o,i)},this.ackTimeout),this._emitBuffer.append(i),this.state==this.OPEN&&this._flushEmitBuffer()},w.prototype.send=function(t){this.transport.send(t)},w.prototype.emit=function(t,e,r){if(null==this._localEvents[t])this._emit(t,e,r);else if("error"==t)o.prototype.emit.call(this,t,e);else{var n=new g('The "'+t+'" event is reserved and cannot be emitted on a client socket');this._onSCError(n)}},w.prototype.publish=function(t,e,r){var n={channel:this._decorateChannelName(t),data:e};this.emit("#publish",n,r)},w.prototype._triggerChannelSubscribe=function(t,e){var r=t.name;if(t.state!=t.SUBSCRIBED){var n=t.state;t.state=t.SUBSCRIBED;var i={channel:r,oldState:n,newState:t.state,subscriptionOptions:e};t.emit("subscribeStateChange",i),t.emit("subscribe",r,e),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"subscribe",r,e)}},w.prototype._triggerChannelSubscribeFail=function(t,e,r){var n=e.name,i=!e.waitForAuth||this.authState==this.AUTHENTICATED;e.state!=e.UNSUBSCRIBED&&i&&(e.state=e.UNSUBSCRIBED,e.emit("subscribeFail",t,n,r),o.prototype.emit.call(this,"subscribeFail",t,n,r))},w.prototype._cancelPendingSubscribeCallback=function(t){null!=t._pendingSubscriptionCid&&(this.transport.cancelPendingResponse(t._pendingSubscriptionCid),delete t._pendingSubscriptionCid)},w.prototype._decorateChannelName=function(t){return this.channelPrefix&&(t=this.channelPrefix+t),t},w.prototype._undecorateChannelName=function(t){return this.channelPrefix&&0==t.indexOf(this.channelPrefix)?t.replace(this.channelPrefix,""):t},w.prototype._trySubscribe=function(t){var e=this,r=!t.waitForAuth||this.authState==this.AUTHENTICATED;if(this.state==this.OPEN&&!this.preparingPendingSubscriptions&&null==t._pendingSubscriptionCid&&r){var n={noTimeout:!0},i={channel:this._decorateChannelName(t.name)};t.waitForAuth&&(n.waitForAuth=!0,i.waitForAuth=n.waitForAuth),t.data&&(i.data=t.data),t.batch&&(n.batch=!0,i.batch=!0),t._pendingSubscriptionCid=this.transport.emit("#subscribe",i,n,function(r){delete t._pendingSubscriptionCid,r?e._triggerChannelSubscribeFail(r,t,i):e._triggerChannelSubscribe(t,i)}),o.prototype.emit.call(this,"subscribeRequest",t.name,i)}},w.prototype.subscribe=function(t,e){var r=this.channels[t];return r?e&&r.setOptions(e):(r=new i(t,this,e),this.channels[t]=r),r.state==r.UNSUBSCRIBED&&(r.state=r.PENDING,this._trySubscribe(r)),r},w.prototype._triggerChannelUnsubscribe=function(t,e){var r=t.name,n=t.state;if(e?t.state=e:t.state=t.UNSUBSCRIBED,this._cancelPendingSubscribeCallback(t),n==t.SUBSCRIBED){var i={channel:r,oldState:n,newState:t.state};t.emit("subscribeStateChange",i),t.emit("unsubscribe",r),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"unsubscribe",r)}},w.prototype._tryUnsubscribe=function(t){if(this.state==this.OPEN){var e={noTimeout:!0};t.batch&&(e.batch=!0),this._cancelPendingSubscribeCallback(t);var r=this._decorateChannelName(t.name);this.transport.emit("#unsubscribe",r,e)}},w.prototype.unsubscribe=function(t){var e=this.channels[t];e&&e.state!=e.UNSUBSCRIBED&&(this._triggerChannelUnsubscribe(e),this._tryUnsubscribe(e))},w.prototype.channel=function(t,e){var r=this.channels[t];return r||(r=new i(t,this,e),this.channels[t]=r),r},w.prototype.destroyChannel=function(t){var e=this.channels[t];e&&(e.unwatch(),e.unsubscribe(),delete this.channels[t])},w.prototype.subscriptions=function(t){var e,r,n=[];for(var o in this.channels)this.channels.hasOwnProperty(o)&&(e=this.channels[o],r=t?e&&(e.state==e.SUBSCRIBED||e.state==e.PENDING):e&&e.state==e.SUBSCRIBED,r&&n.push(o));return n},w.prototype.isSubscribed=function(t,e){var r=this.channels[t];return e?!!r&&(r.state==r.SUBSCRIBED||r.state==r.PENDING):!!r&&r.state==r.SUBSCRIBED},w.prototype.processPendingSubscriptions=function(){var t=this;this.preparingPendingSubscriptions=!1;var e=[];for(var r in this.channels)if(this.channels.hasOwnProperty(r)){var n=this.channels[r];n.state==n.PENDING&&e.push(n)}e.sort(function(t,e){var r=t.priority||0,n=e.priority||0;return r>n?-1:r>(-2*o&6)));return i},f=function(t){t=String(t),/[^\0-\xFF]/.test(t)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var e,r,n,o,i=t.length%3,s="",a=-1,c=t.length-i;++a>18&63)+h.charAt(o>>12&63)+h.charAt(o>>6&63)+h.charAt(63&o);return 2==i?(e=t.charCodeAt(a)<<8,r=t.charCodeAt(++a),o=e+r,s+=h.charAt(o>>10)+h.charAt(o>>4&63)+h.charAt(o<<2&63)+"="):1==i&&(o=t.charCodeAt(a),s+=h.charAt(o>>2)+h.charAt(o<<4&63)+"=="),s},d={encode:f,decode:l,version:"0.1.0"};if("function"==typeof t&&"object"==typeof t.amd&&t.amd)t(function(){return d});else if(i&&!i.nodeType)if(s)s.exports=d;else for(var y in d)d.hasOwnProperty(y)&&(i[y]=d[y]);else o.base64=d}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function o(t){return 3*t.length/4-n(t)}function i(t){var e,r,o,i,s,a=t.length;i=n(t),s=new p(3*a/4-i),r=i>0?a-4:a;var c=0;for(e=0;e>16&255,s[c++]=o>>8&255,s[c++]=255&o;return 2===i?(o=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[c++]=255&o):1===i&&(o=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[c++]=o>>8&255,s[c++]=255&o),s}function s(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function a(t,e,r){for(var n,o=[],i=e;ih?h:c+s));return 1===n?(e=t[r-1],o+=u[e>>2],o+=u[e<<4&63],o+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],o+=u[e>>10],o+=u[e>>4&63],o+=u[e<<2&63],o+="="),i.push(o),i.join("")}r.byteLength=o,r.toByteArray=i,r.fromByteArray=c;for(var u=[],h=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=l.length;fn)throw new d("The "+t+" value provided exceeded the maximum amount allowed")};if(i("connectTimeout"),i("ackTimeout"),this._localEvents={connect:1,connectAbort:1,close:1,disconnect:1,message:1,error:1,raw:1,kickOut:1,subscribe:1,unsubscribe:1,subscribeStateChange:1,authStateChange:1,authenticate:1,deauthenticate:1,removeAuthToken:1,subscribeRequest:1},this.connectAttempts=0,this._emitBuffer=new h,this.channels={},this.options=t,this._cid=1,this.options.callIdGenerator=function(){return e._cid++},this.options.autoReconnect){null==this.options.autoReconnectOptions&&(this.options.autoReconnectOptions={});var c=this.options.autoReconnectOptions;null==c.initialDelay&&(c.initialDelay=1e4),null==c.randomness&&(c.randomness=1e4),null==c.multiplier&&(c.multiplier=1.5),null==c.maxDelay&&(c.maxDelay=6e4)}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.path=this.options.path.replace(/\/$/,"")+"/",this.options.query=t.query||{},"string"==typeof this.options.query&&(this.options.query=u.parse(this.options.query)),this._channelEmitter=new o,this._unloadHandler=function(){e.disconnect()},E&&this.disconnectOnUnload&&r.addEventListener&&r.addEventListener("beforeunload",this._unloadHandler,!1),this._clientMap[this.clientId]=this,this.options.autoConnect&&this.connect()};w.prototype=Object.create(o.prototype),w.CONNECTING=w.prototype.CONNECTING=c.prototype.CONNECTING,w.OPEN=w.prototype.OPEN=c.prototype.OPEN,w.CLOSED=w.prototype.CLOSED=c.prototype.CLOSED,w.AUTHENTICATED=w.prototype.AUTHENTICATED="authenticated",w.UNAUTHENTICATED=w.prototype.UNAUTHENTICATED="unauthenticated",w.PENDING=w.prototype.PENDING="pending",w.ignoreStatuses=f.socketProtocolIgnoreStatuses,w.errorStatuses=f.socketProtocolErrorStatuses,w.prototype._privateEventHandlerMap={"#publish":function(t){var e=this._undecorateChannelName(t.channel),r=this.isSubscribed(e,!0);r&&this._channelEmitter.emit(e,t.data)},"#kickOut":function(t){var e=this._undecorateChannelName(t.channel),r=this.channels[e];r&&(o.prototype.emit.call(this,"kickOut",t.message,e),r.emit("kickOut",t.message,e),this._triggerChannelUnsubscribe(r))},"#setAuthToken":function(t,e){var r=this;if(t){var n=function(n){n?(e.error(n),r._onSCError(n)):(r._changeToAuthenticatedState(t.token),e.end())};this.auth.saveToken(this.authTokenName,t.token,{},n)}else e.error(new y("No token data provided by #setAuthToken event"))},"#removeAuthToken":function(t,e){var r=this;this.auth.removeToken(this.authTokenName,function(t,n){t?(e.error(t),r._onSCError(t)):(o.prototype.emit.call(r,"removeAuthToken",n),r._changeToUnauthenticatedStateAndClearTokens(),e.end())})},"#disconnect":function(t){this.transport.close(t.code,t.data)}},w.prototype.getState=function(){return this.state},w.prototype.getBytesReceived=function(){return this.transport.getBytesReceived()},w.prototype.deauthenticate=function(t){var e=this;this.auth.removeToken(this.authTokenName,function(r,n){r?e._onSCError(r):(o.prototype.emit.call(e,"removeAuthToken",n),e.state!=e.CLOSED&&e.emit("#removeAuthToken"),e._changeToUnauthenticatedStateAndClearTokens()),t&&t(r)})},w.prototype.connect=w.prototype.open=function(){var t=this;if(!this.active){var e=new g("Cannot connect a destroyed client");return void this._onSCError(e)}this.state==this.CLOSED&&(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this.state=this.CONNECTING,o.prototype.emit.call(this,"connecting"),this.transport&&this.transport.off(),this.transport=new c(this.auth,this.codec,this.options),this.transport.on("open",function(e){t.state=t.OPEN,t._onSCOpen(e)}),this.transport.on("error",function(e){t._onSCError(e)}),this.transport.on("close",function(e,r){t.state=t.CLOSED,t._onSCClose(e,r)}),this.transport.on("openAbort",function(e,r){t.state=t.CLOSED,t._onSCClose(e,r,!0)}),this.transport.on("event",function(e,r,n){t._onSCEvent(e,r,n)}))},w.prototype.reconnect=function(t,e){this.disconnect(t,e),this.connect()},w.prototype.disconnect=function(t,e){if(t=t||1e3,"number"!=typeof t)throw new d("If specified, the code argument must be a number");this.state==this.OPEN||this.state==this.CONNECTING?this.transport.close(t,e):(this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef))},w.prototype.destroy=function(t,e){E&&r.removeEventListener&&r.removeEventListener("beforeunload",this._unloadHandler,!1),this.active=!1,this.disconnect(t,e),delete this._clientMap[this.clientId]},w.prototype._changeToUnauthenticatedStateAndClearTokens=function(){if(this.authState!=this.UNAUTHENTICATED){var t=this.authState,e=this.signedAuthToken;this.authState=this.UNAUTHENTICATED,this.signedAuthToken=null,this.authToken=null;var r={oldState:t,newState:this.authState};o.prototype.emit.call(this,"authStateChange",r),o.prototype.emit.call(this,"deauthenticate",e)}},w.prototype._changeToAuthenticatedState=function(t){if(this.signedAuthToken=t,this.authToken=this._extractAuthTokenData(t),this.authState!=this.AUTHENTICATED){var e=this.authState;this.authState=this.AUTHENTICATED;var r={oldState:e,newState:this.authState,signedAuthToken:t,authToken:this.authToken};this.preparingPendingSubscriptions||this.processPendingSubscriptions(),o.prototype.emit.call(this,"authStateChange",r)}o.prototype.emit.call(this,"authenticate",t)},w.prototype.decodeBase64=function(t){var e;if("undefined"==typeof n)e=r.atob?r.atob(t):l.decode(t);else{var o=new n(t,"base64");e=o.toString("utf8")}return e},w.prototype.encodeBase64=function(t){var e;if("undefined"==typeof n)e=r.btoa?r.btoa(t):l.encode(t);else{var o=new n(t,"utf8");e=o.toString("base64")}return e},w.prototype._extractAuthTokenData=function(t){var e=(t||"").split("."),r=e[1];if(null!=r){var n=r;try{return n=this.decodeBase64(n),JSON.parse(n)}catch(o){return n}}return null},w.prototype.getAuthToken=function(){return this.authToken},w.prototype.getSignedAuthToken=function(){return this.signedAuthToken},w.prototype.authenticate=function(t,e){var r=this;this.emit("#authenticate",t,function(n,o){o&&null!=o.isAuthenticated?o.authError&&(o.authError=f.hydrateError(o.authError)):o={isAuthenticated:r.authState,authError:null},n?("BadConnectionError"!=n.name&&"TimeoutError"!=n.name&&r._changeToUnauthenticatedStateAndClearTokens(),e&&e(n,o)):r.auth.saveToken(r.authTokenName,t,{},function(n){n&&r._onSCError(n),o.isAuthenticated?r._changeToAuthenticatedState(t):r._changeToUnauthenticatedStateAndClearTokens(),e&&e(n,o)})})},w.prototype._tryReconnect=function(t){var e,r=this,n=this.connectAttempts++,o=this.options.autoReconnectOptions;if(null==t||n>0){var i=Math.round(o.initialDelay+(o.randomness||0)*Math.random());e=Math.round(i*Math.pow(o.multiplier,n))}else e=t;e>o.maxDelay&&(e=o.maxDelay),clearTimeout(this._reconnectTimeoutRef),this.pendingReconnect=!0,this.pendingReconnectTimeout=e,this._reconnectTimeoutRef=setTimeout(function(){r.connect()},e)},w.prototype._onSCOpen=function(t){var e=this;this.preparingPendingSubscriptions=!0,t?(this.id=t.id,this.pingTimeout=t.pingTimeout,this.transport.pingTimeout=this.pingTimeout,t.isAuthenticated?this._changeToAuthenticatedState(t.authToken):this._changeToUnauthenticatedStateAndClearTokens()):this._changeToUnauthenticatedStateAndClearTokens(),this.connectAttempts=0,this.options.autoSubscribeOnConnect&&this.processPendingSubscriptions(),o.prototype.emit.call(this,"connect",t,function(){e.processPendingSubscriptions()}),this.state==this.OPEN&&this._flushEmitBuffer()},w.prototype._onSCError=function(t){var e=this;setTimeout(function(){if(e.listeners("error").length<1)throw t;o.prototype.emit.call(e,"error",t)},0)},w.prototype._suspendSubscriptions=function(){var t,e;for(var r in this.channels)this.channels.hasOwnProperty(r)&&(t=this.channels[r],e=t.state==t.SUBSCRIBED||t.state==t.PENDING?t.PENDING:t.UNSUBSCRIBED,this._triggerChannelUnsubscribe(t,e))},w.prototype._abortAllPendingEventsDueToBadConnection=function(t){for(var e,r=this._emitBuffer.head;r;){e=r.next;var n=r.data;clearTimeout(n.timeout),delete n.timeout,r.detach(),r=e;var o=n.callback;if(o){delete n.callback;var i="Event '"+n.event+"' was aborted due to a bad connection",s=new v(i,t);o.call(n,s,n)}n.cid&&this.transport.cancelPendingResponse(n.cid)}},w.prototype._onSCClose=function(t,e,r){var n=this;if(this.id=null,this.transport&&this.transport.off(),this.pendingReconnect=!1,this.pendingReconnectTimeout=null,clearTimeout(this._reconnectTimeoutRef),this._suspendSubscriptions(),this._abortAllPendingEventsDueToBadConnection(r?"connectAbort":"disconnect"),this.options.autoReconnect&&(4e3==t||4001==t||1005==t?this._tryReconnect(0):1e3!=t&&t<4500&&this._tryReconnect()),r?o.prototype.emit.call(n,"connectAbort",t,e):o.prototype.emit.call(n,"disconnect",t,e),o.prototype.emit.call(n,"close",t,e),!w.ignoreStatuses[t]){var i;i=e?"Socket connection closed with status code "+t+" and reason: "+e:"Socket connection closed with status code "+t;var s=new m(w.errorStatuses[t]||i,t);this._onSCError(s)}},w.prototype._onSCEvent=function(t,e,r){var n=this._privateEventHandlerMap[t];n?n.call(this,e,r):o.prototype.emit.call(this,t,e,function(){r&&r.callback.apply(r,arguments)})},w.prototype.decode=function(t){return this.transport.decode(t)},w.prototype.encode=function(t){return this.transport.encode(t)},w.prototype._flushEmitBuffer=function(){for(var t,e=this._emitBuffer.head;e;){t=e.next;var r=e.data;e.detach(),this.transport.emitObject(r),e=t}},w.prototype._handleEventAckTimeout=function(t,e){e&&e.detach(),delete t.timeout;var r=t.callback;if(r){delete t.callback;var n=new b("Event response for '"+t.event+"' timed out");r.call(t,n,t)}t.cid&&this.transport.cancelPendingResponse(t.cid)},w.prototype._emit=function(t,e,r){var n=this;this.state==this.CLOSED&&this.connect();var o={event:t,callback:r},i=new h.Item;this.options.cloneData?o.data=p(e):o.data=e,i.data=o,o.timeout=setTimeout(function(){n._handleEventAckTimeout(o,i)},this.ackTimeout),this._emitBuffer.append(i),this.state==this.OPEN&&this._flushEmitBuffer()},w.prototype.send=function(t){this.transport.send(t)},w.prototype.emit=function(t,e,r){if(null==this._localEvents[t])this._emit(t,e,r);else if("error"==t)o.prototype.emit.call(this,t,e);else{var n=new g('The "'+t+'" event is reserved and cannot be emitted on a client socket');this._onSCError(n)}},w.prototype.publish=function(t,e,r){var n={channel:this._decorateChannelName(t),data:e};this.emit("#publish",n,r)},w.prototype._triggerChannelSubscribe=function(t,e){var r=t.name;if(t.state!=t.SUBSCRIBED){var n=t.state;t.state=t.SUBSCRIBED;var i={channel:r,oldState:n,newState:t.state,subscriptionOptions:e};t.emit("subscribeStateChange",i),t.emit("subscribe",r,e),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"subscribe",r,e)}},w.prototype._triggerChannelSubscribeFail=function(t,e,r){var n=e.name,i=!e.waitForAuth||this.authState==this.AUTHENTICATED;e.state!=e.UNSUBSCRIBED&&i&&(e.state=e.UNSUBSCRIBED,e.emit("subscribeFail",t,n,r),o.prototype.emit.call(this,"subscribeFail",t,n,r))},w.prototype._cancelPendingSubscribeCallback=function(t){null!=t._pendingSubscriptionCid&&(this.transport.cancelPendingResponse(t._pendingSubscriptionCid),delete t._pendingSubscriptionCid)},w.prototype._decorateChannelName=function(t){return this.channelPrefix&&(t=this.channelPrefix+t),t},w.prototype._undecorateChannelName=function(t){return this.channelPrefix&&0==t.indexOf(this.channelPrefix)?t.replace(this.channelPrefix,""):t},w.prototype._trySubscribe=function(t){var e=this,r=!t.waitForAuth||this.authState==this.AUTHENTICATED;if(this.state==this.OPEN&&!this.preparingPendingSubscriptions&&null==t._pendingSubscriptionCid&&r){var n={noTimeout:!0},i={channel:this._decorateChannelName(t.name)};t.waitForAuth&&(n.waitForAuth=!0,i.waitForAuth=n.waitForAuth),t.data&&(i.data=t.data),t.batch&&(n.batch=!0,i.batch=!0),t._pendingSubscriptionCid=this.transport.emit("#subscribe",i,n,function(r){delete t._pendingSubscriptionCid,r?e._triggerChannelSubscribeFail(r,t,i):e._triggerChannelSubscribe(t,i)}),o.prototype.emit.call(this,"subscribeRequest",t.name,i)}},w.prototype.subscribe=function(t,e){var r=this.channels[t];return r?e&&r.setOptions(e):(r=new i(t,this,e),this.channels[t]=r),r.state==r.UNSUBSCRIBED&&(r.state=r.PENDING,this._trySubscribe(r)),r},w.prototype._triggerChannelUnsubscribe=function(t,e){var r=t.name,n=t.state;if(e?t.state=e:t.state=t.UNSUBSCRIBED,this._cancelPendingSubscribeCallback(t),n==t.SUBSCRIBED){var i={channel:r,oldState:n,newState:t.state};t.emit("subscribeStateChange",i),t.emit("unsubscribe",r),o.prototype.emit.call(this,"subscribeStateChange",i),o.prototype.emit.call(this,"unsubscribe",r)}},w.prototype._tryUnsubscribe=function(t){if(this.state==this.OPEN){var e={noTimeout:!0};t.batch&&(e.batch=!0),this._cancelPendingSubscribeCallback(t);var r=this._decorateChannelName(t.name);this.transport.emit("#unsubscribe",r,e)}},w.prototype.unsubscribe=function(t){var e=this.channels[t];e&&e.state!=e.UNSUBSCRIBED&&(this._triggerChannelUnsubscribe(e),this._tryUnsubscribe(e))},w.prototype.channel=function(t,e){var r=this.channels[t];return r||(r=new i(t,this,e),this.channels[t]=r),r},w.prototype.destroyChannel=function(t){var e=this.channels[t];e&&(e.unwatch(),e.unsubscribe(),delete this.channels[t])},w.prototype.subscriptions=function(t){var e,r,n=[];for(var o in this.channels)this.channels.hasOwnProperty(o)&&(e=this.channels[o],r=t?e&&(e.state==e.SUBSCRIBED||e.state==e.PENDING):e&&e.state==e.SUBSCRIBED,r&&n.push(o));return n},w.prototype.isSubscribed=function(t,e){var r=this.channels[t];return e?!!r&&(r.state==r.SUBSCRIBED||r.state==r.PENDING):!!r&&r.state==r.SUBSCRIBED},w.prototype.processPendingSubscriptions=function(){var t=this;this.preparingPendingSubscriptions=!1;var e=[];for(var r in this.channels)if(this.channels.hasOwnProperty(r)){var n=this.channels[r];n.state==n.PENDING&&e.push(n)}e.sort(function(t,e){var r=t.priority||0,n=e.priority||0;return r>n?-1:r>(-2*o&6)));return i},f=function(t){t=String(t),/[^\0-\xFF]/.test(t)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var e,r,n,o,i=t.length%3,s="",a=-1,c=t.length-i;++a>18&63)+h.charAt(o>>12&63)+h.charAt(o>>6&63)+h.charAt(63&o);return 2==i?(e=t.charCodeAt(a)<<8,r=t.charCodeAt(++a),o=e+r,s+=h.charAt(o>>10)+h.charAt(o>>4&63)+h.charAt(o<<2&63)+"="):1==i&&(o=t.charCodeAt(a),s+=h.charAt(o>>2)+h.charAt(o<<4&63)+"=="),s},d={encode:f,decode:p,version:"0.1.0"};if("function"==typeof t&&"object"==typeof t.amd&&t.amd)t(function(){return d});else if(i&&!i.nodeType)if(s)s.exports=d;else for(var y in d)d.hasOwnProperty(y)&&(i[y]=d[y]);else o.base64=d}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function o(t){return 3*t.length/4-n(t)}function i(t){var e,r,o,i,s,a=t.length;i=n(t),s=new l(3*a/4-i),r=i>0?a-4:a;var c=0;for(e=0;e>16&255,s[c++]=o>>8&255,s[c++]=255&o;return 2===i?(o=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[c++]=255&o):1===i&&(o=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[c++]=o>>8&255,s[c++]=255&o),s}function s(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function a(t,e,r){for(var n,o=[],i=e;ih?h:c+s));return 1===n?(e=t[r-1],o+=u[e>>2],o+=u[e<<4&63],o+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],o+=u[e>>10],o+=u[e>>4&63],o+=u[e<<2&63],o+="="),i.push(o),i.join("")}r.byteLength=o,r.toByteArray=i,r.fromByteArray=c;for(var u=[],h=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=p.length;f * @license MIT */ -"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}function o(t){if(t>K)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return s(t,e,r)}function s(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return J(t)||t&&J(t.buffer)?l(t,e,r):"string"==typeof t?h(t,e):f(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}function u(t){return a(t),o(t<0?0:0|d(t))}function h(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=o(r),s=n.write(t,e);return s!==r&&(n=n.slice(0,s)),n}function p(t){for(var e=t.length<0?0:0|d(t.length),r=o(e),n=0;n=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function m(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,W(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,o);if("number"==typeof e)return e=255&e,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,o){function i(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}var u;if(o){var h=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var p=!0,l=0;lo&&(n=o)):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s239?4:i>223?3:i>191?2:1;if(o+a<=r){var c,u,h,p;switch(a){case 1:i<128&&(s=i);break;case 2:c=t[o+1],128===(192&c)&&(p=(31&i)<<6|63&c,p>127&&(s=p));break;case 3:c=t[o+1],u=t[o+2],128===(192&c)&&128===(192&u)&&(p=(15&i)<<12|(63&c)<<6|63&u,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:c=t[o+1],u=t[o+2],h=t[o+3],128===(192&c)&&128===(192&u)&&128===(192&h)&&(p=(15&i)<<18|(63&c)<<12|(63&u)<<6|63&h,p>65535&&p<1114112&&(s=p))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=a}return I(n)}function I(t){var e=t.length;if(e<=X)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function j(t,e,r,n,o,i){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,o){return e=+e,r>>>=0,o||j(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),V.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),V.write(t,e,r,n,52,8),r+8}function M(t){if(t=t.split("=")[0],t=t.trim().replace(Z,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],s=0;s55295&&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=(o-55296<<10|r-56320)+65536}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 H(t){for(var e=[],r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function z(t){return Y.toByteArray(M(t))}function $(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function J(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function W(t){return t!==t}var Y=t("base64-js"),V=t("ieee754");r.Buffer=i,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var K=2147483647;r.kMaxLength=K,i.TYPED_ARRAY_SUPPORT=n(),i.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(i.prototype,"parent",{get:function(){if(this instanceof i)return this.buffer}}),Object.defineProperty(i.prototype,"offset",{get:function(){if(this instanceof i)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return s(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return c(t,e,r)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&t._isBuffer===!0},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var s=o-n,a=r-e,c=Math.min(s,a),u=this.slice(n,o),h=t.slice(e,r),p=0;p>>=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 w(this,t,e,r);case"utf8":case"utf-8":return T(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i=o&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),V.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),V.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),V.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),V.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);R(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t=255&t);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s>1,h=-7,p=r?o-1:0,l=r?-1:1,f=t[e+p];for(p+=l,i=f&(1<<-h)-1,f>>=-h,h+=a;h>0;i=256*i+t[e+p],p+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+p],p+=l,h-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,d=n?1:-1,y=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*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+p>=1?l/c:l*Math.pow(2,1-p),e*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(e*c-1)*Math.pow(2,o),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;t[r+f]=255&a,f+=d,a/=256,o-=8);for(s=s<0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y}},{}],14:[function(t,e,r){"use strict";function n(){if(arguments.length)return n.from(arguments)}function o(){}var i;i="An argument without append, prepend, or detach methods was given to `List";var s;s=n.prototype,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;++r0&&u>c&&(u=c);for(var h=0;h=0?(p=y.substr(0,g),l=y.substr(g+1)):(p=y,l=""),f=decodeURIComponent(p),d=decodeURIComponent(l),n(s,f)?o(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],17:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n>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},i=function(e,r){if(t.ArrayBuffer&&r instanceof t.ArrayBuffer)return{base64:!0,data:o(r)};if(t.Buffer){if(r instanceof t.Buffer)return{base64:!0,data:r.toString("base64")};if(r&&"Buffer"===r.type&&Array.isArray(r.data)){var n;return n=t.Buffer.from?t.Buffer.from(r.data):new t.Buffer(r.data),{base64:!0,data:n.toString("base64")}}}return r};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(r){}return e},e.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,i)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(t,e,r){var n=t("./v1"),o=t("./v4"),i=o;i.v1=n,i.v4=o,e.exports=i},{"./v1":26,"./v4":27}],24:[function(t,e,r){function n(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}for(var o=[],i=0;i<256;++i)o[i]=(i+256).toString(16).substr(1);e.exports=n},{}],25:[function(t,e,r){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var i=new Array(16);e.exports=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},{}],26:[function(t,e,r){function n(t,e,r){var n=e&&r||0,h=e||[];t=t||{};var p=t.node||o,l=void 0!==t.clockseq?t.clockseq:i;if(null==p||null==l){var f=s();null==p&&(p=o=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==l&&(l=i=16383&(f[6]<<8|f[7]))}var d=void 0!==t.msecs?t.msecs:(new Date).getTime(),y=void 0!==t.nsecs?t.nsecs:u+1,g=d-c+(y-u)/1e4;if(g<0&&void 0===t.clockseq&&(l=l+1&16383),(g<0||d>c)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=d,u=y,i=l,d+=122192928e5;var m=(1e4*(268435455&d)+y)%4294967296;h[n++]=m>>>24&255,h[n++]=m>>>16&255,h[n++]=m>>>8&255,h[n++]=255&m;var b=d/4294967296*1e4&268435455;h[n++]=b>>>8&255,h[n++]=255&b,h[n++]=b>>>24&15|16,h[n++]=b>>>16&255,h[n++]=l>>>8|128,h[n++]=255&l;for(var v=0;v<6;++v)h[n+v]=p[v];return e?e:a(h)}var o,i,s=t("./lib/rng"),a=t("./lib/bytesToUuid"),c=0,u=0;e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}],27:[function(t,e,r){function n(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[n+a]=s[a];return e||i(s)}var o=t("./lib/rng"),i=t("./lib/bytesToUuid");e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}]},{},[1])(1)});var channelList=[];!function(){function t(t){try{if("undefined"==typeof channelList[t]){channelList[t]=o.subscribe("chat_"+t),channelList[t].on("subscribeFail",function(t){console.error("Failed to subscribe to the sample channel due to error: "+t)});var e=$("#user-is-typing-"+t);channelList[t].watch(function(t){"vt"==t.op?e.text(t.msg).css("visibility","visible"):"vts"==t.op?e.text(t.msg).css("visibility","hidden"):"cmsg"==t.op&&lhinst.syncadmincall()})}}catch(r){console.log(r)}}function e(t){t.ttx=lh.nodejsHelperOptions.typer,ee.emitEvent("nodeJsTypingOperator",[t]),o.publish("chat_"+t.chat_id,{op:"ot",data:t})}function r(t){try{"undefined"!=typeof channelList[t]&&(channelList[t].destroy(),delete channelList[t])}catch(e){console.log(e)}}var n={hostname:lh.nodejsHelperOptions.hostname,path:lh.nodejsHelperOptions.path};""!=lh.nodejsHelperOptions.port&&(n.port=parseInt(lh.nodejsHelperOptions.port)),1==lh.nodejsHelperOptions.secure&&(n.secure=!0);var o=socketCluster.connect(n);o.on("error",function(t){console.error(t)}),o.on("close",function(){try{lhinst.nodeJsMode=!1,channelList.forEach(function(t){"undefined"!=typeof t&&t.destroy()}),channelList=[],ee.removeListener("chatTabLoaded",t),ee.removeListener("operatorTyping",e),ee.removeListener("removeSynchroChat",r),confLH.chat_message_sinterval=confLH.defaut_chat_message_sinterval}catch(n){console.log(n)}}),o.on("connect",function(){try{lhinst.nodeJsMode=!0,lhinst.chatsSynchronising.forEach(function(e){t(e)}),ee.addListener("chatTabLoaded",t),ee.addListener("operatorTyping",e),ee.addListener("removeSynchroChat",r),confLH.chat_message_sinterval=15e3}catch(n){console.log(n)}}),$(window).on("beforeunload",function(){o.destroy()})}(); \ No newline at end of file +"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}function o(t){if(t>K)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return s(t,e,r)}function s(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return J(t)||t&&J(t.buffer)?p(t,e,r):"string"==typeof t?h(t,e):f(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}function u(t){return a(t),o(t<0?0:0|d(t))}function h(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=o(r),s=n.write(t,e);return s!==r&&(n=n.slice(0,s)),n}function l(t){for(var e=t.length<0?0:0|d(t.length),r=o(e),n=0;n=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function m(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,W(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,o);if("number"==typeof e)return e=255&e,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,o){function i(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}var u;if(o){var h=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var l=!0,p=0;po&&(n=o)):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s239?4:i>223?3:i>191?2:1;if(o+a<=r){var c,u,h,l;switch(a){case 1:i<128&&(s=i);break;case 2:c=t[o+1],128===(192&c)&&(l=(31&i)<<6|63&c,l>127&&(s=l));break;case 3:c=t[o+1],u=t[o+2],128===(192&c)&&128===(192&u)&&(l=(15&i)<<12|(63&c)<<6|63&u,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:c=t[o+1],u=t[o+2],h=t[o+3],128===(192&c)&&128===(192&u)&&128===(192&h)&&(l=(15&i)<<18|(63&c)<<12|(63&u)<<6|63&h,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=a}return I(n)}function I(t){var e=t.length;if(e<=X)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function R(t,e,r,n,o,i){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,o){return e=+e,r>>>=0,o||R(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),V.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),V.write(t,e,r,n,52,8),r+8}function M(t){if(t=t.split("=")[0],t=t.trim().replace(Z,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],s=0;s55295&&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=(o-55296<<10|r-56320)+65536}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 F(t){for(var e=[],r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function z(t){return Y.toByteArray(M(t))}function $(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function J(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function W(t){return t!==t}var Y=t("base64-js"),V=t("ieee754");r.Buffer=i,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var K=2147483647;r.kMaxLength=K,i.TYPED_ARRAY_SUPPORT=n(),i.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(i.prototype,"parent",{get:function(){if(this instanceof i)return this.buffer}}),Object.defineProperty(i.prototype,"offset",{get:function(){if(this instanceof i)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return s(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return c(t,e,r)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&t._isBuffer===!0},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var s=o-n,a=r-e,c=Math.min(s,a),u=this.slice(n,o),h=t.slice(e,r),l=0;l>>=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 w(this,t,e,r);case"utf8":case"utf-8":return T(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t],o=1,i=0;++i=o&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||j(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||j(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||j(t,4,this.length),V.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||j(t,4,this.length),V.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||j(t,8,this.length),V.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||j(t,8,this.length),V.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;P(this,t,e,r,o,0)}var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;P(this,t,e,r,o,0)}var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(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},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(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},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);P(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);P(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(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},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(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},i.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t=255&t);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s>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-u;else{if(i===c)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,d=n?1:-1,y=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*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+l>=1?p/c:p*Math.pow(2,1-l),e*c>=2&&(s++,c/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*c-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<0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y}},{}],14:[function(t,e,r){"use strict";function n(){if(arguments.length)return n.from(arguments)}function o(){}var i;i="An argument without append, prepend, or detach methods was given to `List";var s;s=n.prototype,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;++r0&&u>c&&(u=c);for(var h=0;h=0?(l=y.substr(0,g),p=y.substr(g+1)):(l=y,p=""),f=decodeURIComponent(l),d=decodeURIComponent(p),n(s,f)?o(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],17:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n>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},i=function(e,r){if(t.ArrayBuffer&&r instanceof t.ArrayBuffer)return{base64:!0,data:o(r)};if(t.Buffer){if(r instanceof t.Buffer)return{base64:!0,data:r.toString("base64")};if(r&&"Buffer"===r.type&&Array.isArray(r.data)){var n;return n=t.Buffer.from?t.Buffer.from(r.data):new t.Buffer(r.data),{base64:!0,data:n.toString("base64")}}}return r};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(r){}return e},e.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,i)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(t,e,r){var n=t("./v1"),o=t("./v4"),i=o;i.v1=n,i.v4=o,e.exports=i},{"./v1":26,"./v4":27}],24:[function(t,e,r){function n(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}for(var o=[],i=0;i<256;++i)o[i]=(i+256).toString(16).substr(1);e.exports=n},{}],25:[function(t,e,r){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var i=new Array(16);e.exports=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},{}],26:[function(t,e,r){function n(t,e,r){var n=e&&r||0,h=e||[];t=t||{};var l=t.node||o,p=void 0!==t.clockseq?t.clockseq:i;if(null==l||null==p){var f=s();null==l&&(l=o=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==p&&(p=i=16383&(f[6]<<8|f[7]))}var d=void 0!==t.msecs?t.msecs:(new Date).getTime(),y=void 0!==t.nsecs?t.nsecs:u+1,g=d-c+(y-u)/1e4;if(g<0&&void 0===t.clockseq&&(p=p+1&16383),(g<0||d>c)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=d,u=y,i=p,d+=122192928e5;var m=(1e4*(268435455&d)+y)%4294967296;h[n++]=m>>>24&255,h[n++]=m>>>16&255,h[n++]=m>>>8&255,h[n++]=255&m;var b=d/4294967296*1e4&268435455;h[n++]=b>>>8&255,h[n++]=255&b,h[n++]=b>>>24&15|16,h[n++]=b>>>16&255,h[n++]=p>>>8|128,h[n++]=255&p;for(var v=0;v<6;++v)h[n+v]=l[v];return e?e:a(h)}var o,i,s=t("./lib/rng"),a=t("./lib/bytesToUuid"),c=0,u=0;e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}],27:[function(t,e,r){function n(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[n+a]=s[a];return e||i(s)}var o=t("./lib/rng"),i=t("./lib/bytesToUuid");e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}]},{},[1])(1)});var channelList=[];!function(){function t(t){try{if("undefined"==typeof channelList[t]){lh.nodejsHelperOptions.instance_id>0?channelList[t]=s.subscribe("chat_"+lh.nodejsHelperOptions.instance_id+"_"+t):channelList[t]=s.subscribe("chat_"+t),channelList[t].on("subscribeFail",function(t){console.error("Failed to subscribe to the sample channel due to error: "+t)});var e=$("#user-is-typing-"+t);channelList[t].watch(function(t){"vt"==t.op?e.text(t.msg).css("visibility","visible"):"vts"==t.op?e.text(t.msg).css("visibility","hidden"):"cmsg"==t.op&&lhinst.syncadmincall()})}}catch(r){console.log(r)}}function e(t){t.ttx=lh.nodejsHelperOptions.typer,ee.emitEvent("nodeJsTypingOperator",[t]),lh.nodejsHelperOptions.instance_id>0?s.publish("chat_"+lh.nodejsHelperOptions.instance_id+"_"+t.chat_id,{op:"ot",data:t}):s.publish("chat_"+t.chat_id,{op:"ot",data:t})}function r(t){try{"undefined"!=typeof channelList[t]&&(channelList[t].destroy(),delete channelList[t])}catch(e){console.log(e)}}function n(){try{lhinst.nodeJsMode=!0,lhinst.chatsSynchronising.forEach(function(e){t(e)}),ee.addListener("chatTabLoaded",t),ee.addListener("operatorTyping",e),ee.addListener("removeSynchroChat",r),confLH.chat_message_sinterval=15e3}catch(n){console.log(n)}}var o={hostname:lh.nodejsHelperOptions.hostname,path:lh.nodejsHelperOptions.path};""!=lh.nodejsHelperOptions.port&&(o.port=parseInt(lh.nodejsHelperOptions.port)),1==lh.nodejsHelperOptions.secure&&(o.secure=!0);var i;i=lh.nodejsHelperOptions.instance_id>0?"chat_"+lh.nodejsHelperOptions.instance_id+"_"+lhinst.chat_id:"chat_"+lhinst.chat_id;var s=socketCluster.connect(o);s.on("error",function(t){console.error(t)}),s.on("close",function(){try{lhinst.nodeJsMode=!1,channelList.forEach(function(t){"undefined"!=typeof t&&t.destroy()}),channelList=[],ee.removeListener("chatTabLoaded",t),ee.removeListener("operatorTyping",e),ee.removeListener("removeSynchroChat",r),confLH.chat_message_sinterval=confLH.defaut_chat_message_sinterval}catch(n){console.log(n)}}),s.on("connect",function(t){t.isAuthenticated?n():s.emit("login",{hash:lh.nodejsHelperOptions.hash,chanelName:i},function(t){t?console.log(t):n()})}),$(window).on("beforeunload",function(){s.destroy()})}(); \ No newline at end of file diff --git a/nodejshelper/design/nodejshelpertheme/js/nodejshelper.min.js b/nodejshelper/design/nodejshelpertheme/js/nodejshelper.min.js index c2af242..95c6f8b 100644 --- a/nodejshelper/design/nodejshelpertheme/js/nodejshelper.min.js +++ b/nodejshelper/design/nodejshelpertheme/js/nodejshelper.min.js @@ -4,5 +4,5 @@ * @author Feross Aboukhadijeh * @license MIT */ -"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}function o(t){if(t>K)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return s(t,e,r)}function s(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return $(t)||t&&$(t.buffer)?l(t,e,r):"string"==typeof t?h(t,e):f(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}function u(t){return a(t),o(t<0?0:0|d(t))}function h(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=o(r),s=n.write(t,e);return s!==r&&(n=n.slice(0,s)),n}function p(t){for(var e=t.length<0?0:0|d(t.length),r=o(e),n=0;n=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function m(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,o);if("number"==typeof e)return e=255&e,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,o){function i(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}var u;if(o){var h=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var p=!0,l=0;lo&&(n=o)):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s239?4:i>223?3:i>191?2:1;if(o+a<=r){var c,u,h,p;switch(a){case 1:i<128&&(s=i);break;case 2:c=t[o+1],128===(192&c)&&(p=(31&i)<<6|63&c,p>127&&(s=p));break;case 3:c=t[o+1],u=t[o+2],128===(192&c)&&128===(192&u)&&(p=(15&i)<<12|(63&c)<<6|63&u,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:c=t[o+1],u=t[o+2],h=t[o+3],128===(192&c)&&128===(192&u)&&128===(192&h)&&(p=(15&i)<<18|(63&c)<<12|(63&u)<<6|63&h,p>65535&&p<1114112&&(s=p))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=a}return I(n)}function I(t){var e=t.length;if(e<=X)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function j(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),V.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),V.write(t,e,r,n,52,8),r+8}function M(t){if(t=t.split("=")[0],t=t.trim().replace(Z,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],s=0;s55295&&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=(o-55296<<10|r-56320)+65536}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 G(t){for(var e=[],r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function z(t){return J.toByteArray(M(t))}function W(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function $(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function Y(t){return t!==t}var J=t("base64-js"),V=t("ieee754");r.Buffer=i,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var K=2147483647;r.kMaxLength=K,i.TYPED_ARRAY_SUPPORT=n(),i.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(i.prototype,"parent",{get:function(){if(this instanceof i)return this.buffer}}),Object.defineProperty(i.prototype,"offset",{get:function(){if(this instanceof i)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return s(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return c(t,e,r)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&t._isBuffer===!0},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var s=o-n,a=r-e,c=Math.min(s,a),u=this.slice(n,o),h=t.slice(e,r),p=0;p>>=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 w(this,t,e,r);case"utf8":case"utf-8":return S(this,t,e,r);case"ascii":return k(this,t,e,r);case"latin1":case"binary":return T(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i=o&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),V.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),V.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),V.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),V.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);R(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t=255&t);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s>1,h=-7,p=r?o-1:0,l=r?-1:1,f=t[e+p];for(p+=l,i=f&(1<<-h)-1,f>>=-h,h+=a;h>0;i=256*i+t[e+p],p+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+p],p+=l,h-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,d=n?1:-1,y=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*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+p>=1?l/c:l*Math.pow(2,1-p),e*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(e*c-1)*Math.pow(2,o),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;t[r+f]=255&a,f+=d,a/=256,o-=8);for(s=s<0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y}},{}],14:[function(t,e,r){"use strict";function n(){if(arguments.length)return n.from(arguments)}function o(){}var i;i="An argument without append, prepend, or detach methods was given to `List";var s;s=n.prototype,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;++r0&&u>c&&(u=c);for(var h=0;h=0?(p=y.substr(0,g),l=y.substr(g+1)):(p=y,l=""),f=decodeURIComponent(p),d=decodeURIComponent(l),n(s,f)?o(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],17:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n>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},i=function(e,r){if(t.ArrayBuffer&&r instanceof t.ArrayBuffer)return{base64:!0,data:o(r)};if(t.Buffer){if(r instanceof t.Buffer)return{base64:!0,data:r.toString("base64")};if(r&&"Buffer"===r.type&&Array.isArray(r.data)){var n;return n=t.Buffer.from?t.Buffer.from(r.data):new t.Buffer(r.data),{base64:!0,data:n.toString("base64")}}}return r};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(r){}return e},e.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,i)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(t,e,r){var n=t("./v1"),o=t("./v4"),i=o;i.v1=n,i.v4=o,e.exports=i},{"./v1":26,"./v4":27}],24:[function(t,e,r){function n(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}for(var o=[],i=0;i<256;++i)o[i]=(i+256).toString(16).substr(1);e.exports=n},{}],25:[function(t,e,r){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var i=new Array(16);e.exports=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},{}],26:[function(t,e,r){function n(t,e,r){var n=e&&r||0,h=e||[];t=t||{};var p=t.node||o,l=void 0!==t.clockseq?t.clockseq:i;if(null==p||null==l){var f=s();null==p&&(p=o=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==l&&(l=i=16383&(f[6]<<8|f[7]))}var d=void 0!==t.msecs?t.msecs:(new Date).getTime(),y=void 0!==t.nsecs?t.nsecs:u+1,g=d-c+(y-u)/1e4;if(g<0&&void 0===t.clockseq&&(l=l+1&16383),(g<0||d>c)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=d,u=y,i=l,d+=122192928e5;var m=(1e4*(268435455&d)+y)%4294967296;h[n++]=m>>>24&255,h[n++]=m>>>16&255,h[n++]=m>>>8&255,h[n++]=255&m;var b=d/4294967296*1e4&268435455;h[n++]=b>>>8&255,h[n++]=255&b,h[n++]=b>>>24&15|16,h[n++]=b>>>16&255,h[n++]=l>>>8|128,h[n++]=255&l;for(var v=0;v<6;++v)h[n+v]=p[v];return e?e:a(h)}var o,i,s=t("./lib/rng"),a=t("./lib/bytesToUuid"),c=0,u=0;e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}],27:[function(t,e,r){function n(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[n+a]=s[a];return e||i(s)}var o=t("./lib/rng"),i=t("./lib/bytesToUuid");e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}]},{},[1])(1)}),function(){var t={hostname:lh_inst.nodejsHelperOptions.hostname,path:lh_inst.nodejsHelperOptions.path};""!=lh_inst.nodejsHelperOptions.port&&(t.port=parseInt(lh_inst.nodejsHelperOptions.port)),1==lh_inst.nodejsHelperOptions.secure&&(t.secure=!0);var e=socketCluster.connect(t);e.on("error",function(t){console.error(t)}),e.on("connect",function(){});var r=e.subscribe("uo_"+lh_inst.cookieDataPers.vid);r.on("subscribeFail",function(t){console.error("Failed to subscribe to the sample channel due to error: "+t)}),r.watch(function(t){"check_message"==t.op&&lh_inst.startNewMessageCheckSingle()})}(); \ No newline at end of file +"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}function o(t){if(t>K)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return s(t,e,r)}function s(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return $(t)||t&&$(t.buffer)?l(t,e,r):"string"==typeof t?h(t,e):f(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}function u(t){return a(t),o(t<0?0:0|d(t))}function h(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=o(r),s=n.write(t,e);return s!==r&&(n=n.slice(0,s)),n}function p(t){for(var e=t.length<0?0:0|d(t.length),r=o(e),n=0;n=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function m(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,o);if("number"==typeof e)return e=255&e,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,o){function i(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}var u;if(o){var h=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var p=!0,l=0;lo&&(n=o)):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s239?4:i>223?3:i>191?2:1;if(o+a<=r){var c,u,h,p;switch(a){case 1:i<128&&(s=i);break;case 2:c=t[o+1],128===(192&c)&&(p=(31&i)<<6|63&c,p>127&&(s=p));break;case 3:c=t[o+1],u=t[o+2],128===(192&c)&&128===(192&u)&&(p=(15&i)<<12|(63&c)<<6|63&u,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:c=t[o+1],u=t[o+2],h=t[o+3],128===(192&c)&&128===(192&u)&&128===(192&h)&&(p=(15&i)<<18|(63&c)<<12|(63&u)<<6|63&h,p>65535&&p<1114112&&(s=p))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=a}return I(n)}function I(t){var e=t.length;if(e<=X)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function j(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),V.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),V.write(t,e,r,n,52,8),r+8}function M(t){if(t=t.split("=")[0],t=t.trim().replace(Z,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],s=0;s55295&&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=(o-55296<<10|r-56320)+65536}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 G(t){for(var e=[],r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function z(t){return J.toByteArray(M(t))}function W(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function $(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function Y(t){return t!==t}var J=t("base64-js"),V=t("ieee754");r.Buffer=i,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var K=2147483647;r.kMaxLength=K,i.TYPED_ARRAY_SUPPORT=n(),i.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(i.prototype,"parent",{get:function(){if(this instanceof i)return this.buffer}}),Object.defineProperty(i.prototype,"offset",{get:function(){if(this instanceof i)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return s(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return c(t,e,r)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&t._isBuffer===!0},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var s=o-n,a=r-e,c=Math.min(s,a),u=this.slice(n,o),h=t.slice(e,r),p=0;p>>=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 w(this,t,e,r);case"utf8":case"utf-8":return k(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return T(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i=o&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),V.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),V.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),V.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),V.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);R(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t=255&t);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s>1,h=-7,p=r?o-1:0,l=r?-1:1,f=t[e+p];for(p+=l,i=f&(1<<-h)-1,f>>=-h,h+=a;h>0;i=256*i+t[e+p],p+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+p],p+=l,h-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,d=n?1:-1,y=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*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+p>=1?l/c:l*Math.pow(2,1-p),e*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(e*c-1)*Math.pow(2,o),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;t[r+f]=255&a,f+=d,a/=256,o-=8);for(s=s<0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y}},{}],14:[function(t,e,r){"use strict";function n(){if(arguments.length)return n.from(arguments)}function o(){}var i;i="An argument without append, prepend, or detach methods was given to `List";var s;s=n.prototype,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;++r0&&u>c&&(u=c);for(var h=0;h=0?(p=y.substr(0,g),l=y.substr(g+1)):(p=y,l=""),f=decodeURIComponent(p),d=decodeURIComponent(l),n(s,f)?o(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],17:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n>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},i=function(e,r){if(t.ArrayBuffer&&r instanceof t.ArrayBuffer)return{base64:!0,data:o(r)};if(t.Buffer){if(r instanceof t.Buffer)return{base64:!0,data:r.toString("base64")};if(r&&"Buffer"===r.type&&Array.isArray(r.data)){var n;return n=t.Buffer.from?t.Buffer.from(r.data):new t.Buffer(r.data),{base64:!0,data:n.toString("base64")}}}return r};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(r){}return e},e.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,i)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(t,e,r){var n=t("./v1"),o=t("./v4"),i=o;i.v1=n,i.v4=o,e.exports=i},{"./v1":26,"./v4":27}],24:[function(t,e,r){function n(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}for(var o=[],i=0;i<256;++i)o[i]=(i+256).toString(16).substr(1);e.exports=n},{}],25:[function(t,e,r){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var i=new Array(16);e.exports=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},{}],26:[function(t,e,r){function n(t,e,r){var n=e&&r||0,h=e||[];t=t||{};var p=t.node||o,l=void 0!==t.clockseq?t.clockseq:i;if(null==p||null==l){var f=s();null==p&&(p=o=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==l&&(l=i=16383&(f[6]<<8|f[7]))}var d=void 0!==t.msecs?t.msecs:(new Date).getTime(),y=void 0!==t.nsecs?t.nsecs:u+1,g=d-c+(y-u)/1e4;if(g<0&&void 0===t.clockseq&&(l=l+1&16383),(g<0||d>c)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=d,u=y,i=l,d+=122192928e5;var m=(1e4*(268435455&d)+y)%4294967296;h[n++]=m>>>24&255,h[n++]=m>>>16&255,h[n++]=m>>>8&255,h[n++]=255&m;var b=d/4294967296*1e4&268435455;h[n++]=b>>>8&255,h[n++]=255&b,h[n++]=b>>>24&15|16,h[n++]=b>>>16&255,h[n++]=l>>>8|128,h[n++]=255&l;for(var v=0;v<6;++v)h[n+v]=p[v];return e?e:a(h)}var o,i,s=t("./lib/rng"),a=t("./lib/bytesToUuid"),c=0,u=0;e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}],27:[function(t,e,r){function n(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[n+a]=s[a];return e||i(s)}var o=t("./lib/rng"),i=t("./lib/bytesToUuid");e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}]},{},[1])(1)}),function(){function t(){var t=r.subscribe("uo_"+lh_inst.cookieDataPers.vid);t.on("subscribeFail",function(t){console.error("Failed to subscribe to the sample channel due to error: "+t)}),t.watch(function(t){"check_message"==t.op&&lh_inst.startNewMessageCheckSingle()})}var e={hostname:lh_inst.nodejsHelperOptions.hostname,path:lh_inst.nodejsHelperOptions.path};""!=lh_inst.nodejsHelperOptions.port&&(e.port=parseInt(lh_inst.nodejsHelperOptions.port)),1==lh_inst.nodejsHelperOptions.secure&&(e.secure=!0);var r=socketCluster.connect(e);r.on("error",function(t){console.error(t)});var n="chat_uo_"+lh_inst.cookieDataPers.vid;r.on("connect",function(e){e.isAuthenticated?t():r.emit("login",{hash:lh_inst.nodejsHelperOptions.hash,chanelName:n},function(e){e?console.log(e):t()})})}(); \ No newline at end of file diff --git a/nodejshelper/design/nodejshelpertheme/js/nodejshelper.widget.min.js b/nodejshelper/design/nodejshelpertheme/js/nodejshelper.widget.min.js index b468a73..fa6010c 100644 --- a/nodejshelper/design/nodejshelpertheme/js/nodejshelper.widget.min.js +++ b/nodejshelper/design/nodejshelpertheme/js/nodejshelper.widget.min.js @@ -4,5 +4,5 @@ * @author Feross Aboukhadijeh * @license MIT */ -"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}function o(t){if(t>K)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return s(t,e,r)}function s(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return W(t)||t&&W(t.buffer)?l(t,e,r):"string"==typeof t?h(t,e):f(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}function u(t){return a(t),o(t<0?0:0|d(t))}function h(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=o(r),s=n.write(t,e);return s!==r&&(n=n.slice(0,s)),n}function p(t){for(var e=t.length<0?0:0|d(t.length),r=o(e),n=0;n=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function m(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,o);if("number"==typeof e)return e=255&e,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,o){function i(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}var u;if(o){var h=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var p=!0,l=0;lo&&(n=o)):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s239?4:i>223?3:i>191?2:1;if(o+a<=r){var c,u,h,p;switch(a){case 1:i<128&&(s=i);break;case 2:c=t[o+1],128===(192&c)&&(p=(31&i)<<6|63&c,p>127&&(s=p));break;case 3:c=t[o+1],u=t[o+2],128===(192&c)&&128===(192&u)&&(p=(15&i)<<12|(63&c)<<6|63&u,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:c=t[o+1],u=t[o+2],h=t[o+3],128===(192&c)&&128===(192&u)&&128===(192&h)&&(p=(15&i)<<18|(63&c)<<12|(63&u)<<6|63&h,p>65535&&p<1114112&&(s=p))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=a}return I(n)}function I(t){var e=t.length;if(e<=X)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function j(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),V.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),V.write(t,e,r,n,52,8),r+8}function M(t){if(t=t.split("=")[0],t=t.trim().replace(Z,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],s=0;s55295&&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=(o-55296<<10|r-56320)+65536}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 H(t){for(var e=[],r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function z(t){return J.toByteArray(M(t))}function $(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function W(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function Y(t){return t!==t}var J=t("base64-js"),V=t("ieee754");r.Buffer=i,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var K=2147483647;r.kMaxLength=K,i.TYPED_ARRAY_SUPPORT=n(),i.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(i.prototype,"parent",{get:function(){if(this instanceof i)return this.buffer}}),Object.defineProperty(i.prototype,"offset",{get:function(){if(this instanceof i)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return s(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return c(t,e,r)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&t._isBuffer===!0},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var s=o-n,a=r-e,c=Math.min(s,a),u=this.slice(n,o),h=t.slice(e,r),p=0;p>>=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 w(this,t,e,r);case"utf8":case"utf-8":return T(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=this[t],o=1,i=0;++i=o&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||P(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),V.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),V.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),V.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),V.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;R(this,t,e,r,o,0)}var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);R(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(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},i.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t=255&t);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s>1,h=-7,p=r?o-1:0,l=r?-1:1,f=t[e+p];for(p+=l,i=f&(1<<-h)-1,f>>=-h,h+=a;h>0;i=256*i+t[e+p],p+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+p],p+=l,h-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,d=n?1:-1,y=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*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+p>=1?l/c:l*Math.pow(2,1-p),e*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(e*c-1)*Math.pow(2,o),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;t[r+f]=255&a,f+=d,a/=256,o-=8);for(s=s<0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y}},{}],14:[function(t,e,r){"use strict";function n(){if(arguments.length)return n.from(arguments)}function o(){}var i;i="An argument without append, prepend, or detach methods was given to `List";var s;s=n.prototype,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;++r0&&u>c&&(u=c);for(var h=0;h=0?(p=y.substr(0,g),l=y.substr(g+1)):(p=y,l=""),f=decodeURIComponent(p),d=decodeURIComponent(l),n(s,f)?o(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],17:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n>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},i=function(e,r){if(t.ArrayBuffer&&r instanceof t.ArrayBuffer)return{base64:!0,data:o(r)};if(t.Buffer){if(r instanceof t.Buffer)return{base64:!0,data:r.toString("base64")};if(r&&"Buffer"===r.type&&Array.isArray(r.data)){var n;return n=t.Buffer.from?t.Buffer.from(r.data):new t.Buffer(r.data),{base64:!0,data:n.toString("base64")}}}return r};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(r){}return e},e.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,i)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(t,e,r){var n=t("./v1"),o=t("./v4"),i=o;i.v1=n,i.v4=o,e.exports=i},{"./v1":26,"./v4":27}],24:[function(t,e,r){function n(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}for(var o=[],i=0;i<256;++i)o[i]=(i+256).toString(16).substr(1);e.exports=n},{}],25:[function(t,e,r){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var i=new Array(16);e.exports=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},{}],26:[function(t,e,r){function n(t,e,r){var n=e&&r||0,h=e||[];t=t||{};var p=t.node||o,l=void 0!==t.clockseq?t.clockseq:i;if(null==p||null==l){var f=s();null==p&&(p=o=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==l&&(l=i=16383&(f[6]<<8|f[7]))}var d=void 0!==t.msecs?t.msecs:(new Date).getTime(),y=void 0!==t.nsecs?t.nsecs:u+1,g=d-c+(y-u)/1e4;if(g<0&&void 0===t.clockseq&&(l=l+1&16383),(g<0||d>c)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=d,u=y,i=l,d+=122192928e5;var m=(1e4*(268435455&d)+y)%4294967296;h[n++]=m>>>24&255,h[n++]=m>>>16&255,h[n++]=m>>>8&255,h[n++]=255&m;var b=d/4294967296*1e4&268435455;h[n++]=b>>>8&255,h[n++]=255&b,h[n++]=b>>>24&15|16,h[n++]=b>>>16&255,h[n++]=l>>>8|128,h[n++]=255&l;for(var v=0;v<6;++v)h[n+v]=p[v];return e?e:a(h)}var o,i,s=t("./lib/rng"),a=t("./lib/bytesToUuid"),c=0,u=0;e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}],27:[function(t,e,r){function n(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[n+a]=s[a];return e||i(s)}var o=t("./lib/rng"),i=t("./lib/bytesToUuid");e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}]},{},[1])(1)}),setTimeout(function(){function t(t){n.publish("chat_"+lhinst.chat_id,{op:"vt",msg:t.msg})}function e(){n.publish("chat_"+lhinst.chat_id,{op:"vts"})}var r={hostname:lh.nodejsHelperOptions.hostname,path:lh.nodejsHelperOptions.path};""!=lh.nodejsHelperOptions.port&&(r.port=parseInt(lh.nodejsHelperOptions.port)),1==lh.nodejsHelperOptions.secure&&(r.secure=!0);var n=socketCluster.connect(r),o=null;n.on("error",function(t){console.error(t)}),n.on("close",function(){LHCCallbacks.initTypingMonitoringUserInform=!1,null!==o&&o.destroy(),ee.removeListener("visitorTyping",t),ee.removeListener("visitorTypingStopped",e),confLH.chat_message_sinterval=confLH.defaut_chat_message_sinterval}),n.on("connect",function(){lhinst.chat_id>0&&(o=n.subscribe("chat_"+lhinst.chat_id),o.on("subscribeFail",function(t){console.error("Failed to subscribe to the sample channel due to error: "+t)}),o.watch(function(t){if("ot"==t.op){var e=$("#id-operator-typing");1==t.data.status?(e.text(t.data.ttx),e.css("visibility","visible")):e.css("visibility","hidden")}else"cmsg"==t.op?lhinst.syncusercall():"schange"==t.op&&(lhinst.chatsyncuserpending(),lhinst.syncusercall())}),LHCCallbacks.initTypingMonitoringUserInform=!0,ee.addListener("visitorTyping",t),ee.addListener("visitorTypingStopped",e),confLH.chat_message_sinterval=1e4,lhinst.syncusercall())}),$(window).on("beforeunload",function(){n.destroy()})},1e3); \ No newline at end of file +"use strict";function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}function o(t){if(t>K)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return s(t,e,r)}function s(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return W(t)||t&&W(t.buffer)?l(t,e,r):"string"==typeof t?h(t,e):f(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}function u(t){return a(t),o(t<0?0:0|d(t))}function h(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=o(r),s=n.write(t,e);return s!==r&&(n=n.slice(0,s)),n}function p(t){for(var e=t.length<0?0:0|d(t.length),r=o(e),n=0;n=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function m(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,o);if("number"==typeof e)return e=255&e,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,o){function i(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}var u;if(o){var h=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var p=!0,l=0;lo&&(n=o)):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s239?4:i>223?3:i>191?2:1;if(o+a<=r){var c,u,h,p;switch(a){case 1:i<128&&(s=i);break;case 2:c=t[o+1],128===(192&c)&&(p=(31&i)<<6|63&c,p>127&&(s=p));break;case 3:c=t[o+1],u=t[o+2],128===(192&c)&&128===(192&u)&&(p=(15&i)<<12|(63&c)<<6|63&u,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:c=t[o+1],u=t[o+2],h=t[o+3],128===(192&c)&&128===(192&u)&&128===(192&h)&&(p=(15&i)<<18|(63&c)<<12|(63&u)<<6|63&h,p>65535&&p<1114112&&(s=p))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=a}return I(n)}function I(t){var e=t.length;if(e<=X)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function R(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),V.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),V.write(t,e,r,n,52,8),r+8}function M(t){if(t=t.split("=")[0],t=t.trim().replace(Z,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],s=0;s55295&&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=(o-55296<<10|r-56320)+65536}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 F(t){for(var e=[],r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function z(t){return J.toByteArray(M(t))}function $(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function W(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function Y(t){return t!==t}var J=t("base64-js"),V=t("ieee754");r.Buffer=i,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var K=2147483647;r.kMaxLength=K,i.TYPED_ARRAY_SUPPORT=n(),i.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(i.prototype,"parent",{get:function(){if(this instanceof i)return this.buffer}}),Object.defineProperty(i.prototype,"offset",{get:function(){if(this instanceof i)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return s(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return c(t,e,r)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&t._isBuffer===!0},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var s=o-n,a=r-e,c=Math.min(s,a),u=this.slice(n,o),h=t.slice(e,r),p=0;p>>=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 w(this,t,e,r);case"utf8":case"utf-8":return T(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=this[t],o=1,i=0;++i=o&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||j(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||j(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||j(t,4,this.length),V.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||j(t,4,this.length),V.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||j(t,8,this.length),V.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||j(t,8,this.length),V.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;P(this,t,e,r,o,0)}var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;P(this,t,e,r,o,0)}var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(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},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(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},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);P(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);P(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(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},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(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},i.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t=255&t);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s>1,h=-7,p=r?o-1:0,l=r?-1:1,f=t[e+p];for(p+=l,i=f&(1<<-h)-1,f>>=-h,h+=a;h>0;i=256*i+t[e+p],p+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+p],p+=l,h-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,n),i-=u}return(f?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,h=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,d=n?1:-1,y=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*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+p>=1?l/c:l*Math.pow(2,1-p),e*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(e*c-1)*Math.pow(2,o),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;t[r+f]=255&a,f+=d,a/=256,o-=8);for(s=s<0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y}},{}],14:[function(t,e,r){"use strict";function n(){if(arguments.length)return n.from(arguments)}function o(){}var i;i="An argument without append, prepend, or detach methods was given to `List";var s;s=n.prototype,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;++r0&&u>c&&(u=c);for(var h=0;h=0?(p=y.substr(0,g),l=y.substr(g+1)):(p=y,l=""),f=decodeURIComponent(p),d=decodeURIComponent(l),n(s,f)?o(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],17:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n>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},i=function(e,r){if(t.ArrayBuffer&&r instanceof t.ArrayBuffer)return{base64:!0,data:o(r)};if(t.Buffer){if(r instanceof t.Buffer)return{base64:!0,data:r.toString("base64")};if(r&&"Buffer"===r.type&&Array.isArray(r.data)){var n;return n=t.Buffer.from?t.Buffer.from(r.data):new t.Buffer(r.data),{base64:!0,data:n.toString("base64")}}}return r};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(r){}return e},e.exports.encode=function(t){return"#1"===t||"#2"===t?t:JSON.stringify(t,i)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(t,e,r){var n=t("./v1"),o=t("./v4"),i=o;i.v1=n,i.v4=o,e.exports=i},{"./v1":26,"./v4":27}],24:[function(t,e,r){function n(t,e){var r=e||0,n=o;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}for(var o=[],i=0;i<256;++i)o[i]=(i+256).toString(16).substr(1);e.exports=n},{}],25:[function(t,e,r){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var i=new Array(16);e.exports=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},{}],26:[function(t,e,r){function n(t,e,r){var n=e&&r||0,h=e||[];t=t||{};var p=t.node||o,l=void 0!==t.clockseq?t.clockseq:i;if(null==p||null==l){var f=s();null==p&&(p=o=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==l&&(l=i=16383&(f[6]<<8|f[7]))}var d=void 0!==t.msecs?t.msecs:(new Date).getTime(),y=void 0!==t.nsecs?t.nsecs:u+1,g=d-c+(y-u)/1e4;if(g<0&&void 0===t.clockseq&&(l=l+1&16383),(g<0||d>c)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=d,u=y,i=l,d+=122192928e5;var m=(1e4*(268435455&d)+y)%4294967296;h[n++]=m>>>24&255,h[n++]=m>>>16&255,h[n++]=m>>>8&255,h[n++]=255&m;var b=d/4294967296*1e4&268435455;h[n++]=b>>>8&255,h[n++]=255&b,h[n++]=b>>>24&15|16,h[n++]=b>>>16&255,h[n++]=l>>>8|128,h[n++]=255&l;for(var v=0;v<6;++v)h[n+v]=p[v];return e?e:a(h)}var o,i,s=t("./lib/rng"),a=t("./lib/bytesToUuid"),c=0,u=0;e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}],27:[function(t,e,r){function n(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||o)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;++a)e[n+a]=s[a];return e||i(s)}var o=t("./lib/rng"),i=t("./lib/bytesToUuid");e.exports=n},{"./lib/bytesToUuid":24,"./lib/rng":25}]},{},[1])(1)}),setTimeout(function(){function t(t){lh.nodejsHelperOptions.instance_id>0?i.publish("chat_"+lh.nodejsHelperOptions.instance_id+"_"+lhinst.chat_id,{op:"vt",msg:t.msg}):i.publish("chat_"+lhinst.chat_id,{op:"vt",msg:t.msg})}function e(){lh.nodejsHelperOptions.instance_id>0?i.publish("chat_"+lh.nodejsHelperOptions.instance_id+"_"+lhinst.chat_id,{op:"vts"}):i.publish("chat_"+lhinst.chat_id,{op:"vts"})}function r(){s=lh.nodejsHelperOptions.instance_id>0?i.subscribe("chat_"+lh.nodejsHelperOptions.instance_id+"_"+lhinst.chat_id):i.subscribe("chat_"+lhinst.chat_id),s.on("subscribeFail",function(t){console.error("Failed to subscribe to the sample channel due to error: "+t)}),s.watch(function(t){if("ot"==t.op){var e=$("#id-operator-typing");1==t.data.status?(e.text(t.data.ttx),e.css("visibility","visible")):e.css("visibility","hidden")}else"cmsg"==t.op?lhinst.syncusercall():"schange"==t.op&&(lhinst.chatsyncuserpending(),lhinst.syncusercall())}),LHCCallbacks.initTypingMonitoringUserInform=!0,ee.addListener("visitorTyping",t),ee.addListener("visitorTypingStopped",e),confLH.chat_message_sinterval=1e4,lhinst.syncusercall()}var n={hostname:lh.nodejsHelperOptions.hostname,path:lh.nodejsHelperOptions.path};""!=lh.nodejsHelperOptions.port&&(n.port=parseInt(lh.nodejsHelperOptions.port)),1==lh.nodejsHelperOptions.secure&&(n.secure=!0);var o;o=lh.nodejsHelperOptions.instance_id>0?"chat_"+lh.nodejsHelperOptions.instance_id+"_"+lhinst.chat_id:"chat_"+lhinst.chat_id;var i=socketCluster.connect(n),s=null;i.on("error",function(t){console.error(t)}),i.on("close",function(){LHCCallbacks.initTypingMonitoringUserInform=!1,null!==s&&s.destroy(),ee.removeListener("visitorTyping",t),ee.removeListener("visitorTypingStopped",e),confLH.chat_message_sinterval=confLH.defaut_chat_message_sinterval}),i.on("connect",function(t){t.isAuthenticated&&lhinst.chat_id>0?r():i.emit("login",{hash:lh.nodejsHelperOptions.hash,chanelName:o},function(t){t?console.log(t):r()})}),$(window).on("beforeunload",function(){i.destroy()})},1e3); \ No newline at end of file diff --git a/nodejshelper/design/nodejshelpertheme/tpl/lhchat/getstatus/lhc_chat_after_cookie_multiinclude.tpl.php b/nodejshelper/design/nodejshelpertheme/tpl/lhchat/getstatus/lhc_chat_after_cookie_multiinclude.tpl.php index 938ee55..d97387e 100644 --- a/nodejshelper/design/nodejshelpertheme/tpl/lhchat/getstatus/lhc_chat_after_cookie_multiinclude.tpl.php +++ b/nodejshelper/design/nodejshelpertheme/tpl/lhchat/getstatus/lhc_chat_after_cookie_multiinclude.tpl.php @@ -10,6 +10,8 @@ 'path':'getSettingVariable('path')?>', 'port':'getSettingVariable('port')?>', 'secure':'getSettingVariable('secure')?>', + 'instance_id':getSettingVariable('automated_hosting')) : ?>id?>0, + 'hash': 'getSetting('site','secrethash')) . '.' . $date;?>' }; var thnjs = document.getElementsByTagName('head')[0]; diff --git a/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_extension_multiinclude.tpl.php b/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_extension_multiinclude.tpl.php index 5e4fb05..8d198cd 100644 --- a/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_extension_multiinclude.tpl.php +++ b/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_extension_multiinclude.tpl.php @@ -4,13 +4,14 @@ strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 8.0') === false && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 7.0') === false ) : ?> - diff --git a/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_user_extension_multiinclude.tpl.php b/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_user_extension_multiinclude.tpl.php index fc1c9c2..35afb65 100644 --- a/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_user_extension_multiinclude.tpl.php +++ b/nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_user_extension_multiinclude.tpl.php @@ -13,6 +13,8 @@ 'path':'getSettingVariable('path')?>', 'port':'getSettingVariable('port')?>', 'secure':'getSettingVariable('secure')?>', + 'hash': 'getSetting('site','secrethash')) . '.' . $date; ?>', + 'instance_id':getSettingVariable('automated_hosting')) : ?>id?>0 }; confLH.defaut_chat_message_sinterval = confLH.chat_message_sinterval; diff --git a/nodejshelper/serversc/lhc/server.js b/nodejshelper/serversc/lhc/server.js index 3aaae22..87d038d 100644 --- a/nodejshelper/serversc/lhc/server.js +++ b/nodejshelper/serversc/lhc/server.js @@ -50,7 +50,8 @@ var options = { brokerOptions: { host: '127.0.0.1', port: 6379 - } + }, + secretHash: '', //This secrethash of lhc settings, need for user authenticated }; var bootTimeout = Number(process.env.SOCKETCLUSTER_CONTROLLER_BOOT_TIMEOUT) || 10000; diff --git a/nodejshelper/serversc/lhc/worker.js b/nodejshelper/serversc/lhc/worker.js index 4d918b7..1fb2d0d 100644 --- a/nodejshelper/serversc/lhc/worker.js +++ b/nodejshelper/serversc/lhc/worker.js @@ -4,12 +4,15 @@ var serveStatic = require('serve-static'); var path = require('path'); var morgan = require('morgan'); var healthChecker = require('sc-framework-health-check'); +var crypto = require('crypto'); class Worker extends SCWorker { run() { console.log(' >> Worker PID:', process.pid); var environment = this.options.environment; + var secretHash = this.options.secretHash; + var app = express(); var httpServer = this.httpServer; @@ -27,32 +30,64 @@ class Worker extends SCWorker { httpServer.on('request', app); - //var count = 0; - /* In here we handle our incoming realtime connections and listen for events. */ scServer.on('connection', function (socket) { - // Some sample logic to show how to handle client events, - // replace this with your own logic + socket.on('login', function (token, respond) { + var tokenParts = token.hash.split('.'); + var secNow = Math.round(Date.now()/1000); + + if (tokenParts[1] > (secNow - 60*60)) { + var SHA1 = function(input){ + return crypto.createHash('sha1').update(input).digest('hex'); + } + + if (tokenParts[1]) { + var validateVisitorHash = SHA1(tokenParts[1] + 'Visitor' + secretHash); + var validateOperatorHash = SHA1(tokenParts[1] + 'Operator' + secretHash); + } + + if ((tokenParts[0] == validateVisitorHash) || (tokenParts[0] == validateOperatorHash)) { + respond(); + socket.setAuthToken({token:token.hash, exp: (secNow + 60*30), chanelName:token.chanelName}); + } else { + // Passing string as first argument indicates error + respond('Login failed'); + } - /*socket.on('sampleClientEvent', function (data) { - count++; - console.log('Handled sampleClientEvent', data); - scServer.exchange.publish('sample', count); - });*/ + } else { + respond('Login failed'); + } - /*var interval = setInterval(function () { - socket.emit('random', { - number: Math.floor(Math.random() * 5) - }); - }, 1000);*/ + + }); socket.on('disconnect', function () { //clearInterval(interval); }); }); + + scServer.addMiddleware(scServer.MIDDLEWARE_SUBSCRIBE, + function (req, next) { + var authToken = req.socket.authToken; + if (authToken) { + next(); // Allow + } else { + next('You are not authorized to subscribe to ' + req.channel); // Block + } + } + ); + + scServer.addMiddleware(scServer.MIDDLEWARE_PUBLISH_IN, function (req, next) { + var authToken = req.socket.authToken; + if (authToken) { + next(); + } else { + next('You are not authorized to publish to ' + req.channel); + } + }); } }