hsync 0.16.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hsync.js CHANGED
@@ -25,7 +25,7 @@ eval("let process = __webpack_require__.g.process || {env: {}};\n\nconst baseCon
25
25
  \***********************/
26
26
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
27
27
 
28
- eval("const EventEmitter = (__webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter);\nconst b64id = __webpack_require__(/*! b64id */ \"./node_modules/b64id/index.js\");\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:info');\nconst debugVerbose = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:verbose');\nconst debugError = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:error');\nconst { getRPCPeer, createServerPeer } = __webpack_require__(/*! ./lib/rpc */ \"./lib/rpc.js\");\nconst { createWebHandler, setNet: webSetNet } = __webpack_require__(/*! ./lib/web-handler */ \"./lib/web-handler.js\");\nconst { createSocketListenHandler, setNet: listenSetNet, receiveRelayData } = __webpack_require__(/*! ./lib/socket-listen-handler */ \"./lib/socket-listen-handler.js\");\nconst { createSocketRelayHandler, setNet: relaySetNet, receiveListenerData, connectSocket } = __webpack_require__(/*! ./lib/socket-relay-handler */ \"./lib/socket-relay-handler.js\");\nconst fetch = __webpack_require__(/*! ./lib/fetch */ \"./lib/fetch.js\");\n\ndebug.color = 3;\ndebugVerbose.color = 2;\ndebugError.color = 1;\n\nlet mqtt;\n\nfunction setNet(netImpl) {\n webSetNet(netImpl);\n listenSetNet(netImpl);\n relaySetNet(netImpl);\n}\n\nfunction setMqtt(mqttImpl) {\n mqtt = mqttImpl;\n}\n\nasync function createHsync(config) {\n let {\n hsyncServer,\n hsyncSecret,\n localHost,\n port,\n hsyncBase,\n keepalive,\n dynamicHost,\n } = config;\n\n let dynamicTimeout;\n\n if (dynamicHost) {\n const result = await fetch.post(`${dynamicHost}/${hsyncBase}/dyn`, {});\n if (dynamicHost.toLowerCase().startsWith('https')) {\n hsyncServer = `wss://${result.url}`;\n } else {\n hsyncServer = `ws://${result.url}`;\n }\n hsyncSecret = result.secret;\n dynamicTimeout = result.timeout;\n }\n\n const hsyncClient = {};\n hsyncClient.config = config;\n // const peers = {};\n const socketListeners = {};\n const socketRelays= {};\n const events = new EventEmitter();\n \n hsyncClient.on = events.on;\n hsyncClient.emit = events.emit;\n // hsyncClient.peers = peers;\n \n let lastConnect;\n const connectURL = `${hsyncServer}${hsyncServer.endsWith('/') ? '' : '/'}${hsyncBase}`;\n const myHostName = (new URL(connectURL)).hostname;\n hsyncClient.myHostName = myHostName;\n \n debug('connecting to', connectURL, '…' );\n const mqConn = mqtt.connect(connectURL, { password: hsyncSecret, username: myHostName, keepalive });\n mqConn.myHostName = myHostName;\n hsyncClient.mqConn = mqConn;\n\n const webHandler = config.webHandler || createWebHandler({myHostName, localHost, port, mqConn});\n hsyncClient.webHandler = webHandler;\n\n mqConn.on('connect', () => {\n const now = Date.now();\n debug('connected to', myHostName, lastConnect ? (now - lastConnect) : '', lastConnect ? 'since last connect' : '');\n lastConnect = now;\n hsyncClient.emit('connected', config);\n });\n\n mqConn.on('error', (error) => {\n debugError('error on mqConn', myHostName, error.code, error);\n if ((error.code === 4) || (error.code === 5)) {\n debug('ending');\n mqConn.end();\n }\n });\n\n mqConn.on('message', (topic, message) => {\n if (!topic) {\n return;\n }\n // message is Buffer\n const [name, hostName, segment3, action, segment5] = topic.split('/');\n debugVerbose('\\n↓ MQTT' , topic);\n if (name === 'web') {\n webHandler.handleWebRequest(hostName, segment3, action, message);\n return;\n } else if (name === 'msg') {\n const from = segment3;\n if (action === 'json') {\n try {\n const msg = JSON.parse(message.toString());\n msg.from = from;\n hsyncClient.emit('json', msg);\n } catch (e) {\n debugError('error parsing json message');\n }\n } else if (action === 'rpc') {\n const peer = getRPCPeer({hostName: from, temporary: true, hsyncClient});\n // const peer = getPeer({hostName: from, temporary: true});\n peer.transport.receiveData(message.toString());\n }\n else if (!action && (segment3 === 'srpc')) {\n hsyncClient.serverPeer.transport.receiveData(message.toString());\n }\n else if (action === 'socketData') {\n // events.emit('socketData', from, segment5, message);\n receiveSocketData(segment5, message);\n }\n else if (action === 'relayData') {\n // events.emit('socketData', from, segment5, message);\n receiveRelayData(segment5, message);\n }\n else if (action === 'socketClose') {\n events.emit('socketClose', from, segment5);\n }\n }\n\n });\n\n // function getPeer({hostName, temporary, timeout = 10000}) {\n // let peer = peers[hostName];\n // if (!peer) {\n // peer = createRPCPeer({hostName, hsyncClient, timeout, methods: peerMethods});\n // if (temporary) {\n // peer.rpcTemporary = true;\n // }\n // peers[host] = peer;\n // }\n // return peer;\n // }\n\n function sendJson(host, json) {\n if (!host || !json) {\n return;\n }\n\n if (host === myHostName) {\n debugError('cannot send message to self', host);\n }\n\n if (typeof json === 'object') {\n json = JSON.stringify(json);\n } else if (typeof json === 'string') {\n try {\n json = JSON.stringify(JSON.parse(json));\n } catch(e) {\n debugError('not well formed json or object', e);\n return;\n }\n } else {\n return;\n }\n mqConn.publish(`msg/${host}/${myHostName}/json`, json);\n }\n\n function endClient(force, callback) {\n if (force) {\n mqConn.end(force);\n if (webHandler.end) {\n webHandler.end();\n }\n return;\n }\n mqConn.end(force, (a, b) => {\n if (webHandler.end) {\n webHandler.end();\n }\n if (callback) {\n callback(a, b);\n }\n })\n }\n\n function getSocketListeners () {\n return Object.keys(socketListeners).map((id) => {\n return { info: socketListeners[id].info, id };\n });\n }\n\n function getSocketRelays () {\n return Object.keys(socketRelays).map((id) => {\n return { info: socketRelays[id].info, id };\n });\n }\n\n function addSocketListener (port, hostName, targetPort, targetHost = 'localhost') {\n const handler = createSocketListenHandler({port, hostName, targetPort, targetHost, hsyncClient});\n const id = b64id.generateId();\n socketListeners[id] = {handler, info: {port, hostName, targetPort, targetHost}, id};\n return getSocketListeners();\n }\n\n function addSocketRelay(port, hostName, targetPort, targetHost = 'localhost') {\n const handler = createSocketRelayHandler({port, hostName, targetPort, targetHost, hsyncClient});\n const id = b64id.generateId();\n socketRelays[id] = {handler, info: {port, hostName, targetPort, targetHost}, id};\n debug('relay added', port);\n return getSocketRelays();\n }\n\n const serverReplyMethods = {\n ping: (greeting) => {\n return `${greeting} back atcha from client. ${Date.now()}`;\n },\n addSocketListener,\n getSocketListeners,\n getSocketRelays,\n addSocketRelay,\n peerRpc: async (requestInfo) => {\n requestInfo.hsyncClient = hsyncClient;\n const { msg } = requestInfo;\n debug('peerRpc handler', requestInfo.fromHost, msg);\n const reply = {id: msg.id};\n try {\n if (!peerMethods[msg.method]) {\n const notFoundError = new Error('method not found');\n notFoundError.code = -32601;\n throw notFoundError;\n }\n const result = await peerMethods[msg.method](requestInfo, ...msg.params);\n reply.result = result;\n return result;\n } catch (e) {\n debug('peer rpc error', e, msg);\n msg.error = {\n code: e.code || 500,\n message: e.toString(),\n };\n return msg;\n }\n }\n };\n\n const peerMethods = {\n ping: (host, greeting) => {\n debug('ping called', host, greeting);\n return `${greeting} back atcha, ${host}.`;\n },\n connectSocket,\n receiveListenerData,\n receiveRelayData,\n };\n\n hsyncClient.serverPeer = createServerPeer(hsyncClient, serverReplyMethods);\n\n hsyncClient.hsyncBase = hsyncBase;\n hsyncClient.sendJson = sendJson;\n hsyncClient.endClient = endClient;\n hsyncClient.serverReplyMethods = serverReplyMethods;\n hsyncClient.getRPCPeer = getRPCPeer;\n hsyncClient.peerMethods = peerMethods;\n hsyncClient.hsyncSecret = hsyncSecret;\n hsyncClient.hsyncServer = hsyncServer;\n hsyncClient.dynamicTimeout = dynamicTimeout;\n const { host, protocol } = new URL(hsyncServer);\n debug('url', host, protocol);\n if (protocol === 'wss:') {\n hsyncClient.webUrl = `https://${host}`;\n } else {\n hsyncClient.webUrl = `http://${host}`;\n }\n hsyncClient.webAdmin = `${hsyncClient.webUrl}/${hsyncBase}/admin`;\n hsyncClient.webBase = `${hsyncClient.webUrl}/${hsyncBase}`;\n hsyncClient.port = port;\n\n return hsyncClient;\n}\n\nmodule.exports = {\n createHsync,\n setNet,\n setMqtt,\n};\n\n\n//# sourceURL=webpack://hsync/./connection.js?");
28
+ eval("const EventEmitter = (__webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter);\nconst b64id = __webpack_require__(/*! b64id */ \"./node_modules/b64id/index.js\");\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:info');\nconst debugVerbose = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:verbose');\nconst debugError = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:error');\nconst { getRPCPeer, createServerPeer } = __webpack_require__(/*! ./lib/peers */ \"./lib/peers.js\");\nconst { createWebHandler, setNet: webSetNet } = __webpack_require__(/*! ./lib/web-handler */ \"./lib/web-handler.js\");\nconst { createSocketListenHandler, setNet: listenSetNet, receiveRelayData } = __webpack_require__(/*! ./lib/socket-listen-handler */ \"./lib/socket-listen-handler.js\");\nconst { createSocketRelayHandler, setNet: relaySetNet, receiveListenerData, connectSocket } = __webpack_require__(/*! ./lib/socket-relay-handler */ \"./lib/socket-relay-handler.js\");\nconst fetch = __webpack_require__(/*! ./lib/fetch */ \"./lib/fetch.js\");\n\ndebug.color = 3;\ndebugVerbose.color = 2;\ndebugError.color = 1;\n\nlet mqtt;\n\nconsole.log('connection from hsync');\n\nfunction setNet(netImpl) {\n webSetNet(netImpl);\n listenSetNet(netImpl);\n relaySetNet(netImpl);\n}\n\nfunction setMqtt(mqttImpl) {\n mqtt = mqttImpl;\n}\n\nasync function createHsync(config) {\n let {\n hsyncServer,\n hsyncSecret,\n localHost,\n port,\n hsyncBase,\n keepalive,\n dynamicHost,\n listenerLocalPort,\n listenerTargetHost,\n listenerTargetPort,\n relayInboundPort,\n relayTargetHost,\n relayTargetPort,\n } = config;\n\n // console.log('config', config);\n\n let dynamicTimeout;\n\n if (dynamicHost) {\n const result = await fetch.post(`${dynamicHost}/${hsyncBase}/dyn`, {});\n if (dynamicHost.toLowerCase().startsWith('https')) {\n hsyncServer = `wss://${result.url}`;\n } else {\n hsyncServer = `ws://${result.url}`;\n }\n hsyncSecret = result.secret;\n dynamicTimeout = result.timeout;\n }\n\n const hsyncClient = {};\n hsyncClient.config = config;\n // const peers = {};\n const socketListeners = {};\n const socketRelays= {};\n const events = new EventEmitter();\n \n hsyncClient.on = events.on;\n hsyncClient.emit = events.emit;\n // hsyncClient.peers = peers;\n \n let lastConnect;\n const connectURL = `${hsyncServer}${hsyncServer.endsWith('/') ? '' : '/'}${hsyncBase}`;\n const myHostName = (new URL(connectURL)).hostname;\n hsyncClient.myHostName = myHostName;\n \n debug('connecting to', connectURL, '…' );\n const mqConn = mqtt.connect(connectURL, { password: hsyncSecret, username: myHostName, keepalive });\n mqConn.myHostName = myHostName;\n hsyncClient.mqConn = mqConn;\n\n const webHandler = config.webHandler || createWebHandler({myHostName, localHost, port, mqConn});\n hsyncClient.webHandler = webHandler;\n\n mqConn.on('connect', () => {\n const now = Date.now();\n debug('connected to', myHostName, lastConnect ? (now - lastConnect) : '', lastConnect ? 'since last connect' : '');\n lastConnect = now;\n hsyncClient.emit('connected', config);\n });\n\n mqConn.on('error', (error) => {\n debugError('error on mqConn', myHostName, error.code, error);\n if ((error.code === 4) || (error.code === 5)) {\n debug('ending');\n mqConn.end();\n }\n });\n\n mqConn.on('message', (topic, message) => {\n if (!topic) {\n return;\n }\n // message is Buffer\n const [name, hostName, segment3, action, segment5] = topic.split('/');\n debugVerbose('\\n↓ MQTT' , topic);\n if (name === 'web') {\n webHandler.handleWebRequest(hostName, segment3, action, message);\n return;\n } else if (name === 'msg') {\n const from = segment3;\n if (action === 'json') {\n try {\n const msg = JSON.parse(message.toString());\n msg.from = from;\n hsyncClient.emit('json', msg);\n } catch (e) {\n debugError('error parsing json message');\n }\n }\n else if (!action && (segment3 === 'srpc')) {\n hsyncClient.serverPeer.transport.receiveData(message.toString());\n }\n }\n\n });\n\n function endClient(force, callback) {\n if (force) {\n mqConn.end(force);\n if (webHandler.end) {\n webHandler.end();\n }\n return;\n }\n mqConn.end(force, (a, b) => {\n if (webHandler.end) {\n webHandler.end();\n }\n if (callback) {\n callback(a, b);\n }\n })\n }\n\n function getSocketListeners () {\n return Object.keys(socketListeners).map((id) => {\n return { info: socketListeners[id].info, id };\n });\n }\n\n function getSocketRelays () {\n return Object.keys(socketRelays).map((id) => {\n return { info: socketRelays[id].info, id };\n });\n }\n\n function addSocketListener (port, hostName, targetPort, targetHost) {\n // console.log('addSocketListener', port, hostName, targetPort, targetHost);\n const handler = createSocketListenHandler({port, hostName, targetPort, targetHost, hsyncClient});\n const id = b64id.generateId();\n socketListeners[id] = {handler, info: {port, hostName, targetPort, targetHost}, id};\n return getSocketListeners();\n }\n\n function addSocketRelay(port, hostName, targetPort, targetHost = 'localhost') {\n const handler = createSocketRelayHandler({port, hostName, targetPort, targetHost, hsyncClient});\n const id = b64id.generateId();\n socketRelays[id] = {handler, info: {port, hostName, targetPort, targetHost}, id};\n debug('relay added', port);\n return getSocketRelays();\n }\n\n const serverReplyMethods = {\n ping: (greeting) => {\n return `${greeting} back atcha from client. ${Date.now()}`;\n },\n addSocketListener,\n getSocketListeners,\n getSocketRelays,\n addSocketRelay,\n peerRpc: async (requestInfo) => {\n requestInfo.hsyncClient = hsyncClient;\n const { msg } = requestInfo;\n debug('peerRpc handler', requestInfo.fromHost, msg.method);\n const peer = getRPCPeer({hostName: requestInfo.fromHost, hsyncClient});\n if (!msg.id) {\n // notification\n if (Array.isArray(msg.params)) {\n msg.params.unshift(peer);\n }\n peer.transport.emit('rpc', msg);\n return { result: {}, id: msg.id};\n }\n const reply = {id: msg.id, jsonrpc:'2.0'};\n try {\n if (!peer.localMethods[msg.method]) {\n const notFoundError = new Error('method not found');\n notFoundError.code = -32601;\n throw notFoundError;\n }\n const result = await peer.localMethods[msg.method](requestInfo, ...msg.params);\n reply.result = result;\n return result;\n } catch (e) {\n debug('peer rpc error', e, msg);\n reply.error = {\n code: e.code || 500,\n message: e.toString(),\n };\n return reply;\n }\n }\n };\n\n const peerMethods = {\n ping: (remotePeer, greeting) => {\n debug('ping called', remotePeer.hostName, greeting);\n return `${greeting} back atcha, ${remotePeer.hostName}.`;\n },\n connectSocket,\n receiveListenerData,\n receiveRelayData,\n };\n\n hsyncClient.serverPeer = createServerPeer(hsyncClient, serverReplyMethods);\n hsyncClient.getPeer = (hostName) => {\n return getRPCPeer({hostName, hsyncClient});\n };\n hsyncClient.hsyncBase = hsyncBase;\n hsyncClient.endClient = endClient;\n hsyncClient.serverReplyMethods = serverReplyMethods;\n hsyncClient.getRPCPeer = getRPCPeer;\n hsyncClient.peerMethods = peerMethods;\n hsyncClient.hsyncSecret = hsyncSecret;\n hsyncClient.hsyncServer = hsyncServer;\n hsyncClient.dynamicTimeout = dynamicTimeout;\n const { host, protocol } = new URL(hsyncServer);\n if (protocol === 'wss:') {\n hsyncClient.webUrl = `https://${host}`;\n } else {\n hsyncClient.webUrl = `http://${host}`;\n }\n debug('url', host, protocol, hsyncClient.webUrl);\n hsyncClient.webAdmin = `${hsyncClient.webUrl}/${hsyncBase}/admin`;\n hsyncClient.webBase = `${hsyncClient.webUrl}/${hsyncBase}`;\n hsyncClient.port = port;\n\n if (listenerLocalPort) {\n listenerLocalPort.forEach((llp, i) => {\n let lth = listenerTargetHost ? listenerTargetHost[i] || listenerTargetHost[0] : null;\n if (lth) {\n if (lth.endsWith('/')) {\n lth = lth.substring(0, lth.length - 1);\n }\n const ltp = listenerTargetPort ? listenerTargetPort[i] : llp;\n addSocketListener(llp, myHostName, ltp, lth);\n debug('relaying local', llp, 'to', lth, ltp);\n }\n });\n }\n\n if (relayInboundPort) {\n relayInboundPort.forEach((rip, i) => {\n const rth = relayTargetHost ? relayTargetHost[i] : relayTargetHost[0] || 'localhost';\n if (rth) {\n if (rth.endsWith('/')) {\n rth = rth.substring(0, rth.length - 1);\n }\n const rtp = relayTargetPort ? relayTargetPort[i] : rip;\n addSocketRelay(rip, myHostName, rtp, rth);\n debug('relaying inbound', rip, 'to', rth, rtp);\n }\n });\n }\n\n return hsyncClient;\n}\n\nmodule.exports = {\n createHsync,\n setNet,\n setMqtt,\n};\n\n\n//# sourceURL=webpack://hsync/./connection.js?");
29
29
 
30
30
  /***/ }),
31
31
 
@@ -35,7 +35,7 @@ eval("const EventEmitter = (__webpack_require__(/*! events */ \"./node_modules/e
35
35
  \**********************/
36
36
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
37
37
 
38
- eval("const mqtt = __webpack_require__(/*! precompiled-mqtt */ \"./node_modules/precompiled-mqtt/dist/mqtt.browser.js\");\nconst buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\nconst net = __webpack_require__(/*! net-web */ \"./node_modules/net-web/net-web.js\");\nconst { createHsync, setNet, setMqtt } = __webpack_require__(/*! ./connection */ \"./connection.js\");\nconst config = __webpack_require__(/*! ./config */ \"./config.js\");\n\n// TODO need to make this work with web/service workers\nwindow.Buffer = buffer.Buffer;\n\nsetNet(net);\nsetMqtt(mqtt);\n\nasync function dynamicConnect(dynamicHost, useLocalStorage, configObj = {}) {\n if (typeof useLocalStorage === 'object') {\n configObj = useLocalStorage;\n }\n else {\n configObj.useLocalStorage = useLocalStorage;\n }\n\n const fullConfig = {...config, ...configObj};\n if (fullConfig.net) {\n setNet(fullConfig.net);\n }\n let con;\n if (useLocalStorage) {\n const localConfigStr = localStorage.getItem('hsyncConfig');\n if (localConfigStr) {\n const localConfig = JSON.parse(localConfigStr);\n if ((Date.now() - localConfig.created) < (localConfig.timeout * 0.66)) {\n fullConfig.hsyncSecret = localConfig.hsyncSecret;\n fullConfig.hsyncServer = localConfig.hsyncServer;\n } else {\n localStorage.removeItem('hsyncConfig');\n }\n }\n \n if (!fullConfig.hsyncSecret) {\n fullConfig.dynamicHost = dynamicHost || fullConfig.defaultDynamicHost;\n }\n \n con = await createHsync(fullConfig);\n \n if (fullConfig.dynamicHost) {\n const storeConfig = {\n hsyncSecret: con.hsyncSecret,\n hsyncServer: con.hsyncServer,\n timeout: con.dynamicTimeout,\n created: Date.now(),\n };\n localStorage.setItem('hsyncConfig', JSON.stringify(storeConfig));\n }\n\n return con;\n }\n\n fullConfig.dynamicHost = dynamicHost || fullConfig.defaultDynamicHost;\n con = await createHsync(fullConfig);\n\n return con;\n \n}\n\nfunction createConnection(configObj = {}) {\n const fullConfig = {...config, ...configObj};\n return createHsync(fullConfig);\n}\n\n\nconst hsync = globalThis.hsync || {\n createConnection,\n dynamicConnect,\n net,\n config,\n};\nglobalThis.hsync = hsync;\n\nmodule.exports = hsync;\n\n\n//# sourceURL=webpack://hsync/./hsync-web.js?");
38
+ eval("const mqtt = __webpack_require__(/*! precompiled-mqtt */ \"./node_modules/precompiled-mqtt/dist/mqtt.browser.js\");\nconst buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\nconst net = __webpack_require__(/*! net-web */ \"./node_modules/net-web/net-web.js\");\nconst { createHsync, setNet, setMqtt } = __webpack_require__(/*! ./connection */ \"./connection.js\");\nconst { setRTC } = __webpack_require__(/*! ./lib/peers */ \"./lib/peers.js\");\nconst rtc = __webpack_require__(/*! ./lib/rtc-web */ \"./lib/rtc-web.js\");\nconst config = __webpack_require__(/*! ./config */ \"./config.js\");\n\n\n// TODO need to make this work with web/service workers\nwindow.Buffer = buffer.Buffer;\n\nsetRTC(rtc);\nsetNet(net);\nsetMqtt(mqtt);\n\nasync function dynamicConnect(dynamicHost, useLocalStorage, configObj = {}) {\n if (typeof useLocalStorage === 'object') {\n configObj = useLocalStorage;\n }\n else {\n configObj.useLocalStorage = useLocalStorage;\n }\n\n const fullConfig = {...config, ...configObj};\n if (fullConfig.net) {\n setNet(fullConfig.net);\n }\n let con;\n if (useLocalStorage) {\n const localConfigStr = localStorage.getItem('hsyncConfig');\n if (localConfigStr) {\n const localConfig = JSON.parse(localConfigStr);\n if ((Date.now() - localConfig.created) < (localConfig.timeout * 0.66)) {\n fullConfig.hsyncSecret = localConfig.hsyncSecret;\n fullConfig.hsyncServer = localConfig.hsyncServer;\n } else {\n localStorage.removeItem('hsyncConfig');\n }\n }\n \n if (!fullConfig.hsyncSecret) {\n fullConfig.dynamicHost = dynamicHost || fullConfig.defaultDynamicHost;\n }\n \n con = await createHsync(fullConfig);\n \n if (fullConfig.dynamicHost) {\n const storeConfig = {\n hsyncSecret: con.hsyncSecret,\n hsyncServer: con.hsyncServer,\n timeout: con.dynamicTimeout,\n created: Date.now(),\n };\n localStorage.setItem('hsyncConfig', JSON.stringify(storeConfig));\n }\n\n return con;\n }\n\n fullConfig.dynamicHost = dynamicHost || fullConfig.defaultDynamicHost;\n con = await createHsync(fullConfig);\n\n return con;\n \n}\n\nfunction createConnection(configObj = {}) {\n const fullConfig = {...config, ...configObj};\n return createHsync(fullConfig);\n}\n\n\nconst hsync = globalThis.hsync || {\n createConnection,\n dynamicConnect,\n net,\n config,\n};\nglobalThis.hsync = hsync;\n\nmodule.exports = hsync;\n\n\n//# sourceURL=webpack://hsync/./hsync-web.js?");
39
39
 
40
40
  /***/ }),
