mirror of
https://github.com/c9fe/22120.git
synced 2024-11-15 07:22:28 +01:00
2 lines
40 KiB
JavaScript
2 lines
40 KiB
JavaScript
#!/usr/bin/env node
|
|
"use strict";exports.id=81,exports.ids=[81],exports.modules={977:(e,t,s)=>{const{EMPTY_BUFFER:r}=s(1872);function i(e,t){if(0===e.length)return r;if(1===e.length)return e[0];const s=Buffer.allocUnsafe(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];s.set(r,i),i+=r.length}return i<t?s.slice(0,i):s}function o(e,t,s,r,i){for(let o=0;o<i;o++)s[r+o]=e[o]^t[3&o]}function n(e,t){for(let s=0;s<e.length;s++)e[s]^=t[3&s]}function a(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function h(e){if(h.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=Buffer.from(e):ArrayBuffer.isView(e)?t=Buffer.from(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),h.readOnly=!1),t}try{const t=s(Object(function(){var e=new Error("Cannot find module 'bufferutil'");throw e.code="MODULE_NOT_FOUND",e}()));e.exports={concat:i,mask(e,s,r,i,n){n<48?o(e,s,r,i,n):t.mask(e,s,r,i,n)},toArrayBuffer:a,toBuffer:h,unmask(e,s){e.length<32?n(e,s):t.unmask(e,s)}}}catch(t){e.exports={concat:i,mask:o,toArrayBuffer:a,toBuffer:h,unmask:n}}},1872:e=>{e.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},62:(e,t,s)=>{const{kForOnEventAttribute:r,kListener:i}=s(1872),o=Symbol("kCode"),n=Symbol("kData"),a=Symbol("kError"),h=Symbol("kMessage"),c=Symbol("kReason"),l=Symbol("kTarget"),d=Symbol("kType"),f=Symbol("kWasClean");class _{constructor(e){this[l]=null,this[d]=e}get target(){return this[l]}get type(){return this[d]}}Object.defineProperty(_.prototype,"target",{enumerable:!0}),Object.defineProperty(_.prototype,"type",{enumerable:!0});class u extends _{constructor(e,t={}){super(e),this[o]=void 0===t.code?0:t.code,this[c]=void 0===t.reason?"":t.reason,this[f]=void 0!==t.wasClean&&t.wasClean}get code(){return this[o]}get reason(){return this[c]}get wasClean(){return this[f]}}Object.defineProperty(u.prototype,"code",{enumerable:!0}),Object.defineProperty(u.prototype,"reason",{enumerable:!0}),Object.defineProperty(u.prototype,"wasClean",{enumerable:!0});class p extends _{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[h]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[h]}}Object.defineProperty(p.prototype,"error",{enumerable:!0}),Object.defineProperty(p.prototype,"message",{enumerable:!0});class m extends _{constructor(e,t={}){super(e),this[n]=void 0===t.data?null:t.data}get data(){return this[n]}}Object.defineProperty(m.prototype,"data",{enumerable:!0});const y={addEventListener(e,t,s={}){let o;if("message"===e)o=function(e,s){const r=new m("message",{data:s?e:e.toString()});r[l]=this,t.call(this,r)};else if("close"===e)o=function(e,s){const r=new u("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,t.call(this,r)};else if("error"===e)o=function(e){const s=new p("error",{error:e,message:e.message});s[l]=this,t.call(this,s)};else{if("open"!==e)return;o=function(){const e=new _("open");e[l]=this,t.call(this,e)}}o[r]=!!s[r],o[i]=t,s.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(const s of this.listeners(e))if(s[i]===t&&!s[r]){this.removeListener(e,s);break}}};e.exports={CloseEvent:u,ErrorEvent:p,Event:_,EventTarget:y,MessageEvent:m}},1503:(e,t,s)=>{const{tokenChars:r}=s(6746);function i(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}e.exports={format:function(e){return Object.keys(e).map((t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map((e=>[t].concat(Object.keys(e).map((t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(e){const t=Object.create(null);let s,o,n=Object.create(null),a=!1,h=!1,c=!1,l=-1,d=-1,f=-1,_=0;for(;_<e.length;_++)if(d=e.charCodeAt(_),void 0===s)if(-1===f&&1===r[d])-1===l&&(l=_);else if(0===_||32!==d&&9!==d){if(59!==d&&44!==d)throw new SyntaxError(`Unexpected character at index ${_}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${_}`);-1===f&&(f=_);const r=e.slice(l,f);44===d?(i(t,r,n),n=Object.create(null)):s=r,l=f=-1}}else-1===f&&-1!==l&&(f=_);else if(void 0===o)if(-1===f&&1===r[d])-1===l&&(l=_);else if(32===d||9===d)-1===f&&-1!==l&&(f=_);else if(59===d||44===d){if(-1===l)throw new SyntaxError(`Unexpected character at index ${_}`);-1===f&&(f=_),i(n,e.slice(l,f),!0),44===d&&(i(t,s,n),n=Object.create(null),s=void 0),l=f=-1}else{if(61!==d||-1===l||-1!==f)throw new SyntaxError(`Unexpected character at index ${_}`);o=e.slice(l,_),l=f=-1}else if(h){if(1!==r[d])throw new SyntaxError(`Unexpected character at index ${_}`);-1===l?l=_:a||(a=!0),h=!1}else if(c)if(1===r[d])-1===l&&(l=_);else if(34===d&&-1!==l)c=!1,f=_;else{if(92!==d)throw new SyntaxError(`Unexpected character at index ${_}`);h=!0}else if(34===d&&61===e.charCodeAt(_-1))c=!0;else if(-1===f&&1===r[d])-1===l&&(l=_);else if(-1===l||32!==d&&9!==d){if(59!==d&&44!==d)throw new SyntaxError(`Unexpected character at index ${_}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${_}`);-1===f&&(f=_);let r=e.slice(l,f);a&&(r=r.replace(/\\/g,""),a=!1),i(n,o,r),44===d&&(i(t,s,n),n=Object.create(null),s=void 0),o=void 0,l=f=-1}}else-1===f&&(f=_);if(-1===l||c||32===d||9===d)throw new SyntaxError("Unexpected end of input");-1===f&&(f=_);const u=e.slice(l,f);return void 0===s?i(t,u,n):(void 0===o?i(n,u,!0):i(n,o,a?u.replace(/\\/g,""):u),i(t,s,n)),t}}},305:e=>{const t=Symbol("kDone"),s=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[s]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[s]()}[s](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[t])}}}},5196:(e,t,s)=>{const r=s(9796),i=s(977),o=s(305),{kStatusCode:n}=s(1872),a=Buffer.from([0,0,255,255]),h=Symbol("permessage-deflate"),c=Symbol("total-length"),l=Symbol("callback"),d=Symbol("buffers"),f=Symbol("error");let _;function u(e){this[d].push(e),this[c]+=e.length}function p(e){this[c]+=e.length,this[h]._maxPayload<1||this[c]<=this[h]._maxPayload?this[d].push(e):(this[f]=new RangeError("Max payload size exceeded"),this[f].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[f][n]=1009,this.removeListener("data",p),this.reset())}function m(e){this[h]._inflate=null,e[n]=1007,this[l](e)}e.exports=class{constructor(e,t,s){if(this._maxPayload=0|s,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!_){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;_=new o(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[l];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,s=e.find((e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits)));if(!s)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(s.server_no_context_takeover=!0),t.clientNoContextTakeover&&(s.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(s.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?s.client_max_window_bits=t.clientMaxWindowBits:!0!==s.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete s.client_max_window_bits,s}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach((e=>{Object.keys(e).forEach((t=>{let s=e[t];if(s.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(s=s[0],"client_max_window_bits"===t){if(!0!==s){const e=+s;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}else if("server_max_window_bits"===t){const e=+s;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==s)throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}e[t]=s}))})),e}decompress(e,t,s){_.add((r=>{this._decompress(e,t,((e,t)=>{r(),s(e,t)}))}))}compress(e,t,s){_.add((r=>{this._compress(e,t,((e,t)=>{r(),s(e,t)}))}))}_decompress(e,t,s){const o=this._isServer?"client":"server";if(!this._inflate){const e=`${o}_max_window_bits`,t="number"!=typeof this.params[e]?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[h]=this,this._inflate[c]=0,this._inflate[d]=[],this._inflate.on("error",m),this._inflate.on("data",p)}this._inflate[l]=s,this._inflate.write(e),t&&this._inflate.write(a),this._inflate.flush((()=>{const e=this._inflate[f];if(e)return this._inflate.close(),this._inflate=null,void s(e);const r=i.concat(this._inflate[d],this._inflate[c]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[c]=0,this._inflate[d]=[],t&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),s(null,r)}))}_compress(e,t,s){const o=this._isServer?"server":"client";if(!this._deflate){const e=`${o}_max_window_bits`,t="number"!=typeof this.params[e]?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[c]=0,this._deflate[d]=[],this._deflate.on("data",u)}this._deflate[l]=s,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=i.concat(this._deflate[d],this._deflate[c]);t&&(e=e.slice(0,e.length-4)),this._deflate[l]=null,this._deflate[c]=0,this._deflate[d]=[],t&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),s(null,e)}))}}},2957:(e,t,s)=>{const{Writable:r}=s(2781),i=s(5196),{BINARY_TYPES:o,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:h}=s(1872),{concat:c,toArrayBuffer:l,unmask:d}=s(977),{isValidStatusCode:f,isValidUTF8:_}=s(6746);function u(e,t,s,r,i){const o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,u),o.code=i,o[a]=r,o}e.exports=class extends r{constructor(e={}){super(),this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[h]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(e,t,s){if(8===this._opcode&&0==this._state)return s();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];return this._buffers[0]=t.slice(e),t.slice(0,e)}const t=Buffer.allocUnsafe(e);do{const s=this._buffers[0],r=t.length-e;e>=s.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),r),this._buffers[0]=s.slice(e)),e-=s.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,u(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const t=64==(64&e[0]);if(t&&!this._extensions[i.extensionName])return this._loop=!1,u(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(t)return this._loop=!1,u(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,u(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,u(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,u(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,u(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,u(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,u(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[1]),this._isServer){if(!this._masked)return this._loop=!1,u(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,u(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,u(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,u(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=n;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);t=this.consume(this._payloadLength),this._masked&&d(t,this._mask)}return this._opcode>7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,((e,s)=>{if(e)return t(e);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(u(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(s)}const r=this.dataMessage();if(r)return t(r);this.startLoop(t)}))}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let s;s="nodebuffer"===this._binaryType?c(t,e):"arraybuffer"===this._binaryType?l(c(t,e)):t,this.emit("message",s,!0)}else{const s=c(t,e);if(!this._skipUTF8Validation&&!_(s))return this._loop=!1,u(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",s,!1)}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,n),this.end();else{if(1===e.length)return u(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const t=e.readUInt16BE(0);if(!f(t))return u(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const s=e.slice(2);if(!this._skipUTF8Validation&&!_(s))return u(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,s),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}}},7330:(e,t,s)=>{s(1808),s(4404);const{randomFillSync:r}=s(6113),i=s(5196),{EMPTY_BUFFER:o}=s(1872),{isValidStatusCode:n}=s(6746),{mask:a,toBuffer:h}=s(977),c=Buffer.alloc(4);class l{constructor(e,t){this._extensions=t||{},this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){const s=t.mask&&t.readOnly;let i=t.mask?6:2,o=e.length;e.length>=65536?(i+=8,o=127):e.length>125&&(i+=2,o=126);const n=Buffer.allocUnsafe(s?e.length+i:i);return n[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(n[0]|=64),n[1]=o,126===o?n.writeUInt16BE(e.length,2):127===o&&(n.writeUInt32BE(0,2),n.writeUInt32BE(e.length,6)),t.mask?(r(c,0,4),n[1]|=128,n[i-4]=c[0],n[i-3]=c[1],n[i-2]=c[2],n[i-1]=c[3],s?(a(e,c,n,i,e.length),[n]):(a(e,c,e,0,e.length),[n,e])):[n,e]}close(e,t,s,r){let i;if(void 0===e)i=o;else{if("number"!=typeof e||!n(e))throw new TypeError("First argument must be a valid error code number");if(void 0!==t&&t.length){const s=Buffer.byteLength(t);if(s>123)throw new RangeError("The message must not be greater than 123 bytes");i=Buffer.allocUnsafe(2+s),i.writeUInt16BE(e,0),"string"==typeof t?i.write(t,2):i.set(t,2)}else i=Buffer.allocUnsafe(2),i.writeUInt16BE(e,0)}this._deflating?this.enqueue([this.doClose,i,s,r]):this.doClose(i,s,r)}doClose(e,t,s){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:8,mask:t,readOnly:!1}),s)}ping(e,t,s){const r=h(e);if(r.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPing,r,t,h.readOnly,s]):this.doPing(r,t,h.readOnly,s)}doPing(e,t,s,r){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:9,mask:t,readOnly:s}),r)}pong(e,t,s){const r=h(e);if(r.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPong,r,t,h.readOnly,s]):this.doPong(r,t,h.readOnly,s)}doPong(e,t,s,r){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:10,mask:t,readOnly:s}),r)}send(e,t,s){const r=h(e),o=this._extensions[i.extensionName];let n=t.binary?2:1,a=t.compress;if(this._firstFragment?(this._firstFragment=!1,a&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=r.length>=o._threshold),this._compress=a):(a=!1,n=0),t.fin&&(this._firstFragment=!0),o){const e={fin:t.fin,rsv1:a,opcode:n,mask:t.mask,readOnly:h.readOnly};this._deflating?this.enqueue([this.dispatch,r,this._compress,e,s]):this.dispatch(r,this._compress,e,s)}else this.sendFrame(l.frame(r,{fin:t.fin,rsv1:!1,opcode:n,mask:t.mask,readOnly:h.readOnly}),s)}dispatch(e,t,s,r){if(!t)return void this.sendFrame(l.frame(e,s),r);const o=this._extensions[i.extensionName];this._bufferedBytes+=e.length,this._deflating=!0,o.compress(e,s.fin,((t,i)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");"function"==typeof r&&r(e);for(let t=0;t<this._queue.length;t++){const s=this._queue[t][4];"function"==typeof s&&s(e)}}else this._bufferedBytes-=e.length,this._deflating=!1,s.readOnly=!1,this.sendFrame(l.frame(i,s),r),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[1].length,Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[1].length,this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}e.exports=l},404:(e,t,s)=>{const{Duplex:r}=s(2781);function i(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function n(e){this.removeListener("error",n),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}e.exports=function(e,t){let s=!0,a=!0;function h(){s&&e._socket.resume()}e.readyState===e.CONNECTING?e.once("open",(function(){e._receiver.removeAllListeners("drain"),e._receiver.on("drain",h)})):(e._receiver.removeAllListeners("drain"),e._receiver.on("drain",h));const c=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t,r){const i=!r&&c._readableState.objectMode?t.toString():t;c.push(i)||(s=!1,e._socket.pause())})),e.once("error",(function(e){c.destroyed||(a=!1,c.destroy(e))})),e.once("close",(function(){c.destroyed||c.push(null)})),c._destroy=function(t,s){if(e.readyState===e.CLOSED)return s(t),void process.nextTick(i,c);let r=!1;e.once("error",(function(e){r=!0,s(e)})),e.once("close",(function(){r||s(t),process.nextTick(i,c)})),a&&e.terminate()},c._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),c._readableState.endEmitted&&c.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){c._final(t)}))},c._read=function(){e.readyState!==e.OPEN||s||(s=!0,e._receiver._writableState.needDrain||e._socket.resume())},c._write=function(t,s,r){e.readyState!==e.CONNECTING?e.send(t,r):e.once("open",(function(){c._write(t,s,r)}))},c.on("end",o),c.on("error",n),c}},640:(e,t,s)=>{const{tokenChars:r}=s(6746);e.exports={parse:function(e){const t=new Set;let s=-1,i=-1,o=0;for(;o<e.length;o++){const n=e.charCodeAt(o);if(-1===i&&1===r[n])-1===s&&(s=o);else if(0===o||32!==n&&9!==n){if(44!==n)throw new SyntaxError(`Unexpected character at index ${o}`);{if(-1===s)throw new SyntaxError(`Unexpected character at index ${o}`);-1===i&&(i=o);const r=e.slice(s,i);if(t.has(r))throw new SyntaxError(`The "${r}" subprotocol is duplicated`);t.add(r),s=i=-1}}else-1===i&&-1!==s&&(i=o)}if(-1===s||-1!==i)throw new SyntaxError("Unexpected end of input");const n=e.slice(s,o);if(t.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return t.add(n),t}}},6746:(e,t,s)=>{const r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function i(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999}function o(e){const t=e.length;let s=0;for(;s<t;)if(0==(128&e[s]))s++;else if(192==(224&e[s])){if(s+1===t||128!=(192&e[s+1])||192==(254&e[s]))return!1;s+=2}else if(224==(240&e[s])){if(s+2>=t||128!=(192&e[s+1])||128!=(192&e[s+2])||224===e[s]&&128==(224&e[s+1])||237===e[s]&&160==(224&e[s+1]))return!1;s+=3}else{if(240!=(248&e[s]))return!1;if(s+3>=t||128!=(192&e[s+1])||128!=(192&e[s+2])||128!=(192&e[s+3])||240===e[s]&&128==(240&e[s+1])||244===e[s]&&e[s+1]>143||e[s]>244)return!1;s+=4}return!0}try{const t=s(Object(function(){var e=new Error("Cannot find module 'utf-8-validate'");throw e.code="MODULE_NOT_FOUND",e}()));e.exports={isValidStatusCode:i,isValidUTF8:e=>e.length<150?o(e):t(e),tokenChars:r}}catch(t){e.exports={isValidStatusCode:i,isValidUTF8:o,tokenChars:r}}},9284:(e,t,s)=>{const r=s(2361),i=s(3685),{createHash:o}=(s(5687),s(1808),s(4404),s(6113)),n=s(1503),a=s(5196),h=s(640),c=s(8762),{GUID:l,kWebSocket:d}=s(1872),f=/^[+/0-9A-Za-z]{22}==$/;function _(e){e._state=2,e.emit("close")}function u(){this.destroy()}function p(e,t,s,r){e.writable&&(s=s||i.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},e.write(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r\n`+Object.keys(r).map((e=>`${e}: ${r[e]}`)).join("\r\n")+"\r\n\r\n"+s)),e.removeListener("error",u),e.destroy()}e.exports=class extends r{constructor(e,t){if(super(),null==(e={maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=i.createServer(((e,t)=>{const s=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),t.end(s)})),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const s of Object.keys(t))e.on(s,t[s]);return function(){for(const s of Object.keys(t))e.removeListener(s,t[s])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state)return e&&this.once("close",(()=>{e(new Error("The server is not running"))})),void process.nextTick(_,this);if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(_,this);else{const e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close((()=>{_(this)}))}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,s,r){t.on("error",u);const i=void 0!==e.headers["sec-websocket-key"]&&e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if("GET"!==e.method||"websocket"!==e.headers.upgrade.toLowerCase()||!i||!f.test(i)||8!==o&&13!==o||!this.shouldHandle(e))return p(t,400);const c=e.headers["sec-websocket-protocol"];let l=new Set;if(void 0!==c)try{l=h.parse(c)}catch(e){return p(t,400)}const d=e.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&void 0!==d){const e=new a(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=n.parse(d);t[a.extensionName]&&(e.accept(t[a.extensionName]),_[a.extensionName]=e)}catch(e){return p(t,400)}}if(this.options.verifyClient){const n={origin:e.headers[8===o?"sec-websocket-origin":"origin"],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(n,((o,n,a,h)=>{if(!o)return p(t,n||401,a,h);this.completeUpgrade(_,i,l,e,t,s,r)}));if(!this.options.verifyClient(n))return p(t,401)}this.completeUpgrade(_,i,l,e,t,s,r)}completeUpgrade(e,t,s,r,i,h,f){if(!i.readable||!i.writable)return i.destroy();if(i[d])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return p(i,503);const m=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${o("sha1").update(t+l).digest("base64")}`],y=new c(null);if(s.size){const e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;e&&(m.push(`Sec-WebSocket-Protocol: ${e}`),y._protocol=e)}if(e[a.extensionName]){const t=e[a.extensionName].params,s=n.format({[a.extensionName]:[t]});m.push(`Sec-WebSocket-Extensions: ${s}`),y._extensions=e}this.emit("headers",m,r),i.write(m.concat("\r\n").join("\r\n")),i.removeListener("error",u),y.setSocket(i,h,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(y),y.on("close",(()=>{this.clients.delete(y),this._shouldEmitClose&&!this.clients.size&&process.nextTick(_,this)}))),f(y,r)}}},8762:(e,t,s)=>{const r=s(2361),i=s(5687),o=s(3685),n=s(1808),a=s(4404),{randomBytes:h,createHash:c}=s(6113),{Readable:l}=s(2781),{URL:d}=s(7310),f=s(5196),_=s(2957),u=s(7330),{BINARY_TYPES:p,EMPTY_BUFFER:m,GUID:y,kForOnEventAttribute:g,kListener:b,kStatusCode:v,kWebSocket:S,NOOP:w}=s(1872),{EventTarget:{addEventListener:E,removeEventListener:x}}=s(62),{format:k,parse:O}=s(1503),{toBuffer:C}=s(977),N=["CONNECTING","OPEN","CLOSING","CLOSED"],T=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,L=[8,13];class P extends r{constructor(e,t,s){super(),this._binaryType=p[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=m,this._closeTimer=null,this._extensions={},this._protocol="",this._readyState=P.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(s=t,t=[]):t=[t]),R(this,e,t,s)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){p.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,s){const r=new _({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});this._sender=new u(e,this._extensions),this._receiver=r,this._socket=e,r[S]=this,e[S]=this,r.on("conclude",D),r.on("drain",W),r.on("error",F),r.on("message",$),r.on("ping",j),r.on("pong",G),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",q),e.on("data",z),e.on("end",H),e.on("error",Y),this._readyState=P.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=P.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=P.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==P.CLOSED){if(this.readyState===P.CONNECTING){const e="WebSocket was closed before the connection was established";return B(this,this._req,e)}this.readyState!==P.CLOSING?(this._readyState=P.CLOSING,this._sender.close(e,t,!this._isServer,(e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}ping(e,t,s){if(this.readyState===P.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===P.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||m,t,s)):A(this,e,s)}pong(e,t,s){if(this.readyState===P.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===P.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||m,t,s)):A(this,e,s)}send(e,t,s){if(this.readyState===P.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==P.OPEN)return void A(this,e,s);const r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[f.extensionName]||(r.compress=!1),this._sender.send(e||m,r,s)}terminate(){if(this.readyState!==P.CLOSED){if(this.readyState===P.CONNECTING){const e="WebSocket was closed before the connection was established";return B(this,this._req,e)}this._socket&&(this._readyState=P.CLOSING,this._socket.destroy())}}}function R(e,t,s,r){const n={protocolVersion:L[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!L.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${L.join(", ")})`);let a;if(t instanceof d)a=t,e._url=t.href;else{try{a=new d(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}e._url=t}const l="wss:"===a.protocol,_="ws+unix:"===a.protocol;if("ws:"!==a.protocol&&!l&&!_)throw new SyntaxError('The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"');if(_&&!a.pathname)throw new SyntaxError("The URL's pathname is empty");if(a.hash)throw new SyntaxError("The URL contains a fragment identifier");const u=l?443:80,p=h(16).toString("base64"),m=l?i.get:o.get,g=new Set;let b;if(n.createConnection=l?I:U,n.defaultPort=n.defaultPort||u,n.port=a.port||u,n.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,n.headers={"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket",...n.headers},n.path=a.pathname+a.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(b=new f(!0!==n.perMessageDeflate?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=k({[f.extensionName]:b.offer()})),s.length){for(const e of s){if("string"!=typeof e||!T.test(e)||g.has(e))throw new SyntaxError("An invalid or duplicated subprotocol was specified");g.add(e)}n.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(n.origin&&(n.protocolVersion<13?n.headers["Sec-WebSocket-Origin"]=n.origin:n.headers.Origin=n.origin),(a.username||a.password)&&(n.auth=`${a.username}:${a.password}`),_){const e=n.path.split(":");n.socketPath=e[0],n.path=e[1]}let v=e._req=m(n);n.timeout&&v.on("timeout",(()=>{B(e,v,"Opening handshake has timed out")})),v.on("error",(t=>{null===v||v.aborted||(v=e._req=null,e._readyState=P.CLOSING,e.emit("error",t),e.emitClose())})),v.on("response",(i=>{const o=i.headers.location,a=i.statusCode;if(o&&n.followRedirects&&a>=300&&a<400){if(++e._redirects>n.maxRedirects)return void B(e,v,"Maximum redirects exceeded");v.abort();const i=new d(o,t);R(e,i,s,r)}else e.emit("unexpected-response",v,i)||B(e,v,`Unexpected server response: ${i.statusCode}`)})),v.on("upgrade",((t,s,r)=>{if(e.emit("upgrade",t),e.readyState!==P.CONNECTING)return;v=e._req=null;const i=c("sha1").update(p+y).digest("base64");if(t.headers["sec-websocket-accept"]!==i)return void B(e,s,"Invalid Sec-WebSocket-Accept header");const o=t.headers["sec-websocket-protocol"];let a;if(void 0!==o?g.size?g.has(o)||(a="Server sent an invalid subprotocol"):a="Server sent a subprotocol but none was requested":g.size&&(a="Server sent no subprotocol"),a)return void B(e,s,a);o&&(e._protocol=o);const h=t.headers["sec-websocket-extensions"];if(void 0!==h){if(!b)return void B(e,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");let t;try{t=O(h)}catch(t){return void B(e,s,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(t);if(1!==r.length||r[0]!==f.extensionName)return void B(e,s,"Server indicated an extension that was not requested");try{b.accept(t[f.extensionName])}catch(t){return void B(e,s,"Invalid Sec-WebSocket-Extensions header")}e._extensions[f.extensionName]=b}e.setSocket(s,r,{maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})}))}function U(e){return e.path=e.socketPath,n.connect(e)}function I(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function B(e,t,s){e._readyState=P.CLOSING;const r=new Error(s);Error.captureStackTrace(r,B),t.setHeader?(t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),t.once("abort",e.emitClose.bind(e)),e.emit("error",r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function A(e,t,s){if(t){const s=C(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}s&&s(new Error(`WebSocket is not open: readyState ${e.readyState} (${N[e.readyState]})`))}function D(e,t){const s=this[S];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[S]&&(s._socket.removeListener("data",z),process.nextTick(V,s._socket),1005===e?s.close():s.close(e,t))}function W(){this[S]._socket.resume()}function F(e){const t=this[S];void 0!==t._socket[S]&&(t._socket.removeListener("data",z),process.nextTick(V,t._socket),t.close(e[v])),t.emit("error",e)}function M(){this[S].emitClose()}function $(e,t){this[S].emit("message",e,t)}function j(e){const t=this[S];t.pong(e,!t._isServer,w),t.emit("ping",e)}function G(e){this[S].emit("pong",e)}function V(e){e.resume()}function q(){const e=this[S];let t;this.removeListener("close",q),this.removeListener("data",z),this.removeListener("end",H),e._readyState=P.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[S]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",M),e._receiver.on("finish",M))}function z(e){this[S]._receiver.write(e)||this.pause()}function H(){const e=this[S];e._readyState=P.CLOSING,e._receiver.end(),this.end()}function Y(){const e=this[S];this.removeListener("error",Y),this.on("error",w),e&&(e._readyState=P.CLOSING,this.destroy())}Object.defineProperty(P,"CONNECTING",{enumerable:!0,value:N.indexOf("CONNECTING")}),Object.defineProperty(P.prototype,"CONNECTING",{enumerable:!0,value:N.indexOf("CONNECTING")}),Object.defineProperty(P,"OPEN",{enumerable:!0,value:N.indexOf("OPEN")}),Object.defineProperty(P.prototype,"OPEN",{enumerable:!0,value:N.indexOf("OPEN")}),Object.defineProperty(P,"CLOSING",{enumerable:!0,value:N.indexOf("CLOSING")}),Object.defineProperty(P.prototype,"CLOSING",{enumerable:!0,value:N.indexOf("CLOSING")}),Object.defineProperty(P,"CLOSED",{enumerable:!0,value:N.indexOf("CLOSED")}),Object.defineProperty(P.prototype,"CLOSED",{enumerable:!0,value:N.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","protocol","readyState","url"].forEach((e=>{Object.defineProperty(P.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(P.prototype,`on${e}`,{enumerable:!0,get(){for(const t of this.listeners(e))if(t[g])return t[b];return null},set(t){for(const t of this.listeners(e))if(t[g]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[g]:!0})}})})),P.prototype.addEventListener=E,P.prototype.removeEventListener=x,e.exports=P},1081:(e,t,s)=>{s.r(t),s.d(t,{createWebSocketStream:()=>r,Receiver:()=>i,Sender:()=>o,WebSocket:()=>n,WebSocketServer:()=>a,default:()=>h});var r=s(404),i=s(2957),o=s(7330),n=s(8762),a=s(9284);const h=n}}; |