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

48 lines
269 KiB
JavaScript
Raw Normal View History

#!/bin/env node
var dr=Object.create;var sn=Object.defineProperty;var fr=Object.getOwnPropertyDescriptor;var hr=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,vr=Object.prototype.hasOwnProperty;var br=(i,e,t)=>e in i?sn(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 gr=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of hr(e))!vr.call(i,a)&&a!==t&&sn(i,a,{get:()=>e[a],enumerable:!(n=fr(e,a))||n.enumerable});return i};var V=(i,e,t)=>(t=i!=null?dr(xr(i)):{},gr(e||!i||!i.__esModule?sn(t,"default",{value:i,enumerable:!0}):t,i));var q=(i,e,t)=>(br(i,typeof e!="symbol"?e+"":e,t),t),on=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var r=(i,e,t)=>(on(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)=>(on(i,e,"write to private field"),n?n.call(i,t):e.set(i,t),t),xt=(i,e,t,n)=>({set _(a){y(i,e,a,t)},get _(){return r(i,e,n)}}),E=(i,e,t)=>(on(i,e,"access private method"),t);var Fa=O((Ql,ka)=>{var Ta=require("stream").Stream,ec=require("util");ka.exports=xe;function xe(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}ec.inherits(xe,Ta);xe.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(xe.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}});xe.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};xe.prototype.resume=function(){this._released||this.release(),this.source.resume()};xe.prototype.pause=function(){this.source.pause()};xe.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(i){this.emit.apply(this,i)}.bind(this)),this._bufferedEvents=[]};xe.prototype.pipe=function(){var i=Ta.prototype.pipe.apply(this,arguments);return this.resume(),i};xe.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)};xe.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 Ua=O((Zl,ja)=>{var ic=require("util"),Oa=require("stream").Stream,Ba=Fa();ja.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}ic.inherits(P,Oa);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 Ba)){var t=Ba.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 Oa.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=gn.prototype.append.bind(this);if(typeof e=="number"&&(e=""+e),os.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 Uc))&&(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)):jc.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"&&bn(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=xn.normalize(e.filepath).replace(/\\/g,"/"):e.filename||i.name||i.path?t=xn.basename(e.filename||i.name||i.path):i.readable&&i.hasOwnProperty("httpVersion")&&(t=xn.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=vn.lookup(i.name)),!t&&i.path&&(t=vn.lookup(i.path)),!t&&i.readable&&i.hasOwnProperty("httpVersion")&&(t=i.headers["content-type"]),!t&&(e.filepath||e.filename)&&(t=vn.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
2023-05-29 02:09:44 +00:00
`).join(`
`+s),i.push(a+"m+"+Ft.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=xp()+e+" "+i[0]}function xp(){return G.inspectOpts.hideDate?"":new Date().toISOString()+" "}function vp(...i){return process.stderr.write(kt.format(...i)+`
`)}function bp(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function gp(){return process.env.DEBUG}function yp(i){i.inspectOpts={};let e=Object.keys(G.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=G.inspectOpts[e[t]]}Ft.exports=Tn()(G);var{formatters:Ss}=Ft.exports;Ss.o=function(i){return this.inspectOpts.colors=this.useColors,kt.inspect(i,this.inspectOpts).split(`
`).map(e=>e.trim()).join(" ")};Ss.O=function(i){return this.inspectOpts.colors=this.useColors,kt.inspect(i,this.inspectOpts)}});var Ts=O((vm,kn)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?kn.exports=Rs():kn.exports=_s()});var Fs=O((bm,ks)=>{var Ji;ks.exports=function(){if(!Ji){try{Ji=Ts()("follow-redirects")}catch{}typeof Ji!="function"&&(Ji=function(){})}Ji.apply(null,arguments)}});var Ps=O((gm,Un)=>{var ii=require("url"),Fn=ii.URL,wp=require("http"),Ep=require("https"),js=require("stream").Writable,Us=require("assert"),Is=Fs(),On=["abort","aborted","connect","error","socket","timeout"],jn=Object.create(null);On.forEach(function(i){jn[i]=function(e,t,n){this._redirectable.emit(i,e,t,n)}});var Cp=Yi("ERR_INVALID_URL","Invalid URL",TypeError),Bs=Yi("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Ap=Yi("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),Rp=Yi("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Sp=Yi("ERR_STREAM_WRITE_AFTER_END","write after end");function re(i,e){js.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()}re.prototype=Object.create(js.prototype);re.prototype.abort=function(){qs(this._currentRequest),this.emit("abort")};re.prototype.write=function(i,e,t){if(this._ending)throw new Sp;if(!ti(i)&&!kp(i))throw new TypeError("data should be a string, Buffer or Uint8Array");if(Ki(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 Rp),this.abort())};re.prototype.end=function(i,e,t){if(Ki(i)?(t=i,i=e=null):Ki(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}};re.prototype.setHeader=function(i,e){this._options.headers[i]=e,this._currentRequest.setHeader(i,e)};re.prototype.removeHeader=function(i){delete this._options.headers[i],this._currentRequest.removeHeader(i)};re.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){re.prototype[i]=function(e,t){return this._currentRequest[i](e,t)}});["aborted","connection","socket"].forEach(function(i){Object.defineProperty(re.prototype,i,{get:function(){return this._currentRequest[i]}})});re.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))}};re.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 On)n.on(a,jn[a]);if(this._currentUrl=/^\//.test(this._options.path
2023-05-29 02:09:44 +00:00
(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 _o(){return{buf:"",write:function(i){this.buf+=i},end:function(i){this.buf+=i},read:function(){return this.buf}}}});var Bo=O((Yf,Fo)=>{Fo.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 Uo=O($t=>{"use strict";$t.byteLength=Qp;$t.toByteArray=el;$t.fromByteArray=nl;var ke=[],fe=[],Xp=typeof Uint8Array<"u"?Uint8Array:Array,ia="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(li=0,Oo=ia.length;li<Oo;++li)ke[li]=ia[li],fe[ia.charCodeAt(li)]=li;var li,Oo;fe["-".charCodeAt(0)]=62;fe["_".charCodeAt(0)]=63;function jo(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 Qp(i){var e=jo(i),t=e[0],n=e[1];return(t+n)*3/4-n}function Zp(i,e,t){return(e+t)*3/4-t}function el(i){var e,t=jo(i),n=t[0],a=t[1],s=new Xp(Zp(i,n,a)),o=0,c=a>0?n-4:n,p;for(p=0;p<c;p+=4)e=fe[i.charCodeAt(p)]<<18|fe[i.charCodeAt(p+1)]<<12|fe[i.charCodeAt(p+2)]<<6|fe[i.charCodeAt(p+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return a===2&&(e=fe[i.charCodeAt(p)]<<2|fe[i.charCodeAt(p+1)]>>4,s[o++]=e&255),a===1&&(e=fe[i.charCodeAt(p)]<<10|fe[i.charCodeAt(p+1)]<<4|fe[i.charCodeAt(p+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function il(i){return ke[i>>18&63]+ke[i>>12&63]+ke[i>>6&63]+ke[i&63]}function tl(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(il(n));return a.join("")}function nl(i){for(var e,t=i.length,n=t%3,a=[],s=16383,o=0,c=t-n;o<c;o+=s)a.push(tl(i,o,o+s>c?c:o+s));return n===1?(e=i[t-1],a.push(ke[e>>2]+ke[e<<4&63]+"==")):n===2&&(e=(i[t-2]<<8)+i[t-1],a.push(ke[e>>10]+ke[e>>4&63]+ke[e<<2&63]+"=")),a.join("")}});var Io=O(ta=>{ta.read=function(i,e,t,n,a){var s,o,c=a*8-n-1,p=(1<<c)-1,l=p>>1,u=-7,m=t?a-1:0,v=t?-1:1,b=i[e+m];for(m+=v,s=b&(1<<-u)-1,b>>=-u,u+=c;u>0;s=s*256+i[e+m],m+=v,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=o*256+i[e+m],m+=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)};ta.write=function(i,e,t,n,a,s){var o,c,p,l=s*8-a-1,u=(1<<l)-1,m=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+m>=1?e+=v/p:e+=v*Math.pow(2,1-m),e*p>=2&&(o++,p/=2),o+m>=u?(c=0,o=u):o+m>=1?(c=(e*p-1)*Math.pow(2,a),o=o+m):(c=e*Math.pow(2,m-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 Qo=O(Li=>{"use strict";var na=Uo(),Ui=Io(),Lo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Li.Buffer=f;Li.SlowBuffer=pl;Li.INSPECT_MAX_BYTES=50;var Vt=2147483647;Li.kMaxLength=Vt;f.TYPED_ARRAY_SUPPORT=al();!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 al(){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]&&$c[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e};var bs=Symbol("internals");function $i(i){return i&&String(i).trim().toLowerCase()}function St(i){return i===!1||i==null?i:d.isArray(i)?i.map(St):String(i)}function Vc(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 Gc=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Rn(i,e,t,n,a){if(d.isFunction(n))return n.call(this,e,t);if(a&&(e=t),!!d.isString(e)){if(d.isString(n))return e.indexOf(n)!==-1;if(d.isRegExp(n))return n.test(e)}}function Jc(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function Kc(i,e){let t=d.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 gi=class{constructor(e){e&&this.set(e)}set(e,t,n){let a=this;function s(c,p,l){let u=$i(p);if(!u)throw new Error("header name must be a non-empty string");let m=d.findKey(a,u);(!m||a[m]===void 0||l===!0||l===void 0&&a[m]!==!1)&&(a[m||p]=St(c))}let o=(c,p)=>d.forEach(c,(l,u)=>s(l,u,p));return d.isPlainObject(e)||e instanceof this.constructor?o(e,t):d.isString(e)&&(e=e.trim())&&!Gc(e)?o(vs(e),t):e!=null&&s(t,e,n),this}get(e,t){if(e=$i(e),e){let n=d.findKey(this,e);if(n){let a=this[n];if(!t)return a;if(t===!0)return Vc(a);if(d.isFunction(t))return t.call(this,a,n);if(d.isRegExp(t))return t.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=$i(e),e){let n=d.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Rn(this,this[n],n,t)))}return!1}delete(e,t){let n=this,a=!1;function s(o){if(o=$i(o),o){let c=d.findKey(n,o);c&&(!t||Rn(n,n[c],c,t))&&(delete n[c],a=!0)}}return d.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||Rn(this,this[s],s,e,!0))&&(delete this[s],a=!0)}return a}normalize(e){let t=this,n={};return d.forEach(this,(a,s)=>{let o=d.findKey(n,s);if(o){t[o]=St(a),delete t[s];return}let c=e?Jc(s):String(s).trim();c!==s&&delete t[s],t[c]=St(a),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return d.forEach(this,(n,a)=>{n!=null&&n!==!1&&(t[a]=e&&d.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[bs]=this[bs]={accessors:{}}).accessors,a=this.prototype;function s(o){let c=$i(o);n[c]||(Kc(a,o),n[c]=!0)}return d.isArray(e)?e.forEach(s):s(e),this}};gi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.freezeMethods(gi.prototype);d.freezeMethods(gi);var N=gi;function Vi(i,e){let t=this||bi,n=e||t,a=N.from(n.headers),s=n.data;return d.forEach(i,function(c){s=c.call(t,s,a.normalize(),e?e.status:void 0)}),a.normalize(),s}function Gi(i){return!!(i&&i.__CANCEL__)}function gs(i,e,t){g.call(this,i??"canceled",g.ERR_CANCELED,e,t),this.name="CanceledError"}d.inherits(gs,g,{__CANCEL__:!0});var ve=gs;function Me(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 Sn(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function _n(i,e){return e?i.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):i}function Ze(i,e){return i&&!Sn(e)?_n(i,e):e}var Xs=V(ws(),1),Qs=V(require("http"),1),Zs=V(require("https"),1),eo=V(require("util"),1),io=V(Ps(),1),Le=V(require("zlib"),1);var ni="1.4.0";function Xi(i){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}var Fp=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function In(i,e,t){let n=t&&t.Blob||z.classes.Blob,a=Xi(i);if(e===void 0&&n&&(e=!0),a==="data"){i=a.length?i.slice(a.length+1):i;let s=Fp.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 ai=V(require("stream"),1);var Ns=V(require("stream"),1);function Bp(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 zs=Bp;function Op(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 m=s,v=0;for(;m!==a;)v+=t[m++],m=m%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 Bt=Op;var Ot=Symbol("internals"),Ln=class extends Ns.default.Transform{constructor(e){e=d.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(c,p)=>!d.isUndefined(p[c])),super({readableHighWaterMark:e.chunkSize});let t=this,n=this[Ot]={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=Bt(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",c=>{c==="progress"&&(n.isCaptured||(n.isCaptured=!0))});let s=0;n.updateProgress=zs(function(){let p=n.length,l=n.bytesSeen,u=l-s;if(!u||t.destroyed)return;let m=a(u);s=l,process.nextTick(()=>{t.emit("progress",{loaded:l,total:p,progress:p?l/p:void 0,bytes:u,rate:m||void 0,estimated:m&&p&&l<=p?(p-l)/m:void 0})})},n.ticksRate);let o=()=>{n.updateProgress(!0)};this.once("end",o),this.once("error",o)}_read(e){let t=this[Ot];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){let a=this,s=this[Ot],o=s.maxRate,c=this.readableHighWaterMark,p=s.timeWindow,l=1e3/p,u=o/l,m=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.
`,Ip=Qi.encode(We),Lp=2,Pn=class{constructor(e,t){let{escapeName:n}=this.constructor,a=d.isString(t),s=`Content-Disposition: form-data; name="${n(e)}"${!a&&t.name?`; filename="${n(t.name)}"`:""}${We}`;a?t=Qi.encode(String(t).replace(/\r?\n|\r\n?/g,We)):s+=`Content-Type: ${t.type||"application/octet-stream"}${We}`,this.headers=Qi.encode(s+We),this.contentLength=a?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+Lp,this.name=e,this.value=t}async*encode(){yield this.headers;let{value:e}=this;d.isTypedArray(e)?yield e:yield*jt(e),yield Ip}static escapeName(e){return String(e).replace(/[\r\n"]/g,t=>({"\r":"%0D","\n":"%0A",'"':"%22"})[t])}},qp=(i,e,t)=>{let{tag:n="form-data-boundary",size:a=25,boundary:s=n+"-"+d.generateString(a,Up)}=t||{};if(!d.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=Qi.encode("--"+s+We),c=Qi.encode("--"+s+"--"+We+We),p=c.byteLength,l=Array.from(i.entries()).map(([m,v])=>{let b=new Pn(m,v);return p+=b.size,b});p+=o.byteLength*l.length,p=d.toFiniteNumber(p);let u={"Content-Type":`multipart/form-data; boundary=${s}`};return Number.isFinite(p)&&(u["Content-Length"]=p),e&&e(u),Ms.Readable.from(async function*(){for(let m of l)yield o,yield*m.encode();yield c}())},Ws=qp;var $s=V(require("stream"),1),zn=class extends $s.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)}},Vs=zn;var Pp=(i,e)=>d.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,Gs=Pp;var Js={flush:Le.default.constants.Z_SYNC_FLUSH,finishFlush:Le.default.constants.Z_SYNC_FLUSH},zp={flush:Le.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Le.default.constants.BROTLI_OPERATION_FLUSH},Ks=d.isFunction(Le.default.createBrotliDecompress),{http:Np,https:Dp}=io.default,Hp=/https:?/,Ys=z.protocols.map(i=>i+":");function Mp(i){i.beforeRedirects.proxy&&i.beforeRedirects.proxy(i),i.beforeRedirects.config&&i.beforeRedirects.config(i)}function no(i,e,t){let n=e;if(!n&&n!==!1){let a=(0,Xs.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){no(s,e,s.href)}}var Wp=typeof process<"u"&&d.kindOf(process)==="process",$p=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)}),ao=Wp&&function(e){return $p(async function(n,a,s){let{data:o,lookup:c,family:p}=e,{responseType:l,responseEncoding:u}=e,m=e.method.toUpperCase(),v,b=!1,h;c&&d.isAsyncFn(c)&&(c=Gs(c,R=>{if(d.isString(R))R=[R,R.indexOf(".")<0?6:4];else if(!d.isArray(R))throw new TypeError("lookup async function must return an array [ip: string, family: number]]");return R}));let x=new to.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 ve(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=Ze(e.baseURL,e.url),_=new URL(k,"http://localhost"),F=_.protocol||Ys[0];if(F==="data:"){let R;if(m!=="GET")return Me(n,a,{status:405,statusText:"method not allowed",headers:{},config:e});try{R=In(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=d.stripBOM(
2023-05-29 02:09:44 +00:00
`)?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 he?(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))+`
2023-05-29 02:09:44 +00:00
`)}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 pr)this.agent.on(t,n=>{this.sendResponse([0,n])})}listen(){this.inStream.on("data",this.handleInput.bind(this))}};var $l=new Zt,lr=new en;lr.bind($l);lr.listen();
2023-05-29 02:09:44 +00:00
/*! 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
*)
*/