41
41
 
@@ -49,13 +49,23 @@ eval("const fetch = __webpack_require__(/*! isomorphic-fetch */ \"./node_modules
49
49
 
50
50
  /***/ }),
51
51
 
52
- /***/ "./lib/rpc.js":
53
- /*!********************!*\
54
- !*** ./lib/rpc.js ***!
55
- \********************/
52
+ /***/ "./lib/peers.js":
53
+ /*!**********************!*\
54
+ !*** ./lib/peers.js ***!
55
+ \**********************/
56
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
57
+
58
+ eval("const rawr = __webpack_require__(/*! rawr */ \"./node_modules/rawr/index.js\");\nconst b64id = __webpack_require__(/*! b64id */ \"./node_modules/b64id/index.js\");\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:peers');\nconst EventEmitter = (__webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter);\nconst buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\nconst mqttPacket = __webpack_require__(/*! mqtt-packet-web */ \"./node_modules/mqtt-packet-web/index.js\");\n\nglobalThis.Buffer = buffer.Buffer;\n\nconst { handleSocketPacket } = __webpack_require__(/*! ./socket-map */ \"./lib/socket-map.js\");\nconst fetch = __webpack_require__(/*! ./fetch */ \"./lib/fetch.js\");\n\nconst peers = {};\n\nlet rtc;\n\nfunction setRTC(rtcImpl) {\n rtc = rtcImpl;\n}\n\nfunction createPacket(topic, payload) {\n let payloadStr = payload;\n // console.log('mqttPacket', { topic, payload });\n // if (payload instanceof Uint8Array) {\n // console.log('str payload', new TextDecoder().decode(payload));\n // }\n const packet = mqttPacket.generate({\n qos: 0,\n cmd: 'publish',\n topic,\n payload: payloadStr,\n });\n // console.log('packet', packet);\n return packet;\n}\n\nfunction parsePacket(packet) {\n const parser = mqttPacket.parser();\n return new Promise((resolve, reject) => {\n parser.on('packet', resolve);\n parser.on('error', reject);\n parser.parse(packet);\n });\n}\n\nfunction getRPCPeer(options = {}) {\n const { hostName, temporary, timeout = 10000, hsyncClient } = options;\n let peer = peers[hostName];\n if (!peer) {\n debug('CREATING peer', hostName);\n peer = createRPCPeer({hostName, hsyncClient, timeout});\n if (temporary) {\n peer.rpcTemporary = true;\n }\n peers[hostName] = peer;\n }\n return peer;\n}\n\nfunction createRPCPeer(options = {}) {\n const { hostName, hsyncClient, timeout = 10000, useRTC = true } = options;\n if (!hostName) {\n throw new Error('No hostname specified');\n }\n if (hostName === hsyncClient.myHostName) {\n throw new Error('Peer must be a different host');\n }\n const myAuth = b64id.generateId();\n const transport = new EventEmitter();\n const peer = rawr({transport, methods: Object.assign({}, hsyncClient.peerMethods), timeout, idGenerator: b64id.generateId});\n peer.hostName = hostName;\n peer.rtcEvents = new EventEmitter();\n peer.localMethods = Object.assign({}, hsyncClient.peerMethods);\n peer.sockets = {};\n\n peer.localMethods.rtcSignal = (peerInfo, signal) => {\n debug('rtcSignal', signal.type);\n if (signal.type === 'offer' && !peer.rtcCon && !signal.alreadySent) {\n rtc.answerPeer(peer, signal);\n } else if (signal.type === 'answer') {\n peer.handleRtcAnswer(signal);\n }\n return 'rtcSignal ok';\n }\n\n peer.rtcEvents.on('packet', async (packet) => {\n try {\n const msg = await parsePacket(packet);\n const [p1, p2, p3] = msg.topic.split('/');\n if (p1 === 'rpc') {\n transport.receiveData(JSON.parse(msg.payload.toString()));\n } else if (p1 === 'socketData'){\n handleSocketPacket(msg);\n } else {\n debug('other topic', msg.topic);\n }\n } catch (e) {\n debug('bad packet', e);\n }\n });\n\n peer.rtcEvents.on('dcOpen', () => {\n debug('dcOpen');\n peer.packAndSend = (topic, payload) => {\n const packet = createPacket(topic, payload);\n peer.rtcSend(packet);\n }\n });\n\n peer.rtcEvents.on('closed', () => {\n peer.dcOpen = false;\n delete peer.packAndSend;\n debug('rtc closed');\n for (s in peer.sockets) {\n try {\n debug('closing socket', s);\n peer.sockets[s].destroy();\n delete peer.sockets[s];\n } catch (e) {\n debug('error closing socket', e);\n }\n }\n });\n\n peer.rtcEvents.on('disconnected', () => {\n peer.dcOpen = false;\n delete peer.packAndSend;\n debug('rtc disconnected');\n for (s in peer.sockets) {\n try {\n debug('closing socket', s);\n peer.sockets[s].destroy();\n delete peer.sockets[s];\n } catch (e) {\n debug('error closing socket', e);\n }\n }\n });\n\n peer.connectRTC = async () => {\n debug('connectRTC');\n \n return new Promise(async (resolve, reject) => {\n try {\n const offer = await rtc.offerPeer(peer);\n peer.rtcEvents.once('dcOpen', () => {\n debug('dcOpen!');\n resolve(offer);\n });\n } catch (e) {\n reject(e);\n }\n });\n };\n\n transport.send = async (msg) => {\n const fullMsg = {\n msg,\n myAuth,\n toHost: hostName,\n fromHost: hsyncClient.webUrl,\n };\n\n debug('↑ peer rpc', peer.dcOpen ? 'RTC' : 'REST', `${hostName}/_hs/rpc`, msg.method);\n\n if (peer.dcOpen) {\n let payload = msg;\n if (typeof msg === 'object') {\n payload = JSON.stringify(payload);\n }\n const packet = createPacket('rpc', payload);\n peer.rtcSend(packet);\n return;\n }\n\n try {\n debug('fetching', fullMsg, useRTC);\n const result = await fetch.post(`${hostName}/_hs/rpc`, fullMsg);\n debug('fetch result', result);\n if (msg.id) {\n transport.receiveData({id: msg.id, result, jsonrpc: msg.jsonrpc});\n }\n // if (!peer.rtcCon && useRTC) {\n // debug('STARTING rtc creation');\n // rtc.offerPeer(peer);\n // }\n } catch(e) {\n debug('error sending peer RPC request', e);\n transport.receiveData({id: msg.id, error: e, method: msg.method, jsonrpc: msg.jsonrpc});\n }\n \n };\n\n transport.receiveData = (msg) => {\n if(typeof msg === 'string') {\n msg = JSON.parse(msg);\n }\n debug('↓ peer rpc receivedData', msg, msg.params);\n if (msg.params && Array.isArray(msg.params)) {\n debug('unshifting', msg.params);\n msg.params.unshift(peer);\n }\n transport.emit('rpc', msg);\n };\n\n peer.myAuth = myAuth;\n peer.hostName = hostName;\n return peer;\n}\n\nfunction createServerPeer(hsyncClient, methods) {\n const transport = new EventEmitter();\n transport.send = (msg) => {\n if(typeof msg === 'object') {\n msg = JSON.stringify(msg);\n }\n const topic = `srpc/${hsyncClient.myHostName}`;\n debug('↑ server rpc request', msg);\n hsyncClient.mqConn.publish(topic, Buffer.from(msg));\n };\n transport.receiveData = (msg) => {\n if(msg) {\n msg = JSON.parse(msg);\n }\n debug('↓ server rpc reply', msg.method, msg.id);\n transport.emit('rpc', msg);\n };\n const peer = rawr({transport, methods, timeout: 5000});\n return peer;\n}\n\nmodule.exports = {\n createRPCPeer,\n createServerPeer,\n getRPCPeer,\n setRTC,\n};\n\n\n//# sourceURL=webpack://hsync/./lib/peers.js?");
59
+
60
+ /***/ }),
61
+
62
+ /***/ "./lib/rtc-web.js":
63
+ /*!************************!*\
64
+ !*** ./lib/rtc-web.js ***!
65
+ \************************/
56
66
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
57
67
 
58
- eval("const rawr = __webpack_require__(/*! rawr */ \"./node_modules/rawr/index.js\");\nconst b64id = __webpack_require__(/*! b64id */ \"./node_modules/b64id/index.js\");\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:rpc');\nconst EventEmitter = (__webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter);\n// const { peerMethods } = require('./peer-methods');\nconst fetch = __webpack_require__(/*! ./fetch */ \"./lib/fetch.js\");\n\nconst peers = {};\n\nfunction getRPCPeer({hostName, temporary, timeout = 10000, hsyncClient}) {\n let peer = peers[hostName];\n if (!peer) {\n debug('creating peer', hostName);\n peer = createRPCPeer({hostName, hsyncClient, timeout, methods: hsyncClient.peerMethods});\n if (temporary) {\n peer.rpcTemporary = true;\n }\n peers[hostName] = peer;\n }\n return peer;\n}\n\n\nfunction createRPCPeer({ hostName, hsyncClient, timeout = 10000, methods = {} }) {\n if (!hostName) {\n throw new Error('No hostname specified');\n }\n if (hostName === hsyncClient.myHostName) {\n throw new Error('Peer must be a different host');\n }\n const myAuth = b64id.generateId();\n const transport = new EventEmitter();\n transport.send = async (msg) => {\n const fullMsg = {\n msg,\n myAuth,\n toHost: hostName,\n fromHost: hsyncClient.webUrl,\n };\n // const toSend = JSON.stringify(fullMsg);\n const topic = `rpc/${hsyncClient.myHostName}`;\n debug(' peer rpc', `${hostName}/_hs/rpc`, msg);\n // hsyncClient.mqConn.publish(topic, Buffer.from(toSend));\n try {\n const result = await fetch.post(`${hostName}/_hs/rpc`, fullMsg);\n transport.receiveData({id: msg.id, result, jsonrpc: msg.jsonrpc});\n } catch(e) {\n debug(e);\n transport.receiveData({id: msg.id, error: e, method: msg.method, jsonrpc: msg.jsonrpc});\n }\n \n };\n transport.receiveData = (msg) => {\n debug(' peer rpc', msg);\n if(typeof msg === 'string') {\n msg = JSON.parse(msg);\n }\n if (Array.isArray(msg.params)) {\n msg.params.unshift(hostName);\n }\n transport.emit('rpc', msg);\n };\n\n const peer = rawr({transport, methods: Object.assign({}, methods), timeout, idGenerator: b64id.generateId});\n peer.myAuth = myAuth;\n return peer;\n \n}\n\nfunction createServerPeer(hsyncClient, methods) {\n const transport = new EventEmitter();\n transport.send = (msg) => {\n if(typeof msg === 'object') {\n msg = JSON.stringify(msg);\n }\n const topic = `srpc/${hsyncClient.myHostName}`;\n debug(' server rpc request', msg);\n hsyncClient.mqConn.publish(topic, Buffer.from(msg));\n };\n transport.receiveData = (msg) => {\n debug(' server rpc reply', msg);\n if(msg) {\n msg = JSON.parse(msg);\n }\n transport.emit('rpc', msg);\n };\n const peer = rawr({transport, methods, timeout: 5000});\n return peer;\n}\n\nmodule.exports = {\n createRPCPeer,\n createServerPeer,\n getRPCPeer,\n};\n\n//# sourceURL=webpack://hsync/./lib/rpc.js?");
68
+ eval("const debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:rtc-web');\nconst debugError = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('errors');\n\nconst rtc = {\n PeerConnection: RTCPeerConnection,\n};\n\n\nconst defaultOptions = {\n // Recommended for libdatachannel\n // bundlePolicy: \"max-bundle\",\n iceServers: [{ 'urls': 'stun:stun.l.google.com:19302' }] \n};\n\nconst GATHERING_TIMEOUT = 4000;\n\nasync function offerPeer(peer) {\n\n const con = new RTCPeerConnection(defaultOptions);\n // window.rtc = rtc;\n\n peer.rtcCon = con;\n peer.rtcOfferer = true;\n \n let gatheringComplete = false;\n let offerSent = false;\n const start = Date.now();\n\n function sendOffer(alreadySent) {\n debug('send offer', alreadySent);\n const desc = con.localDescription;\n peer.methods.rtcSignal({type: desc.type, sdp: desc.sdp, alreadySent});\n }\n\n con.onicegatheringstatechange = (state) => {\n debug('state change', con.iceGatheringState);\n if (con.iceGatheringState === 'complete') {\n debug('icegathering done', Date.now() - start);\n gatheringComplete = true;\n // We only want to provide an answer once all of our candidates have been added to the SDP.\n sendOffer(offerSent);\n }\n }\n\n con.onicecandidate = (ice) => {\n debug('ice candidate', ice);\n };\n\n con.onconnectionstatechange = (event) => {\n debug('connection state', con.connectionState, event);\n if(con.connectionState === 'connected') {\n peer.connected = true;\n peer.rtcEvents.emit('connected', con);\n }\n };\n\n con.ondatachannel = (event) => {\n debug('dc from answerer', event);\n peer.dc = event.channel;\n };\n\n const dc = con.createDataChannel('from web');\n\n peer.dc = dc;\n dc.onmessage = (event) => { \n debug('dc event', event.data);\n peer.rtcEvents.emit('packet', event.data);\n };\n dc.onopen = (event) => { \n peer.dcOpen = true;\n peer.dc = dc;\n peer.rtcEvents.emit('dcOpen', dc);\n peer.rtcSend = (packet) => {\n dc.send(packet);\n };\n // dc.send('yo waddup from the browser');\n };\n\n const offer = await con.createOffer({offerToReceiveAudio:true, offerToReceiveVideo:true});\n await con.setLocalDescription(offer);\n\n setTimeout(() => {\n if (!gatheringComplete) {\n debug('didnt finish gathering');\n sendOffer();\n offerSent = true;\n }\n }, GATHERING_TIMEOUT);\n\n peer.handleRtcAnswer = (answer) => {\n debug('node handleRtcAnswer', answer.sdp.length);\n con.setRemoteDescription(answer);\n return 'web handleRtcAnswer ok';\n }\n}\n\nasync function answerPeer(peer, offer) {\n const options = {...defaultOptions, bundlePolicy: \"max-bundle\"};\n const con = new RTCPeerConnection(options);\n // window.rtc = rtc;\n\n peer.rtcCon = con;\n \n let gatheringComplete = false;\n const start = Date.now();\n\n function sendAnswer() {\n const desc = con.localDescription;\n peer.methods.rtcSignal({type: desc.type, sdp: desc.sdp});\n }\n\n con.onicegatheringstatechange = (state) => {\n if (con.iceGatheringState === 'complete') {\n gatheringComplete = true;\n debug('answerer icegathering done', Date.now() - start);\n sendAnswer();\n }\n }\n await con.setRemoteDescription(offer);\n\n let answer = await con.createAnswer();\n await con.setLocalDescription(answer);\n\n con.onicecandidate = (ice) => {\n debug('ice candidate', ice);\n };\n\n con.onconnectionstatechange = (event) => {\n debug('connection state', con.connectionState, event);\n if(con.connectionState === 'connected') {\n peer.connected = true;\n peer.rtcEvents.emit('connected', con);\n } else if (con.connectionState === 'disconnected') {\n peer.connected = false;\n peer.rtcEvents.emit('disconnected', con);\n peer.rtcCon = null;\n peer.dc = null;\n } else if (con.connectionState === 'closed') {\n peer.connected = false;\n peer.rtcEvents.emit('closed', con);\n peer.rtcCon = null;\n peer.dc = null;\n }\n };\n\n con.ondatachannel = (event) => {\n debug('dc from node', event);\n peer.dcOpen = true;\n peer.dc = event.channel;\n peer.rtcEvents.emit('dcOpen', peer.dc);\n peer.rtcSend = (packet) => {\n peer.dc.send(packet);\n };\n peer.dc.onmessage = (event) => {\n peer.rtcEvents.emit('packet', event.data);\n };\n };\n\n setTimeout(() => {\n if (!gatheringComplete) {\n debug('didnt finish gathering');\n sendAnswer();\n }\n }, GATHERING_TIMEOUT);\n\n}\n\n\nrtc.offerPeer = offerPeer;\nrtc.answerPeer = answerPeer;\n\nmodule.exports = rtc;\n\n//# sourceURL=webpack://hsync/./lib/rtc-web.js?");
59
69
 
60
70
  /***/ }),
61
71
 
@@ -65,7 +75,17 @@ eval("const rawr = __webpack_require__(/*! rawr */ \"./node_modules/rawr/index.j
65
75
  \**************************************/
66
76
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
67
77
 
68
- eval("const b64id = __webpack_require__(/*! b64id */ \"./node_modules/b64id/index.js\");\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:listener');\nconst debugError = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:error');\n// const { getRTCPeer } = require('./data-channel');\n\nconst { getRPCPeer } = __webpack_require__(/*! ./rpc */ \"./lib/rpc.js\");\n\nlet net;\n\nfunction setNet(netImpl) {\n net = netImpl;\n}\n\n\ndebugError.color = 1;\n\nconst sockets = {};\n\n// function receiveRelayData(socketId, data) {\n// if (sockets[socketId]) {\n// debug('receiveRelayData', socketId, data.length);\n// sockets[socketId].write(data);\n// }\n// }\n\nfunction receiveRelayData(requestInfo, { socketId, data }) {\n debug('receiveRelayData', socketId, data, 'sockets', Object.keys(sockets));\n if (!sockets[socketId]) {\n throw new Error('listener has no matching socket for relay: ' + socketId);\n }\n let dataBuffer = data;\n if (typeof dataBuffer === 'string') {\n dataBuffer = Buffer.from(dataBuffer, 'base64');\n }\n sockets[socketId].write(dataBuffer);\n return 'ok';\n}\n\nfunction createSocketListenHandler({hostName, port, targetPort, targetHost, hsyncClient}) {\n debug('creating handler', hostName, port, targetPort, targetHost);\n \n const rpcPeer = getRPCPeer({hostName, hsyncClient});\n\n debug('peer crated');\n\n const socketServer = net.createServer(async (socket) => {\n\n socket.socketId = b64id.generateId();\n sockets[socket.socketId] = socket;\n debug('connected to local listener', port, socket.socketId);\n socket.peerConnected = false;\n const pubTopic = `msg/${hostName}/${hsyncClient.myHostName}/socketData/${socket.socketId}`;\n const closeTopic = `msg/${hostName}/${hsyncClient.myHostName}/socketClose/${socket.socketId}`;\n const dataQueue = [];\n\n async function sendData(data) {\n debug('sending data', hostName, data.length);\n // const p = getRTCPeer(hostName, hsyncClient);\n // if (p.connected) {\n // p.send(`socketData/${socket.socketId}`, data);\n // return;\n // }\n // hsyncClient.mqConn.publish(pubTopic, data);\n const result = await rpcPeer.methods.receiveListenerData({\n socketId: socket.socketId,\n data: Buffer.from(data).toString('base64'),\n });\n debug('sendData from Listener', result);\n }\n\n socket.on('data', async (data) => {\n debug('socket data', data?.length);\n // if (!socket.peerConnected) {\n // dataQueue.push(data);\n // return;\n // }\n sendData(data);\n });\n \n socket.on('close', () => {\n debug('listener socket closed', port, socket.socketId);\n if (sockets[socket.socketId]) {\n delete sockets[socket.socketId];\n }\n // hsyncClient.mqConn.publish(closeTopic, '');\n });\n \n socket.on('error', (error) => {\n debug('socket error', hostName, socket.socketId, error);\n if (sockets[socket.socketId]) {\n delete sockets[socket.socketId];\n }\n // hsyncClient.mqConn.publish(closeTopic, '');\n });\n \n try {\n debug('connecting remotely', socket.socketId, targetPort);\n const result = await rpcPeer.methods.connectSocket({socketId: socket.socketId, port: targetPort});\n debug('connect result', result);\n socket.peerConnected = true;\n dataQueue.forEach(sendData);\n // const p = getRTCPeer(hostName, hsyncClient);\n // if (p.pc) {\n // p.createDC();\n // }\n \n } catch (e) {\n debugError('cant connect remotely', hostName, targetPort, e);\n if (sockets[socket.socketId]) {\n delete sockets[socket.socketId];\n }\n socket.end();\n }\n \n\n });\n\n socketServer.listen(port);\n\n\n function end() {\n const sockKeys = Object.keys(sockets);\n sockKeys.forEach((sk) => {\n try {\n sockets[sk].end();\n delete sockets[sk];\n }\n catch(e) {\n debug('error closing socket', e);\n }\n });\n }\n\n return {\n socketServer,\n sockets,\n end,\n };\n}\n\nmodule.exports = { \n createSocketListenHandler,\n receiveRelayData,\n setNet,\n};\n\n//# sourceURL=webpack://hsync/./lib/socket-listen-handler.js?");
78
+ eval("const b64id = __webpack_require__(/*! b64id */ \"./node_modules/b64id/index.js\");\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:listener');\nconst debugError = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:error');\n\nconst { getRPCPeer } = __webpack_require__(/*! ./peers */ \"./lib/peers.js\");\nconst { sockets } = __webpack_require__(/*! ./socket-map */ \"./lib/socket-map.js\");\n\nlet net;\n\nfunction setNet(netImpl) {\n net = netImpl;\n}\n\ndebugError.color = 1;\n\nfunction receiveRelayData(remotePeer, { socketId, data }) {\n debug('receiveRelayData', socketId, data, 'sockets', Object.keys(sockets));\n if (!sockets[socketId]) {\n throw new Error('listener has no matching socket for relay: ' + socketId);\n }\n let dataBuffer = data;\n if (typeof dataBuffer === 'string') {\n dataBuffer = Buffer.from(dataBuffer, 'base64');\n }\n sockets[socketId].write(dataBuffer);\n return 'receiveRelayData ok';\n}\n\nfunction createSocketListenHandler(options = {}) {\n const { hostName, port, targetPort, targetHost, hsyncClient } = options;\n debug('creating handler', port, targetHost);\n \n const rpcPeer = getRPCPeer({hostName: targetHost, hsyncClient});\n\n const socketServer = net.createServer(async (socket) => {\n\n if (!rpcPeer.rtcCon) {\n await rpcPeer.connectRTC();\n }\n\n socket.socketId = b64id.generateId();\n sockets[socket.socketId] = socket;\n rpcPeer.sockets[socket.socketId] = socket;\n socket.listenerSocket = true;\n debug('connected to local listener', port, socket.socketId);\n socket.peerConnected = false;\n const pubTopic = `msg/${hostName}/${hsyncClient.myHostName}/socketData/${socket.socketId}`;\n const closeTopic = `msg/${hostName}/${hsyncClient.myHostName}/socketClose/${socket.socketId}`;\n const dataQueue = [];\n\n async function sendData(data) {\n if (rpcPeer.packAndSend) {\n debug('sending data via rtc', hostName, socket.socketId, data.length);\n rpcPeer.packAndSend(`socketData/${socket.socketId}`, data);\n return;\n }\n debug('sending data via rpc', hostName, data.length);\n // hsyncClient.mqConn.publish(pubTopic, data);\n const result = await rpcPeer.methods.receiveListenerData({\n socketId: socket.socketId,\n data: Buffer.from(data).toString('base64'),\n });\n debug('sendData from Listener', result);\n }\n\n socket.on('data', async (data) => {\n debug('socket data', data ? data.length : '');\n // if (!socket.peerConnected) {\n // dataQueue.push(data);\n // return;\n // }\n sendData(data);\n });\n \n socket.on('close', () => {\n debug('listener socket closed', port, socket.socketId);\n if (sockets[socket.socketId]) {\n delete sockets[socket.socketId];\n }\n });\n \n socket.on('error', (error) => {\n debug('socket error', hostName, socket.socketId, error);\n if (sockets[socket.socketId]) {\n delete sockets[socket.socketId];\n }\n });\n \n try {\n debug('connecting remotely', socket.socketId, targetPort, rpcPeer.hostName, targetHost);\n const result = await rpcPeer.methods.connectSocket({\n socketId: socket.socketId,\n port: targetPort,\n hostName: rpcPeer.hostName,\n wut: 'huh',\n });\n debug('connect result', result);\n socket.peerConnected = true;\n dataQueue.forEach(sendData); \n } catch (e) {\n debugError('cant connect remotely', hostName, targetPort, e);\n if (sockets[socket.socketId]) {\n delete sockets[socket.socketId];\n }\n socket.end();\n }\n });\n\n socketServer.listen(port);\n\n function end() {\n const sockKeys = Object.keys(sockets);\n sockKeys.forEach((sk) => {\n try {\n sockets[sk].end();\n delete sockets[sk];\n }\n catch(e) {\n debug('error closing socket', e);\n }\n });\n }\n\n return {\n socketServer,\n sockets,\n end,\n };\n}\n\nmodule.exports = { \n createSocketListenHandler,\n receiveRelayData,\n setNet,\n};\n\n//# sourceURL=webpack://hsync/./lib/socket-listen-handler.js?");
79
+
80
+ /***/ }),
81
+
82
+ /***/ "./lib/socket-map.js":
83
+ /*!***************************!*\
84
+ !*** ./lib/socket-map.js ***!
85
+ \***************************/
86
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
87
+
88
+ eval("const debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:socket-map');\nconst sockets = {};\n\nfunction handleSocketPacket(packet) {\n const [topic, socketId] = packet.topic.split('/');\n const socket = sockets[socketId];\n if (!socket) {\n return;\n }\n if (topic === 'socketData') {\n debug('socketData', typeof packet.payload, !!socket.listenerSocket, packet.payload.length);\n socket.write(packet.payload);\n }\n}\n\nmodule.exports = {\n sockets,\n handleSocketPacket,\n};\n\n//# sourceURL=webpack://hsync/./lib/socket-map.js?");
69
89
 
