tabby/clients/tabby-agent/dist/cli.js

48 lines
268 KiB
JavaScript
Raw Normal View History

#!/bin/env node
2023-05-29 02:09:44 +00:00
var ar=Object.create;var tn=Object.defineProperty;var sr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var rr=Object.getPrototypeOf,cr=Object.prototype.hasOwnProperty;var pr=(i,e,t)=>e in i?tn(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var O=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var lr=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of or(e))!cr.call(i,a)&&a!==t&&tn(i,a,{get:()=>e[a],enumerable:!(n=sr(e,a))||n.enumerable});return i};var X=(i,e,t)=>(t=i!=null?ar(rr(i)):{},lr(e||!i||!i.__esModule?tn(t,"default",{value:i,enumerable:!0}):t,i));var L=(i,e,t)=>(pr(i,typeof e!="symbol"?e+"":e,t),t),nn=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var r=(i,e,t)=>(nn(i,e,"read from private field"),t?t.call(i):e.get(i)),C=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},y=(i,e,t,n)=>(nn(i,e,"write to private field"),n?n.call(i,t):e.set(i,t),t),ft=(i,e,t,n)=>({set _(a){y(i,e,a,t)},get _(){return r(i,e,n)}}),E=(i,e,t)=>(nn(i,e,"access private method"),t);var Aa=O((Hl,Ca)=>{var Ea=require("stream").Stream,$r=require("util");Ca.exports=fe;function fe(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}$r.inherits(fe,Ea);fe.create=function(i,e){var t=new this;e=e||{};for(var n in e)t[n]=e[n];t.source=i;var a=i.emit;return i.emit=function(){return t._handleEmit(arguments),a.apply(i,arguments)},i.on("error",function(){}),t.pauseStream&&i.pause(),t};Object.defineProperty(fe.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}});fe.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};fe.prototype.resume=function(){this._released||this.release(),this.source.resume()};fe.prototype.pause=function(){this.source.pause()};fe.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(i){this.emit.apply(this,i)}.bind(this)),this._bufferedEvents=[]};fe.prototype.pipe=function(){var i=Ea.prototype.pipe.apply(this,arguments);return this.resume(),i};fe.prototype._handleEmit=function(i){if(this._released){this.emit.apply(this,i);return}i[0]==="data"&&(this.dataSize+=i[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(i)};fe.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var i="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(i))}}});var Ta=O((Ml,_a)=>{var Vr=require("util"),Sa=require("stream").Stream,Ra=Aa();_a.exports=P;function P(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}Vr.inherits(P,Sa);P.create=function(i){var e=new this;i=i||{};for(var t in i)e[t]=i[t];return e};P.isStreamLike=function(i){return typeof i!="function"&&typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"&&!Buffer.isBuffer(i)};P.prototype.append=function(i){var e=P.isStreamLike(i);if(e){if(!(i instanceof Ra)){var t=Ra.create(i,{maxDataSize:1/0,pauseStream:this.pauseStreams});i.on("data",this._checkDataSize.bind(this)),i=t}this._handleErrors(i),this.pauseStreams&&i.pause()}return this._streams.push(i),this};P.prototype.pipe=function(i,e){return Sa.prototype.pipe.call(this,i,e),this.resume(),i};P.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};P.prototype._realGetNext=function(){var i=this._streams.shift();if(typeof i>"u"){this.end();return}if(typeof i!="function"){this._pipeNext(i);return}var e=i;e(function(t){var n=P.isStreamLike(t);n&&(t.on("data",this._checkDataSize.bind(this)),this._handleErrors(t)),
`;B.DEFAULT_CONTENT_TYPE="application/octet-stream";B.prototype.append=function(i,e,t){t=t||{},typeof t=="string"&&(t={filename:t});var n=xn.prototype.append.bind(this);if(typeof e=="number"&&(e=""+e),es.isArray(e)){this._error(new Error("Arrays are not supported."));return}var a=this._multiPartHeader(i,e,t),s=this._multiPartFooter();n(a),n(e),n(s),this._trackLength(a,e,t)};B.prototype._trackLength=function(i,e,t){var n=0;t.knownLength!=null?n+=+t.knownLength:Buffer.isBuffer(e)?n=e.length:typeof e=="string"&&(n=Buffer.byteLength(e)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(i)+B.LINE_BREAK.length,!(!e||!e.path&&!(e.readable&&e.hasOwnProperty("httpVersion"))&&!(e instanceof Rc))&&(t.knownLength||this._valuesToMeasure.push(e))};B.prototype._lengthRetriever=function(i,e){i.hasOwnProperty("fd")?i.end!=null&&i.end!=1/0&&i.start!=null?e(null,i.end+1-(i.start?i.start:0)):Ac.stat(i.path,function(t,n){var a;if(t){e(t);return}a=n.size-(i.start?i.start:0),e(null,a)}):i.hasOwnProperty("httpVersion")?e(null,+i.headers["content-length"]):i.hasOwnProperty("httpModule")?(i.on("response",function(t){i.pause(),e(null,+t.headers["content-length"])}),i.resume()):e("Unknown stream")};B.prototype._multiPartHeader=function(i,e,t){if(typeof t.header=="string")return t.header;var n=this._getContentDisposition(e,t),a=this._getContentType(e,t),s="",o={"Content-Disposition":["form-data",'name="'+i+'"'].concat(n||[]),"Content-Type":[].concat(a||[])};typeof t.header=="object"&&hn(o,t.header);var c;for(var p in o)o.hasOwnProperty(p)&&(c=o[p],c!=null&&(Array.isArray(c)||(c=[c]),c.length&&(s+=p+": "+c.join("; ")+B.LINE_BREAK)));return"--"+this.getBoundary()+B.LINE_BREAK+s+B.LINE_BREAK};B.prototype._getContentDisposition=function(i,e){var t,n;return typeof e.filepath=="string"?t=mn.normalize(e.filepath).replace(/\\/g,"/"):e.filename||i.name||i.path?t=mn.basename(e.filename||i.name||i.path):i.readable&&i.hasOwnProperty("httpVersion")&&(t=mn.basename(i.client._httpMessage.path||"")),t&&(n='filename="'+t+'"'),n};B.prototype._getContentType=function(i,e){var t=e.contentType;return!t&&i.name&&(t=fn.lookup(i.name)),!t&&i.path&&(t=fn.lookup(i.path)),!t&&i.readable&&i.hasOwnProperty("httpVersion")&&(t=i.headers["content-type"]),!t&&(e.filepath||e.filename)&&(t=fn.lookup(e.filepath||e.filename)),!t&&typeof i=="object"&&(t=B.DEFAULT_CONTENT_TYPE),t};B.prototype._multiPartFooter=function(){return function(i){var e=B.LINE_BREAK,t=this._streams.length===0;t&&(e+=this._lastBoundary()),i(e)}.bind(this)};B.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+B.LINE_BREAK};B.prototype.getHeaders=function(i){var e,t={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in i)i.hasOwnProperty(e)&&(t[e.toLowerCase()]=i[e]);return t};B.prototype.setBoundary=function(i){this._boundary=i};B.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};B.prototype.getBuffer=function(){for(var i=new Buffer.alloc(0),e=this.getBoundary(),t=0,n=this._streams.length;t<n;t++)typeof this._streams[t]!="function"&&(Buffer.isBuffer(this._streams[t])?i=Buffer.concat([i,this._streams[t]]):i=Buffer.concat([i,Buffer.from(this._streams[t])]),(typeof this._streams[t]!="string"||this._streams[t].substring(2,e.length+2)!==e)&&(i=Buffer.concat([i,Buffer.from(B.LINE_BREAK)])));return Buffer.concat([i,Buffer.from(this._lastBoundary())])};B.prototype._generateBoundary=function(){for(var i="--------------------------",e=0;e<24;e++)i+=Math.floor(Math.random()*10).toString(16);this._boundary=i};B.prototype.getLengthSync=function(){var i=this._overheadLength+this._valueLength;return this._streams.length&&(i+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),i};B.prototype.hasKnownLength=function(){var i=!0;return this._valuesToMeasure.length&&(i=!1),i};B.prototype.getLength=function(i){var e=this._overheadLength+this._valueLength;if(this._streams.length&&(e+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(i
`).join(`
`+s),i.push(a+"m+"+Tt.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=rp()+e+" "+i[0]}function rp(){return V.inspectOpts.hideDate?"":new Date().toISOString()+" "}function cp(...i){return process.stderr.write(_t.format(...i)+`
`)}function pp(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function lp(){return process.env.DEBUG}function up(i){i.inspectOpts={};let e=Object.keys(V.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=V.inspectOpts[e[t]]}Tt.exports=Rn()(V);var{formatters:ys}=Tt.exports;ys.o=function(i){return this.inspectOpts.colors=this.useColors,_t.inspect(i,this.inspectOpts).split(`
`).map(e=>e.trim()).join(" ")};ys.O=function(i){return this.inspectOpts.colors=this.useColors,_t.inspect(i,this.inspectOpts)}});var Es=O((rd,Sn)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Sn.exports=gs():Sn.exports=ws()});var As=O((cd,Cs)=>{var Vi;Cs.exports=function(){if(!Vi){try{Vi=Es()("follow-redirects")}catch{}typeof Vi!="function"&&(Vi=function(){})}Vi.apply(null,arguments)}});var Os=O((pd,Bn)=>{var ei=require("url"),_n=ei.URL,dp=require("http"),mp=require("https"),_s=require("stream").Writable,Ts=require("assert"),ks=As(),kn=["abort","aborted","connect","error","socket","timeout"],Fn=Object.create(null);kn.forEach(function(i){Fn[i]=function(e,t,n){this._redirectable.emit(i,e,t,n)}});var fp=Ji("ERR_INVALID_URL","Invalid URL",TypeError),Rs=Ji("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),hp=Ji("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),xp=Ji("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),vp=Ji("ERR_STREAM_WRITE_AFTER_END","write after end");function oe(i,e){_s.call(this),this._sanitizeOptions(i),this._options=i,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var t=this;this._onNativeResponse=function(n){t._processResponse(n)},this._performRequest()}oe.prototype=Object.create(_s.prototype);oe.prototype.abort=function(){Bs(this._currentRequest),this.emit("abort")};oe.prototype.write=function(i,e,t){if(this._ending)throw new vp;if(!ii(i)&&!yp(i))throw new TypeError("data should be a string, Buffer or Uint8Array");if(Gi(e)&&(t=e,e=null),i.length===0){t&&t();return}this._requestBodyLength+i.length<=this._options.maxBodyLength?(this._requestBodyLength+=i.length,this._requestBodyBuffers.push({data:i,encoding:e}),this._currentRequest.write(i,e,t)):(this.emit("error",new xp),this.abort())};oe.prototype.end=function(i,e,t){if(Gi(i)?(t=i,i=e=null):Gi(e)&&(t=e,e=null),!i)this._ended=this._ending=!0,this._currentRequest.end(null,null,t);else{var n=this,a=this._currentRequest;this.write(i,e,function(){n._ended=!0,a.end(null,null,t)}),this._ending=!0}};oe.prototype.setHeader=function(i,e){this._options.headers[i]=e,this._currentRequest.setHeader(i,e)};oe.prototype.removeHeader=function(i){delete this._options.headers[i],this._currentRequest.removeHeader(i)};oe.prototype.setTimeout=function(i,e){var t=this;function n(o){o.setTimeout(i),o.removeListener("timeout",o.destroy),o.addListener("timeout",o.destroy)}function a(o){t._timeout&&clearTimeout(t._timeout),t._timeout=setTimeout(function(){t.emit("timeout"),s()},i),n(o)}function s(){t._timeout&&(clearTimeout(t._timeout),t._timeout=null),t.removeListener("abort",s),t.removeListener("error",s),t.removeListener("response",s),e&&t.removeListener("timeout",e),t.socket||t._currentRequest.removeListener("socket",a)}return e&&this.on("timeout",e),this.socket?a(this.socket):this._currentRequest.once("socket",a),this.on("socket",n),this.on("abort",s),this.on("error",s),this.on("response",s),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(i){oe.prototype[i]=function(e,t){return this._currentRequest[i](e,t)}});["aborted","connection","socket"].forEach(function(i){Object.defineProperty(oe.prototype,i,{get:function(){return this._currentRequest[i]}})});oe.prototype._sanitizeOptions=function(i){if(i.headers||(i.headers={}),i.host&&(i.hostname||(i.hostname=i.host),delete i.host),!i.pathname&&i.path){var e=i.path.indexOf("?");e<0?i.pathname=i.path:(i.pathname=i.path.substring(0,e),i.search=i.path.substring(e))}};oe.prototype._performRequest=function(){var i=this._options.protocol,e=this._options.nativeProtocols[i];if(!e){this.emit("error",new TypeError("Unsupported protocol "+i));return}if(this._options.agents){var t=i.slice(0,-1);this._options.agent=this._options.agents[t]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var a of kn)n.on(a,Fn[a]);if(this._currentUrl=/^\//.test(this._options.path
(see https://github.com/puleos/object-hash/issues/26)
Use "options.replacer" or "options.ignoreUnknown"
`)},_domwindow:function(){return n("domwindow")},_bigint:function(a){return n("bigint:"+a.toString())},_process:function(){return n("process")},_timer:function(){return n("timer")},_pipe:function(){return n("pipe")},_tcp:function(){return n("tcp")},_udp:function(){return n("udp")},_tty:function(){return n("tty")},_statwatcher:function(){return n("statwatcher")},_securecontext:function(){return n("securecontext")},_connection:function(){return n("connection")},_zlib:function(){return n("zlib")},_context:function(){return n("context")},_nodescript:function(){return n("nodescript")},_httpparser:function(){return n("httpparser")},_dataview:function(){return n("dataview")},_signal:function(){return n("signal")},_fsevent:function(){return n("fsevent")},_tlswrap:function(){return n("tlswrap")}}}function bo(){return{buf:"",write:function(i){this.buf+=i},end:function(i){this.buf+=i},read:function(){return this.buf}}}});var Eo=O((Bf,wo)=>{wo.exports={STRING:2,BOOLEAN:4,BYTES:4,NUMBER:8,Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8}});var Ro=O(Dt=>{"use strict";Dt.byteLength=Hp;Dt.toByteArray=Wp;Dt.fromByteArray=Gp;var Te=[],me=[],Dp=typeof Uint8Array<"u"?Uint8Array:Array,Kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pi=0,Co=Kn.length;pi<Co;++pi)Te[pi]=Kn[pi],me[Kn.charCodeAt(pi)]=pi;var pi,Co;me["-".charCodeAt(0)]=62;me["_".charCodeAt(0)]=63;function Ao(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Hp(i){var e=Ao(i),t=e[0],n=e[1];return(t+n)*3/4-n}function Mp(i,e,t){return(e+t)*3/4-t}function Wp(i){var e,t=Ao(i),n=t[0],a=t[1],s=new Dp(Mp(i,n,a)),o=0,c=a>0?n-4:n,p;for(p=0;p<c;p+=4)e=me[i.charCodeAt(p)]<<18|me[i.charCodeAt(p+1)]<<12|me[i.charCodeAt(p+2)]<<6|me[i.charCodeAt(p+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return a===2&&(e=me[i.charCodeAt(p)]<<2|me[i.charCodeAt(p+1)]>>4,s[o++]=e&255),a===1&&(e=me[i.charCodeAt(p)]<<10|me[i.charCodeAt(p+1)]<<4|me[i.charCodeAt(p+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function $p(i){return Te[i>>18&63]+Te[i>>12&63]+Te[i>>6&63]+Te[i&63]}function Vp(i,e,t){for(var n,a=[],s=e;s<t;s+=3)n=(i[s]<<16&16711680)+(i[s+1]<<8&65280)+(i[s+2]&255),a.push($p(n));return a.join("")}function Gp(i){for(var e,t=i.length,n=t%3,a=[],s=16383,o=0,c=t-n;o<c;o+=s)a.push(Vp(i,o,o+s>c?c:o+s));return n===1?(e=i[t-1],a.push(Te[e>>2]+Te[e<<4&63]+"==")):n===2&&(e=(i[t-2]<<8)+i[t-1],a.push(Te[e>>10]+Te[e>>4&63]+Te[e<<2&63]+"=")),a.join("")}});var So=O(Yn=>{Yn.read=function(i,e,t,n,a){var s,o,c=a*8-n-1,p=(1<<c)-1,l=p>>1,u=-7,d=t?a-1:0,v=t?-1:1,b=i[e+d];for(d+=v,s=b&(1<<-u)-1,b>>=-u,u+=c;u>0;s=s*256+i[e+d],d+=v,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=o*256+i[e+d],d+=v,u-=8);if(s===0)s=1-l;else{if(s===p)return o?NaN:(b?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(b?-1:1)*o*Math.pow(2,s-n)};Yn.write=function(i,e,t,n,a,s){var o,c,p,l=s*8-a-1,u=(1<<l)-1,d=u>>1,v=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:s-1,h=n?1:-1,x=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(p=Math.pow(2,-o))<1&&(o--,p*=2),o+d>=1?e+=v/p:e+=v*Math.pow(2,1-d),e*p>=2&&(o++,p/=2),o+d>=u?(c=0,o=u):o+d>=1?(c=(e*p-1)*Math.pow(2,a),o=o+d):(c=e*Math.pow(2,d-1)*Math.pow(2,a),o=0));a>=8;i[t+b]=c&255,b+=h,c/=256,a-=8);for(o=o<<a|c,l+=a;l>0;i[t+b]=o&255,b+=h,o/=256,l-=8);i[t+b-h]|=x*128}});var Mo=O(qi=>{"use strict";var Xn=Ro(),ji=So(),_o=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;qi.Buffer=f;qi.SlowBuffer=Zp;qi.INSPECT_MAX_BYTES=50;var Ht=2147483647;qi.kMaxLength=Ht;f.TYPED_ARRAY_SUPPORT=Jp();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Jp(){try{let i=new Uint8Array(1),e={foo:function(){return 42}};ret
`).forEach(function(o){a=o.indexOf(":"),t=o.substring(0,a).trim().toLowerCase(),n=o.substring(a+1).trim(),!(!t||e[t]&&Ic[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e};var ds=Symbol("internals");function Mi(i){return i&&String(i).trim().toLowerCase()}function At(i){return i===!1||i==null?i:m.isArray(i)?i.map(At):String(i)}function Lc(i){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=t.exec(i);)e[n[1]]=n[2];return e}var Pc=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function En(i,e,t,n,a){if(m.isFunction(n))return n.call(this,e,t);if(a&&(e=t),!!m.isString(e)){if(m.isString(n))return e.indexOf(n)!==-1;if(m.isRegExp(n))return n.test(e)}}function zc(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function Nc(i,e){let t=m.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(i,n+t,{value:function(a,s,o){return this[n].call(this,e,a,s,o)},configurable:!0})})}var bi=class{constructor(e){e&&this.set(e)}set(e,t,n){let a=this;function s(c,p,l){let u=Mi(p);if(!u)throw new Error("header name must be a non-empty string");let d=m.findKey(a,u);(!d||a[d]===void 0||l===!0||l===void 0&&a[d]!==!1)&&(a[d||p]=At(c))}let o=(c,p)=>m.forEach(c,(l,u)=>s(l,u,p));return m.isPlainObject(e)||e instanceof this.constructor?o(e,t):m.isString(e)&&(e=e.trim())&&!Pc(e)?o(us(e),t):e!=null&&s(t,e,n),this}get(e,t){if(e=Mi(e),e){let n=m.findKey(this,e);if(n){let a=this[n];if(!t)return a;if(t===!0)return Lc(a);if(m.isFunction(t))return t.call(this,a,n);if(m.isRegExp(t))return t.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Mi(e),e){let n=m.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||En(this,this[n],n,t)))}return!1}delete(e,t){let n=this,a=!1;function s(o){if(o=Mi(o),o){let c=m.findKey(n,o);c&&(!t||En(n,n[c],c,t))&&(delete n[c],a=!0)}}return m.isArray(e)?e.forEach(s):s(e),a}clear(e){let t=Object.keys(this),n=t.length,a=!1;for(;n--;){let s=t[n];(!e||En(this,this[s],s,e,!0))&&(delete this[s],a=!0)}return a}normalize(e){let t=this,n={};return m.forEach(this,(a,s)=>{let o=m.findKey(n,s);if(o){t[o]=At(a),delete t[s];return}let c=e?zc(s):String(s).trim();c!==s&&delete t[s],t[c]=At(a),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return m.forEach(this,(n,a)=>{n!=null&&n!==!1&&(t[a]=e&&m.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(a=>n.set(a)),n}static accessor(e){let n=(this[ds]=this[ds]={accessors:{}}).accessors,a=this.prototype;function s(o){let c=Mi(o);n[c]||(Nc(a,o),n[c]=!0)}return m.isArray(e)?e.forEach(s):s(e),this}};bi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);m.freezeMethods(bi.prototype);m.freezeMethods(bi);var N=bi;function Wi(i,e){let t=this||vi,n=e||t,a=N.from(n.headers),s=n.data;return m.forEach(i,function(c){s=c.call(t,s,a.normalize(),e?e.status:void 0)}),a.normalize(),s}function $i(i){return!!(i&&i.__CANCEL__)}function ms(i,e,t){g.call(this,i??"canceled",g.ERR_CANCELED,e,t),this.name="CanceledError"}m.inherits(ms,g,{__CANCEL__:!0});var he=ms;function He(i,e,t){let n=t.config.validateStatus;!t.status||!n||n(t.status)?i(t):e(new g("Request failed with status code "+t.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Cn(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function An(i,e){return e?i.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):i}function Qe(i,e){return i&&!Cn(e)?An(i,e):e}var $s=X(hs(),1),Vs=X(require("http"),1),Gs=X(require("https"),1),Js=X(require("util"),1),Ks=X(Os(),1),qe=X(require("zlib"),1);var ti="1.4.0";function Ki(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}var wp=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function On(i,e,t){let n=t&&t.Blob||z.classes.Blob,a=Ki(i);if(e===void 0&&n&&(e=!0),a==="data"){i=a.length?i.slice(a.length+1):i;let s=wp.exec(i);if(!s)throw new g("Invalid URL",g.ERR_INVALID_URL);let o=s[1],c=s[2],p=s[3],l=Buffer.from(decodeURIComponent(p),c?"base64":"utf8");if(e){if(!n)throw new g("Blob is not supported",g.ERR_NOT_SUPPORT);return new n([l],{type:o})}return l}throw new g("Unsupported protocol "+a,g.ERR_NOT_SUPPORT)}var ni=X(require("stream"),1);var Us=X(require("stream"),1);function Ep(i,e){let t=0,n=1e3/e,a=null;return function(o,c){let p=Date.now();if(o||p-t>n)return a&&(clearTimeout(a),a=null),t=p,i.apply(null,c);a||(a=setTimeout(()=>(a=null,t=Date.now(),i.apply(null,c)),n-(p-t)))}}var js=Ep;function Cp(i,e){i=i||10;let t=new Array(i),n=new Array(i),a=0,s=0,o;return e=e!==void 0?e:1e3,function(p){let l=Date.now(),u=n[s];o||(o=l),t[a]=p,n[a]=l;let d=s,v=0;for(;d!==a;)v+=t[d++],d=d%i;if(a=(a+1)%i,a===s&&(s=(s+1)%i),l-o<e)return;let b=u&&l-u;return b?Math.round(v*1e3/b):void 0}}var kt=Cp;var Ft=Symbol("internals"),jn=class extends Us.default.Transform{constructor(e){e=m.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(c,p)=>!m.isUndefined(p[c])),super({readableHighWaterMark:e.chunkSize});let t=this,n=this[Ft]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},a=kt(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",c=>{c==="progress"&&(n.isCaptured||(n.isCaptured=!0))});let s=0;n.updateProgress=js(function(){let p=n.length,l=n.bytesSeen,u=l-s;if(!u||t.destroyed)return;let d=a(u);s=l,process.nextTick(()=>{t.emit("progress",{loaded:l,total:p,progress:p?l/p:void 0,bytes:u,rate:d||void 0,estimated:d&&p&&l<=p?(p-l)/d:void 0})})},n.ticksRate);let o=()=>{n.updateProgress(!0)};this.once("end",o),this.once("error",o)}_read(e){let t=this[Ft];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){let a=this,s=this[Ft],o=s.maxRate,c=this.readableHighWaterMark,p=s.timeWindow,l=1e3/p,u=o/l,d=s.minChunkSize!==!1?Math.max(s.minChunkSize,u*.01):0;function v(h,x){let A=Buffer.byteLength(h);s.bytesSeen+=A,s.bytes+=A,s.isCaptured&&s.updateProgress(),a.push(h)?process.nextTick(x):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(x)}}let b=(h,x)=>{let A=Buffer.byteLength(h),w=null,k=c,_,F=0;if(o){let j=Date.now();(!s.ts||(F=j-s.ts)>=p)&&(s.ts=j,_=u-s.
`,Sp=Yi.encode(Me),_p=2,qn=class{constructor(e,t){let{escapeName:n}=this.constructor,a=m.isString(t),s=`Content-Disposition: form-data; name="${n(e)}"${!a&&t.name?`; filename="${n(t.name)}"`:""}${Me}`;a?t=Yi.encode(String(t).replace(/\r?\n|\r\n?/g,Me)):s+=`Content-Type: ${t.type||"application/octet-stream"}${Me}`,this.headers=Yi.encode(s+Me),this.contentLength=a?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+_p,this.name=e,this.value=t}async*encode(){yield this.headers;let{value:e}=this;m.isTypedArray(e)?yield e:yield*Bt(e),yield Sp}static escapeName(e){return String(e).replace(/[\r\n"]/g,t=>({"\r":"%0D","\n":"%0A",'"':"%22"})[t])}},Tp=(i,e,t)=>{let{tag:n="form-data-boundary",size:a=25,boundary:s=n+"-"+m.generateString(a,Rp)}=t||{};if(!m.isFormData(i))throw TypeError("FormData instance required");if(s.length<1||s.length>70)throw Error("boundary must be 10-70 characters long");let o=Yi.encode("--"+s+Me),c=Yi.encode("--"+s+"--"+Me+Me),p=c.byteLength,l=Array.from(i.entries()).map(([d,v])=>{let b=new qn(d,v);return p+=b.size,b});p+=o.byteLength*l.length,p=m.toFiniteNumber(p);let u={"Content-Type":`multipart/form-data; boundary=${s}`};return Number.isFinite(p)&&(u["Content-Length"]=p),e&&e(u),Ls.Readable.from(async function*(){for(let d of l)yield o,yield*d.encode();yield c}())},Ps=Tp;var zs=X(require("stream"),1),In=class extends zs.default.Transform{__transform(e,t,n){this.push(e),n()}_transform(e,t,n){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let a=Buffer.alloc(2);a[0]=120,a[1]=156,this.push(a,t)}this.__transform(e,t,n)}},Ns=In;var kp=(i,e)=>m.isAsyncFn(i)?function(...t){let n=t.pop();i.apply(this,t).then(a=>{try{e?n(null,...e(a)):n(null,a)}catch(s){n(s)}},n)}:i,Ds=kp;var Hs={flush:qe.default.constants.Z_SYNC_FLUSH,finishFlush:qe.default.constants.Z_SYNC_FLUSH},Fp={flush:qe.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:qe.default.constants.BROTLI_OPERATION_FLUSH},Ms=m.isFunction(qe.default.createBrotliDecompress),{http:Bp,https:Op}=Ks.default,jp=/https:?/,Ws=z.protocols.map(i=>i+":");function Up(i){i.beforeRedirects.proxy&&i.beforeRedirects.proxy(i),i.beforeRedirects.config&&i.beforeRedirects.config(i)}function Xs(i,e,t){let n=e;if(!n&&n!==!1){let a=(0,$s.getProxyForUrl)(t);a&&(n=new URL(a))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let s=Buffer.from(n.auth,"utf8").toString("base64");i.headers["Proxy-Authorization"]="Basic "+s}i.headers.host=i.hostname+(i.port?":"+i.port:"");let a=n.hostname||n.host;i.hostname=a,i.host=a,i.port=n.port,i.path=t,n.protocol&&(i.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}i.beforeRedirects.proxy=function(s){Xs(s,e,s.href)}}var qp=typeof process<"u"&&m.kindOf(process)==="process",Ip=i=>new Promise((e,t)=>{let n,a,s=(p,l)=>{a||(a=!0,n&&n(p,l))},o=p=>{s(p),e(p)},c=p=>{s(p,!0),t(p)};i(o,c,p=>n=p).catch(c)}),Qs=qp&&function(e){return Ip(async function(n,a,s){let{data:o,lookup:c,family:p}=e,{responseType:l,responseEncoding:u}=e,d=e.method.toUpperCase(),v,b=!1,h;c&&m.isAsyncFn(c)&&(c=Ds(c,R=>{if(m.isString(R))R=[R,R.indexOf(".")<0?6:4];else if(!m.isArray(R))throw new TypeError("lookup async function must return an array [ip: string, family: number]]");return R}));let x=new Ys.default,A=()=>{e.cancelToken&&e.cancelToken.unsubscribe(w),e.signal&&e.signal.removeEventListener("abort",w),x.removeAllListeners()};s((R,T)=>{v=!0,T&&(b=!0,A())});function w(R){x.emit("abort",!R||R.type?new he(null,e,h):R)}x.once("abort",a),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(w),e.signal&&(e.signal.aborted?w():e.signal.addEventListener("abort",w)));let k=Qe(e.baseURL,e.url),_=new URL(k,"http://localhost"),F=_.protocol||Ws[0];if(F==="data:"){let R;if(d!=="GET")return He(n,a,{status:405,statusText:"method not allowed",headers:{},config:e});try{R=On(e.url,l==="blob",{Blob:e.env&&e.env.Blob})}catch(T){throw g.from(T,g.ERR_BAD_REQUEST,e)}return l==="text"?(R=R.toString(u),(!u||u==="utf8")&&(R=m.stripBOM(
`)?this.buffer="":this.buffer=n.pop();for(let a of n){let s=null;try{s=JSON.parse(a)}catch(o){this.errLogger.write(JSON.stringify(o,Object.getOwnPropertyNames(o))+`
`);continue}this.handleRequest(s).then(o=>{this.sendResponse(o)})}}}async handleRequest(e){let t=[0,null];try{if(!this.agent)throw new Error(`Agent not bound.
`);t[0]=e[0];let n=e[1].func;if(n==="cancelRequest")t[1]=this.cancelRequest(e);else{let a=this.agent[n];if(!a)throw new Error(`Unknown function: ${n}`);let s=a.apply(this.agent,e[1].args);s instanceof Ee?(this.ongoingRequests[e[0]]=s,t[1]=await s,delete this.ongoingRequests[e[0]]):t[1]=s}}catch(n){this.errLogger.write(JSON.stringify(n,Object.getOwnPropertyNames(n))+`
`)}finally{return t}}cancelRequest(e){let t=this.ongoingRequests[e[1].args[0]];return t?(t.cancel(),!0):!1}sendResponse(e){this.outStream.write(JSON.stringify(e)+`
`)}bind(e){this.agent=e;for(let t of er)this.agent.on(t,n=>{this.sendResponse([0,n])})}listen(){this.inStream.on("data",this.handleInput.bind(this))}};var ql=new Yt,ir=new Xt;ir.bind(ql);ir.listen();
/*! Bundled license information:
mime-db/index.js:
(*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015-2022 Douglas Christopher Wilson
* MIT Licensed
*)
mime-types/index.js:
(*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*)
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
*/