varHC=Object.create;varMr=Object.defineProperty;varWC=Object.getOwnPropertyDescriptor;varGC=Object.getOwnPropertyNames;varVC=Object.getPrototypeOf,KC=Object.prototype.hasOwnProperty;varJC=(t,e,n)=>eint?Mr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;varH=(t=>typeofrequire<"u"?require:typeofProxy<"u"?newProxy(t,{get:(e,n)=>(typeofrequire<"u"?require:e)[n]}):t)(function(t){if(typeofrequire<"u")returnrequire.apply(this,arguments);throwError('Dynamic require of "'+t+'" is not supported')});vario=(t,e)=>()=>(t&&(e=t(t=0)),e);varR=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cc=(t,e)=>{for(varnine)Mr(t,n,{get:e[n],enumerable:!0});},nm=(t,e,n,i)=>{if(e&&typeofe=="object"||typeofe=="function")for(letsofGC(e))!KC.call(t,s)&&s!==n&&Mr(t,s,{get:()=>e[s],enumerable:!(i=WC(e,s))||i.enumerable});returnt};varxn=(t,e,n)=>(n=t!=null?HC(VC(t)):{},nm(e||!t||!t.__esModule?Mr(n,"default",{value:t,enumerable:!0}):n,t)),Tc=t=>nm(Mr({},"__esModule",{value:!0}),t);varle=(t,e,n)=>(JC(t,typeofe!="symbol"?e+"":e,n),n),Oc=(t,e,n)=>{if(!e.has(t))throwTypeError("Cannot "+n)};varw=(t,e,n)=>(Oc(t,e,"read from private field"),n?n.call(t):e.get(t)),ce=(t,e,n)=>{if(e.has(t))throwTypeError("Cannot add the same private member more than once");einstanceofWeakSet?e.add(t):e.set(t,n);},ie=(t,e,n,i)=>(Oc(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n);varro=(t,e,n,i)=>({set_(s){ie(t,e,s,n);},get_(){returnw(t,e,i)}}),oe=(t,e,n)=>(Oc(t,e,"access private method"),n);varFc=R((tz,sm)=>{varrm=Object.prototype.toString;sm.exports=function(e){varn=rm.call(e),i=n==="[object Arguments]";returni||(i=n!=="[object Array]"&&e!==null&&typeofe=="object"&&typeofe.length=="number"&&e.length>=0&&rm.call(e.callee)==="[object Function]"),i};});varmm=R((nz,dm)=>{varfm;Object.keys||(zr=Object.prototype.hasOwnProperty,Ic=Object.prototype.toString,om=Fc(),Lc=Object.prototype.propertyIsEnumerable,am=!Lc.call({toString:null},"toString"),cm=Lc.call(function(){},"prototype"),Hr=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ao=function(t){vare=t.constructor;returne&&e.prototype===t},lm={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},um=function(){if(typeofwindow>"u")return!1;for(vartinwindow)try{if(!lm["$"+t]&&zr.call(window,t)&&window[t]!==null&&typeofwindow[t]=="object")try{ao(window[t]);}catch{return!0}}catch{return!0}return!1}(),pm=function(t){if(typeofwindow>"u"||!um)returnao(t);try{returnao(t)}catch{return!1}},fm=function(e){varn=e!==null&&typeofe=="object",i=Ic.call(e)==="[object Function]",s=om(e),r=n&&Ic.call(e)==="[object String]",o=[];if(!n&&!i&&!s)thrownewTypeError("Object.keys called on a non-object");vara=cm&&i;if(r&&e.length>0&&!zr.call(e,0))for(varu=0;u<e.length;++u)o.push(String(u));if(s&&e.length>0)for(varf=0;f<e.length;++f)o.push(String(f));elsefor(varcine)!(a&&c==="prototype")&&zr.call(e,c)&&o.push(String(c));if(am)for(vard=pm(e),g=0;g<Hr.length;++g)!(d&&Hr[g]==="constructor")&&zr.call(e,Hr[g])&&o.push(Hr[g]);returno});varzr,Ic,om,Lc,am,cm,Hr,ao,lm,um,pm;dm.exports=fm;});varlo=R((iz,ym)=>{varZC=Array.prototype.slice,e1=Fc(),hm=Object.keys,co=hm?function(e){returnhm(e)}:mm(),gm=Object.keys;co.shim=function(){if(Object.keys){vare=function(){varn=Object.keys(arguments);returnn&&n.length===arguments.length}(1,2);e||(Object.keys=function(i){returne1(i)?gm(ZC.call(i)):gm(i)});}elseObject.keys=co;returnObject.keys||co};ym.exports=co;});varuo=R((rz,xm)=>{xm.exports=function(){if(typeofSymbol!="function"||typeofObject.getOwnPropertySymbols!="function")return!1;if(typeofSymbol.iterator=="symbol")return!0;vare={},n=Symbol("test"),i=Object(n);if(typeofn=="string"||Object.prototype.toStr
`).map(e=>e.trim()).join(" ")};yv.O=function(t){return this.inspectOpts.colors=this.useColors,Yo.inspect(t,this.inspectOpts)};});var vv=R(($H,pu)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?pu.exports=fv():pu.exports=xv();});var wv=R((BH,bv)=>{var ss;bv.exports=function(){if(!ss){try{ss=vv()("follow-redirects");}catch{}typeof ss!="function"&&(ss=function(){});}ss.apply(null,arguments);};});var Ov=R((DH,gu)=>{var mi=H("url"),fu=mi.URL,VF=H("http"),KF=H("https"),Av=H("stream").Writable,_v=H("assert"),Rv=wv(),mu=["abort","aborted","connect","error","socket","timeout"],hu=Object.create(null);mu.forEach(function(t){hu[t]=function(e,n,i){this._redirectable.emit(t,e,n,i);};});var JF=as("ERR_INVALID_URL","Invalid URL",TypeError),Sv=as("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),YF=as("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),XF=as("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),QF=as("ERR_STREAM_WRITE_AFTER_END","write after end");function Ct(t,e){Av.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var n=this;this._onNativeResponse=function(i){n._processResponse(i);},this._performRequest();}Ct.prototype=Object.create(Av.prototype);Ct.prototype.abort=function(){Tv(this._currentRequest),this.emit("abort");};Ct.prototype.write=function(t,e,n){if(this._ending)throw new QF;if(!hi(t)&&!tI(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(os(e)&&(n=e,e=null),t.length===0){n&&n();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,n)):(this.emit("error",new XF),this.abort());};Ct.prototype.end=function(t,e,n){if(os(t)?(n=t,t=e=null):os(e)&&(n=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,n);else {var i=this,s=this._currentRequest;this.write(t,e,function(){i._ended=!0,s.end(null,null,n);}),this._ending=!0;}};Ct.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e);};Ct.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t);};Ct.prototype.setTimeout=function(t,e){var n=this;function i(o){o.setTimeout(t),o.removeListener("timeout",o.destroy),o.addListener("timeout",o.destroy);}function s(o){n._timeout&&clearTimeout(n._timeout),n._timeout=setTimeout(function(){n.emit("timeout"),r();},t),i(o);}function r(){n._timeout&&(clearTimeout(n._timeout),n._timeout=null),n.removeListener("abort",r),n.removeListener("error",r),n.removeListener("response",r),e&&n.removeListener("timeout",e),n.socket||n._currentRequest.removeListener("socket",s);}return e&&this.on("timeout",e),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",i),this.on("abort",r),this.on("error",r),this.on("response",r),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Ct.prototype[t]=function(e,n){return this._currentRequest[t](e,n)};});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Ct.prototype,t,{get:function(){return this._currentRequest[t]}});});Ct.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e));}};Ct.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e){this.emit("error",new TypeError("Unsupported protocol "+t));return}if(this._options.agents){var n=t.slice(0,-1);this._options.agent=this._options.agents[n];}var i=this._currentRequest=e.request(this._options,this._onNativeResponse);i._redirectable=this;for(var s of mu)i.on(s,hu[s]);if(this._currentUrl=/^\//.test(this._options.path)?mi.
`),re=HD.bind(null,{[nE]:"",[iE]:o,[sE]:T,[rE]:Np,[Up]:D,[oE]:$}),k="";d!==null&&(g===void 0?k=re(d):k=re(Object.assign({},d,{name:g})));let F=a instanceof Function?a:a?pE:uj,U=F().indexOf(":")+1;if(_&&!y)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(b&&typeof b!="function")throw Error(`Unknownmixintype"${typeof b}"-expected"function"`);if(W&&typeof W!="string")throw Error(`UnknownmsgPrefixtype"${typeof W}"-expected"string"`);ND(h,y,_);let z=uE(y,_);return Object.assign(e,{levels:z,[sj]:_,[XD]:i,[JD]:F,[YD]:U,[rE]:Np,[Up]:D,[sE]:T,[ZD]:Z,[ej]:Y,[tj]:u,[nj]:f,[ij]:c,[aj]:c?`,${JSON.stringify(c)}:{`:"",[iE]:o,[rj]:b,[cj]:A,[nE]:k,[oE]:$,[oj]:C,silent:GD,onChild:J,[lj]:W}),Object.setPrototypeOf(e,DD()),UD(e),e[QD](h),e}Dt.exports=Mp;Dt.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=tE(t.dest||process.stdout.fd),eE(t)):eE({dest:tE(t),minLength:0});Dt.exports.transport=Rp();Dt.exports.multistream=ZS();Dt.exports.levels=uE();Dt.exports.stdSerializers=gj;Dt.exports.stdTimeFunctions=Object.assign({},cE);Dt.exports.symbols=lE;Dt.exports.version=VD;Dt.exports.default=Mp;Dt.exports.pino=Mp;});var vE={};Cc(vE,{RotatingFileStream:()=>ja,RotatingFileStreamError:()=>Cs,createStream:()=>qj});async function mE(t){return new Promise(e=>fs$1.access(t,fs$1.constants.F_OK,n=>e(!n)))}function hE(t){return (e,n,i)=>{let s=parseInt(i,10);if(e!=="number"||s!==i||s<=0)throw new Error(`'${t}'optionmustbeapositiveintegernumber`)}}function Hp(t,e){return (n,i,s)=>{if(n!=="string")throw new Error(`Don't know how to handle 'options.${t}' type: ${n}`);i[t]=e(s);}}function xE(t,e,n){let i={};if(i.num=parseInt(t,10),isNaN(i.num))throw new Error(`Unknown 'options.${e}' format: ${t}`);if(i.num<=0)throw new Error(`A positive integer number is expected for 'options.${e}'`);if(i.unit=t.replace(/^[ 0]*/g,"").substr((i.num+"").length,1),i.unit.length===0)throw new Error(`Missing unit for 'options.${e}'`);if(!n[i.unit])throw new Error(`Unknown 'options.${e}' unit: ${i.unit}`);return i}function Wp(t,e,n){if(parseInt(n/t.num,10)*t.num!==n)throw new Error(`An integer divider of ${n} is expected as ${e} for 'options.interval'`)}function kj(t){let e=xE(t,"interval",Oj);switch(e.unit){case"h":Wp(e,"hours",24);break;case"m":Wp(e,"minutes",60);break;case"s":Wp(e,"seconds",60);break}return e}function gE(t){let e=xE(t,"size",Pj);return e.unit==="K"?e.num*1024:e.unit==="M"?e.num*1048576:e.unit==="G"?e.num*1073741824:e.num}function Fj(t){let e={};for(let n in t){let i=t[n],s=typeof i;if(!(n in yE))throw new Error(`Unknownoption:${n}`);e[n]=t[n],yE[n](s,e,i);}return e.path||(e.path=""),e.interval||(delete e.immutable,delete e.initialRotation,delete e.intervalBoundary),e.rotate&&(delete e.history,delete e.immutable,delete e.maxFiles,delete e.maxSize,delete e.intervalBoundary),e.immutable&&delete e.compress,e.intervalBoundary||delete e.initialRotation,e}function Ij(t,e,n){return i=>i?`${t}.${i}${e&&!n?".gz":""}`:t}function Lj(t,e,n){let i=s=>(s>9?"":"0")+s;return (s,r)=>{if(!s)return t;let o=s.getFullYear()+""+i(s.getMonth()+1),a=i(s.getDate()),u=i(s.getHours()),f=i(s.getMinutes());return o+a+"-"+u+f+"-"+i(r)+"-"+t+(e&&!n?".gz":"")}}function qj(t,e){if(typeof e>"u")e={};else if(typeof e!="object")throw new Error(`The"options"argumentmustbeoftypeobject.Receivedtype${typeofe}`);let n=Fj(e),{compress:i,omitExtension:s}=n,r;if(typeof t=="string")r=e.rotate?Ij(t,i!==void 0,s):Lj(t,i!==void 0,s);else if(typeof t=="function")r=t;else throw new Error(`The"filename"argumentmustbeoneoftypestringorfunction.Receivedtype${typeoft}`);return new ja(r,n)}var Cs,ja,Oj,Pj,yE,bE=io(()=>{Cs=class extends Error{constructor(){super("Too many destination file attempts");le(this,"code","RFS-TOO-MANY");}},ja=class extends sr.Writable{constructor(n,i){let{encoding:s,history:r,maxFiles:o,maxSize:a,path:u}=i;super({decodeStrings:!0,defaultEncoding:s});le(this,"createGzip");le(this,"exec");le(this,"file");le(this,"filename");le(this,"finished");le(this,"fsCreateReadStream");le(this,"fsCreateWriteStream");
`),n];}catch(u){if(u.code!=="ENOENT")throw u}for(let u of a)if(u)try{let f=await this.fsStat(u);f.isFile()?o.push({name:u,size:f.size,time:f.ctime.getTime()}):this.emit("warning",new Error(`File'${u}'containedinhistoryisnotaregularfile`));}catch(f){if(f.code!=="ENOENT")throw f}if(o.sort((u,f)=>u.time-f.time),s)for(;o.length>s;){let u=o.shift();await this.unlink(u.name),this.emit("removed",u.name,!0);}if(r)for(;o.reduce((u,f)=>u+f.size,0)>r;){let u=o.shift();await this.unlink(u.name),this.emit("removed",u.name,!1);}await promises.writeFile(i,o.map(u=>u.name).join(`
`,"utf-8"),this.emit("history");}async immutate(n){let{size:i}=this.options,s=this.now();for(let r=1;r<1e3;++r){let o=0,a;this.filename=this.options.path+this.generator(s,r);try{a=await this.fsStat(this.filename);}catch(u){if(u.code!=="ENOENT")throw u}if(a){if(o=a.size,!a.isFile())throw new Error(`Can't write on: '${this.filename}' (it is not a file)`);if(i&&o>=i)continue}if(n)return this.last=this.filename,this.reopen(o);await this.rotated(this.last),this.last=this.filename;return}throw new Cs}async unlink(n){try{await this.fsUnlink(n);}catch(i){if(i.code!=="ENOENT")throw i;this.emit("warning",i);}}};Oj={M:!0,d:!0,h:!0,m:!0,s:!0};Pj={B:!0,G:!0,K:!0,M:!0};yE={encoding:(t,e,n)=>new yI.TextDecoder(n),immutable:()=>{},initialRotation:()=>{},interval:Hp("interval",kj),intervalBoundary:()=>{},maxFiles:hE("maxFiles"),maxSize:Hp("maxSize",gE),mode:()=>{},omitExtension:()=>{},rotate:hE("rotate"),size:Hp("size",gE),teeToStdout:()=>{},compress:(t,e,n)=>{if(!n)throw new Error("A value for 'options.compress' must be specified");if(t==="boolean")return e.compress=(i,s)=>`cat ${i} | gzip -c9 > ${s}`;if(t!=="function"){if(t!=="string")throw new Error(`Don'tknowhowtohandle'options.compress'type:${t}`);if(n!=="gzip")throw new Error(`Don't know how to handle compression method: ${n}`)}},history:t=>{if(t!=="string")throw new Error(`Don'tknowhowtohandle'options.history'type:${t}`)},path:(t,e,n)=>{if(t!=="string")throw new Error(`Don't know how to handle 'options.path' type: ${t}`);n[n.length-1]!==path.sep&&(e.path=n+path.sep);}};});var EE={};Cc(EE,{allLoggers:()=>Ts,rootLogger:()=>He});var Gp,wE,He,Ts,_n=io(()=>{Gp=xn(fE());ys();wE=(bE(),Tc(vE)).createStream("tabby-agent.log",{path:H("path").join(H("os").homedir(),".tabby","agent","logs"),size:"10M",interval:"1d"}),He=wE?(0, Gp.default)(wE):(0, Gp.default)();Ts=[He];He.onChild=t=>{Ts.push(t);};});var _E=R((CG,AE)=>{AE.exports=function(){function t(i,s){function r(){this.constructor=i;}r.prototype=s.prototype,i.prototype=new r;}function e(i,s,r,o,a,u){this.message=i,this.expected=s,this.found=r,this.offset=o,this.line=a,this.column=u,this.name="SyntaxError";}t(e,Error);function n(i){var s=arguments.length>1?arguments[1]:{},r={},o={start:qd},a=qd,f=function(){return em},c=r,d="#",g={type:"literal",value:"#",description:'"#"'},h=void 0,y={type:"any",description:"any character"},b="[",A={type:"literal",value:"[",description:'"["'},_="]",S={type:"literal",value:"]",description:'"]"'},C=function(l){_c(Qe("ObjectPath",l,Ye,Xe));},I=function(l){_c(Qe("ArrayPath",l,Ye,Xe));},q=function(l,m){return l.concat(m)},J=function(l){return [l]},W=function(l){return l},D=".",$={type:"literal",value:".",description:'"."'},G="=",T={type:"literal",value:"=",description:'"="'},Y=function(l,m){_c(Qe("Assign",m,Ye,Xe,l));},Z=function(l){return l.join("")},re=function(l){return l.value},k='"""',F={type:"literal",value:'"""',description:'"\\"\\"\\""'},U=null,z=function(l){return Qe("String",l.join(""),Ye,Xe)},ae='"',Le={type:"literal",value:'"',description:'"\\""'},he="'''",St={type:"literal",value:"'''",description:`"'''"`},si="'",ot={type:"literal",value:"'",description:`"'"`},Oe=function(l){return l},pe=function(l){return l},nn="\\",qe={type:"literal",value:"\\",description:'"\\\\"'},Q=function(){return ""},we="e",K={type:"literal",value:"e",description:'"e"'},de="E",Ee={type:"literal",value:"E",description:'"E"'},Je=function(l,m){return Qe("Float",parseFloat(l+"e"+m),Ye,Xe)},ke=function(l){return Qe("Float",parseFloat(l),Ye,Xe)},oi="+",In={type:"literal",value:"+",description:'"+"'},fd=function(l){return l.join("")},qr="-",$r={type:"literal",value:"-",description:'"-"'},dd=function(l){return "-"+l.join("")},TR=function(l){return Qe("Integer",parseInt(l,10),Ye,Xe)},md="true",OR={type:"literal",value:"true",description:'"true"'},kR=function(){return Qe("Boolean",!0,Ye,Xe)},hd="false",PR={type:"literal",value:"false",description:'"false"'},FR=function(){returnQe("Boolean",!1,Ye,Xe)},IR=function(){returnQe("Array",[],Ye,Xe)},LR=function(l){returnQe("Array",l?[l]:[],Ye,Xe)},qR=function(l){returnQe("
`},kd="\\f",xC={type:"literal",value:"\\f",description:'"\\\\f"'},vC=function(){return "\f"},Pd="\\r",bC={type:"literal",value:"\\r",description:'"\\\\r"'},wC=function(){return "\r"},Fd="\\U",SC={type:"literal",value:"\\U",description:'"\\\\U"'},Id=function(l){return MC(l.join(""))},Ld="\\u",EC={type:"literal",value:"\\u",description:'"\\\\u"'},p=0,ee=0,jr=0,vc={line:1,column:1,seenCR:!1},Qs=0,bc=[],N=0,M={},Zs;if("startRule"in s){if(!(s.startRule in o))throw new Error(`Can't start parsing from rule "`+s.startRule+'".');a=o[s.startRule];}functionYe(){returnwc(ee).line}functionXe(){returnwc(ee).column}functionwc(l){functionm(x,v,E){varP,B;for(P=v;P<E;P++)B=i.charAt(P),B===`
`)},_domwindow:function(){return i("domwindow")},_bigint:function(s){return i("bigint:"+s.toString())},_process:function(){return i("process")},_timer:function(){return i("timer")},_pipe:function(){return i("pipe")},_tcp:function(){return i("tcp")},_udp:function(){return i("udp")},_tty:function(){return i("tty")},_statwatcher:function(){return i("statwatcher")},_securecontext:function(){return i("securecontext")},_connection:function(){return i("connection")},_zlib:function(){return i("zlib")},_context:function(){return i("context")},_nodescript:function(){return i("nodescript")},_httpparser:function(){return i("httpparser")},_dataview:function(){return i("dataview")},_signal:function(){return i("signal")},_fsevent:function(){return i("fsevent")},_tlswrap:function(){return i("tlswrap")}}}function $_(){return {buf:"",write:function(t){this.buf+=t;},end:function(t){this.buf+=t;},read:function(){return this.buf}}}});var N_=R((p5,j_)=>{j_.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 z_=R(pc=>{pc.byteLength=XU;pc.toByteArray=ZU;pc.fromByteArray=nM;var gn=[],Nt=[],YU=typeof Uint8Array<"u"?Uint8Array:Array,ed="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(qi=0,U_=ed.length;qi<U_;++qi)gn[qi]=ed[qi],Nt[ed.charCodeAt(qi)]=qi;var qi,U_;Nt["-".charCodeAt(0)]=62;Nt["_".charCodeAt(0)]=63;function M_(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var i=n===e?0:4-n%4;return [n,i]}function XU(t){var e=M_(t),n=e[0],i=e[1];return (n+i)*3/4-i}function QU(t,e,n){return (e+n)*3/4-n}function ZU(t){var e,n=M_(t),i=n[0],s=n[1],r=new YU(QU(t,i,s)),o=0,a=s>0?i-4:i,u;for(u=0;u<a;u+=4)e=Nt[t.charCodeAt(u)]<<18|Nt[t.charCodeAt(u+1)]<<12|Nt[t.charCodeAt(u+2)]<<6|Nt[t.charCodeAt(u+3)],r[o++]=e>>16&255,r[o++]=e>>8&255,r[o++]=e&255;return s===2&&(e=Nt[t.charCodeAt(u)]<<2|Nt[t.charCodeAt(u+1)]>>4,r[o++]=e&255),s===1&&(e=Nt[t.charCodeAt(u)]<<10|Nt[t.charCodeAt(u+1)]<<4|Nt[t.charCodeAt(u+2)]>>2,r[o++]=e>>8&255,r[o++]=e&255),r}function eM(t){return gn[t>>18&63]+gn[t>>12&63]+gn[t>>6&63]+gn[t&63]}function tM(t,e,n){for(var i,s=[],r=e;r<n;r+=3)i=(t[r]<<16&16711680)+(t[r+1]<<8&65280)+(t[r+2]&255),s.push(eM(i));return s.join("")}function nM(t){for(var e,n=t.length,i=n%3,s=[],r=16383,o=0,a=n-i;o<a;o+=r)s.push(tM(t,o,o+r>a?a:o+r));return i===1?(e=t[n-1],s.push(gn[e>>2]+gn[e<<4&63]+"==")):i===2&&(e=(t[n-2]<<8)+t[n-1],s.push(gn[e>>10]+gn[e>>4&63]+gn[e<<2&63]+"=")),s.join("")}});var H_=R(td=>{td.read=function(t,e,n,i,s){var r,o,a=s*8-i-1,u=(1<<a)-1,f=u>>1,c=-7,d=n?s-1:0,g=n?-1:1,h=t[e+d];for(d+=g,r=h&(1<<-c)-1,h>>=-c,c+=a;c>0;r=r*256+t[e+d],d+=g,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=o*256+t[e+d],d+=g,c-=8);if(r===0)r=1-f;else {if(r===u)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,i),r=r-f;}return (h?-1:1)*o*Math.pow(2,r-i)};td.write=function(t,e,n,i,s,r){var o,a,u,f=r*8-s-1,c=(1<<f)-1,d=c>>1,g=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:r-1,y=i?1:-1,b=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=g/u:e+=g*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=c?(a=0,o=c):o+d>=1?(a=(e*u-1)*Math.pow(2,s),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;t[n+h]=a&255,h+=y,a/=256,s-=8);for(o=o<<s|a,f+=s;f>0;t[n+h]=o&255,h+=y,o/=256,f-=8);t[n+h-y]|=b*128;};});var aR=R(Lr=>{var nd=z_(),Fr=H_(),W_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Lr.Buffer=L;Lr.SlowBuffer=cM;Lr.INSPECT_MAX_BYTES=50;var fc=2147483647;Lr.kMaxLength=fc;L.TYPED_ARRAY_SUPPORT=iM();!L.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 iM(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.set
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),i=o.substring(s+1).trim(),!(!n||e[n]&&mF[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i);}),e};var sv=Symbol("internals");function ns(t){return t&&String(t).trim().toLowerCase()}function Vo(t){return t===!1||t==null?t:O.isArray(t)?t.map(Vo):String(t)}function hF(t){let e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}var gF=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());functionou(t,e,n,i,s){if(O.isFunction(i))returni.call(this,e,n);if(s&&(e=n),!!O.isString(e)){if(O.isString(i))returne.indexOf(i)!==-1;if(O.isRegExp(i))returni.test(e)}}functionyF(t){returnt.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}functionxF(t,e){letn=O.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(s,r,o){returnthis[i].call(this,e,s,r,o)},configurable:!0});});}varZi=class{constructor(e){e&&this.set(e);}set(e,n,i){lets=this;functionr(a,u,f){letc=ns(u);if(!c)thrownewError("header name must be a non-empty string");letd=O.findKey(s,c);(!d||s[d]===void0||f===!0||f===void0&&s[d]!==!1)&&(s[d||u]=Vo(a));}leto=(a,u)=>O.forEach(a,(f,c)=>r(f,c,u));returnO.isPlainObject(e)||einstanceofthis.constructor?o(e,n):O.isString(e)&&(e=e.trim())&&!gF(e)?o(rv(e),n):e!=null&&r(n,e,i),this}get(e,n){if(e=ns(e),e){leti=O.findKey(this,e);if(i){lets=this[i];if(!n)returns;if(n===!0)returnhF(s);if(O.isFunction(n))returnn.call(this,s,i);if(O.isRegExp(n))returnn.exec(s);thrownewTypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ns(e),e){leti=O.findKey(this,e);return!!(i&&this[i]!==void0&&(!n||ou(this,this[i],i,n)))}return!1}delete(e,n){leti=this,s=!1;functionr(o){if(o=ns(o),o){leta=O.findKey(i,o);a&&(!n||ou(i,i[a],a,n))&&(deletei[a],s=!0);}}returnO.isArray(e)?e.forEach(r):r(e),s}clear(e){letn=Object.keys(this),i=n.length,s=!1;for(;i--;){letr=n[i];(!e||ou(this,this[r],r,e,!0))&&(deletethis[r],s=!0);}returns}normalize(e){letn=this,i={};returnO.forEach(this,(s,r)=>{leto=O.findKey(i,r);if(o){n[o]=Vo(s),deleten[r];return}leta=e?yF(r):String(r).trim();a!==r&&deleten[r],n[a]=Vo(s),i[a]=!0;}),this}concat(...e){returnthis.constructor.concat(this,...e)}toJSON(e){letn=Object.create(null);returnO.forEach(this,(i,s)=>{i!=null&&i!==!1&&(n[s]=e&&O.isArray(i)?i.join(", "):i);}),n}[Symbol.iterator](){returnObject.entries(this.toJSON())[Symbol.iterator]()}toString(){returnObject.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`,uI=ls.encode(Mn),pI=2,bu=class{constructor(e,n){let{escapeName:i}=this.constructor,s=O.isString(n),r=`Content-Disposition:form-data;name="${i(e)}"${!s&&n.name?`; filename="${i(n.name)}"`:""}${Mn}`;s?n=ls.encode(String(n).replace(/\r?\n|\r\n?/g,Mn)):r+=`Content-Type:${n.type||"application/octet-stream"}${Mn}`,this.headers=ls.encode(r+Mn),this.contentLength=s?n.byteLength:n.size,this.size=this.headers.byteLength+this.contentLength+pI,this.name=e,this.value=n;}async*encode(){yield this.headers;let{value:e}=this;O.isTypedArray(e)?yield e:yield*ea(e),yield uI;}static escapeName(e){return String(e).replace(/[\r\n"]/g,n=>({"\r":"%0D","\n":"%0A",'"':"%22"})[n])}},fI=(t,e,n)=>{let{tag:i="form-data-boundary",size:s=25,boundary:r=i+"-"+O.generateString(s,lI)}=n||{};if(!O.isFormData(t))throw TypeError("FormData instance required");if(r.length<1||r.length>70)throw Error("boundary must be 10-70 characters long");let o=ls.encode("--"+r+Mn),a=ls.encode("--"+r+"--"+Mn+Mn),u=a.byteLength,f=Array.from(t.entries()).map(([d,g])=>{let h=new bu(d,g);return u+=h.size,h});u+=o.byteLength*f.length,u=O.toFiniteNumber(u);let c={"Content-Type":`multipart/form-data;boundary=${r}`};return Number.isFinite(u)&&(c["Content-Length"]=u),e&&e(c),sr.Readable.from(async function*(){for(let d of f)yield o,yield*d.encode();yield a;}())},Fv=fI;var wu=class extends sr__default.default.Transform{__transform(e,n,i){this.push(e),i();}_transform(e,n,i){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let s=Buffer.alloc(2);s[0]=120,s[1]=156,this.push(s,n);}this.__transform(e,n,i);}},Iv=wu;var mI=(t,e)=>O.isAsyncFn(t)?function(...n){let i=n.pop();t.apply(this,n).then(s=>{try{e?i(null,...e(s)):i(null,s);}catch(r){i(r);}},i);}:t,Lv=mI;var qv={flush:zn__default.default.constants.Z_SYNC_FLUSH,finishFlush:zn__default.default.constants.Z_SYNC_FLUSH},vI={flush:zn__default.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:zn__default.default.constants.BROTLI_OPERATION_FLUSH},$v=O.isFunction(zn__default.default.createBrotliDecompress),{http:bI,https:wI}=jv.default,SI=/https:?/,Bv=Ie.protocols.map(t=>t+":");function EI(t){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t);}function Nv(t,e,n){let i=e;if(!i&&i!==!1){let s=(0, Dv.getProxyForUrl)(n);s&&(i=new URL(s));}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let r=Buffer.from(i.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+r;}t.headers.host=t.hostname+(t.port?":"+t.port:"");let s=i.hostname||i.host;t.hostname=s,t.host=s,t.port=i.port,t.path=n,i.protocol&&(t.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`);}t.beforeRedirects.proxy=function(r){Nv(r,e,r.href);};}var AI=typeof process<"u"&&O.kindOf(process)==="process",_I=t=>new Promise((e,n)=>{let i,s,r=(u,f)=>{s||(s=!0,i&&i(u,f));},o=u=>{r(u),e(u);},a=u=>{r(u,!0),n(u);};t(o,a,u=>i=u).catch(a);}),Uv=AI&&function(e){return _I(async function(i,s,r){let{data:o,lookup:a,family:u}=e,{responseType:f,responseEncoding:c}=e,d=e.method.toUpperCase(),g,h=!1,y;a&&O.isAsyncFn(a)&&(a=Lv(a,U=>{if(O.isString(U))U=[U,U.indexOf(".")<0?6:4];else if(!O.isArray(U))throw new TypeError("lookup async function must return an array [ip: string, family: number]]");return U}));let b=new xI__default.default,A=()=>{e.cancelToken&&e.cancelToken.unsubscribe(_),e.signal&&e.signal.removeEventListener("abort",_),b.removeAllListeners();};r((U,z)=>{g=!0,z&&(h=!0,A());});function _(U){b.emit("abort",!U||U.type?new Ht(null,e,y):U);}b.once("abort",s),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(_),e.signal&&(e.signal.aborted?_():e.signal.addEventListener("abort",_)));let S=fi(e.baseURL,e.url),C=new URL(S,"http://localhost"),I=C.protocol||Bv[0];if(I==="data:"){let U;if(d!=="GET")return Un(i,s,{status:405,statusText:"method not allowed",headers:{},config:e});try{U=yu(e.url,f==="blob",{Blob:e.env&&e.env.Blob});}catch(z){throw ne.from(z,ne.ERR_BAD_REQUEST,e)}ret
`)?this.buffer="":this.buffer=i.pop();for(let s of i){let r=null;try{r=JSON.parse(s);}catch(o){this.logger.error({error:o},`Failedtoparserequest:${s}`);continue}this.logger.debug({request:r},"Received request"),this.handleRequest(r).then(o=>{this.sendResponse(o),this.logger.debug({response:o},"Sent response");});}}}async handleRequest(e){let n=[0,null];try{if(!this.agent)throw new Error(`Agentnotbound.
`);n[0]=e[0];let i=e[1].func;if(i==="cancelRequest")n[1]=this.cancelRequest(e);else {let s=this.agent[i];if(!s)throw new Error(`Unknownfunction:${i}`);let r=s.apply(this.agent,e[1].args);typeof r=="object"&&typeof r.then=="function"?(this.ongoingRequests[e[0]]=r,n[1]=await r,delete this.ongoingRequests[e[0]]):n[1]=r;}}catch(i){this.logger.error({error:i,request:e},"Failed to handle request");}finally{return n}}cancelRequest(e){let n=this.ongoingRequests[e[1].args[0]];return n?(n instanceof at&&n.cancel(),delete this.ongoingRequests[e[1].args[0]],!0):!1}sendResponse(e){this.outStream.write(JSON.stringify(e)+`
`);}bind(e){this.agent=e;for(let n of RR)this.agent.on(n,i=>{this.sendResponse([0,i]);});}listen(){this.inStream.on("data",this.handleInput.bind(this));}};var CR=new xc;yc.create().then(t=>{CR.bind(t),CR.listen();});