70
90
  /***/ }),
71
91
 
@@ -75,7 +95,7 @@ eval("const b64id = __webpack_require__(/*! b64id */ \"./node_modules/b64id/inde
75
95
  \*************************************/
76
96
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
77
97
 
78
- eval("const b64id = __webpack_require__(/*! b64id */ \"./node_modules/b64id/index.js\");\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:relay');\nconst debugError = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:error');\n// const { getRTCPeer } = require('./data-channel');\nconst { getRPCPeer } = __webpack_require__(/*! ./rpc */ \"./lib/rpc.js\");\n\ndebugError.color = 1;\n\nlet net;\n\nfunction setNet(netImpl) {\n net = netImpl;\n}\n\n\nconst relays = {};\nconst sockets = {};\n\nfunction receiveListenerData(requestInfo, { socketId, data }) {\n debug('receiveListenerData', socketId, data, 'sockets', Object.keys(sockets));\n if (!sockets[socketId]) {\n throw new Error('relay has no matching socket for listener : ' + socketId);\n }\n let dataBuffer = data;\n if (typeof dataBuffer === 'string') {\n dataBuffer = Buffer.from(dataBuffer, 'base64');\n }\n sockets[socketId].write(dataBuffer);\n return 'ok';\n}\n\nfunction connectSocket({ hsyncClient, fromHost }, {port, socketId}) {\n const relay = relays['p' + port];\n debug('connect relay', port, socketId);\n if (!relay) {\n throw new Error('no relay found for port: ' + port);\n }\n const rpcPeer = getRPCPeer({hostName: fromHost, hsyncClient});\n // const relayDataTopic = `msg/${hostName}/${hsyncClient.myHostName}/relayData/${socketId}`;\n return new Promise((resolve, reject) => {\n const socket = new net.Socket();\n socket.socketId = socketId;\n sockets[socketId] = socket;\n socket.connect(relay.targetPort, relay.targetHost, () => {\n debug(`CONNECTED TO LOCAL SERVER`, socket.socketId, socket.hostName);\n resolve({socketId, targetHost: relay.targetHost, targetPort: relay.targetPort});\n });\n\n socket.on('data', async (data) => {\n debug(`data in ${socket.socketId}`, relay.targetPort, relay.targetHost, data.length);\n const result = await rpcPeer.methods.receiveRelayData({\n socketId,\n data: Buffer.from(data).toString('base64'),\n });\n // const p = getRTCPeer(hostName, hsyncClient);\n // if (p.connected) {\n // p.send(`relayData/${socketId}`, data);\n // return;\n // }\n // hsyncClient.mqConn.publish(relayDataTopic, data);\n });\n socket.on('close', () => {\n debug(`LOCAL CONNECTION CLOSED`, socket.socketId, targetHost, targetPort);\n delete sockets[socket.socketId];\n });\n\n socket.on('error', (e) => {\n debugError(`LOCAL CONNECTION ERROR`, socket.socketId, targetHost, targetPort, e);\n delete sockets[socket.socketId];\n reject(e);\n });\n \n });\n\n}\n\n// function receiveSocketData(socketId, data) {\n// if (sockets[socketId]) {\n// debug('receiveSocketData', socketId, data.length);\n// sockets[socketId].write(data);\n// return 'ok';\n// }\n\n// throw new Error('socket not found: ' + socketId);\n// }\n\nfunction createSocketRelayHandler({hostName, port, targetPort, targetHost, hsyncClient}) {\n debug('creating relay', hostName, port, targetPort, targetHost);\n relays['p' + port] = {\n hostName,\n port,\n targetPort,\n targetHost,\n };\n}\n\nmodule.exports = {\n createSocketRelayHandler,\n connectSocket,\n // receiveSocketData,\n setNet,\n receiveListenerData,\n};\n\n//# sourceURL=webpack://hsync/./lib/socket-relay-handler.js?");
98
+ eval("const debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:relay');\nconst debugError = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('hsync:error');\nconst { getRPCPeer } = __webpack_require__(/*! ./peers */ \"./lib/peers.js\");\nconst { sockets } = __webpack_require__(/*! ./socket-map */ \"./lib/socket-map.js\");\n\ndebugError.color = 1;\n\nlet net;\n\nfunction setNet(netImpl) {\n net = netImpl;\n}\n\nconst relays = {};\n\nfunction receiveListenerData(remotePeer, { socketId, data }) {\n debug('receiveListenerData', socketId, data, 'sockets', Object.keys(sockets));\n if (!sockets[socketId]) {\n throw new Error('relay has no matching socket for listener : ' + socketId);\n }\n let dataBuffer = data;\n if (typeof dataBuffer === 'string') {\n dataBuffer = Buffer.from(dataBuffer, 'base64');\n }\n sockets[socketId].write(dataBuffer);\n return 'receiveListenerData ok';\n}\n\nfunction connectSocket(remotePeer, { hsyncClient, fromHost, port, socketId}) {\n const relay = relays['p' + port];\n debug('connect relay', port, socketId);\n if (!relay) {\n throw new Error('no relay found for port: ' + port);\n }\n // const rpcPeer = getRPCPeer({hostName: fromHost, hsyncClient});\n // const relayDataTopic = `msg/${hostName}/${hsyncClient.myHostName}/relayData/${socketId}`;\n return new Promise((resolve, reject) => {\n const socket = new net.Socket();\n socket.socketId = socketId;\n sockets[socketId] = socket;\n socket.connect(relay.targetPort, relay.targetHost, () => {\n debug(`CONNECTED TO LOCAL SERVER`, socket.socketId, socket.hostName);\n resolve({socketId, targetHost: relay.targetHost, targetPort: relay.targetPort});\n });\n\n socket.on('data', async (data) => {\n debug(`data in ${socket.socketId}`, relay.targetPort, relay.targetHost, data.length);\n if (remotePeer.packAndSend) {\n debug('sending relay data via rtc', socket.socketId, data.length);\n remotePeer.packAndSend(`socketData/${socket.socketId}`, Buffer.from(data));\n return;\n }\n const result = await remotePeer.methods.receiveRelayData({\n socketId,\n data: Buffer.from(data).toString('base64'),\n });\n // const p = getRTCPeer(hostName, hsyncClient);\n // if (p.connected) {\n // p.send(`relayData/${socketId}`, data);\n // return;\n // }\n // hsyncClient.mqConn.publish(relayDataTopic, data);\n });\n socket.on('close', () => {\n debug(`LOCAL CONNECTION CLOSED`, socket.socketId, targetHost, targetPort);\n delete sockets[socket.socketId];\n });\n\n socket.on('error', (e) => {\n debugError(`LOCAL CONNECTION ERROR`, socket.socketId, targetHost, targetPort, e);\n delete sockets[socket.socketId];\n reject(e);\n });\n \n });\n\n}\n\n// function receiveSocketData(socketId, data) {\n// if (sockets[socketId]) {\n// debug('receiveSocketData', socketId, data.length);\n// sockets[socketId].write(data);\n// return 'ok';\n// }\n\n// throw new Error('socket not found: ' + socketId);\n// }\n\nfunction createSocketRelayHandler({hostName, port, targetPort, targetHost, hsyncClient}) {\n debug('creating relay', hostName, port, targetPort, targetHost);\n relays['p' + port] = {\n hostName,\n port,\n targetPort,\n targetHost,\n };\n}\n\nmodule.exports = {\n createSocketRelayHandler,\n connectSocket,\n // receiveSocketData,\n setNet,\n receiveListenerData,\n};\n\n//# sourceURL=webpack://hsync/./lib/socket-relay-handler.js?");
79
99
 
80
100
  /***/ }),
81
101
 
@@ -95,7 +115,7 @@ eval("const debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/
95
115
  \*************************************/
96
116
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
97
117
 
98
- eval("const base64 = __webpack_require__(/*! base64-url */ \"./node_modules/base64-url/index.js\");\nconst uuidv4 = __webpack_require__(/*! uuid/v4 */ \"./node_modules/uuid/v4.js\");\n\nfunction uuidToB64(uuidStr) {\n const buf = Buffer.from(uuidStr.replace(/\\-/g, ''), 'hex');\n return base64.encode(buf);\n}\n\nfunction b64ToUuid(b64Str) {\n const uuid = Buffer.from(base64.unescape(b64Str), 'base64').toString('hex');\n return `${uuid.substring(0, 8)}-${uuid.substring(8, 12)}-${uuid.substring(12, 16)}-${uuid.substring(16, 20)}-${uuid.substring(20)}`;\n}\n\nfunction generateId() {\n return uuidToB64(uuidv4());\n}\n\nmodule.exports = {\n b64ToUuid,\n uuidToB64,\n generateId\n};\n\n//# sourceURL=webpack://hsync/./node_modules/b64id/index.js?");
118
+ eval("const base64 = __webpack_require__(/*! base64-url */ \"./node_modules/base64-url/index.js\");\nconst uuidv4 = (__webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/commonjs-browser/index.js\").v4);\n\nfunction uuidToB64(uuidStr) {\n const buf = Buffer.from(uuidStr.replace(/\\-/g, ''), 'hex');\n return base64.encode(buf);\n}\n\nfunction b64ToUuid(b64Str) {\n const uuid = Buffer.from(base64.unescape(b64Str), 'base64').toString('hex');\n return `${uuid.substring(0, 8)}-${uuid.substring(8, 12)}-${uuid.substring(12, 16)}-${uuid.substring(16, 20)}-${uuid.substring(20)}`;\n}\n\nfunction generateId() {\n return uuidToB64(uuidv4());\n}\n\nmodule.exports = {\n b64ToUuid,\n uuidToB64,\n generateId\n};\n\n//# sourceURL=webpack://hsync/./node_modules/b64id/index.js?");
99
119
 
100
120
  /***/ }),
101
121
 
@@ -173,6 +193,16 @@ eval("/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org
173
193
 
174
194
  /***/ }),
175
195
 
196
+ /***/ "./node_modules/inherits/inherits_browser.js":
197
+ /*!***************************************************!*\
198
+ !*** ./node_modules/inherits/inherits_browser.js ***!
199
+ \***************************************************/
200
+ /***/ ((module) => {
201
+
202
+ eval("if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n\n\n//# sourceURL=webpack://hsync/./node_modules/inherits/inherits_browser.js?");
203
+
204
+ /***/ }),
205
+
176
206
  /***/ "./node_modules/isomorphic-fetch/fetch-npm-browserify.js":
177
207
  /*!***************************************************************!*\
178
208
  !*** ./node_modules/isomorphic-fetch/fetch-npm-browserify.js ***!
@@ -183,6 +213,108 @@ eval("// the whatwg-fetch polyfill installs the fetch() function\n// on the glob
183
213
 
184
214
  /***/ }),
185
215
 
