webxoss-client/socket.io.min.js
2016-10-23 13:47:38 +08:00

3 lines
No EOL
71 KiB
JavaScript

(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.io=e()}})(function(){var e,t,r;return function n(e,t,r){function i(s,a){if(!t[s]){if(!e[s]){var c=typeof require=="function"&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var u=t[s]={exports:{}};e[s][0].call(u.exports,function(t){var r=e[s][1][t];return i(r?r:t)},u,u.exports,n,e,t,r)}return t[s].exports}var o=typeof require=="function"&&require;for(var s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,r){t.exports=e("./lib/")},{"./lib/":2}],2:[function(e,t,r){t.exports=e("./socket");t.exports.parser=e("engine.io-parser")},{"./socket":3,"engine.io-parser":19}],3:[function(e,t,r){(function(r){var n=e("./transports");var i=e("component-emitter");var o=e("debug")("engine.io-client:socket");var s=e("indexof");var a=e("engine.io-parser");var c=e("parseuri");var f=e("parsejson");var u=e("parseqs");t.exports=l;function p(){}function l(e,t){if(!(this instanceof l))return new l(e,t);t=t||{};if(e&&"object"==typeof e){t=e;e=null}if(e){e=c(e);t.hostname=e.host;t.secure=e.protocol=="https"||e.protocol=="wss";t.port=e.port;if(e.query)t.query=e.query}else if(t.host){t.hostname=c(t.host).host}this.secure=null!=t.secure?t.secure:r.location&&"https:"==location.protocol;if(t.hostname&&!t.port){t.port=this.secure?"443":"80"}this.agent=t.agent||false;this.hostname=t.hostname||(r.location?location.hostname:"localhost");this.port=t.port||(r.location&&location.port?location.port:this.secure?443:80);this.query=t.query||{};if("string"==typeof this.query)this.query=u.decode(this.query);this.upgrade=false!==t.upgrade;this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/";this.forceJSONP=!!t.forceJSONP;this.jsonp=false!==t.jsonp;this.forceBase64=!!t.forceBase64;this.enablesXDR=!!t.enablesXDR;this.timestampParam=t.timestampParam||"t";this.timestampRequests=t.timestampRequests;this.transports=t.transports||["polling","websocket"];this.readyState="";this.writeBuffer=[];this.policyPort=t.policyPort||843;this.rememberUpgrade=t.rememberUpgrade||false;this.binaryType=null;this.onlyBinaryUpgrades=t.onlyBinaryUpgrades;this.perMessageDeflate=false!==t.perMessageDeflate?t.perMessageDeflate||{}:false;if(true===this.perMessageDeflate)this.perMessageDeflate={};if(this.perMessageDeflate&&null==this.perMessageDeflate.threshold){this.perMessageDeflate.threshold=1024}this.pfx=t.pfx||null;this.key=t.key||null;this.passphrase=t.passphrase||null;this.cert=t.cert||null;this.ca=t.ca||null;this.ciphers=t.ciphers||null;this.rejectUnauthorized=t.rejectUnauthorized===undefined?null:t.rejectUnauthorized;var n=typeof r=="object"&&r;if(n.global===n){if(t.extraHeaders&&Object.keys(t.extraHeaders).length>0){this.extraHeaders=t.extraHeaders}}this.open()}l.priorWebsocketSuccess=false;i(l.prototype);l.protocol=a.protocol;l.Socket=l;l.Transport=e("./transport");l.transports=e("./transports");l.parser=e("engine.io-parser");l.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=h(this.query);t.EIO=a.protocol;t.transport=e;if(this.id)t.sid=this.id;var r=new n[e]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:t,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized,perMessageDeflate:this.perMessageDeflate,extraHeaders:this.extraHeaders});return r};function h(e){var t={};for(var r in e){if(e.hasOwnProperty(r)){t[r]=e[r]}}return t}l.prototype.open=function(){var e;if(this.rememberUpgrade&&l.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1){e="websocket"}else if(0===this.transports.length){var t=this;setTimeout(function(){t.emit("error","No transports available")},0);return}else{e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(r){this.transports.shift();this.open();return}e.open();this.setTransport(e)};l.prototype.setTransport=function(e){o("setting transport %s",e.name);var t=this;if(this.transport){o("clearing existing transport %s",this.transport.name);this.transport.removeAllListeners()}this.transport=e;e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})};l.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=false,n=this;l.priorWebsocketSuccess=false;function i(){if(n.onlyBinaryUpgrades){var i=!this.supportsBinary&&n.transport.supportsBinary;r=r||i}if(r)return;o('probe transport "%s" opened',e);t.send([{type:"ping",data:"probe"}]);t.once("packet",function(i){if(r)return;if("pong"==i.type&&"probe"==i.data){o('probe transport "%s" pong',e);n.upgrading=true;n.emit("upgrading",t);if(!t)return;l.priorWebsocketSuccess="websocket"==t.name;o('pausing current transport "%s"',n.transport.name);n.transport.pause(function(){if(r)return;if("closed"==n.readyState)return;o("changing transport and sending upgrade packet");p();n.setTransport(t);t.send([{type:"upgrade"}]);n.emit("upgrade",t);t=null;n.upgrading=false;n.flush()})}else{o('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name;n.emit("upgradeError",s)}})}function s(){if(r)return;r=true;p();t.close();t=null}function a(r){var i=new Error("probe error: "+r);i.transport=t.name;s();o('probe transport "%s" failed because of error: %s',e,r);n.emit("upgradeError",i)}function c(){a("transport closed")}function f(){a("socket closed")}function u(e){if(t&&e.name!=t.name){o('"%s" works - aborting "%s"',e.name,t.name);s()}}function p(){t.removeListener("open",i);t.removeListener("error",a);t.removeListener("close",c);n.removeListener("close",f);n.removeListener("upgrading",u)}t.once("open",i);t.once("error",a);t.once("close",c);this.once("close",f);this.once("upgrading",u);t.open()};l.prototype.onOpen=function(){o("socket open");this.readyState="open";l.priorWebsocketSuccess="websocket"==this.transport.name;this.emit("open");this.flush();if("open"==this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++){this.probe(this.upgrades[e])}}};l.prototype.onPacket=function(e){if("opening"==this.readyState||"open"==this.readyState){o('socket receive: type "%s", data "%s"',e.type,e.data);this.emit("packet",e);this.emit("heartbeat");switch(e.type){case"open":this.onHandshake(f(e.data));break;case"pong":this.setPing();this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data;this.onError(t);break;case"message":this.emit("data",e.data);this.emit("message",e.data);break}}else{o('packet received with socket readyState "%s"',this.readyState)}};l.prototype.onHandshake=function(e){this.emit("handshake",e);this.id=e.sid;this.transport.query.sid=e.sid;this.upgrades=this.filterUpgrades(e.upgrades);this.pingInterval=e.pingInterval;this.pingTimeout=e.pingTimeout;this.onOpen();if("closed"==this.readyState)return;this.setPing();this.removeListener("heartbeat",this.onHeartbeat);this.on("heartbeat",this.onHeartbeat)};l.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){if("closed"==t.readyState)return;t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)};l.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer);e.pingIntervalTimer=setTimeout(function(){o("writing ping packet - expecting pong within %sms",e.pingTimeout);e.ping();e.onHeartbeat(e.pingTimeout)},e.pingInterval)};l.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})};l.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen);this.prevBufferLen=0;if(0===this.writeBuffer.length){this.emit("drain")}else{this.flush()}};l.prototype.flush=function(){if("closed"!=this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){o("flushing %d packets in socket",this.writeBuffer.length);this.transport.send(this.writeBuffer);this.prevBufferLen=this.writeBuffer.length;this.emit("flush")}};l.prototype.write=l.prototype.send=function(e,t,r){this.sendPacket("message",e,t,r);return this};l.prototype.sendPacket=function(e,t,r,n){if("function"==typeof t){n=t;t=undefined}if("function"==typeof r){n=r;r=null}if("closing"==this.readyState||"closed"==this.readyState){return}r=r||{};r.compress=false!==r.compress;var i={type:e,data:t,options:r};this.emit("packetCreate",i);this.writeBuffer.push(i);if(n)this.once("flush",n);this.flush()};l.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState){this.readyState="closing";var e=this;if(this.writeBuffer.length){this.once("drain",function(){if(this.upgrading){n()}else{t()}})}else if(this.upgrading){n()}else{t()}}function t(){e.onClose("forced close");o("socket closing - telling transport to close");e.transport.close()}function r(){e.removeListener("upgrade",r);e.removeListener("upgradeError",r);t()}function n(){e.once("upgrade",r);e.once("upgradeError",r)}return this};l.prototype.onError=function(e){o("socket error %j",e);l.priorWebsocketSuccess=false;this.emit("error",e);this.onClose("transport error",e)};l.prototype.onClose=function(e,t){if("opening"==this.readyState||"open"==this.readyState||"closing"==this.readyState){o('socket close with reason: "%s"',e);var r=this;clearTimeout(this.pingIntervalTimer);clearTimeout(this.pingTimeoutTimer);this.transport.removeAllListeners("close");this.transport.close();this.transport.removeAllListeners();this.readyState="closed";this.id=null;this.emit("close",e,t);r.writeBuffer=[];r.prevBufferLen=0}};l.prototype.filterUpgrades=function(e){var t=[];for(var r=0,n=e.length;r<n;r++){if(~s(this.transports,e[r]))t.push(e[r])}return t}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{"./transport":4,"./transports":5,"component-emitter":15,debug:17,"engine.io-parser":19,indexof:23,parsejson:26,parseqs:27,parseuri:28}],4:[function(e,t,r){var n=e("engine.io-parser");var i=e("component-emitter");t.exports=o;function o(e){this.path=e.path;this.hostname=e.hostname;this.port=e.port;this.secure=e.secure;this.query=e.query;this.timestampParam=e.timestampParam;this.timestampRequests=e.timestampRequests;this.readyState="";this.agent=e.agent||false;this.socket=e.socket;this.enablesXDR=e.enablesXDR;this.pfx=e.pfx;this.key=e.key;this.passphrase=e.passphrase;this.cert=e.cert;this.ca=e.ca;this.ciphers=e.ciphers;this.rejectUnauthorized=e.rejectUnauthorized;this.extraHeaders=e.extraHeaders}i(o.prototype);o.prototype.onError=function(e,t){var r=new Error(e);r.type="TransportError";r.description=t;this.emit("error",r);return this};o.prototype.open=function(){if("closed"==this.readyState||""==this.readyState){this.readyState="opening";this.doOpen()}return this};o.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState){this.doClose();this.onClose()}return this};o.prototype.send=function(e){if("open"==this.readyState){this.write(e)}else{throw new Error("Transport not open")}};o.prototype.onOpen=function(){this.readyState="open";this.writable=true;this.emit("open")};o.prototype.onData=function(e){var t=n.decodePacket(e,this.socket.binaryType);this.onPacket(t)};o.prototype.onPacket=function(e){this.emit("packet",e)};o.prototype.onClose=function(){this.readyState="closed";this.emit("close")}},{"component-emitter":15,"engine.io-parser":19}],5:[function(e,t,r){(function(t){var n=e("xmlhttprequest-ssl");var i=e("./polling-xhr");var o=e("./polling-jsonp");var s=e("./websocket");r.polling=a;r.websocket=s;function a(e){var r;var s=false;var a=false;var c=false!==e.jsonp;if(t.location){var f="https:"==location.protocol;var u=location.port;if(!u){u=f?443:80}s=e.hostname!=location.hostname||u!=e.port;a=e.secure!=f}e.xdomain=s;e.xscheme=a;r=new n(e);if("open"in r&&!e.forceJSONP){return new i(e)}else{if(!c)throw new Error("JSONP disabled");return new o(e)}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{"./polling-jsonp":6,"./polling-xhr":7,"./websocket":9,"xmlhttprequest-ssl":10}],6:[function(e,t,r){(function(r){var n=e("./polling");var i=e("component-inherit");t.exports=u;var o=/\n/g;var s=/\\n/g;var a;var c=0;function f(){}function u(e){n.call(this,e);this.query=this.query||{};if(!a){if(!r.___eio)r.___eio=[];a=r.___eio}this.index=a.length;var t=this;a.push(function(e){t.onData(e)});this.query.j=this.index;if(r.document&&r.addEventListener){r.addEventListener("beforeunload",function(){if(t.script)t.script.onerror=f},false)}}i(u,n);u.prototype.supportsBinary=false;u.prototype.doClose=function(){if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}if(this.form){this.form.parentNode.removeChild(this.form);this.form=null;this.iframe=null}n.prototype.doClose.call(this)};u.prototype.doPoll=function(){var e=this;var t=document.createElement("script");if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}t.async=true;t.src=this.uri();t.onerror=function(t){e.onError("jsonp poll error",t)};var r=document.getElementsByTagName("script")[0];if(r){r.parentNode.insertBefore(t,r)}else{(document.head||document.body).appendChild(t)}this.script=t;var n="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);if(n){setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e);document.body.removeChild(e)},100)}};u.prototype.doWrite=function(e,t){var r=this;if(!this.form){var n=document.createElement("form");var i=document.createElement("textarea");var a=this.iframeId="eio_iframe_"+this.index;var c;n.className="socketio";n.style.position="absolute";n.style.top="-1000px";n.style.left="-1000px";n.target=a;n.method="POST";n.setAttribute("accept-charset","utf-8");i.name="d";n.appendChild(i);document.body.appendChild(n);this.form=n;this.area=i}this.form.action=this.uri();function f(){u();t()}function u(){if(r.iframe){try{r.form.removeChild(r.iframe)}catch(e){r.onError("jsonp polling iframe removal error",e)}}try{var t='<iframe src="javascript:0" name="'+r.iframeId+'">';c=document.createElement(t)}catch(e){c=document.createElement("iframe");c.name=r.iframeId;c.src="javascript:0"}c.id=r.iframeId;r.form.appendChild(c);r.iframe=c}u();e=e.replace(s,"\\\n");this.area.value=e.replace(o,"\\n");try{this.form.submit()}catch(p){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(r.iframe.readyState=="complete"){f()}}}else{this.iframe.onload=f}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{"./polling":8,"component-inherit":16}],7:[function(e,t,r){(function(r){var n=e("xmlhttprequest-ssl");var i=e("./polling");var o=e("component-emitter");var s=e("component-inherit");var a=e("debug")("engine.io-client:polling-xhr");t.exports=f;t.exports.Request=u;function c(){}function f(e){i.call(this,e);if(r.location){var t="https:"==location.protocol;var n=location.port;if(!n){n=t?443:80}this.xd=e.hostname!=r.location.hostname||n!=e.port;this.xs=e.secure!=t}else{this.extraHeaders=e.extraHeaders}}s(f,i);f.prototype.supportsBinary=true;f.prototype.request=function(e){e=e||{};e.uri=this.uri();e.xd=this.xd;e.xs=this.xs;e.agent=this.agent||false;e.supportsBinary=this.supportsBinary;e.enablesXDR=this.enablesXDR;e.pfx=this.pfx;e.key=this.key;e.passphrase=this.passphrase;e.cert=this.cert;e.ca=this.ca;e.ciphers=this.ciphers;e.rejectUnauthorized=this.rejectUnauthorized;e.extraHeaders=this.extraHeaders;return new u(e)};f.prototype.doWrite=function(e,t){var r=typeof e!=="string"&&e!==undefined;var n=this.request({method:"POST",data:e,isBinary:r});var i=this;n.on("success",t);n.on("error",function(e){i.onError("xhr post error",e)});this.sendXhr=n};f.prototype.doPoll=function(){a("xhr poll");var e=this.request();var t=this;e.on("data",function(e){t.onData(e)});e.on("error",function(e){t.onError("xhr poll error",e)});this.pollXhr=e};function u(e){this.method=e.method||"GET";this.uri=e.uri;this.xd=!!e.xd;this.xs=!!e.xs;this.async=false!==e.async;this.data=undefined!=e.data?e.data:null;this.agent=e.agent;this.isBinary=e.isBinary;this.supportsBinary=e.supportsBinary;this.enablesXDR=e.enablesXDR;this.pfx=e.pfx;this.key=e.key;this.passphrase=e.passphrase;this.cert=e.cert;this.ca=e.ca;this.ciphers=e.ciphers;this.rejectUnauthorized=e.rejectUnauthorized;this.extraHeaders=e.extraHeaders;this.create()}o(u.prototype);u.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx;e.key=this.key;e.passphrase=this.passphrase;e.cert=this.cert;e.ca=this.ca;e.ciphers=this.ciphers;e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new n(e);var i=this;try{a("xhr open %s: %s",this.method,this.uri);t.open(this.method,this.uri,this.async);try{if(this.extraHeaders){t.setDisableHeaderCheck(true);for(var o in this.extraHeaders){if(this.extraHeaders.hasOwnProperty(o)){t.setRequestHeader(o,this.extraHeaders[o])}}}}catch(s){}if(this.supportsBinary){t.responseType="arraybuffer"}if("POST"==this.method){try{if(this.isBinary){t.setRequestHeader("Content-type","application/octet-stream")}else{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}}catch(s){}}if("withCredentials"in t){t.withCredentials=true}if(this.hasXDR()){t.onload=function(){i.onLoad()};t.onerror=function(){i.onError(t.responseText)}}else{t.onreadystatechange=function(){if(4!=t.readyState)return;if(200==t.status||1223==t.status){i.onLoad()}else{setTimeout(function(){i.onError(t.status)},0)}}}a("xhr data %s",this.data);t.send(this.data)}catch(s){setTimeout(function(){i.onError(s)},0);return}if(r.document){this.index=u.requestsCount++;u.requests[this.index]=this}};u.prototype.onSuccess=function(){this.emit("success");this.cleanup()};u.prototype.onData=function(e){this.emit("data",e);this.onSuccess()};u.prototype.onError=function(e){this.emit("error",e);this.cleanup(true)};u.prototype.cleanup=function(e){if("undefined"==typeof this.xhr||null===this.xhr){return}if(this.hasXDR()){this.xhr.onload=this.xhr.onerror=c}else{this.xhr.onreadystatechange=c}if(e){try{this.xhr.abort()}catch(t){}}if(r.document){delete u.requests[this.index]}this.xhr=null};u.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(r){}if(t==="application/octet-stream"){e=this.xhr.response}else{if(!this.supportsBinary){e=this.xhr.responseText}else{try{e=String.fromCharCode.apply(null,new Uint8Array(this.xhr.response))}catch(r){var n=new Uint8Array(this.xhr.response);var i=[];for(var o=0,s=n.length;o<s;o++){i.push(n[o])}e=String.fromCharCode.apply(null,i)}}}}catch(r){this.onError(r)}if(null!=e){this.onData(e)}};u.prototype.hasXDR=function(){return"undefined"!==typeof r.XDomainRequest&&!this.xs&&this.enablesXDR};u.prototype.abort=function(){this.cleanup()};if(r.document){u.requestsCount=0;u.requests={};if(r.attachEvent){r.attachEvent("onunload",p)}else if(r.addEventListener){r.addEventListener("beforeunload",p,false)}}function p(){for(var e in u.requests){if(u.requests.hasOwnProperty(e)){u.requests[e].abort()}}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{"./polling":8,"component-emitter":15,"component-inherit":16,debug:17,"xmlhttprequest-ssl":10}],8:[function(e,t,r){var n=e("../transport");var i=e("parseqs");var o=e("engine.io-parser");var s=e("component-inherit");var a=e("yeast");var c=e("debug")("engine.io-client:polling");t.exports=u;var f=function(){var t=e("xmlhttprequest-ssl");var r=new t({xdomain:false});return null!=r.responseType}();function u(e){var t=e&&e.forceBase64;if(!f||t){this.supportsBinary=false}n.call(this,e)}s(u,n);u.prototype.name="polling";u.prototype.doOpen=function(){this.poll()};u.prototype.pause=function(e){var t=0;var r=this;this.readyState="pausing";function n(){c("paused");r.readyState="paused";e()}if(this.polling||!this.writable){var i=0;if(this.polling){c("we are currently polling - waiting to pause");i++;this.once("pollComplete",function(){c("pre-pause polling complete");--i||n()})}if(!this.writable){c("we are currently writing - waiting to pause");i++;this.once("drain",function(){c("pre-pause writing complete");--i||n()})}}else{n()}};u.prototype.poll=function(){c("polling");this.polling=true;this.doPoll();this.emit("poll")};u.prototype.onData=function(e){var t=this;c("polling got data %s",e);var r=function(e,r,n){if("opening"==t.readyState){t.onOpen()}if("close"==e.type){t.onClose();return false}t.onPacket(e)};o.decodePayload(e,this.socket.binaryType,r);if("closed"!=this.readyState){this.polling=false;this.emit("pollComplete");if("open"==this.readyState){this.poll()}else{c('ignoring poll - transport state "%s"',this.readyState)}}};u.prototype.doClose=function(){var e=this;function t(){c("writing close packet");e.write([{type:"close"}])}if("open"==this.readyState){c("transport open - closing");t()}else{c("transport not open - deferring close");this.once("open",t)}};u.prototype.write=function(e){var t=this;this.writable=false;var r=function(){t.writable=true;t.emit("drain")};var t=this;o.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,r)})};u.prototype.uri=function(){var e=this.query||{};var t=this.secure?"https":"http";var r="";if(false!==this.timestampRequests){e[this.timestampParam]=a()}if(!this.supportsBinary&&!e.sid){e.b64=1}e=i.encode(e);if(this.port&&("https"==t&&this.port!=443||"http"==t&&this.port!=80)){r=":"+this.port}if(e.length){e="?"+e}var n=this.hostname.indexOf(":")!==-1;return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e}},{"../transport":4,"component-inherit":16,debug:17,"engine.io-parser":19,parseqs:27,"xmlhttprequest-ssl":10,yeast:30}],9:[function(e,t,r){(function(r){var n=e("../transport");var i=e("engine.io-parser");var o=e("parseqs");var s=e("component-inherit");var a=e("yeast");var c=e("debug")("engine.io-client:websocket");var f=r.WebSocket||r.MozWebSocket;var u=f||(typeof window!=="undefined"?null:e("ws"));t.exports=p;function p(e){var t=e&&e.forceBase64;if(t){this.supportsBinary=false}this.perMessageDeflate=e.perMessageDeflate;n.call(this,e)}s(p,n);p.prototype.name="websocket";p.prototype.supportsBinary=true;p.prototype.doOpen=function(){if(!this.check()){return}var e=this;var t=this.uri();var r=void 0;var n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx;n.key=this.key;n.passphrase=this.passphrase;n.cert=this.cert;n.ca=this.ca;n.ciphers=this.ciphers;n.rejectUnauthorized=this.rejectUnauthorized;if(this.extraHeaders){n.headers=this.extraHeaders}this.ws=f?new u(t):new u(t,r,n);if(this.ws.binaryType===undefined){this.supportsBinary=false}if(this.ws.supports&&this.ws.supports.binary){this.supportsBinary=true;this.ws.binaryType="buffer"}else{this.ws.binaryType="arraybuffer"}this.addEventListeners()};p.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()};this.ws.onclose=function(){e.onClose()};this.ws.onmessage=function(t){e.onData(t.data)};this.ws.onerror=function(t){e.onError("websocket error",t)}};if("undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)){p.prototype.onData=function(e){var t=this;setTimeout(function(){n.prototype.onData.call(t,e)},0)}}p.prototype.write=function(e){var t=this;this.writable=false;var n=e.length;for(var o=0,s=n;o<s;o++){(function(e){i.encodePacket(e,t.supportsBinary,function(i){if(!f){var o={};if(e.options){o.compress=e.options.compress}if(t.perMessageDeflate){var s="string"==typeof i?r.Buffer.byteLength(i):i.length;if(s<t.perMessageDeflate.threshold){o.compress=false}}}try{if(f){t.ws.send(i)}else{t.ws.send(i,o)}}catch(u){c("websocket closed before onclose event")}--n||a()})})(e[o])}function a(){t.emit("flush");setTimeout(function(){t.writable=true;t.emit("drain")},0)}};p.prototype.onClose=function(){n.prototype.onClose.call(this)};p.prototype.doClose=function(){if(typeof this.ws!=="undefined"){this.ws.close()}};p.prototype.uri=function(){var e=this.query||{};var t=this.secure?"wss":"ws";var r="";if(this.port&&("wss"==t&&this.port!=443||"ws"==t&&this.port!=80)){r=":"+this.port}if(this.timestampRequests){e[this.timestampParam]=a()}if(!this.supportsBinary){e.b64=1}e=o.encode(e);if(e.length){e="?"+e}var n=this.hostname.indexOf(":")!==-1;return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e};p.prototype.check=function(){return!!u&&!("__initialize"in u&&this.name===p.prototype.name)}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{"../transport":4,"component-inherit":16,debug:17,"engine.io-parser":19,parseqs:27,ws:undefined,yeast:30}],10:[function(e,t,r){var n=e("has-cors");t.exports=function(e){var t=e.xdomain;var r=e.xscheme;var i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||n)){return new XMLHttpRequest}}catch(o){}try{if("undefined"!=typeof XDomainRequest&&!r&&i){return new XDomainRequest}}catch(o){}if(!t){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(o){}}}},{"has-cors":22}],11:[function(e,t,r){t.exports=n;function n(e,t,r){var n=false;r=r||i;o.count=e;return e===0?t():o;function o(e,i){if(o.count<=0){throw new Error("after called too many times")}--o.count;if(e){n=true;t(e);t=r}else if(o.count===0&&!n){t(null,i)}}}function i(){}},{}],12:[function(e,t,r){t.exports=function(e,t,r){var n=e.byteLength;t=t||0;r=r||n;if(e.slice){return e.slice(t,r)}if(t<0){t+=n}if(r<0){r+=n}if(r>n){r=n}if(t>=n||t>=r||n===0){return new ArrayBuffer(0)}var i=new Uint8Array(e);var o=new Uint8Array(r-t);for(var s=t,a=0;s<r;s++,a++){o[a]=i[s]}return o.buffer}},{}],13:[function(e,t,r){(function(e){"use strict";r.encode=function(t){var r=new Uint8Array(t),n,i=r.length,o="";for(n=0;n<i;n+=3){o+=e[r[n]>>2];o+=e[(r[n]&3)<<4|r[n+1]>>4];o+=e[(r[n+1]&15)<<2|r[n+2]>>6];o+=e[r[n+2]&63]}if(i%3===2){o=o.substring(0,o.length-1)+"="}else if(i%3===1){o=o.substring(0,o.length-2)+"=="}return o};r.decode=function(t){var r=t.length*.75,n=t.length,i,o=0,s,a,c,f;if(t[t.length-1]==="="){r--;if(t[t.length-2]==="="){r--}}var u=new ArrayBuffer(r),p=new Uint8Array(u);for(i=0;i<n;i+=4){s=e.indexOf(t[i]);a=e.indexOf(t[i+1]);c=e.indexOf(t[i+2]);f=e.indexOf(t[i+3]);p[o++]=s<<2|a>>4;p[o++]=(a&15)<<4|c>>2;p[o++]=(c&3)<<6|f&63}return u}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],14:[function(e,t,r){(function(e){var r=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder;var n=function(){try{var e=new Blob(["hi"]);return e.size===2}catch(t){return false}}();var i=n&&function(){try{var e=new Blob([new Uint8Array([1,2])]);return e.size===2}catch(t){return false}}();var o=r&&r.prototype.append&&r.prototype.getBlob;function s(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.buffer instanceof ArrayBuffer){var n=r.buffer;if(r.byteLength!==n.byteLength){var i=new Uint8Array(r.byteLength);i.set(new Uint8Array(n,r.byteOffset,r.byteLength));n=i.buffer}e[t]=n}}}function a(e,t){t=t||{};var n=new r;s(e);for(var i=0;i<e.length;i++){n.append(e[i])}return t.type?n.getBlob(t.type):n.getBlob()}function c(e,t){s(e);return new Blob(e,t||{})}t.exports=function(){if(n){return i?e.Blob:c}else if(o){return a}else{return undefined}}()}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{}],15:[function(e,t,r){t.exports=n;function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype){e[t]=n.prototype[t]}return e}n.prototype.on=n.prototype.addEventListener=function(e,t){this._callbacks=this._callbacks||{};(this._callbacks[e]=this._callbacks[e]||[]).push(t);return this};n.prototype.once=function(e,t){var r=this;this._callbacks=this._callbacks||{};function n(){r.off(e,n);t.apply(this,arguments)}n.fn=t;this.on(e,n);return this};n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var r=this._callbacks[e];if(!r)return this;if(1==arguments.length){delete this._callbacks[e];return this}var n;for(var i=0;i<r.length;i++){n=r[i];if(n===t||n.fn===t){r.splice(i,1);break}}return this};n.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks[e];if(r){r=r.slice(0);for(var n=0,i=r.length;n<i;++n){r[n].apply(this,t)}}return this};n.prototype.listeners=function(e){this._callbacks=this._callbacks||{};return this._callbacks[e]||[]};n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],16:[function(e,t,r){t.exports=function(e,t){var r=function(){};r.prototype=t.prototype;e.prototype=new r;e.prototype.constructor=e}},{}],17:[function(e,t,r){r=t.exports=e("./debug");r.log=o;r.formatArgs=i;r.save=s;r.load=a;r.useColors=n;r.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c();r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}r.formatters.j=function(e){return JSON.stringify(e)};function i(){var e=arguments;var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff);if(!t)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0;var o=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;i++;if("%c"===e){o=i}});e.splice(o,0,n);return e}function o(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{if(null==e){r.storage.removeItem("debug")}else{r.storage.debug=e}}catch(t){}}function a(){var e;try{e=r.storage.debug}catch(t){}return e}r.enable(a());function c(){try{return window.localStorage}catch(e){}}},{"./debug":18}],18:[function(e,t,r){r=t.exports=s;r.coerce=u;r.disable=c;r.enable=a;r.enabled=f;r.humanize=e("ms");r.names=[];r.skips=[];r.formatters={};var n=0;var i;function o(){return r.colors[n++%r.colors.length]}function s(e){function t(){}t.enabled=false;function n(){var e=n;var t=+new Date;var s=t-(i||t);e.diff=s;e.prev=i;e.curr=t;i=t;if(null==e.useColors)e.useColors=r.useColors();if(null==e.color&&e.useColors)e.color=o();var a=Array.prototype.slice.call(arguments);a[0]=r.coerce(a[0]);if("string"!==typeof a[0]){a=["%o"].concat(a)}var c=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,n){if(t==="%%")return t;c++;var i=r.formatters[n];if("function"===typeof i){var o=a[c];t=i.call(e,o);a.splice(c,1);c--}return t});if("function"===typeof r.formatArgs){a=r.formatArgs.apply(e,a)}var f=n.log||r.log||console.log.bind(console);f.apply(e,a)}n.enabled=true;var s=r.enabled(e)?n:t;s.namespace=e;return s}function a(e){r.save(e);var t=(e||"").split(/[\s,]+/);var n=t.length;for(var i=0;i<n;i++){if(!t[i])continue;e=t[i].replace(/\*/g,".*?");if(e[0]==="-"){r.skips.push(new RegExp("^"+e.substr(1)+"$"))}else{r.names.push(new RegExp("^"+e+"$"))}}}function c(){r.enable("")}function f(e){var t,n;for(t=0,n=r.skips.length;t<n;t++){if(r.skips[t].test(e)){return false}}for(t=0,n=r.names.length;t<n;t++){if(r.names[t].test(e)){return true}}return false}function u(e){if(e instanceof Error)return e.stack||e.message;
return e}},{ms:25}],19:[function(e,t,r){(function(t){var n=e("./keys");var i=e("has-binary");var o=e("arraybuffer.slice");var s=e("base64-arraybuffer");var a=e("after");var c=e("utf8");var f=navigator.userAgent.match(/Android/i);var u=/PhantomJS/i.test(navigator.userAgent);var p=f||u;r.protocol=3;var l=r.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6};var h=n(l);var d={type:"error",data:"parser error"};var y=e("blob");r.encodePacket=function(e,r,n,i){if("function"==typeof r){i=r;r=false}if("function"==typeof n){i=n;n=null}var o=e.data===undefined?undefined:e.data.buffer||e.data;if(t.ArrayBuffer&&o instanceof ArrayBuffer){return v(e,r,i)}else if(y&&o instanceof t.Blob){return b(e,r,i)}if(o&&o.base64){return g(e,i)}var s=l[e.type];if(undefined!==e.data){s+=n?c.encode(String(e.data)):String(e.data)}return i(""+s)};function g(e,t){var n="b"+r.packets[e.type]+e.data.data;return t(n)}function v(e,t,n){if(!t){return r.encodeBase64Packet(e,n)}var i=e.data;var o=new Uint8Array(i);var s=new Uint8Array(1+i.byteLength);s[0]=l[e.type];for(var a=0;a<o.length;a++){s[a+1]=o[a]}return n(s.buffer)}function m(e,t,n){if(!t){return r.encodeBase64Packet(e,n)}var i=new FileReader;i.onload=function(){e.data=i.result;r.encodePacket(e,t,true,n)};return i.readAsArrayBuffer(e.data)}function b(e,t,n){if(!t){return r.encodeBase64Packet(e,n)}if(p){return m(e,t,n)}var i=new Uint8Array(1);i[0]=l[e.type];var o=new y([i.buffer,e.data]);return n(o)}r.encodeBase64Packet=function(e,n){var i="b"+r.packets[e.type];if(y&&e.data instanceof t.Blob){var o=new FileReader;o.onload=function(){var e=o.result.split(",")[1];n(i+e)};return o.readAsDataURL(e.data)}var s;try{s=String.fromCharCode.apply(null,new Uint8Array(e.data))}catch(a){var c=new Uint8Array(e.data);var f=new Array(c.length);for(var u=0;u<c.length;u++){f[u]=c[u]}s=String.fromCharCode.apply(null,f)}i+=t.btoa(s);return n(i)};r.decodePacket=function(e,t,n){if(typeof e=="string"||e===undefined){if(e.charAt(0)=="b"){return r.decodeBase64Packet(e.substr(1),t)}if(n){try{e=c.decode(e)}catch(i){return d}}var s=e.charAt(0);if(Number(s)!=s||!h[s]){return d}if(e.length>1){return{type:h[s],data:e.substring(1)}}else{return{type:h[s]}}}var a=new Uint8Array(e);var s=a[0];var f=o(e,1);if(y&&t==="blob"){f=new y([f])}return{type:h[s],data:f}};r.decodeBase64Packet=function(e,r){var n=h[e.charAt(0)];if(!t.ArrayBuffer){return{type:n,data:{base64:true,data:e.substr(1)}}}var i=s.decode(e.substr(1));if(r==="blob"&&y){i=new y([i])}return{type:n,data:i}};r.encodePayload=function(e,t,n){if(typeof t=="function"){n=t;t=null}var o=i(e);if(t&&o){if(y&&!p){return r.encodePayloadAsBlob(e,n)}return r.encodePayloadAsArrayBuffer(e,n)}if(!e.length){return n("0:")}function s(e){return e.length+":"+e}function a(e,n){r.encodePacket(e,!o?false:t,true,function(e){n(null,s(e))})}w(e,a,function(e,t){return n(t.join(""))})};function w(e,t,r){var n=new Array(e.length);var i=a(e.length,r);var o=function(e,r,i){t(r,function(t,r){n[e]=r;i(t,n)})};for(var s=0;s<e.length;s++){o(s,e[s],i)}}r.decodePayload=function(e,t,n){if(typeof e!="string"){return r.decodePayloadAsBinary(e,t,n)}if(typeof t==="function"){n=t;t=null}var i;if(e==""){return n(d,0,1)}var o="",s,a;for(var c=0,f=e.length;c<f;c++){var u=e.charAt(c);if(":"!=u){o+=u}else{if(""==o||o!=(s=Number(o))){return n(d,0,1)}a=e.substr(c+1,s);if(o!=a.length){return n(d,0,1)}if(a.length){i=r.decodePacket(a,t,true);if(d.type==i.type&&d.data==i.data){return n(d,0,1)}var p=n(i,c+s,f);if(false===p)return}c+=s;o=""}}if(o!=""){return n(d,0,1)}};r.encodePayloadAsArrayBuffer=function(e,t){if(!e.length){return t(new ArrayBuffer(0))}function n(e,t){r.encodePacket(e,true,true,function(e){return t(null,e)})}w(e,n,function(e,r){var n=r.reduce(function(e,t){var r;if(typeof t==="string"){r=t.length}else{r=t.byteLength}return e+r.toString().length+r+2},0);var i=new Uint8Array(n);var o=0;r.forEach(function(e){var t=typeof e==="string";var r=e;if(t){var n=new Uint8Array(e.length);for(var s=0;s<e.length;s++){n[s]=e.charCodeAt(s)}r=n.buffer}if(t){i[o++]=0}else{i[o++]=1}var a=r.byteLength.toString();for(var s=0;s<a.length;s++){i[o++]=parseInt(a[s])}i[o++]=255;var n=new Uint8Array(r);for(var s=0;s<n.length;s++){i[o++]=n[s]}});return t(i.buffer)})};r.encodePayloadAsBlob=function(e,t){function n(e,t){r.encodePacket(e,true,true,function(e){var r=new Uint8Array(1);r[0]=1;if(typeof e==="string"){var n=new Uint8Array(e.length);for(var i=0;i<e.length;i++){n[i]=e.charCodeAt(i)}e=n.buffer;r[0]=0}var o=e instanceof ArrayBuffer?e.byteLength:e.size;var s=o.toString();var a=new Uint8Array(s.length+1);for(var i=0;i<s.length;i++){a[i]=parseInt(s[i])}a[s.length]=255;if(y){var c=new y([r.buffer,a.buffer,e]);t(null,c)}})}w(e,n,function(e,r){return t(new y(r))})};r.decodePayloadAsBinary=function(e,t,n){if(typeof t==="function"){n=t;t=null}var i=e;var s=[];var a=false;while(i.byteLength>0){var c=new Uint8Array(i);var f=c[0]===0;var u="";for(var p=1;;p++){if(c[p]==255)break;if(u.length>310){a=true;break}u+=c[p]}if(a)return n(d,0,1);i=o(i,2+u.length);u=parseInt(u);var l=o(i,0,u);if(f){try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(h){var y=new Uint8Array(l);l="";for(var p=0;p<y.length;p++){l+=String.fromCharCode(y[p])}}}s.push(l);i=o(i,u)}var g=s.length;s.forEach(function(e,i){n(r.decodePacket(e,t,true),i,g)})}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{"./keys":20,after:11,"arraybuffer.slice":12,"base64-arraybuffer":13,blob:14,"has-binary":21,utf8:29}],20:[function(e,t,r){t.exports=Object.keys||function n(e){var t=[];var r=Object.prototype.hasOwnProperty;for(var n in e){if(r.call(e,n)){t.push(n)}}return t}},{}],21:[function(e,t,r){(function(r){var n=e("isarray");t.exports=i;function i(e){function t(e){if(!e)return false;if(r.Buffer&&r.Buffer.isBuffer(e)||r.ArrayBuffer&&e instanceof ArrayBuffer||r.Blob&&e instanceof Blob||r.File&&e instanceof File){return true}if(n(e)){for(var i=0;i<e.length;i++){if(t(e[i])){return true}}}else if(e&&"object"==typeof e){if(e.toJSON){e=e.toJSON()}for(var o in e){if(Object.prototype.hasOwnProperty.call(e,o)&&t(e[o])){return true}}}return false}return t(e)}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{isarray:24}],22:[function(e,t,r){try{t.exports=typeof XMLHttpRequest!=="undefined"&&"withCredentials"in new XMLHttpRequest}catch(n){t.exports=false}},{}],23:[function(e,t,r){var n=[].indexOf;t.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;r<e.length;++r){if(e[r]===t)return r}return-1}},{}],24:[function(e,t,r){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],25:[function(e,t,r){var n=1e3;var i=n*60;var o=i*60;var s=o*24;var a=s*365.25;t.exports=function(e,t){t=t||{};if("string"==typeof e)return c(e);return t.long?u(e):f(e)};function c(e){e=""+e;if(e.length>1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);var c=(t[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return r*a;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*o;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}function f(e){if(e>=s)return Math.round(e/s)+"d";if(e>=o)return Math.round(e/o)+"h";if(e>=i)return Math.round(e/i)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}function u(e){return p(e,s,"day")||p(e,o,"hour")||p(e,i,"minute")||p(e,n,"second")||e+" ms"}function p(e,t,r){if(e<t)return;if(e<t*1.5)return Math.floor(e/t)+" "+r;return Math.ceil(e/t)+" "+r+"s"}},{}],26:[function(e,t,r){(function(e){var r=/^[\],:{}\s]*$/;var n=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;var i=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;var o=/(?:^|:|,)(?:\s*\[)+/g;var s=/^\s+/;var a=/\s+$/;t.exports=function c(t){if("string"!=typeof t||!t){return null}t=t.replace(s,"").replace(a,"");if(e.JSON&&JSON.parse){return JSON.parse(t)}if(r.test(t.replace(n,"@").replace(i,"]").replace(o,""))){return new Function("return "+t)()}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{}],27:[function(e,t,r){r.encode=function(e){var t="";for(var r in e){if(e.hasOwnProperty(r)){if(t.length)t+="&";t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r])}}return t};r.decode=function(e){var t={};var r=e.split("&");for(var n=0,i=r.length;n<i;n++){var o=r[n].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}},{}],28:[function(e,t,r){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function o(e){var t=e,r=e.indexOf("["),o=e.indexOf("]");if(r!=-1&&o!=-1){e=e.substring(0,r)+e.substring(r,o).replace(/:/g,";")+e.substring(o,e.length)}var s=n.exec(e||""),a={},c=14;while(c--){a[i[c]]=s[c]||""}if(r!=-1&&o!=-1){a.source=t;a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":");a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":");a.ipv6uri=true}return a}},{}],29:[function(t,r,n){(function(t){(function(i){var o=typeof n=="object"&&n;var s=typeof r=="object"&&r&&r.exports==o&&r;var a=typeof t=="object"&&t;if(a.global===a||a.window===a){i=a}var c=String.fromCharCode;function f(e){var t=[];var r=0;var n=e.length;var i;var o;while(r<n){i=e.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){o=e.charCodeAt(r++);if((o&64512)==56320){t.push(((i&1023)<<10)+(o&1023)+65536)}else{t.push(i);r--}}else{t.push(i)}}return t}function u(e){var t=e.length;var r=-1;var n;var i="";while(++r<t){n=e[r];if(n>65535){n-=65536;i+=c(n>>>10&1023|55296);n=56320|n&1023}i+=c(n)}return i}function p(e){if(e>=55296&&e<=57343){throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}}function l(e,t){return c(e>>t&63|128)}function h(e){if((e&4294967168)==0){return c(e)}var t="";if((e&4294965248)==0){t=c(e>>6&31|192)}else if((e&4294901760)==0){p(e);t=c(e>>12&15|224);t+=l(e,6)}else if((e&4292870144)==0){t=c(e>>18&7|240);t+=l(e,12);t+=l(e,6)}t+=c(e&63|128);return t}function d(e){var t=f(e);var r=t.length;var n=-1;var i;var o="";while(++n<r){i=t[n];o+=h(i)}return o}function y(){if(b>=m){throw Error("Invalid byte index")}var e=v[b]&255;b++;if((e&192)==128){return e&63}throw Error("Invalid continuation byte")}function g(){var e;var t;var r;var n;var i;if(b>m){throw Error("Invalid byte index")}if(b==m){return false}e=v[b]&255;b++;if((e&128)==0){return e}if((e&224)==192){var t=y();i=(e&31)<<6|t;if(i>=128){return i}else{throw Error("Invalid continuation byte")}}if((e&240)==224){t=y();r=y();i=(e&15)<<12|t<<6|r;if(i>=2048){p(i);return i}else{throw Error("Invalid continuation byte")}}if((e&248)==240){t=y();r=y();n=y();i=(e&15)<<18|t<<12|r<<6|n;if(i>=65536&&i<=1114111){return i}}throw Error("Invalid UTF-8 detected")}var v;var m;var b;function w(e){v=f(e);m=v.length;b=0;var t=[];var r;while((r=g())!==false){t.push(r)}return u(t)}var k={version:"2.0.0",encode:d,decode:w};if(typeof e=="function"&&typeof e.amd=="object"&&e.amd){e(function(){return k})}else if(o&&!o.nodeType){if(s){s.exports=k}else{var x={};var A=x.hasOwnProperty;for(var B in k){A.call(k,B)&&(o[B]=k[B])}}}else{i.utf8=k}})(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{}],30:[function(e,t,r){"use strict";var n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,o={},s=0,a=0,c;function f(e){var t="";do{t=n[e%i]+t;e=Math.floor(e/i)}while(e>0);return t}function u(e){var t=0;for(a=0;a<e.length;a++){t=t*i+o[e.charAt(a)]}return t}function p(){var e=f(+new Date);if(e!==c)return s=0,c=e;return e+"."+f(s++)}for(;a<i;a++)o[n[a]]=a;p.encode=f;p.decode=u;t.exports=p},{}],31:[function(e,t,r){var n=e("./url");var i=e("socket.io-parser");var o=e("./manager");var s=e("debug")("socket.io-client");t.exports=r=c;var a=r.managers={};function c(e,t){if(typeof e=="object"){t=e;e=undefined}t=t||{};var r=n(e);var i=r.source;var c=r.id;var f=r.path;var u=a[c]&&f in a[c].nsps;var p=t.forceNew||t["force new connection"]||false===t.multiplex||u;var l;if(p){s("ignoring socket cache for %s",i);l=o(i,t)}else{if(!a[c]){s("new io instance for %s",i);a[c]=o(i,t)}l=a[c]}return l.socket(r.path)}r.protocol=i.protocol;r.connect=c;r.Manager=e("./manager");r.Socket=e("./socket")},{"./manager":32,"./socket":34,"./url":35,debug:39,"socket.io-parser":47}],32:[function(e,t,r){var n=e("engine.io-client");var i=e("./socket");var o=e("component-emitter");var s=e("socket.io-parser");var a=e("./on");var c=e("component-bind");var f=e("debug")("socket.io-client:manager");var u=e("indexof");var p=e("backo2");var l=Object.prototype.hasOwnProperty;t.exports=h;function h(e,t){if(!(this instanceof h))return new h(e,t);if(e&&"object"==typeof e){t=e;e=undefined}t=t||{};t.path=t.path||"/socket.io";this.nsps={};this.subs=[];this.opts=t;this.reconnection(t.reconnection!==false);this.reconnectionAttempts(t.reconnectionAttempts||Infinity);this.reconnectionDelay(t.reconnectionDelay||1e3);this.reconnectionDelayMax(t.reconnectionDelayMax||5e3);this.randomizationFactor(t.randomizationFactor||.5);this.backoff=new p({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()});this.timeout(null==t.timeout?2e4:t.timeout);this.readyState="closed";this.uri=e;this.connecting=[];this.lastPing=null;this.encoding=false;this.packetBuffer=[];this.encoder=new s.Encoder;this.decoder=new s.Decoder;this.autoConnect=t.autoConnect!==false;if(this.autoConnect)this.open()}h.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var e in this.nsps){if(l.call(this.nsps,e)){this.nsps[e].emit.apply(this.nsps[e],arguments)}}};h.prototype.updateSocketIds=function(){for(var e in this.nsps){if(l.call(this.nsps,e)){this.nsps[e].id=this.engine.id}}};o(h.prototype);h.prototype.reconnection=function(e){if(!arguments.length)return this._reconnection;this._reconnection=!!e;return this};h.prototype.reconnectionAttempts=function(e){if(!arguments.length)return this._reconnectionAttempts;this._reconnectionAttempts=e;return this};h.prototype.reconnectionDelay=function(e){if(!arguments.length)return this._reconnectionDelay;this._reconnectionDelay=e;this.backoff&&this.backoff.setMin(e);return this};h.prototype.randomizationFactor=function(e){if(!arguments.length)return this._randomizationFactor;this._randomizationFactor=e;this.backoff&&this.backoff.setJitter(e);return this};h.prototype.reconnectionDelayMax=function(e){if(!arguments.length)return this._reconnectionDelayMax;this._reconnectionDelayMax=e;this.backoff&&this.backoff.setMax(e);return this};h.prototype.timeout=function(e){if(!arguments.length)return this._timeout;this._timeout=e;return this};h.prototype.maybeReconnectOnOpen=function(){if(!this.reconnecting&&this._reconnection&&this.backoff.attempts===0){this.reconnect()}};h.prototype.open=h.prototype.connect=function(e){f("readyState %s",this.readyState);if(~this.readyState.indexOf("open"))return this;f("opening %s",this.uri);this.engine=n(this.uri,this.opts);var t=this.engine;var r=this;this.readyState="opening";this.skipReconnect=false;var i=a(t,"open",function(){r.onopen();e&&e()});var o=a(t,"error",function(t){f("connect_error");r.cleanup();r.readyState="closed";r.emitAll("connect_error",t);if(e){var n=new Error("Connection error");n.data=t;e(n)}else{r.maybeReconnectOnOpen()}});if(false!==this._timeout){var s=this._timeout;f("connect attempt will timeout after %d",s);var c=setTimeout(function(){f("connect attempt timed out after %d",s);i.destroy();t.close();t.emit("error","timeout");r.emitAll("connect_timeout",s)},s);this.subs.push({destroy:function(){clearTimeout(c)}})}this.subs.push(i);this.subs.push(o);return this};h.prototype.onopen=function(){f("open");this.cleanup();this.readyState="open";this.emit("open");var e=this.engine;this.subs.push(a(e,"data",c(this,"ondata")));this.subs.push(a(e,"ping",c(this,"onping")));this.subs.push(a(e,"pong",c(this,"onpong")));this.subs.push(a(e,"error",c(this,"onerror")));this.subs.push(a(e,"close",c(this,"onclose")));this.subs.push(a(this.decoder,"decoded",c(this,"ondecoded")))};h.prototype.onping=function(){this.lastPing=new Date;this.emitAll("ping")};h.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};h.prototype.ondata=function(e){this.decoder.add(e)};h.prototype.ondecoded=function(e){this.emit("packet",e)};h.prototype.onerror=function(e){f("error",e);this.emitAll("error",e)};h.prototype.socket=function(e){var t=this.nsps[e];if(!t){t=new i(this,e);this.nsps[e]=t;var r=this;t.on("connecting",n);t.on("connect",function(){t.id=r.engine.id});if(this.autoConnect){n()}}function n(){if(!~u(r.connecting,t)){r.connecting.push(t)}}return t};h.prototype.destroy=function(e){var t=u(this.connecting,e);if(~t)this.connecting.splice(t,1);if(this.connecting.length)return;this.close()};h.prototype.packet=function(e){f("writing packet %j",e);var t=this;if(!t.encoding){t.encoding=true;this.encoder.encode(e,function(r){for(var n=0;n<r.length;n++){t.engine.write(r[n],e.options)}t.encoding=false;t.processPacketQueue()})}else{t.packetBuffer.push(e)}};h.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}};h.prototype.cleanup=function(){f("cleanup");var e;while(e=this.subs.shift())e.destroy();this.packetBuffer=[];this.encoding=false;this.lastPing=null;this.decoder.destroy()};h.prototype.close=h.prototype.disconnect=function(){f("disconnect");this.skipReconnect=true;this.reconnecting=false;if("opening"==this.readyState){this.cleanup()}this.backoff.reset();this.readyState="closed";if(this.engine)this.engine.close()};h.prototype.onclose=function(e){f("onclose");this.cleanup();this.backoff.reset();this.readyState="closed";this.emit("close",e);if(this._reconnection&&!this.skipReconnect){this.reconnect()}};h.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts){f("reconnect failed");this.backoff.reset();this.emitAll("reconnect_failed");this.reconnecting=false}else{var t=this.backoff.duration();f("will wait %dms before reconnect attempt",t);this.reconnecting=true;var r=setTimeout(function(){if(e.skipReconnect)return;f("attempting reconnect");e.emitAll("reconnect_attempt",e.backoff.attempts);e.emitAll("reconnecting",e.backoff.attempts);if(e.skipReconnect)return;e.open(function(t){if(t){f("reconnect attempt error");e.reconnecting=false;e.reconnect();e.emitAll("reconnect_error",t.data)}else{f("reconnect success");e.onreconnect()}})},t);this.subs.push({destroy:function(){clearTimeout(r)}})}};h.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=false;this.backoff.reset();this.updateSocketIds();this.emitAll("reconnect",e)}},{"./on":33,"./socket":34,backo2:36,"component-bind":37,"component-emitter":38,debug:39,"engine.io-client":1,indexof:42,"socket.io-parser":47}],33:[function(e,t,r){t.exports=n;function n(e,t,r){e.on(t,r);return{destroy:function(){e.removeListener(t,r)}}}},{}],34:[function(e,t,r){var n=e("socket.io-parser");var i=e("component-emitter");var o=e("to-array");var s=e("./on");var a=e("component-bind");var c=e("debug")("socket.io-client:socket");var f=e("has-binary");t.exports=r=l;var u={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1};var p=i.prototype.emit;function l(e,t){this.io=e;this.nsp=t;this.json=this;this.ids=0;this.acks={};this.receiveBuffer=[];this.sendBuffer=[];this.connected=false;this.disconnected=true;if(this.io.autoConnect)this.open()}i(l.prototype);l.prototype.subEvents=function(){if(this.subs)return;var e=this.io;this.subs=[s(e,"open",a(this,"onopen")),s(e,"packet",a(this,"onpacket")),s(e,"close",a(this,"onclose"))]};l.prototype.open=l.prototype.connect=function(){if(this.connected)return this;this.subEvents();this.io.open();if("open"==this.io.readyState)this.onopen();this.emit("connecting");return this};l.prototype.send=function(){var e=o(arguments);e.unshift("message");this.emit.apply(this,e);return this};l.prototype.emit=function(e){if(u.hasOwnProperty(e)){p.apply(this,arguments);return this}var t=o(arguments);var r=n.EVENT;if(f(t)){r=n.BINARY_EVENT}var i={type:r,data:t};i.options={};i.options.compress=!this.flags||false!==this.flags.compress;if("function"==typeof t[t.length-1]){c("emitting packet with ack id %d",this.ids);this.acks[this.ids]=t.pop();i.id=this.ids++}if(this.connected){this.packet(i)}else{this.sendBuffer.push(i)}delete this.flags;return this};l.prototype.packet=function(e){e.nsp=this.nsp;this.io.packet(e)};l.prototype.onopen=function(){c("transport is open - connecting");if("/"!=this.nsp){this.packet({type:n.CONNECT})}};l.prototype.onclose=function(e){c("close (%s)",e);this.connected=false;this.disconnected=true;delete this.id;this.emit("disconnect",e)};l.prototype.onpacket=function(e){if(e.nsp!=this.nsp)return;switch(e.type){case n.CONNECT:this.onconnect();break;case n.EVENT:this.onevent(e);break;case n.BINARY_EVENT:this.onevent(e);break;case n.ACK:this.onack(e);break;case n.BINARY_ACK:this.onack(e);break;case n.DISCONNECT:this.ondisconnect();break;case n.ERROR:this.emit("error",e.data);break}};l.prototype.onevent=function(e){var t=e.data||[];c("emitting event %j",t);if(null!=e.id){c("attaching ack callback to event");t.push(this.ack(e.id))}if(this.connected){p.apply(this,t)}else{this.receiveBuffer.push(t)}};l.prototype.ack=function(e){var t=this;var r=false;return function(){if(r)return;r=true;var i=o(arguments);c("sending ack %j",i);var s=f(i)?n.BINARY_ACK:n.ACK;t.packet({type:s,id:e,data:i})}};l.prototype.onack=function(e){var t=this.acks[e.id];if("function"==typeof t){c("calling ack %s with %j",e.id,e.data);t.apply(this,e.data);delete this.acks[e.id]}else{c("bad ack %s",e.id)}};l.prototype.onconnect=function(){this.connected=true;this.disconnected=false;this.emit("connect");this.emitBuffered()};l.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++){p.apply(this,this.receiveBuffer[e])}this.receiveBuffer=[];for(e=0;e<this.sendBuffer.length;e++){this.packet(this.sendBuffer[e])}this.sendBuffer=[]};l.prototype.ondisconnect=function(){c("server disconnect (%s)",this.nsp);this.destroy();this.onclose("io server disconnect")};l.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++){this.subs[e].destroy()}this.subs=null}this.io.destroy(this)};l.prototype.close=l.prototype.disconnect=function(){if(this.connected){c("performing disconnect (%s)",this.nsp);this.packet({type:n.DISCONNECT})}this.destroy();if(this.connected){this.onclose("io client disconnect")}return this};l.prototype.compress=function(e){this.flags=this.flags||{};this.flags.compress=e;return this}},{"./on":33,"component-bind":37,"component-emitter":38,debug:39,"has-binary":41,"socket.io-parser":47,"to-array":51}],35:[function(e,t,r){(function(r){var n=e("parseuri");var i=e("debug")("socket.io-client:url");t.exports=o;function o(e,t){var o=e;var t=t||r.location;if(null==e)e=t.protocol+"//"+t.host;if("string"==typeof e){if("/"==e.charAt(0)){if("/"==e.charAt(1)){e=t.protocol+e}else{e=t.host+e}}if(!/^(https?|wss?):\/\//.test(e)){i("protocol-less url %s",e);if("undefined"!=typeof t){e=t.protocol+"//"+e}else{e="https://"+e}}i("parse %s",e);o=n(e)}if(!o.port){if(/^(http|ws)$/.test(o.protocol)){o.port="80"}else if(/^(http|ws)s$/.test(o.protocol)){o.port="443"}}o.path=o.path||"/";var s=o.host.indexOf(":")!==-1;var a=s?"["+o.host+"]":o.host;o.id=o.protocol+"://"+a+":"+o.port;o.href=o.protocol+"://"+a+(t&&t.port==o.port?"":":"+o.port);return o}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{debug:39,parseuri:45}],36:[function(e,t,r){t.exports=n;function n(e){e=e||{};this.ms=e.min||100;this.max=e.max||1e4;this.factor=e.factor||2;this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0;this.attempts=0}n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random();var r=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-r:e+r}return Math.min(e,this.max)|0};n.prototype.reset=function(){this.attempts=0};n.prototype.setMin=function(e){this.ms=e};n.prototype.setMax=function(e){this.max=e};n.prototype.setJitter=function(e){this.jitter=e}},{}],37:[function(e,t,r){var n=[].slice;t.exports=function(e,t){if("string"==typeof t)t=e[t];if("function"!=typeof t)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return t.apply(e,r.concat(n.call(arguments)))}}},{}],38:[function(e,t,r){t.exports=n;function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype){e[t]=n.prototype[t]}return e}n.prototype.on=n.prototype.addEventListener=function(e,t){this._callbacks=this._callbacks||{};(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t);return this};n.prototype.once=function(e,t){function r(){this.off(e,r);t.apply(this,arguments)}r.fn=t;this.on(e,r);return this};n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length){delete this._callbacks["$"+e];return this}var n;for(var i=0;i<r.length;i++){n=r[i];if(n===t||n.fn===t){r.splice(i,1);break}}return this};n.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks["$"+e];if(r){r=r.slice(0);for(var n=0,i=r.length;n<i;++n){r[n].apply(this,t)}}return this};n.prototype.listeners=function(e){this._callbacks=this._callbacks||{};return this._callbacks["$"+e]||[]};n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],39:[function(e,t,r){arguments[4][17][0].apply(r,arguments)},{"./debug":40,dup:17}],40:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{dup:18,ms:44}],41:[function(e,t,r){(function(r){var n=e("isarray");t.exports=i;function i(e){function t(e){if(!e)return false;if(r.Buffer&&r.Buffer.isBuffer&&r.Buffer.isBuffer(e)||r.ArrayBuffer&&e instanceof ArrayBuffer||r.Blob&&e instanceof Blob||r.File&&e instanceof File){return true}if(n(e)){for(var i=0;i<e.length;i++){if(t(e[i])){return true}}}else if(e&&"object"==typeof e){if(e.toJSON&&"function"==typeof e.toJSON){e=e.toJSON()}for(var o in e){if(Object.prototype.hasOwnProperty.call(e,o)&&t(e[o])){return true}}}return false}return t(e)}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{isarray:43}],42:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23}],43:[function(e,t,r){arguments[4][24][0].apply(r,arguments)},{dup:24}],44:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],45:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{dup:28}],46:[function(e,t,r){(function(t){var n=e("isarray");var i=e("./is-buffer");r.deconstructPacket=function(e){var t=[];var r=e.data;function o(e){if(!e)return e;if(i(e)){var r={_placeholder:true,num:t.length};t.push(e);return r}else if(n(e)){var s=new Array(e.length);for(var a=0;a<e.length;a++){s[a]=o(e[a])}return s}else if("object"==typeof e&&!(e instanceof Date)){var s={};for(var c in e){s[c]=o(e[c])}return s}return e}var s=e;s.data=o(r);s.attachments=t.length;return{packet:s,buffers:t}};r.reconstructPacket=function(e,t){var r=0;function i(e){if(e&&e._placeholder){var r=t[e.num];return r}else if(n(e)){for(var o=0;o<e.length;o++){e[o]=i(e[o])}return e}else if(e&&"object"==typeof e){for(var s in e){e[s]=i(e[s])}return e}return e}e.data=i(e.data);e.attachments=undefined;return e};r.removeBlobs=function(e,r){function o(e,c,f){if(!e)return e;if(t.Blob&&e instanceof Blob||t.File&&e instanceof File){s++;var u=new FileReader;u.onload=function(){if(f){f[c]=this.result}else{a=this.result}if(!--s){r(a)}};u.readAsArrayBuffer(e)}else if(n(e)){for(var p=0;p<e.length;p++){o(e[p],p,e)}}else if(e&&"object"==typeof e&&!i(e)){for(var l in e){o(e[l],l,e)}}}var s=0;var a=e;o(a);if(!s){r(a)}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{"./is-buffer":48,isarray:43}],47:[function(e,t,r){var n=e("debug")("socket.io-parser");var i=e("json3");var o=e("isarray");var s=e("component-emitter");var a=e("./binary");var c=e("./is-buffer");r.protocol=4;r.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"];r.CONNECT=0;r.DISCONNECT=1;r.EVENT=2;r.ACK=3;r.ERROR=4;r.BINARY_EVENT=5;r.BINARY_ACK=6;r.Encoder=f;r.Decoder=l;function f(){}f.prototype.encode=function(e,t){n("encoding packet %j",e);if(r.BINARY_EVENT==e.type||r.BINARY_ACK==e.type){p(e,t)}else{var i=u(e);t([i])}};function u(e){var t="";var o=false;t+=e.type;if(r.BINARY_EVENT==e.type||r.BINARY_ACK==e.type){t+=e.attachments;t+="-"}if(e.nsp&&"/"!=e.nsp){o=true;t+=e.nsp}if(null!=e.id){if(o){t+=",";o=false}t+=e.id}if(null!=e.data){if(o)t+=",";t+=i.stringify(e.data)}n("encoded %j as %s",e,t);return t}function p(e,t){function r(e){var r=a.deconstructPacket(e);var n=u(r.packet);var i=r.buffers;i.unshift(n);t(i)}a.removeBlobs(e,r)}function l(){this.reconstructor=null}s(l.prototype);l.prototype.add=function(e){var t;if("string"==typeof e){t=h(e);if(r.BINARY_EVENT==t.type||r.BINARY_ACK==t.type){this.reconstructor=new d(t);if(this.reconstructor.reconPack.attachments===0){this.emit("decoded",t)}}else{this.emit("decoded",t)}}else if(c(e)||e.base64){if(!this.reconstructor){throw new Error("got binary data when not reconstructing a packet")}else{t=this.reconstructor.takeBinaryData(e);if(t){this.reconstructor=null;this.emit("decoded",t)}}}else{throw new Error("Unknown type: "+e)}};function h(e){var t={};var o=0;t.type=Number(e.charAt(0));if(null==r.types[t.type])return y();if(r.BINARY_EVENT==t.type||r.BINARY_ACK==t.type){var s="";while(e.charAt(++o)!="-"){s+=e.charAt(o);if(o==e.length)break}if(s!=Number(s)||e.charAt(o)!="-"){throw new Error("Illegal attachments")}t.attachments=Number(s)}if("/"==e.charAt(o+1)){t.nsp="";while(++o){var a=e.charAt(o);if(","==a)break;t.nsp+=a;if(o==e.length)break}}else{t.nsp="/"}var c=e.charAt(o+1);if(""!==c&&Number(c)==c){t.id="";while(++o){var a=e.charAt(o);if(null==a||Number(a)!=a){--o;break}t.id+=e.charAt(o);if(o==e.length)break}t.id=Number(t.id)}if(e.charAt(++o)){try{t.data=i.parse(e.substr(o))}catch(f){return y()}}n("decoded %s as %j",e,t);return t}l.prototype.destroy=function(){if(this.reconstructor){this.reconstructor.finishedReconstruction()}};function d(e){this.reconPack=e;this.buffers=[]}d.prototype.takeBinaryData=function(e){this.buffers.push(e);if(this.buffers.length==this.reconPack.attachments){var t=a.reconstructPacket(this.reconPack,this.buffers);this.finishedReconstruction();return t}return null};d.prototype.finishedReconstruction=function(){this.reconPack=null;this.buffers=[]};function y(e){return{type:r.ERROR,data:"parser error"}}},{"./binary":46,"./is-buffer":48,"component-emitter":49,debug:39,isarray:43,json3:50}],48:[function(e,t,r){(function(e){t.exports=r;function r(t){return e.Buffer&&e.Buffer.isBuffer(t)||e.ArrayBuffer&&t instanceof ArrayBuffer}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{}],49:[function(e,t,r){arguments[4][15][0].apply(r,arguments)
},{dup:15}],50:[function(t,r,n){(function(t){(function(){var i=typeof e==="function"&&e.amd;var o={"function":true,object:true};var s=o[typeof n]&&n&&!n.nodeType&&n;var a=o[typeof window]&&window||this,c=s&&o[typeof r]&&r&&!r.nodeType&&typeof t=="object"&&t;if(c&&(c["global"]===c||c["window"]===c||c["self"]===c)){a=c}function f(e,t){e||(e=a["Object"]());t||(t=a["Object"]());var r=e["Number"]||a["Number"],n=e["String"]||a["String"],i=e["Object"]||a["Object"],s=e["Date"]||a["Date"],c=e["SyntaxError"]||a["SyntaxError"],u=e["TypeError"]||a["TypeError"],p=e["Math"]||a["Math"],l=e["JSON"]||a["JSON"];if(typeof l=="object"&&l){t.stringify=l.stringify;t.parse=l.parse}var h=i.prototype,d=h.toString,y,g,v;var m=new s(-0xc782b5b800cec);try{m=m.getUTCFullYear()==-109252&&m.getUTCMonth()===0&&m.getUTCDate()===1&&m.getUTCHours()==10&&m.getUTCMinutes()==37&&m.getUTCSeconds()==6&&m.getUTCMilliseconds()==708}catch(b){}function w(e){if(w[e]!==v){return w[e]}var i;if(e=="bug-string-char-index"){i="a"[0]!="a"}else if(e=="json"){i=w("json-stringify")&&w("json-parse")}else{var o,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(e=="json-stringify"){var c=t.stringify,f=typeof c=="function"&&m;if(f){(o=function(){return 1}).toJSON=o;try{f=c(0)==="0"&&c(new r)==="0"&&c(new n)=='""'&&c(d)===v&&c(v)===v&&c()===v&&c(o)==="1"&&c([o])=="[1]"&&c([v])=="[null]"&&c(null)=="null"&&c([v,d,null])=="[null,null,null]"&&c({a:[o,true,false,null,"\x00\b\n\f\r "]})==a&&c(null,o)==="1"&&c([1,2],null,1)=="[\n 1,\n 2\n]"&&c(new s(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&c(new s(864e13))=='"+275760-09-13T00:00:00.000Z"'&&c(new s(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&c(new s(-1))=='"1969-12-31T23:59:59.999Z"'}catch(u){f=false}}i=f}if(e=="json-parse"){var p=t.parse;if(typeof p=="function"){try{if(p("0")===0&&!p(false)){o=p(a);var l=o["a"].length==5&&o["a"][0]===1;if(l){try{l=!p('" "')}catch(u){}if(l){try{l=p("01")!==1}catch(u){}}if(l){try{l=p("1.")!==1}catch(u){}}}}}catch(u){l=false}}i=l}}return w[e]=!!i}if(!w("json")){var k="[object Function]",x="[object Date]",A="[object Number]",B="[object String]",C="[object Array]",S="[object Boolean]";var E=w("bug-string-char-index");if(!m){var _=p.floor;var T=[0,31,59,90,120,151,181,212,243,273,304,334];var O=function(e,t){return T[t]+365*(e-1970)+_((e-1969+(t=+(t>1)))/4)-_((e-1901+t)/100)+_((e-1601+t)/400)}}if(!(y=h.hasOwnProperty)){y=function(e){var t={},r;if((t.__proto__=null,t.__proto__={toString:1},t).toString!=d){y=function(e){var t=this.__proto__,r=e in(this.__proto__=null,this);this.__proto__=t;return r}}else{r=t.constructor;y=function(e){var t=(this.constructor||r).prototype;return e in this&&!(e in t&&this[e]===t[e])}}t=null;return y.call(this,e)}}g=function(e,t){var r=0,n,i,s;(n=function(){this.valueOf=0}).prototype.valueOf=0;i=new n;for(s in i){if(y.call(i,s)){r++}}n=i=null;if(!r){i=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];g=function(e,t){var r=d.call(e)==k,n,s;var a=!r&&typeof e.constructor!="function"&&o[typeof e.hasOwnProperty]&&e.hasOwnProperty||y;for(n in e){if(!(r&&n=="prototype")&&a.call(e,n)){t(n)}}for(s=i.length;n=i[--s];a.call(e,n)&&t(n));}}else if(r==2){g=function(e,t){var r={},n=d.call(e)==k,i;for(i in e){if(!(n&&i=="prototype")&&!y.call(r,i)&&(r[i]=1)&&y.call(e,i)){t(i)}}}}else{g=function(e,t){var r=d.call(e)==k,n,i;for(n in e){if(!(r&&n=="prototype")&&y.call(e,n)&&!(i=n==="constructor")){t(n)}}if(i||y.call(e,n="constructor")){t(n)}}}return g(e,t)};if(!w("json-stringify")){var j={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var P="000000";var N=function(e,t){return(P+(t||0)).slice(-e)};var R="\\u00";var D=function(e){var t='"',r=0,n=e.length,i=!E||n>10;var o=i&&(E?e.split(""):e);for(;r<n;r++){var s=e.charCodeAt(r);switch(s){case 8:case 9:case 10:case 12:case 13:case 34:case 92:t+=j[s];break;default:if(s<32){t+=R+N(2,s.toString(16));break}t+=i?o[r]:e.charAt(r)}}return t+'"'};var U=function(e,t,r,n,i,o,s){var a,c,f,p,l,h,m,b,w,k,E,T,j,P,R,q;try{a=t[e]}catch(L){}if(typeof a=="object"&&a){c=d.call(a);if(c==x&&!y.call(a,"toJSON")){if(a>-1/0&&a<1/0){if(O){l=_(a/864e5);for(f=_(l/365.2425)+1970-1;O(f+1,0)<=l;f++);for(p=_((l-O(f,0))/30.42);O(f,p+1)<=l;p++);l=1+l-O(f,p);h=(a%864e5+864e5)%864e5;m=_(h/36e5)%24;b=_(h/6e4)%60;w=_(h/1e3)%60;k=h%1e3}else{f=a.getUTCFullYear();p=a.getUTCMonth();l=a.getUTCDate();m=a.getUTCHours();b=a.getUTCMinutes();w=a.getUTCSeconds();k=a.getUTCMilliseconds()}a=(f<=0||f>=1e4?(f<0?"-":"+")+N(6,f<0?-f:f):N(4,f))+"-"+N(2,p+1)+"-"+N(2,l)+"T"+N(2,m)+":"+N(2,b)+":"+N(2,w)+"."+N(3,k)+"Z"}else{a=null}}else if(typeof a.toJSON=="function"&&(c!=A&&c!=B&&c!=C||y.call(a,"toJSON"))){a=a.toJSON(e)}}if(r){a=r.call(t,e,a)}if(a===null){return"null"}c=d.call(a);if(c==S){return""+a}else if(c==A){return a>-1/0&&a<1/0?""+a:"null"}else if(c==B){return D(""+a)}if(typeof a=="object"){for(P=s.length;P--;){if(s[P]===a){throw u()}}s.push(a);E=[];R=o;o+=i;if(c==C){for(j=0,P=a.length;j<P;j++){T=U(j,a,r,n,i,o,s);E.push(T===v?"null":T)}q=E.length?i?"[\n"+o+E.join(",\n"+o)+"\n"+R+"]":"["+E.join(",")+"]":"[]"}else{g(n||a,function(e){var t=U(e,a,r,n,i,o,s);if(t!==v){E.push(D(e)+":"+(i?" ":"")+t)}});q=E.length?i?"{\n"+o+E.join(",\n"+o)+"\n"+R+"}":"{"+E.join(",")+"}":"{}"}s.pop();return q}};t.stringify=function(e,t,r){var n,i,s,a;if(o[typeof t]&&t){if((a=d.call(t))==k){i=t}else if(a==C){s={};for(var c=0,f=t.length,u;c<f;u=t[c++],(a=d.call(u),a==B||a==A)&&(s[u]=1));}}if(r){if((a=d.call(r))==A){if((r-=r%1)>0){for(n="",r>10&&(r=10);n.length<r;n+=" ");}}else if(a==B){n=r.length<=10?r:r.slice(0,10)}}return U("",(u={},u[""]=e,u),i,s,n,"",[])}}if(!w("json-parse")){var q=n.fromCharCode;var L={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:"\n",102:"\f",114:"\r"};var M,I;var H=function(){M=I=null;throw c()};var z=function(){var e=I,t=e.length,r,n,i,o,s;while(M<t){s=e.charCodeAt(M);switch(s){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:r=E?e.charAt(M):e[M];M++;return r;case 34:for(r="@",M++;M<t;){s=e.charCodeAt(M);if(s<32){H()}else if(s==92){s=e.charCodeAt(++M);switch(s){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:r+=L[s];M++;break;case 117:n=++M;for(i=M+4;M<i;M++){s=e.charCodeAt(M);if(!(s>=48&&s<=57||s>=97&&s<=102||s>=65&&s<=70)){H()}}r+=q("0x"+e.slice(n,M));break;default:H()}}else{if(s==34){break}s=e.charCodeAt(M);n=M;while(s>=32&&s!=92&&s!=34){s=e.charCodeAt(++M)}r+=e.slice(n,M)}}if(e.charCodeAt(M)==34){M++;return r}H();default:n=M;if(s==45){o=true;s=e.charCodeAt(++M)}if(s>=48&&s<=57){if(s==48&&(s=e.charCodeAt(M+1),s>=48&&s<=57)){H()}o=false;for(;M<t&&(s=e.charCodeAt(M),s>=48&&s<=57);M++);if(e.charCodeAt(M)==46){i=++M;for(;i<t&&(s=e.charCodeAt(i),s>=48&&s<=57);i++);if(i==M){H()}M=i}s=e.charCodeAt(M);if(s==101||s==69){s=e.charCodeAt(++M);if(s==43||s==45){M++}for(i=M;i<t&&(s=e.charCodeAt(i),s>=48&&s<=57);i++);if(i==M){H()}M=i}return+e.slice(n,M)}if(o){H()}if(e.slice(M,M+4)=="true"){M+=4;return true}else if(e.slice(M,M+5)=="false"){M+=5;return false}else if(e.slice(M,M+4)=="null"){M+=4;return null}H()}}return"$"};var J=function(e){var t,r;if(e=="$"){H()}if(typeof e=="string"){if((E?e.charAt(0):e[0])=="@"){return e.slice(1)}if(e=="["){t=[];for(;;r||(r=true)){e=z();if(e=="]"){break}if(r){if(e==","){e=z();if(e=="]"){H()}}else{H()}}if(e==","){H()}t.push(J(e))}return t}else if(e=="{"){t={};for(;;r||(r=true)){e=z();if(e=="}"){break}if(r){if(e==","){e=z();if(e=="}"){H()}}else{H()}}if(e==","||typeof e!="string"||(E?e.charAt(0):e[0])!="@"||z()!=":"){H()}t[e.slice(1)]=J(z())}return t}H()}return e};var X=function(e,t,r){var n=F(e,t,r);if(n===v){delete e[t]}else{e[t]=n}};var F=function(e,t,r){var n=e[t],i;if(typeof n=="object"&&n){if(d.call(n)==C){for(i=n.length;i--;){X(n,i,r)}}else{g(n,function(e){X(n,e,r)})}}return r.call(e,t,n)};t.parse=function(e,t){var r,n;M=0;I=""+e;r=J(z());if(z()!="$"){H()}M=I=null;return t&&d.call(t)==k?F((n={},n[""]=r,n),"",t):r}}}t["runInContext"]=f;return t}if(s&&!i){f(a,s)}else{var u=a.JSON,p=a["JSON3"],l=false;var h=f(a,a["JSON3"]={noConflict:function(){if(!l){l=true;a.JSON=u;a["JSON3"]=p;u=p=null}return h}});a.JSON={parse:h.parse,stringify:h.stringify}}if(i){e(function(){return h})}}).call(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{}],51:[function(e,t,r){t.exports=n;function n(e,t){var r=[];t=t||0;for(var n=t||0;n<e.length;n++){r[n-t]=e[n]}return r}},{}]},{},[31])(31)});