Place to store the code and config used for the next-Iterations live event. https://iterations.space/live/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
42 KiB

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.eio=t()}}(function(){var t;return 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 p=new Error("Cannot find module '"+s+"'");throw p.code="MODULE_NOT_FOUND",p}var u=r[s]={exports:{}};e[s][0].call(u.exports,function(t){var r=e[s][1][t];return o(r||t)},u,u.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){e.exports=t("./lib/")},{"./lib/":2}],2:[function(t,e,r){e.exports=t("./socket"),e.exports.parser=t("engine.io-parser")},{"./socket":3,"engine.io-parser":17}],3:[function(t,e,r){(function(r){function n(t,e){if(!(this instanceof n))return new n(t,e);if(e=e||{},t&&"object"==typeof t&&(e=t,t=null),t&&(t=u(t),e.host=t.host,e.secure="https"==t.protocol||"wss"==t.protocol,e.port=t.port,t.query&&(e.query=t.query)),this.secure=null!=e.secure?e.secure:r.location&&"https:"==location.protocol,e.host){var o=e.host.split(":");e.hostname=o.shift(),o.length?e.port=o.pop():e.port||(e.port=this.secure?"443":"80")}this.agent=e.agent||!1,this.hostname=e.hostname||(r.location?location.hostname:"localhost"),this.port=e.port||(r.location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=f.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=e.rejectUnauthorized||null,this.open()}function o(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var i=t("./transports"),s=t("component-emitter"),a=t("debug")("engine.io-client:socket"),c=t("indexof"),p=t("engine.io-parser"),u=t("parseuri"),h=t("parsejson"),f=t("parseqs");e.exports=n,n.priorWebsocketSuccess=!1,s(n.prototype),n.protocol=p.protocol,n.Socket=n,n.Transport=t("./transport"),n.transports=t("./transports"),n.parser=t("engine.io-parser"),n.prototype.createTransport=function(t){a('creating transport "%s"',t);var e=o(this.query);return e.EIO=p.protocol,e.transport=t,this.id&&(e.sid=this.id),new i[t]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:e,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})},n.prototype.open=function(){var t;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&-1!=this.transports.indexOf("websocket"))t="websocket";else{if(0==this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";var t;try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},n.prototype.setTransport=function(t){a("setting transport %s",t.name);var e=this;this.transport&&(a("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},n.prototype.probe=function(t){function e(){if(f.onlyBinaryUpgrades){var e=!this.supportsBinary&&f.transport.supportsBinary;h=h||e}h||(a('probe transport "%s" opened',t),u.send([{type:"ping",data:"probe"}]),u.once("packet",function(e){if(!h)if("pong"==e.type&&"probe"==e.data){if(a('probe transport "%s" pong',t),f.upgrading=!0,f.emit("upgrading",u),!u)return;n.priorWebsocketSuccess="websocket"==u.name,a('pausing current transport "%s"',f.transport.name),f.transport.pause(function(){h||"closed"!=f.readyState&&(a("changing transport and sending upgrade packet"),p(),f.setTransport(u),u.send([{type:"upgrade"}]),f.emit("upgrade",u),u=null,f.upgrading=!1,f.flush())})}else{a('probe transport "%s" failed',t);var r=new Error("probe error");r.transport=u.name,f.emit("upgradeError",r)}}))}function r(){h||(h=!0,p(),u.close(),u=null)}function o(e){var n=new Error("probe error: "+e);n.transport=u.name,r(),a('probe transport "%s" failed because of error: %s',t,e),f.emit("upgradeError",n)}function i(){o("transport closed")}function s(){o("socket closed")}function c(t){u&&t.name!=u.name&&(a('"%s" works - aborting "%s"',t.name,u.name),r())}function p(){u.removeListener("open",e),u.removeListener("error",o),u.removeListener("close",i),f.removeListener("close",s),f.removeListener("upgrading",c)}a('probing transport "%s"',t);var u=this.createTransport(t,{probe:1}),h=!1,f=this;n.priorWebsocketSuccess=!1,u.once("open",e),u.once("error",o),u.once("close",i),this.once("close",s),this.once("upgrading",c),u.open()},n.prototype.onOpen=function(){if(a("socket open"),this.readyState="open",n.priorWebsocketSuccess="websocket"==this.transport.name,this.emit("open"),this.flush(),"open"==this.readyState&&this.upgrade&&this.transport.pause){a("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},n.prototype.onPacket=function(t){if("opening"==this.readyState||"open"==this.readyState)switch(a('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(h(t.data));break;case"pong":this.setPing();break;case"error":var e=new Error("server error");e.code=t.data,this.emit("error",e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else a('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!=this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!=e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},n.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){a("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var t=0;t<this.prevBufferLen;t++)this.callbackBuffer[t]&&this.callbackBuffer[t]();this.writeBuffer.splice(0,this.prevBufferLen),this.callbackBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0==this.writeBuffer.length?this.emit("drain"):this.flush()},n.prototype.flush=function(){"closed"!=this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(a("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(t,e){return this.sendPacket("message",t,e),this},n.prototype.sendPacket=function(t,e,r){if("closing"!=this.readyState&&"closed"!=this.readyState){var n={type:t,data:e};this.emit("packetCreate",n),this.writeBuffer.push(n),this.callbackBuffer.push(r),this.flush()}},n.prototype.close=function(){function t(){n.onClose("forced close"),a("socket closing - telling transport to close"),n.transport.close()}function e(){n.removeListener("upgrade",e),n.removeListener("upgradeError",e),t()}function r(){n.once("upgrade",e),n.once("upgradeError",e)}if("opening"==this.readyState||"open"==this.readyState){this.readyState="closing";var n=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?r():t()}):this.upgrading?r():t()}return this},n.prototype.onError=function(t){a("socket error %j",t),n.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},n.prototype.onClose=function(t,e){if("opening"==this.readyState||"open"==this.readyState||"closing"==this.readyState){a('socket close with reason: "%s"',t);var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){r.writeBuffer=[],r.callbackBuffer=[],r.prevBufferLen=0},0),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e)}},n.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~c(this.transports,t[r])&&e.push(t[r]);return e}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./transport":4,"./transports":5,"component-emitter":12,debug:14,"engine.io-parser":17,indexof:27,parsejson:28,parseqs:29,parseuri:30}],4:[function(t,e,r){function n(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized}var o=t("engine.io-parser"),i=t("component-emitter");e.exports=n,i(n.prototype),n.timestamps=0,n.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),this},n.prototype.open=function(){return"closed"!=this.readyState&&""!=this.readyState||(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return"opening"!=this.readyState&&"open"!=this.readyState||(this.doClose(),this.onClose()),this},n.prototype.send=function(t){if("open"!=this.readyState)throw new Error("Transport not open");this.write(t)},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(t){var e=o.decodePacket(t,this.socket.binaryType);this.onPacket(e)},n.prototype.onPacket=function(t){this.emit("packet",t)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":12,"engine.io-parser":17}],5:[function(t,e,r){(function(e){function n(t){var r=!1,n=!1,a=!1!==t.jsonp;if(e.location){var c="https:"==location.protocol,p=location.port;p||(p=c?443:80),r=t.hostname!=location.hostname||p!=t.port,n=t.secure!=c}if(t.xdomain=r,t.xscheme=n,"open"in new o(t)&&!t.forceJSONP)return new i(t);if(!a)throw new Error("JSONP disabled");return new s(t)}var o=t("xmlhttprequest"),i=t("./polling-xhr"),s=t("./polling-jsonp"),a=t("./websocket");r.polling=n,r.websocket=a}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polling-jsonp":6,"./polling-xhr":7,"./websocket":9,xmlhttprequest:10}],6:[function(t,e,r){(function(r){function n(){}function o(t){i.call(this,t),this.query=this.query||{},a||(r.___eio||(r.___eio=[]),a=r.___eio),this.index=a.length;var e=this;a.push(function(t){e.onData(t)}),this.query.j=this.index,r.document&&r.addEventListener&&r.addEventListener("beforeunload",function(){e.script&&(e.script.onerror=n)},!1)}var i=t("./polling"),s=t("component-inherit");e.exports=o;var a,c=/\n/g,p=/\\n/g;s(o,i),o.prototype.supportsBinary=!1,o.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),i.prototype.doClose.call(this)},o.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(e,r),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},o.prototype.doWrite=function(t,e){function r(){n(),e()}function n(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+o.iframeId+'">';i=document.createElement(t)}catch(t){i=document.createElement("iframe"),i.name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),u=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=u,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),n(),t=t.replace(p,"\\\n"),this.area.value=t.replace(c,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"==o.iframe.readyState&&r()}:this.iframe.onload=r}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polling":8,"component-inherit":13}],7:[function(t,e,r){(function(r){function n(){}function o(t){if(c.call(this,t),r.location){var e="https:"==location.protocol,n=location.port;n||(n=e?443:80),this.xd=t.hostname!=r.location.hostname||n!=t.port,this.xs=t.secure!=e}}function i(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!=t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.create()}function s(){for(var t in i.requests)i.requests.hasOwnProperty(t)&&i.requests[t].abort()}var a=t("xmlhttprequest"),c=t("./polling"),p=t("component-emitter"),u=t("component-inherit"),h=t("debug")("engine.io-client:polling-xhr");e.exports=o,e.exports.Request=i,u(o,c),o.prototype.supportsBinary=!0,o.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,new i(t)},o.prototype.doWrite=function(t,e){var r="string"!=typeof t&&void 0!==t,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=n},o.prototype.doPoll=function(){h("xhr poll");var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},p(i.prototype),i.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new a(t),n=this;try{if(h("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async),this.supportsBinary&&(e.responseType="arraybuffer"),"POST"==this.method)try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}"withCredentials"in e&&(e.withCredentials=!0),this.hasXDR()?(e.onload=function(){n.onLoad()},e.onerror=function(){n.onError(e.responseText)}):e.onreadystatechange=function(){4==e.readyState&&(200==e.status||1223==e.status?n.onLoad():setTimeout(function(){n.onError(e.status)},0))},h("xhr data %s",this.data),e.send(this.data)}catch(t){return void setTimeout(function(){n.onError(t)},0)}r.document&&(this.index=i.requestsCount++,i.requests[this.index]=this)},i.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},i.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},i.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},i.prototype.cleanup=function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,t)try{this.xhr.abort()}catch(t){}r.document&&delete i.requests[this.index],this.xhr=null}},i.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(t){}t="application/octet-stream"===e?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},i.prototype.hasXDR=function(){return void 0!==r.XDomainRequest&&!this.xs&&this.enablesXDR},i.prototype.abort=function(){this.cleanup()},r.document&&(i.requestsCount=0,i.requests={},r.attachEvent?r.attachEvent("onunload",s):r.addEventListener&&r.addEventListener("beforeunload",s,!1))}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polling":8,"component-emitter":12,"component-inherit":13,debug:14,xmlhttprequest:10}],8:[function(t,e,r){function n(t){var e=t&&t.forceBase64;p&&!e||(this.supportsBinary=!1),o.call(this,t)}var o=t("../transport"),i=t("parseqs"),s=t("engine.io-parser"),a=t("component-inherit"),c=t("debug")("engine.io-client:polling");e.exports=n;var p=function(){return null!=new(t("xmlhttprequest"))({xdomain:!1}).responseType}();a(n,o),n.prototype.name="polling",n.prototype.doOpen=function(){this.poll()},n.prototype.pause=function(t){function e(){c("paused"),r.readyState="paused",t()}var r=this;if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(c("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){c("pre-pause polling complete"),--n||e()})),this.writable||(c("we are currently writing - waiting to pause"),n++,this.once("drain",function(){c("pre-pause writing complete"),--n||e()}))}else e()},n.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},n.prototype.onData=function(t){var e=this;c("polling got data %s",t);var r=function(t,r,n){if("opening"==e.readyState&&e.onOpen(),"close"==t.type)return e.onClose(),!1;e.onPacket(t)};s.decodePayload(t,this.socket.binaryType,r),"closed"!=this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"==this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},n.prototype.doClose=function(){function t(){c("writing close packet"),e.write([{type:"close"}])}var e=this;"open"==this.readyState?(c("transport open - closing"),t()):(c("transport not open - deferring close"),this.once("open",t))},n.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")},e=this;s.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,r)})},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";return!1!==this.timestampRequests&&(t[this.timestampParam]=+new Date+"-"+o.timestamps++),this.supportsBinary||t.sid||(t.b64=1),t=i.encode(t),this.port&&("https"==e&&443!=this.port||"http"==e&&80!=this.port)&&(r=":"+this.port),t.length&&(t="?"+t),e+"://"+this.hostname+r+this.path+t}},{"../transport":4,"component-inherit":13,debug:14,"engine.io-parser":17,parseqs:29,xmlhttprequest:10}],9:[function(t,e,r){function n(t){t&&t.forceBase64&&(this.supportsBinary=!1),o.call(this,t)}var o=t("../transport"),i=t("engine.io-parser"),s=t("parseqs"),a=t("component-inherit"),c=t("debug")("engine.io-client:websocket"),p=t("ws");e.exports=n,a(n,o),n.prototype.name="websocket",n.prototype.supportsBinary=!0,n.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e={agent:this.agent};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,this.ws=new p(t,void 0,e),void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},n.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},"undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(n.prototype.onData=function(t){var e=this;setTimeout(function(){o.prototype.onData.call(e,t)},0)}),n.prototype.write=function(t){function e(){r.writable=!0,r.emit("drain")}var r=this;this.writable=!1;for(var n=0,o=t.length;n<o;n++)i.encodePacket(t[n],this.supportsBinary,function(t){try{r.ws.send(t)}catch(t){c("websocket closed before onclose event")}});setTimeout(e,0)},n.prototype.onClose=function(){o.prototype.onClose.call(this)},n.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";return this.port&&("wss"==e&&443!=this.port||"ws"==e&&80!=this.port)&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=+new Date),this.supportsBinary||(t.b64=1),t=s.encode(t),t.length&&(t="?"+t),e+"://"+this.hostname+r+this.path+t},n.prototype.check=function(){return!(!p||"__initialize"in p&&this.name===n.prototype.name)}},{"../transport":4,"component-inherit":13,debug:14,"engine.io-parser":17,parseqs:29,ws:31}],10:[function(t,e,r){var n=t("has-cors");e.exports=function(t){var e=t.xdomain,r=t.xscheme,o=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||n))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!r&&o)return new XDomainRequest}catch(t){}if(!e)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}},{"has-cors":25}],11:[function(t,e,r){(function(t){function r(t,e){e=e||{};for(var r=new n,o=0;o<t.length;o++)r.append(t[o]);return e.type?r.getBlob(e.type):r.getBlob()}var n=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,o=function(){try{return 2==new Blob(["hi"]).size}catch(t){return!1}}(),i=n&&n.prototype.append&&n.prototype.getBlob;e.exports=function(){return o?t.Blob:i?r:void 0}()}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],12:[function(t,e,r){function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){n.off(t,r),e.apply(this,arguments)}var n=this;return this._callbacks=this._callbacks||{},r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks[t];if(!r)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var n,o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks[t];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],13:[function(t,e,r){e.exports=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],14:[function(t,e,r){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}function o(){var t=arguments,e=this.useColors;if(t[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+t[0]+(e?"%c ":" ")+"+"+r.humanize(this.diff),!e)return t;var n="color: "+this.color;t=[t[0],n,"color: inherit"].concat(Array.prototype.slice.call(t,1));var o=0,i=0;return t[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,n),t}function i(){return"object"==typeof console&&"function"==typeof console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(t){try{null==t?localStorage.removeItem("debug"):localStorage.debug=t}catch(t){}}function a(){var t;try{t=localStorage.debug}catch(t){}return t}r=e.exports=t("./debug"),r.log=i,r.formatArgs=o,r.save=s,r.load=a,r.useColors=n,r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(t){return JSON.stringify(t)},r.enable(a())},{"./debug":15}],15:[function(t,e,r){function n(){return r.colors[u++%r.colors.length]}function o(t){function e(){}function o(){var t=o,e=+new Date,i=e-(p||e);t.diff=i,t.prev=p,t.curr=e,p=e,null==t.useColors&&(t.useColors=r.useColors()),null==t.color&&t.useColors&&(t.color=n());var s=Array.prototype.slice.call(arguments);s[0]=r.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var a=0;s[0]=s[0].replace(/%([a-z%])/g,function(e,n){if("%%"===e)return e;a++;var o=r.formatters[n];if("function"==typeof o){var i=s[a];e=o.call(t,i),s.splice(a,1),a--}return e}),"function"==typeof r.formatArgs&&(s=r.formatArgs.apply(t,s)),(o.log||r.log||console.log.bind(console)).apply(t,s)}e.enabled=!1,o.enabled=!0;var i=r.enabled(t)?o:e;return i.namespace=t,i}function i(t){r.save(t);for(var e=(t||"").split(/[\s,]+/),n=e.length,o=0;o<n;o++)e[o]&&(t=e[o].replace(/\*/g,".*?"),"-"===t[0]?r.skips.push(new RegExp("^"+t.substr(1)+"$")):r.names.push(new RegExp("^"+t+"$")))}function s(){r.enable("")}function a(t){var e,n;for(e=0,n=r.skips.length;e<n;e++)if(r.skips[e].test(t))return!1;for(e=0,n=r.names.length;e<n;e++)if(r.names[e].test(t))return!0;return!1}function c(t){return t instanceof Error?t.stack||t.message:t}r=e.exports=o,r.coerce=c,r.disable=s,r.enable=i,r.enabled=a,r.humanize=t("ms"),r.names=[],r.skips=[],r.formatters={};var p,u=0},{ms:16}],16:[function(t,e,r){function n(t){var e=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"y":return r*h;case"days":case"day":case"d":return r*u;case"hours":case"hour":case"h":return r*p;case"minutes":case"minute":case"m":return r*c;case"seconds":case"second":case"s":return r*a;case"ms":return r}}}function o(t){return t>=u?Math.round(t/u)+"d":t>=p?Math.round(t/p)+"h":t>=c?Math.round(t/c)+"m":t>=a?Math.round(t/a)+"s":t+"ms"}function i(t){return s(t,u,"day")||s(t,p,"hour")||s(t,c,"minute")||s(t,a,"second")||t+" ms"}function s(t,e,r){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}var a=1e3,c=60*a,p=60*c,u=24*p,h=365.25*u;e.exports=function(t,e){return e=e||{},"string"==typeof t?n(t):e.long?i(t):o(t)}},{}],17:[function(t,e,r){(function(e){function n(t,e){return e("b"+r.packets[t.type]+t.data.data)}function o(t,e,n){if(!e)return r.encodeBase64Packet(t,n);var o=t.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=g[t.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return n(s.buffer)}function i(t,e,n){if(!e)return r.encodeBase64Packet(t,n);var o=new FileReader;return o.onload=function(){t.data=o.result,r.encodePacket(t,e,!0,n)},o.readAsArrayBuffer(t.data)}function s(t,e,n){if(!e)return r.encodeBase64Packet(t,n);if(m)return i(t,e,n);var o=new Uint8Array(1);return o[0]=g[t.type],n(new w([o.buffer,t.data]))}function a(t,e,r){for(var n=new Array(t.length),o=f(t.length,r),i=function(t,r,o){e(r,function(e,r){n[t]=r,o(e,n)})},s=0;s<t.length;s++)i(s,t[s],o)}var c=t("./keys"),p=t("has-binary"),u=t("arraybuffer.slice"),h=t("base64-arraybuffer"),f=t("after"),l=t("utf8"),d=navigator.userAgent.match(/Android/i),y=/PhantomJS/i.test(navigator.userAgent),m=d||y;r.protocol=3;var g=r.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},v=c(g),b={type:"error",data:"parser error"},w=t("blob");r.encodePacket=function(t,r,i,a){"function"==typeof r&&(a=r,r=!1),"function"==typeof i&&(a=i,i=null);var c=void 0===t.data?void 0:t.data.buffer||t.data;if(e.ArrayBuffer&&c instanceof ArrayBuffer)return o(t,r,a);if(w&&c instanceof e.Blob)return s(t,r,a);if(c&&c.base64)return n(t,a);var p=g[t.type];return void 0!==t.data&&(p+=i?l.encode(String(t.data)):String(t.data)),a(""+p)},r.encodeBase64Packet=function(t,n){var o="b"+r.packets[t.type];if(w&&t.data instanceof w){var i=new FileReader;return i.onload=function(){var t=i.result.split(",")[1];n(o+t)},i.readAsDataURL(t.data)}var s;try{s=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(e){for(var a=new Uint8Array(t.data),c=new Array(a.length),p=0;p<a.length;p++)c[p]=a[p];s=String.fromCharCode.apply(null,c)}return o+=e.btoa(s),n(o)},r.decodePacket=function(t,e,n){if("string"==typeof t||void 0===t){if("b"==t.charAt(0))return r.decodeBase64Packet(t.substr(1),e);if(n)try{t=l.decode(t)}catch(t){return b}var o=t.charAt(0);return Number(o)==o&&v[o]?t.length>1?{type:v[o],data:t.substring(1)}:{type:v[o]}:b}var i=new Uint8Array(t),o=i[0],s=u(t,1);return w&&"blob"===e&&(s=new w([s])),{type:v[o],data:s}},r.decodeBase64Packet=function(t,r){var n=v[t.charAt(0)];if(!e.ArrayBuffer)return{type:n,data:{base64:!0,data:t.substr(1)}};var o=h.decode(t.substr(1));return"blob"===r&&w&&(o=new w([o])),{type:n,data:o}},r.encodePayload=function(t,e,n){function o(t){return t.length+":"+t}function i(t,n){r.encodePacket(t,!!s&&e,!0,function(t){n(null,o(t))})}"function"==typeof e&&(n=e,e=null);var s=p(t);return e&&s?w&&!m?r.encodePayloadAsBlob(t,n):r.encodePayloadAsArrayBuffer(t,n):t.length?void a(t,i,function(t,e){return n(e.join(""))}):n("0:")},r.decodePayload=function(t,e,n){if("string"!=typeof t)return r.decodePayloadAsBinary(t,e,n);"function"==typeof e&&(n=e,e=null);var o;if(""==t)return n(b,0,1);for(var i,s,a="",c=0,p=t.length;c<p;c++){var u=t.charAt(c);if(":"!=u)a+=u;else{if(""==a||a!=(i=Number(a)))return n(b,0,1);if(s=t.substr(c+1,i),a!=s.length)return n(b,0,1);if(s.length){if(o=r.decodePacket(s,e,!0),b.type==o.type&&b.data==o.data)return n(b,0,1);if(!1===n(o,c+i,p))return}c+=i,a=""}}return""!=a?n(b,0,1):void 0},r.encodePayloadAsArrayBuffer=function(t,e){function n(t,e){r.encodePacket(t,!0,!0,function(t){return e(null,t)})}if(!t.length)return e(new ArrayBuffer(0));a(t,n,function(t,r){var n=r.reduce(function(t,e){var r;return r="string"==typeof e?e.length:e.byteLength,t+r.toString().length+r+2},0),o=new Uint8Array(n),i=0;return r.forEach(function(t){var e="string"==typeof t,r=t;if(e){for(var n=new Uint8Array(t.length),s=0;s<t.length;s++)n[s]=t.charCodeAt(s);r=n.buffer}o[i++]=e?0:1;for(var a=r.byteLength.toString(),s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(var n=new Uint8Array(r),s=0;s<n.length;s++)o[i++]=n[s]}),e(o.buffer)})},r.encodePayloadAsBlob=function(t,e){function n(t,e){r.encodePacket(t,!0,!0,function(t){var r=new Uint8Array(1);if(r[0]=1,"string"==typeof t){for(var n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);t=n.buffer,r[0]=0}for(var i=t instanceof ArrayBuffer?t.byteLength:t.size,s=i.toString(),a=new Uint8Array(s.length+1),o=0;o<s.length;o++)a[o]=parseInt(s[o]);if(a[s.length]=255,w){var c=new w([r.buffer,a.buffer,t]);e(null,c)}})}a(t,n,function(t,r){return e(new w(r))})},r.decodePayloadAsBinary=function(t,e,n){"function"==typeof e&&(n=e,e=null);for(var o=t,i=[],s=!1;o.byteLength>0;){for(var a=new Uint8Array(o),c=0===a[0],p="",h=1;255!=a[h];h++){if(p.length>310){s=!0;break}p+=a[h]}if(s)return n(b,0,1);o=u(o,2+p.length),p=parseInt(p);var f=u(o,0,p);if(c)try{f=String.fromCharCode.apply(null,new Uint8Array(f))}catch(t){var l=new Uint8Array(f);f="";for(var h=0;h<l.length;h++)f+=String.fromCharCode(l[h])}i.push(f),o=u(o,p)}var d=i.length;i.forEach(function(t,o){n(r.decodePacket(t,e,!0),o,d)})}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./keys":18,after:19,"arraybuffer.slice":20,"base64-arraybuffer":21,blob:11,"has-binary":22,utf8:24}],18:[function(t,e,r){e.exports=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e}},{}],19:[function(t,e,r){function n(t,e,r){function n(t,o){if(n.count<=0)throw new Error("after called too many times");--n.count,t?(i=!0,e(t),e=r):0!==n.count||i||e(null,o)}var i=!1;return r=r||o,n.count=t,0===t?e():n}function o(){}e.exports=n},{}],20:[function(t,e,r){e.exports=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||0===n)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(r-e),s=e,a=0;s<r;s++,a++)i[a]=o[s];return i.buffer}},{}],21:[function(t,e,r){!function(t){"use strict";r.encode=function(e){var r,n=new Uint8Array(e),o=n.length,i="";for(r=0;r<o;r+=3)i+=t[n[r]>>2],i+=t[(3&n[r])<<4|n[r+1]>>4],i+=t[(15&n[r+1])<<2|n[r+2]>>6],i+=t[63&n[r+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},r.decode=function(e){var r,n,o,i,s,a=.75*e.length,c=e.length,p=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var u=new ArrayBuffer(a),h=new Uint8Array(u);for(r=0;r<c;r+=4)n=t.indexOf(e[r]),o=t.indexOf(e[r+1]),i=t.indexOf(e[r+2]),s=t.indexOf(e[r+3]),h[p++]=n<<2|o>>4,h[p++]=(15&o)<<4|i>>2,h[p++]=(3&i)<<6|63&s;return u}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],22:[function(t,e,r){(function(r){function n(t){function e(t){if(!t)return!1;if(r.Buffer&&r.Buffer.isBuffer(t)||r.ArrayBuffer&&t instanceof ArrayBuffer||r.Blob&&t instanceof Blob||r.File&&t instanceof File)return!0;if(o(t)){for(var n=0;n<t.length;n++)if(e(t[n]))return!0}else if(t&&"object"==typeof t){t.toJSON&&(t=t.toJSON());for(var i in t)if(t.hasOwnProperty(i)&&e(t[i]))return!0}return!1}return e(t)}var o=t("isarray");e.exports=n}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{isarray:23}],23:[function(t,e,r){e.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},{}],24:[function(e,r,n){(function(e){!function(o){function i(t){for(var e,r,n=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function s(t){for(var e,r=t.length,n=-1,o="";++n<r;)e=t[n],e>65535&&(e-=65536,o+=b(e>>>10&1023|55296),e=56320|1023&e),o+=b(e);return o}function a(t,e){return b(t>>e&63|128)}function c(t){if(0==(4294967168&t))return b(t);var e="";return 0==(4294965248&t)?e=b(t>>6&31|192):0==(4294901760&t)?(e=b(t>>12&15|224),e+=a(t,6)):0==(4292870144&t)&&(e=b(t>>18&7|240),e+=a(t,12),e+=a(t,6)),e+=b(63&t|128)}function p(t){for(var e,r=i(t),n=r.length,o=-1,s="";++o<n;)e=r[o],s+=c(e);return s}function u(){if(v>=g)throw Error("Invalid byte index");var t=255&m[v];if(v++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function h(){var t,e,r,n,o;if(v>g)throw Error("Invalid byte index");if(v==g)return!1;if(t=255&m[v],v++,0==(128&t))return t;if(192==(224&t)){var e=u();if((o=(31&t)<<6|e)>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&t)){if(e=u(),r=u(),(o=(15&t)<<12|e<<6|r)>=2048)return o;throw Error("Invalid continuation byte")}if(240==(248&t)&&(e=u(),r=u(),n=u(),(o=(15&t)<<18|e<<12|r<<6|n)>=65536&&o<=1114111))return o;throw Error("Invalid UTF-8 detected")}function f(t){m=i(t),g=m.length,v=0;for(var e,r=[];!1!==(e=h());)r.push(e);return s(r)}var l="object"==typeof n&&n,d="object"==typeof r&&r&&r.exports==l&&r,y="object"==typeof e&&e;y.global!==y&&y.window!==y||(o=y);var m,g,v,b=String.fromCharCode,w={version:"2.0.0",encode:p,decode:f};if("function"==typeof t&&"object"==typeof t.amd&&t.amd)t(function(){return w});else if(l&&!l.nodeType)if(d)d.exports=w;else{var k={},x=k.hasOwnProperty;for(var _ in w)x.call(w,_)&&(l[_]=w[_])}else o.utf8=w}(this)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],25:[function(t,e,r){var n=t("global");try{e.exports="XMLHttpRequest"in n&&"withCredentials"in new n.XMLHttpRequest}catch(t){e.exports=!1}},{global:26}],26:[function(t,e,r){e.exports=function(){return this}()},{}],27:[function(t,e,r){var n=[].indexOf;e.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}},{}],28:[function(t,e,r){(function(t){var r=/^[\],:{}\s]*$/,n=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,o=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,i=/(?:^|:|,)(?:\s*\[)+/g,s=/^\s+/,a=/\s+$/;e.exports=function(e){return"string"==typeof e&&e?(e=e.replace(s,"").replace(a,""),t.JSON&&JSON.parse?JSON.parse(e):r.test(e.replace(n,"@").replace(o,"]").replace(i,""))?new Function("return "+e)():void 0):null}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],29:[function(t,e,r){r.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},r.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},{}],30:[function(t,e,r){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,o=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(t){var e=t,r=t.indexOf("["),i=t.indexOf("]");-1!=r&&-1!=i&&(t=t.substring(0,r)+t.substring(r,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=n.exec(t||""),a={},c=14;c--;)a[o[c]]=s[c]||"";return-1!=r&&-1!=i&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},{}],31:[function(t,e,r){function n(t,e,r){return e?new i(t,e):new i(t)}var o=function(){return this}(),i=o.WebSocket||o.MozWebSocket;e.exports=i?n:null,i&&(n.prototype=i.prototype)},{}]},{},[1])(1)});var EngineioTools={ReconnectingSocket:function(t,e){function r(){c=!0,p=!1,m=!1,d=0,h=0,clearTimeout(y)}function n(){c=!1,m||p||s()}function o(){p&&s()}function i(){m=!0,a.call(g)}function s(){if(d>=l)return void g.emit("reconnecting_failed");var t=f?2*(h||u/2):u*d;p=!0,y=setTimeout(function(){g.open()},t),h=t,g.emit("reconnecting",{attempt:d+1,max_attempts:l,delay:t}),d++}var a,c=!1,p=!1,u=4e3,h=0,f=!0,l=5,d=0,y=null,m=!1,g=eio.apply(eio,arguments);return g.on("open",r),g.on("close",n),g.on("error",o),a=g.close,g.close=i,e&&("number"==typeof e.reconnect_delay&&(u=e.reconnect_delay),"number"==typeof e.reconnect_max_attempts&&(l=e.reconnect_max_attempts),void 0!==e.reconnect_delay_exponential&&(f=!!e.reconnect_delay_exponential)),g},Rpc:function(){function t(t){var r=new e(t),n=function(){return n.makeCall.apply(n,arguments)};for(var o in r)n[o]=r[o];return n._mixinEmitter(),n._bindSocketListeners(),n._rpc=n,n}function e(t){this._next_id=0,this._rpc_callbacks={},this._socket=t,this._rpc=this,this._namespace="",this._namespaces=[]}return e.prototype._bindSocketListeners=function(){var t=this;this._onMessageProxy=function(){t._onMessage.apply(t,arguments)},this._socket.on("message",this._onMessageProxy)},e.prototype.dispose=function(){this._onMessageProxy&&(this._socket.removeListener("message",this._onMessageProxy),delete this._onMessageProxy);for(var t in this._namespaces)this._namespaces[t].dispose();this.removeAllListeners()},e.prototype.namespace=function(t){var e,r;return e=this._namespace?this._namespace+"."+t:t,r=new this._rpc.Namespace(this._rpc,e),this._rpc._namespaces.push(r),r},e.prototype._findRelevantNamespaces=function(t){var e=[];for(var r in this._namespaces)this._namespaces[r]._namespace===t&&e.push(this._namespaces[r]),0===this._namespaces[r]._namespace.indexOf(t+".")&&e.push(this._namespaces[r]);return e},e.prototype._mixinEmitter=function(t){var e=["on","once","off","removeListener","removeAllListeners","emit","listeners","hasListeners"];t=t||this;for(var r=0;r<e.length;r++)"function"==typeof this._socket[e[r]]&&(t[e[r]]=this._socket[e[r]])},e.prototype._isCall=function(t){return void 0!==t.method&&void 0!==t.params},e.prototype._isResponse=function(t){return void 0!==t.id&&void 0!==t.response},e.prototype.makeCall=function(t){var e,r,n;e=Array.prototype.slice.call(arguments,1,arguments.length),"function"==typeof e[e.length-1]&&(r=e[e.length-1],e=e.slice(0,e.length-1)),n={method:t,params:e},"function"==typeof r&&(n.id=this._next_id,this._next_id++,this._rpc_callbacks[n.id]=r),this.send(n)},e.prototype.send=function(t){this._socket&&this._socket.send(JSON.stringify(t))},e.prototype._onMessage=function(t){var e,r,n,o,i,s;try{if(!(e=JSON.parse(t)))throw"Corrupt packet"}catch(t){return}if(this._isResponse(e)){if("function"!=typeof this._rpc_callbacks[e.id])return;n=this._rpc_callbacks[e.id],delete this._rpc_callbacks[e.id],n.apply(this,e.response)}else if(this._isCall(e)&&(r=void 0!==e.id?this._createReturnCallFn(e.id):this._noop,this.emit.apply(this,["all",e.method,r].concat(e.params)),this.emit.apply(this,[e.method,r].concat(e.params)),e.method.indexOf(".")>0)){o=e.method.substring(0,e.method.lastIndexOf(".")),i=this._findRelevantNamespaces(o);for(s in i)e.method=e.method.replace(i[s]._namespace+".",""),i[s].emit.apply(i[s],[e.method,r].concat(e.params))}},e.prototype._createReturnCallFn=function(t){var e=this;return function(){var r=Array.prototype.slice.call(arguments,0),n={id:t,response:r};e.send(n)}},e.prototype._noop=function(){},e.prototype.Namespace=function(t,e){var r=function(){if(void 0!==arguments[0])return arguments[0]=r._namespace+"."+arguments[0],r._rpc.apply(r._rpc,arguments)};return r._rpc=t,r._namespace=e,r.dispose=function(){r.removeAllListeners(),r._rpc=null},t._mixinEmitter(r),r},t}()};