216
+ /***/ "./node_modules/mqtt-packet-web/index.js":
217
+ /*!***********************************************!*\
218
+ !*** ./node_modules/mqtt-packet-web/index.js ***!
219
+ \***********************************************/
220
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
221
+
222
+ eval("const buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\nglobalThis.Buffer = buffer.Buffer;\nconst mqtt = __webpack_require__(/*! mqtt-packet */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/mqtt.js\");\nmodule.exports = mqtt;\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/index.js?");
223
+
224
+ /***/ }),
225
+
226
+ /***/ "./node_modules/mqtt-packet-web/node_modules/bl/BufferList.js":
227
+ /*!********************************************************************!*\
228
+ !*** ./node_modules/mqtt-packet-web/node_modules/bl/BufferList.js ***!
229
+ \********************************************************************/
230
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
231
+
232
+ "use strict";
233
+ eval("\n\nconst { Buffer } = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\nconst symbol = Symbol.for('BufferList')\n\nfunction BufferList (buf) {\n if (!(this instanceof BufferList)) {\n return new BufferList(buf)\n }\n\n BufferList._init.call(this, buf)\n}\n\nBufferList._init = function _init (buf) {\n Object.defineProperty(this, symbol, { value: true })\n\n this._bufs = []\n this.length = 0\n\n if (buf) {\n this.append(buf)\n }\n}\n\nBufferList.prototype._new = function _new (buf) {\n return new BufferList(buf)\n}\n\nBufferList.prototype._offset = function _offset (offset) {\n if (offset === 0) {\n return [0, 0]\n }\n\n let tot = 0\n\n for (let i = 0; i < this._bufs.length; i++) {\n const _t = tot + this._bufs[i].length\n if (offset < _t || i === this._bufs.length - 1) {\n return [i, offset - tot]\n }\n tot = _t\n }\n}\n\nBufferList.prototype._reverseOffset = function (blOffset) {\n const bufferId = blOffset[0]\n let offset = blOffset[1]\n\n for (let i = 0; i < bufferId; i++) {\n offset += this._bufs[i].length\n }\n\n return offset\n}\n\nBufferList.prototype.get = function get (index) {\n if (index > this.length || index < 0) {\n return undefined\n }\n\n const offset = this._offset(index)\n\n return this._bufs[offset[0]][offset[1]]\n}\n\nBufferList.prototype.slice = function slice (start, end) {\n if (typeof start === 'number' && start < 0) {\n start += this.length\n }\n\n if (typeof end === 'number' && end < 0) {\n end += this.length\n }\n\n return this.copy(null, 0, start, end)\n}\n\nBufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {\n if (typeof srcStart !== 'number' || srcStart < 0) {\n srcStart = 0\n }\n\n if (typeof srcEnd !== 'number' || srcEnd > this.length) {\n srcEnd = this.length\n }\n\n if (srcStart >= this.length) {\n return dst || Buffer.alloc(0)\n }\n\n if (srcEnd <= 0) {\n return dst || Buffer.alloc(0)\n }\n\n const copy = !!dst\n const off = this._offset(srcStart)\n const len = srcEnd - srcStart\n let bytes = len\n let bufoff = (copy && dstStart) || 0\n let start = off[1]\n\n // copy/slice everything\n if (srcStart === 0 && srcEnd === this.length) {\n if (!copy) {\n // slice, but full concat if multiple buffers\n return this._bufs.length === 1\n ? this._bufs[0]\n : Buffer.concat(this._bufs, this.length)\n }\n\n // copy, need to copy individual buffers\n for (let i = 0; i < this._bufs.length; i++) {\n this._bufs[i].copy(dst, bufoff)\n bufoff += this._bufs[i].length\n }\n\n return dst\n }\n\n // easy, cheap case where it's a subset of one of the buffers\n if (bytes <= this._bufs[off[0]].length - start) {\n return copy\n ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)\n : this._bufs[off[0]].slice(start, start + bytes)\n }\n\n if (!copy) {\n // a slice, we need something to copy in to\n dst = Buffer.allocUnsafe(len)\n }\n\n for (let i = off[0]; i < this._bufs.length; i++) {\n const l = this._bufs[i].length - start\n\n if (bytes > l) {\n this._bufs[i].copy(dst, bufoff, start)\n bufoff += l\n } else {\n this._bufs[i].copy(dst, bufoff, start, start + bytes)\n bufoff += l\n break\n }\n\n bytes -= l\n\n if (start) {\n start = 0\n }\n }\n\n // safeguard so that we don't return uninitialized memory\n if (dst.length > bufoff) return dst.slice(0, bufoff)\n\n return dst\n}\n\nBufferList.prototype.shallowSlice = function shallowSlice (start, end) {\n start = start || 0\n end = typeof end !== 'number' ? this.length : end\n\n if (start < 0) {\n start += this.length\n }\n\n if (end < 0) {\n end += this.length\n }\n\n if (start === end) {\n return this._new()\n }\n\n const startOffset = this._offset(start)\n const endOffset = this._offset(end)\n const buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)\n\n if (endOffset[1] === 0) {\n buffers.pop()\n } else {\n buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1])\n }\n\n if (startOffset[1] !== 0) {\n buffers[0] = buffers[0].slice(startOffset[1])\n }\n\n return this._new(buffers)\n}\n\nBufferList.prototype.toString = function toString (encoding, start, end) {\n return this.slice(start, end).toString(encoding)\n}\n\nBufferList.prototype.consume = function consume (bytes) {\n // first, normalize the argument, in accordance with how Buffer does it\n bytes = Math.trunc(bytes)\n // do nothing if not a positive number\n if (Number.isNaN(bytes) || bytes <= 0) return this\n\n while (this._bufs.length) {\n if (bytes >= this._bufs[0].length) {\n bytes -= this._bufs[0].length\n this.length -= this._bufs[0].length\n this._bufs.shift()\n } else {\n this._bufs[0] = this._bufs[0].slice(bytes)\n this.length -= bytes\n break\n }\n }\n\n return this\n}\n\nBufferList.prototype.duplicate = function duplicate () {\n const copy = this._new()\n\n for (let i = 0; i < this._bufs.length; i++) {\n copy.append(this._bufs[i])\n }\n\n return copy\n}\n\nBufferList.prototype.append = function append (buf) {\n if (buf == null) {\n return this\n }\n\n if (buf.buffer) {\n // append a view of the underlying ArrayBuffer\n this._appendBuffer(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength))\n } else if (Array.isArray(buf)) {\n for (let i = 0; i < buf.length; i++) {\n this.append(buf[i])\n }\n } else if (this._isBufferList(buf)) {\n // unwrap argument into individual BufferLists\n for (let i = 0; i < buf._bufs.length; i++) {\n this.append(buf._bufs[i])\n }\n } else {\n // coerce number arguments to strings, since Buffer(number) does\n // uninitialized memory allocation\n if (typeof buf === 'number') {\n buf = buf.toString()\n }\n\n this._appendBuffer(Buffer.from(buf))\n }\n\n return this\n}\n\nBufferList.prototype._appendBuffer = function appendBuffer (buf) {\n this._bufs.push(buf)\n this.length += buf.length\n}\n\nBufferList.prototype.indexOf = function (search, offset, encoding) {\n if (encoding === undefined && typeof offset === 'string') {\n encoding = offset\n offset = undefined\n }\n\n if (typeof search === 'function' || Array.isArray(search)) {\n throw new TypeError('The \"value\" argument must be one of type string, Buffer, BufferList, or Uint8Array.')\n } else if (typeof search === 'number') {\n search = Buffer.from([search])\n } else if (typeof search === 'string') {\n search = Buffer.from(search, encoding)\n } else if (this._isBufferList(search)) {\n search = search.slice()\n } else if (Array.isArray(search.buffer)) {\n search = Buffer.from(search.buffer, search.byteOffset, search.byteLength)\n } else if (!Buffer.isBuffer(search)) {\n search = Buffer.from(search)\n }\n\n offset = Number(offset || 0)\n\n if (isNaN(offset)) {\n offset = 0\n }\n\n if (offset < 0) {\n offset = this.length + offset\n }\n\n if (offset < 0) {\n offset = 0\n }\n\n if (search.length === 0) {\n return offset > this.length ? this.length : offset\n }\n\n const blOffset = this._offset(offset)\n let blIndex = blOffset[0] // index of which internal buffer we're working on\n let buffOffset = blOffset[1] // offset of the internal buffer we're working on\n\n // scan over each buffer\n for (; blIndex < this._bufs.length; blIndex++) {\n const buff = this._bufs[blIndex]\n\n while (buffOffset < buff.length) {\n const availableWindow = buff.length - buffOffset\n\n if (availableWindow >= search.length) {\n const nativeSearchResult = buff.indexOf(search, buffOffset)\n\n if (nativeSearchResult !== -1) {\n return this._reverseOffset([blIndex, nativeSearchResult])\n }\n\n buffOffset = buff.length - search.length + 1 // end of native search window\n } else {\n const revOffset = this._reverseOffset([blIndex, buffOffset])\n\n if (this._match(revOffset, search)) {\n return revOffset\n }\n\n buffOffset++\n }\n }\n\n buffOffset = 0\n }\n\n return -1\n}\n\nBufferList.prototype._match = function (offset, search) {\n if (this.length - offset < search.length) {\n return false\n }\n\n for (let searchOffset = 0; searchOffset < search.length; searchOffset++) {\n if (this.get(offset + searchOffset) !== search[searchOffset]) {\n return false\n }\n }\n return true\n}\n\n;(function () {\n const methods = {\n readDoubleBE: 8,\n readDoubleLE: 8,\n readFloatBE: 4,\n readFloatLE: 4,\n readInt32BE: 4,\n readInt32LE: 4,\n readUInt32BE: 4,\n readUInt32LE: 4,\n readInt16BE: 2,\n readInt16LE: 2,\n readUInt16BE: 2,\n readUInt16LE: 2,\n readInt8: 1,\n readUInt8: 1,\n readIntBE: null,\n readIntLE: null,\n readUIntBE: null,\n readUIntLE: null\n }\n\n for (const m in methods) {\n (function (m) {\n if (methods[m] === null) {\n BufferList.prototype[m] = function (offset, byteLength) {\n return this.slice(offset, offset + byteLength)[m](0, byteLength)\n }\n } else {\n BufferList.prototype[m] = function (offset = 0) {\n return this.slice(offset, offset + methods[m])[m](0)\n }\n }\n }(m))\n }\n}())\n\n// Used internally by the class and also as an indicator of this object being\n// a `BufferList`. It's not possible to use `instanceof BufferList` in a browser\n// environment because there could be multiple different copies of the\n// BufferList class and some `BufferList`s might be `BufferList`s.\nBufferList.prototype._isBufferList = function _isBufferList (b) {\n return b instanceof BufferList || BufferList.isBufferList(b)\n}\n\nBufferList.isBufferList = function isBufferList (b) {\n return b != null && b[symbol]\n}\n\nmodule.exports = BufferList\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/bl/BufferList.js?");
234
+
235
+ /***/ }),
236
+
237
+ /***/ "./node_modules/mqtt-packet-web/node_modules/bl/bl.js":
238
+ /*!************************************************************!*\
239
+ !*** ./node_modules/mqtt-packet-web/node_modules/bl/bl.js ***!
240
+ \************************************************************/
241
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
242
+
243
+ "use strict";
244
+ eval("\n\nconst DuplexStream = (__webpack_require__(/*! readable-stream */ \"./node_modules/readable-stream/readable-browser.js\").Duplex)\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")\nconst BufferList = __webpack_require__(/*! ./BufferList */ \"./node_modules/mqtt-packet-web/node_modules/bl/BufferList.js\")\n\nfunction BufferListStream (callback) {\n if (!(this instanceof BufferListStream)) {\n return new BufferListStream(callback)\n }\n\n if (typeof callback === 'function') {\n this._callback = callback\n\n const piper = function piper (err) {\n if (this._callback) {\n this._callback(err)\n this._callback = null\n }\n }.bind(this)\n\n this.on('pipe', function onPipe (src) {\n src.on('error', piper)\n })\n this.on('unpipe', function onUnpipe (src) {\n src.removeListener('error', piper)\n })\n\n callback = null\n }\n\n BufferList._init.call(this, callback)\n DuplexStream.call(this)\n}\n\ninherits(BufferListStream, DuplexStream)\nObject.assign(BufferListStream.prototype, BufferList.prototype)\n\nBufferListStream.prototype._new = function _new (callback) {\n return new BufferListStream(callback)\n}\n\nBufferListStream.prototype._write = function _write (buf, encoding, callback) {\n this._appendBuffer(buf)\n\n if (typeof callback === 'function') {\n callback()\n }\n}\n\nBufferListStream.prototype._read = function _read (size) {\n if (!this.length) {\n return this.push(null)\n }\n\n size = Math.min(size, this.length)\n this.push(this.slice(0, size))\n this.consume(size)\n}\n\nBufferListStream.prototype.end = function end (chunk) {\n DuplexStream.prototype.end.call(this, chunk)\n\n if (this._callback) {\n this._callback(null, this.slice())\n this._callback = null\n }\n}\n\nBufferListStream.prototype._destroy = function _destroy (err, cb) {\n this._bufs.length = 0\n this.length = 0\n cb(err)\n}\n\nBufferListStream.prototype._isBufferList = function _isBufferList (b) {\n return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b)\n}\n\nBufferListStream.isBufferList = BufferList.isBufferList\n\nmodule.exports = BufferListStream\nmodule.exports.BufferListStream = BufferListStream\nmodule.exports.BufferList = BufferList\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/bl/bl.js?");
245
+
246
+ /***/ }),
247
+
248
+ /***/ "./node_modules/mqtt-packet-web/node_modules/mqtt-packet/constants.js":
249
+ /*!****************************************************************************!*\
250
+ !*** ./node_modules/mqtt-packet-web/node_modules/mqtt-packet/constants.js ***!
251
+ \****************************************************************************/
252
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
253
+
254
+ eval("/* Protocol - protocol constants */\nconst protocol = module.exports\nconst { Buffer } = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\n\n/* Command code => mnemonic */\nprotocol.types = {\n 0: 'reserved',\n 1: 'connect',\n 2: 'connack',\n 3: 'publish',\n 4: 'puback',\n 5: 'pubrec',\n 6: 'pubrel',\n 7: 'pubcomp',\n 8: 'subscribe',\n 9: 'suback',\n 10: 'unsubscribe',\n 11: 'unsuback',\n 12: 'pingreq',\n 13: 'pingresp',\n 14: 'disconnect',\n 15: 'auth'\n}\n\nprotocol.requiredHeaderFlags = {\n 1: 0, // 'connect'\n 2: 0, // 'connack'\n 4: 0, // 'puback'\n 5: 0, // 'pubrec'\n 6: 2, // 'pubrel'\n 7: 0, // 'pubcomp'\n 8: 2, // 'subscribe'\n 9: 0, // 'suback'\n 10: 2, // 'unsubscribe'\n 11: 0, // 'unsuback'\n 12: 0, // 'pingreq'\n 13: 0, // 'pingresp'\n 14: 0, // 'disconnect'\n 15: 0 // 'auth'\n}\n\nprotocol.requiredHeaderFlagsErrors = {}\nfor (const k in protocol.requiredHeaderFlags) {\n const v = protocol.requiredHeaderFlags[k]\n protocol.requiredHeaderFlagsErrors[k] = 'Invalid header flag bits, must be 0x' + v.toString(16) + ' for ' + protocol.types[k] + ' packet'\n}\n\n/* Mnemonic => Command code */\nprotocol.codes = {}\nfor (const k in protocol.types) {\n const v = protocol.types[k]\n protocol.codes[v] = k\n}\n\n/* Header */\nprotocol.CMD_SHIFT = 4\nprotocol.CMD_MASK = 0xF0\nprotocol.DUP_MASK = 0x08\nprotocol.QOS_MASK = 0x03\nprotocol.QOS_SHIFT = 1\nprotocol.RETAIN_MASK = 0x01\n\n/* Length */\nprotocol.VARBYTEINT_MASK = 0x7F\nprotocol.VARBYTEINT_FIN_MASK = 0x80\nprotocol.VARBYTEINT_MAX = 268435455\n\n/* Connack */\nprotocol.SESSIONPRESENT_MASK = 0x01\nprotocol.SESSIONPRESENT_HEADER = Buffer.from([protocol.SESSIONPRESENT_MASK])\nprotocol.CONNACK_HEADER = Buffer.from([protocol.codes.connack << protocol.CMD_SHIFT])\n\n/* Connect */\nprotocol.USERNAME_MASK = 0x80\nprotocol.PASSWORD_MASK = 0x40\nprotocol.WILL_RETAIN_MASK = 0x20\nprotocol.WILL_QOS_MASK = 0x18\nprotocol.WILL_QOS_SHIFT = 3\nprotocol.WILL_FLAG_MASK = 0x04\nprotocol.CLEAN_SESSION_MASK = 0x02\nprotocol.CONNECT_HEADER = Buffer.from([protocol.codes.connect << protocol.CMD_SHIFT])\n\n/* Properties */\nprotocol.properties = {\n sessionExpiryInterval: 17,\n willDelayInterval: 24,\n receiveMaximum: 33,\n maximumPacketSize: 39,\n topicAliasMaximum: 34,\n requestResponseInformation: 25,\n requestProblemInformation: 23,\n userProperties: 38,\n authenticationMethod: 21,\n authenticationData: 22,\n payloadFormatIndicator: 1,\n messageExpiryInterval: 2,\n contentType: 3,\n responseTopic: 8,\n correlationData: 9,\n maximumQoS: 36,\n retainAvailable: 37,\n assignedClientIdentifier: 18,\n reasonString: 31,\n wildcardSubscriptionAvailable: 40,\n subscriptionIdentifiersAvailable: 41,\n sharedSubscriptionAvailable: 42,\n serverKeepAlive: 19,\n responseInformation: 26,\n serverReference: 28,\n topicAlias: 35,\n subscriptionIdentifier: 11\n}\nprotocol.propertiesCodes = {}\nfor (const prop in protocol.properties) {\n const id = protocol.properties[prop]\n protocol.propertiesCodes[id] = prop\n}\nprotocol.propertiesTypes = {\n sessionExpiryInterval: 'int32',\n willDelayInterval: 'int32',\n receiveMaximum: 'int16',\n maximumPacketSize: 'int32',\n topicAliasMaximum: 'int16',\n requestResponseInformation: 'byte',\n requestProblemInformation: 'byte',\n userProperties: 'pair',\n authenticationMethod: 'string',\n authenticationData: 'binary',\n payloadFormatIndicator: 'byte',\n messageExpiryInterval: 'int32',\n contentType: 'string',\n responseTopic: 'string',\n correlationData: 'binary',\n maximumQoS: 'int8',\n retainAvailable: 'byte',\n assignedClientIdentifier: 'string',\n reasonString: 'string',\n wildcardSubscriptionAvailable: 'byte',\n subscriptionIdentifiersAvailable: 'byte',\n sharedSubscriptionAvailable: 'byte',\n serverKeepAlive: 'int16',\n responseInformation: 'string',\n serverReference: 'string',\n topicAlias: 'int16',\n subscriptionIdentifier: 'var'\n}\n\nfunction genHeader (type) {\n return [0, 1, 2].map(qos => {\n return [0, 1].map(dup => {\n return [0, 1].map(retain => {\n const buf = Buffer.alloc(1)\n buf.writeUInt8(\n protocol.codes[type] << protocol.CMD_SHIFT |\n (dup ? protocol.DUP_MASK : 0) |\n qos << protocol.QOS_SHIFT | retain, 0, true)\n return buf\n })\n })\n })\n}\n\n/* Publish */\nprotocol.PUBLISH_HEADER = genHeader('publish')\n\n/* Subscribe */\nprotocol.SUBSCRIBE_HEADER = genHeader('subscribe')\nprotocol.SUBSCRIBE_OPTIONS_QOS_MASK = 0x03\nprotocol.SUBSCRIBE_OPTIONS_NL_MASK = 0x01\nprotocol.SUBSCRIBE_OPTIONS_NL_SHIFT = 2\nprotocol.SUBSCRIBE_OPTIONS_RAP_MASK = 0x01\nprotocol.SUBSCRIBE_OPTIONS_RAP_SHIFT = 3\nprotocol.SUBSCRIBE_OPTIONS_RH_MASK = 0x03\nprotocol.SUBSCRIBE_OPTIONS_RH_SHIFT = 4\nprotocol.SUBSCRIBE_OPTIONS_RH = [0x00, 0x10, 0x20]\nprotocol.SUBSCRIBE_OPTIONS_NL = 0x04\nprotocol.SUBSCRIBE_OPTIONS_RAP = 0x08\nprotocol.SUBSCRIBE_OPTIONS_QOS = [0x00, 0x01, 0x02]\n\n/* Unsubscribe */\nprotocol.UNSUBSCRIBE_HEADER = genHeader('unsubscribe')\n\n/* Confirmations */\nprotocol.ACKS = {\n unsuback: genHeader('unsuback'),\n puback: genHeader('puback'),\n pubcomp: genHeader('pubcomp'),\n pubrel: genHeader('pubrel'),\n pubrec: genHeader('pubrec')\n}\n\nprotocol.SUBACK_HEADER = Buffer.from([protocol.codes.suback << protocol.CMD_SHIFT])\n\n/* Protocol versions */\nprotocol.VERSION3 = Buffer.from([3])\nprotocol.VERSION4 = Buffer.from([4])\nprotocol.VERSION5 = Buffer.from([5])\nprotocol.VERSION131 = Buffer.from([131])\nprotocol.VERSION132 = Buffer.from([132])\n\n/* QoS */\nprotocol.QOS = [0, 1, 2].map(qos => {\n return Buffer.from([qos])\n})\n\n/* Empty packets */\nprotocol.EMPTY = {\n pingreq: Buffer.from([protocol.codes.pingreq << 4, 0]),\n pingresp: Buffer.from([protocol.codes.pingresp << 4, 0]),\n disconnect: Buffer.from([protocol.codes.disconnect << 4, 0])\n}\n\nprotocol.MQTT5_PUBACK_PUBREC_CODES = {\n 0x00: 'Success',\n 0x10: 'No matching subscribers',\n 0x80: 'Unspecified error',\n 0x83: 'Implementation specific error',\n 0x87: 'Not authorized',\n 0x90: 'Topic Name invalid',\n 0x91: 'Packet identifier in use',\n 0x97: 'Quota exceeded',\n 0x99: 'Payload format invalid'\n}\n\nprotocol.MQTT5_PUBREL_PUBCOMP_CODES = {\n 0x00: 'Success',\n 0x92: 'Packet Identifier not found'\n}\n\nprotocol.MQTT5_SUBACK_CODES = {\n 0x00: 'Granted QoS 0',\n 0x01: 'Granted QoS 1',\n 0x02: 'Granted QoS 2',\n 0x80: 'Unspecified error',\n 0x83: 'Implementation specific error',\n 0x87: 'Not authorized',\n 0x8F: 'Topic Filter invalid',\n 0x91: 'Packet Identifier in use',\n 0x97: 'Quota exceeded',\n 0x9E: 'Shared Subscriptions not supported',\n 0xA1: 'Subscription Identifiers not supported',\n 0xA2: 'Wildcard Subscriptions not supported'\n}\n\nprotocol.MQTT5_UNSUBACK_CODES = {\n 0x00: 'Success',\n 0x11: 'No subscription existed',\n 0x80: 'Unspecified error',\n 0x83: 'Implementation specific error',\n 0x87: 'Not authorized',\n 0x8F: 'Topic Filter invalid',\n 0x91: 'Packet Identifier in use'\n}\n\nprotocol.MQTT5_DISCONNECT_CODES = {\n 0x00: 'Normal disconnection',\n 0x04: 'Disconnect with Will Message',\n 0x80: 'Unspecified error',\n 0x81: 'Malformed Packet',\n 0x82: 'Protocol Error',\n 0x83: 'Implementation specific error',\n 0x87: 'Not authorized',\n 0x89: 'Server busy',\n 0x8B: 'Server shutting down',\n 0x8D: 'Keep Alive timeout',\n 0x8E: 'Session taken over',\n 0x8F: 'Topic Filter invalid',\n 0x90: 'Topic Name invalid',\n 0x93: 'Receive Maximum exceeded',\n 0x94: 'Topic Alias invalid',\n 0x95: 'Packet too large',\n 0x96: 'Message rate too high',\n 0x97: 'Quota exceeded',\n 0x98: 'Administrative action',\n 0x99: 'Payload format invalid',\n 0x9A: 'Retain not supported',\n 0x9B: 'QoS not supported',\n 0x9C: 'Use another server',\n 0x9D: 'Server moved',\n 0x9E: 'Shared Subscriptions not supported',\n 0x9F: 'Connection rate exceeded',\n 0xA0: 'Maximum connect time',\n 0xA1: 'Subscription Identifiers not supported',\n 0xA2: 'Wildcard Subscriptions not supported'\n}\n\nprotocol.MQTT5_AUTH_CODES = {\n 0x00: 'Success',\n 0x18: 'Continue authentication',\n 0x19: 'Re-authenticate'\n}\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/mqtt-packet/constants.js?");
255
+
256
+ /***/ }),
257
+
258
+ /***/ "./node_modules/mqtt-packet-web/node_modules/mqtt-packet/generate.js":
259
+ /*!***************************************************************************!*\
260
+ !*** ./node_modules/mqtt-packet-web/node_modules/mqtt-packet/generate.js ***!
261
+ \***************************************************************************/
262
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
263
+
264
+ eval("const writeToStream = __webpack_require__(/*! ./writeToStream */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/writeToStream.js\")\nconst EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\")\nconst { Buffer } = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\n\nfunction generate (packet, opts) {\n const stream = new Accumulator()\n writeToStream(packet, stream, opts)\n return stream.concat()\n}\n\nclass Accumulator extends EventEmitter {\n constructor () {\n super()\n this._array = new Array(20)\n this._i = 0\n }\n\n write (chunk) {\n this._array[this._i++] = chunk\n return true\n }\n\n concat () {\n let length = 0\n const lengths = new Array(this._array.length)\n const list = this._array\n let pos = 0\n let i\n\n for (i = 0; i < list.length && list[i] !== undefined; i++) {\n if (typeof list[i] !== 'string') lengths[i] = list[i].length\n else lengths[i] = Buffer.byteLength(list[i])\n\n length += lengths[i]\n }\n\n const result = Buffer.allocUnsafe(length)\n\n for (i = 0; i < list.length && list[i] !== undefined; i++) {\n if (typeof list[i] !== 'string') {\n list[i].copy(result, pos)\n pos += lengths[i]\n } else {\n result.write(list[i], pos)\n pos += lengths[i]\n }\n }\n\n return result\n }\n\n destroy (err) {\n if (err) this.emit('error', err)\n }\n}\n\nmodule.exports = generate\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/mqtt-packet/generate.js?");
265
+
266
+ /***/ }),
267
+
268
+ /***/ "./node_modules/mqtt-packet-web/node_modules/mqtt-packet/mqtt.js":
269
+ /*!***********************************************************************!*\
270
+ !*** ./node_modules/mqtt-packet-web/node_modules/mqtt-packet/mqtt.js ***!
271
+ \***********************************************************************/
272
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
273
+
274
+ eval("exports.parser = __webpack_require__(/*! ./parser */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/parser.js\").parser\nexports.generate = __webpack_require__(/*! ./generate */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/generate.js\")\nexports.writeToStream = __webpack_require__(/*! ./writeToStream */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/writeToStream.js\")\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/mqtt-packet/mqtt.js?");
275
+
276
+ /***/ }),
277
+
278
+ /***/ "./node_modules/mqtt-packet-web/node_modules/mqtt-packet/numbers.js":
279
+ /*!**************************************************************************!*\
280
+ !*** ./node_modules/mqtt-packet-web/node_modules/mqtt-packet/numbers.js ***!
281
+ \**************************************************************************/
282
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
283
+
284
+ eval("const { Buffer } = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\nconst max = 65536\nconst cache = {}\n\n// in node 6 Buffer.subarray returns a Uint8Array instead of a Buffer\n// later versions return a Buffer\n// alternative is Buffer.slice but that creates a new buffer\n// creating new buffers takes time\n// SubOk is only false on node < 8\nconst SubOk = Buffer.isBuffer(Buffer.from([1, 2]).subarray(0, 1))\n\nfunction generateBuffer (i) {\n const buffer = Buffer.allocUnsafe(2)\n buffer.writeUInt8(i >> 8, 0)\n buffer.writeUInt8(i & 0x00FF, 0 + 1)\n\n return buffer\n}\n\nfunction generateCache () {\n for (let i = 0; i < max; i++) {\n cache[i] = generateBuffer(i)\n }\n}\n\nfunction genBufVariableByteInt (num) {\n const maxLength = 4 // max 4 bytes\n let digit = 0\n let pos = 0\n const buffer = Buffer.allocUnsafe(maxLength)\n\n do {\n digit = num % 128 | 0\n num = num / 128 | 0\n if (num > 0) digit = digit | 0x80\n\n buffer.writeUInt8(digit, pos++)\n } while (num > 0 && pos < maxLength)\n\n if (num > 0) {\n pos = 0\n }\n\n return SubOk ? buffer.subarray(0, pos) : buffer.slice(0, pos)\n}\n\nfunction generate4ByteBuffer (num) {\n const buffer = Buffer.allocUnsafe(4)\n buffer.writeUInt32BE(num, 0)\n return buffer\n}\n\nmodule.exports = {\n cache,\n generateCache,\n generateNumber: generateBuffer,\n genBufVariableByteInt,\n generate4ByteBuffer\n}\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/mqtt-packet/numbers.js?");
285
+
286
+ /***/ }),
287
+
288
+ /***/ "./node_modules/mqtt-packet-web/node_modules/mqtt-packet/packet.js":
289
+ /*!*************************************************************************!*\
290
+ !*** ./node_modules/mqtt-packet-web/node_modules/mqtt-packet/packet.js ***!
291
+ \*************************************************************************/
292
+ /***/ ((module) => {
293
+
294
+ eval("class Packet {\n constructor () {\n this.cmd = null\n this.retain = false\n this.qos = 0\n this.dup = false\n this.length = -1\n this.topic = null\n this.payload = null\n }\n}\n\nmodule.exports = Packet\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/mqtt-packet/packet.js?");
295
+
296
+ /***/ }),
297
+
298
+ /***/ "./node_modules/mqtt-packet-web/node_modules/mqtt-packet/parser.js":
299
+ /*!*************************************************************************!*\
300
+ !*** ./node_modules/mqtt-packet-web/node_modules/mqtt-packet/parser.js ***!
301
+ \*************************************************************************/
302
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
303
+
304
+ eval("const bl = __webpack_require__(/*! bl */ \"./node_modules/mqtt-packet-web/node_modules/bl/bl.js\")\nconst EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\")\nconst Packet = __webpack_require__(/*! ./packet */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/packet.js\")\nconst constants = __webpack_require__(/*! ./constants */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/constants.js\")\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('mqtt-packet:parser')\n\nclass Parser extends EventEmitter {\n constructor () {\n super()\n this.parser = this.constructor.parser\n }\n\n static parser (opt) {\n if (!(this instanceof Parser)) return (new Parser()).parser(opt)\n\n this.settings = opt || {}\n\n this._states = [\n '_parseHeader',\n '_parseLength',\n '_parsePayload',\n '_newPacket'\n ]\n\n this._resetState()\n return this\n }\n\n _resetState () {\n debug('_resetState: resetting packet, error, _list, and _stateCounter')\n this.packet = new Packet()\n this.error = null\n this._list = bl()\n this._stateCounter = 0\n }\n\n parse (buf) {\n if (this.error) this._resetState()\n\n this._list.append(buf)\n debug('parse: current state: %s', this._states[this._stateCounter])\n while ((this.packet.length !== -1 || this._list.length > 0) &&\n this[this._states[this._stateCounter]]() &&\n !this.error) {\n this._stateCounter++\n debug('parse: state complete. _stateCounter is now: %d', this._stateCounter)\n debug('parse: packet.length: %d, buffer list length: %d', this.packet.length, this._list.length)\n if (this._stateCounter >= this._states.length) this._stateCounter = 0\n }\n debug('parse: exited while loop. packet: %d, buffer list length: %d', this.packet.length, this._list.length)\n return this._list.length\n }\n\n _parseHeader () {\n // There is at least one byte in the buffer\n const zero = this._list.readUInt8(0)\n const cmdIndex = zero >> constants.CMD_SHIFT\n this.packet.cmd = constants.types[cmdIndex]\n const headerFlags = zero & 0xf\n const requiredHeaderFlags = constants.requiredHeaderFlags[cmdIndex]\n if (requiredHeaderFlags != null && headerFlags !== requiredHeaderFlags) {\n // Where a flag bit is marked as “Reserved” in Table 2.2 - Flag Bits, it is reserved for future use and MUST be set to the value listed in that table [MQTT-2.2.2-1]. If invalid flags are received, the receiver MUST close the Network Connection [MQTT-2.2.2-2]\n return this._emitError(new Error(constants.requiredHeaderFlagsErrors[cmdIndex]))\n }\n this.packet.retain = (zero & constants.RETAIN_MASK) !== 0\n this.packet.qos = (zero >> constants.QOS_SHIFT) & constants.QOS_MASK\n if (this.packet.qos > 2) {\n return this._emitError(new Error('Packet must not have both QoS bits set to 1'))\n }\n this.packet.dup = (zero & constants.DUP_MASK) !== 0\n debug('_parseHeader: packet: %o', this.packet)\n\n this._list.consume(1)\n\n return true\n }\n\n _parseLength () {\n // There is at least one byte in the list\n const result = this._parseVarByteNum(true)\n\n if (result) {\n this.packet.length = result.value\n this._list.consume(result.bytes)\n }\n debug('_parseLength %d', result.value)\n return !!result\n }\n\n _parsePayload () {\n debug('_parsePayload: payload %O', this._list)\n let result = false\n\n // Do we have a payload? Do we have enough data to complete the payload?\n // PINGs have no payload\n if (this.packet.length === 0 || this._list.length >= this.packet.length) {\n this._pos = 0\n\n switch (this.packet.cmd) {\n case 'connect':\n this._parseConnect()\n break\n case 'connack':\n this._parseConnack()\n break\n case 'publish':\n this._parsePublish()\n break\n case 'puback':\n case 'pubrec':\n case 'pubrel':\n case 'pubcomp':\n this._parseConfirmation()\n break\n case 'subscribe':\n this._parseSubscribe()\n break\n case 'suback':\n this._parseSuback()\n break\n case 'unsubscribe':\n this._parseUnsubscribe()\n break\n case 'unsuback':\n this._parseUnsuback()\n break\n case 'pingreq':\n case 'pingresp':\n // These are empty, nothing to do\n break\n case 'disconnect':\n this._parseDisconnect()\n break\n case 'auth':\n this._parseAuth()\n break\n default:\n this._emitError(new Error('Not supported'))\n }\n\n result = true\n }\n debug('_parsePayload complete result: %s', result)\n return result\n }\n\n _parseConnect () {\n debug('_parseConnect')\n let topic // Will topic\n let payload // Will payload\n let password // Password\n let username // Username\n const flags = {}\n const packet = this.packet\n\n // Parse protocolId\n const protocolId = this._parseString()\n\n if (protocolId === null) return this._emitError(new Error('Cannot parse protocolId'))\n if (protocolId !== 'MQTT' && protocolId !== 'MQIsdp') {\n return this._emitError(new Error('Invalid protocolId'))\n }\n\n packet.protocolId = protocolId\n\n // Parse constants version number\n if (this._pos >= this._list.length) return this._emitError(new Error('Packet too short'))\n\n packet.protocolVersion = this._list.readUInt8(this._pos)\n\n if (packet.protocolVersion >= 128) {\n packet.bridgeMode = true\n packet.protocolVersion = packet.protocolVersion - 128\n }\n\n if (packet.protocolVersion !== 3 && packet.protocolVersion !== 4 && packet.protocolVersion !== 5) {\n return this._emitError(new Error('Invalid protocol version'))\n }\n\n this._pos++\n\n if (this._pos >= this._list.length) {\n return this._emitError(new Error('Packet too short'))\n }\n\n if (this._list.readUInt8(this._pos) & 0x1) {\n // The Server MUST validate that the reserved flag in the CONNECT Control Packet is set to zero and disconnect the Client if it is not zero [MQTT-3.1.2-3]\n return this._emitError(new Error('Connect flag bit 0 must be 0, but got 1'))\n }\n // Parse connect flags\n flags.username = (this._list.readUInt8(this._pos) & constants.USERNAME_MASK)\n flags.password = (this._list.readUInt8(this._pos) & constants.PASSWORD_MASK)\n flags.will = (this._list.readUInt8(this._pos) & constants.WILL_FLAG_MASK)\n\n const willRetain = !!(this._list.readUInt8(this._pos) & constants.WILL_RETAIN_MASK)\n const willQos = (this._list.readUInt8(this._pos) &\n constants.WILL_QOS_MASK) >> constants.WILL_QOS_SHIFT\n\n if (flags.will) {\n packet.will = {}\n packet.will.retain = willRetain\n packet.will.qos = willQos\n } else {\n if (willRetain) {\n return this._emitError(new Error('Will Retain Flag must be set to zero when Will Flag is set to 0'))\n }\n if (willQos) {\n return this._emitError(new Error('Will QoS must be set to zero when Will Flag is set to 0'))\n }\n }\n\n packet.clean = (this._list.readUInt8(this._pos) & constants.CLEAN_SESSION_MASK) !== 0\n this._pos++\n\n // Parse keepalive\n packet.keepalive = this._parseNum()\n if (packet.keepalive === -1) return this._emitError(new Error('Packet too short'))\n\n // parse properties\n if (packet.protocolVersion === 5) {\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n }\n // Parse clientId\n const clientId = this._parseString()\n if (clientId === null) return this._emitError(new Error('Packet too short'))\n packet.clientId = clientId\n debug('_parseConnect: packet.clientId: %s', packet.clientId)\n\n if (flags.will) {\n if (packet.protocolVersion === 5) {\n const willProperties = this._parseProperties()\n if (Object.getOwnPropertyNames(willProperties).length) {\n packet.will.properties = willProperties\n }\n }\n // Parse will topic\n topic = this._parseString()\n if (topic === null) return this._emitError(new Error('Cannot parse will topic'))\n packet.will.topic = topic\n debug('_parseConnect: packet.will.topic: %s', packet.will.topic)\n\n // Parse will payload\n payload = this._parseBuffer()\n if (payload === null) return this._emitError(new Error('Cannot parse will payload'))\n packet.will.payload = payload\n debug('_parseConnect: packet.will.paylaod: %s', packet.will.payload)\n }\n\n // Parse username\n if (flags.username) {\n username = this._parseString()\n if (username === null) return this._emitError(new Error('Cannot parse username'))\n packet.username = username\n debug('_parseConnect: packet.username: %s', packet.username)\n }\n\n // Parse password\n if (flags.password) {\n password = this._parseBuffer()\n if (password === null) return this._emitError(new Error('Cannot parse password'))\n packet.password = password\n }\n // need for right parse auth packet and self set up\n this.settings = packet\n debug('_parseConnect: complete')\n return packet\n }\n\n _parseConnack () {\n debug('_parseConnack')\n const packet = this.packet\n\n if (this._list.length < 1) return null\n const flags = this._list.readUInt8(this._pos++)\n if (flags > 1) {\n return this._emitError(new Error('Invalid connack flags, bits 7-1 must be set to 0'))\n }\n packet.sessionPresent = !!(flags & constants.SESSIONPRESENT_MASK)\n\n if (this.settings.protocolVersion === 5) {\n if (this._list.length >= 2) {\n packet.reasonCode = this._list.readUInt8(this._pos++)\n } else {\n packet.reasonCode = 0\n }\n } else {\n if (this._list.length < 2) return null\n packet.returnCode = this._list.readUInt8(this._pos++)\n }\n\n if (packet.returnCode === -1 || packet.reasonCode === -1) return this._emitError(new Error('Cannot parse return code'))\n // mqtt 5 properties\n if (this.settings.protocolVersion === 5) {\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n }\n debug('_parseConnack: complete')\n }\n\n _parsePublish () {\n debug('_parsePublish')\n const packet = this.packet\n packet.topic = this._parseString()\n\n if (packet.topic === null) return this._emitError(new Error('Cannot parse topic'))\n\n // Parse messageId\n if (packet.qos > 0) if (!this._parseMessageId()) { return }\n\n // Properties mqtt 5\n if (this.settings.protocolVersion === 5) {\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n }\n\n packet.payload = this._list.slice(this._pos, packet.length)\n debug('_parsePublish: payload from buffer list: %o', packet.payload)\n }\n\n _parseSubscribe () {\n debug('_parseSubscribe')\n const packet = this.packet\n let topic\n let options\n let qos\n let rh\n let rap\n let nl\n let subscription\n\n packet.subscriptions = []\n\n if (!this._parseMessageId()) { return }\n\n // Properties mqtt 5\n if (this.settings.protocolVersion === 5) {\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n }\n\n if (packet.length <= 0) { return this._emitError(new Error('Malformed subscribe, no payload specified')) }\n\n while (this._pos < packet.length) {\n // Parse topic\n topic = this._parseString()\n if (topic === null) return this._emitError(new Error('Cannot parse topic'))\n if (this._pos >= packet.length) return this._emitError(new Error('Malformed Subscribe Payload'))\n\n options = this._parseByte()\n\n if (this.settings.protocolVersion === 5) {\n if (options & 0xc0) {\n return this._emitError(new Error('Invalid subscribe topic flag bits, bits 7-6 must be 0'))\n }\n } else {\n if (options & 0xfc) {\n return this._emitError(new Error('Invalid subscribe topic flag bits, bits 7-2 must be 0'))\n }\n }\n\n qos = options & constants.SUBSCRIBE_OPTIONS_QOS_MASK\n if (qos > 2) {\n return this._emitError(new Error('Invalid subscribe QoS, must be <= 2'))\n }\n nl = ((options >> constants.SUBSCRIBE_OPTIONS_NL_SHIFT) & constants.SUBSCRIBE_OPTIONS_NL_MASK) !== 0\n rap = ((options >> constants.SUBSCRIBE_OPTIONS_RAP_SHIFT) & constants.SUBSCRIBE_OPTIONS_RAP_MASK) !== 0\n rh = (options >> constants.SUBSCRIBE_OPTIONS_RH_SHIFT) & constants.SUBSCRIBE_OPTIONS_RH_MASK\n\n if (rh > 2) {\n return this._emitError(new Error('Invalid retain handling, must be <= 2'))\n }\n\n subscription = { topic, qos }\n\n // mqtt 5 options\n if (this.settings.protocolVersion === 5) {\n subscription.nl = nl\n subscription.rap = rap\n subscription.rh = rh\n } else if (this.settings.bridgeMode) {\n subscription.rh = 0\n subscription.rap = true\n subscription.nl = true\n }\n\n // Push pair to subscriptions\n debug('_parseSubscribe: push subscription `%s` to subscription', subscription)\n packet.subscriptions.push(subscription)\n }\n }\n\n _parseSuback () {\n debug('_parseSuback')\n const packet = this.packet\n this.packet.granted = []\n\n if (!this._parseMessageId()) { return }\n\n // Properties mqtt 5\n if (this.settings.protocolVersion === 5) {\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n }\n\n if (packet.length <= 0) { return this._emitError(new Error('Malformed suback, no payload specified')) }\n\n // Parse granted QoSes\n while (this._pos < this.packet.length) {\n const code = this._list.readUInt8(this._pos++)\n if (this.settings.protocolVersion === 5) {\n if (!constants.MQTT5_SUBACK_CODES[code]) {\n return this._emitError(new Error('Invalid suback code'))\n }\n } else {\n if (code > 2 && code !== 0x80) {\n return this._emitError(new Error('Invalid suback QoS, must be 0, 1, 2 or 128'))\n }\n }\n this.packet.granted.push(code)\n }\n }\n\n _parseUnsubscribe () {\n debug('_parseUnsubscribe')\n const packet = this.packet\n\n packet.unsubscriptions = []\n\n // Parse messageId\n if (!this._parseMessageId()) { return }\n\n // Properties mqtt 5\n if (this.settings.protocolVersion === 5) {\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n }\n\n if (packet.length <= 0) { return this._emitError(new Error('Malformed unsubscribe, no payload specified')) }\n\n while (this._pos < packet.length) {\n // Parse topic\n const topic = this._parseString()\n if (topic === null) return this._emitError(new Error('Cannot parse topic'))\n\n // Push topic to unsubscriptions\n debug('_parseUnsubscribe: push topic `%s` to unsubscriptions', topic)\n packet.unsubscriptions.push(topic)\n }\n }\n\n _parseUnsuback () {\n debug('_parseUnsuback')\n const packet = this.packet\n if (!this._parseMessageId()) return this._emitError(new Error('Cannot parse messageId'))\n\n if ((this.settings.protocolVersion === 3 ||\n this.settings.protocolVersion === 4) && packet.length !== 2) {\n return this._emitError(new Error('Malformed unsuback, payload length must be 2'))\n }\n if (packet.length <= 0) { return this._emitError(new Error('Malformed unsuback, no payload specified')) }\n\n // Properties mqtt 5\n if (this.settings.protocolVersion === 5) {\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n // Parse granted QoSes\n packet.granted = []\n\n while (this._pos < this.packet.length) {\n const code = this._list.readUInt8(this._pos++)\n if (!constants.MQTT5_UNSUBACK_CODES[code]) {\n return this._emitError(new Error('Invalid unsuback code'))\n }\n this.packet.granted.push(code)\n }\n }\n }\n\n // parse packets like puback, pubrec, pubrel, pubcomp\n _parseConfirmation () {\n debug('_parseConfirmation: packet.cmd: `%s`', this.packet.cmd)\n const packet = this.packet\n\n this._parseMessageId()\n\n if (this.settings.protocolVersion === 5) {\n if (packet.length > 2) {\n // response code\n packet.reasonCode = this._parseByte()\n switch (this.packet.cmd) {\n case 'puback':\n case 'pubrec':\n if (!constants.MQTT5_PUBACK_PUBREC_CODES[packet.reasonCode]) {\n return this._emitError(new Error('Invalid ' + this.packet.cmd + ' reason code'))\n }\n break\n case 'pubrel':\n case 'pubcomp':\n if (!constants.MQTT5_PUBREL_PUBCOMP_CODES[packet.reasonCode]) {\n return this._emitError(new Error('Invalid ' + this.packet.cmd + ' reason code'))\n }\n break\n }\n debug('_parseConfirmation: packet.reasonCode `%d`', packet.reasonCode)\n } else {\n packet.reasonCode = 0\n }\n\n if (packet.length > 3) {\n // properies mqtt 5\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n }\n }\n\n return true\n }\n\n // parse disconnect packet\n _parseDisconnect () {\n const packet = this.packet\n debug('_parseDisconnect')\n\n if (this.settings.protocolVersion === 5) {\n // response code\n if (this._list.length > 0) {\n packet.reasonCode = this._parseByte()\n if (!constants.MQTT5_DISCONNECT_CODES[packet.reasonCode]) {\n this._emitError(new Error('Invalid disconnect reason code'))\n }\n } else {\n packet.reasonCode = 0\n }\n // properies mqtt 5\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n }\n\n debug('_parseDisconnect result: true')\n return true\n }\n\n // parse auth packet\n _parseAuth () {\n debug('_parseAuth')\n const packet = this.packet\n\n if (this.settings.protocolVersion !== 5) {\n return this._emitError(new Error('Not supported auth packet for this version MQTT'))\n }\n\n // response code\n packet.reasonCode = this._parseByte()\n if (!constants.MQTT5_AUTH_CODES[packet.reasonCode]) {\n return this._emitError(new Error('Invalid auth reason code'))\n }\n // properies mqtt 5\n const properties = this._parseProperties()\n if (Object.getOwnPropertyNames(properties).length) {\n packet.properties = properties\n }\n\n debug('_parseAuth: result: true')\n return true\n }\n\n _parseMessageId () {\n const packet = this.packet\n\n packet.messageId = this._parseNum()\n\n if (packet.messageId === null) {\n this._emitError(new Error('Cannot parse messageId'))\n return false\n }\n\n debug('_parseMessageId: packet.messageId %d', packet.messageId)\n return true\n }\n\n _parseString (maybeBuffer) {\n const length = this._parseNum()\n const end = length + this._pos\n\n if (length === -1 || end > this._list.length || end > this.packet.length) return null\n\n const result = this._list.toString('utf8', this._pos, end)\n this._pos += length\n debug('_parseString: result: %s', result)\n return result\n }\n\n _parseStringPair () {\n debug('_parseStringPair')\n return {\n name: this._parseString(),\n value: this._parseString()\n }\n }\n\n _parseBuffer () {\n const length = this._parseNum()\n const end = length + this._pos\n\n if (length === -1 || end > this._list.length || end > this.packet.length) return null\n\n const result = this._list.slice(this._pos, end)\n\n this._pos += length\n debug('_parseBuffer: result: %o', result)\n return result\n }\n\n _parseNum () {\n if (this._list.length - this._pos < 2) return -1\n\n const result = this._list.readUInt16BE(this._pos)\n this._pos += 2\n debug('_parseNum: result: %s', result)\n return result\n }\n\n _parse4ByteNum () {\n if (this._list.length - this._pos < 4) return -1\n\n const result = this._list.readUInt32BE(this._pos)\n this._pos += 4\n debug('_parse4ByteNum: result: %s', result)\n return result\n }\n\n _parseVarByteNum (fullInfoFlag) {\n debug('_parseVarByteNum')\n const maxBytes = 4\n let bytes = 0\n let mul = 1\n let value = 0\n let result = false\n let current\n const padding = this._pos ? this._pos : 0\n\n while (bytes < maxBytes && (padding + bytes) < this._list.length) {\n current = this._list.readUInt8(padding + bytes++)\n value += mul * (current & constants.VARBYTEINT_MASK)\n mul *= 0x80\n\n if ((current & constants.VARBYTEINT_FIN_MASK) === 0) {\n result = true\n break\n }\n if (this._list.length <= bytes) {\n break\n }\n }\n\n if (!result && bytes === maxBytes && this._list.length >= bytes) {\n this._emitError(new Error('Invalid variable byte integer'))\n }\n\n if (padding) {\n this._pos += bytes\n }\n\n if (result) {\n if (fullInfoFlag) {\n result = { bytes, value }\n } else {\n result = value\n }\n } else {\n result = false\n }\n\n debug('_parseVarByteNum: result: %o', result)\n return result\n }\n\n _parseByte () {\n let result\n if (this._pos < this._list.length) {\n result = this._list.readUInt8(this._pos)\n this._pos++\n }\n debug('_parseByte: result: %o', result)\n return result\n }\n\n _parseByType (type) {\n debug('_parseByType: type: %s', type)\n switch (type) {\n case 'byte': {\n return this._parseByte() !== 0\n }\n case 'int8': {\n return this._parseByte()\n }\n case 'int16': {\n return this._parseNum()\n }\n case 'int32': {\n return this._parse4ByteNum()\n }\n case 'var': {\n return this._parseVarByteNum()\n }\n case 'string': {\n return this._parseString()\n }\n case 'pair': {\n return this._parseStringPair()\n }\n case 'binary': {\n return this._parseBuffer()\n }\n }\n }\n\n _parseProperties () {\n debug('_parseProperties')\n const length = this._parseVarByteNum()\n const start = this._pos\n const end = start + length\n const result = {}\n while (this._pos < end) {\n const type = this._parseByte()\n if (!type) {\n this._emitError(new Error('Cannot parse property code type'))\n return false\n }\n const name = constants.propertiesCodes[type]\n if (!name) {\n this._emitError(new Error('Unknown property'))\n return false\n }\n // user properties process\n if (name === 'userProperties') {\n if (!result[name]) {\n result[name] = Object.create(null)\n }\n const currentUserProperty = this._parseByType(constants.propertiesTypes[name])\n if (result[name][currentUserProperty.name]) {\n if (Array.isArray(result[name][currentUserProperty.name])) {\n result[name][currentUserProperty.name].push(currentUserProperty.value)\n } else {\n const currentValue = result[name][currentUserProperty.name]\n result[name][currentUserProperty.name] = [currentValue]\n result[name][currentUserProperty.name].push(currentUserProperty.value)\n }\n } else {\n result[name][currentUserProperty.name] = currentUserProperty.value\n }\n continue\n }\n if (result[name]) {\n if (Array.isArray(result[name])) {\n result[name].push(this._parseByType(constants.propertiesTypes[name]))\n } else {\n result[name] = [result[name]]\n result[name].push(this._parseByType(constants.propertiesTypes[name]))\n }\n } else {\n result[name] = this._parseByType(constants.propertiesTypes[name])\n }\n }\n return result\n }\n\n _newPacket () {\n debug('_newPacket')\n if (this.packet) {\n this._list.consume(this.packet.length)\n debug('_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d', this.packet.cmd, this.packet.payload, this.packet.length)\n this.emit('packet', this.packet)\n }\n debug('_newPacket: new packet')\n this.packet = new Packet()\n\n this._pos = 0\n\n return true\n }\n\n _emitError (err) {\n debug('_emitError', err)\n this.error = err\n this.emit('error', err)\n }\n}\n\nmodule.exports = Parser\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/mqtt-packet/parser.js?");
305
+
306
+ /***/ }),
307
+
308
+ /***/ "./node_modules/mqtt-packet-web/node_modules/mqtt-packet/writeToStream.js":
309
+ /*!********************************************************************************!*\
310
+ !*** ./node_modules/mqtt-packet-web/node_modules/mqtt-packet/writeToStream.js ***!
311
+ \********************************************************************************/
312
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
313
+
314
+ eval("const protocol = __webpack_require__(/*! ./constants */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/constants.js\")\nconst { Buffer } = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\nconst empty = Buffer.allocUnsafe(0)\nconst zeroBuf = Buffer.from([0])\nconst numbers = __webpack_require__(/*! ./numbers */ \"./node_modules/mqtt-packet-web/node_modules/mqtt-packet/numbers.js\")\nconst nextTick = (__webpack_require__(/*! process-nextick-args */ \"./node_modules/process-nextick-args/index.js\").nextTick)\nconst debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")('mqtt-packet:writeToStream')\n\nconst numCache = numbers.cache\nconst generateNumber = numbers.generateNumber\nconst generateCache = numbers.generateCache\nconst genBufVariableByteInt = numbers.genBufVariableByteInt\nconst generate4ByteBuffer = numbers.generate4ByteBuffer\nlet writeNumber = writeNumberCached\nlet toGenerate = true\n\nfunction generate (packet, stream, opts) {\n debug('generate called')\n if (stream.cork) {\n stream.cork()\n nextTick(uncork, stream)\n }\n\n if (toGenerate) {\n toGenerate = false\n generateCache()\n }\n debug('generate: packet.cmd: %s', packet.cmd)\n switch (packet.cmd) {\n case 'connect':\n return connect(packet, stream, opts)\n case 'connack':\n return connack(packet, stream, opts)\n case 'publish':\n return publish(packet, stream, opts)\n case 'puback':\n case 'pubrec':\n case 'pubrel':\n case 'pubcomp':\n return confirmation(packet, stream, opts)\n case 'subscribe':\n return subscribe(packet, stream, opts)\n case 'suback':\n return suback(packet, stream, opts)\n case 'unsubscribe':\n return unsubscribe(packet, stream, opts)\n case 'unsuback':\n return unsuback(packet, stream, opts)\n case 'pingreq':\n case 'pingresp':\n return emptyPacket(packet, stream, opts)\n case 'disconnect':\n return disconnect(packet, stream, opts)\n case 'auth':\n return auth(packet, stream, opts)\n default:\n stream.destroy(new Error('Unknown command'))\n return false\n }\n}\n/**\n * Controls numbers cache.\n * Set to \"false\" to allocate buffers on-the-flight instead of pre-generated cache\n */\nObject.defineProperty(generate, 'cacheNumbers', {\n get () {\n return writeNumber === writeNumberCached\n },\n set (value) {\n if (value) {\n if (!numCache || Object.keys(numCache).length === 0) toGenerate = true\n writeNumber = writeNumberCached\n } else {\n toGenerate = false\n writeNumber = writeNumberGenerated\n }\n }\n})\n\nfunction uncork (stream) {\n stream.uncork()\n}\n\nfunction connect (packet, stream, opts) {\n const settings = packet || {}\n const protocolId = settings.protocolId || 'MQTT'\n let protocolVersion = settings.protocolVersion || 4\n const will = settings.will\n let clean = settings.clean\n const keepalive = settings.keepalive || 0\n const clientId = settings.clientId || ''\n const username = settings.username\n const password = settings.password\n /* mqtt5 new oprions */\n const properties = settings.properties\n\n if (clean === undefined) clean = true\n\n let length = 0\n\n // Must be a string and non-falsy\n if (!protocolId ||\n (typeof protocolId !== 'string' && !Buffer.isBuffer(protocolId))) {\n stream.destroy(new Error('Invalid protocolId'))\n return false\n } else length += protocolId.length + 2\n\n // Must be 3 or 4 or 5\n if (protocolVersion !== 3 && protocolVersion !== 4 && protocolVersion !== 5) {\n stream.destroy(new Error('Invalid protocol version'))\n return false\n } else length += 1\n\n // ClientId might be omitted in 3.1.1 and 5, but only if cleanSession is set to 1\n if ((typeof clientId === 'string' || Buffer.isBuffer(clientId)) &&\n (clientId || protocolVersion >= 4) && (clientId || clean)) {\n length += Buffer.byteLength(clientId) + 2\n } else {\n if (protocolVersion < 4) {\n stream.destroy(new Error('clientId must be supplied before 3.1.1'))\n return false\n }\n if ((clean * 1) === 0) {\n stream.destroy(new Error('clientId must be given if cleanSession set to 0'))\n return false\n }\n }\n\n // Must be a two byte number\n if (typeof keepalive !== 'number' ||\n keepalive < 0 ||\n keepalive > 65535 ||\n keepalive % 1 !== 0) {\n stream.destroy(new Error('Invalid keepalive'))\n return false\n } else length += 2\n\n // Connect flags\n length += 1\n\n let propertiesData\n let willProperties\n\n // Properties\n if (protocolVersion === 5) {\n propertiesData = getProperties(stream, properties)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n\n // If will exists...\n if (will) {\n // It must be an object\n if (typeof will !== 'object') {\n stream.destroy(new Error('Invalid will'))\n return false\n }\n // It must have topic typeof string\n if (!will.topic || typeof will.topic !== 'string') {\n stream.destroy(new Error('Invalid will topic'))\n return false\n } else {\n length += Buffer.byteLength(will.topic) + 2\n }\n\n // Payload\n length += 2 // payload length\n if (will.payload) {\n if (will.payload.length >= 0) {\n if (typeof will.payload === 'string') {\n length += Buffer.byteLength(will.payload)\n } else {\n length += will.payload.length\n }\n } else {\n stream.destroy(new Error('Invalid will payload'))\n return false\n }\n }\n // will properties\n willProperties = {}\n if (protocolVersion === 5) {\n willProperties = getProperties(stream, will.properties)\n if (!willProperties) { return false }\n length += willProperties.length\n }\n }\n\n // Username\n let providedUsername = false\n if (username != null) {\n if (isStringOrBuffer(username)) {\n providedUsername = true\n length += Buffer.byteLength(username) + 2\n } else {\n stream.destroy(new Error('Invalid username'))\n return false\n }\n }\n\n // Password\n if (password != null) {\n if (!providedUsername) {\n stream.destroy(new Error('Username is required to use password'))\n return false\n }\n\n if (isStringOrBuffer(password)) {\n length += byteLength(password) + 2\n } else {\n stream.destroy(new Error('Invalid password'))\n return false\n }\n }\n\n // Generate header\n stream.write(protocol.CONNECT_HEADER)\n\n // Generate length\n writeVarByteInt(stream, length)\n\n // Generate protocol ID\n writeStringOrBuffer(stream, protocolId)\n\n if (settings.bridgeMode) {\n protocolVersion += 128\n }\n\n stream.write(\n protocolVersion === 131\n ? protocol.VERSION131\n : protocolVersion === 132\n ? protocol.VERSION132\n : protocolVersion === 4\n ? protocol.VERSION4\n : protocolVersion === 5\n ? protocol.VERSION5\n : protocol.VERSION3\n )\n\n // Connect flags\n let flags = 0\n flags |= (username != null) ? protocol.USERNAME_MASK : 0\n flags |= (password != null) ? protocol.PASSWORD_MASK : 0\n flags |= (will && will.retain) ? protocol.WILL_RETAIN_MASK : 0\n flags |= (will && will.qos) ? will.qos << protocol.WILL_QOS_SHIFT : 0\n flags |= will ? protocol.WILL_FLAG_MASK : 0\n flags |= clean ? protocol.CLEAN_SESSION_MASK : 0\n\n stream.write(Buffer.from([flags]))\n\n // Keepalive\n writeNumber(stream, keepalive)\n\n // Properties\n if (protocolVersion === 5) {\n propertiesData.write()\n }\n\n // Client ID\n writeStringOrBuffer(stream, clientId)\n\n // Will\n if (will) {\n if (protocolVersion === 5) {\n willProperties.write()\n }\n writeString(stream, will.topic)\n writeStringOrBuffer(stream, will.payload)\n }\n\n // Username and password\n if (username != null) {\n writeStringOrBuffer(stream, username)\n }\n if (password != null) {\n writeStringOrBuffer(stream, password)\n }\n // This is a small packet that happens only once on a stream\n // We assume the stream is always free to receive more data after this\n return true\n}\n\nfunction connack (packet, stream, opts) {\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const rc = version === 5 ? settings.reasonCode : settings.returnCode\n const properties = settings.properties\n let length = 2 // length of rc and sessionHeader\n\n // Check return code\n if (typeof rc !== 'number') {\n stream.destroy(new Error('Invalid return code'))\n return false\n }\n // mqtt5 properties\n let propertiesData = null\n if (version === 5) {\n propertiesData = getProperties(stream, properties)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n\n stream.write(protocol.CONNACK_HEADER)\n // length\n writeVarByteInt(stream, length)\n stream.write(settings.sessionPresent ? protocol.SESSIONPRESENT_HEADER : zeroBuf)\n\n stream.write(Buffer.from([rc]))\n if (propertiesData != null) {\n propertiesData.write()\n }\n return true\n}\n\nfunction publish (packet, stream, opts) {\n debug('publish: packet: %o', packet)\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const qos = settings.qos || 0\n const retain = settings.retain ? protocol.RETAIN_MASK : 0\n const topic = settings.topic\n const payload = settings.payload || empty\n const id = settings.messageId\n const properties = settings.properties\n\n let length = 0\n\n // Topic must be a non-empty string or Buffer\n if (typeof topic === 'string') length += Buffer.byteLength(topic) + 2\n else if (Buffer.isBuffer(topic)) length += topic.length + 2\n else {\n stream.destroy(new Error('Invalid topic'))\n return false\n }\n\n // Get the payload length\n if (!Buffer.isBuffer(payload)) length += Buffer.byteLength(payload)\n else length += payload.length\n\n // Message ID must a number if qos > 0\n if (qos && typeof id !== 'number') {\n stream.destroy(new Error('Invalid messageId'))\n return false\n } else if (qos) length += 2\n\n // mqtt5 properties\n let propertiesData = null\n if (version === 5) {\n propertiesData = getProperties(stream, properties)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n\n // Header\n stream.write(protocol.PUBLISH_HEADER[qos][settings.dup ? 1 : 0][retain ? 1 : 0])\n\n // Remaining length\n writeVarByteInt(stream, length)\n\n // Topic\n writeNumber(stream, byteLength(topic))\n stream.write(topic)\n\n // Message ID\n if (qos > 0) writeNumber(stream, id)\n\n // Properties\n if (propertiesData != null) {\n propertiesData.write()\n }\n\n // Payload\n debug('publish: payload: %o', payload)\n return stream.write(payload)\n}\n\n/* Puback, pubrec, pubrel and pubcomp */\nfunction confirmation (packet, stream, opts) {\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const type = settings.cmd || 'puback'\n const id = settings.messageId\n const dup = (settings.dup && type === 'pubrel') ? protocol.DUP_MASK : 0\n let qos = 0\n const reasonCode = settings.reasonCode\n const properties = settings.properties\n let length = version === 5 ? 3 : 2\n\n if (type === 'pubrel') qos = 1\n\n // Check message ID\n if (typeof id !== 'number') {\n stream.destroy(new Error('Invalid messageId'))\n return false\n }\n\n // properies mqtt 5\n let propertiesData = null\n if (version === 5) {\n // Confirm should not add empty property length with no properties (rfc 3.4.2.2.1)\n if (typeof properties === 'object') {\n propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n }\n\n // Header\n stream.write(protocol.ACKS[type][qos][dup][0])\n\n // Length === 3 is only true of version === 5 and no properties; therefore if reasonCode === 0 we are allowed to skip both bytes - but if we write the reason code we also have to write property length [MQTT-3.4.2-1].\n if (length === 3) length += reasonCode !== 0 ? 1 : -1\n writeVarByteInt(stream, length)\n\n // Message ID\n writeNumber(stream, id)\n\n // reason code in header - but only if it couldn't be omitted - indicated by length !== 2.\n if (version === 5 && length !== 2) {\n stream.write(Buffer.from([reasonCode]))\n }\n\n // properties mqtt 5\n if (propertiesData !== null) {\n propertiesData.write()\n } else {\n if (length === 4) {\n // we have no properties but have written a reason code - so we need to indicate empty properties by filling in a zero.\n stream.write(Buffer.from([0]))\n }\n }\n return true\n}\n\nfunction subscribe (packet, stream, opts) {\n debug('subscribe: packet: ')\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const dup = settings.dup ? protocol.DUP_MASK : 0\n const id = settings.messageId\n const subs = settings.subscriptions\n const properties = settings.properties\n\n let length = 0\n\n // Check message ID\n if (typeof id !== 'number') {\n stream.destroy(new Error('Invalid messageId'))\n return false\n } else length += 2\n\n // properies mqtt 5\n let propertiesData = null\n if (version === 5) {\n propertiesData = getProperties(stream, properties)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n\n // Check subscriptions\n if (typeof subs === 'object' && subs.length) {\n for (let i = 0; i < subs.length; i += 1) {\n const itopic = subs[i].topic\n const iqos = subs[i].qos\n\n if (typeof itopic !== 'string') {\n stream.destroy(new Error('Invalid subscriptions - invalid topic'))\n return false\n }\n if (typeof iqos !== 'number') {\n stream.destroy(new Error('Invalid subscriptions - invalid qos'))\n return false\n }\n\n if (version === 5) {\n const nl = subs[i].nl || false\n if (typeof nl !== 'boolean') {\n stream.destroy(new Error('Invalid subscriptions - invalid No Local'))\n return false\n }\n const rap = subs[i].rap || false\n if (typeof rap !== 'boolean') {\n stream.destroy(new Error('Invalid subscriptions - invalid Retain as Published'))\n return false\n }\n const rh = subs[i].rh || 0\n if (typeof rh !== 'number' || rh > 2) {\n stream.destroy(new Error('Invalid subscriptions - invalid Retain Handling'))\n return false\n }\n }\n\n length += Buffer.byteLength(itopic) + 2 + 1\n }\n } else {\n stream.destroy(new Error('Invalid subscriptions'))\n return false\n }\n\n // Generate header\n debug('subscribe: writing to stream: %o', protocol.SUBSCRIBE_HEADER)\n stream.write(protocol.SUBSCRIBE_HEADER[1][dup ? 1 : 0][0])\n\n // Generate length\n writeVarByteInt(stream, length)\n\n // Generate message ID\n writeNumber(stream, id)\n\n // properies mqtt 5\n if (propertiesData !== null) {\n propertiesData.write()\n }\n\n let result = true\n\n // Generate subs\n for (const sub of subs) {\n const jtopic = sub.topic\n const jqos = sub.qos\n const jnl = +sub.nl\n const jrap = +sub.rap\n const jrh = sub.rh\n let joptions\n\n // Write topic string\n writeString(stream, jtopic)\n\n // options process\n joptions = protocol.SUBSCRIBE_OPTIONS_QOS[jqos]\n if (version === 5) {\n joptions |= jnl ? protocol.SUBSCRIBE_OPTIONS_NL : 0\n joptions |= jrap ? protocol.SUBSCRIBE_OPTIONS_RAP : 0\n joptions |= jrh ? protocol.SUBSCRIBE_OPTIONS_RH[jrh] : 0\n }\n // Write options\n result = stream.write(Buffer.from([joptions]))\n }\n\n return result\n}\n\nfunction suback (packet, stream, opts) {\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const id = settings.messageId\n const granted = settings.granted\n const properties = settings.properties\n let length = 0\n\n // Check message ID\n if (typeof id !== 'number') {\n stream.destroy(new Error('Invalid messageId'))\n return false\n } else length += 2\n\n // Check granted qos vector\n if (typeof granted === 'object' && granted.length) {\n for (let i = 0; i < granted.length; i += 1) {\n if (typeof granted[i] !== 'number') {\n stream.destroy(new Error('Invalid qos vector'))\n return false\n }\n length += 1\n }\n } else {\n stream.destroy(new Error('Invalid qos vector'))\n return false\n }\n\n // properies mqtt 5\n let propertiesData = null\n if (version === 5) {\n propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n\n // header\n stream.write(protocol.SUBACK_HEADER)\n\n // Length\n writeVarByteInt(stream, length)\n\n // Message ID\n writeNumber(stream, id)\n\n // properies mqtt 5\n if (propertiesData !== null) {\n propertiesData.write()\n }\n\n return stream.write(Buffer.from(granted))\n}\n\nfunction unsubscribe (packet, stream, opts) {\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const id = settings.messageId\n const dup = settings.dup ? protocol.DUP_MASK : 0\n const unsubs = settings.unsubscriptions\n const properties = settings.properties\n\n let length = 0\n\n // Check message ID\n if (typeof id !== 'number') {\n stream.destroy(new Error('Invalid messageId'))\n return false\n } else {\n length += 2\n }\n // Check unsubs\n if (typeof unsubs === 'object' && unsubs.length) {\n for (let i = 0; i < unsubs.length; i += 1) {\n if (typeof unsubs[i] !== 'string') {\n stream.destroy(new Error('Invalid unsubscriptions'))\n return false\n }\n length += Buffer.byteLength(unsubs[i]) + 2\n }\n } else {\n stream.destroy(new Error('Invalid unsubscriptions'))\n return false\n }\n // properies mqtt 5\n let propertiesData = null\n if (version === 5) {\n propertiesData = getProperties(stream, properties)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n\n // Header\n stream.write(protocol.UNSUBSCRIBE_HEADER[1][dup ? 1 : 0][0])\n\n // Length\n writeVarByteInt(stream, length)\n\n // Message ID\n writeNumber(stream, id)\n\n // properies mqtt 5\n if (propertiesData !== null) {\n propertiesData.write()\n }\n\n // Unsubs\n let result = true\n for (let j = 0; j < unsubs.length; j++) {\n result = writeString(stream, unsubs[j])\n }\n\n return result\n}\n\nfunction unsuback (packet, stream, opts) {\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const id = settings.messageId\n const dup = settings.dup ? protocol.DUP_MASK : 0\n const granted = settings.granted\n const properties = settings.properties\n const type = settings.cmd\n const qos = 0\n\n let length = 2\n\n // Check message ID\n if (typeof id !== 'number') {\n stream.destroy(new Error('Invalid messageId'))\n return false\n }\n\n // Check granted\n if (version === 5) {\n if (typeof granted === 'object' && granted.length) {\n for (let i = 0; i < granted.length; i += 1) {\n if (typeof granted[i] !== 'number') {\n stream.destroy(new Error('Invalid qos vector'))\n return false\n }\n length += 1\n }\n } else {\n stream.destroy(new Error('Invalid qos vector'))\n return false\n }\n }\n\n // properies mqtt 5\n let propertiesData = null\n if (version === 5) {\n propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n\n // Header\n stream.write(protocol.ACKS[type][qos][dup][0])\n\n // Length\n writeVarByteInt(stream, length)\n\n // Message ID\n writeNumber(stream, id)\n\n // properies mqtt 5\n if (propertiesData !== null) {\n propertiesData.write()\n }\n\n // payload\n if (version === 5) {\n stream.write(Buffer.from(granted))\n }\n return true\n}\n\nfunction emptyPacket (packet, stream, opts) {\n return stream.write(protocol.EMPTY[packet.cmd])\n}\n\nfunction disconnect (packet, stream, opts) {\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const reasonCode = settings.reasonCode\n const properties = settings.properties\n let length = version === 5 ? 1 : 0\n\n // properies mqtt 5\n let propertiesData = null\n if (version === 5) {\n propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)\n if (!propertiesData) { return false }\n length += propertiesData.length\n }\n\n // Header\n stream.write(Buffer.from([protocol.codes.disconnect << 4]))\n\n // Length\n writeVarByteInt(stream, length)\n\n // reason code in header\n if (version === 5) {\n stream.write(Buffer.from([reasonCode]))\n }\n\n // properies mqtt 5\n if (propertiesData !== null) {\n propertiesData.write()\n }\n\n return true\n}\n\nfunction auth (packet, stream, opts) {\n const version = opts ? opts.protocolVersion : 4\n const settings = packet || {}\n const reasonCode = settings.reasonCode\n const properties = settings.properties\n let length = version === 5 ? 1 : 0\n\n if (version !== 5) stream.destroy(new Error('Invalid mqtt version for auth packet'))\n\n // properies mqtt 5\n const propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)\n if (!propertiesData) { return false }\n length += propertiesData.length\n\n // Header\n stream.write(Buffer.from([protocol.codes.auth << 4]))\n\n // Length\n writeVarByteInt(stream, length)\n\n // reason code in header\n stream.write(Buffer.from([reasonCode]))\n\n // properies mqtt 5\n if (propertiesData !== null) {\n propertiesData.write()\n }\n return true\n}\n\n/**\n * writeVarByteInt - write an MQTT style variable byte integer to the buffer\n *\n * @param <Buffer> buffer - destination\n * @param <Number> pos - offset\n * @param <Number> length - length (>0)\n * @returns <Number> number of bytes written\n *\n * @api private\n */\n\nconst varByteIntCache = {}\nfunction writeVarByteInt (stream, num) {\n if (num > protocol.VARBYTEINT_MAX) {\n stream.destroy(new Error(`Invalid variable byte integer: ${num}`))\n return false\n }\n\n let buffer = varByteIntCache[num]\n\n if (!buffer) {\n buffer = genBufVariableByteInt(num)\n if (num < 16384) varByteIntCache[num] = buffer\n }\n debug('writeVarByteInt: writing to stream: %o', buffer)\n return stream.write(buffer)\n}\n\n/**\n * writeString - write a utf8 string to the buffer\n *\n * @param <Buffer> buffer - destination\n * @param <Number> pos - offset\n * @param <String> string - string to write\n * @return <Number> number of bytes written\n *\n * @api private\n */\n\nfunction writeString (stream, string) {\n const strlen = Buffer.byteLength(string)\n writeNumber(stream, strlen)\n\n debug('writeString: %s', string)\n return stream.write(string, 'utf8')\n}\n\n/**\n * writeStringPair - write a utf8 string pairs to the buffer\n *\n * @param <Buffer> buffer - destination\n * @param <String> name - string name to write\n * @param <String> value - string value to write\n * @return <Number> number of bytes written\n *\n * @api private\n */\nfunction writeStringPair (stream, name, value) {\n writeString(stream, name)\n writeString(stream, value)\n}\n\n/**\n * writeNumber - write a two byte number to the buffer\n *\n * @param <Buffer> buffer - destination\n * @param <Number> pos - offset\n * @param <String> number - number to write\n * @return <Number> number of bytes written\n *\n * @api private\n */\nfunction writeNumberCached (stream, number) {\n debug('writeNumberCached: number: %d', number)\n debug('writeNumberCached: %o', numCache[number])\n return stream.write(numCache[number])\n}\nfunction writeNumberGenerated (stream, number) {\n const generatedNumber = generateNumber(number)\n debug('writeNumberGenerated: %o', generatedNumber)\n return stream.write(generatedNumber)\n}\nfunction write4ByteNumber (stream, number) {\n const generated4ByteBuffer = generate4ByteBuffer(number)\n debug('write4ByteNumber: %o', generated4ByteBuffer)\n return stream.write(generated4ByteBuffer)\n}\n/**\n * writeStringOrBuffer - write a String or Buffer with the its length prefix\n *\n * @param <Buffer> buffer - destination\n * @param <Number> pos - offset\n * @param <String> toWrite - String or Buffer\n * @return <Number> number of bytes written\n */\nfunction writeStringOrBuffer (stream, toWrite) {\n if (typeof toWrite === 'string') {\n writeString(stream, toWrite)\n } else if (toWrite) {\n writeNumber(stream, toWrite.length)\n stream.write(toWrite)\n } else writeNumber(stream, 0)\n}\n\nfunction getProperties (stream, properties) {\n /* connect properties */\n if (typeof properties !== 'object' || properties.length != null) {\n return {\n length: 1,\n write () {\n writeProperties(stream, {}, 0)\n }\n }\n }\n let propertiesLength = 0\n function getLengthProperty (name, value) {\n const type = protocol.propertiesTypes[name]\n let length = 0\n switch (type) {\n case 'byte': {\n if (typeof value !== 'boolean') {\n stream.destroy(new Error(`Invalid ${name}: ${value}`))\n return false\n }\n length += 1 + 1\n break\n }\n case 'int8': {\n if (typeof value !== 'number' || value < 0 || value > 0xff) {\n stream.destroy(new Error(`Invalid ${name}: ${value}`))\n return false\n }\n length += 1 + 1\n break\n }\n case 'binary': {\n if (value && value === null) {\n stream.destroy(new Error(`Invalid ${name}: ${value}`))\n return false\n }\n length += 1 + Buffer.byteLength(value) + 2\n break\n }\n case 'int16': {\n if (typeof value !== 'number' || value < 0 || value > 0xffff) {\n stream.destroy(new Error(`Invalid ${name}: ${value}`))\n return false\n }\n length += 1 + 2\n break\n }\n case 'int32': {\n if (typeof value !== 'number' || value < 0 || value > 0xffffffff) {\n stream.destroy(new Error(`Invalid ${name}: ${value}`))\n return false\n }\n length += 1 + 4\n break\n }\n case 'var': {\n // var byte integer is max 24 bits packed in 32 bits\n if (typeof value !== 'number' || value < 0 || value > 0x0fffffff) {\n stream.destroy(new Error(`Invalid ${name}: ${value}`))\n return false\n }\n length += 1 + Buffer.byteLength(genBufVariableByteInt(value))\n break\n }\n case 'string': {\n if (typeof value !== 'string') {\n stream.destroy(new Error(`Invalid ${name}: ${value}`))\n return false\n }\n length += 1 + 2 + Buffer.byteLength(value.toString())\n break\n }\n case 'pair': {\n if (typeof value !== 'object') {\n stream.destroy(new Error(`Invalid ${name}: ${value}`))\n return false\n }\n length += Object.getOwnPropertyNames(value).reduce((result, name) => {\n const currentValue = value[name]\n if (Array.isArray(currentValue)) {\n result += currentValue.reduce((currentLength, value) => {\n currentLength += 1 + 2 + Buffer.byteLength(name.toString()) + 2 + Buffer.byteLength(value.toString())\n return currentLength\n }, 0)\n } else {\n result += 1 + 2 + Buffer.byteLength(name.toString()) + 2 + Buffer.byteLength(value[name].toString())\n }\n return result\n }, 0)\n break\n }\n default: {\n stream.destroy(new Error(`Invalid property ${name}: ${value}`))\n return false\n }\n }\n return length\n }\n if (properties) {\n for (const propName in properties) {\n let propLength = 0\n let propValueLength = 0\n const propValue = properties[propName]\n if (Array.isArray(propValue)) {\n for (let valueIndex = 0; valueIndex < propValue.length; valueIndex++) {\n propValueLength = getLengthProperty(propName, propValue[valueIndex])\n if (!propValueLength) { return false }\n propLength += propValueLength\n }\n } else {\n propValueLength = getLengthProperty(propName, propValue)\n if (!propValueLength) { return false }\n propLength = propValueLength\n }\n if (!propLength) return false\n propertiesLength += propLength\n }\n }\n const propertiesLengthLength = Buffer.byteLength(genBufVariableByteInt(propertiesLength))\n\n return {\n length: propertiesLengthLength + propertiesLength,\n write () {\n writeProperties(stream, properties, propertiesLength)\n }\n }\n}\n\nfunction getPropertiesByMaximumPacketSize (stream, properties, opts, length) {\n const mayEmptyProps = ['reasonString', 'userProperties']\n const maximumPacketSize = opts && opts.properties && opts.properties.maximumPacketSize ? opts.properties.maximumPacketSize : 0\n\n let propertiesData = getProperties(stream, properties)\n if (maximumPacketSize) {\n while (length + propertiesData.length > maximumPacketSize) {\n const currentMayEmptyProp = mayEmptyProps.shift()\n if (currentMayEmptyProp && properties[currentMayEmptyProp]) {\n delete properties[currentMayEmptyProp]\n propertiesData = getProperties(stream, properties)\n } else {\n return false\n }\n }\n }\n return propertiesData\n}\n\nfunction writeProperty (stream, propName, value) {\n const type = protocol.propertiesTypes[propName]\n switch (type) {\n case 'byte': {\n stream.write(Buffer.from([protocol.properties[propName]]))\n stream.write(Buffer.from([+value]))\n break\n }\n case 'int8': {\n stream.write(Buffer.from([protocol.properties[propName]]))\n stream.write(Buffer.from([value]))\n break\n }\n case 'binary': {\n stream.write(Buffer.from([protocol.properties[propName]]))\n writeStringOrBuffer(stream, value)\n break\n }\n case 'int16': {\n stream.write(Buffer.from([protocol.properties[propName]]))\n writeNumber(stream, value)\n break\n }\n case 'int32': {\n stream.write(Buffer.from([protocol.properties[propName]]))\n write4ByteNumber(stream, value)\n break\n }\n case 'var': {\n stream.write(Buffer.from([protocol.properties[propName]]))\n writeVarByteInt(stream, value)\n break\n }\n case 'string': {\n stream.write(Buffer.from([protocol.properties[propName]]))\n writeString(stream, value)\n break\n }\n case 'pair': {\n Object.getOwnPropertyNames(value).forEach(name => {\n const currentValue = value[name]\n if (Array.isArray(currentValue)) {\n currentValue.forEach(value => {\n stream.write(Buffer.from([protocol.properties[propName]]))\n writeStringPair(stream, name.toString(), value.toString())\n })\n } else {\n stream.write(Buffer.from([protocol.properties[propName]]))\n writeStringPair(stream, name.toString(), currentValue.toString())\n }\n })\n break\n }\n default: {\n stream.destroy(new Error(`Invalid property ${propName} value: ${value}`))\n return false\n }\n }\n}\n\nfunction writeProperties (stream, properties, propertiesLength) {\n /* write properties to stream */\n writeVarByteInt(stream, propertiesLength)\n for (const propName in properties) {\n if (Object.prototype.hasOwnProperty.call(properties, propName) && properties[propName] !== null) {\n const value = properties[propName]\n if (Array.isArray(value)) {\n for (let valueIndex = 0; valueIndex < value.length; valueIndex++) {\n writeProperty(stream, propName, value[valueIndex])\n }\n } else {\n writeProperty(stream, propName, value)\n }\n }\n }\n}\n\nfunction byteLength (bufOrString) {\n if (!bufOrString) return 0\n else if (bufOrString instanceof Buffer) return bufOrString.length\n else return Buffer.byteLength(bufOrString)\n}\n\nfunction isStringOrBuffer (field) {\n return typeof field === 'string' || field instanceof Buffer\n}\n\nmodule.exports = generate\n\n\n//# sourceURL=webpack://hsync/./node_modules/mqtt-packet-web/node_modules/mqtt-packet/writeToStream.js?");
315
+
316
+ /***/ }),
317
+
186
318
  /***/ "./node_modules/ms/index.js":
