@wix/create-app 0.0.18 → 0.0.20

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.
@@ -0,0 +1,6 @@
1
+
2
+ import { createRequire as _createRequire } from 'node:module';
3
+ const require = _createRequire(import.meta.url);
4
+
5
+ var a=Object.create;var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var u=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var s=(t,e)=>()=>(t&&(e=t(t=0)),e);var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:!0})},n=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!l.call(t,m)&&m!==o&&r(t,m,{get:()=>e[m],enumerable:!(i=p(e,m))||i.enumerable});return t};var L=(t,e,o)=>(o=t!=null?a(f(t)):{},n(e||!t||!t.__esModule?r(o,"default",{value:t,enumerable:!0}):o,t)),P=t=>n(r({},"__esModule",{value:!0}),t);import{fileURLToPath as _}from"url";import d from"path";var g,h,b,x=s(()=>{"use strict";g=()=>_(import.meta.url),h=()=>d.dirname(g()),b=h()});export{u as a,s as b,D as c,F as d,L as e,P as f,b as g,x as h};
6
+ //# sourceMappingURL=chunk-JDGVCNVP.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/tsup/assets/esm_shims.js"],"sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n"],"mappings":";;;;u4BACA,OAAS,iBAAAA,MAAqB,MAC9B,OAAOC,MAAU,OAFjB,IAIMC,EACAC,EAEOC,EAPbC,EAAAC,EAAA,KAIMJ,EAAc,IAAMF,EAAc,YAAY,GAAG,EACjDG,EAAa,IAAMF,EAAK,QAAQC,EAAY,CAAC,EAEtCE,EAA4BD,EAAW","names":["fileURLToPath","path","getFilename","getDirname","__dirname","init_esm_shims","__esmMin"]}
1
+ {"version":3,"sources":["../../../node_modules/tsup/assets/esm_shims.js"],"sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n"],"mappings":";;;;m4BACA,OAAS,iBAAAA,MAAqB,MAC9B,OAAOC,MAAU,OAFjB,IAIMC,EACAC,EAEOC,EAPbC,EAAAC,EAAA,kBAIMJ,EAAc,IAAMF,EAAc,YAAY,GAAG,EACjDG,EAAa,IAAMF,EAAK,QAAQC,EAAY,CAAC,EAEtCE,EAA4BD,EAAW","names":["fileURLToPath","path","getFilename","getDirname","__dirname","init_esm_shims","__esmMin"]}
@@ -0,0 +1,12 @@
1
+
2
+ import { createRequire as _createRequire } from 'node:module';
3
+ const require = _createRequire(import.meta.url);
4
+
5
+ import{a as _,c as w,e as V,h as d}from"./chunk-JDGVCNVP.js";var qe=w((rr,Fe)=>{"use strict";d();var{Duplex:Gt}=_("stream");function Ae(s){s.emit("close")}function Vt(){!this.destroyed&&this._writableState.finished&&this.destroy()}function We(s){this.removeListener("error",We),this.destroy(),this.listenerCount("error")===0&&this.emit("error",s)}function $t(s,e){let t=!0,r=new Gt({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return s.on("message",function(n,o){let l=!o&&r._readableState.objectMode?n.toString():n;r.push(l)||s.pause()}),s.once("error",function(n){r.destroyed||(t=!1,r.destroy(n))}),s.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(i,n){if(s.readyState===s.CLOSED){n(i),process.nextTick(Ae,r);return}let o=!1;s.once("error",function(f){o=!0,n(f)}),s.once("close",function(){o||n(i),process.nextTick(Ae,r)}),t&&s.terminate()},r._final=function(i){if(s.readyState===s.CONNECTING){s.once("open",function(){r._final(i)});return}s._socket!==null&&(s._socket._writableState.finished?(i(),r._readableState.endEmitted&&r.destroy()):(s._socket.once("finish",function(){i()}),s.close()))},r._read=function(){s.isPaused&&s.resume()},r._write=function(i,n,o){if(s.readyState===s.CONNECTING){s.once("open",function(){r._write(i,n,o)});return}s.send(i,o)},r.on("end",Vt),r.on("error",We),r}Fe.exports=$t});var P=w((nr,Ge)=>{"use strict";d();Ge.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:()=>{}}});var $=w((ar,re)=>{"use strict";d();var{EMPTY_BUFFER:jt}=P(),me=Buffer[Symbol.species];function Ht(s,e){if(s.length===0)return jt;if(s.length===1)return s[0];let t=Buffer.allocUnsafe(e),r=0;for(let i=0;i<s.length;i++){let n=s[i];t.set(n,r),r+=n.length}return r<e?new me(t.buffer,t.byteOffset,r):t}function Ve(s,e,t,r,i){for(let n=0;n<i;n++)t[r+n]=s[n]^e[n&3]}function $e(s,e){for(let t=0;t<s.length;t++)s[t]^=e[t&3]}function zt(s){return s.length===s.buffer.byteLength?s.buffer:s.buffer.slice(s.byteOffset,s.byteOffset+s.length)}function ge(s){if(ge.readOnly=!0,Buffer.isBuffer(s))return s;let e;return s instanceof ArrayBuffer?e=new me(s):ArrayBuffer.isView(s)?e=new me(s.buffer,s.byteOffset,s.byteLength):(e=Buffer.from(s),ge.readOnly=!1),e}re.exports={concat:Ht,mask:Ve,toArrayBuffer:zt,toBuffer:ge,unmask:$e};if(!process.env.WS_NO_BUFFER_UTIL)try{let s=_("bufferutil");re.exports.mask=function(e,t,r,i,n){n<48?Ve(e,t,r,i,n):s.mask(e,t,r,i,n)},re.exports.unmask=function(e,t){e.length<32?$e(e,t):s.unmask(e,t)}}catch{}});var ze=w((fr,He)=>{"use strict";d();var je=Symbol("kDone"),ye=Symbol("kRun"),xe=class{constructor(e){this[je]=()=>{this.pending--,this[ye]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ye]()}[ye](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[je])}}};He.exports=xe});var z=w((cr,Ze)=>{"use strict";d();var j=_("zlib"),Ye=$(),Yt=ze(),{kStatusCode:Ke}=P(),Kt=Buffer[Symbol.species],Xt=Buffer.from([0,0,255,255]),oe=Symbol("permessage-deflate"),C=Symbol("total-length"),H=Symbol("callback"),R=Symbol("buffers"),ne=Symbol("error"),ie,Se=class{constructor(e,t,r){if(this._maxPayload=r|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!ie){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;ie=new Yt(i)}}static get extensionName(){return"permessage-deflate"}offer(){let 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:this._options.clientMaxWindowBits==null&&(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){let e=this._deflate[H];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,r=e.find(i=>!(t.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>i.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(r.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?r.client_max_window_bits=t.clientMaxWindowBits:(r.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(r=>{let i=t[r];if(i.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(i=i[0],r==="client_max_window_bits"){if(i!==!0){let n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else if(r==="server_max_window_bits"){let n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=i})}),e}decompress(e,t,r){ie.add(i=>{this._decompress(e,t,(n,o)=>{i(),r(n,o)})})}compress(e,t,r){ie.add(i=>{this._compress(e,t,(n,o)=>{i(),r(n,o)})})}_decompress(e,t,r){let i=this._isServer?"client":"server";if(!this._inflate){let n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?j.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=j.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[oe]=this,this._inflate[C]=0,this._inflate[R]=[],this._inflate.on("error",Qt),this._inflate.on("data",Xe)}this._inflate[H]=r,this._inflate.write(e),t&&this._inflate.write(Xt),this._inflate.flush(()=>{let n=this._inflate[ne];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=Ye.concat(this._inflate[R],this._inflate[C]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[C]=0,this._inflate[R]=[],t&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let i=this._isServer?"server":"client";if(!this._deflate){let n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?j.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=j.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[C]=0,this._deflate[R]=[],this._deflate.on("data",Zt)}this._deflate[H]=r,this._deflate.write(e),this._deflate.flush(j.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Ye.concat(this._deflate[R],this._deflate[C]);t&&(n=new Kt(n.buffer,n.byteOffset,n.length-4)),this._deflate[H]=null,this._deflate[C]=0,this._deflate[R]=[],t&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};Ze.exports=Se;function Zt(s){this[R].push(s),this[C]+=s.length}function Xe(s){if(this[C]+=s.length,this[oe]._maxPayload<1||this[C]<=this[oe]._maxPayload){this[R].push(s);return}this[ne]=new RangeError("Max payload size exceeded"),this[ne].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ne][Ke]=1009,this.removeListener("data",Xe),this.reset()}function Qt(s){this[oe]._inflate=null,s[Ke]=1007,this[H](s)}});var Y=w((dr,ae)=>{"use strict";d();var{isUtf8:Qe}=_("buffer"),Jt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function es(s){return s>=1e3&&s<=1014&&s!==1004&&s!==1005&&s!==1006||s>=3e3&&s<=4999}function Ee(s){let e=s.length,t=0;for(;t<e;)if(!(s[t]&128))t++;else if((s[t]&224)===192){if(t+1===e||(s[t+1]&192)!==128||(s[t]&254)===192)return!1;t+=2}else if((s[t]&240)===224){if(t+2>=e||(s[t+1]&192)!==128||(s[t+2]&192)!==128||s[t]===224&&(s[t+1]&224)===128||s[t]===237&&(s[t+1]&224)===160)return!1;t+=3}else if((s[t]&248)===240){if(t+3>=e||(s[t+1]&192)!==128||(s[t+2]&192)!==128||(s[t+3]&192)!==128||s[t]===240&&(s[t+1]&240)===128||s[t]===244&&s[t+1]>143||s[t]>244)return!1;t+=4}else return!1;return!0}ae.exports={isValidStatusCode:es,isValidUTF8:Ee,tokenChars:Jt};if(Qe)ae.exports.isValidUTF8=function(s){return s.length<24?Ee(s):Qe(s)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let s=_("utf-8-validate");ae.exports.isValidUTF8=function(e){return e.length<32?Ee(e):s(e)}}catch{}});var Oe=w((pr,nt)=>{"use strict";d();var{Writable:ts}=_("stream"),Je=z(),{BINARY_TYPES:ss,EMPTY_BUFFER:et,kStatusCode:rs,kWebSocket:is}=P(),{concat:ve,toArrayBuffer:ns,unmask:os}=$(),{isValidStatusCode:as,isValidUTF8:tt}=Y(),le=Buffer[Symbol.species],K=0,st=1,rt=2,it=3,be=4,ls=5,we=class extends ts{constructor(e={}){super(),this._binaryType=e.binaryType||ss[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[is]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=K,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==K)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new le(r.buffer,r.byteOffset+e,r.length-e),new le(r.buffer,r.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let r=this._buffers[0],i=t.length-e;e>=r.length?t.set(this._buffers.shift(),i):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),i),this._buffers[0]=new le(r.buffer,r.byteOffset+e,r.length-e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do switch(this._state){case K:t=this.getInfo();break;case st:t=this.getPayloadLength16();break;case rt:t=this.getPayloadLength64();break;case it:this.getMask();break;case be:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48)return this._loop=!1,y(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");let t=(e[0]&64)===64;if(t&&!this._extensions[Je.extensionName])return this._loop=!1,y(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,y(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,y(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,y(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,y(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,y(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1)return this._loop=!1,y(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,y(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,y(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,y(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=st;else if(this._payloadLength===127)this._state=rt;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,53-32)-1?(this._loop=!1,y(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,y(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=it:this._state=be}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=be}getData(e){let t=et;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&os(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=ls,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[Je.extensionName].decompress(e,this._fin,(i,n)=>{if(i)return t(i);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(y(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}let o=this.dataMessage();if(o)return t(o);this.startLoop(t)})}dataMessage(){if(this._fin){let e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=ve(t,e):this._binaryType==="arraybuffer"?r=ns(ve(t,e)):r=t,this.emit("message",r,!0)}else{let r=ve(t,e);if(!this._skipUTF8Validation&&!tt(r))return this._loop=!1,y(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=K}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,et),this.end();else{let t=e.readUInt16BE(0);if(!as(t))return y(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=new le(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!tt(r))return y(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=K}};nt.exports=we;function y(s,e,t,r,i){let n=new s(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,y),n.code=i,n[rs]=r,n}});var Te=w((xr,lt)=>{"use strict";d();var gr=_("net"),yr=_("tls"),{randomFillSync:fs}=_("crypto"),ot=z(),{EMPTY_BUFFER:hs}=P(),{isValidStatusCode:cs}=Y(),{mask:at,toBuffer:W}=$(),k=Symbol("kByteLength"),us=Buffer.alloc(4),ke=class s{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,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 r,i=!1,n=2,o=!1;t.mask&&(r=t.maskBuffer||us,t.generateMask?t.generateMask(r):fs(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let l;typeof e=="string"?(!t.mask||o)&&t[k]!==void 0?l=t[k]:(e=Buffer.from(e),l=e.length):(l=e.length,i=t.mask&&t.readOnly&&!o);let f=l;l>=65536?(n+=8,f=127):l>125&&(n+=2,f=126);let a=Buffer.allocUnsafe(i?l+n:n);return a[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(a[0]|=64),a[1]=f,f===126?a.writeUInt16BE(l,2):f===127&&(a[2]=a[3]=0,a.writeUIntBE(l,4,6)),t.mask?(a[1]|=128,a[n-4]=r[0],a[n-3]=r[1],a[n-2]=r[2],a[n-1]=r[3],o?[a,e]:i?(at(e,r,a,n,l),[a]):(at(e,r,e,0,l),[a,e])):[a,e]}close(e,t,r,i){let n;if(e===void 0)n=hs;else{if(typeof e!="number"||!cs(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let l=Buffer.byteLength(t);if(l>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+l),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[k]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,i]):this.sendFrame(s.frame(n,o),i)}ping(e,t,r){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=!1):(e=W(e),i=e.length,n=W.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[k]:i,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(s.frame(e,o),r)}pong(e,t,r){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=!1):(e=W(e),i=e.length,n=W.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[k]:i,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(s.frame(e,o),r)}send(e,t,r){let i=this._extensions[ot.extensionName],n=t.binary?2:1,o=t.compress,l,f;if(typeof e=="string"?(l=Buffer.byteLength(e),f=!1):(e=W(e),l=e.length,f=W.readOnly),this._firstFragment?(this._firstFragment=!1,o&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=l>=i._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),i){let a={[k]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,a,r]):this.dispatch(e,this._compress,a,r)}else this.sendFrame(s.frame(e,{[k]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:!1}),r)}dispatch(e,t,r,i){if(!t){this.sendFrame(s.frame(e,r),i);return}let n=this._extensions[ot.extensionName];this._bufferedBytes+=r[k],this._deflating=!0,n.compress(e,r.fin,(o,l)=>{if(this._socket.destroyed){let f=new Error("The socket was closed while data was being compressed");typeof i=="function"&&i(f);for(let a=0;a<this._queue.length;a++){let c=this._queue[a],h=c[c.length-1];typeof h=="function"&&h(f)}return}this._bufferedBytes-=r[k],this._deflating=!1,r.readOnly=!1,this.sendFrame(s.frame(l,r),i),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][k],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][k],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};lt.exports=ke});var gt=w((Er,mt)=>{"use strict";d();var{kForOnEventAttribute:X,kListener:Ce}=P(),ft=Symbol("kCode"),ht=Symbol("kData"),ct=Symbol("kError"),ut=Symbol("kMessage"),dt=Symbol("kReason"),F=Symbol("kTarget"),_t=Symbol("kType"),pt=Symbol("kWasClean"),N=class{constructor(e){this[F]=null,this[_t]=e}get target(){return this[F]}get type(){return this[_t]}};Object.defineProperty(N.prototype,"target",{enumerable:!0});Object.defineProperty(N.prototype,"type",{enumerable:!0});var B=class extends N{constructor(e,t={}){super(e),this[ft]=t.code===void 0?0:t.code,this[dt]=t.reason===void 0?"":t.reason,this[pt]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[ft]}get reason(){return this[dt]}get wasClean(){return this[pt]}};Object.defineProperty(B.prototype,"code",{enumerable:!0});Object.defineProperty(B.prototype,"reason",{enumerable:!0});Object.defineProperty(B.prototype,"wasClean",{enumerable:!0});var q=class extends N{constructor(e,t={}){super(e),this[ct]=t.error===void 0?null:t.error,this[ut]=t.message===void 0?"":t.message}get error(){return this[ct]}get message(){return this[ut]}};Object.defineProperty(q.prototype,"error",{enumerable:!0});Object.defineProperty(q.prototype,"message",{enumerable:!0});var Z=class extends N{constructor(e,t={}){super(e),this[ht]=t.data===void 0?null:t.data}get data(){return this[ht]}};Object.defineProperty(Z.prototype,"data",{enumerable:!0});var ds={addEventListener(s,e,t={}){for(let i of this.listeners(s))if(!t[X]&&i[Ce]===e&&!i[X])return;let r;if(s==="message")r=function(n,o){let l=new Z("message",{data:o?n:n.toString()});l[F]=this,fe(e,this,l)};else if(s==="close")r=function(n,o){let l=new B("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[F]=this,fe(e,this,l)};else if(s==="error")r=function(n){let o=new q("error",{error:n,message:n.message});o[F]=this,fe(e,this,o)};else if(s==="open")r=function(){let n=new N("open");n[F]=this,fe(e,this,n)};else return;r[X]=!!t[X],r[Ce]=e,t.once?this.once(s,r):this.on(s,r)},removeEventListener(s,e){for(let t of this.listeners(s))if(t[Ce]===e&&!t[X]){this.removeListener(s,t);break}}};mt.exports={CloseEvent:B,ErrorEvent:q,Event:N,EventTarget:ds,MessageEvent:Z};function fe(s,e,t){typeof s=="object"&&s.handleEvent?s.handleEvent.call(s,t):s.call(e,t)}});var Ne=w((br,yt)=>{"use strict";d();var{tokenChars:Q}=Y();function T(s,e,t){s[e]===void 0?s[e]=[t]:s[e].push(t)}function _s(s){let e=Object.create(null),t=Object.create(null),r=!1,i=!1,n=!1,o,l,f=-1,a=-1,c=-1,h=0;for(;h<s.length;h++)if(a=s.charCodeAt(h),o===void 0)if(c===-1&&Q[a]===1)f===-1&&(f=h);else if(h!==0&&(a===32||a===9))c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let S=s.slice(f,c);a===44?(T(e,S,t),t=Object.create(null)):o=S,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(l===void 0)if(c===-1&&Q[a]===1)f===-1&&(f=h);else if(a===32||a===9)c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h),T(t,s.slice(f,c),!0),a===44&&(T(e,o,t),t=Object.create(null),o=void 0),f=c=-1}else if(a===61&&f!==-1&&c===-1)l=s.slice(f,h),f=c=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(i){if(Q[a]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1?f=h:r||(r=!0),i=!1}else if(n)if(Q[a]===1)f===-1&&(f=h);else if(a===34&&f!==-1)n=!1,c=h;else if(a===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===34&&s.charCodeAt(h-1)===61)n=!0;else if(c===-1&&Q[a]===1)f===-1&&(f=h);else if(f!==-1&&(a===32||a===9))c===-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let S=s.slice(f,c);r&&(S=S.replace(/\\/g,""),r=!1),T(t,l,S),a===44&&(T(e,o,t),t=Object.create(null),o=void 0),l=void 0,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(f===-1||n||a===32||a===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=h);let g=s.slice(f,c);return o===void 0?T(e,g,t):(l===void 0?T(t,g,!0):r?T(t,l,g.replace(/\\/g,"")):T(t,l,g),T(e,o,t)),e}function ps(s){return Object.keys(s).map(e=>{let t=s[e];return Array.isArray(t)||(t=[t]),t.map(r=>[e].concat(Object.keys(r).map(i=>{let n=r[i];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?i:`${i}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}yt.exports={format:ps,parse:_s}});var Ie=w((kr,Nt)=>{"use strict";d();var ms=_("events"),gs=_("https"),ys=_("http"),Et=_("net"),xs=_("tls"),{randomBytes:Ss,createHash:Es}=_("crypto"),{Readable:Or}=_("stream"),{URL:Le}=_("url"),U=z(),vs=Oe(),bs=Te(),{BINARY_TYPES:xt,EMPTY_BUFFER:he,GUID:ws,kForOnEventAttribute:Pe,kListener:Os,kStatusCode:ks,kWebSocket:x,NOOP:vt}=P(),{EventTarget:{addEventListener:Ts,removeEventListener:Cs}}=gt(),{format:Ns,parse:Ls}=Ne(),{toBuffer:Ps}=$(),Rs=30*1e3,bt=Symbol("kAborted"),Re=[8,13],L=["CONNECTING","OPEN","CLOSING","CLOSED"],Us=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,p=class s extends ms{constructor(e,t,r){super(),this._binaryType=xt[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=he,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=s.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(r=t,t=[]):t=[t]),wt(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){xt.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,r){let i=new vs({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new bs(e,this._extensions,r.generateMask),this._receiver=i,this._socket=e,i[x]=this,e[x]=this,i.on("conclude",Ms),i.on("drain",Ds),i.on("error",As),i.on("message",Ws),i.on("ping",Fs),i.on("pong",qs),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",kt),e.on("data",ue),e.on("end",Tt),e.on("error",Ct),this._readyState=s.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=s.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[U.extensionName]&&this._extensions[U.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=s.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==s.CLOSED){if(this.readyState===s.CONNECTING){let r="WebSocket was closed before the connection was established";O(this,this._req,r);return}if(this.readyState===s.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=s.CLOSING,this._sender.close(e,t,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Rs)}}pause(){this.readyState===s.CONNECTING||this.readyState===s.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===s.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==s.OPEN){Ue(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||he,t,r)}pong(e,t,r){if(this.readyState===s.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==s.OPEN){Ue(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||he,t,r)}resume(){this.readyState===s.CONNECTING||this.readyState===s.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===s.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(r=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==s.OPEN){Ue(this,e,r);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[U.extensionName]||(i.compress=!1),this._sender.send(e||he,i,r)}terminate(){if(this.readyState!==s.CLOSED){if(this.readyState===s.CONNECTING){let e="WebSocket was closed before the connection was established";O(this,this._req,e);return}this._socket&&(this._readyState=s.CLOSING,this._socket.destroy())}}};Object.defineProperty(p,"CONNECTING",{enumerable:!0,value:L.indexOf("CONNECTING")});Object.defineProperty(p.prototype,"CONNECTING",{enumerable:!0,value:L.indexOf("CONNECTING")});Object.defineProperty(p,"OPEN",{enumerable:!0,value:L.indexOf("OPEN")});Object.defineProperty(p.prototype,"OPEN",{enumerable:!0,value:L.indexOf("OPEN")});Object.defineProperty(p,"CLOSING",{enumerable:!0,value:L.indexOf("CLOSING")});Object.defineProperty(p.prototype,"CLOSING",{enumerable:!0,value:L.indexOf("CLOSING")});Object.defineProperty(p,"CLOSED",{enumerable:!0,value:L.indexOf("CLOSED")});Object.defineProperty(p.prototype,"CLOSED",{enumerable:!0,value:L.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(s=>{Object.defineProperty(p.prototype,s,{enumerable:!0})});["open","error","close","message"].forEach(s=>{Object.defineProperty(p.prototype,`on${s}`,{enumerable:!0,get(){for(let e of this.listeners(s))if(e[Pe])return e[Os];return null},set(e){for(let t of this.listeners(s))if(t[Pe]){this.removeListener(s,t);break}typeof e=="function"&&this.addEventListener(s,e,{[Pe]:!0})}})});p.prototype.addEventListener=Ts;p.prototype.removeEventListener=Cs;Nt.exports=p;function wt(s,e,t,r){let i={protocolVersion:Re[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!Re.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Re.join(", ")})`);let n;if(e instanceof Le)n=e,s._url=e.href;else{try{n=new Le(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s._url=e}let o=n.protocol==="wss:",l=n.protocol==="ws+unix:",f;if(n.protocol!=="ws:"&&!o&&!l?f=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:l&&!n.pathname?f="The URL's pathname is empty":n.hash&&(f="The URL contains a fragment identifier"),f){let u=new SyntaxError(f);if(s._redirects===0)throw u;ce(s,u);return}let a=o?443:80,c=Ss(16).toString("base64"),h=o?gs.request:ys.request,g=new Set,S;if(i.createConnection=o?Bs:Is,i.defaultPort=i.defaultPort||a,i.port=n.port||a,i.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},i.path=n.pathname+n.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(S=new U(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=Ns({[U.extensionName]:S.offer()})),t.length){for(let u of t){if(typeof u!="string"||!Us.test(u)||g.has(u))throw new SyntaxError("An invalid or duplicated subprotocol was specified");g.add(u)}i.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(n.username||n.password)&&(i.auth=`${n.username}:${n.password}`),l){let u=i.path.split(":");i.socketPath=u[0],i.path=u[1]}let m;if(i.followRedirects){if(s._redirects===0){s._originalIpc=l,s._originalSecure=o,s._originalHostOrSocketPath=l?i.socketPath:n.host;let u=r&&r.headers;if(r={...r,headers:{}},u)for(let[b,A]of Object.entries(u))r.headers[b.toLowerCase()]=A}else if(s.listenerCount("redirect")===0){let u=l?s._originalIpc?i.socketPath===s._originalHostOrSocketPath:!1:s._originalIpc?!1:n.host===s._originalHostOrSocketPath;(!u||s._originalSecure&&!o)&&(delete i.headers.authorization,delete i.headers.cookie,u||delete i.headers.host,i.auth=void 0)}i.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),m=s._req=h(i),s._redirects&&s.emit("redirect",s.url,m)}else m=s._req=h(i);i.timeout&&m.on("timeout",()=>{O(s,m,"Opening handshake has timed out")}),m.on("error",u=>{m===null||m[bt]||(m=s._req=null,ce(s,u))}),m.on("response",u=>{let b=u.headers.location,A=u.statusCode;if(b&&i.followRedirects&&A>=300&&A<400){if(++s._redirects>i.maxRedirects){O(s,m,"Maximum redirects exceeded");return}m.abort();let se;try{se=new Le(b,e)}catch{let I=new SyntaxError(`Invalid URL: ${b}`);ce(s,I);return}wt(s,se,t,r)}else s.emit("unexpected-response",m,u)||O(s,m,`Unexpected server response: ${u.statusCode}`)}),m.on("upgrade",(u,b,A)=>{if(s.emit("upgrade",u),s.readyState!==p.CONNECTING)return;if(m=s._req=null,u.headers.upgrade.toLowerCase()!=="websocket"){O(s,b,"Invalid Upgrade header");return}let se=Es("sha1").update(c+ws).digest("base64");if(u.headers["sec-websocket-accept"]!==se){O(s,b,"Invalid Sec-WebSocket-Accept header");return}let G=u.headers["sec-websocket-protocol"],I;if(G!==void 0?g.size?g.has(G)||(I="Server sent an invalid subprotocol"):I="Server sent a subprotocol but none was requested":g.size&&(I="Server sent no subprotocol"),I){O(s,b,I);return}G&&(s._protocol=G);let Me=u.headers["sec-websocket-extensions"];if(Me!==void 0){if(!S){O(s,b,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _e;try{_e=Ls(Me)}catch{O(s,b,"Invalid Sec-WebSocket-Extensions header");return}let De=Object.keys(_e);if(De.length!==1||De[0]!==U.extensionName){O(s,b,"Server indicated an extension that was not requested");return}try{S.accept(_e[U.extensionName])}catch{O(s,b,"Invalid Sec-WebSocket-Extensions header");return}s._extensions[U.extensionName]=S}s.setSocket(b,A,{generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(m,s):m.end()}function ce(s,e){s._readyState=p.CLOSING,s.emit("error",e),s.emitClose()}function Is(s){return s.path=s.socketPath,Et.connect(s)}function Bs(s){return s.path=void 0,!s.servername&&s.servername!==""&&(s.servername=Et.isIP(s.host)?"":s.host),xs.connect(s)}function O(s,e,t){s._readyState=p.CLOSING;let r=new Error(t);Error.captureStackTrace(r,O),e.setHeader?(e[bt]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(ce,s,r)):(e.destroy(r),e.once("error",s.emit.bind(s,"error")),e.once("close",s.emitClose.bind(s)))}function Ue(s,e,t){if(e){let r=Ps(e).length;s._socket?s._sender._bufferedBytes+=r:s._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${s.readyState} (${L[s.readyState]})`);process.nextTick(t,r)}}function Ms(s,e){let t=this[x];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=s,t._socket[x]!==void 0&&(t._socket.removeListener("data",ue),process.nextTick(Ot,t._socket),s===1005?t.close():t.close(s,e))}function Ds(){let s=this[x];s.isPaused||s._socket.resume()}function As(s){let e=this[x];e._socket[x]!==void 0&&(e._socket.removeListener("data",ue),process.nextTick(Ot,e._socket),e.close(s[ks])),e.emit("error",s)}function St(){this[x].emitClose()}function Ws(s,e){this[x].emit("message",s,e)}function Fs(s){let e=this[x];e.pong(s,!e._isServer,vt),e.emit("ping",s)}function qs(s){this[x].emit("pong",s)}function Ot(s){s.resume()}function kt(){let s=this[x];this.removeListener("close",kt),this.removeListener("data",ue),this.removeListener("end",Tt),s._readyState=p.CLOSING;let e;!this._readableState.endEmitted&&!s._closeFrameReceived&&!s._receiver._writableState.errorEmitted&&(e=s._socket.read())!==null&&s._receiver.write(e),s._receiver.end(),this[x]=void 0,clearTimeout(s._closeTimer),s._receiver._writableState.finished||s._receiver._writableState.errorEmitted?s.emitClose():(s._receiver.on("error",St),s._receiver.on("finish",St))}function ue(s){this[x]._receiver.write(s)||this.pause()}function Tt(){let s=this[x];s._readyState=p.CLOSING,s._receiver.end(),this.end()}function Ct(){let s=this[x];this.removeListener("error",Ct),this.on("error",vt),s&&(s._readyState=p.CLOSING,this.destroy())}});var Pt=w((Cr,Lt)=>{"use strict";d();var{tokenChars:Gs}=Y();function Vs(s){let e=new Set,t=-1,r=-1,i=0;for(i;i<s.length;i++){let o=s.charCodeAt(i);if(r===-1&&Gs[o]===1)t===-1&&(t=i);else if(i!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=i);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${i}`);r===-1&&(r=i);let l=s.slice(t,r);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=s.slice(t,i);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Lt.exports={parse:Vs}});var At=w((Ur,Dt)=>{"use strict";d();var $s=_("events"),de=_("http"),Lr=_("https"),Pr=_("net"),Rr=_("tls"),{createHash:js}=_("crypto"),Rt=Ne(),M=z(),Hs=Pt(),zs=Ie(),{GUID:Ys,kWebSocket:Ks}=P(),Xs=/^[+/0-9A-Za-z]{22}==$/,Ut=0,It=1,Mt=2,Be=class extends $s{constructor(e,t){if(super(),e={maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:zs,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(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(e.port!=null?(this._server=de.createServer((r,i)=>{let n=de.STATUS_CODES[426];i.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),i.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=Zs(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,n,o)=>{this.handleUpgrade(i,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Ut}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(this._state===Mt){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(J,this);return}if(e&&this.once("close",e),this._state!==It)if(this._state=It,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(J,this):process.nextTick(J,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{J(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,i){t.on("error",Bt);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){D(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){D(this,e,t,400,"Invalid Upgrade header");return}if(!n||!Xs.test(n)){D(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){D(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){ee(t,400);return}let l=e.headers["sec-websocket-protocol"],f=new Set;if(l!==void 0)try{f=Hs.parse(l)}catch{D(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let a=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&a!==void 0){let h=new M(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let g=Rt.parse(a);g[M.extensionName]&&(h.accept(g[M.extensionName]),c[M.extensionName]=h)}catch{D(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(g,S,m,u)=>{if(!g)return ee(t,S||401,m,u);this.completeUpgrade(c,n,f,e,t,r,i)});return}if(!this.options.verifyClient(h))return ee(t,401)}this.completeUpgrade(c,n,f,e,t,r,i)}completeUpgrade(e,t,r,i,n,o,l){if(!n.readable||!n.writable)return n.destroy();if(n[Ks])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Ut)return ee(n,503);let a=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${js("sha1").update(t+Ys).digest("base64")}`],c=new this.options.WebSocket(null);if(r.size){let h=this.options.handleProtocols?this.options.handleProtocols(r,i):r.values().next().value;h&&(a.push(`Sec-WebSocket-Protocol: ${h}`),c._protocol=h)}if(e[M.extensionName]){let h=e[M.extensionName].params,g=Rt.format({[M.extensionName]:[h]});a.push(`Sec-WebSocket-Extensions: ${g}`),c._extensions=e}this.emit("headers",a,i),n.write(a.concat(`\r
6
+ `).join(`\r
7
+ `)),n.removeListener("error",Bt),c.setSocket(n,o,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(J,this)})),l(c,i)}};Dt.exports=Be;function Zs(s,e){for(let t of Object.keys(e))s.on(t,e[t]);return function(){for(let r of Object.keys(e))s.removeListener(r,e[r])}}function J(s){s._state=Mt,s.emit("close")}function Bt(){this.destroy()}function ee(s,e,t,r){t=t||de.STATUS_CODES[e],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t),...r},s.once("finish",s.destroy),s.end(`HTTP/1.1 ${e} ${de.STATUS_CODES[e]}\r
8
+ `+Object.keys(r).map(i=>`${i}: ${r[i]}`).join(`\r
9
+ `)+`\r
10
+ \r
11
+ `+t)}function D(s,e,t,r,i){if(s.listenerCount("wsClientError")){let n=new Error(i);Error.captureStackTrace(n,D),s.emit("wsClientError",n,t,e)}else ee(t,r,i)}});d();d();d();var Qs=V(qe(),1),Js=V(Oe(),1),er=V(Te(),1),Wt=V(Ie(),1),tr=V(At(),1);var Ft=Wt.default;var te=global;te.WebSocket||(te.WebSocket=Ft);te.window||(te.window=global);te.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}];import sr from"react-devtools-core";sr.connectToDevTools();
12
+ //# sourceMappingURL=devtools-3PMMQQZD.js.map