@wendongfly/myhi 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attach.js +61 -1
- package/package.json +1 -1
package/dist/attach.js
CHANGED
|
@@ -1,2 +1,62 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
var _i=Object.create;var rs=Object.defineProperty;var Ci=Object.getOwnPropertyDescriptor;var bi=Object.getOwnPropertyNames;var Ei=Object.getPrototypeOf,wi=Object.prototype.hasOwnProperty;var b=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var x=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),xi=(s,e)=>{for(var t in e)rs(s,t,{get:e[t],enumerable:!0})},vi=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of bi(e))!wi.call(s,n)&&n!==t&&rs(s,n,{get:()=>e[n],enumerable:!(r=Ci(e,n))||r.enumerable});return s};var O=(s,e,t)=>(t=s!=null?_i(Ei(s)):{},vi(e||!s||!s.__esModule?rs(t,"default",{value:s,enumerable:!0}):t,s));var Js=x((Mc,Ys)=>{var Se=b("fs"),Xs=b("url"),Si=b("child_process").spawn;Ys.exports=ns;ns.XMLHttpRequest=ns;function ns(s){"use strict";s=s||{};var e=this,t=b("http"),r=b("https"),n,i,o={},f=!1,l={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},u=Object.assign({},l),a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],c=["TRACE","TRACK","CONNECT"],h=!1,p=!1,_=!1,d={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.response=Buffer.alloc(0),this.status=null,this.statusText=null;var g=function(m){return f||m&&a.indexOf(m.toLowerCase())===-1},E=function(m){return m&&c.indexOf(m)===-1};this.open=function(m,y,F,S,B){if(this.abort(),p=!1,_=!1,!E(m))throw new Error("SecurityError: Request method not allowed");o={method:m,url:y.toString(),async:typeof F!="boolean"?!0:F,user:S||null,password:B||null},w(this.OPENED)},this.setDisableHeaderCheck=function(m){f=m},this.setRequestHeader=function(m,y){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!g(m))return console.warn('Refused to set unsafe header "'+m+'"'),!1;if(h)throw new Error("INVALID_STATE_ERR: send flag is true");return u[m]=y,!0},this.getResponseHeader=function(m){return typeof m=="string"&&this.readyState>this.OPENED&&i.headers[m.toLowerCase()]&&!p?i.headers[m.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||p)return"";var m="";for(var y in i.headers)y!=="set-cookie"&&y!=="set-cookie2"&&(m+=y+": "+i.headers[y]+`\r
|
|
3
|
+
`);return m.substr(0,m.length-2)},this.getRequestHeader=function(m){return typeof m=="string"&&u[m]?u[m]:""},this.send=function(m){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(h)throw new Error("INVALID_STATE_ERR: send has already been called");var y=!1,F=!1,S=Xs.parse(o.url),B;switch(S.protocol){case"https:":y=!0;case"http:":B=S.hostname;break;case"file:":F=!0;break;case void 0:case"":B="localhost";break;default:throw new Error("Protocol not supported.")}if(F){if(o.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)Se.readFile(unescape(S.pathname),function(I,le){I?e.handleError(I,I.errno||-1):(e.status=200,e.responseText=le.toString("utf8"),e.response=le,w(e.DONE))});else try{this.response=Se.readFileSync(unescape(S.pathname)),this.responseText=this.response.toString("utf8"),this.status=200,w(e.DONE)}catch(I){this.handleError(I,I.errno||-1)}return}var D=S.port||(y?443:80),z=S.pathname+(S.search?S.search:"");if(u.Host=B,y&&D===443||D===80||(u.Host+=":"+S.port),o.user){typeof o.password>"u"&&(o.password="");var Qt=new Buffer(o.user+":"+o.password);u.Authorization="Basic "+Qt.toString("base64")}if(o.method==="GET"||o.method==="HEAD")m=null;else if(m){u["Content-Length"]=Buffer.isBuffer(m)?m.length:Buffer.byteLength(m);var ui=Object.keys(u);ui.some(function(I){return I.toLowerCase()==="content-type"})||(u["Content-Type"]="text/plain;charset=UTF-8")}else o.method==="POST"&&(u["Content-Length"]=0);var di=s.agent||!1,K={host:B,port:D,path:z,method:o.method,headers:u,agent:di};if(y&&(K.pfx=s.pfx,K.key=s.key,K.passphrase=s.passphrase,K.cert=s.cert,K.ca=s.ca,K.ciphers=s.ciphers,K.rejectUnauthorized=s.rejectUnauthorized!==!1),p=!1,o.async){var Zt=y?r.request:t.request;h=!0,e.dispatchEvent("readystatechange");var es=function(I){if(i=I,i.statusCode===302||i.statusCode===303||i.statusCode===307){o.url=i.headers.location;var le=Xs.parse(o.url);B=le.hostname;var ae={hostname:le.hostname,port:le.port,path:le.path,method:i.statusCode===303?"GET":o.method,headers:u};y&&(ae.pfx=s.pfx,ae.key=s.key,ae.passphrase=s.passphrase,ae.cert=s.cert,ae.ca=s.ca,ae.ciphers=s.ciphers,ae.rejectUnauthorized=s.rejectUnauthorized!==!1),n=Zt(ae,es).on("error",ts),n.end();return}w(e.HEADERS_RECEIVED),e.status=i.statusCode,i.on("data",function(yt){if(yt){var yi=Buffer.from(yt);e.response=Buffer.concat([e.response,yi])}h&&w(e.LOADING)}),i.on("end",function(){h&&(h=!1,w(e.DONE),e.responseText=e.response.toString("utf8"))}),i.on("error",function(yt){e.handleError(yt)})},ts=function(I){if(n.reusedSocket&&I.code==="ECONNRESET")return Zt(K,es).on("error",ts);e.handleError(I)};n=Zt(K,es).on("error",ts),s.autoUnref&&n.on("socket",I=>{I.unref()}),m&&n.write(m),n.end(),e.dispatchEvent("loadstart")}else{var Ye=".node-xmlhttprequest-content-"+process.pid,Je=".node-xmlhttprequest-sync-"+process.pid;Se.writeFileSync(Je,"","utf8");for(var pi="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(y?"s":"")+".request;var options = "+JSON.stringify(K)+";var responseText = '';var responseData = Buffer.alloc(0);var req = doRequest(options, function(response) {response.on('data', function(chunk) { var data = Buffer.from(chunk); responseText += data.toString('utf8'); responseData = Buffer.concat([responseData, data]);});response.on('end', function() {fs.writeFileSync('"+Ye+"', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText, data: responseData.toString('base64')}}), 'utf8');fs.unlinkSync('"+Je+"');});response.on('error', function(error) {fs.writeFileSync('"+Ye+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+Je+"');});}).on('error', function(error) {fs.writeFileSync('"+Ye+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+Je+"');});"+(m?"req.write('"+JSON.stringify(m).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",mi=Si(process.argv[0],["-e",pi]),Uc;Se.existsSync(Je););if(e.responseText=Se.readFileSync(Ye,"utf8"),mi.stdin.end(),Se.unlinkSync(Ye),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var gi=JSON.parse(e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,""));e.handleError(gi,503)}else{e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1");var ss=JSON.parse(e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"));i={statusCode:e.status,headers:ss.data.headers},e.responseText=ss.data.text,e.response=Buffer.from(ss.data.data,"base64"),w(e.DONE,!0)}}},this.handleError=function(m,y){this.status=y||0,this.statusText=m,this.responseText=m.stack,p=!0,w(this.DONE)},this.abort=function(){n&&(n.abort(),n=null),u=Object.assign({},l),this.responseText="",this.responseXML="",this.response=Buffer.alloc(0),p=_=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||h)&&this.readyState!==this.DONE&&(h=!1,w(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(m,y){m in d||(d[m]=[]),d[m].push(y)},this.removeEventListener=function(m,y){m in d&&(d[m]=d[m].filter(function(F){return F!==y}))},this.dispatchEvent=function(m){if(typeof e["on"+m]=="function"&&(this.readyState===this.DONE&&o.async?setTimeout(function(){e["on"+m]()},0):e["on"+m]()),m in d)for(let y=0,F=d[m].length;y<F;y++)this.readyState===this.DONE?setTimeout(function(){d[m][y].call(e)},0):d[m][y].call(e)};var w=function(m){if(!(e.readyState===m||e.readyState===e.UNSENT&&_)&&(e.readyState=m,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let y;_?y="abort":p?y="error":y="load",e.dispatchEvent(y),e.dispatchEvent("loadend")}}}});var ue=x(ir=>{ir.Emitter=U;function U(s){if(s)return ki(s)}function ki(s){for(var e in U.prototype)s[e]=U.prototype[e];return s}U.prototype.on=U.prototype.addEventListener=function(s,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(e),this};U.prototype.once=function(s,e){function t(){this.off(s,t),e.apply(this,arguments)}return t.fn=e,this.on(s,t),this};U.prototype.off=U.prototype.removeListener=U.prototype.removeAllListeners=U.prototype.removeEventListener=function(s,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+s];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var r,n=0;n<t.length;n++)if(r=t[n],r===e||r.fn===e){t.splice(n,1);break}return t.length===0&&delete this._callbacks["$"+s],this};U.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+s],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,n=t.length;r<n;++r)t[r].apply(this,e)}return this};U.prototype.emitReserved=U.prototype.emit;U.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]};U.prototype.hasListeners=function(s){return!!this.listeners(s).length}});var ur=x((tf,lr)=>{var ke=1e3,Oe=ke*60,Te=Oe*60,de=Te*24,Ai=de*7,Li=de*365.25;lr.exports=function(s,e){e=e||{};var t=typeof s;if(t==="string"&&s.length>0)return Bi(s);if(t==="number"&&isFinite(s))return e.long?Di(s):Pi(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};function Bi(s){if(s=String(s),!(s.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Li;case"weeks":case"week":case"w":return t*Ai;case"days":case"day":case"d":return t*de;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Te;case"minutes":case"minute":case"mins":case"min":case"m":return t*Oe;case"seconds":case"second":case"secs":case"sec":case"s":return t*ke;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Pi(s){var e=Math.abs(s);return e>=de?Math.round(s/de)+"d":e>=Te?Math.round(s/Te)+"h":e>=Oe?Math.round(s/Oe)+"m":e>=ke?Math.round(s/ke)+"s":s+"ms"}function Di(s){var e=Math.abs(s);return e>=de?wt(s,e,de,"day"):e>=Te?wt(s,e,Te,"hour"):e>=Oe?wt(s,e,Oe,"minute"):e>=ke?wt(s,e,ke,"second"):s+" ms"}function wt(s,e,t,r){var n=e>=t*1.5;return Math.round(s/t)+" "+r+(n?"s":"")}});var fs=x((sf,dr)=>{function Ii(s){t.debug=t,t.default=t,t.coerce=l,t.disable=o,t.enable=n,t.enabled=f,t.humanize=ur(),t.destroy=u,Object.keys(s).forEach(a=>{t[a]=s[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let c=0;for(let h=0;h<a.length;h++)c=(c<<5)-c+a.charCodeAt(h),c|=0;return t.colors[Math.abs(c)%t.colors.length]}t.selectColor=e;function t(a){let c,h=null,p,_;function d(...g){if(!d.enabled)return;let E=d,w=Number(new Date),m=w-(c||w);E.diff=m,E.prev=c,E.curr=w,c=w,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let y=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(S,B)=>{if(S==="%%")return"%";y++;let D=t.formatters[B];if(typeof D=="function"){let z=g[y];S=D.call(E,z),g.splice(y,1),y--}return S}),t.formatArgs.call(E,g),(E.log||t.log).apply(E,g)}return d.namespace=a,d.useColors=t.useColors(),d.color=t.selectColor(a),d.extend=r,d.destroy=t.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==t.namespaces&&(p=t.namespaces,_=t.enabled(a)),_),set:g=>{h=g}}),typeof t.init=="function"&&t.init(d),d}function r(a,c){let h=t(this.namespace+(typeof c>"u"?":":c)+a);return h.log=this.log,h}function n(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let c=(typeof a=="string"?a:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of c)h[0]==="-"?t.skips.push(h.slice(1)):t.names.push(h)}function i(a,c){let h=0,p=0,_=-1,d=0;for(;h<a.length;)if(p<c.length&&(c[p]===a[h]||c[p]==="*"))c[p]==="*"?(_=p,d=h,p++):(h++,p++);else if(_!==-1)p=_+1,d++,h=d;else return!1;for(;p<c.length&&c[p]==="*";)p++;return p===c.length}function o(){let a=[...t.names,...t.skips.map(c=>"-"+c)].join(",");return t.enable(""),a}function f(a){for(let c of t.skips)if(i(a,c))return!1;for(let c of t.names)if(i(a,c))return!0;return!1}function l(a){return a instanceof Error?a.stack||a.message:a}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}dr.exports=Ii});var pr=x((M,xt)=>{M.formatArgs=qi;M.save=Mi;M.load=Wi;M.useColors=Ui;M.storage=ji();M.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();M.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ui(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let s;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(s=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(s[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function qi(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+xt.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;s.splice(1,0,e,"color: inherit");let t=0,r=0;s[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),s.splice(r,0,e)}M.log=console.debug||console.log||(()=>{});function Mi(s){try{s?M.storage.setItem("debug",s):M.storage.removeItem("debug")}catch{}}function Wi(){let s;try{s=M.storage.getItem("debug")||M.storage.getItem("DEBUG")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function ji(){try{return localStorage}catch{}}xt.exports=fs()(M);var{formatters:Vi}=xt.exports;Vi.j=function(s){try{return JSON.stringify(s)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var gr=x((N,St)=>{var $i=b("tty"),vt=b("util");N.init=Ki;N.log=Xi;N.formatArgs=Hi;N.save=Yi;N.load=Ji;N.useColors=Gi;N.destroy=vt.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");N.colors=[6,2,3,4,5,1];try{let s=b("supports-color");s&&(s.stderr||s).level>=2&&(N.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}N.inspectOpts=Object.keys(process.env).filter(s=>/^debug_/i.test(s)).reduce((s,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,i)=>i.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),s[t]=r,s},{});function Gi(){return"colors"in N.inspectOpts?!!N.inspectOpts.colors:$i.isatty(process.stderr.fd)}function Hi(s){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),i=` ${n};1m${e} \x1B[0m`;s[0]=i+s[0].split(`
|
|
4
|
+
`).join(`
|
|
5
|
+
`+i),s.push(n+"m+"+St.exports.humanize(this.diff)+"\x1B[0m")}else s[0]=zi()+e+" "+s[0]}function zi(){return N.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Xi(...s){return process.stderr.write(vt.formatWithOptions(N.inspectOpts,...s)+`
|
|
6
|
+
`)}function Yi(s){s?process.env.DEBUG=s:delete process.env.DEBUG}function Ji(){return process.env.DEBUG}function Ki(s){s.inspectOpts={};let e=Object.keys(N.inspectOpts);for(let t=0;t<e.length;t++)s.inspectOpts[e[t]]=N.inspectOpts[e[t]]}St.exports=fs()(N);var{formatters:mr}=St.exports;mr.o=function(s){return this.inspectOpts.colors=this.useColors,vt.inspect(s,this.inspectOpts).split(`
|
|
7
|
+
`).map(e=>e.trim()).join(" ")};mr.O=function(s){return this.inspectOpts.colors=this.useColors,vt.inspect(s,this.inspectOpts)}});var pe=x((rf,hs)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?hs.exports=pr():hs.exports=gr()});var re=x((wf,Or)=>{"use strict";var Sr=["nodebuffer","arraybuffer","fragments"],kr=typeof Blob<"u";kr&&Sr.push("blob");Or.exports={BINARY_TYPES:Sr,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:kr,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var st=x((xf,Tt)=>{"use strict";var{EMPTY_BUFFER:so}=re(),ds=Buffer[Symbol.species];function ro(s,e){if(s.length===0)return so;if(s.length===1)return s[0];let t=Buffer.allocUnsafe(e),r=0;for(let n=0;n<s.length;n++){let i=s[n];t.set(i,r),r+=i.length}return r<e?new ds(t.buffer,t.byteOffset,r):t}function Tr(s,e,t,r,n){for(let i=0;i<n;i++)t[r+i]=s[i]^e[i&3]}function Fr(s,e){for(let t=0;t<s.length;t++)s[t]^=e[t&3]}function no(s){return s.length===s.buffer.byteLength?s.buffer:s.buffer.slice(s.byteOffset,s.byteOffset+s.length)}function ps(s){if(ps.readOnly=!0,Buffer.isBuffer(s))return s;let e;return s instanceof ArrayBuffer?e=new ds(s):ArrayBuffer.isView(s)?e=new ds(s.buffer,s.byteOffset,s.byteLength):(e=Buffer.from(s),ps.readOnly=!1),e}Tt.exports={concat:ro,mask:Tr,toArrayBuffer:no,toBuffer:ps,unmask:Fr};if(!process.env.WS_NO_BUFFER_UTIL)try{let s=b("bufferutil");Tt.exports.mask=function(e,t,r,n,i){i<48?Tr(e,t,r,n,i):s.mask(e,t,r,n,i)},Tt.exports.unmask=function(e,t){e.length<32?Fr(e,t):s.unmask(e,t)}}catch{}});var Ar=x((vf,Rr)=>{"use strict";var Nr=Symbol("kDone"),ms=Symbol("kRun"),gs=class{constructor(e){this[Nr]=()=>{this.pending--,this[ms]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ms]()}[ms](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Nr])}}};Rr.exports=gs});var nt=x((Sf,Dr)=>{"use strict";var rt=b("zlib"),Lr=st(),io=Ar(),{kStatusCode:Br}=re(),oo=Buffer[Symbol.species],ao=Buffer.from([0,0,255,255]),Nt=Symbol("permessage-deflate"),ne=Symbol("total-length"),Ne=Symbol("callback"),ce=Symbol("buffers"),Re=Symbol("error"),Ft,ys=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,!Ft){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Ft=new io(n)}}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[Ne];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(n=>!(t.serverNoContextTakeover===!1&&n.server_no_context_takeover||n.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>n.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!n.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 n=t[r];if(n.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(n=n[0],r==="client_max_window_bits"){if(n!==!0){let i=+n;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${r}": ${n}`);n=i}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${n}`)}else if(r==="server_max_window_bits"){let i=+n;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${r}": ${n}`);n=i}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(n!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${n}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=n})}),e}decompress(e,t,r){Ft.add(n=>{this._decompress(e,t,(i,o)=>{n(),r(i,o)})})}compress(e,t,r){Ft.add(n=>{this._compress(e,t,(i,o)=>{n(),r(i,o)})})}_decompress(e,t,r){let n=this._isServer?"client":"server";if(!this._inflate){let i=`${n}_max_window_bits`,o=typeof this.params[i]!="number"?rt.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=rt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[Nt]=this,this._inflate[ne]=0,this._inflate[ce]=[],this._inflate.on("error",fo),this._inflate.on("data",Pr)}this._inflate[Ne]=r,this._inflate.write(e),t&&this._inflate.write(ao),this._inflate.flush(()=>{let i=this._inflate[Re];if(i){this._inflate.close(),this._inflate=null,r(i);return}let o=Lr.concat(this._inflate[ce],this._inflate[ne]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ne]=0,this._inflate[ce]=[],t&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let n=this._isServer?"server":"client";if(!this._deflate){let i=`${n}_max_window_bits`,o=typeof this.params[i]!="number"?rt.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=rt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[ne]=0,this._deflate[ce]=[],this._deflate.on("data",co)}this._deflate[Ne]=r,this._deflate.write(e),this._deflate.flush(rt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=Lr.concat(this._deflate[ce],this._deflate[ne]);t&&(i=new oo(i.buffer,i.byteOffset,i.length-4)),this._deflate[Ne]=null,this._deflate[ne]=0,this._deflate[ce]=[],t&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),r(null,i)})}};Dr.exports=ys;function co(s){this[ce].push(s),this[ne]+=s.length}function Pr(s){if(this[ne]+=s.length,this[Nt]._maxPayload<1||this[ne]<=this[Nt]._maxPayload){this[ce].push(s);return}this[Re]=new RangeError("Max payload size exceeded"),this[Re].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Re][Br]=1009,this.removeListener("data",Pr),this.reset()}function fo(s){if(this[Nt]._inflate=null,this[Re]){this[Ne](this[Re]);return}s[Br]=1007,this[Ne](s)}});var Ae=x((kf,Rt)=>{"use strict";var{isUtf8:Ir}=b("buffer"),{hasBlob:ho}=re(),lo=[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 uo(s){return s>=1e3&&s<=1014&&s!==1004&&s!==1005&&s!==1006||s>=3e3&&s<=4999}function _s(s){let e=s.length,t=0;for(;t<e;)if((s[t]&128)===0)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}function po(s){return ho&&typeof s=="object"&&typeof s.arrayBuffer=="function"&&typeof s.type=="string"&&typeof s.stream=="function"&&(s[Symbol.toStringTag]==="Blob"||s[Symbol.toStringTag]==="File")}Rt.exports={isBlob:po,isValidStatusCode:uo,isValidUTF8:_s,tokenChars:lo};if(Ir)Rt.exports.isValidUTF8=function(s){return s.length<24?_s(s):Ir(s)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let s=b("utf-8-validate");Rt.exports.isValidUTF8=function(e){return e.length<32?_s(e):s(e)}}catch{}});var xs=x((Of,$r)=>{"use strict";var{Writable:mo}=b("stream"),Ur=nt(),{BINARY_TYPES:go,EMPTY_BUFFER:qr,kStatusCode:yo,kWebSocket:_o}=re(),{concat:Cs,toArrayBuffer:Co,unmask:bo}=st(),{isValidStatusCode:Eo,isValidUTF8:Mr}=Ae(),At=Buffer[Symbol.species],G=0,Wr=1,jr=2,Vr=3,bs=4,Es=5,Lt=6,ws=class extends mo{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||go[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[_o]=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=G}_write(e,t,r){if(this._opcode===8&&this._state==G)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 At(r.buffer,r.byteOffset+e,r.length-e),new At(r.buffer,r.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let r=this._buffers[0],n=t.length-e;e>=r.length?t.set(this._buffers.shift(),n):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),n),this._buffers[0]=new At(r.buffer,r.byteOffset+e,r.length-e)),e-=r.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case G:this.getInfo(e);break;case Wr:this.getPayloadLength16(e);break;case jr:this.getPayloadLength64(e);break;case Vr:this.getMask();break;case bs:this.getData(e);break;case Es:case Lt:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((t[0]&48)!==0){let n=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(n);return}let r=(t[0]&64)===64;if(r&&!this._extensions[Ur.extensionName]){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(this._fin=(t[0]&128)===128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(r){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(!this._fragmented){let n=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}this._compressed=r}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let n=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(n);return}if(r){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let n=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(n);return}}else{let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)===128,this._isServer){if(!this._masked){let n=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(n);return}}else if(this._masked){let n=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(n);return}this._payloadLength===126?this._state=Wr:this._payloadLength===127?this._state=jr:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),r=t.readUInt32BE(0);if(r>Math.pow(2,21)-1){let n=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(n);return}this._payloadLength=r*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)){let t=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}this._masked?this._state=Vr:this._state=bs}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=bs}getData(e){let t=qr;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])!==0&&bo(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=Es,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[Ur.extensionName].decompress(e,this._fin,(n,i)=>{if(n)return t(n);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(o);return}this._fragments.push(i)}this.dataMessage(t),this._state===G&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=G;return}let t=this._messageLength,r=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let n;this._binaryType==="nodebuffer"?n=Cs(r,t):this._binaryType==="arraybuffer"?n=Co(Cs(r,t)):this._binaryType==="blob"?n=new Blob(r):n=r,this._allowSynchronousEvents?(this.emit("message",n,!0),this._state=G):(this._state=Lt,setImmediate(()=>{this.emit("message",n,!0),this._state=G,this.startLoop(e)}))}else{let n=Cs(r,t);if(!this._skipUTF8Validation&&!Mr(n)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(i);return}this._state===Es||this._allowSynchronousEvents?(this.emit("message",n,!1),this._state=G):(this._state=Lt,setImmediate(()=>{this.emit("message",n,!1),this._state=G,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,qr),this.end();else{let r=e.readUInt16BE(0);if(!Eo(r)){let i=this.createError(RangeError,`invalid status code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");t(i);return}let n=new At(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Mr(n)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(i);return}this._loop=!1,this.emit("conclude",r,n),this.end()}this._state=G;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=G):(this._state=Lt,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=G,this.startLoop(t)}))}createError(e,t,r,n,i){this._loop=!1,this._errored=!0;let o=new e(r?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=i,o[yo]=n,o}};$r.exports=ws});var ks=x((Ff,zr)=>{"use strict";var{Duplex:Tf}=b("stream"),{randomFillSync:wo}=b("crypto"),Gr=nt(),{EMPTY_BUFFER:xo,kWebSocket:vo,NOOP:So}=re(),{isBlob:Le,isValidStatusCode:ko}=Ae(),{mask:Hr,toBuffer:me}=st(),H=Symbol("kByteLength"),Oo=Buffer.alloc(4),Bt=8*1024,ge,Be=Bt,J=0,To=1,Fo=2,vs=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._queue=[],this._state=J,this.onerror=So,this[vo]=void 0}static frame(e,t){let r,n=!1,i=2,o=!1;t.mask&&(r=t.maskBuffer||Oo,t.generateMask?t.generateMask(r):(Be===Bt&&(ge===void 0&&(ge=Buffer.alloc(Bt)),wo(ge,0,Bt),Be=0),r[0]=ge[Be++],r[1]=ge[Be++],r[2]=ge[Be++],r[3]=ge[Be++]),o=(r[0]|r[1]|r[2]|r[3])===0,i=6);let f;typeof e=="string"?(!t.mask||o)&&t[H]!==void 0?f=t[H]:(e=Buffer.from(e),f=e.length):(f=e.length,n=t.mask&&t.readOnly&&!o);let l=f;f>=65536?(i+=8,l=127):f>125&&(i+=2,l=126);let u=Buffer.allocUnsafe(n?f+i:i);return u[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(u[0]|=64),u[1]=l,l===126?u.writeUInt16BE(f,2):l===127&&(u[2]=u[3]=0,u.writeUIntBE(f,4,6)),t.mask?(u[1]|=128,u[i-4]=r[0],u[i-3]=r[1],u[i-2]=r[2],u[i-1]=r[3],o?[u,e]:n?(Hr(e,r,u,i,f),[u]):(Hr(e,r,e,0,f),[u,e])):[u,e]}close(e,t,r,n){let i;if(e===void 0)i=xo;else{if(typeof e!="number"||!ko(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)i=Buffer.allocUnsafe(2),i.writeUInt16BE(e,0);else{let f=Buffer.byteLength(t);if(f>123)throw new RangeError("The message must not be greater than 123 bytes");i=Buffer.allocUnsafe(2+f),i.writeUInt16BE(e,0),typeof t=="string"?i.write(t,2):i.set(t,2)}}let o={[H]:i.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==J?this.enqueue([this.dispatch,i,!1,o,n]):this.sendFrame(s.frame(i,o),n)}ping(e,t,r){let n,i;if(typeof e=="string"?(n=Buffer.byteLength(e),i=!1):Le(e)?(n=e.size,i=!1):(e=me(e),n=e.length,i=me.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[H]:n,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};Le(e)?this._state!==J?this.enqueue([this.getBlobData,e,!1,o,r]):this.getBlobData(e,!1,o,r):this._state!==J?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(s.frame(e,o),r)}pong(e,t,r){let n,i;if(typeof e=="string"?(n=Buffer.byteLength(e),i=!1):Le(e)?(n=e.size,i=!1):(e=me(e),n=e.length,i=me.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[H]:n,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};Le(e)?this._state!==J?this.enqueue([this.getBlobData,e,!1,o,r]):this.getBlobData(e,!1,o,r):this._state!==J?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(s.frame(e,o),r)}send(e,t,r){let n=this._extensions[Gr.extensionName],i=t.binary?2:1,o=t.compress,f,l;typeof e=="string"?(f=Buffer.byteLength(e),l=!1):Le(e)?(f=e.size,l=!1):(e=me(e),f=e.length,l=me.readOnly),this._firstFragment?(this._firstFragment=!1,o&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=f>=n._threshold),this._compress=o):(o=!1,i=0),t.fin&&(this._firstFragment=!0);let u={[H]:f,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:l,rsv1:o};Le(e)?this._state!==J?this.enqueue([this.getBlobData,e,this._compress,u,r]):this.getBlobData(e,this._compress,u,r):this._state!==J?this.enqueue([this.dispatch,e,this._compress,u,r]):this.dispatch(e,this._compress,u,r)}getBlobData(e,t,r,n){this._bufferedBytes+=r[H],this._state=Fo,e.arrayBuffer().then(i=>{if(this._socket.destroyed){let f=new Error("The socket was closed while the blob was being read");process.nextTick(Ss,this,f,n);return}this._bufferedBytes-=r[H];let o=me(i);t?this.dispatch(o,t,r,n):(this._state=J,this.sendFrame(s.frame(o,r),n),this.dequeue())}).catch(i=>{process.nextTick(No,this,i,n)})}dispatch(e,t,r,n){if(!t){this.sendFrame(s.frame(e,r),n);return}let i=this._extensions[Gr.extensionName];this._bufferedBytes+=r[H],this._state=To,i.compress(e,r.fin,(o,f)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");Ss(this,l,n);return}this._bufferedBytes-=r[H],this._state=J,r.readOnly=!1,this.sendFrame(s.frame(f,r),n),this.dequeue()})}dequeue(){for(;this._state===J&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][H],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][H],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)}};zr.exports=vs;function Ss(s,e,t){typeof t=="function"&&t(e);for(let r=0;r<s._queue.length;r++){let n=s._queue[r],i=n[n.length-1];typeof i=="function"&&i(e)}}function No(s,e,t){Ss(s,e,t),s.onerror(e)}});var sn=x((Nf,tn)=>{"use strict";var{kForOnEventAttribute:it,kListener:Os}=re(),Xr=Symbol("kCode"),Yr=Symbol("kData"),Jr=Symbol("kError"),Kr=Symbol("kMessage"),Qr=Symbol("kReason"),Pe=Symbol("kTarget"),Zr=Symbol("kType"),en=Symbol("kWasClean"),ie=class{constructor(e){this[Pe]=null,this[Zr]=e}get target(){return this[Pe]}get type(){return this[Zr]}};Object.defineProperty(ie.prototype,"target",{enumerable:!0});Object.defineProperty(ie.prototype,"type",{enumerable:!0});var ye=class extends ie{constructor(e,t={}){super(e),this[Xr]=t.code===void 0?0:t.code,this[Qr]=t.reason===void 0?"":t.reason,this[en]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[Xr]}get reason(){return this[Qr]}get wasClean(){return this[en]}};Object.defineProperty(ye.prototype,"code",{enumerable:!0});Object.defineProperty(ye.prototype,"reason",{enumerable:!0});Object.defineProperty(ye.prototype,"wasClean",{enumerable:!0});var De=class extends ie{constructor(e,t={}){super(e),this[Jr]=t.error===void 0?null:t.error,this[Kr]=t.message===void 0?"":t.message}get error(){return this[Jr]}get message(){return this[Kr]}};Object.defineProperty(De.prototype,"error",{enumerable:!0});Object.defineProperty(De.prototype,"message",{enumerable:!0});var ot=class extends ie{constructor(e,t={}){super(e),this[Yr]=t.data===void 0?null:t.data}get data(){return this[Yr]}};Object.defineProperty(ot.prototype,"data",{enumerable:!0});var Ro={addEventListener(s,e,t={}){for(let n of this.listeners(s))if(!t[it]&&n[Os]===e&&!n[it])return;let r;if(s==="message")r=function(i,o){let f=new ot("message",{data:o?i:i.toString()});f[Pe]=this,Pt(e,this,f)};else if(s==="close")r=function(i,o){let f=new ye("close",{code:i,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});f[Pe]=this,Pt(e,this,f)};else if(s==="error")r=function(i){let o=new De("error",{error:i,message:i.message});o[Pe]=this,Pt(e,this,o)};else if(s==="open")r=function(){let i=new ie("open");i[Pe]=this,Pt(e,this,i)};else return;r[it]=!!t[it],r[Os]=e,t.once?this.once(s,r):this.on(s,r)},removeEventListener(s,e){for(let t of this.listeners(s))if(t[Os]===e&&!t[it]){this.removeListener(s,t);break}}};tn.exports={CloseEvent:ye,ErrorEvent:De,Event:ie,EventTarget:Ro,MessageEvent:ot};function Pt(s,e,t){typeof s=="object"&&s.handleEvent?s.handleEvent.call(s,t):s.call(e,t)}});var Ts=x((Rf,rn)=>{"use strict";var{tokenChars:at}=Ae();function Q(s,e,t){s[e]===void 0?s[e]=[t]:s[e].push(t)}function Ao(s){let e=Object.create(null),t=Object.create(null),r=!1,n=!1,i=!1,o,f,l=-1,u=-1,a=-1,c=0;for(;c<s.length;c++)if(u=s.charCodeAt(c),o===void 0)if(a===-1&&at[u]===1)l===-1&&(l=c);else if(c!==0&&(u===32||u===9))a===-1&&l!==-1&&(a=c);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);a===-1&&(a=c);let p=s.slice(l,a);u===44?(Q(e,p,t),t=Object.create(null)):o=p,l=a=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);else if(f===void 0)if(a===-1&&at[u]===1)l===-1&&(l=c);else if(u===32||u===9)a===-1&&l!==-1&&(a=c);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);a===-1&&(a=c),Q(t,s.slice(l,a),!0),u===44&&(Q(e,o,t),t=Object.create(null),o=void 0),l=a=-1}else if(u===61&&l!==-1&&a===-1)f=s.slice(l,c),l=a=-1;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(n){if(at[u]!==1)throw new SyntaxError(`Unexpected character at index ${c}`);l===-1?l=c:r||(r=!0),n=!1}else if(i)if(at[u]===1)l===-1&&(l=c);else if(u===34&&l!==-1)i=!1,a=c;else if(u===92)n=!0;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(u===34&&s.charCodeAt(c-1)===61)i=!0;else if(a===-1&&at[u]===1)l===-1&&(l=c);else if(l!==-1&&(u===32||u===9))a===-1&&(a=c);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);a===-1&&(a=c);let p=s.slice(l,a);r&&(p=p.replace(/\\/g,""),r=!1),Q(t,f,p),u===44&&(Q(e,o,t),t=Object.create(null),o=void 0),f=void 0,l=a=-1}else throw new SyntaxError(`Unexpected character at index ${c}`);if(l===-1||i||u===32||u===9)throw new SyntaxError("Unexpected end of input");a===-1&&(a=c);let h=s.slice(l,a);return o===void 0?Q(e,h,t):(f===void 0?Q(t,h,!0):r?Q(t,f,h.replace(/\\/g,"")):Q(t,f,h),Q(e,o,t)),e}function Lo(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(n=>{let i=r[n];return Array.isArray(i)||(i=[i]),i.map(o=>o===!0?n:`${n}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}rn.exports={format:Lo,parse:Ao}});var qt=x((Bf,gn)=>{"use strict";var Bo=b("events"),Po=b("https"),Do=b("http"),an=b("net"),Io=b("tls"),{randomBytes:Uo,createHash:qo}=b("crypto"),{Duplex:Af,Readable:Lf}=b("stream"),{URL:Fs}=b("url"),fe=nt(),Mo=xs(),Wo=ks(),{isBlob:jo}=Ae(),{BINARY_TYPES:nn,EMPTY_BUFFER:Dt,GUID:Vo,kForOnEventAttribute:Ns,kListener:$o,kStatusCode:Go,kWebSocket:R,NOOP:cn}=re(),{EventTarget:{addEventListener:Ho,removeEventListener:zo}}=sn(),{format:Xo,parse:Yo}=Ts(),{toBuffer:Jo}=st(),Ko=30*1e3,fn=Symbol("kAborted"),Rs=[8,13],oe=["CONNECTING","OPEN","CLOSING","CLOSED"],Qo=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,k=class s extends Bo{constructor(e,t,r){super(),this._binaryType=nn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Dt,this._closeTimer=null,this._errorEmitted=!1,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]),hn(this,e,t,r)):(this._autoPong=r.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){nn.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 n=new Mo({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),i=new Wo(e,this._extensions,r.generateMask);this._receiver=n,this._sender=i,this._socket=e,n[R]=this,i[R]=this,e[R]=this,n.on("conclude",ta),n.on("drain",sa),n.on("error",ra),n.on("message",na),n.on("ping",ia),n.on("pong",oa),i.onerror=aa,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",dn),e.on("data",Ut),e.on("end",pn),e.on("error",mn),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[fe.extensionName]&&this._extensions[fe.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){V(this,this._req,"WebSocket was closed before the connection was established");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())}),un(this)}}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){As(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||Dt,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){As(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||Dt,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){As(this,e,r);return}let n={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[fe.extensionName]||(n.compress=!1),this._sender.send(e||Dt,n,r)}terminate(){if(this.readyState!==s.CLOSED){if(this.readyState===s.CONNECTING){V(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=s.CLOSING,this._socket.destroy())}}};Object.defineProperty(k,"CONNECTING",{enumerable:!0,value:oe.indexOf("CONNECTING")});Object.defineProperty(k.prototype,"CONNECTING",{enumerable:!0,value:oe.indexOf("CONNECTING")});Object.defineProperty(k,"OPEN",{enumerable:!0,value:oe.indexOf("OPEN")});Object.defineProperty(k.prototype,"OPEN",{enumerable:!0,value:oe.indexOf("OPEN")});Object.defineProperty(k,"CLOSING",{enumerable:!0,value:oe.indexOf("CLOSING")});Object.defineProperty(k.prototype,"CLOSING",{enumerable:!0,value:oe.indexOf("CLOSING")});Object.defineProperty(k,"CLOSED",{enumerable:!0,value:oe.indexOf("CLOSED")});Object.defineProperty(k.prototype,"CLOSED",{enumerable:!0,value:oe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(s=>{Object.defineProperty(k.prototype,s,{enumerable:!0})});["open","error","close","message"].forEach(s=>{Object.defineProperty(k.prototype,`on${s}`,{enumerable:!0,get(){for(let e of this.listeners(s))if(e[Ns])return e[$o];return null},set(e){for(let t of this.listeners(s))if(t[Ns]){this.removeListener(s,t);break}typeof e=="function"&&this.addEventListener(s,e,{[Ns]:!0})}})});k.prototype.addEventListener=Ho;k.prototype.removeEventListener=zo;gn.exports=k;function hn(s,e,t,r){let n={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Rs[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(s._autoPong=n.autoPong,!Rs.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${Rs.join(", ")})`);let i;if(e instanceof Fs)i=e;else try{i=new Fs(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}i.protocol==="http:"?i.protocol="ws:":i.protocol==="https:"&&(i.protocol="wss:"),s._url=i.href;let o=i.protocol==="wss:",f=i.protocol==="ws+unix:",l;if(i.protocol!=="ws:"&&!o&&!f?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:f&&!i.pathname?l="The URL's pathname is empty":i.hash&&(l="The URL contains a fragment identifier"),l){let d=new SyntaxError(l);if(s._redirects===0)throw d;It(s,d);return}let u=o?443:80,a=Uo(16).toString("base64"),c=o?Po.request:Do.request,h=new Set,p;if(n.createConnection=n.createConnection||(o?ea:Zo),n.defaultPort=n.defaultPort||u,n.port=i.port||u,n.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,n.headers={...n.headers,"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":a,Connection:"Upgrade",Upgrade:"websocket"},n.path=i.pathname+i.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(p=new fe(n.perMessageDeflate!==!0?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=Xo({[fe.extensionName]:p.offer()})),t.length){for(let d of t){if(typeof d!="string"||!Qo.test(d)||h.has(d))throw new SyntaxError("An invalid or duplicated subprotocol was specified");h.add(d)}n.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(n.origin&&(n.protocolVersion<13?n.headers["Sec-WebSocket-Origin"]=n.origin:n.headers.Origin=n.origin),(i.username||i.password)&&(n.auth=`${i.username}:${i.password}`),f){let d=n.path.split(":");n.socketPath=d[0],n.path=d[1]}let _;if(n.followRedirects){if(s._redirects===0){s._originalIpc=f,s._originalSecure=o,s._originalHostOrSocketPath=f?n.socketPath:i.host;let d=r&&r.headers;if(r={...r,headers:{}},d)for(let[g,E]of Object.entries(d))r.headers[g.toLowerCase()]=E}else if(s.listenerCount("redirect")===0){let d=f?s._originalIpc?n.socketPath===s._originalHostOrSocketPath:!1:s._originalIpc?!1:i.host===s._originalHostOrSocketPath;(!d||s._originalSecure&&!o)&&(delete n.headers.authorization,delete n.headers.cookie,d||delete n.headers.host,n.auth=void 0)}n.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),_=s._req=c(n),s._redirects&&s.emit("redirect",s.url,_)}else _=s._req=c(n);n.timeout&&_.on("timeout",()=>{V(s,_,"Opening handshake has timed out")}),_.on("error",d=>{_===null||_[fn]||(_=s._req=null,It(s,d))}),_.on("response",d=>{let g=d.headers.location,E=d.statusCode;if(g&&n.followRedirects&&E>=300&&E<400){if(++s._redirects>n.maxRedirects){V(s,_,"Maximum redirects exceeded");return}_.abort();let w;try{w=new Fs(g,e)}catch{let y=new SyntaxError(`Invalid URL: ${g}`);It(s,y);return}hn(s,w,t,r)}else s.emit("unexpected-response",_,d)||V(s,_,`Unexpected server response: ${d.statusCode}`)}),_.on("upgrade",(d,g,E)=>{if(s.emit("upgrade",d),s.readyState!==k.CONNECTING)return;_=s._req=null;let w=d.headers.upgrade;if(w===void 0||w.toLowerCase()!=="websocket"){V(s,g,"Invalid Upgrade header");return}let m=qo("sha1").update(a+Vo).digest("base64");if(d.headers["sec-websocket-accept"]!==m){V(s,g,"Invalid Sec-WebSocket-Accept header");return}let y=d.headers["sec-websocket-protocol"],F;if(y!==void 0?h.size?h.has(y)||(F="Server sent an invalid subprotocol"):F="Server sent a subprotocol but none was requested":h.size&&(F="Server sent no subprotocol"),F){V(s,g,F);return}y&&(s._protocol=y);let S=d.headers["sec-websocket-extensions"];if(S!==void 0){if(!p){V(s,g,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let B;try{B=Yo(S)}catch{V(s,g,"Invalid Sec-WebSocket-Extensions header");return}let D=Object.keys(B);if(D.length!==1||D[0]!==fe.extensionName){V(s,g,"Server indicated an extension that was not requested");return}try{p.accept(B[fe.extensionName])}catch{V(s,g,"Invalid Sec-WebSocket-Extensions header");return}s._extensions[fe.extensionName]=p}s.setSocket(g,E,{allowSynchronousEvents:n.allowSynchronousEvents,generateMask:n.generateMask,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})}),n.finishRequest?n.finishRequest(_,s):_.end()}function It(s,e){s._readyState=k.CLOSING,s._errorEmitted=!0,s.emit("error",e),s.emitClose()}function Zo(s){return s.path=s.socketPath,an.connect(s)}function ea(s){return s.path=void 0,!s.servername&&s.servername!==""&&(s.servername=an.isIP(s.host)?"":s.host),Io.connect(s)}function V(s,e,t){s._readyState=k.CLOSING;let r=new Error(t);Error.captureStackTrace(r,V),e.setHeader?(e[fn]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(It,s,r)):(e.destroy(r),e.once("error",s.emit.bind(s,"error")),e.once("close",s.emitClose.bind(s)))}function As(s,e,t){if(e){let r=jo(e)?e.size:Jo(e).length;s._socket?s._sender._bufferedBytes+=r:s._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${s.readyState} (${oe[s.readyState]})`);process.nextTick(t,r)}}function ta(s,e){let t=this[R];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=s,t._socket[R]!==void 0&&(t._socket.removeListener("data",Ut),process.nextTick(ln,t._socket),s===1005?t.close():t.close(s,e))}function sa(){let s=this[R];s.isPaused||s._socket.resume()}function ra(s){let e=this[R];e._socket[R]!==void 0&&(e._socket.removeListener("data",Ut),process.nextTick(ln,e._socket),e.close(s[Go])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",s))}function on(){this[R].emitClose()}function na(s,e){this[R].emit("message",s,e)}function ia(s){let e=this[R];e._autoPong&&e.pong(s,!this._isServer,cn),e.emit("ping",s)}function oa(s){this[R].emit("pong",s)}function ln(s){s.resume()}function aa(s){let e=this[R];e.readyState!==k.CLOSED&&(e.readyState===k.OPEN&&(e._readyState=k.CLOSING,un(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",s)))}function un(s){s._closeTimer=setTimeout(s._socket.destroy.bind(s._socket),Ko)}function dn(){let s=this[R];this.removeListener("close",dn),this.removeListener("data",Ut),this.removeListener("end",pn),s._readyState=k.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[R]=void 0,clearTimeout(s._closeTimer),s._receiver._writableState.finished||s._receiver._writableState.errorEmitted?s.emitClose():(s._receiver.on("error",on),s._receiver.on("finish",on))}function Ut(s){this[R]._receiver.write(s)||this.pause()}function pn(){let s=this[R];s._readyState=k.CLOSING,s._receiver.end(),this.end()}function mn(){let s=this[R];this.removeListener("error",mn),this.on("error",cn),s&&(s._readyState=k.CLOSING,this.destroy())}});var bn=x((Df,Cn)=>{"use strict";var Pf=qt(),{Duplex:ca}=b("stream");function yn(s){s.emit("close")}function fa(){!this.destroyed&&this._writableState.finished&&this.destroy()}function _n(s){this.removeListener("error",_n),this.destroy(),this.listenerCount("error")===0&&this.emit("error",s)}function ha(s,e){let t=!0,r=new ca({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return s.on("message",function(i,o){let f=!o&&r._readableState.objectMode?i.toString():i;r.push(f)||s.pause()}),s.once("error",function(i){r.destroyed||(t=!1,r.destroy(i))}),s.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(n,i){if(s.readyState===s.CLOSED){i(n),process.nextTick(yn,r);return}let o=!1;s.once("error",function(l){o=!0,i(l)}),s.once("close",function(){o||i(n),process.nextTick(yn,r)}),t&&s.terminate()},r._final=function(n){if(s.readyState===s.CONNECTING){s.once("open",function(){r._final(n)});return}s._socket!==null&&(s._socket._writableState.finished?(n(),r._readableState.endEmitted&&r.destroy()):(s._socket.once("finish",function(){n()}),s.close()))},r._read=function(){s.isPaused&&s.resume()},r._write=function(n,i,o){if(s.readyState===s.CONNECTING){s.once("open",function(){r._write(n,i,o)});return}s.send(n,o)},r.on("end",fa),r.on("error",_n),r}Cn.exports=ha});var wn=x((If,En)=>{"use strict";var{tokenChars:la}=Ae();function ua(s){let e=new Set,t=-1,r=-1,n=0;for(n;n<s.length;n++){let o=s.charCodeAt(n);if(r===-1&&la[o]===1)t===-1&&(t=n);else if(n!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=n);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${n}`);r===-1&&(r=n);let f=s.slice(t,r);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);e.add(f),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${n}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let i=s.slice(t,n);if(e.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);return e.add(i),e}En.exports={parse:ua}});var Fn=x((qf,Tn)=>{"use strict";var da=b("events"),Mt=b("http"),{Duplex:Uf}=b("stream"),{createHash:pa}=b("crypto"),xn=Ts(),_e=nt(),ma=wn(),ga=qt(),{GUID:ya,kWebSocket:_a}=re(),Ca=/^[+/0-9A-Za-z]{22}==$/,vn=0,Sn=1,On=2,Ls=class extends da{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,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:ga,...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=Mt.createServer((r,n)=>{let i=Mt.STATUS_CODES[426];n.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),n.end(i)}),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=ba(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,i,o)=>{this.handleUpgrade(n,i,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=vn}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===On){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(ct,this);return}if(e&&this.once("close",e),this._state!==Sn)if(this._state=Sn,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(ct,this):process.nextTick(ct,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{ct(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,n){t.on("error",kn);let i=e.headers["sec-websocket-key"],o=e.headers.upgrade,f=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Ce(this,e,t,405,"Invalid HTTP method");return}if(o===void 0||o.toLowerCase()!=="websocket"){Ce(this,e,t,400,"Invalid Upgrade header");return}if(i===void 0||!Ca.test(i)){Ce(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(f!==13&&f!==8){Ce(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){ft(t,400);return}let l=e.headers["sec-websocket-protocol"],u=new Set;if(l!==void 0)try{u=ma.parse(l)}catch{Ce(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 _e(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let p=xn.parse(a);p[_e.extensionName]&&(h.accept(p[_e.extensionName]),c[_e.extensionName]=h)}catch{Ce(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${f===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(p,_,d,g)=>{if(!p)return ft(t,_||401,d,g);this.completeUpgrade(c,i,u,e,t,r,n)});return}if(!this.options.verifyClient(h))return ft(t,401)}this.completeUpgrade(c,i,u,e,t,r,n)}completeUpgrade(e,t,r,n,i,o,f){if(!i.readable||!i.writable)return i.destroy();if(i[_a])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>vn)return ft(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${pa("sha1").update(t+ya).digest("base64")}`],a=new this.options.WebSocket(null,void 0,this.options);if(r.size){let c=this.options.handleProtocols?this.options.handleProtocols(r,n):r.values().next().value;c&&(u.push(`Sec-WebSocket-Protocol: ${c}`),a._protocol=c)}if(e[_e.extensionName]){let c=e[_e.extensionName].params,h=xn.format({[_e.extensionName]:[c]});u.push(`Sec-WebSocket-Extensions: ${h}`),a._extensions=e}this.emit("headers",u,n),i.write(u.concat(`\r
|
|
8
|
+
`).join(`\r
|
|
9
|
+
`)),i.removeListener("error",kn),a.setSocket(i,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(a),a.on("close",()=>{this.clients.delete(a),this._shouldEmitClose&&!this.clients.size&&process.nextTick(ct,this)})),f(a,n)}};Tn.exports=Ls;function ba(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 ct(s){s._state=On,s.emit("close")}function kn(){this.destroy()}function ft(s,e,t,r){t=t||Mt.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} ${Mt.STATUS_CODES[e]}\r
|
|
10
|
+
`+Object.keys(r).map(n=>`${n}: ${r[n]}`).join(`\r
|
|
11
|
+
`)+`\r
|
|
12
|
+
\r
|
|
13
|
+
`+t)}function Ce(s,e,t,r,n,i){if(s.listenerCount("wsClientError")){let o=new Error(n);Error.captureStackTrace(o,Ce),s.emit("wsClientError",o,t,e)}else ft(t,r,n,i)}});var Pn=x((Oh,Bn)=>{var We=1e3,je=We*60,Ve=je*60,Ee=Ve*24,Pa=Ee*7,Da=Ee*365.25;Bn.exports=function(s,e){e=e||{};var t=typeof s;if(t==="string"&&s.length>0)return Ia(s);if(t==="number"&&isFinite(s))return e.long?qa(s):Ua(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};function Ia(s){if(s=String(s),!(s.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Da;case"weeks":case"week":case"w":return t*Pa;case"days":case"day":case"d":return t*Ee;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Ve;case"minutes":case"minute":case"mins":case"min":case"m":return t*je;case"seconds":case"second":case"secs":case"sec":case"s":return t*We;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Ua(s){var e=Math.abs(s);return e>=Ee?Math.round(s/Ee)+"d":e>=Ve?Math.round(s/Ve)+"h":e>=je?Math.round(s/je)+"m":e>=We?Math.round(s/We)+"s":s+"ms"}function qa(s){var e=Math.abs(s);return e>=Ee?Vt(s,e,Ee,"day"):e>=Ve?Vt(s,e,Ve,"hour"):e>=je?Vt(s,e,je,"minute"):e>=We?Vt(s,e,We,"second"):s+" ms"}function Vt(s,e,t,r){var n=e>=t*1.5;return Math.round(s/t)+" "+r+(n?"s":"")}});var Is=x((Th,Dn)=>{function Ma(s){t.debug=t,t.default=t,t.coerce=l,t.disable=o,t.enable=n,t.enabled=f,t.humanize=Pn(),t.destroy=u,Object.keys(s).forEach(a=>{t[a]=s[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let c=0;for(let h=0;h<a.length;h++)c=(c<<5)-c+a.charCodeAt(h),c|=0;return t.colors[Math.abs(c)%t.colors.length]}t.selectColor=e;function t(a){let c,h=null,p,_;function d(...g){if(!d.enabled)return;let E=d,w=Number(new Date),m=w-(c||w);E.diff=m,E.prev=c,E.curr=w,c=w,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let y=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(S,B)=>{if(S==="%%")return"%";y++;let D=t.formatters[B];if(typeof D=="function"){let z=g[y];S=D.call(E,z),g.splice(y,1),y--}return S}),t.formatArgs.call(E,g),(E.log||t.log).apply(E,g)}return d.namespace=a,d.useColors=t.useColors(),d.color=t.selectColor(a),d.extend=r,d.destroy=t.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==t.namespaces&&(p=t.namespaces,_=t.enabled(a)),_),set:g=>{h=g}}),typeof t.init=="function"&&t.init(d),d}function r(a,c){let h=t(this.namespace+(typeof c>"u"?":":c)+a);return h.log=this.log,h}function n(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let c=(typeof a=="string"?a:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of c)h[0]==="-"?t.skips.push(h.slice(1)):t.names.push(h)}function i(a,c){let h=0,p=0,_=-1,d=0;for(;h<a.length;)if(p<c.length&&(c[p]===a[h]||c[p]==="*"))c[p]==="*"?(_=p,d=h,p++):(h++,p++);else if(_!==-1)p=_+1,d++,h=d;else return!1;for(;p<c.length&&c[p]==="*";)p++;return p===c.length}function o(){let a=[...t.names,...t.skips.map(c=>"-"+c)].join(",");return t.enable(""),a}function f(a){for(let c of t.skips)if(i(a,c))return!1;for(let c of t.names)if(i(a,c))return!0;return!1}function l(a){return a instanceof Error?a.stack||a.message:a}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Dn.exports=Ma});var In=x((W,$t)=>{W.formatArgs=ja;W.save=Va;W.load=$a;W.useColors=Wa;W.storage=Ga();W.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();W.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Wa(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let s;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(s=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(s[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ja(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+$t.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;s.splice(1,0,e,"color: inherit");let t=0,r=0;s[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),s.splice(r,0,e)}W.log=console.debug||console.log||(()=>{});function Va(s){try{s?W.storage.setItem("debug",s):W.storage.removeItem("debug")}catch{}}function $a(){let s;try{s=W.storage.getItem("debug")||W.storage.getItem("DEBUG")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function Ga(){try{return localStorage}catch{}}$t.exports=Is()(W);var{formatters:Ha}=$t.exports;Ha.j=function(s){try{return JSON.stringify(s)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var qn=x((A,Ht)=>{var za=b("tty"),Gt=b("util");A.init=ec;A.log=Ka;A.formatArgs=Ya;A.save=Qa;A.load=Za;A.useColors=Xa;A.destroy=Gt.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");A.colors=[6,2,3,4,5,1];try{let s=b("supports-color");s&&(s.stderr||s).level>=2&&(A.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}A.inspectOpts=Object.keys(process.env).filter(s=>/^debug_/i.test(s)).reduce((s,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,i)=>i.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),s[t]=r,s},{});function Xa(){return"colors"in A.inspectOpts?!!A.inspectOpts.colors:za.isatty(process.stderr.fd)}function Ya(s){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),i=` ${n};1m${e} \x1B[0m`;s[0]=i+s[0].split(`
|
|
14
|
+
`).join(`
|
|
15
|
+
`+i),s.push(n+"m+"+Ht.exports.humanize(this.diff)+"\x1B[0m")}else s[0]=Ja()+e+" "+s[0]}function Ja(){return A.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ka(...s){return process.stderr.write(Gt.formatWithOptions(A.inspectOpts,...s)+`
|
|
16
|
+
`)}function Qa(s){s?process.env.DEBUG=s:delete process.env.DEBUG}function Za(){return process.env.DEBUG}function ec(s){s.inspectOpts={};let e=Object.keys(A.inspectOpts);for(let t=0;t<e.length;t++)s.inspectOpts[e[t]]=A.inspectOpts[e[t]]}Ht.exports=Is()(A);var{formatters:Un}=Ht.exports;Un.o=function(s){return this.inspectOpts.colors=this.useColors,Gt.inspect(s,this.inspectOpts).split(`
|
|
17
|
+
`).map(e=>e.trim()).join(" ")};Un.O=function(s){return this.inspectOpts.colors=this.useColors,Gt.inspect(s,this.inspectOpts)}});var ut=x((Fh,Us)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Us.exports=In():Us.exports=qn()});var zn=x((Ph,Hn)=>{var $e=1e3,Ge=$e*60,He=Ge*60,we=He*24,ic=we*7,oc=we*365.25;Hn.exports=function(s,e){e=e||{};var t=typeof s;if(t==="string"&&s.length>0)return ac(s);if(t==="number"&&isFinite(s))return e.long?fc(s):cc(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};function ac(s){if(s=String(s),!(s.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*oc;case"weeks":case"week":case"w":return t*ic;case"days":case"day":case"d":return t*we;case"hours":case"hour":case"hrs":case"hr":case"h":return t*He;case"minutes":case"minute":case"mins":case"min":case"m":return t*Ge;case"seconds":case"second":case"secs":case"sec":case"s":return t*$e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function cc(s){var e=Math.abs(s);return e>=we?Math.round(s/we)+"d":e>=He?Math.round(s/He)+"h":e>=Ge?Math.round(s/Ge)+"m":e>=$e?Math.round(s/$e)+"s":s+"ms"}function fc(s){var e=Math.abs(s);return e>=we?zt(s,e,we,"day"):e>=He?zt(s,e,He,"hour"):e>=Ge?zt(s,e,Ge,"minute"):e>=$e?zt(s,e,$e,"second"):s+" ms"}function zt(s,e,t,r){var n=e>=t*1.5;return Math.round(s/t)+" "+r+(n?"s":"")}});var Ws=x((Dh,Xn)=>{function hc(s){t.debug=t,t.default=t,t.coerce=l,t.disable=o,t.enable=n,t.enabled=f,t.humanize=zn(),t.destroy=u,Object.keys(s).forEach(a=>{t[a]=s[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let c=0;for(let h=0;h<a.length;h++)c=(c<<5)-c+a.charCodeAt(h),c|=0;return t.colors[Math.abs(c)%t.colors.length]}t.selectColor=e;function t(a){let c,h=null,p,_;function d(...g){if(!d.enabled)return;let E=d,w=Number(new Date),m=w-(c||w);E.diff=m,E.prev=c,E.curr=w,c=w,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let y=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(S,B)=>{if(S==="%%")return"%";y++;let D=t.formatters[B];if(typeof D=="function"){let z=g[y];S=D.call(E,z),g.splice(y,1),y--}return S}),t.formatArgs.call(E,g),(E.log||t.log).apply(E,g)}return d.namespace=a,d.useColors=t.useColors(),d.color=t.selectColor(a),d.extend=r,d.destroy=t.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==t.namespaces&&(p=t.namespaces,_=t.enabled(a)),_),set:g=>{h=g}}),typeof t.init=="function"&&t.init(d),d}function r(a,c){let h=t(this.namespace+(typeof c>"u"?":":c)+a);return h.log=this.log,h}function n(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let c=(typeof a=="string"?a:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of c)h[0]==="-"?t.skips.push(h.slice(1)):t.names.push(h)}function i(a,c){let h=0,p=0,_=-1,d=0;for(;h<a.length;)if(p<c.length&&(c[p]===a[h]||c[p]==="*"))c[p]==="*"?(_=p,d=h,p++):(h++,p++);else if(_!==-1)p=_+1,d++,h=d;else return!1;for(;p<c.length&&c[p]==="*";)p++;return p===c.length}function o(){let a=[...t.names,...t.skips.map(c=>"-"+c)].join(",");return t.enable(""),a}function f(a){for(let c of t.skips)if(i(a,c))return!1;for(let c of t.names)if(i(a,c))return!0;return!1}function l(a){return a instanceof Error?a.stack||a.message:a}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Xn.exports=hc});var Yn=x((j,Xt)=>{j.formatArgs=uc;j.save=dc;j.load=pc;j.useColors=lc;j.storage=mc();j.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();j.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function lc(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let s;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(s=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(s[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function uc(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+Xt.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;s.splice(1,0,e,"color: inherit");let t=0,r=0;s[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),s.splice(r,0,e)}j.log=console.debug||console.log||(()=>{});function dc(s){try{s?j.storage.setItem("debug",s):j.storage.removeItem("debug")}catch{}}function pc(){let s;try{s=j.storage.getItem("debug")||j.storage.getItem("DEBUG")}catch{}return!s&&typeof process<"u"&&"env"in process&&(s=process.env.DEBUG),s}function mc(){try{return localStorage}catch{}}Xt.exports=Ws()(j);var{formatters:gc}=Xt.exports;gc.j=function(s){try{return JSON.stringify(s)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Kn=x((L,Jt)=>{var yc=b("tty"),Yt=b("util");L.init=vc;L.log=Ec;L.formatArgs=Cc;L.save=wc;L.load=xc;L.useColors=_c;L.destroy=Yt.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");L.colors=[6,2,3,4,5,1];try{let s=b("supports-color");s&&(s.stderr||s).level>=2&&(L.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}L.inspectOpts=Object.keys(process.env).filter(s=>/^debug_/i.test(s)).reduce((s,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,i)=>i.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),s[t]=r,s},{});function _c(){return"colors"in L.inspectOpts?!!L.inspectOpts.colors:yc.isatty(process.stderr.fd)}function Cc(s){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),i=` ${n};1m${e} \x1B[0m`;s[0]=i+s[0].split(`
|
|
18
|
+
`).join(`
|
|
19
|
+
`+i),s.push(n+"m+"+Jt.exports.humanize(this.diff)+"\x1B[0m")}else s[0]=bc()+e+" "+s[0]}function bc(){return L.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ec(...s){return process.stderr.write(Yt.formatWithOptions(L.inspectOpts,...s)+`
|
|
20
|
+
`)}function wc(s){s?process.env.DEBUG=s:delete process.env.DEBUG}function xc(){return process.env.DEBUG}function vc(s){s.inspectOpts={};let e=Object.keys(L.inspectOpts);for(let t=0;t<e.length;t++)s.inspectOpts[e[t]]=L.inspectOpts[e[t]]}Jt.exports=Ws()(L);var{formatters:Jn}=Jt.exports;Jn.o=function(s){return this.inspectOpts.colors=this.useColors,Yt.inspect(s,this.inspectOpts).split(`
|
|
21
|
+
`).map(e=>e.trim()).join(" ")};Jn.O=function(s){return this.inspectOpts.colors=this.useColors,Yt.inspect(s,this.inspectOpts)}});var Qn=x((Ih,js)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?js.exports=Yn():js.exports=Kn()});import{readFileSync as Rc}from"fs";import{join as Ac}from"path";import{homedir as Lc}from"os";import{createInterface as hi}from"readline";var us=O(Js(),1);var X=Object.create(null);X.open="0";X.close="1";X.ping="2";X.pong="3";X.message="4";X.upgrade="5";X.noop="6";var Ke=Object.create(null);Object.keys(X).forEach(s=>{Ke[X[s]]=s});var Qe={type:"error",data:"parser error"};var Ze=({type:s,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+Ks(e,!0).toString("base64")):r(X[s]+(e||"")),Ks=(s,e)=>Buffer.isBuffer(s)||s instanceof Uint8Array&&!e?s:s instanceof ArrayBuffer?Buffer.from(s):Buffer.from(s.buffer,s.byteOffset,s.byteLength),is;function Qs(s,e){if(s.data instanceof ArrayBuffer||ArrayBuffer.isView(s.data))return e(Ks(s.data,!1));Ze(s,!0,t=>{is||(is=new TextEncoder),e(is.encode(t))})}var et=(s,e)=>{if(typeof s!="string")return{type:"message",data:Zs(s,e)};let t=s.charAt(0);if(t==="b"){let r=Buffer.from(s.substring(1),"base64");return{type:"message",data:Zs(r,e)}}return Ke[t]?s.length>1?{type:Ke[t],data:s.substring(1)}:{type:Ke[t]}:Qe},Zs=(s,e)=>e==="arraybuffer"?s instanceof ArrayBuffer?s:Buffer.isBuffer(s)?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:Buffer.isBuffer(s)?s:Buffer.from(s);var er="",tr=(s,e)=>{let t=s.length,r=new Array(t),n=0;s.forEach((i,o)=>{Ze(i,!1,f=>{r[o]=f,++n===t&&e(r.join(er))})})},sr=(s,e)=>{let t=s.split(er),r=[];for(let n=0;n<t.length;n++){let i=et(t[n],e);if(r.push(i),i.type==="error")break}return r};function rr(){return new TransformStream({transform(s,e){Qs(s,t=>{let r=t.length,n;if(r<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,r);else if(r<65536){n=new Uint8Array(3);let i=new DataView(n.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{n=new Uint8Array(9);let i=new DataView(n.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}s.data&&typeof s.data!="string"&&(n[0]|=128),e.enqueue(n),e.enqueue(t)})}})}var os;function _t(s){return s.reduce((e,t)=>e+t.length,0)}function Ct(s,e){if(s[0].length===e)return s.shift();let t=new Uint8Array(e),r=0;for(let n=0;n<e;n++)t[n]=s[0][r++],r===s[0].length&&(s.shift(),r=0);return s.length&&r<s[0].length&&(s[0]=s[0].slice(r)),t}function nr(s,e){os||(os=new TextDecoder);let t=[],r=0,n=-1,i=!1;return new TransformStream({transform(o,f){for(t.push(o);;){if(r===0){if(_t(t)<1)break;let l=Ct(t,1);i=(l[0]&128)===128,n=l[0]&127,n<126?r=3:n===126?r=1:r=2}else if(r===1){if(_t(t)<2)break;let l=Ct(t,2);n=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(_t(t)<8)break;let l=Ct(t,8),u=new DataView(l.buffer,l.byteOffset,l.length),a=u.getUint32(0);if(a>Math.pow(2,21)-1){f.enqueue(Qe);break}n=a*Math.pow(2,32)+u.getUint32(4),r=3}else{if(_t(t)<n)break;let l=Ct(t,n);f.enqueue(et(i?l:os.decode(l),e)),r=0}if(n===0||n>s){f.enqueue(Qe);break}}}})}var as=4;var yr=O(ue(),1);var Z=process.nextTick,q=global,or="nodebuffer";function ar(){return new cs}function Oi(s){let e=s.split("; "),t=e[0].indexOf("=");if(t===-1)return;let r=e[0].substring(0,t).trim();if(!r.length)return;let n=e[0].substring(t+1).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));let i={name:r,value:n};for(let o=1;o<e.length;o++){let f=e[o].split("=");if(f.length!==2)continue;let l=f[0].trim(),u=f[1].trim();switch(l){case"Expires":i.expires=new Date(u);break;case"Max-Age":let a=new Date;a.setUTCSeconds(a.getUTCSeconds()+parseInt(u,10)),i.expires=a;break;default:}}return i}var cs=class{constructor(){this._cookies=new Map}parseCookies(e){e&&e.forEach(t=>{let r=Oi(t);r&&this._cookies.set(r.name,r)})}get cookies(){let e=Date.now();return this._cookies.forEach((t,r)=>{var n;((n=t.expires)===null||n===void 0?void 0:n.getTime())<e&&this._cookies.delete(r)}),this._cookies.entries()}addCookies(e){let t=[];for(let[r,n]of this.cookies)t.push(`${r}=${n.value}`);t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}appendCookies(e){for(let[t,r]of this.cookies)e.append("cookie",`${t}=${r.value}`)}};function bt(s,...e){return e.reduce((t,r)=>(s.hasOwnProperty(r)&&(t[r]=s[r]),t),{})}var Ti=q.setTimeout,Fi=q.clearTimeout;function ee(s,e){e.useNativeTimers?(s.setTimeoutFn=Ti.bind(q),s.clearTimeoutFn=Fi.bind(q)):(s.setTimeoutFn=q.setTimeout.bind(q),s.clearTimeoutFn=q.clearTimeout.bind(q))}var Ni=1.33;function cr(s){return typeof s=="string"?Ri(s):Math.ceil((s.byteLength||s.size)*Ni)}function Ri(s){let e=0,t=0;for(let r=0,n=s.length;r<n;r++)e=s.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}function Et(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function fr(s){let e="";for(let t in s)s.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(s[t]));return e}function hr(s){let e={},t=s.split("&");for(let r=0,n=t.length;r<n;r++){let i=t[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}var _r=O(pe(),1),Qi=(0,_r.default)("engine.io-client:transport"),kt=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},te=class extends yr.Emitter{constructor(e){super(),this.writable=!1,ee(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,r){return super.emitReserved("error",new kt(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):Qi("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=et(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=fr(e);return t.length?"?"+t:""}};var Cr=O(pe(),1),Y=(0,Cr.default)("engine.io-client:polling"),tt=class extends te{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{Y("paused"),this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(Y("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){Y("pre-pause polling complete"),--r||t()})),this.writable||(Y("we are currently writing - waiting to pause"),r++,this.once("drain",function(){Y("pre-pause writing complete"),--r||t()}))}else t()}_poll(){Y("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){Y("polling got data %s",e);let t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};sr(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():Y('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{Y("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(Y("transport open - closing"),e()):(Y("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,tr(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Et()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var xr=O(ue(),1);var br=!1;try{br=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Er=br;var vr=O(pe(),1),ls=(0,vr.default)("engine.io-client:polling");function Zi(){}var Ot=class extends tt{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",r=location.port;r||(r=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(n,i)=>{this.onError("xhr post error",n,i)})}doPoll(){ls("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},se=class s extends xr.Emitter{constructor(e,t,r){super(),this.createRequest=e,ee(this,r),this._opts=r,this._method=r.method||"GET",this._uri=t,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;let t=bt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(t);try{ls("xhr open %s: %s",this._method,this._uri),r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var n;r.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},ls("xhr data %s",this._data),r.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=s.requestsCount++,s.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Zi,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete s.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};se.requestsCount=0;se.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",wr);else if(typeof addEventListener=="function"){let s="onpagehide"in q?"pagehide":"unload";addEventListener(s,wr,!1)}}function wr(){for(let s in se.requests)se.requests.hasOwnProperty(s)&&se.requests[s].abort()}var _f=(function(){let s=eo({xdomain:!1});return s&&s.responseType!==null})();function eo(s){let e=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Er))return new XMLHttpRequest}catch{}if(!e)try{return new q[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var to=us.default||us,Fe=class extends Ot{request(e={}){var t;return Object.assign(e,{xd:this.xd,cookieJar:(t=this.socket)===null||t===void 0?void 0:t._cookieJar},this.opts),new se(r=>new to(r),this.uri(),e)}};var Ea=O(bn(),1),wa=O(xs(),1),xa=O(ks(),1),Bs=O(qt(),1),va=O(Fn(),1);var Nn=O(pe(),1),ka=(0,Nn.default)("engine.io-client:websocket"),Oa=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Wt=class extends te{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,r=Oa?{}:bt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,r)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],n=t===e.length-1;Ze(r,this.supportsBinary,i=>{try{this.doWrite(r,i)}catch{ka("websocket closed before onclose event")}n&&Z(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Et()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},$f=q.WebSocket||q.MozWebSocket;var Ie=class extends Wt{createSocket(e,t,r){var n;if(!((n=this.socket)===null||n===void 0)&&n._cookieJar){r.headers=r.headers||{},r.headers.cookie=typeof r.headers.cookie=="string"?[r.headers.cookie]:r.headers.cookie||[];for(let[i,o]of this.socket._cookieJar.cookies)r.headers.cookie.push(`${i}=${o.value}`)}return new Bs.default(e,t,r)}doWrite(e,t){let r={};e.options&&(r.compress=e.options.compress),this.opts.perMessageDeflate&&(typeof t=="string"?Buffer.byteLength(t):t.length)<this.opts.perMessageDeflate.threshold&&(r.compress=!1),this.ws.send(t,r)}};var Rn=O(pe(),1),ht=(0,Rn.default)("engine.io-client:webtransport"),Ue=class extends te{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{ht("transport closed gracefully"),this.onClose()}).catch(e=>{ht("transport closed due to %s",e),this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=nr(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),n=rr();n.readable.pipeTo(e.writable),this._writer=n.writable.getWriter();let i=()=>{r.read().then(({done:f,value:l})=>{if(f){ht("session is closed");return}ht("received chunk: %o",l),this.onPacket(l),i()}).catch(f=>{ht("an error occurred while reading: %s",f)})};i();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],n=t===e.length-1;this._writer.write(r).then(()=>{n&&Z(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var Ps={websocket:Ie,webtransport:Ue,polling:Fe};var Ta=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Fa=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function qe(s){if(s.length>8e3)throw"URI too long";let e=s,t=s.indexOf("["),r=s.indexOf("]");t!=-1&&r!=-1&&(s=s.substring(0,t)+s.substring(t,r).replace(/:/g,";")+s.substring(r,s.length));let n=Ta.exec(s||""),i={},o=14;for(;o--;)i[Fa[o]]=n[o]||"";return t!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Na(i,i.path),i.queryKey=Ra(i,i.query),i}function Na(s,e){let t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Ra(s,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,n,i){n&&(t[n]=i)}),t}var An=O(ue(),1);var Ln=O(pe(),1),v=(0,Ln.default)("engine.io-client:socket"),Ds=typeof addEventListener=="function"&&typeof removeEventListener=="function",lt=[];Ds&&addEventListener("offline",()=>{v("closing %d connection(s) because the network was lost",lt.length),lt.forEach(s=>s())},!1);var be=class s extends An.Emitter{constructor(e,t){if(super(),this.binaryType=or,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){let r=qe(e);t.hostname=r.host,t.secure=r.protocol==="https"||r.protocol==="wss",t.port=r.port,r.query&&(t.query=r.query)}else t.host&&(t.hostname=qe(t.host).host);ee(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(r=>{let n=r.prototype.name;this.transports.push(n),this._transportsByName[n]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=hr(this.opts.query)),Ds&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(v("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},lt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=ar()),this._open()}createTransport(e){v('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=as,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return v("options: %j",r),new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&s.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){v("setting transport %s",e.name),this.transport&&(v("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){v("socket open"),this.readyState="open",s.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(v('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else v('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();v("flushing %d packets in socket",e.length),this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){let n=this.writeBuffer[r].data;if(n&&(t+=cr(n)),r>0&&t>this._maxPayload)return v("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return v("payload size is %d (max: %d)",t,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(v("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,Z(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,r){return this._sendPacket("message",e,t,r),this}send(e,t,r){return this._sendPacket("message",e,t,r),this}_sendPacket(e,t,r,n){if(typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),v("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(v("socket error %j",e),s.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return v("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(v('socket close with reason: "%s"',e),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ds&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let r=lt.indexOf(this._offlineEventListener);r!==-1&&(v("removing listener for the 'offline' event"),lt.splice(r,1))}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}};be.protocol=as;var jt=class extends be{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){v("starting upgrade probes");for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}}_probe(e){v('probing transport "%s"',e);let t=this.createTransport(e),r=!1;be.priorWebsocketSuccess=!1;let n=()=>{r||(v('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",c=>{if(!r)if(c.type==="pong"&&c.data==="probe"){if(v('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;be.priorWebsocketSuccess=t.name==="websocket",v('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(v("changing transport and sending upgrade packet"),a(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{v('probe transport "%s" failed',e);let h=new Error("probe error");h.transport=t.name,this.emitReserved("upgradeError",h)}}))};function i(){r||(r=!0,a(),t.close(),t=null)}let o=c=>{let h=new Error("probe error: "+c);h.transport=t.name,i(),v('probe transport "%s" failed because of error: %s',e,c),this.emitReserved("upgradeError",h)};function f(){o("transport closed")}function l(){o("socket closed")}function u(c){t&&c.name!==t.name&&(v('"%s" works - aborting "%s"',c.name,t.name),i())}let a=()=>{t.removeListener("open",n),t.removeListener("error",o),t.removeListener("close",f),this.off("close",l),this.off("upgrading",u)};t.once("open",n),t.once("error",o),t.once("close",f),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}},Me=class extends jt{constructor(e,t={}){let r=typeof e=="object"?e:t;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(n=>Ps[n]).filter(n=>!!n)),super(e,r)}};var dh=Me.protocol;var Wn=O(ut(),1),Mn=(0,Wn.default)("socket.io-client:url");function jn(s,e="",t){let r=s;t=t||typeof location<"u"&&location,s==null&&(s=t.protocol+"//"+t.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=t.protocol+s:s=t.host+s),/^(https?|wss?):\/\//.test(s)||(Mn("protocol-less url %s",s),typeof t<"u"?s=t.protocol+"//"+s:s="https://"+s),Mn("parse %s",s),r=qe(s)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(t&&t.port===r.port?"":":"+r.port),r}var zs={};xi(zs,{Decoder:()=>Gs,Encoder:()=>$s,PacketType:()=>C,isPacketValid:()=>Fc,protocol:()=>si});var Zn=O(ue(),1);var tc=typeof ArrayBuffer=="function",sc=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,Vn=Object.prototype.toString,rc=typeof Blob=="function"||typeof Blob<"u"&&Vn.call(Blob)==="[object BlobConstructor]",nc=typeof File=="function"||typeof File<"u"&&Vn.call(File)==="[object FileConstructor]";function pt(s){return tc&&(s instanceof ArrayBuffer||sc(s))||rc&&s instanceof Blob||nc&&s instanceof File}function dt(s,e){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let t=0,r=s.length;t<r;t++)if(dt(s[t]))return!0;return!1}if(pt(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return dt(s.toJSON(),!0);for(let t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&dt(s[t]))return!0;return!1}function $n(s){let e=[],t=s.data,r=s;return r.data=qs(t,e),r.attachments=e.length,{packet:r,buffers:e}}function qs(s,e){if(!s)return s;if(pt(s)){let t={_placeholder:!0,num:e.length};return e.push(s),t}else if(Array.isArray(s)){let t=new Array(s.length);for(let r=0;r<s.length;r++)t[r]=qs(s[r],e);return t}else if(typeof s=="object"&&!(s instanceof Date)){let t={};for(let r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=qs(s[r],e));return t}return s}function Gn(s,e){return s.data=Ms(s.data,e),delete s.attachments,s}function Ms(s,e){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<e.length)return e[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let t=0;t<s.length;t++)s[t]=Ms(s[t],e);else if(typeof s=="object")for(let t in s)Object.prototype.hasOwnProperty.call(s,t)&&(s[t]=Ms(s[t],e));return s}var ei=O(Qn(),1),Vs=(0,ei.default)("socket.io-parser"),ti=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],si=5,C;(function(s){s[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK"})(C||(C={}));var $s=class{constructor(e){this.replacer=e}encode(e){return Vs("encoding packet %j",e),(e.type===C.EVENT||e.type===C.ACK)&&dt(e)?this.encodeAsBinary({type:e.type===C.EVENT?C.BINARY_EVENT:C.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===C.BINARY_EVENT||e.type===C.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),Vs("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=$n(e),r=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(r),n}},Gs=class s extends Zn.Emitter{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let r=t.type===C.BINARY_EVENT;r||t.type===C.BINARY_ACK?(t.type=r?C.EVENT:C.ACK,this.reconstructor=new Hs(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(pt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(C[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===C.BINARY_EVENT||r.type===C.BINARY_ACK){let i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(i,t)}else r.nsp="/";let n=e.charAt(t+1);if(n!==""&&Number(n)==n){let i=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){let i=this.tryParse(e.substr(t));if(s.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return Vs("decoded %s as %j",e,r),r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case C.CONNECT:return Kt(t);case C.DISCONNECT:return t===void 0;case C.CONNECT_ERROR:return typeof t=="string"||Kt(t);case C.EVENT:case C.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&ti.indexOf(t[0])===-1);case C.ACK:case C.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Hs=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Gn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Sc(s){return typeof s=="string"}var kc=Number.isInteger||function(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s};function Oc(s){return s===void 0||kc(s)}function Kt(s){return Object.prototype.toString.call(s)==="[object Object]"}function Tc(s,e){switch(s){case C.CONNECT:return e===void 0||Kt(e);case C.DISCONNECT:return e===void 0;case C.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&ti.indexOf(e[0])===-1);case C.ACK:return Array.isArray(e);case C.CONNECT_ERROR:return typeof e=="string"||Kt(e);default:return!1}}function Fc(s){return Sc(s.nsp)&&Oc(s.id)&&Tc(s.type,s.data)}function $(s,e,t){return s.on(e,t),function(){s.off(e,t)}}var ri=O(ue(),1),ni=O(ut(),1),T=(0,ni.default)("socket.io-client:socket"),Nc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ze=class extends ri.Emitter{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[$(e,"open",this.onopen.bind(this)),$(e,"packet",this.onpacket.bind(this)),$(e,"error",this.onerror.bind(this)),$(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var r,n,i;if(Nc.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:C.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let a=this.ids++;T("emitting packet with ack id %d",a);let c=t.pop();this._registerAckCallback(a,c),o.id=a}let f=(n=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||n===void 0?void 0:n.writable,l=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!f?T("discard packet as the transport is not currently writable"):l?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o),this.flags={},this}_registerAckCallback(e,t){var r;let n=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===e&&(T("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(f,1));T("event with ack id %d has timed out after %d ms",e,n),t.call(this,new Error("operation has timed out"))},n),o=(...f)=>{this.io.clearTimeoutFn(i),t.apply(this,f)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((r,n)=>{let i=(o,f)=>o?n(o):r(f);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((n,...i)=>r!==this._queue[0]?T("packet [%d] already acknowledged",r.id):(n!==null?r.tryCount>this._opts.retries&&(T("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(n)):(T("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(T("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){T("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,T("sending packet [%d] (try n\xB0%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){T("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:C.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){T("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){let r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case C.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case C.EVENT:case C.BINARY_EVENT:this.onevent(e);break;case C.ACK:case C.BINARY_ACK:this.onack(e);break;case C.DISCONNECT:this.ondisconnect();break;case C.CONNECT_ERROR:this.destroy();let r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){let t=e.data||[];T("emitting event %j",t),e.id!=null&&(T("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...n){r||(r=!0,T("sending ack %j",n),t.packet({type:C.ACK,id:e,data:n}))}}onack(e){let t=this.acks[e.id];if(typeof t!="function"){T("bad ack %s",e.id);return}delete this.acks[e.id],T("calling ack %s with %j",e.id,e.data),t.withError&&e.data.unshift(null),t.apply(this,e.data)}onconnect(e,t){T("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){T("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(T("performing disconnect (%s)",this.nsp),this.packet({type:C.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let r of t)r.apply(this,e.data)}}};function xe(s){s=s||{},this.ms=s.min||100,this.max=s.max||1e4,this.factor=s.factor||2,this.jitter=s.jitter>0&&s.jitter<=1?s.jitter:0,this.attempts=0}xe.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*s);s=(Math.floor(e*10)&1)==0?s-t:s+t}return Math.min(s,this.max)|0};xe.prototype.reset=function(){this.attempts=0};xe.prototype.setMin=function(s){this.ms=s};xe.prototype.setMax=function(s){this.max=s};xe.prototype.setJitter=function(s){this.jitter=s};var ii=O(ue(),1),oi=O(ut(),1),P=(0,oi.default)("socket.io-client:manager"),Xe=class extends ii.Emitter{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,ee(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new xe({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let n=t.parser||zs;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(P("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;P("opening %s",this.uri),this.engine=new Me(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let n=$(t,"open",function(){r.onopen(),e&&e()}),i=f=>{P("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",f),e?e(f):this.maybeReconnectOnOpen()},o=$(t,"error",i);if(this._timeout!==!1){let f=this._timeout;P("connect attempt will timeout after %d",f);let l=this.setTimeoutFn(()=>{P("connect attempt timed out after %d",f),n(),i(new Error("timeout")),t.close()},f);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(n),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){P("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push($(e,"ping",this.onping.bind(this)),$(e,"data",this.ondata.bind(this)),$(e,"error",this.onerror.bind(this)),$(e,"close",this.onclose.bind(this)),$(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Z(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){P("error",e),this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ze(this,e,t),this.nsps[e]=r),r}_destroy(e){let t=Object.keys(this.nsps);for(let r of t)if(this.nsps[r].active){P("socket %s is still active, skipping close",r);return}this._close()}_packet(e){P("writing packet %j",e);let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){P("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){P("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var r;P("closed due to %s",e),this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)P("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();P("will wait %dms before reconnect attempt",t),this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(P("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(P("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):(P("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var ci=O(ut(),1),ai=(0,ci.default)("socket.io-client"),mt={};function gt(s,e){typeof s=="object"&&(e=s,s=void 0),e=e||{};let t=jn(s,e.path||"/socket.io"),r=t.source,n=t.id,i=t.path,o=mt[n]&&i in mt[n].nsps,f=e.forceNew||e["force new connection"]||e.multiplex===!1||o,l;return f?(ai("ignoring socket cache for %s",r),l=new Xe(r,e)):(mt[n]||(ai("new io instance for %s",r),mt[n]=new Xe(r,e)),l=mt[n]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(gt,{Manager:Xe,Socket:ze,io:gt,connect:gt});var Bc=process.env.MYHI_SERVER||"http://localhost:3000",Pc=Rc(Ac(Lc(),".myhi","token"),"utf8").trim();function ve(s){try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),s.disconnect()}function fi(s,e){s.emit("join",e),s.on("joined",t=>{process.stderr.write(`\r
|
|
22
|
+
[myhi] \u5DF2\u9644\u52A0\u5230 "${t.title}" (${e})\r
|
|
23
|
+
`),process.stderr.write(`[myhi] \u6309 Ctrl+] \u5206\u79BB\r
|
|
24
|
+
\r
|
|
25
|
+
`),s.emit("take-control",{sessionId:e});try{process.stdin.setRawMode(!0)}catch{}process.stdin.resume(),process.stdin.setEncoding("binary"),process.stdin.on("data",r=>{r===""&&(process.stderr.write(`\r
|
|
26
|
+
[myhi] \u5DF2\u5206\u79BB\r
|
|
27
|
+
`),ve(s),process.exit(0)),s.emit("input",r)}),s.on("output",r=>{process.stdout.write(r,"binary")}),process.stdout.on("resize",()=>{s.emit("resize",{cols:process.stdout.columns||80,rows:process.stdout.rows||24})})}),s.on("control-denied",({reason:t})=>{process.stderr.write(`\r
|
|
28
|
+
[myhi] \u83B7\u53D6\u63A7\u5236\u6743\u5931\u8D25: ${t}\r
|
|
29
|
+
`)}),s.on("control-changed",({holder:t,holderName:r})=>{t&&t!==s.id?process.stderr.write(`\r
|
|
30
|
+
[myhi] ${r||"\u5176\u4ED6\u7528\u6237"} \u5DF2\u83B7\u53D6\u63A7\u5236\u6743\uFF0C\u5F53\u524D\u4E3A\u53EA\u8BFB\r
|
|
31
|
+
`):t||process.stderr.write(`\r
|
|
32
|
+
[myhi] \u63A7\u5236\u6743\u5DF2\u91CA\u653E\r
|
|
33
|
+
`)}),s.on("session-exit",({code:t})=>{process.stderr.write(`\r
|
|
34
|
+
[myhi] \u4F1A\u8BDD\u5DF2\u9000\u51FA (code ${t})\r
|
|
35
|
+
`),ve(s),process.exit(0)}),s.on("error",({message:t})=>{process.stderr.write(`\r
|
|
36
|
+
[myhi] \u9519\u8BEF: ${t}\r
|
|
37
|
+
`),ve(s),process.exit(1)})}async function Dc(s){return new Promise((e,t)=>{s.emit("list"),s.once("sessions",r=>{let n=r.filter(o=>o.alive);n.length||(process.stderr.write(`[myhi] \u6CA1\u6709\u6D3B\u8DC3\u7684\u4F1A\u8BDD\u3002
|
|
38
|
+
`),ve(s),process.exit(0)),process.stdout.write(`
|
|
39
|
+
\u6D3B\u8DC3\u4F1A\u8BDD:
|
|
40
|
+
`),n.forEach((o,f)=>{let l=o.viewers>0?` (${o.viewers} \u4EBA\u5728\u7EBF)`:"";process.stdout.write(` [${f+1}] ${o.title}${l} \u2014 ${o.id}
|
|
41
|
+
`)}),process.stdout.write(`
|
|
42
|
+
`);let i=hi({input:process.stdin,output:process.stdout});i.question("\u9009\u62E9\u4F1A\u8BDD\u7F16\u53F7: ",o=>{i.close();let f=parseInt(o,10)-1;(f<0||f>=n.length)&&(process.stderr.write(`[myhi] \u65E0\u6548\u7684\u9009\u62E9\u3002
|
|
43
|
+
`),ve(s),process.exit(1)),e(n[f].id)})})})}async function li(s,e){return new Promise((t,r)=>{s.emit("create",e,n=>{n?.ok||(process.stderr.write(`[myhi] \u521B\u5EFA\u5931\u8D25: ${n?.error||"\u672A\u77E5\u9519\u8BEF"}
|
|
44
|
+
`),ve(s),process.exit(1)),process.stdout.write(`[myhi] \u5DF2\u521B\u5EFA\u4F1A\u8BDD "${n.session.title}" \u2014 ${n.session.id}
|
|
45
|
+
`),t(n.session.id)})})}async function Ic(s){let e=hi({input:process.stdin,output:process.stdout}),t=i=>new Promise(o=>e.question(i,o)),r=(await t("\u4F1A\u8BDD\u540D\u79F0 [shell]: ")).trim()||"shell",n=(await t("\u542F\u52A8\u547D\u4EE4\uFF08\u53EF\u9009\uFF09: ")).trim()||void 0;return e.close(),li(s,{title:r,initCmd:n})}var he=gt(Bc,{transports:["websocket"],auth:{token:Pc}});he.on("connect_error",s=>{process.stderr.write(`[myhi] \u8FDE\u63A5\u5931\u8D25: ${s.message}
|
|
46
|
+
`),process.exit(1)});he.on("connect",async()=>{let s=process.argv[2];if(s==="--new"){let e=process.argv[3],t=process.argv[4]||void 0,r=e?await li(he,{title:e,initCmd:t}):await Ic(he);fi(he,r)}else{let e=s||await Dc(he);fi(he,e)}});for(let s of["SIGINT","SIGTERM"])process.on(s,()=>{ve(he),process.exit(0)});process.on("exit",()=>{try{process.stdin.setRawMode(!1)}catch{}});
|
|
47
|
+
/*! Bundled license information:
|
|
48
|
+
|
|
49
|
+
xmlhttprequest-ssl/lib/XMLHttpRequest.js:
|
|
50
|
+
(**
|
|
51
|
+
* Wrapper for built-in http.js to emulate the browser XMLHttpRequest object.
|
|
52
|
+
*
|
|
53
|
+
* This can be used with JS designed for browsers to improve reuse of code and
|
|
54
|
+
* allow the use of existing libraries.
|
|
55
|
+
*
|
|
56
|
+
* Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs.
|
|
57
|
+
*
|
|
58
|
+
* @author Dan DeFelippi <dan@driverdan.com>
|
|
59
|
+
* @contributor David Ellis <d.f.ellis@ieee.org>
|
|
60
|
+
* @license MIT
|
|
61
|
+
*)
|
|
62
|
+
*/
|