187
319
  /*!**********************************!*\
188
320
  !*** ./node_modules/ms/index.js ***!
@@ -203,13 +335,24 @@ eval("const EventEmitter = (__webpack_require__(/*! events */ \"./node_modules/e
203
335
 
204
336
  /***/ }),
205
337
 
338
+ /***/ "./node_modules/process-nextick-args/index.js":
339
+ /*!****************************************************!*\
340
+ !*** ./node_modules/process-nextick-args/index.js ***!
341
+ \****************************************************/
342
+ /***/ ((module) => {
343
+
344
+ "use strict";
345
+ eval("\n\nif (typeof process === 'undefined' ||\n !process.version ||\n process.version.indexOf('v0.') === 0 ||\n process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = { nextTick: nextTick };\n} else {\n module.exports = process\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== 'function') {\n throw new TypeError('\"callback\" argument must be a function');\n }\n var len = arguments.length;\n var args, i;\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n default:\n args = new Array(len - 1);\n i = 0;\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}\n\n\n\n//# sourceURL=webpack://hsync/./node_modules/process-nextick-args/index.js?");
346
+
347
+ /***/ }),
348
+
206
349
  /***/ "./node_modules/rawr/index.js":
207
350
  /*!************************************!*\
208
351
  !*** ./node_modules/rawr/index.js ***!
209
352
  \************************************/
