@rindo/core 4.18.2-dev.1733699480.1e6d201 → 4.18.3-dev.1734304270.ca7046f
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/cli/index.cjs +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +939 -679
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +52 -40
- package/dev-server/ws.js +1 -1
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +5 -2
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +5 -2
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +5 -3
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +10 -4
- package/internal/rindo-public-compiler.d.ts +7 -0
- package/internal/testing/index.js +4 -1
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +5 -3
- package/mock-doc/index.js +5 -3
- package/mock-doc/package.json +1 -1
- package/package.json +16 -19
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/index.js +1 -1
- package/sys/node/node-fetch.js +10 -2
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +28 -13
- package/testing/mocks.d.ts +9 -9
- package/testing/package.json +1 -1
package/dev-server/ws.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={699:(e,t,s)=>{"use strict";const r=s(60);r.createWebSocketStream=s(719),r.Server=s(722),r.Receiver=s(286),r.Sender=s(914),r.WebSocket=r,r.WebSocketServer=r.Server,e.exports=r},338:(e,t,s)=>{"use strict";const{EMPTY_BUFFER:r}=s(614),i=Buffer[Symbol.species];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]}if(e.exports={concat:function(e,t){if(0===e.length)return r;if(1===e.length)return e[0];const s=Buffer.allocUnsafe(t);let o=0;for(let t=0;t<e.length;t++){const r=e[t];s.set(r,o),o+=r.length}return o<t?new i(s.buffer,s.byteOffset,o):s},mask:o,toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:function e(t){if(e.readOnly=!0,Buffer.isBuffer(t))return t;let s;return t instanceof ArrayBuffer?s=new i(t):ArrayBuffer.isView(t)?s=new i(t.buffer,t.byteOffset,t.byteLength):(s=Buffer.from(t),e.readOnly=!1),s},unmask:n},!process.env.WS_NO_BUFFER_UTIL)try{const t=s(Object(function(){var e=new Error("Cannot find module 'bufferutil'");throw e.code="MODULE_NOT_FOUND",e}()));e.exports.mask=function(e,s,r,i,n){n<48?o(e,s,r,i,n):t.mask(e,s,r,i,n)},e.exports.unmask=function(e,s){e.length<32?n(e,s):t.unmask(e,s)}}catch(e){}},614:e=>{"use strict";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:()=>{}}},597:(e,t,s)=>{"use strict";const{kForOnEventAttribute:r,kListener:i}=s(614),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={}){for(const o of this.listeners(e))if(!s[r]&&o[i]===t&&!o[r])return;let o;if("message"===e)o=function(e,s){const r=new m("message",{data:s?e:e.toString()});r[l]=this,v(t,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,v(t,this,r)};else if("error"===e)o=function(e){const s=new p("error",{error:e,message:e.message});s[l]=this,v(t,this,s)};else{if("open"!==e)return;o=function(){const e=new _("open");e[l]=this,v(t,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}}};function v(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}e.exports={CloseEvent:u,ErrorEvent:p,Event:_,EventTarget:y,MessageEvent:m}},926:(e,t,s)=>{"use strict";const{tokenChars:r}=s(880);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}}},759:e=>{"use strict";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])}}}},971:(e,t,s)=>{"use strict";const r=s(106),i=s(338),o=s(759),{kStatusCode:n}=s(614),a=Buffer[Symbol.species],h=Buffer.from([0,0,255,255]),c=Symbol("permessage-deflate"),l=Symbol("total-length"),d=Symbol("callback"),f=Symbol("buffers"),_=Symbol("error");let u;function p(e){this[f].push(e),this[l]+=e.length}function m(e){this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload?this[f].push(e):(this[_]=new RangeError("Max payload size exceeded"),this[_].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[_][n]=1009,this.removeListener("data",m),this.reset())}function y(e){this[c]._inflate=null,e[n]=1007,this[d](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,!u){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;u=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[d];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){u.add((r=>{this._decompress(e,t,((e,t)=>{r(),s(e,t)}))}))}compress(e,t,s){u.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[c]=this,this._inflate[l]=0,this._inflate[f]=[],this._inflate.on("error",y),this._inflate.on("data",m)}this._inflate[d]=s,this._inflate.write(e),t&&this._inflate.write(h),this._inflate.flush((()=>{const e=this._inflate[_];if(e)return this._inflate.close(),this._inflate=null,void s(e);const r=i.concat(this._inflate[f],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[f]=[],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[l]=0,this._deflate[f]=[],this._deflate.on("data",p)}this._deflate[d]=s,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[l]);t&&(e=new a(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[l]=0,this._deflate[f]=[],t&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),s(null,e)}))}}},286:(e,t,s)=>{"use strict";const{Writable:r}=s(584),i=s(971),{BINARY_TYPES:o,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:h}=s(614),{concat:c,toArrayBuffer:l,unmask:d}=s(338),{isValidStatusCode:f,isValidUTF8:_}=s(880),u=Buffer[Symbol.species];e.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,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._errored=!1,this._loop=!1,this._state=0}_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]=new u(t.buffer,t.byteOffset+e,t.length-e),new u(t.buffer,t.byteOffset,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]=new u(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0);return t}startLoop(e){this._loop=!0;do{switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:return void(this._loop=!1)}}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2)return void(this._loop=!1);const t=this.consume(2);if(48&t[0]){return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"))}const s=!(64&~t[0]);if(!s||this._extensions[i.extensionName]){if(this._fin=!(128&~t[0]),this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(s){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(!this._fragmented){return void e(this.createError(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 void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"))}this._compressed=s}else{if(!(this._opcode>7&&this._opcode<11)){return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"))}if(!this._fin){return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"))}if(s){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength){return void e(this.createError(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&~t[1]),this._isServer){if(!this._masked){return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}}else if(this._masked){return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"))}126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(e)}else{e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}}getPayloadLength16(e){this._bufferedBytes<2?this._loop=!1:(this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e))}getPayloadLength64(e){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),s=t.readUInt32BE(0);if(s>Math.pow(2,21)-1){e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"))}else this._payloadLength=s*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"))}else 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&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&d(t,this._mask)}if(this._opcode>7)this.controlMessage(t,e);else{if(this._compressed)return this._state=5,void this.decompress(t,e);t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}}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){const e=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");return void t(e)}this._fragments.push(s)}this.dataMessage(t),0===this._state&&this.startLoop(t)}))}dataMessage(e){if(!this._fin)return void(this._state=0);const t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?c(s,t):"arraybuffer"===this._binaryType?l(c(s,t)):s,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=0):(this._state=6,setImmediate((()=>{this.emit("message",r,!0),this._state=0,this.startLoop(e)})))}else{const r=c(s,t);if(!this._skipUTF8Validation&&!_(r)){const t=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");return void e(t)}5===this._state||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=0):(this._state=6,setImmediate((()=>{this.emit("message",r,!1),this._state=0,this.startLoop(e)})))}}controlMessage(e,t){if(8!==this._opcode)this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=0):(this._state=6,setImmediate((()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=0,this.startLoop(t)})));else{if(0===e.length)this._loop=!1,this.emit("conclude",1005,n),this.end();else{const s=e.readUInt16BE(0);if(!f(s)){const e=this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");return void t(e)}const r=new u(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!_(r)){const e=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");return void t(e)}this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=0}}createError(e,t,s,r,i){this._loop=!1,this._errored=!0;const o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=i,o[a]=r,o}}},914:(e,t,s)=>{"use strict";const{Duplex:r}=s(584),{randomFillSync:i}=s(982),o=s(971),{EMPTY_BUFFER:n}=s(614),{isValidStatusCode:a}=s(880),{mask:h,toBuffer:c}=s(338),l=Symbol("kByteLength"),d=Buffer.alloc(4);class f{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let s,r,o=!1,n=2,a=!1;t.mask&&(s=t.maskBuffer||d,t.generateMask?t.generateMask(s):i(s,0,4),a=!(s[0]|s[1]|s[2]|s[3]),n=6),"string"==typeof e?r=t.mask&&!a||void 0===t[l]?(e=Buffer.from(e)).length:t[l]:(r=e.length,o=t.mask&&t.readOnly&&!a);let c=r;r>=65536?(n+=8,c=127):r>125&&(n+=2,c=126);const f=Buffer.allocUnsafe(o?r+n:n);return f[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(f[0]|=64),f[1]=c,126===c?f.writeUInt16BE(r,2):127===c&&(f[2]=f[3]=0,f.writeUIntBE(r,4,6)),t.mask?(f[1]|=128,f[n-4]=s[0],f[n-3]=s[1],f[n-2]=s[2],f[n-1]=s[3],a?[f,e]:o?(h(e,s,f,n,r),[f]):(h(e,s,e,0,r),[f,e])):[f,e]}close(e,t,s,r){let i;if(void 0===e)i=n;else{if("number"!=typeof e||!a(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)}const o={[l]:i.length,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,i,!1,o,r]):this.sendFrame(f.frame(i,o),r)}ping(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):(r=(e=c(e)).length,i=c.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[l]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(f.frame(e,o),s)}pong(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):(r=(e=c(e)).length,i=c.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[l]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(f.frame(e,o),s)}send(e,t,s){const r=this._extensions[o.extensionName];let i,n,a=t.binary?2:1,h=t.compress;if("string"==typeof e?(i=Buffer.byteLength(e),n=!1):(i=(e=c(e)).length,n=c.readOnly),this._firstFragment?(this._firstFragment=!1,h&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(h=i>=r._threshold),this._compress=h):(h=!1,a=0),t.fin&&(this._firstFragment=!0),r){const r={[l]:i,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:n,rsv1:h};this._deflating?this.enqueue([this.dispatch,e,this._compress,r,s]):this.dispatch(e,this._compress,r,s)}else this.sendFrame(f.frame(e,{[l]:i,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:n,rsv1:!1}),s)}dispatch(e,t,s,r){if(!t)return void this.sendFrame(f.frame(e,s),r);const i=this._extensions[o.extensionName];this._bufferedBytes+=s[l],this._deflating=!0,i.compress(e,s.fin,((e,t)=>{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],r=s[s.length-1];"function"==typeof r&&r(e)}}else this._bufferedBytes-=s[l],this._deflating=!1,s.readOnly=!1,this.sendFrame(f.frame(t,s),r),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[3][l],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][l],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=f},719:(e,t,s)=>{"use strict";const{Duplex:r}=s(584);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;const a=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t,s){const r=!s&&a._readableState.objectMode?t.toString():t;a.push(r)||e.pause()})),e.once("error",(function(e){a.destroyed||(s=!1,a.destroy(e))})),e.once("close",(function(){a.destroyed||a.push(null)})),a._destroy=function(t,r){if(e.readyState===e.CLOSED)return r(t),void process.nextTick(i,a);let o=!1;e.once("error",(function(e){o=!0,r(e)})),e.once("close",(function(){o||r(t),process.nextTick(i,a)})),s&&e.terminate()},a._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){a._final(t)}))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,s,r){e.readyState!==e.CONNECTING?e.send(t,r):e.once("open",(function(){a._write(t,s,r)}))},a.on("end",o),a.on("error",n),a}},237:(e,t,s)=>{"use strict";const{tokenChars:r}=s(880);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}}},880:(e,t,s)=>{"use strict";const{isUtf8:r}=s(181);function i(e){const t=e.length;let s=0;for(;s<t;)if(128&e[s])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}else s++;return!0}if(e.exports={isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:i,tokenChars:[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]},r)e.exports.isValidUTF8=function(e){return e.length<24?i(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)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.isValidUTF8=function(e){return e.length<32?i(e):t(e)}}catch(e){}},722:(e,t,s)=>{"use strict";const r=s(434),i=s(611),{Duplex:o}=s(584),{createHash:n}=s(982),a=s(926),h=s(971),c=s(237),l=s(60),{GUID:d,kWebSocket:f}=s(614),_=/^[+/0-9A-Za-z]{22}==$/;function u(e){e._state=2,e.emit("close")}function p(){this.destroy()}function m(e,t,s,r){s=s||i.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},e.once("finish",e.destroy),e.end(`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)}function y(e,t,s,r,i){if(e.listenerCount("wsClientError")){const r=new Error(i);Error.captureStackTrace(r,y),e.emit("wsClientError",r,s,t)}else m(s,r,i)}e.exports=class extends r{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...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(u,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(u,this);else{const e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close((()=>{u(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",p);const i=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if("GET"!==e.method){return void y(this,e,t,405,"Invalid HTTP method")}if("websocket"!==e.headers.upgrade.toLowerCase()){return void y(this,e,t,400,"Invalid Upgrade header")}if(!i||!_.test(i)){return void y(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header")}if(8!==o&&13!==o){return void y(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header")}if(!this.shouldHandle(e))return void m(t,400);const n=e.headers["sec-websocket-protocol"];let l=new Set;if(void 0!==n)try{l=c.parse(n)}catch(s){return void y(this,e,t,400,"Invalid Sec-WebSocket-Protocol header")}const d=e.headers["sec-websocket-extensions"],f={};if(this.options.perMessageDeflate&&void 0!==d){const s=new h(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const e=a.parse(d);e[h.extensionName]&&(s.accept(e[h.extensionName]),f[h.extensionName]=s)}catch(s){return void y(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header")}}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 m(t,n||401,a,h);this.completeUpgrade(f,i,l,e,t,s,r)}));if(!this.options.verifyClient(n))return m(t,401)}this.completeUpgrade(f,i,l,e,t,s,r)}completeUpgrade(e,t,s,r,i,o,c){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return m(i,503);const l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${n("sha1").update(t+d).digest("base64")}`],_=new this.options.WebSocket(null,void 0,this.options);if(s.size){const e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;e&&(l.push(`Sec-WebSocket-Protocol: ${e}`),_._protocol=e)}if(e[h.extensionName]){const t=e[h.extensionName].params,s=a.format({[h.extensionName]:[t]});l.push(`Sec-WebSocket-Extensions: ${s}`),_._extensions=e}this.emit("headers",l,r),i.write(l.concat("\r\n").join("\r\n")),i.removeListener("error",p),_.setSocket(i,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(_),_.on("close",(()=>{this.clients.delete(_),this._shouldEmitClose&&!this.clients.size&&process.nextTick(u,this)}))),c(_,r)}}},60:(e,t,s)=>{"use strict";const r=s(434),i=s(692),o=s(611),n=s(278),a=s(756),{randomBytes:h,createHash:c}=s(982),{Duplex:l,Readable:d}=s(584),{URL:f}=s(16),_=s(971),u=s(286),p=s(914),{BINARY_TYPES:m,EMPTY_BUFFER:y,GUID:v,kForOnEventAttribute:g,kListener:b,kStatusCode:S,kWebSocket:w,NOOP:E}=s(614),{EventTarget:{addEventListener:k,removeEventListener:x}}=s(597),{format:O,parse:T}=s(926),{toBuffer:C}=s(338),N=Symbol("kAborted"),L=[8,13],P=["CONNECTING","OPEN","CLOSING","CLOSED"],R=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class U extends r{constructor(e,t,s){super(),this._binaryType=m[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=U.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]),B(this,e,t,s)):(this._autoPong=s.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){m.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 isPaused(){return this._paused}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 u({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});this._sender=new p(e,this._extensions,s.generateMask),this._receiver=r,this._socket=e,r[w]=this,e[w]=this,r.on("conclude",F),r.on("drain",j),r.on("error",$),r.on("message",V),r.on("ping",q),r.on("pong",z),e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Y),e.on("data",X),e.on("end",K),e.on("error",Z),this._readyState=U.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=U.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[_.extensionName]&&this._extensions[_.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=U.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==U.CLOSED)if(this.readyState!==U.CONNECTING)this.readyState!==U.CLOSING?(this._readyState=U.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();else{const e="WebSocket was closed before the connection was established";D(this,this._req,e)}}pause(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===U.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===U.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||y,t,s)):A(this,e,s)}pong(e,t,s){if(this.readyState===U.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===U.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||y,t,s)):A(this,e,s)}resume(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===U.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!==U.OPEN)return void A(this,e,s);const r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[_.extensionName]||(r.compress=!1),this._sender.send(e||y,r,s)}terminate(){if(this.readyState!==U.CLOSED)if(this.readyState!==U.CONNECTING)this._socket&&(this._readyState=U.CLOSING,this._socket.destroy());else{const e="WebSocket was closed before the connection was established";D(this,this._req,e)}}}function B(e,t,s,r){const n={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:L[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=n.autoPong,!L.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${L.join(", ")})`);let a;if(t instanceof f)a=t;else try{a=new f(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}"http:"===a.protocol?a.protocol="ws:":"https:"===a.protocol&&(a.protocol="wss:"),e._url=a.href;const l="wss:"===a.protocol,d="ws+unix:"===a.protocol;let u;if("ws:"===a.protocol||l||d?d&&!a.pathname?u="The URL's pathname is empty":a.hash&&(u="The URL contains a fragment identifier"):u='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"',u){const t=new SyntaxError(u);if(0===e._redirects)throw t;return void I(e,t)}const p=l?443:80,m=h(16).toString("base64"),y=l?i.request:o.request,g=new Set;let b,S;if(n.createConnection=n.createConnection||(l?W:M),n.defaultPort=n.defaultPort||p,n.port=a.port||p,n.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,n.headers={...n.headers,"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket"},n.path=a.pathname+a.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(b=new _(!0!==n.perMessageDeflate?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=O({[_.extensionName]:b.offer()})),s.length){for(const e of s){if("string"!=typeof e||!R.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}`),d){const e=n.path.split(":");n.socketPath=e[0],n.path=e[1]}if(n.followRedirects){if(0===e._redirects){e._originalIpc=d,e._originalSecure=l,e._originalHostOrSocketPath=d?n.socketPath:a.host;const t=r&&r.headers;if(r={...r,headers:{}},t)for(const[e,s]of Object.entries(t))r.headers[e.toLowerCase()]=s}else if(0===e.listenerCount("redirect")){const t=d?!!e._originalIpc&&n.socketPath===e._originalHostOrSocketPath:!e._originalIpc&&a.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!l)&&(delete n.headers.authorization,delete n.headers.cookie,t||delete n.headers.host,n.auth=void 0)}n.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),S=e._req=y(n),e._redirects&&e.emit("redirect",e.url,S)}else S=e._req=y(n);n.timeout&&S.on("timeout",(()=>{D(e,S,"Opening handshake has timed out")})),S.on("error",(t=>{null===S||S[N]||(S=e._req=null,I(e,t))})),S.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 D(e,S,"Maximum redirects exceeded");let i;S.abort();try{i=new f(o,t)}catch(t){const s=new SyntaxError(`Invalid URL: ${o}`);return void I(e,s)}B(e,i,s,r)}else e.emit("unexpected-response",S,i)||D(e,S,`Unexpected server response: ${i.statusCode}`)})),S.on("upgrade",((t,s,r)=>{if(e.emit("upgrade",t),e.readyState!==U.CONNECTING)return;if(S=e._req=null,"websocket"!==t.headers.upgrade.toLowerCase())return void D(e,s,"Invalid Upgrade header");const i=c("sha1").update(m+v).digest("base64");if(t.headers["sec-websocket-accept"]!==i)return void D(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 D(e,s,a);o&&(e._protocol=o);const h=t.headers["sec-websocket-extensions"];if(void 0!==h){if(!b){return void D(e,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let t;try{t=T(h)}catch(t){return void D(e,s,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(t);if(1!==r.length||r[0]!==_.extensionName){return void D(e,s,"Server indicated an extension that was not requested")}try{b.accept(t[_.extensionName])}catch(t){return void D(e,s,"Invalid Sec-WebSocket-Extensions header")}e._extensions[_.extensionName]=b}e.setSocket(s,r,{allowSynchronousEvents:n.allowSynchronousEvents,generateMask:n.generateMask,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})})),n.finishRequest?n.finishRequest(S,e):S.end()}function I(e,t){e._readyState=U.CLOSING,e.emit("error",t),e.emitClose()}function M(e){return e.path=e.socketPath,n.connect(e)}function W(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function D(e,t,s){e._readyState=U.CLOSING;const r=new Error(s);Error.captureStackTrace(r,D),t.setHeader?(t[N]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(I,e,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}if(s){const t=new Error(`WebSocket is not open: readyState ${e.readyState} (${P[e.readyState]})`);process.nextTick(s,t)}}function F(e,t){const s=this[w];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[w]&&(s._socket.removeListener("data",X),process.nextTick(H,s._socket),1005===e?s.close():s.close(e,t))}function j(){const e=this[w];e.isPaused||e._socket.resume()}function $(e){const t=this[w];void 0!==t._socket[w]&&(t._socket.removeListener("data",X),process.nextTick(H,t._socket),t.close(e[S])),t.emit("error",e)}function G(){this[w].emitClose()}function V(e,t){this[w].emit("message",e,t)}function q(e){const t=this[w];t._autoPong&&t.pong(e,!this._isServer,E),t.emit("ping",e)}function z(e){this[w].emit("pong",e)}function H(e){e.resume()}function Y(){const e=this[w];let t;this.removeListener("close",Y),this.removeListener("data",X),this.removeListener("end",K),e._readyState=U.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",G),e._receiver.on("finish",G))}function X(e){this[w]._receiver.write(e)||this.pause()}function K(){const e=this[w];e._readyState=U.CLOSING,e._receiver.end(),this.end()}function Z(){const e=this[w];this.removeListener("error",Z),this.on("error",E),e&&(e._readyState=U.CLOSING,this.destroy())}Object.defineProperty(U,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")}),Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")}),Object.defineProperty(U,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")}),Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")}),Object.defineProperty(U,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")}),Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")}),Object.defineProperty(U,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")}),Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(U.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(U.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})}})})),U.prototype.addEventListener=k,U.prototype.removeEventListener=x,e.exports=U},181:e=>{"use strict";e.exports=require("buffer")},982:e=>{"use strict";e.exports=require("crypto")},434:e=>{"use strict";e.exports=require("events")},611:e=>{"use strict";e.exports=require("http")},692:e=>{"use strict";e.exports=require("https")},278:e=>{"use strict";e.exports=require("net")},584:e=>{"use strict";e.exports=require("stream")},756:e=>{"use strict";e.exports=require("tls")},16:e=>{"use strict";e.exports=require("url")},106:e=>{"use strict";e.exports=require("zlib")}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,s),o.exports}var r={};(()=>{var e=r,t=s(699);e.Server=t.Server,e.on=t.on,e.close=t.close,e.ping=t.ping})();var i=exports;for(var o in r)i[o]=r[o];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
|
|
1
|
+
(()=>{var e={699:(e,t,s)=>{"use strict";const r=s(60);r.createWebSocketStream=s(719),r.Server=s(722),r.Receiver=s(286),r.Sender=s(914),r.WebSocket=r,r.WebSocketServer=r.Server,e.exports=r},338:(e,t,s)=>{"use strict";const{EMPTY_BUFFER:r}=s(614),i=Buffer[Symbol.species];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]}if(e.exports={concat:function(e,t){if(0===e.length)return r;if(1===e.length)return e[0];const s=Buffer.allocUnsafe(t);let o=0;for(let t=0;t<e.length;t++){const r=e[t];s.set(r,o),o+=r.length}return o<t?new i(s.buffer,s.byteOffset,o):s},mask:o,toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:function e(t){if(e.readOnly=!0,Buffer.isBuffer(t))return t;let s;return t instanceof ArrayBuffer?s=new i(t):ArrayBuffer.isView(t)?s=new i(t.buffer,t.byteOffset,t.byteLength):(s=Buffer.from(t),e.readOnly=!1),s},unmask:n},!process.env.WS_NO_BUFFER_UTIL)try{const t=s(Object(function(){var e=new Error("Cannot find module 'bufferutil'");throw e.code="MODULE_NOT_FOUND",e}()));e.exports.mask=function(e,s,r,i,n){n<48?o(e,s,r,i,n):t.mask(e,s,r,i,n)},e.exports.unmask=function(e,s){e.length<32?n(e,s):t.unmask(e,s)}}catch(e){}},614:e=>{"use strict";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:()=>{}}},597:(e,t,s)=>{"use strict";const{kForOnEventAttribute:r,kListener:i}=s(614),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={}){for(const o of this.listeners(e))if(!s[r]&&o[i]===t&&!o[r])return;let o;if("message"===e)o=function(e,s){const r=new m("message",{data:s?e:e.toString()});r[l]=this,v(t,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,v(t,this,r)};else if("error"===e)o=function(e){const s=new p("error",{error:e,message:e.message});s[l]=this,v(t,this,s)};else{if("open"!==e)return;o=function(){const e=new _("open");e[l]=this,v(t,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}}};function v(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}e.exports={CloseEvent:u,ErrorEvent:p,Event:_,EventTarget:y,MessageEvent:m}},926:(e,t,s)=>{"use strict";const{tokenChars:r}=s(880);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}}},759:e=>{"use strict";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])}}}},971:(e,t,s)=>{"use strict";const r=s(106),i=s(338),o=s(759),{kStatusCode:n}=s(614),a=Buffer[Symbol.species],h=Buffer.from([0,0,255,255]),c=Symbol("permessage-deflate"),l=Symbol("total-length"),d=Symbol("callback"),f=Symbol("buffers"),_=Symbol("error");let u;function p(e){this[f].push(e),this[l]+=e.length}function m(e){this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload?this[f].push(e):(this[_]=new RangeError("Max payload size exceeded"),this[_].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[_][n]=1009,this.removeListener("data",m),this.reset())}function y(e){this[c]._inflate=null,e[n]=1007,this[d](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,!u){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;u=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[d];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){u.add((r=>{this._decompress(e,t,((e,t)=>{r(),s(e,t)}))}))}compress(e,t,s){u.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[c]=this,this._inflate[l]=0,this._inflate[f]=[],this._inflate.on("error",y),this._inflate.on("data",m)}this._inflate[d]=s,this._inflate.write(e),t&&this._inflate.write(h),this._inflate.flush((()=>{const e=this._inflate[_];if(e)return this._inflate.close(),this._inflate=null,void s(e);const r=i.concat(this._inflate[f],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[f]=[],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[l]=0,this._deflate[f]=[],this._deflate.on("data",p)}this._deflate[d]=s,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[l]);t&&(e=new a(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[l]=0,this._deflate[f]=[],t&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),s(null,e)}))}}},286:(e,t,s)=>{"use strict";const{Writable:r}=s(584),i=s(971),{BINARY_TYPES:o,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:h}=s(614),{concat:c,toArrayBuffer:l,unmask:d}=s(338),{isValidStatusCode:f,isValidUTF8:_}=s(880),u=Buffer[Symbol.species];e.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,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._errored=!1,this._loop=!1,this._state=0}_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]=new u(t.buffer,t.byteOffset+e,t.length-e),new u(t.buffer,t.byteOffset,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]=new u(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0);return t}startLoop(e){this._loop=!0;do{switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:return void(this._loop=!1)}}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2)return void(this._loop=!1);const t=this.consume(2);if(48&t[0]){return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"))}const s=!(64&~t[0]);if(!s||this._extensions[i.extensionName]){if(this._fin=!(128&~t[0]),this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(s){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(!this._fragmented){return void e(this.createError(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 void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"))}this._compressed=s}else{if(!(this._opcode>7&&this._opcode<11)){return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"))}if(!this._fin){return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"))}if(s){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength){return void e(this.createError(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&~t[1]),this._isServer){if(!this._masked){return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}}else if(this._masked){return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"))}126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(e)}else{e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}}getPayloadLength16(e){this._bufferedBytes<2?this._loop=!1:(this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e))}getPayloadLength64(e){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),s=t.readUInt32BE(0);if(s>Math.pow(2,21)-1){e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"))}else this._payloadLength=s*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"))}else 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&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&d(t,this._mask)}if(this._opcode>7)this.controlMessage(t,e);else{if(this._compressed)return this._state=5,void this.decompress(t,e);t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}}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){const e=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");return void t(e)}this._fragments.push(s)}this.dataMessage(t),0===this._state&&this.startLoop(t)}))}dataMessage(e){if(!this._fin)return void(this._state=0);const t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?c(s,t):"arraybuffer"===this._binaryType?l(c(s,t)):s,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=0):(this._state=6,setImmediate((()=>{this.emit("message",r,!0),this._state=0,this.startLoop(e)})))}else{const r=c(s,t);if(!this._skipUTF8Validation&&!_(r)){const t=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");return void e(t)}5===this._state||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=0):(this._state=6,setImmediate((()=>{this.emit("message",r,!1),this._state=0,this.startLoop(e)})))}}controlMessage(e,t){if(8!==this._opcode)this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=0):(this._state=6,setImmediate((()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=0,this.startLoop(t)})));else{if(0===e.length)this._loop=!1,this.emit("conclude",1005,n),this.end();else{const s=e.readUInt16BE(0);if(!f(s)){const e=this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");return void t(e)}const r=new u(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!_(r)){const e=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");return void t(e)}this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=0}}createError(e,t,s,r,i){this._loop=!1,this._errored=!0;const o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=i,o[a]=r,o}}},914:(e,t,s)=>{"use strict";const{Duplex:r}=s(584),{randomFillSync:i}=s(982),o=s(971),{EMPTY_BUFFER:n}=s(614),{isValidStatusCode:a}=s(880),{mask:h,toBuffer:c}=s(338),l=Symbol("kByteLength"),d=Buffer.alloc(4),f=8192;let _,u=f;class p{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let s,r,o=!1,n=2,a=!1;t.mask&&(s=t.maskBuffer||d,t.generateMask?t.generateMask(s):(u===f&&(void 0===_&&(_=Buffer.alloc(f)),i(_,0,f),u=0),s[0]=_[u++],s[1]=_[u++],s[2]=_[u++],s[3]=_[u++]),a=!(s[0]|s[1]|s[2]|s[3]),n=6),"string"==typeof e?r=t.mask&&!a||void 0===t[l]?(e=Buffer.from(e)).length:t[l]:(r=e.length,o=t.mask&&t.readOnly&&!a);let c=r;r>=65536?(n+=8,c=127):r>125&&(n+=2,c=126);const p=Buffer.allocUnsafe(o?r+n:n);return p[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(p[0]|=64),p[1]=c,126===c?p.writeUInt16BE(r,2):127===c&&(p[2]=p[3]=0,p.writeUIntBE(r,4,6)),t.mask?(p[1]|=128,p[n-4]=s[0],p[n-3]=s[1],p[n-2]=s[2],p[n-1]=s[3],a?[p,e]:o?(h(e,s,p,n,r),[p]):(h(e,s,e,0,r),[p,e])):[p,e]}close(e,t,s,r){let i;if(void 0===e)i=n;else{if("number"!=typeof e||!a(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)}const o={[l]:i.length,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,i,!1,o,r]):this.sendFrame(p.frame(i,o),r)}ping(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):(r=(e=c(e)).length,i=c.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[l]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(p.frame(e,o),s)}pong(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):(r=(e=c(e)).length,i=c.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[l]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(p.frame(e,o),s)}send(e,t,s){const r=this._extensions[o.extensionName];let i,n,a=t.binary?2:1,h=t.compress;if("string"==typeof e?(i=Buffer.byteLength(e),n=!1):(i=(e=c(e)).length,n=c.readOnly),this._firstFragment?(this._firstFragment=!1,h&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(h=i>=r._threshold),this._compress=h):(h=!1,a=0),t.fin&&(this._firstFragment=!0),r){const r={[l]:i,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:n,rsv1:h};this._deflating?this.enqueue([this.dispatch,e,this._compress,r,s]):this.dispatch(e,this._compress,r,s)}else this.sendFrame(p.frame(e,{[l]:i,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:n,rsv1:!1}),s)}dispatch(e,t,s,r){if(!t)return void this.sendFrame(p.frame(e,s),r);const i=this._extensions[o.extensionName];this._bufferedBytes+=s[l],this._deflating=!0,i.compress(e,s.fin,((e,t)=>{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],r=s[s.length-1];"function"==typeof r&&r(e)}}else this._bufferedBytes-=s[l],this._deflating=!1,s.readOnly=!1,this.sendFrame(p.frame(t,s),r),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[3][l],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][l],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=p},719:(e,t,s)=>{"use strict";const{Duplex:r}=s(584);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;const a=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t,s){const r=!s&&a._readableState.objectMode?t.toString():t;a.push(r)||e.pause()})),e.once("error",(function(e){a.destroyed||(s=!1,a.destroy(e))})),e.once("close",(function(){a.destroyed||a.push(null)})),a._destroy=function(t,r){if(e.readyState===e.CLOSED)return r(t),void process.nextTick(i,a);let o=!1;e.once("error",(function(e){o=!0,r(e)})),e.once("close",(function(){o||r(t),process.nextTick(i,a)})),s&&e.terminate()},a._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){a._final(t)}))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,s,r){e.readyState!==e.CONNECTING?e.send(t,r):e.once("open",(function(){a._write(t,s,r)}))},a.on("end",o),a.on("error",n),a}},237:(e,t,s)=>{"use strict";const{tokenChars:r}=s(880);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}}},880:(e,t,s)=>{"use strict";const{isUtf8:r}=s(181);function i(e){const t=e.length;let s=0;for(;s<t;)if(128&e[s])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}else s++;return!0}if(e.exports={isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:i,tokenChars:[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]},r)e.exports.isValidUTF8=function(e){return e.length<24?i(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)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.isValidUTF8=function(e){return e.length<32?i(e):t(e)}}catch(e){}},722:(e,t,s)=>{"use strict";const r=s(434),i=s(611),{Duplex:o}=s(584),{createHash:n}=s(982),a=s(926),h=s(971),c=s(237),l=s(60),{GUID:d,kWebSocket:f}=s(614),_=/^[+/0-9A-Za-z]{22}==$/;function u(e){e._state=2,e.emit("close")}function p(){this.destroy()}function m(e,t,s,r){s=s||i.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},e.once("finish",e.destroy),e.end(`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)}function y(e,t,s,r,i){if(e.listenerCount("wsClientError")){const r=new Error(i);Error.captureStackTrace(r,y),e.emit("wsClientError",r,s,t)}else m(s,r,i)}e.exports=class extends r{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...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(u,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(u,this);else{const e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close((()=>{u(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",p);const i=e.headers["sec-websocket-key"],o=e.headers.upgrade,n=+e.headers["sec-websocket-version"];if("GET"!==e.method){return void y(this,e,t,405,"Invalid HTTP method")}if(void 0===o||"websocket"!==o.toLowerCase()){return void y(this,e,t,400,"Invalid Upgrade header")}if(void 0===i||!_.test(i)){return void y(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header")}if(8!==n&&13!==n){return void y(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header")}if(!this.shouldHandle(e))return void m(t,400);const l=e.headers["sec-websocket-protocol"];let d=new Set;if(void 0!==l)try{d=c.parse(l)}catch(s){return void y(this,e,t,400,"Invalid Sec-WebSocket-Protocol header")}const f=e.headers["sec-websocket-extensions"],u={};if(this.options.perMessageDeflate&&void 0!==f){const s=new h(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const e=a.parse(f);e[h.extensionName]&&(s.accept(e[h.extensionName]),u[h.extensionName]=s)}catch(s){return void y(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header")}}if(this.options.verifyClient){const o={origin:e.headers[""+(8===n?"sec-websocket-origin":"origin")],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,((o,n,a,h)=>{if(!o)return m(t,n||401,a,h);this.completeUpgrade(u,i,d,e,t,s,r)}));if(!this.options.verifyClient(o))return m(t,401)}this.completeUpgrade(u,i,d,e,t,s,r)}completeUpgrade(e,t,s,r,i,o,c){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return m(i,503);const l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${n("sha1").update(t+d).digest("base64")}`],_=new this.options.WebSocket(null,void 0,this.options);if(s.size){const e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;e&&(l.push(`Sec-WebSocket-Protocol: ${e}`),_._protocol=e)}if(e[h.extensionName]){const t=e[h.extensionName].params,s=a.format({[h.extensionName]:[t]});l.push(`Sec-WebSocket-Extensions: ${s}`),_._extensions=e}this.emit("headers",l,r),i.write(l.concat("\r\n").join("\r\n")),i.removeListener("error",p),_.setSocket(i,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(_),_.on("close",(()=>{this.clients.delete(_),this._shouldEmitClose&&!this.clients.size&&process.nextTick(u,this)}))),c(_,r)}}},60:(e,t,s)=>{"use strict";const r=s(434),i=s(692),o=s(611),n=s(278),a=s(756),{randomBytes:h,createHash:c}=s(982),{Duplex:l,Readable:d}=s(584),{URL:f}=s(16),_=s(971),u=s(286),p=s(914),{BINARY_TYPES:m,EMPTY_BUFFER:y,GUID:v,kForOnEventAttribute:g,kListener:b,kStatusCode:S,kWebSocket:w,NOOP:E}=s(614),{EventTarget:{addEventListener:k,removeEventListener:x}}=s(597),{format:O,parse:T}=s(926),{toBuffer:C}=s(338),N=Symbol("kAborted"),L=[8,13],P=["CONNECTING","OPEN","CLOSING","CLOSED"],R=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class U extends r{constructor(e,t,s){super(),this._binaryType=m[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=U.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]),B(this,e,t,s)):(this._autoPong=s.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){m.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 isPaused(){return this._paused}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 u({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});this._sender=new p(e,this._extensions,s.generateMask),this._receiver=r,this._socket=e,r[w]=this,e[w]=this,r.on("conclude",F),r.on("drain",j),r.on("error",$),r.on("message",V),r.on("ping",q),r.on("pong",z),e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Y),e.on("data",X),e.on("end",K),e.on("error",Z),this._readyState=U.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=U.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[_.extensionName]&&this._extensions[_.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=U.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==U.CLOSED)if(this.readyState!==U.CONNECTING)this.readyState!==U.CLOSING?(this._readyState=U.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();else{const e="WebSocket was closed before the connection was established";D(this,this._req,e)}}pause(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===U.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===U.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||y,t,s)):A(this,e,s)}pong(e,t,s){if(this.readyState===U.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===U.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||y,t,s)):A(this,e,s)}resume(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===U.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!==U.OPEN)return void A(this,e,s);const r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[_.extensionName]||(r.compress=!1),this._sender.send(e||y,r,s)}terminate(){if(this.readyState!==U.CLOSED)if(this.readyState!==U.CONNECTING)this._socket&&(this._readyState=U.CLOSING,this._socket.destroy());else{const e="WebSocket was closed before the connection was established";D(this,this._req,e)}}}function B(e,t,s,r){const n={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:L[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=n.autoPong,!L.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${L.join(", ")})`);let a;if(t instanceof f)a=t;else try{a=new f(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}"http:"===a.protocol?a.protocol="ws:":"https:"===a.protocol&&(a.protocol="wss:"),e._url=a.href;const l="wss:"===a.protocol,d="ws+unix:"===a.protocol;let u;if("ws:"===a.protocol||l||d?d&&!a.pathname?u="The URL's pathname is empty":a.hash&&(u="The URL contains a fragment identifier"):u='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"',u){const t=new SyntaxError(u);if(0===e._redirects)throw t;return void I(e,t)}const p=l?443:80,m=h(16).toString("base64"),y=l?i.request:o.request,g=new Set;let b,S;if(n.createConnection=n.createConnection||(l?W:M),n.defaultPort=n.defaultPort||p,n.port=a.port||p,n.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,n.headers={...n.headers,"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket"},n.path=a.pathname+a.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(b=new _(!0!==n.perMessageDeflate?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=O({[_.extensionName]:b.offer()})),s.length){for(const e of s){if("string"!=typeof e||!R.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}`),d){const e=n.path.split(":");n.socketPath=e[0],n.path=e[1]}if(n.followRedirects){if(0===e._redirects){e._originalIpc=d,e._originalSecure=l,e._originalHostOrSocketPath=d?n.socketPath:a.host;const t=r&&r.headers;if(r={...r,headers:{}},t)for(const[e,s]of Object.entries(t))r.headers[e.toLowerCase()]=s}else if(0===e.listenerCount("redirect")){const t=d?!!e._originalIpc&&n.socketPath===e._originalHostOrSocketPath:!e._originalIpc&&a.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!l)&&(delete n.headers.authorization,delete n.headers.cookie,t||delete n.headers.host,n.auth=void 0)}n.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),S=e._req=y(n),e._redirects&&e.emit("redirect",e.url,S)}else S=e._req=y(n);n.timeout&&S.on("timeout",(()=>{D(e,S,"Opening handshake has timed out")})),S.on("error",(t=>{null===S||S[N]||(S=e._req=null,I(e,t))})),S.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 D(e,S,"Maximum redirects exceeded");let i;S.abort();try{i=new f(o,t)}catch(t){const s=new SyntaxError(`Invalid URL: ${o}`);return void I(e,s)}B(e,i,s,r)}else e.emit("unexpected-response",S,i)||D(e,S,`Unexpected server response: ${i.statusCode}`)})),S.on("upgrade",((t,s,r)=>{if(e.emit("upgrade",t),e.readyState!==U.CONNECTING)return;S=e._req=null;const i=t.headers.upgrade;if(void 0===i||"websocket"!==i.toLowerCase())return void D(e,s,"Invalid Upgrade header");const o=c("sha1").update(m+v).digest("base64");if(t.headers["sec-websocket-accept"]!==o)return void D(e,s,"Invalid Sec-WebSocket-Accept header");const a=t.headers["sec-websocket-protocol"];let h;if(void 0!==a?g.size?g.has(a)||(h="Server sent an invalid subprotocol"):h="Server sent a subprotocol but none was requested":g.size&&(h="Server sent no subprotocol"),h)return void D(e,s,h);a&&(e._protocol=a);const l=t.headers["sec-websocket-extensions"];if(void 0!==l){if(!b){return void D(e,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let t;try{t=T(l)}catch(t){return void D(e,s,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(t);if(1!==r.length||r[0]!==_.extensionName){return void D(e,s,"Server indicated an extension that was not requested")}try{b.accept(t[_.extensionName])}catch(t){return void D(e,s,"Invalid Sec-WebSocket-Extensions header")}e._extensions[_.extensionName]=b}e.setSocket(s,r,{allowSynchronousEvents:n.allowSynchronousEvents,generateMask:n.generateMask,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})})),n.finishRequest?n.finishRequest(S,e):S.end()}function I(e,t){e._readyState=U.CLOSING,e.emit("error",t),e.emitClose()}function M(e){return e.path=e.socketPath,n.connect(e)}function W(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function D(e,t,s){e._readyState=U.CLOSING;const r=new Error(s);Error.captureStackTrace(r,D),t.setHeader?(t[N]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(I,e,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}if(s){const t=new Error(`WebSocket is not open: readyState ${e.readyState} (${P[e.readyState]})`);process.nextTick(s,t)}}function F(e,t){const s=this[w];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[w]&&(s._socket.removeListener("data",X),process.nextTick(H,s._socket),1005===e?s.close():s.close(e,t))}function j(){const e=this[w];e.isPaused||e._socket.resume()}function $(e){const t=this[w];void 0!==t._socket[w]&&(t._socket.removeListener("data",X),process.nextTick(H,t._socket),t.close(e[S])),t.emit("error",e)}function G(){this[w].emitClose()}function V(e,t){this[w].emit("message",e,t)}function q(e){const t=this[w];t._autoPong&&t.pong(e,!this._isServer,E),t.emit("ping",e)}function z(e){this[w].emit("pong",e)}function H(e){e.resume()}function Y(){const e=this[w];let t;this.removeListener("close",Y),this.removeListener("data",X),this.removeListener("end",K),e._readyState=U.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",G),e._receiver.on("finish",G))}function X(e){this[w]._receiver.write(e)||this.pause()}function K(){const e=this[w];e._readyState=U.CLOSING,e._receiver.end(),this.end()}function Z(){const e=this[w];this.removeListener("error",Z),this.on("error",E),e&&(e._readyState=U.CLOSING,this.destroy())}Object.defineProperty(U,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")}),Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:P.indexOf("CONNECTING")}),Object.defineProperty(U,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")}),Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:P.indexOf("OPEN")}),Object.defineProperty(U,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")}),Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:P.indexOf("CLOSING")}),Object.defineProperty(U,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")}),Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:P.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(U.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(U.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})}})})),U.prototype.addEventListener=k,U.prototype.removeEventListener=x,e.exports=U},181:e=>{"use strict";e.exports=require("buffer")},982:e=>{"use strict";e.exports=require("crypto")},434:e=>{"use strict";e.exports=require("events")},611:e=>{"use strict";e.exports=require("http")},692:e=>{"use strict";e.exports=require("https")},278:e=>{"use strict";e.exports=require("net")},584:e=>{"use strict";e.exports=require("stream")},756:e=>{"use strict";e.exports=require("tls")},16:e=>{"use strict";e.exports=require("url")},106:e=>{"use strict";e.exports=require("zlib")}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,s),o.exports}var r={};(()=>{var e=r,t=s(699);e.Server=t.Server,e.on=t.on,e.close=t.close,e.ping=t.ping})();var i=exports;for(var o in r)i[o]=r[o];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/app-data",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.3-dev.1734304270.ca7046f",
|
|
4
4
|
"description": "Used for default app data and build conditionals within builds.",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
package/internal/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Client Platform v4.18.
|
|
2
|
+
Rindo Client Platform v4.18.3-dev.1734304270.ca7046f | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -1461,7 +1461,10 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1461
1461
|
endSchedule();
|
|
1462
1462
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1463
1463
|
};
|
|
1464
|
-
var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn)
|
|
1464
|
+
var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
|
|
1465
|
+
console.error(err2);
|
|
1466
|
+
fn();
|
|
1467
|
+
}) : fn();
|
|
1465
1468
|
var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
|
|
1466
1469
|
var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1467
1470
|
var _a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/client",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.3-dev.1734304270.ca7046f",
|
|
4
4
|
"description": "Rindo internal client platform to be imported by the Rindo Compiler and internal runtime. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Hydrate Platform v4.18.
|
|
2
|
+
Rindo Hydrate Platform v4.18.3-dev.1734304270.ca7046f | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -1450,7 +1450,10 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1450
1450
|
endSchedule();
|
|
1451
1451
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1452
1452
|
};
|
|
1453
|
-
var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn)
|
|
1453
|
+
var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
|
|
1454
|
+
console.error(err2);
|
|
1455
|
+
fn();
|
|
1456
|
+
}) : fn();
|
|
1454
1457
|
var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
|
|
1455
1458
|
var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1456
1459
|
var _a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/hydrate",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.3-dev.1734304270.ca7046f",
|
|
4
4
|
"description": "Rindo internal hydrate platform to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Hydrate Runner v4.18.
|
|
2
|
+
Rindo Hydrate Runner v4.18.3-dev.1734304270.ca7046f | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -12824,14 +12824,16 @@ var WINDOW_PROPS = [
|
|
|
12824
12824
|
];
|
|
12825
12825
|
var GLOBAL_CONSTRUCTORS = [
|
|
12826
12826
|
["CustomEvent", MockCustomEvent],
|
|
12827
|
+
["DocumentFragment", MockDocumentFragment],
|
|
12828
|
+
["DOMParser", MockDOMParser],
|
|
12827
12829
|
["Event", MockEvent],
|
|
12828
|
-
["Headers", MockHeaders],
|
|
12829
12830
|
["FocusEvent", MockFocusEvent],
|
|
12831
|
+
["Headers", MockHeaders],
|
|
12830
12832
|
["KeyboardEvent", MockKeyboardEvent],
|
|
12831
12833
|
["MouseEvent", MockMouseEvent],
|
|
12832
12834
|
["Request", MockRequest],
|
|
12833
12835
|
["Response", MockResponse],
|
|
12834
|
-
["
|
|
12836
|
+
["ShadowRoot", MockDocumentFragment],
|
|
12835
12837
|
["HTMLAnchorElement", MockAnchorElement],
|
|
12836
12838
|
["HTMLBaseElement", MockBaseElement],
|
|
12837
12839
|
["HTMLButtonElement", MockButtonElement],
|
package/internal/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.3-dev.1734304270.ca7046f",
|
|
4
4
|
"description": "Rindo internals only to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -1276,7 +1276,7 @@ export interface ComponentRuntimeMeta {
|
|
|
1276
1276
|
/**
|
|
1277
1277
|
* This number is used to hold a series of bitflags for various features we
|
|
1278
1278
|
* support on components. The flags which this value is intended to store are
|
|
1279
|
-
* documented in the
|
|
1279
|
+
* documented in the `CMP_FLAGS` enum.
|
|
1280
1280
|
*/
|
|
1281
1281
|
$flags$: number;
|
|
1282
1282
|
/**
|
|
@@ -1320,7 +1320,7 @@ export interface ComponentRuntimeMembers {
|
|
|
1320
1320
|
* The fields are:
|
|
1321
1321
|
*
|
|
1322
1322
|
* 1. A number used to hold bitflags for component members. The bit flags which
|
|
1323
|
-
* this is intended to store are documented in the
|
|
1323
|
+
* this is intended to store are documented in the `MEMBER_FLAGS` enum.
|
|
1324
1324
|
* 2. The attribute name to observe.
|
|
1325
1325
|
*/
|
|
1326
1326
|
export type ComponentRuntimeMember = [number, string?];
|
|
@@ -1329,7 +1329,7 @@ export type ComponentRuntimeMember = [number, string?];
|
|
|
1329
1329
|
* runtime. The field are:
|
|
1330
1330
|
*
|
|
1331
1331
|
* 1. A number used to hold bitflags for listeners. The bit flags which this is
|
|
1332
|
-
* intended to store are documented in the
|
|
1332
|
+
* intended to store are documented in the `LISTENER_FLAGS` enum.
|
|
1333
1333
|
* 2. The event name.
|
|
1334
1334
|
* 3. The method name.
|
|
1335
1335
|
*/
|
|
@@ -1610,6 +1610,12 @@ export interface ScreenshotOptions {
|
|
|
1610
1610
|
* more sensitive. Defaults to the testing config `pixelmatchThreshold` value;
|
|
1611
1611
|
*/
|
|
1612
1612
|
pixelmatchThreshold?: number;
|
|
1613
|
+
/**
|
|
1614
|
+
* Capture the screenshot beyond the viewport.
|
|
1615
|
+
*
|
|
1616
|
+
* @defaultValue `false` if there is no `clip`. `true` otherwise.
|
|
1617
|
+
*/
|
|
1618
|
+
captureBeyondViewport?: boolean;
|
|
1613
1619
|
}
|
|
1614
1620
|
export interface ScreenshotBoundingBox {
|
|
1615
1621
|
/**
|
|
@@ -2134,7 +2140,7 @@ export interface CompilerWorkerContext {
|
|
|
2134
2140
|
transformCssToEsm(input: TransformCssToEsmInput): Promise<TransformCssToEsmOutput>;
|
|
2135
2141
|
}
|
|
2136
2142
|
/**
|
|
2137
|
-
* The methods that are supported on a {@link
|
|
2143
|
+
* The methods that are supported on a {@link CompilerWorkerContext}
|
|
2138
2144
|
*/
|
|
2139
2145
|
export type WorkerContextMethod = keyof CompilerWorkerContext;
|
|
2140
2146
|
/**
|
|
@@ -79,6 +79,13 @@ export interface RindoConfig {
|
|
|
79
79
|
* Below is an example folder structure containing a webapp's global sass file, named app.css.
|
|
80
80
|
*/
|
|
81
81
|
globalStyle?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Will generate {@link https://nodejs.org/api/packages.html#packages_exports export map} entry points
|
|
84
|
+
* for each component in the build when `true`.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
generateExportMaps?: boolean;
|
|
82
89
|
/**
|
|
83
90
|
* When the hashFileNames config is set to true, and it is a production build,
|
|
84
91
|
* the hashedFileNameLength config is used to determine how many characters the file name's hash should be.
|
|
@@ -1555,7 +1555,10 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1555
1555
|
endSchedule();
|
|
1556
1556
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1557
1557
|
};
|
|
1558
|
-
var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn)
|
|
1558
|
+
var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
|
|
1559
|
+
console.error(err2);
|
|
1560
|
+
fn();
|
|
1561
|
+
}) : fn();
|
|
1559
1562
|
var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
|
|
1560
1563
|
var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1561
1564
|
var _a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/testing",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.3-dev.1734304270.ca7046f",
|
|
4
4
|
"description": "Rindo internal testing platform to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
package/mock-doc/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Mock Doc (CommonJS) v4.18.
|
|
2
|
+
Rindo Mock Doc (CommonJS) v4.18.3-dev.1734304270.ca7046f | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -8740,14 +8740,16 @@ var WINDOW_PROPS = [
|
|
|
8740
8740
|
];
|
|
8741
8741
|
var GLOBAL_CONSTRUCTORS = [
|
|
8742
8742
|
["CustomEvent", MockCustomEvent],
|
|
8743
|
+
["DocumentFragment", MockDocumentFragment],
|
|
8744
|
+
["DOMParser", MockDOMParser],
|
|
8743
8745
|
["Event", MockEvent],
|
|
8744
|
-
["Headers", MockHeaders],
|
|
8745
8746
|
["FocusEvent", MockFocusEvent],
|
|
8747
|
+
["Headers", MockHeaders],
|
|
8746
8748
|
["KeyboardEvent", MockKeyboardEvent],
|
|
8747
8749
|
["MouseEvent", MockMouseEvent],
|
|
8748
8750
|
["Request", MockRequest],
|
|
8749
8751
|
["Response", MockResponse],
|
|
8750
|
-
["
|
|
8752
|
+
["ShadowRoot", MockDocumentFragment],
|
|
8751
8753
|
["HTMLAnchorElement", MockAnchorElement],
|
|
8752
8754
|
["HTMLBaseElement", MockBaseElement],
|
|
8753
8755
|
["HTMLButtonElement", MockButtonElement],
|
package/mock-doc/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Mock Doc v4.18.
|
|
2
|
+
Rindo Mock Doc v4.18.3-dev.1734304270.ca7046f | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
// src/runtime/runtime-constants.ts
|
|
@@ -8687,14 +8687,16 @@ var WINDOW_PROPS = [
|
|
|
8687
8687
|
];
|
|
8688
8688
|
var GLOBAL_CONSTRUCTORS = [
|
|
8689
8689
|
["CustomEvent", MockCustomEvent],
|
|
8690
|
+
["DocumentFragment", MockDocumentFragment],
|
|
8691
|
+
["DOMParser", MockDOMParser],
|
|
8690
8692
|
["Event", MockEvent],
|
|
8691
|
-
["Headers", MockHeaders],
|
|
8692
8693
|
["FocusEvent", MockFocusEvent],
|
|
8694
|
+
["Headers", MockHeaders],
|
|
8693
8695
|
["KeyboardEvent", MockKeyboardEvent],
|
|
8694
8696
|
["MouseEvent", MockMouseEvent],
|
|
8695
8697
|
["Request", MockRequest],
|
|
8696
8698
|
["Response", MockResponse],
|
|
8697
|
-
["
|
|
8699
|
+
["ShadowRoot", MockDocumentFragment],
|
|
8698
8700
|
["HTMLAnchorElement", MockAnchorElement],
|
|
8699
8701
|
["HTMLBaseElement", MockBaseElement],
|
|
8700
8702
|
["HTMLButtonElement", MockButtonElement],
|
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.3-dev.1734304270.ca7046f",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/rindo-core/index.cjs",
|
|
6
6
|
"module": "./internal/rindo-core/index.js",
|
|
@@ -23,25 +23,23 @@
|
|
|
23
23
|
"testing/"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "npm run clean && npm run tsc.
|
|
26
|
+
"build": "npm run clean && npm run tsc.prod && npm run ts scripts/index.ts -- --prod --ci",
|
|
27
27
|
"build.watch": "npm run build -- --watch",
|
|
28
|
-
"build.updateSelectorEngine": "
|
|
29
|
-
"clean": "rm -rf build/ cli/ compiler/ dev-server/ internal/ mock-doc/ sys/ testing/ && npm run clean
|
|
30
|
-
"clean.scripts": "rm -rf scripts/build",
|
|
28
|
+
"build.updateSelectorEngine": "npm run ts scripts/updateSelectorEngine.ts",
|
|
29
|
+
"clean": "rm -rf build/ cli/ compiler/ dev-server/ internal/ mock-doc/ sys/ testing/ && npm run clean:scripts && npm run clean.screenshots",
|
|
31
30
|
"clean.screenshots": "rm -rf test/end-to-end/screenshot/builds test/end-to-end/screenshot/images",
|
|
31
|
+
"clean:scripts": "rm -rf scripts/build",
|
|
32
32
|
"lint": "eslint \"bin/*\" \"scripts/*.ts\" \"scripts/**/*.ts\" \"src/*.ts\" \"src/**/*.ts\" \"src/**/*.tsx\"",
|
|
33
33
|
"install.jest": "bash ./src/testing/jest/install-dependencies.sh",
|
|
34
34
|
"prettier": "npm run prettier.base -- --write",
|
|
35
35
|
"prettier.base": "prettier --cache \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/rindo|.github/(**/)?*.(yml|yaml)|*.js\"",
|
|
36
36
|
"prettier.dry-run": "npm run prettier.base -- --list-different",
|
|
37
|
-
"release.ci.prepare": "npm run
|
|
38
|
-
"release.ci": "
|
|
39
|
-
"rollup.prod.ci": "rollup --config --config-prod --config-ci",
|
|
40
|
-
"rollup.watch": "rollup --watch --config",
|
|
37
|
+
"release.ci.prepare": "npm run ts scripts/index.ts -- --release --ci-prepare",
|
|
38
|
+
"release.ci": "NODE_OPTIONS=--max-old-space-size=4096 npm run ts scripts/index.ts -- --release --ci-publish",
|
|
41
39
|
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage",
|
|
42
40
|
"test.analysis": "cd test && npm run analysis.build-and-analyze",
|
|
43
41
|
"test.bundlers": "cd test && npm run bundlers",
|
|
44
|
-
"test.dist": "
|
|
42
|
+
"test.dist": "npm run ts scripts/index.ts -- --validate-build",
|
|
45
43
|
"test.end-to-end": "cd test/end-to-end && npm ci && npm test && npm run test.dist",
|
|
46
44
|
"test.jest": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
|
|
47
45
|
"test.prod": "npm run test.dist && npm run test.end-to-end && npm run test.jest && npm run test.testing && npm run test.analysis",
|
|
@@ -49,17 +47,15 @@
|
|
|
49
47
|
"test.docs-build": "cd test && npm run build.docs-json && npm run build.docs-readme",
|
|
50
48
|
"test.watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watch",
|
|
51
49
|
"test.watch-all": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watchAll --coverage",
|
|
52
|
-
"tsc": "tsc --incremental",
|
|
53
50
|
"tsc.prod": "tsc",
|
|
54
|
-
"
|
|
55
|
-
"tsc.watch": "tsc --incremental --watch"
|
|
51
|
+
"ts": "tsc --noEmit --project scripts/tsconfig.json && tsx"
|
|
56
52
|
},
|
|
57
53
|
"devDependencies": {
|
|
58
54
|
"@familyjs/prettier-config": "^4.0.0",
|
|
59
55
|
"@rollup/plugin-commonjs": "21.1.0",
|
|
60
56
|
"@rollup/plugin-json": "6.1.0",
|
|
61
57
|
"@rollup/plugin-node-resolve": "9.0.0",
|
|
62
|
-
"@rollup/plugin-replace": "5.0.
|
|
58
|
+
"@rollup/plugin-replace": "5.0.7",
|
|
63
59
|
"@rollup/pluginutils": "5.1.0",
|
|
64
60
|
"@types/eslint": "^8.4.6",
|
|
65
61
|
"@types/exit": "^0.1.31",
|
|
@@ -79,7 +75,7 @@
|
|
|
79
75
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
80
76
|
"ansi-colors": "4.1.3",
|
|
81
77
|
"autoprefixer": "10.4.19",
|
|
82
|
-
"conventional-changelog-cli": "^
|
|
78
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
83
79
|
"dts-bundle-generator": "~9.5.0",
|
|
84
80
|
"esbuild": "^0.21.0",
|
|
85
81
|
"esbuild-plugin-replace": "^1.4.0",
|
|
@@ -108,15 +104,16 @@
|
|
|
108
104
|
"parse5": "7.1.2",
|
|
109
105
|
"pixelmatch": "5.3.0",
|
|
110
106
|
"postcss": "^8.2.8",
|
|
111
|
-
"prettier": "3.
|
|
107
|
+
"prettier": "3.3.1",
|
|
112
108
|
"prompts": "2.4.2",
|
|
113
109
|
"puppeteer": "^21.0.0",
|
|
114
110
|
"rollup": "2.56.3",
|
|
115
111
|
"semver": "^7.3.7",
|
|
116
|
-
"terser": "5.31.
|
|
112
|
+
"terser": "5.31.1",
|
|
113
|
+
"tsx": "^4.10.3",
|
|
117
114
|
"typescript": "~5.4.0",
|
|
118
115
|
"webpack": "^5.75.0",
|
|
119
|
-
"ws": "8.17.
|
|
116
|
+
"ws": "8.17.1"
|
|
120
117
|
},
|
|
121
118
|
"engines": {
|
|
122
119
|
"node": ">=16.0.0",
|
|
@@ -142,6 +139,6 @@
|
|
|
142
139
|
"prettier": "@familyjs/prettier-config",
|
|
143
140
|
"volta": {
|
|
144
141
|
"node": "22.2.0",
|
|
145
|
-
"npm": "10.8.
|
|
142
|
+
"npm": "10.8.1"
|
|
146
143
|
}
|
|
147
144
|
}
|
package/screenshot/index.js
CHANGED