diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e6434b0f..64c042a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +# [4.0.0](https://github.com/socketio/engine.io-client/compare/v4.0.0-alpha.1...4.0.0) (2020-09-10) + +More details about this release in the blog post: https://socket.io/blog/engine-io-4-release/ + +### Bug Fixes + +* **react-native:** restrict the list of options for the WebSocket object ([2f5c948](https://github.com/socketio/engine.io-client/commit/2f5c948abe8fd1c0fdb010e88f96bd933a3792ea)) +* use globalThis polyfill instead of self/global ([#634](https://github.com/socketio/engine.io-client/issues/634)) ([3f3a6f9](https://github.com/socketio/engine.io-client/commit/3f3a6f991404ef601252193382d2d2029cff6c45)) + + +### Features + +* strip debug from the browser bundle ([f7ba966](https://github.com/socketio/engine.io-client/commit/f7ba966e53f4609f755880be8fa504f7252b0817)) + +#### Links + +- Diff: [v4.0.0-alpha.1...4.0.0](https://github.com/socketio/engine.io-client/compare/v4.0.0-alpha.1...4.0.0) +- Full diff: [3.4.0...4.0.0](https://github.com/socketio/engine.io-client/compare/3.4.0...4.0.0) +- Server release: [4.0.0](https://github.com/socketio/engine.io/releases/tag/4.0.0) +- ws version: [~7.2.1](https://github.com/websockets/ws/releases/tag/7.2.1) + + ## [3.4.1](https://github.com/socketio/engine.io-client/compare/3.4.0...3.4.1) (2020-04-17) diff --git a/dist/engine.io.js b/dist/engine.io.js index 5fec3a957..0f82f47ad 100644 --- a/dist/engine.io.js +++ b/dist/engine.io.js @@ -1,8 +1,402 @@ /*! - * Engine.IO v4.0.0-alpha.1 + * Engine.IO v4.0.0 * (c) 2014-2020 Guillermo Rauch * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.eio=e():t.eio=e()}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")(),(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=10)}([function(t,e,r){var n,o=r(14),i=r(16),s=r(17),a=r(18);"undefined"!=typeof ArrayBuffer&&(n=r(19));var u="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),c="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),f=u||c;e.protocol=4;var p=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},l=Object.keys(p),h={type:"error",data:"parser error"},d=r(20);function y(t,e,r){for(var n=new Array(t.length),o=s(t.length,r),i=function(t,r,o){e(r,(function(e,r){n[t]=r,o(e,n)}))},a=0;a1?{type:l[o],data:t.substring(1)}:{type:l[o]}:h}return{type:"message",data:d&&"blob"===r?new d([t]):t}},e.decodeBase64Packet=function(t,e){var r=l[t.charAt(0)];if(!n)return{type:r,data:{base64:!0,data:t.substr(1)}};var o=n.decode(t.substr(1));return"blob"===e&&d&&(o=new d([o])),{type:r,data:o}},e.encodePayload=function(t,r,n){"function"==typeof r&&(n=r,r=null);var i=o(t);if(r&&i)return d&&!f?e.encodePayloadAsBlob(t,n):e.encodePayloadAsArrayBuffer(t,n);if(!t.length)return n("0:");y(t,(function(t,n){e.encodePacket(t,!!i&&r,!1,(function(t){n(null,function(t){return t.length+":"+t}(t))}))}),(function(t,e){return n(e.join(""))}))},e.decodePayload=function(t,r,n){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,n);var o;if("function"==typeof r&&(n=r,r=null),""===t)return n(h,0,1);for(var i,s,a="",u=0,c=t.length;u0;){for(var a=new Uint8Array(o),u=0===a[0],c="",f=1;255!==a[f];f++){if(c.length>310)return n(h,0,1);c+=a[f]}o=i(o,2+c.length),c=parseInt(c);var p=i(o,0,c);if(u)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(t){var l=new Uint8Array(p);p="";for(var d=0;d=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=r(22)(e),t.exports.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,r(21))},function(t,e,r){var n=r(12);t.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(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r0);return e}function c(){var t=u(+new Date);return t!==n?(s=0,n=t):t+"."+u(s++)}for(;a<64;a++)i[o[a]]=a;c.encode=u,c.decode=function(t){var e=0;for(a=0;a1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return i(this,e),r=a(this,u(e).call(this)),t&&"object"===o(t)&&(s=t,t=null),t?(t=y(t),s.hostname=t.host,s.secure="https"===t.protocol||"wss"===t.protocol,s.port=t.port,t.query&&(s.query=t.query)):s.host&&(s.hostname=y(s.host).host),r.secure=null!=s.secure?s.secure:"undefined"!=typeof location&&"https:"===location.protocol,s.hostname&&!s.port&&(s.port=r.secure?"443":"80"),r.hostname=s.hostname||("undefined"!=typeof location?location.hostname:"localhost"),r.port=s.port||("undefined"!=typeof location&&location.port?location.port:r.secure?443:80),r.transports=s.transports||["polling","websocket"],r.readyState="",r.writeBuffer=[],r.prevBufferLen=0,r.opts=n({path:"/engine.io",agent:!1,upgrade:!0,jsonp:!0,timestampParam:"t",policyPort:843,rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{}},s),r.opts.path=r.opts.path.replace(/\/$/,"")+"/","string"==typeof r.opts.query&&(r.opts.query=m.decode(r.opts.query)),r.opts.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),r.id=null,r.upgrades=null,r.pingInterval=null,r.pingTimeout=null,r.pingTimeoutTimer=null,r.open(),r}var r,p,b;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,t),r=e,(p=[{key:"createTransport",value:function(t){l('creating transport "%s"',t);var e=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}(this.opts.query);e.EIO=d.protocol,e.transport=t,this.id&&(e.sid=this.id);var r=n({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return l("options: %j",r),new f[t](r)}},{key:"open",value:function(){var t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var r=this;return void setTimeout((function(){r.emit("error","No transports available")}),0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return l("error while creating transport: %s",t),this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){l("setting transport %s",t.name);var e=this;this.transport&&(l("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")}))}},{key:"probe",value:function(t){l('probing transport "%s"',t);var r=this.createTransport(t,{probe:1}),n=!1,o=this;function i(){if(o.onlyBinaryUpgrades){var i=!this.supportsBinary&&o.transport.supportsBinary;n=n||i}n||(l('probe transport "%s" opened',t),r.send([{type:"ping",data:"probe"}]),r.once("packet",(function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(l('probe transport "%s" pong',t),o.upgrading=!0,o.emit("upgrading",r),!r)return;e.priorWebsocketSuccess="websocket"===r.name,l('pausing current transport "%s"',o.transport.name),o.transport.pause((function(){n||"closed"!==o.readyState&&(l("changing transport and sending upgrade packet"),p(),o.setTransport(r),r.send([{type:"upgrade"}]),o.emit("upgrade",r),r=null,o.upgrading=!1,o.flush())}))}else{l('probe transport "%s" failed',t);var s=new Error("probe error");s.transport=r.name,o.emit("upgradeError",s)}})))}function s(){n||(n=!0,p(),r.close(),r=null)}function a(e){var n=new Error("probe error: "+e);n.transport=r.name,s(),l('probe transport "%s" failed because of error: %s',t,e),o.emit("upgradeError",n)}function u(){a("transport closed")}function c(){a("socket closed")}function f(t){r&&t.name!==r.name&&(l('"%s" works - aborting "%s"',t.name,r.name),s())}function p(){r.removeListener("open",i),r.removeListener("error",a),r.removeListener("close",u),o.removeListener("close",c),o.removeListener("upgrading",f)}e.priorWebsocketSuccess=!1,r.once("open",i),r.once("error",a),r.once("close",u),this.once("close",c),this.once("upgrading",f),r.open()}},{key:"onOpen",value:function(){if(l("socket open"),this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause){l("starting upgrade probes");for(var t=0,r=this.upgrades.length;t0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{supportsBinary:this.supportsBinary,xd:this.xd,xs:this.xs},this.opts),new w(this.uri(),t)}},{key:"doWrite",value: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)}))}},{key:"doPoll",value:function(){m("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}}]),e}(h),w=function(t){function e(t,r){var n;return i(this,e),(n=u(this,c(e).call(this))).opts=r,n.method=r.method||"GET",n.uri=t,n.async=!1!==r.async,n.data=void 0!==r.data?r.data:null,n.isBinary=r.isBinary,n.supportsBinary=r.supportsBinary,n.create(),n}return f(e,t),a(e,[{key:"create",value:function(){var t=y(this.opts,"agent","enablesXDR","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;var r=this.xhr=new l(t),n=this;try{m("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var o in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.opts.extraHeaders[o])}catch(t){console.log(t)}if("POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),this.hasXDR()?(r.onload=function(){n.onLoad()},r.onerror=function(){n.onError(r.responseText)}):r.onreadystatechange=function(){if(2===r.readyState)try{var t=r.getResponseHeader("Content-Type");(n.supportsBinary&&"application/octet-stream"===t||"application/octet-stream; charset=UTF-8"===t)&&(r.responseType="arraybuffer")}catch(t){}4===r.readyState&&(200===r.status||1223===r.status?n.onLoad():setTimeout((function(){n.onError("number"==typeof r.status?r.status:0)}),0))},m("xhr data %s",this.data),r.send(this.data)}catch(t){return void setTimeout((function(){n.onError(t)}),0)}"undefined"!=typeof document&&(this.index=e.requestsCount++,e.requests[this.index]=this)}},{key:"onSuccess",value:function(){this.emit("success"),this.cleanup()}},{key:"onData",value:function(t){this.emit("data",t),this.onSuccess()}},{key:"onError",value:function(t){this.emit("error",t),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=b:this.xhr.onreadystatechange=b,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete e.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t=("application/octet-stream"===e||"application/octet-stream; charset=UTF-8"===e)&&this.xhr.response||this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)}},{key:"hasXDR",value:function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR}},{key:"abort",value:function(){this.cleanup()}}]),e}(d);if(w.requestsCount=0,w.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",k);else if("function"==typeof addEventListener){var C="onpagehide"in self?"pagehide":"unload";addEventListener(C,k,!1)}function k(){for(var t in w.requests)w.requests.hasOwnProperty(t)&&w.requests[t].abort()}t.exports=v,t.exports.Request=w},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(15),i=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);t.exports=function t(e){if(!e||"object"!==n(e))return!1;if(o(e)){for(var r=0,i=e.length;rn&&(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=55296&&e<=56319&&o=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function u(t,e){return i(t>>e&63|128)}function c(t,e){if(0==(4294967168&t))return i(t);var r="";return 0==(4294965248&t)?r=i(t>>6&31|192):0==(4294901760&t)?(a(t,e)||(t=65533),r=i(t>>12&15|224),r+=u(t,6)):0==(4292870144&t)&&(r=i(t>>18&7|240),r+=u(t,12),r+=u(t,6)),r+=i(63&t|128)}function f(){if(o>=n)throw Error("Invalid byte index");var t=255&r[o];if(o++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function p(t){var e,i;if(o>n)throw Error("Invalid byte index");if(o==n)return!1;if(e=255&r[o],o++,0==(128&e))return e;if(192==(224&e)){if((i=(31&e)<<6|f())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if((i=(15&e)<<12|f()<<6|f())>=2048)return a(i,t)?i:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(i=(7&e)<<18|f()<<12|f()<<6|f())>=65536&&i<=1114111)return i;throw Error("Invalid UTF-8 detected")}t.exports={version:"2.1.2",encode:function(t,e){for(var r=!1!==(e=e||{}).strict,n=s(t),o=n.length,i=-1,a="";++i65535&&(o+=i((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=i(e);return o}(c)}}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n>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},e.decode=function(t){var e,n,o,i,s,a=.75*t.length,u=t.length,c=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var f=new ArrayBuffer(a),p=new Uint8Array(f);for(e=0;e>4,p[c++]=(15&o)<<4|i>>2,p[c++]=(3&i)<<6|63&s;return f}}()},function(t,e){var r=void 0!==r?r:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,n=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),o=n&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),i=r&&r.prototype.append&&r.prototype.getBlob;function s(t){return t.map((function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var r=new Uint8Array(t.byteLength);r.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=r.buffer}return e}return t}))}function a(t,e){e=e||{};var n=new r;return s(t).forEach((function(t){n.append(t)})),e.type?n.getBlob(e.type):n.getBlob()}function u(t,e){return new Blob(s(t),e||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,u.prototype=Blob.prototype),t.exports=n?o?Blob:u:i?a:void 0},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,c=[],f=!1,p=-1;function l(){f&&u&&(f=!1,u.length?c=u.concat(c):p=-1,c.length&&h())}function h(){if(!f){var t=a(l);f=!0;for(var e=c.length;e;){for(u=c,c=[];++p1)for(var r=1;r=1.5*r;return Math.round(t/r)+" "+n+(o?"s":"")}t.exports=function(t,e){e=e||{};var u=r(t);if("string"===u&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*i;case"minutes":case"minute":case"mins":case"min":case"m":return r*o;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;default:return}}(t);if("number"===u&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=s)return a(t,e,s,"day");if(e>=i)return a(t,e,i,"hour");if(e>=o)return a(t,e,o,"minute");if(e>=n)return a(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=s)return Math.round(t/s)+"d";if(e>=i)return Math.round(t/i)+"h";if(e>=o)return Math.round(t/o)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,r){(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r';r=document.createElement(t)}catch(t){(r=document.createElement("iframe")).name=n.iframeId,r.src="javascript:0"}r.id=n.iframeId,n.form.appendChild(r),n.iframe=r}this.form.action=this.uri(),u(),t=t.replace(l,"\\\n"),this.area.value=t.replace(p,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&a()}:this.iframe.onload=a}},{key:"supportsBinary",get:function(){return!1}}])&&o(f.prototype,d),y&&o(f,y),r}(f);t.exports=d}).call(this,r(25))},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(n=window)}t.exports=n},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r { + if (typeof self !== 'undefined') { + return self; + } else if (typeof window !== 'undefined') { + return window; + } else if (typeof global !== 'undefined') { + return global; + } else { + return Function('return this')(); + } + })(), function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./lib/index.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./lib/globalThis.browser.js": +/*!***********************************!*\ + !*** ./lib/globalThis.browser.js ***! + \***********************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +eval("module.exports = function () {\n if (typeof self !== \"undefined\") {\n return self;\n } else if (typeof window !== \"undefined\") {\n return window;\n } else {\n return Function(\"return this\")();\n }\n}();\n\n//# sourceURL=webpack://eio/./lib/globalThis.browser.js?"); + +/***/ }), + +/***/ "./lib/index.js": +/*!**********************!*\ + !*** ./lib/index.js ***! + \**********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("var Socket = __webpack_require__(/*! ./socket */ \"./lib/socket.js\");\n\nmodule.exports = function (uri, opts) {\n return new Socket(uri, opts);\n};\n/**\n * Expose deps for legacy compatibility\n * and standalone browser access.\n */\n\n\nmodule.exports.Socket = Socket;\nmodule.exports.protocol = Socket.protocol; // this is an int\n\nmodule.exports.Transport = __webpack_require__(/*! ./transport */ \"./lib/transport.js\");\nmodule.exports.transports = __webpack_require__(/*! ./transports/index */ \"./lib/transports/index.js\");\nmodule.exports.parser = __webpack_require__(/*! engine.io-parser */ \"./node_modules/engine.io-parser/lib/index.js\");\n\n//# sourceURL=webpack://eio/./lib/index.js?"); + +/***/ }), + +/***/ "./lib/socket.js": +/*!***********************!*\ + !*** ./lib/socket.js ***! + \***********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar transports = __webpack_require__(/*! ./transports/index */ \"./lib/transports/index.js\");\n\nvar Emitter = __webpack_require__(/*! component-emitter */ \"./node_modules/component-emitter/index.js\");\n\nvar debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")(\"engine.io-client:socket\");\n\nvar parser = __webpack_require__(/*! engine.io-parser */ \"./node_modules/engine.io-parser/lib/index.js\");\n\nvar parseuri = __webpack_require__(/*! parseuri */ \"./node_modules/parseuri/index.js\");\n\nvar parseqs = __webpack_require__(/*! parseqs */ \"./node_modules/parseqs/index.js\");\n\nvar Socket =\n/*#__PURE__*/\nfunction (_Emitter) {\n _inherits(Socket, _Emitter);\n\n /**\n * Socket constructor.\n *\n * @param {String|Object} uri or options\n * @param {Object} options\n * @api public\n */\n function Socket(uri) {\n var _this;\n\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Socket);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(Socket).call(this));\n\n if (uri && \"object\" === _typeof(uri)) {\n opts = uri;\n uri = null;\n }\n\n if (uri) {\n uri = parseuri(uri);\n opts.hostname = uri.host;\n opts.secure = uri.protocol === \"https\" || uri.protocol === \"wss\";\n opts.port = uri.port;\n if (uri.query) opts.query = uri.query;\n } else if (opts.host) {\n opts.hostname = parseuri(opts.host).host;\n }\n\n _this.secure = null != opts.secure ? opts.secure : typeof location !== \"undefined\" && \"https:\" === location.protocol;\n\n if (opts.hostname && !opts.port) {\n // if no port is specified manually, use the protocol default\n opts.port = _this.secure ? \"443\" : \"80\";\n }\n\n _this.hostname = opts.hostname || (typeof location !== \"undefined\" ? location.hostname : \"localhost\");\n _this.port = opts.port || (typeof location !== \"undefined\" && location.port ? location.port : _this.secure ? 443 : 80);\n _this.transports = opts.transports || [\"polling\", \"websocket\"];\n _this.readyState = \"\";\n _this.writeBuffer = [];\n _this.prevBufferLen = 0;\n _this.opts = _extends({\n path: \"/engine.io\",\n agent: false,\n upgrade: true,\n jsonp: true,\n timestampParam: \"t\",\n policyPort: 843,\n rememberUpgrade: false,\n rejectUnauthorized: true,\n perMessageDeflate: {\n threshold: 1024\n },\n transportOptions: {}\n }, opts);\n _this.opts.path = _this.opts.path.replace(/\\/$/, \"\") + \"/\";\n\n if (typeof _this.opts.query === \"string\") {\n _this.opts.query = parseqs.decode(_this.opts.query);\n } // set on handshake\n\n\n _this.id = null;\n _this.upgrades = null;\n _this.pingInterval = null;\n _this.pingTimeout = null; // set on heartbeat\n\n _this.pingTimeoutTimer = null;\n\n _this.open();\n\n return _this;\n }\n /**\n * Creates transport of the given type.\n *\n * @param {String} transport name\n * @return {Transport}\n * @api private\n */\n\n\n _createClass(Socket, [{\n key: \"createTransport\",\n value: function createTransport(name) {\n debug('creating transport \"%s\"', name);\n var query = clone(this.opts.query); // append engine.io protocol identifier\n\n query.EIO = parser.protocol; // transport name\n\n query.transport = name; // session id if we already have one\n\n if (this.id) query.sid = this.id;\n\n var opts = _extends({}, this.opts.transportOptions[name], this.opts, {\n query: query,\n socket: this,\n hostname: this.hostname,\n secure: this.secure,\n port: this.port\n });\n\n debug(\"options: %j\", opts);\n return new transports[name](opts);\n }\n /**\n * Initializes transport to use and starts probe.\n *\n * @api private\n */\n\n }, {\n key: \"open\",\n value: function open() {\n var transport;\n\n if (this.opts.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf(\"websocket\") !== -1) {\n transport = \"websocket\";\n } else if (0 === this.transports.length) {\n // Emit error on next tick so it can be listened to\n var self = this;\n setTimeout(function () {\n self.emit(\"error\", \"No transports available\");\n }, 0);\n return;\n } else {\n transport = this.transports[0];\n }\n\n this.readyState = \"opening\"; // Retry with the next transport if the transport is disabled (jsonp: false)\n\n try {\n transport = this.createTransport(transport);\n } catch (e) {\n debug(\"error while creating transport: %s\", e);\n this.transports.shift();\n this.open();\n return;\n }\n\n transport.open();\n this.setTransport(transport);\n }\n /**\n * Sets the current transport. Disables the existing one (if any).\n *\n * @api private\n */\n\n }, {\n key: \"setTransport\",\n value: function setTransport(transport) {\n debug(\"setting transport %s\", transport.name);\n var self = this;\n\n if (this.transport) {\n debug(\"clearing existing transport %s\", this.transport.name);\n this.transport.removeAllListeners();\n } // set up transport\n\n\n this.transport = transport; // set up transport listeners\n\n transport.on(\"drain\", function () {\n self.onDrain();\n }).on(\"packet\", function (packet) {\n self.onPacket(packet);\n }).on(\"error\", function (e) {\n self.onError(e);\n }).on(\"close\", function () {\n self.onClose(\"transport close\");\n });\n }\n /**\n * Probes a transport.\n *\n * @param {String} transport name\n * @api private\n */\n\n }, {\n key: \"probe\",\n value: function probe(name) {\n debug('probing transport \"%s\"', name);\n var transport = this.createTransport(name, {\n probe: 1\n });\n var failed = false;\n var self = this;\n Socket.priorWebsocketSuccess = false;\n\n function onTransportOpen() {\n if (self.onlyBinaryUpgrades) {\n var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n failed = failed || upgradeLosesBinary;\n }\n\n if (failed) return;\n debug('probe transport \"%s\" opened', name);\n transport.send([{\n type: \"ping\",\n data: \"probe\"\n }]);\n transport.once(\"packet\", function (msg) {\n if (failed) return;\n\n if (\"pong\" === msg.type && \"probe\" === msg.data) {\n debug('probe transport \"%s\" pong', name);\n self.upgrading = true;\n self.emit(\"upgrading\", transport);\n if (!transport) return;\n Socket.priorWebsocketSuccess = \"websocket\" === transport.name;\n debug('pausing current transport \"%s\"', self.transport.name);\n self.transport.pause(function () {\n if (failed) return;\n if (\"closed\" === self.readyState) return;\n debug(\"changing transport and sending upgrade packet\");\n cleanup();\n self.setTransport(transport);\n transport.send([{\n type: \"upgrade\"\n }]);\n self.emit(\"upgrade\", transport);\n transport = null;\n self.upgrading = false;\n self.flush();\n });\n } else {\n debug('probe transport \"%s\" failed', name);\n var err = new Error(\"probe error\");\n err.transport = transport.name;\n self.emit(\"upgradeError\", err);\n }\n });\n }\n\n function freezeTransport() {\n if (failed) return; // Any callback called by transport should be ignored since now\n\n failed = true;\n cleanup();\n transport.close();\n transport = null;\n } // Handle any error that happens while probing\n\n\n function onerror(err) {\n var error = new Error(\"probe error: \" + err);\n error.transport = transport.name;\n freezeTransport();\n debug('probe transport \"%s\" failed because of error: %s', name, err);\n self.emit(\"upgradeError\", error);\n }\n\n function onTransportClose() {\n onerror(\"transport closed\");\n } // When the socket is closed while we're probing\n\n\n function onclose() {\n onerror(\"socket closed\");\n } // When the socket is upgraded while we're probing\n\n\n function onupgrade(to) {\n if (transport && to.name !== transport.name) {\n debug('\"%s\" works - aborting \"%s\"', to.name, transport.name);\n freezeTransport();\n }\n } // Remove all listeners on the transport and on self\n\n\n function cleanup() {\n transport.removeListener(\"open\", onTransportOpen);\n transport.removeListener(\"error\", onerror);\n transport.removeListener(\"close\", onTransportClose);\n self.removeListener(\"close\", onclose);\n self.removeListener(\"upgrading\", onupgrade);\n }\n\n transport.once(\"open\", onTransportOpen);\n transport.once(\"error\", onerror);\n transport.once(\"close\", onTransportClose);\n this.once(\"close\", onclose);\n this.once(\"upgrading\", onupgrade);\n transport.open();\n }\n /**\n * Called when connection is deemed open.\n *\n * @api public\n */\n\n }, {\n key: \"onOpen\",\n value: function onOpen() {\n debug(\"socket open\");\n this.readyState = \"open\";\n Socket.priorWebsocketSuccess = \"websocket\" === this.transport.name;\n this.emit(\"open\");\n this.flush(); // we check for `readyState` in case an `open`\n // listener already closed the socket\n\n if (\"open\" === this.readyState && this.opts.upgrade && this.transport.pause) {\n debug(\"starting upgrade probes\");\n var i = 0;\n var l = this.upgrades.length;\n\n for (; i < l; i++) {\n this.probe(this.upgrades[i]);\n }\n }\n }\n /**\n * Handles a packet.\n *\n * @api private\n */\n\n }, {\n key: \"onPacket\",\n value: function onPacket(packet) {\n if (\"opening\" === this.readyState || \"open\" === this.readyState || \"closing\" === this.readyState) {\n debug('socket receive: type \"%s\", data \"%s\"', packet.type, packet.data);\n this.emit(\"packet\", packet); // Socket is live - any packet counts\n\n this.emit(\"heartbeat\");\n\n switch (packet.type) {\n case \"open\":\n this.onHandshake(JSON.parse(packet.data));\n break;\n\n case \"ping\":\n this.resetPingTimeout();\n this.sendPacket(\"pong\");\n this.emit(\"pong\");\n break;\n\n case \"error\":\n var err = new Error(\"server error\");\n err.code = packet.data;\n this.onError(err);\n break;\n\n case \"message\":\n this.emit(\"data\", packet.data);\n this.emit(\"message\", packet.data);\n break;\n }\n } else {\n debug('packet received with socket readyState \"%s\"', this.readyState);\n }\n }\n /**\n * Called upon handshake completion.\n *\n * @param {Object} handshake obj\n * @api private\n */\n\n }, {\n key: \"onHandshake\",\n value: function onHandshake(data) {\n this.emit(\"handshake\", data);\n this.id = data.sid;\n this.transport.query.sid = data.sid;\n this.upgrades = this.filterUpgrades(data.upgrades);\n this.pingInterval = data.pingInterval;\n this.pingTimeout = data.pingTimeout;\n this.onOpen(); // In case open handler closes socket\n\n if (\"closed\" === this.readyState) return;\n this.resetPingTimeout();\n }\n /**\n * Sets and resets ping timeout timer based on server pings.\n *\n * @api private\n */\n\n }, {\n key: \"resetPingTimeout\",\n value: function resetPingTimeout() {\n var _this2 = this;\n\n clearTimeout(this.pingTimeoutTimer);\n this.pingTimeoutTimer = setTimeout(function () {\n _this2.onClose(\"ping timeout\");\n }, this.pingInterval + this.pingTimeout);\n }\n /**\n * Called on `drain` event\n *\n * @api private\n */\n\n }, {\n key: \"onDrain\",\n value: function onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen); // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit(\"drain\");\n } else {\n this.flush();\n }\n }\n /**\n * Flush write buffers.\n *\n * @api private\n */\n\n }, {\n key: \"flush\",\n value: function flush() {\n if (\"closed\" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) {\n debug(\"flushing %d packets in socket\", this.writeBuffer.length);\n this.transport.send(this.writeBuffer); // keep track of current length of writeBuffer\n // splice writeBuffer and callbackBuffer on `drain`\n\n this.prevBufferLen = this.writeBuffer.length;\n this.emit(\"flush\");\n }\n }\n /**\n * Sends a message.\n *\n * @param {String} message.\n * @param {Function} callback function.\n * @param {Object} options.\n * @return {Socket} for chaining.\n * @api public\n */\n\n }, {\n key: \"write\",\n value: function write(msg, options, fn) {\n this.sendPacket(\"message\", msg, options, fn);\n return this;\n }\n }, {\n key: \"send\",\n value: function send(msg, options, fn) {\n this.sendPacket(\"message\", msg, options, fn);\n return this;\n }\n /**\n * Sends a packet.\n *\n * @param {String} packet type.\n * @param {String} data.\n * @param {Object} options.\n * @param {Function} callback function.\n * @api private\n */\n\n }, {\n key: \"sendPacket\",\n value: function sendPacket(type, data, options, fn) {\n if (\"function\" === typeof data) {\n fn = data;\n data = undefined;\n }\n\n if (\"function\" === typeof options) {\n fn = options;\n options = null;\n }\n\n if (\"closing\" === this.readyState || \"closed\" === this.readyState) {\n return;\n }\n\n options = options || {};\n options.compress = false !== options.compress;\n var packet = {\n type: type,\n data: data,\n options: options\n };\n this.emit(\"packetCreate\", packet);\n this.writeBuffer.push(packet);\n if (fn) this.once(\"flush\", fn);\n this.flush();\n }\n /**\n * Closes the connection.\n *\n * @api private\n */\n\n }, {\n key: \"close\",\n value: function close() {\n var self = this;\n\n if (\"opening\" === this.readyState || \"open\" === this.readyState) {\n this.readyState = \"closing\";\n\n if (this.writeBuffer.length) {\n this.once(\"drain\", function () {\n if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n });\n } else if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n }\n\n function close() {\n self.onClose(\"forced close\");\n debug(\"socket closing - telling transport to close\");\n self.transport.close();\n }\n\n function cleanupAndClose() {\n self.removeListener(\"upgrade\", cleanupAndClose);\n self.removeListener(\"upgradeError\", cleanupAndClose);\n close();\n }\n\n function waitForUpgrade() {\n // wait for upgrade to finish since we can't send packets while pausing a transport\n self.once(\"upgrade\", cleanupAndClose);\n self.once(\"upgradeError\", cleanupAndClose);\n }\n\n return this;\n }\n /**\n * Called upon transport error\n *\n * @api private\n */\n\n }, {\n key: \"onError\",\n value: function onError(err) {\n debug(\"socket error %j\", err);\n Socket.priorWebsocketSuccess = false;\n this.emit(\"error\", err);\n this.onClose(\"transport error\", err);\n }\n /**\n * Called upon transport close.\n *\n * @api private\n */\n\n }, {\n key: \"onClose\",\n value: function onClose(reason, desc) {\n if (\"opening\" === this.readyState || \"open\" === this.readyState || \"closing\" === this.readyState) {\n debug('socket close with reason: \"%s\"', reason);\n var self = this; // clear timers\n\n clearTimeout(this.pingIntervalTimer);\n clearTimeout(this.pingTimeoutTimer); // stop event from firing again for transport\n\n this.transport.removeAllListeners(\"close\"); // ensure transport won't stay open\n\n this.transport.close(); // ignore further transport communication\n\n this.transport.removeAllListeners(); // set ready state\n\n this.readyState = \"closed\"; // clear session id\n\n this.id = null; // emit close event\n\n this.emit(\"close\", reason, desc); // clean buffers after, so users can still\n // grab the buffers on `close` event\n\n self.writeBuffer = [];\n self.prevBufferLen = 0;\n }\n }\n /**\n * Filters upgrades, returning only those matching client transports.\n *\n * @param {Array} server upgrades\n * @api private\n *\n */\n\n }, {\n key: \"filterUpgrades\",\n value: function filterUpgrades(upgrades) {\n var filteredUpgrades = [];\n var i = 0;\n var j = upgrades.length;\n\n for (; i < j; i++) {\n if (~this.transports.indexOf(upgrades[i])) filteredUpgrades.push(upgrades[i]);\n }\n\n return filteredUpgrades;\n }\n }]);\n\n return Socket;\n}(Emitter);\n\nSocket.priorWebsocketSuccess = false;\n/**\n * Protocol version.\n *\n * @api public\n */\n\nSocket.protocol = parser.protocol; // this is an int\n\nfunction clone(obj) {\n var o = {};\n\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n o[i] = obj[i];\n }\n }\n\n return o;\n}\n\nmodule.exports = Socket;\n\n//# sourceURL=webpack://eio/./lib/socket.js?"); + +/***/ }), + +/***/ "./lib/transport.js": +/*!**************************!*\ + !*** ./lib/transport.js ***! + \**************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar parser = __webpack_require__(/*! engine.io-parser */ \"./node_modules/engine.io-parser/lib/index.js\");\n\nvar Emitter = __webpack_require__(/*! component-emitter */ \"./node_modules/component-emitter/index.js\");\n\nvar Transport =\n/*#__PURE__*/\nfunction (_Emitter) {\n _inherits(Transport, _Emitter);\n\n /**\n * Transport abstract constructor.\n *\n * @param {Object} options.\n * @api private\n */\n function Transport(opts) {\n var _this;\n\n _classCallCheck(this, Transport);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(Transport).call(this));\n _this.opts = opts;\n _this.query = opts.query;\n _this.readyState = \"\";\n _this.socket = opts.socket;\n return _this;\n }\n /**\n * Emits an error.\n *\n * @param {String} str\n * @return {Transport} for chaining\n * @api public\n */\n\n\n _createClass(Transport, [{\n key: \"onError\",\n value: function onError(msg, desc) {\n var err = new Error(msg);\n err.type = \"TransportError\";\n err.description = desc;\n this.emit(\"error\", err);\n return this;\n }\n /**\n * Opens the transport.\n *\n * @api public\n */\n\n }, {\n key: \"open\",\n value: function open() {\n if (\"closed\" === this.readyState || \"\" === this.readyState) {\n this.readyState = \"opening\";\n this.doOpen();\n }\n\n return this;\n }\n /**\n * Closes the transport.\n *\n * @api private\n */\n\n }, {\n key: \"close\",\n value: function close() {\n if (\"opening\" === this.readyState || \"open\" === this.readyState) {\n this.doClose();\n this.onClose();\n }\n\n return this;\n }\n /**\n * Sends multiple packets.\n *\n * @param {Array} packets\n * @api private\n */\n\n }, {\n key: \"send\",\n value: function send(packets) {\n if (\"open\" === this.readyState) {\n this.write(packets);\n } else {\n throw new Error(\"Transport not open\");\n }\n }\n /**\n * Called upon open\n *\n * @api private\n */\n\n }, {\n key: \"onOpen\",\n value: function onOpen() {\n this.readyState = \"open\";\n this.writable = true;\n this.emit(\"open\");\n }\n /**\n * Called with data.\n *\n * @param {String} data\n * @api private\n */\n\n }, {\n key: \"onData\",\n value: function onData(data) {\n var packet = parser.decodePacket(data, this.socket.binaryType);\n this.onPacket(packet);\n }\n /**\n * Called with a decoded packet.\n */\n\n }, {\n key: \"onPacket\",\n value: function onPacket(packet) {\n this.emit(\"packet\", packet);\n }\n /**\n * Called upon close.\n *\n * @api private\n */\n\n }, {\n key: \"onClose\",\n value: function onClose() {\n this.readyState = \"closed\";\n this.emit(\"close\");\n }\n }]);\n\n return Transport;\n}(Emitter);\n\nmodule.exports = Transport;\n\n//# sourceURL=webpack://eio/./lib/transport.js?"); + +/***/ }), + +/***/ "./lib/transports/index.js": +/*!*********************************!*\ + !*** ./lib/transports/index.js ***! + \*********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("var XMLHttpRequest = __webpack_require__(/*! xmlhttprequest-ssl */ \"./lib/xmlhttprequest.js\");\n\nvar XHR = __webpack_require__(/*! ./polling-xhr */ \"./lib/transports/polling-xhr.js\");\n\nvar JSONP = __webpack_require__(/*! ./polling-jsonp */ \"./lib/transports/polling-jsonp.js\");\n\nvar websocket = __webpack_require__(/*! ./websocket */ \"./lib/transports/websocket.js\");\n\nexports.polling = polling;\nexports.websocket = websocket;\n/**\n * Polling transport polymorphic constructor.\n * Decides on xhr vs jsonp based on feature detection.\n *\n * @api private\n */\n\nfunction polling(opts) {\n var xhr;\n var xd = false;\n var xs = false;\n var jsonp = false !== opts.jsonp;\n\n if (typeof location !== \"undefined\") {\n var isSSL = \"https:\" === location.protocol;\n var port = location.port; // some user agents have empty `location.port`\n\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n xd = opts.hostname !== location.hostname || port !== opts.port;\n xs = opts.secure !== isSSL;\n }\n\n opts.xdomain = xd;\n opts.xscheme = xs;\n xhr = new XMLHttpRequest(opts);\n\n if (\"open\" in xhr && !opts.forceJSONP) {\n return new XHR(opts);\n } else {\n if (!jsonp) throw new Error(\"JSONP disabled\");\n return new JSONP(opts);\n }\n}\n\n//# sourceURL=webpack://eio/./lib/transports/index.js?"); + +/***/ }), + +/***/ "./lib/transports/polling-jsonp.js": +/*!*****************************************!*\ + !*** ./lib/transports/polling-jsonp.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar Polling = __webpack_require__(/*! ./polling */ \"./lib/transports/polling.js\");\n\nvar globalThis = __webpack_require__(/*! ../globalThis */ \"./lib/globalThis.browser.js\");\n\nvar rNewline = /\\n/g;\nvar rEscapedNewline = /\\\\n/g;\n/**\n * Global JSONP callbacks.\n */\n\nvar callbacks;\n/**\n * Noop.\n */\n\nfunction empty() {}\n\nvar JSONPPolling =\n/*#__PURE__*/\nfunction (_Polling) {\n _inherits(JSONPPolling, _Polling);\n\n /**\n * JSONP Polling constructor.\n *\n * @param {Object} opts.\n * @api public\n */\n function JSONPPolling(opts) {\n var _this;\n\n _classCallCheck(this, JSONPPolling);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(JSONPPolling).call(this, opts));\n _this.query = _this.query || {}; // define global callbacks array if not present\n // we do this here (lazily) to avoid unneeded global pollution\n\n if (!callbacks) {\n // we need to consider multiple engines in the same page\n callbacks = globalThis.___eio = globalThis.___eio || [];\n } // callback identifier\n\n\n _this.index = callbacks.length; // add callback to jsonp global\n\n var self = _assertThisInitialized(_this);\n\n callbacks.push(function (msg) {\n self.onData(msg);\n }); // append to query string\n\n _this.query.j = _this.index; // prevent spurious errors from being emitted when the window is unloaded\n\n if (typeof addEventListener === \"function\") {\n addEventListener(\"beforeunload\", function () {\n if (self.script) self.script.onerror = empty;\n }, false);\n }\n\n return _this;\n }\n /**\n * JSONP only supports binary as base64 encoded strings\n */\n\n\n _createClass(JSONPPolling, [{\n key: \"doClose\",\n\n /**\n * Closes the socket.\n *\n * @api private\n */\n value: function doClose() {\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n if (this.form) {\n this.form.parentNode.removeChild(this.form);\n this.form = null;\n this.iframe = null;\n }\n\n _get(_getPrototypeOf(JSONPPolling.prototype), \"doClose\", this).call(this);\n }\n /**\n * Starts a poll cycle.\n *\n * @api private\n */\n\n }, {\n key: \"doPoll\",\n value: function doPoll() {\n var self = this;\n var script = document.createElement(\"script\");\n\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n script.async = true;\n script.src = this.uri();\n\n script.onerror = function (e) {\n self.onError(\"jsonp poll error\", e);\n };\n\n var insertAt = document.getElementsByTagName(\"script\")[0];\n\n if (insertAt) {\n insertAt.parentNode.insertBefore(script, insertAt);\n } else {\n (document.head || document.body).appendChild(script);\n }\n\n this.script = script;\n var isUAgecko = \"undefined\" !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\n if (isUAgecko) {\n setTimeout(function () {\n var iframe = document.createElement(\"iframe\");\n document.body.appendChild(iframe);\n document.body.removeChild(iframe);\n }, 100);\n }\n }\n /**\n * Writes with a hidden iframe.\n *\n * @param {String} data to send\n * @param {Function} called upon flush.\n * @api private\n */\n\n }, {\n key: \"doWrite\",\n value: function doWrite(data, fn) {\n var self = this;\n var iframe;\n\n if (!this.form) {\n var form = document.createElement(\"form\");\n var area = document.createElement(\"textarea\");\n var id = this.iframeId = \"eio_iframe_\" + this.index;\n form.className = \"socketio\";\n form.style.position = \"absolute\";\n form.style.top = \"-1000px\";\n form.style.left = \"-1000px\";\n form.target = id;\n form.method = \"POST\";\n form.setAttribute(\"accept-charset\", \"utf-8\");\n area.name = \"d\";\n form.appendChild(area);\n document.body.appendChild(form);\n this.form = form;\n this.area = area;\n }\n\n this.form.action = this.uri();\n\n function complete() {\n initIframe();\n fn();\n }\n\n function initIframe() {\n if (self.iframe) {\n try {\n self.form.removeChild(self.iframe);\n } catch (e) {\n self.onError(\"jsonp polling iframe removal error\", e);\n }\n }\n\n try {\n // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n var html = '