210
353
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
211
354
 
212
- eval("const { EventEmitter } = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst transports = __webpack_require__(/*! ./transports */ \"./node_modules/rawr/transports/index.js\");\n\nfunction rawr({ transport, timeout = 0, handlers = {}, methods }) {\n let callId = 0;\n // eslint-disable-next-line no-param-reassign\n methods = methods || handlers; // backwards compat\n const pendingCalls = {};\n const methodHandlers = {};\n const notificationEvents = new EventEmitter();\n notificationEvents.on = notificationEvents.on.bind(notificationEvents);\n\n transport.on('rpc', (msg) => {\n if (msg.id) {\n // handle an RPC request\n if (msg.params && methodHandlers[msg.method]) {\n methodHandlers[msg.method](msg);\n return;\n }\n // handle an RPC result\n const promise = pendingCalls[msg.id];\n if (promise) {\n if (promise.timeoutId) {\n clearTimeout(promise.timeoutId);\n }\n delete pendingCalls[msg.id];\n if (msg.error) {\n promise.reject(msg.error);\n }\n return promise.resolve(msg.result);\n }\n return;\n }\n // handle a notification\n msg.params.unshift(msg.method);\n notificationEvents.emit(...msg.params);\n });\n\n function addHandler(methodName, handler) {\n methodHandlers[methodName] = (msg) => {\n Promise.resolve()\n .then(() => {\n return handler.apply(this, msg.params);\n })\n .then((result) => {\n transport.send({\n id: msg.id,\n result\n });\n })\n .catch((error) => {\n const serializedError = { message: error.message };\n if (error.code) {\n serializedError.code = error.code;\n }\n transport.send({\n id: msg.id,\n error: serializedError\n });\n });\n };\n }\n\n Object.keys(methods).forEach((m) => {\n addHandler(m, methods[m]);\n });\n\n const methodsProxy = new Proxy({}, {\n get: (target, name) => {\n return (...args) => {\n const id = ++callId;\n const msg = {\n jsonrpc: '2.0',\n method: name,\n params: args,\n id\n };\n\n let timeoutId;\n if (timeout) {\n timeoutId = setTimeout(() => {\n if (pendingCalls[id]) {\n const err = new Error('RPC timeout');\n err.code = 504;\n pendingCalls[id].reject(err);\n delete pendingCalls[id];\n }\n }, timeout);\n }\n\n const response = new Promise((resolve, reject) => {\n pendingCalls[id] = { resolve, reject, timeoutId };\n });\n\n transport.send(msg);\n\n return response;\n };\n }\n });\n\n const notifiers = new Proxy({}, {\n get: (target, name) => {\n return (...args) => {\n const msg = {\n jsonrpc: '2.0',\n method: name,\n params: args\n };\n transport.send(msg);\n };\n }\n });\n\n const notifications = new Proxy({}, {\n get: (target, name) => {\n return (callback) => {\n notificationEvents.on(name.substring(2), (...args) => {\n return callback.apply(callback, args);\n });\n };\n }\n });\n\n return {\n methods: methodsProxy,\n addHandler,\n notifications,\n notifiers,\n transport,\n };\n}\n\nrawr.transports = transports;\n\nmodule.exports = rawr;\n\n\n//# sourceURL=webpack://hsync/./node_modules/rawr/index.js?");
355
+ eval("const { EventEmitter } = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst transports = __webpack_require__(/*! ./transports */ \"./node_modules/rawr/transports/index.js\");\n\nfunction rawr({ transport, timeout = 0, handlers = {}, methods, idGenerator }) {\n let callId = 0;\n // eslint-disable-next-line no-param-reassign\n methods = methods || handlers; // backwards compat\n const pendingCalls = {};\n const methodHandlers = {};\n const notificationEvents = new EventEmitter();\n notificationEvents.on = notificationEvents.on.bind(notificationEvents);\n\n transport.on('rpc', (msg) => {\n if (msg.id) {\n // handle an RPC request\n if (msg.params && methodHandlers[msg.method]) {\n methodHandlers[msg.method](msg);\n return;\n }\n // handle an RPC result\n const promise = pendingCalls[msg.id];\n if (promise) {\n if (promise.timeoutId) {\n clearTimeout(promise.timeoutId);\n }\n delete pendingCalls[msg.id];\n if (msg.error) {\n promise.reject(msg.error);\n }\n return promise.resolve(msg.result);\n }\n return;\n }\n // handle a notification\n msg.params.unshift(msg.method);\n notificationEvents.emit(...msg.params);\n });\n\n function addHandler(methodName, handler) {\n methodHandlers[methodName] = (msg) => {\n Promise.resolve()\n .then(() => {\n return handler.apply(this, msg.params);\n })\n .then((result) => {\n transport.send({\n id: msg.id,\n result\n });\n })\n .catch((error) => {\n const serializedError = { message: error.message };\n if (error.code) {\n serializedError.code = error.code;\n }\n transport.send({\n id: msg.id,\n error: serializedError\n });\n });\n };\n }\n\n Object.keys(methods).forEach((m) => {\n addHandler(m, methods[m]);\n });\n\n const methodsProxy = new Proxy({}, {\n get: (target, name) => {\n return (...args) => {\n const id = idGenerator ? idGenerator() : ++callId;\n const msg = {\n jsonrpc: '2.0',\n method: name,\n params: args,\n id\n };\n\n let timeoutId;\n if (timeout) {\n timeoutId = setTimeout(() => {\n if (pendingCalls[id]) {\n const err = new Error('RPC timeout');\n err.code = 504;\n pendingCalls[id].reject(err);\n delete pendingCalls[id];\n }\n }, timeout);\n }\n\n const response = new Promise((resolve, reject) => {\n pendingCalls[id] = { resolve, reject, timeoutId };\n });\n\n transport.send(msg);\n\n return response;\n };\n }\n });\n\n const notifiers = new Proxy({}, {\n get: (target, name) => {\n return (...args) => {\n const msg = {\n jsonrpc: '2.0',\n method: name,\n params: args\n };\n transport.send(msg);\n };\n }\n });\n\n const notifications = new Proxy({}, {\n get: (target, name) => {\n return (callback) => {\n notificationEvents.on(name.substring(2), (...args) => {\n return callback.apply(callback, args);\n });\n };\n }\n });\n\n return {\n methods: methodsProxy,\n addHandler,\n notifications,\n notifiers,\n transport,\n };\n}\n\nrawr.transports = transports;\n\nmodule.exports = rawr;\n\n\n//# sourceURL=webpack://hsync/./node_modules/rawr/index.js?");
213
356
 
