/*! * Engine.IO v4.0.4 * (c) 2014-2020 Guillermo Rauch * Released under the MIT License. */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["eio"] = factory(); else root["eio"] = factory(); })((() => { 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 withCredentials: 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 = '