214
357
  /***/ }),
215
358
 
@@ -263,33 +406,372 @@ eval("const { EventEmitter } = __webpack_require__(/*! events */ \"./node_module
263
406
 
264
407
  /***/ }),
265
408
 
266
- /***/ "./node_modules/uuid/lib/bytesToUuid.js":
267
- /*!**********************************************!*\
268
- !*** ./node_modules/uuid/lib/bytesToUuid.js ***!
269
- \**********************************************/
409
+ /***/ "./node_modules/readable-stream/errors-browser.js":
410
+ /*!********************************************************!*\
411
+ !*** ./node_modules/readable-stream/errors-browser.js ***!
412
+ \********************************************************/
413
+ /***/ ((module) => {
414
+
415
+ "use strict";
416
+ eval("\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inheritsLoose(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n\n return NodeError;\n }(Base);\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"';\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n }\n\n msg += \". Received type \".concat(typeof actual);\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented';\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\nmodule.exports.codes = codes;\n\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/errors-browser.js?");
417
+
418
+ /***/ }),
419
+
420
+ /***/ "./node_modules/readable-stream/lib/_stream_duplex.js":
421
+ /*!************************************************************!*\
422
+ !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***!
423
+ \************************************************************/
424
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
425
+
426
+ "use strict";
427
+ eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n\n\n/*<replacement>*/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n};\n/*</replacement>*/\n\nmodule.exports = Duplex;\nvar Readable = __webpack_require__(/*! ./_stream_readable */ \"./node_modules/readable-stream/lib/_stream_readable.js\");\nvar Writable = __webpack_require__(/*! ./_stream_writable */ \"./node_modules/readable-stream/lib/_stream_writable.js\");\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Duplex, Readable);\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(onEndNT, this);\n}\nfunction onEndNT(self) {\n self.end();\n}\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/_stream_duplex.js?");
428
+
429
+ /***/ }),
430
+
431
+ /***/ "./node_modules/readable-stream/lib/_stream_passthrough.js":
432
+ /*!*****************************************************************!*\
433
+ !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***!
434
+ \*****************************************************************/
435
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
436
+
437
+ "use strict";
438
+ eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n\n\nmodule.exports = PassThrough;\nvar Transform = __webpack_require__(/*! ./_stream_transform */ \"./node_modules/readable-stream/lib/_stream_transform.js\");\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(PassThrough, Transform);\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/_stream_passthrough.js?");
439
+
440
+ /***/ }),
441
+
442
+ /***/ "./node_modules/readable-stream/lib/_stream_readable.js":
443
+ /*!**************************************************************!*\
444
+ !*** ./node_modules/readable-stream/lib/_stream_readable.js ***!
445
+ \**************************************************************/
446
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
447
+
448
+ "use strict";
449
+ eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nmodule.exports = Readable;\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n\nReadable.ReadableState = ReadableState;\n\n/*<replacement>*/\nvar EE = (__webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter);\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream = __webpack_require__(/*! ./internal/streams/stream */ \"./node_modules/readable-stream/lib/internal/streams/stream-browser.js\");\n/*</replacement>*/\n\nvar Buffer = (__webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\").Buffer);\nvar OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/*<replacement>*/\nvar debugUtil = __webpack_require__(/*! util */ \"?d17e\");\nvar debug;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/*</replacement>*/\n\nvar BufferList = __webpack_require__(/*! ./internal/streams/buffer_list */ \"./node_modules/readable-stream/lib/internal/streams/buffer_list.js\");\nvar destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ \"./node_modules/readable-stream/lib/internal/streams/destroy.js\");\nvar _require = __webpack_require__(/*! ./internal/streams/state */ \"./node_modules/readable-stream/lib/internal/streams/state.js\"),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes),\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n\n// Lazy loaded to improve the startup performance.\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Readable, Stream);\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'end' (and potentially 'finish')\n this.autoDestroy = !!options.autoDestroy;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ \"./node_modules/string_decoder/lib/string_decoder.js\").StringDecoder);\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\nfunction Readable(options) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n if (!(this instanceof Readable)) return new Readable(options);\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n\n // legacy\n this.readable = true;\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n Stream.call(this);\n}\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n return er;\n}\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ \"./node_modules/string_decoder/lib/string_decoder.js\").StringDecoder);\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n // If setEncoding(null), decoder.encoding equals utf8\n this._readableState.encoding = this._readableState.decoder.encoding;\n\n // Iterate over current buffer to convert already stored Buffers:\n var p = this._readableState.buffer.head;\n var content = '';\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n};\n\n// Don't raise the hwm > 1GB\nvar MAX_HWM = 0x40000000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n }\n\n // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n return dest;\n};\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0;\n\n // Try start flowing on next tick if stream isn't explicitly paused\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true;\n\n // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n};\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n this._readableState.paused = true;\n return this;\n};\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null);\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n};\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = __webpack_require__(/*! ./internal/streams/async_iterator */ \"./node_modules/readable-stream/lib/internal/streams/async_iterator.js\");\n }\n return createReadableStreamAsyncIterator(this);\n };\n}\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n});\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length);\n\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = __webpack_require__(/*! ./internal/streams/from */ \"./node_modules/readable-stream/lib/internal/streams/from-browser.js\");\n }\n return from(Readable, iterable, opts);\n };\n}\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/_stream_readable.js?");
450
+
451
+ /***/ }),
452
+
453
+ /***/ "./node_modules/readable-stream/lib/_stream_transform.js":
454
+ /*!***************************************************************!*\
455
+ !*** ./node_modules/readable-stream/lib/_stream_transform.js ***!
456
+ \***************************************************************/
457
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
458
+
459
+ "use strict";
460
+ eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n\n\nmodule.exports = Transform;\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes),\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\nvar Duplex = __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Transform, Duplex);\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\nfunction prefinish() {\n var _this = this;\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null)\n // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/_stream_transform.js?");
461
+
462
+ /***/ }),
463
+
464
+ /***/ "./node_modules/readable-stream/lib/_stream_writable.js":
465
+ /*!**************************************************************!*\
466
+ !*** ./node_modules/readable-stream/lib/_stream_writable.js ***!
467
+ \**************************************************************/
468
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
469
+
470
+ "use strict";
471
+ eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n\n\nmodule.exports = Writable;\n\n/* <replacement> */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* </replacement> */\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n\nWritable.WritableState = WritableState;\n\n/*<replacement>*/\nvar internalUtil = {\n deprecate: __webpack_require__(/*! util-deprecate */ \"./node_modules/util-deprecate/browser.js\")\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream = __webpack_require__(/*! ./internal/streams/stream */ \"./node_modules/readable-stream/lib/internal/streams/stream-browser.js\");\n/*</replacement>*/\n\nvar Buffer = (__webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\").Buffer);\nvar OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\nvar destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ \"./node_modules/readable-stream/lib/internal/streams/destroy.js\");\nvar _require = __webpack_require__(/*! ./internal/streams/state */ \"./node_modules/readable-stream/lib/internal/streams/state.js\"),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes),\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Writable, Stream);\nfunction nop() {}\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'finish' (and potentially 'end')\n this.autoDestroy = !!options.autoDestroy;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\nfunction Writable(options) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n\n // legacy.\n this.writable = true;\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n // TODO: defer error events consistently everywhere, not just the cb\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n}\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n}\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n if (entry === null) state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\nWritable.prototype._writev = null;\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n}\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n // reuse the free corkReq.\n state.corkedRequestsFree.next = corkReq;\n}\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/_stream_writable.js?");
472
+
473
+ /***/ }),
474
+
475
+ /***/ "./node_modules/readable-stream/lib/internal/streams/async_iterator.js":
476
+ /*!*****************************************************************************!*\
477
+ !*** ./node_modules/readable-stream/lib/internal/streams/async_iterator.js ***!
478
+ \*****************************************************************************/
479
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
480
+
481
+ "use strict";
482
+ eval("\n\nvar _Object$setPrototypeO;\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar finished = __webpack_require__(/*! ./end-of-stream */ \"./node_modules/readable-stream/lib/internal/streams/end-of-stream.js\");\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n }\n\n // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject];\n // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\nmodule.exports = createReadableStreamAsyncIterator;\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/internal/streams/async_iterator.js?");
483
+
484
+ /***/ }),
485
+
486
+ /***/ "./node_modules/readable-stream/lib/internal/streams/buffer_list.js":
487
+ /*!**************************************************************************!*\
488
+ !*** ./node_modules/readable-stream/lib/internal/streams/buffer_list.js ***!
489
+ \**************************************************************************/
490
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
491
+
492
+ "use strict";
493
+ eval("\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\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, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar _require = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\"),\n Buffer = _require.Buffer;\nvar _require2 = __webpack_require__(/*! util */ \"?ed1b\"),\n inspect = _require2.inspect;\nvar custom = inspect && inspect.custom || 'inspect';\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\nmodule.exports = /*#__PURE__*/function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) ret += s + p.data;\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n }\n\n // Consumes a specified amount of characters from the buffered data.\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Make sure the linked list only shows the minimal necessary information.\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread(_objectSpread({}, options), {}, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n}();\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/internal/streams/buffer_list.js?");
494
+
495
+ /***/ }),
496
+
497
+ /***/ "./node_modules/readable-stream/lib/internal/streams/destroy.js":
498
+ /*!**********************************************************************!*\
499
+ !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***!
500
+ \**********************************************************************/
270
501
  /***/ ((module) => {
271
502
 
272
- eval("/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/lib/bytesToUuid.js?");
503
+ "use strict";
504
+ eval("\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n}\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/internal/streams/destroy.js?");
505
+
506
+ /***/ }),
507
+
508
+ /***/ "./node_modules/readable-stream/lib/internal/streams/end-of-stream.js":
509
+ /*!****************************************************************************!*\
510
+ !*** ./node_modules/readable-stream/lib/internal/streams/end-of-stream.js ***!
511
+ \****************************************************************************/
512
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
513
+
514
+ "use strict";
515
+ eval("// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n\n\nvar ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(/*! ../../../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes.ERR_STREAM_PREMATURE_CLOSE);\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n}\nfunction noop() {}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\nmodule.exports = eos;\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/internal/streams/end-of-stream.js?");
273
516
 
274
517
  /***/ }),
275
518
 
276
- /***/ "./node_modules/uuid/lib/rng-browser.js":
277
- /*!**********************************************!*\
278
- !*** ./node_modules/uuid/lib/rng-browser.js ***!
279
- \**********************************************/
519
+ /***/ "./node_modules/readable-stream/lib/internal/streams/from-browser.js":
520
+ /*!***************************************************************************!*\
521
+ !*** ./node_modules/readable-stream/lib/internal/streams/from-browser.js ***!
522
+ \***************************************************************************/
280
523
  /***/ ((module) => {
281
524
 
282
- eval("// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/lib/rng-browser.js?");
525
+ eval("module.exports = function () {\n throw new Error('Readable.from is not available in the browser')\n};\n\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/internal/streams/from-browser.js?");
283
526
 
284
527
  /***/ }),
285
528
 
286
- /***/ "./node_modules/uuid/v4.js":
287
- /*!*********************************!*\
288
- !*** ./node_modules/uuid/v4.js ***!
289
- \*********************************/
529
+ /***/ "./node_modules/readable-stream/lib/internal/streams/pipeline.js":
530
+ /*!***********************************************************************!*\
531
+ !*** ./node_modules/readable-stream/lib/internal/streams/pipeline.js ***!
532
+ \***********************************************************************/
290
533
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
291
534
 
292
- eval("var rng = __webpack_require__(/*! ./lib/rng */ \"./node_modules/uuid/lib/rng-browser.js\");\nvar bytesToUuid = __webpack_require__(/*! ./lib/bytesToUuid */ \"./node_modules/uuid/lib/bytesToUuid.js\");\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/v4.js?");
535
+ "use strict";
536
+ eval("// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n\n\nvar eos;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\nvar _require$codes = (__webpack_require__(/*! ../../../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes),\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = __webpack_require__(/*! ./end-of-stream */ \"./node_modules/readable-stream/lib/internal/streams/end-of-stream.js\");\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true;\n\n // request.destroy just do .end - .abort is what we want\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\nfunction call(fn) {\n fn();\n}\nfunction pipe(from, to) {\n return from.pipe(to);\n}\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\nmodule.exports = pipeline;\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/internal/streams/pipeline.js?");
537
+
538
+ /***/ }),
539
+
540
+ /***/ "./node_modules/readable-stream/lib/internal/streams/state.js":
541
+ /*!********************************************************************!*\
542
+ !*** ./node_modules/readable-stream/lib/internal/streams/state.js ***!
543
+ \********************************************************************/
544
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
545
+
546
+ "use strict";
547
+ eval("\n\nvar ERR_INVALID_OPT_VALUE = (__webpack_require__(/*! ../../../errors */ \"./node_modules/readable-stream/errors-browser.js\").codes.ERR_INVALID_OPT_VALUE);\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n\n // Default value\n return state.objectMode ? 16 : 16 * 1024;\n}\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/internal/streams/state.js?");
548
+
549
+ /***/ }),
550
+
551
+ /***/ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js":
552
+ /*!*****************************************************************************!*\
553
+ !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***!
554
+ \*****************************************************************************/
555
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
556
+
557
+ eval("module.exports = __webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter;\n\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/lib/internal/streams/stream-browser.js?");
558
+
559
+ /***/ }),
560
+
561
+ /***/ "./node_modules/readable-stream/readable-browser.js":
562
+ /*!**********************************************************!*\
563
+ !*** ./node_modules/readable-stream/readable-browser.js ***!
564
+ \**********************************************************/
565
+ /***/ ((module, exports, __webpack_require__) => {
566
+
567
+ eval("exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ \"./node_modules/readable-stream/lib/_stream_readable.js\");\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ \"./node_modules/readable-stream/lib/_stream_writable.js\");\nexports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ \"./node_modules/readable-stream/lib/_stream_duplex.js\");\nexports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ \"./node_modules/readable-stream/lib/_stream_transform.js\");\nexports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ \"./node_modules/readable-stream/lib/_stream_passthrough.js\");\nexports.finished = __webpack_require__(/*! ./lib/internal/streams/end-of-stream.js */ \"./node_modules/readable-stream/lib/internal/streams/end-of-stream.js\");\nexports.pipeline = __webpack_require__(/*! ./lib/internal/streams/pipeline.js */ \"./node_modules/readable-stream/lib/internal/streams/pipeline.js\");\n\n\n//# sourceURL=webpack://hsync/./node_modules/readable-stream/readable-browser.js?");
568
+
569
+ /***/ }),
570
+
571
+ /***/ "./node_modules/safe-buffer/index.js":
572
+ /*!*******************************************!*\
573
+ !*** ./node_modules/safe-buffer/index.js ***!
574
+ \*******************************************/
575
+ /***/ ((module, exports, __webpack_require__) => {
576
+
577
+ eval("/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\")\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n\n\n//# sourceURL=webpack://hsync/./node_modules/safe-buffer/index.js?");
578
+
579
+ /***/ }),
580
+
581
+ /***/ "./node_modules/string_decoder/lib/string_decoder.js":
582
+ /*!***********************************************************!*\
583
+ !*** ./node_modules/string_decoder/lib/string_decoder.js ***!
584
+ \***********************************************************/
585
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
586
+
587
+ "use strict";
588
+ eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n/*<replacement>*/\n\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer);\n/*</replacement>*/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}\n\n//# sourceURL=webpack://hsync/./node_modules/string_decoder/lib/string_decoder.js?");
589
+
590
+ /***/ }),
591
+
592
+ /***/ "./node_modules/util-deprecate/browser.js":
593
+ /*!************************************************!*\
594
+ !*** ./node_modules/util-deprecate/browser.js ***!
595
+ \************************************************/
596
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
597
+
598
+ eval("\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!__webpack_require__.g.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = __webpack_require__.g.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n\n\n//# sourceURL=webpack://hsync/./node_modules/util-deprecate/browser.js?");
599
+
600
+ /***/ }),
601
+
602
+ /***/ "./node_modules/uuid/dist/commonjs-browser/index.js":
603
+ /*!**********************************************************!*\
604
+ !*** ./node_modules/uuid/dist/commonjs-browser/index.js ***!
605
+ \**********************************************************/
606
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
607
+
608
+ "use strict";
609
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nObject.defineProperty(exports, \"NIL\", ({\n enumerable: true,\n get: function get() {\n return _nil.default;\n }\n}));\nObject.defineProperty(exports, \"parse\", ({\n enumerable: true,\n get: function get() {\n return _parse.default;\n }\n}));\nObject.defineProperty(exports, \"stringify\", ({\n enumerable: true,\n get: function get() {\n return _stringify.default;\n }\n}));\nObject.defineProperty(exports, \"v1\", ({\n enumerable: true,\n get: function get() {\n return _v.default;\n }\n}));\nObject.defineProperty(exports, \"v3\", ({\n enumerable: true,\n get: function get() {\n return _v2.default;\n }\n}));\nObject.defineProperty(exports, \"v4\", ({\n enumerable: true,\n get: function get() {\n return _v3.default;\n }\n}));\nObject.defineProperty(exports, \"v5\", ({\n enumerable: true,\n get: function get() {\n return _v4.default;\n }\n}));\nObject.defineProperty(exports, \"validate\", ({\n enumerable: true,\n get: function get() {\n return _validate.default;\n }\n}));\nObject.defineProperty(exports, \"version\", ({\n enumerable: true,\n get: function get() {\n return _version.default;\n }\n}));\n\nvar _v = _interopRequireDefault(__webpack_require__(/*! ./v1.js */ \"./node_modules/uuid/dist/commonjs-browser/v1.js\"));\n\nvar _v2 = _interopRequireDefault(__webpack_require__(/*! ./v3.js */ \"./node_modules/uuid/dist/commonjs-browser/v3.js\"));\n\nvar _v3 = _interopRequireDefault(__webpack_require__(/*! ./v4.js */ \"./node_modules/uuid/dist/commonjs-browser/v4.js\"));\n\nvar _v4 = _interopRequireDefault(__webpack_require__(/*! ./v5.js */ \"./node_modules/uuid/dist/commonjs-browser/v5.js\"));\n\nvar _nil = _interopRequireDefault(__webpack_require__(/*! ./nil.js */ \"./node_modules/uuid/dist/commonjs-browser/nil.js\"));\n\nvar _version = _interopRequireDefault(__webpack_require__(/*! ./version.js */ \"./node_modules/uuid/dist/commonjs-browser/version.js\"));\n\nvar _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/commonjs-browser/validate.js\"));\n\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/commonjs-browser/stringify.js\"));\n\nvar _parse = _interopRequireDefault(__webpack_require__(/*! ./parse.js */ \"./node_modules/uuid/dist/commonjs-browser/parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/index.js?");
610
+
611
+ /***/ }),
612
+
613
+ /***/ "./node_modules/uuid/dist/commonjs-browser/md5.js":
614
+ /*!********************************************************!*\
615
+ !*** ./node_modules/uuid/dist/commonjs-browser/md5.js ***!
616
+ \********************************************************/
617
+ /***/ ((__unused_webpack_module, exports) => {
618
+
619
+ "use strict";
620
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\n/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (let i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n const output = [];\n const length32 = input.length * 32;\n const hexTab = '0123456789abcdef';\n\n for (let i = 0; i < length32; i += 8) {\n const x = input[i >> 5] >>> i % 32 & 0xff;\n const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n let a = 1732584193;\n let b = -271733879;\n let c = -1732584194;\n let d = 271733878;\n\n for (let i = 0; i < x.length; i += 16) {\n const olda = a;\n const oldb = b;\n const oldc = c;\n const oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n const length8 = input.length * 8;\n const output = new Uint32Array(getOutputLength(length8));\n\n for (let i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n const lsw = (x & 0xffff) + (y & 0xffff);\n const msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nvar _default = md5;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/md5.js?");
621
+
622
+ /***/ }),
623
+
624
+ /***/ "./node_modules/uuid/dist/commonjs-browser/native.js":
625
+ /*!***********************************************************!*\
626
+ !*** ./node_modules/uuid/dist/commonjs-browser/native.js ***!
627
+ \***********************************************************/
628
+ /***/ ((__unused_webpack_module, exports) => {
629
+
630
+ "use strict";
631
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nconst randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nvar _default = {\n randomUUID\n};\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/native.js?");
632
+
633
+ /***/ }),
634
+
635
+ /***/ "./node_modules/uuid/dist/commonjs-browser/nil.js":
636
+ /*!********************************************************!*\
637
+ !*** ./node_modules/uuid/dist/commonjs-browser/nil.js ***!
638
+ \********************************************************/
639
+ /***/ ((__unused_webpack_module, exports) => {
640
+
641
+ "use strict";
642
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _default = '00000000-0000-0000-0000-000000000000';\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/nil.js?");
643
+
644
+ /***/ }),
645
+
646
+ /***/ "./node_modules/uuid/dist/commonjs-browser/parse.js":
647
+ /*!**********************************************************!*\
648
+ !*** ./node_modules/uuid/dist/commonjs-browser/parse.js ***!
649
+ \**********************************************************/
650
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
651
+
652
+ "use strict";
653
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\nvar _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/commonjs-browser/validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction parse(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n let v;\n const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nvar _default = parse;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/parse.js?");
654
+
655
+ /***/ }),
656
+
657
+ /***/ "./node_modules/uuid/dist/commonjs-browser/regex.js":
658
+ /*!**********************************************************!*\
659
+ !*** ./node_modules/uuid/dist/commonjs-browser/regex.js ***!
660
+ \**********************************************************/
661
+ /***/ ((__unused_webpack_module, exports) => {
662
+
663
+ "use strict";
664
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/regex.js?");
665
+
666
+ /***/ }),
667
+
668
+ /***/ "./node_modules/uuid/dist/commonjs-browser/rng.js":
669
+ /*!********************************************************!*\
670
+ !*** ./node_modules/uuid/dist/commonjs-browser/rng.js ***!
671
+ \********************************************************/
672
+ /***/ ((__unused_webpack_module, exports) => {
673
+
674
+ "use strict";
675
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = rng;\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\n\nfunction rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/rng.js?");
676
+
677
+ /***/ }),
678
+
679
+ /***/ "./node_modules/uuid/dist/commonjs-browser/sha1.js":
680
+ /*!*********************************************************!*\
681
+ !*** ./node_modules/uuid/dist/commonjs-browser/sha1.js ***!
682
+ \*********************************************************/
683
+ /***/ ((__unused_webpack_module, exports) => {
684
+
685
+ "use strict";
686
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\n// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (let i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n const l = bytes.length / 4 + 2;\n const N = Math.ceil(l / 16);\n const M = new Array(N);\n\n for (let i = 0; i < N; ++i) {\n const arr = new Uint32Array(16);\n\n for (let j = 0; j < 16; ++j) {\n arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];\n }\n\n M[i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (let i = 0; i < N; ++i) {\n const W = new Uint32Array(80);\n\n for (let t = 0; t < 16; ++t) {\n W[t] = M[i][t];\n }\n\n for (let t = 16; t < 80; ++t) {\n W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n }\n\n let a = H[0];\n let b = H[1];\n let c = H[2];\n let d = H[3];\n let e = H[4];\n\n for (let t = 0; t < 80; ++t) {\n const s = Math.floor(t / 20);\n const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nvar _default = sha1;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/sha1.js?");
687
+
688
+ /***/ }),
689
+
690
+ /***/ "./node_modules/uuid/dist/commonjs-browser/stringify.js":
691
+ /*!**************************************************************!*\
692
+ !*** ./node_modules/uuid/dist/commonjs-browser/stringify.js ***!
693
+ \**************************************************************/
694
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
695
+
696
+ "use strict";
697
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nexports.unsafeStringify = unsafeStringify;\n\nvar _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/commonjs-browser/validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nfunction unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nvar _default = stringify;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/stringify.js?");
698
+
699
+ /***/ }),
700
+
701
+ /***/ "./node_modules/uuid/dist/commonjs-browser/v1.js":
702
+ /*!*******************************************************!*\
703
+ !*** ./node_modules/uuid/dist/commonjs-browser/v1.js ***!
704
+ \*******************************************************/
705
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
706
+
707
+ "use strict";
708
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\nvar _rng = _interopRequireDefault(__webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/commonjs-browser/rng.js\"));\n\nvar _stringify = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/commonjs-browser/stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\nlet _nodeId;\n\nlet _clockseq; // Previous uuid creation time\n\n\nlet _lastMSecs = 0;\nlet _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n let i = buf && offset || 0;\n const b = buf || new Array(16);\n options = options || {};\n let node = options.node || _nodeId;\n let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n const seedBytes = options.random || (options.rng || _rng.default)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (let n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || (0, _stringify.unsafeStringify)(b);\n}\n\nvar _default = v1;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/v1.js?");
709
+
710
+ /***/ }),
711
+
712
+ /***/ "./node_modules/uuid/dist/commonjs-browser/v3.js":
713
+ /*!*******************************************************!*\
714
+ !*** ./node_modules/uuid/dist/commonjs-browser/v3.js ***!
715
+ \*******************************************************/
716
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
717
+
718
+ "use strict";
719
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\nvar _v = _interopRequireDefault(__webpack_require__(/*! ./v35.js */ \"./node_modules/uuid/dist/commonjs-browser/v35.js\"));\n\nvar _md = _interopRequireDefault(__webpack_require__(/*! ./md5.js */ \"./node_modules/uuid/dist/commonjs-browser/md5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v3 = (0, _v.default)('v3', 0x30, _md.default);\nvar _default = v3;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/v3.js?");
720
+
721
+ /***/ }),
722
+
723
+ /***/ "./node_modules/uuid/dist/commonjs-browser/v35.js":
724
+ /*!********************************************************!*\
725
+ !*** ./node_modules/uuid/dist/commonjs-browser/v35.js ***!
726
+ \********************************************************/
727
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
728
+
729
+ "use strict";
730
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.URL = exports.DNS = void 0;\nexports[\"default\"] = v35;\n\nvar _stringify = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/commonjs-browser/stringify.js\");\n\nvar _parse = _interopRequireDefault(__webpack_require__(/*! ./parse.js */ \"./node_modules/uuid/dist/commonjs-browser/parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n const bytes = [];\n\n for (let i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nconst DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexports.DNS = DNS;\nconst URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexports.URL = URL;\n\nfunction v35(name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n var _namespace;\n\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = (0, _parse.default)(namespace);\n }\n\n if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n let bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return (0, _stringify.unsafeStringify)(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/v35.js?");
731
+
732
+ /***/ }),
733
+
734
+ /***/ "./node_modules/uuid/dist/commonjs-browser/v4.js":
735
+ /*!*******************************************************!*\
736
+ !*** ./node_modules/uuid/dist/commonjs-browser/v4.js ***!
737
+ \*******************************************************/
738
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
739
+
740
+ "use strict";
741
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\nvar _native = _interopRequireDefault(__webpack_require__(/*! ./native.js */ \"./node_modules/uuid/dist/commonjs-browser/native.js\"));\n\nvar _rng = _interopRequireDefault(__webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/commonjs-browser/rng.js\"));\n\nvar _stringify = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/commonjs-browser/stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction v4(options, buf, offset) {\n if (_native.default.randomUUID && !buf && !options) {\n return _native.default.randomUUID();\n }\n\n options = options || {};\n\n const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return (0, _stringify.unsafeStringify)(rnds);\n}\n\nvar _default = v4;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/v4.js?");
742
+
743
+ /***/ }),
744
+
745
+ /***/ "./node_modules/uuid/dist/commonjs-browser/v5.js":
746
+ /*!*******************************************************!*\
747
+ !*** ./node_modules/uuid/dist/commonjs-browser/v5.js ***!
748
+ \*******************************************************/
749
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
750
+
751
+ "use strict";
752
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\nvar _v = _interopRequireDefault(__webpack_require__(/*! ./v35.js */ \"./node_modules/uuid/dist/commonjs-browser/v35.js\"));\n\nvar _sha = _interopRequireDefault(__webpack_require__(/*! ./sha1.js */ \"./node_modules/uuid/dist/commonjs-browser/sha1.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v5 = (0, _v.default)('v5', 0x50, _sha.default);\nvar _default = v5;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/v5.js?");
753
+
754
+ /***/ }),
755
+
756
+ /***/ "./node_modules/uuid/dist/commonjs-browser/validate.js":
757
+ /*!*************************************************************!*\
758
+ !*** ./node_modules/uuid/dist/commonjs-browser/validate.js ***!
759
+ \*************************************************************/
760
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
761
+
762
+ "use strict";
763
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\nvar _regex = _interopRequireDefault(__webpack_require__(/*! ./regex.js */ \"./node_modules/uuid/dist/commonjs-browser/regex.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && _regex.default.test(uuid);\n}\n\nvar _default = validate;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/validate.js?");
764
+
765
+ /***/ }),
766
+
767
+ /***/ "./node_modules/uuid/dist/commonjs-browser/version.js":
768
+ /*!************************************************************!*\
769
+ !*** ./node_modules/uuid/dist/commonjs-browser/version.js ***!
770
+ \************************************************************/
771
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
772
+
773
+ "use strict";
774
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\nvar _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/commonjs-browser/validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction version(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n return parseInt(uuid.slice(14, 15), 16);\n}\n\nvar _default = version;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://hsync/./node_modules/uuid/dist/commonjs-browser/version.js?");
293
775
 
294
776
  /***/ }),
295
777
 
@@ -304,6 +786,26 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
304
786
 
305
787
  /***/ }),
306
788
 
789
+ /***/ "?ed1b":
790
+ /*!**********************!*\
791
+ !*** util (ignored) ***!
792
+ \**********************/
793
+ /***/ (() => {
794
+
795
+ eval("/* (ignored) */\n\n//# sourceURL=webpack://hsync/util_(ignored)?");
796
+
797
+ /***/ }),
798
+
799
+ /***/ "?d17e":
800
+ /*!**********************!*\
801
+ !*** util (ignored) ***!
802
+ \**********************/
803
+ /***/ (() => {
804
+
805
+ eval("/* (ignored) */\n\n//# sourceURL=webpack://hsync/util_(ignored)?");
806
+
807
+ /***/ }),
808
+
307
809
  /***/ "./node_modules/precompiled-mqtt/dist/mqtt.browser.js":
308
810
  /*!************************************************************!*\
309
811
  !*** ./node_modules/precompiled-mqtt/dist/mqtt.browser.js ***!
@@ -321,7 +823,7 @@ eval("/*! For license information please see mqtt.browser.js.LICENSE.txt */\n!fu
321
823
  /***/ ((module) => {
322
824
 
323
825
  "use strict";
324
- eval("module.exports = JSON.parse('{\"_from\":\"net-web\",\"_id\":\"net-web@0.2.0\",\"_inBundle\":false,\"_integrity\":\"sha512-eiQ3Yo/8Ikg5fLSAkT+U+nBeKAyCptgxZjsICaaFIpj9jtdLpSrO7tzq8AlcQctkZ+qxyqaB0QC/VGxbwCxwIA==\",\"_location\":\"/net-web\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"tag\",\"registry\":true,\"raw\":\"net-web\",\"name\":\"net-web\",\"escapedName\":\"net-web\",\"rawSpec\":\"\",\"saveSpec\":null,\"fetchSpec\":\"latest\"},\"_requiredBy\":[\"#USER\",\"/\"],\"_resolved\":\"https://registry.npmjs.org/net-web/-/net-web-0.2.0.tgz\",\"_shasum\":\"2a57c14ec88e210f77dee95c625008c8e0e167d3\",\"_spec\":\"net-web\",\"_where\":\"/home/monteslu/code/mine/hsync\",\"author\":{\"name\":\"Luis Montes\"},\"bugs\":{\"url\":\"https://github.com/monteslu/net-web/issues\"},\"bundleDependencies\":false,\"deprecated\":false,\"description\":\"a global(page) node net shim for the web\",\"devDependencies\":{\"webpack\":\"^5.75.0\",\"webpack-cli\":\"^5.0.1\"},\"homepage\":\"https://github.com/monteslu/net-web#readme\",\"license\":\"ISC\",\"main\":\"net-web.js\",\"name\":\"net-web\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/monteslu/net-web.git\"},\"scripts\":{\"build\":\"webpack && BUILD_MODE=production webpack\",\"test\":\"echo \\\\\"Error: no test specified\\\\\" && exit 1\"},\"version\":\"0.2.0\"}');\n\n//# sourceURL=webpack://hsync/./node_modules/net-web/package.json?");
826
+ eval("module.exports = JSON.parse('{\"name\":\"net-web\",\"version\":\"0.2.0\",\"description\":\"a global(page) node net shim for the web\",\"main\":\"net-web.js\",\"scripts\":{\"test\":\"echo \\\\\"Error: no test specified\\\\\" && exit 1\",\"build\":\"webpack && BUILD_MODE=production webpack\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/monteslu/net-web.git\"},\"author\":\"Luis Montes\",\"license\":\"ISC\",\"devDependencies\":{\"webpack\":\"^5.75.0\",\"webpack-cli\":\"^5.0.1\"}}');\n\n//# sourceURL=webpack://hsync/./node_modules/net-web/package.json?");
325
827
 
326
828
  /***/ })
327
829