UNPKG

create-update

Version:

Create Update app with one command

1 lines 217 kB
"use strict";var cd=Object.create;var ts=Object.defineProperty;var fd=Object.getOwnPropertyDescriptor;var ld=Object.getOwnPropertyNames;var dd=Object.getPrototypeOf,ud=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),md=(t,e)=>{for(var r in e)ts(t,r,{get:e[r],enumerable:!0})},ca=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ld(e))!ud.call(t,i)&&i!==r&&ts(t,i,{get:()=>e[i],enumerable:!(s=fd(e,i))||s.enumerable});return t};var x=(t,e,r)=>(r=t!=null?cd(dd(t)):{},ca(e||!t||!t.__esModule?ts(r,"default",{value:t,enumerable:!0}):r,t)),pd=t=>ca(ts({},"__esModule",{value:!0}),t);var Lc=k((lo,uo)=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});function Fp(t){return t.encrypted}var fo=(t,e)=>{let r;typeof e=="function"?r={connect:e}:r=e;let s=typeof r.connect=="function",i=typeof r.secureConnect=="function",n=typeof r.close=="function",o=()=>{s&&r.connect(),Fp(t)&&i&&(t.authorized?r.secureConnect():t.authorizationError||t.once("secureConnect",r.secureConnect)),n&&t.once("close",r.close)};t.writable&&!t.connecting?o():t.connecting?t.once("connect",o):t.destroyed&&n&&r.close(t._hadError)};lo.default=fo;uo.exports=fo;uo.exports.default=fo});var nf=k((NE,sf)=>{"use strict";var hy=new Set([200,203,204,206,300,301,308,404,405,410,414,501]),cy=new Set([200,203,204,300,301,302,303,307,308,404,405,410,414,501]),fy=new Set([500,502,503,504]),ly={date:!0,connection:!0,"keep-alive":!0,"proxy-authenticate":!0,"proxy-authorization":!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0},dy={"content-length":!0,"content-encoding":!0,"transfer-encoding":!0,"content-range":!0};function yt(t){let e=parseInt(t,10);return isFinite(e)?e:0}function uy(t){return t?fy.has(t.status):!0}function _o(t){let e={};if(!t)return e;let r=t.trim().split(/,/);for(let s of r){let[i,n]=s.split(/=/,2);e[i.trim()]=n===void 0?!0:n.trim().replace(/^"|"$/g,"")}return e}function my(t){let e=[];for(let r in t){let s=t[r];e.push(s===!0?r:r+"="+s)}if(e.length)return e.join(", ")}sf.exports=class{constructor(e,r,{shared:s,cacheHeuristic:i,immutableMinTimeToLive:n,ignoreCargoCult:o,_fromObject:a}={}){if(a){this._fromObject(a);return}if(!r||!r.headers)throw Error("Response headers missing");this._assertRequestHasHeaders(e),this._responseTime=this.now(),this._isShared=s!==!1,this._cacheHeuristic=i!==void 0?i:.1,this._immutableMinTtl=n!==void 0?n:24*3600*1e3,this._status="status"in r?r.status:200,this._resHeaders=r.headers,this._rescc=_o(r.headers["cache-control"]),this._method="method"in e?e.method:"GET",this._url=e.url,this._host=e.headers.host,this._noAuthorization=!e.headers.authorization,this._reqHeaders=r.headers.vary?e.headers:null,this._reqcc=_o(e.headers["cache-control"]),o&&"pre-check"in this._rescc&&"post-check"in this._rescc&&(delete this._rescc["pre-check"],delete this._rescc["post-check"],delete this._rescc["no-cache"],delete this._rescc["no-store"],delete this._rescc["must-revalidate"],this._resHeaders=Object.assign({},this._resHeaders,{"cache-control":my(this._rescc)}),delete this._resHeaders.expires,delete this._resHeaders.pragma),r.headers["cache-control"]==null&&/no-cache/.test(r.headers.pragma)&&(this._rescc["no-cache"]=!0)}now(){return Date.now()}storable(){return!!(!this._reqcc["no-store"]&&(this._method==="GET"||this._method==="HEAD"||this._method==="POST"&&this._hasExplicitExpiration())&&cy.has(this._status)&&!this._rescc["no-store"]&&(!this._isShared||!this._rescc.private)&&(!this._isShared||this._noAuthorization||this._allowsStoringAuthenticated())&&(this._resHeaders.expires||this._rescc["max-age"]||this._isShared&&this._rescc["s-maxage"]||this._rescc.public||hy.has(this._status)))}_hasExplicitExpiration(){return this._isShared&&this._rescc["s-maxage"]||this._rescc["max-age"]||this._resHeaders.expires}_assertRequestHasHeaders(e){if(!e||!e.headers)throw Error("Request headers missing")}satisfiesWithoutRevalidation(e){this._assertRequestHasHeaders(e);let r=_o(e.headers["cache-control"]);return r["no-cache"]||/no-cache/.test(e.headers.pragma)||r["max-age"]&&this.age()>r["max-age"]||r["min-fresh"]&&this.timeToLive()<1e3*r["min-fresh"]||this.stale()&&!(r["max-stale"]&&!this._rescc["must-revalidate"]&&(r["max-stale"]===!0||r["max-stale"]>this.age()-this.maxAge()))?!1:this._requestMatches(e,!1)}_requestMatches(e,r){return(!this._url||this._url===e.url)&&this._host===e.headers.host&&(!e.method||this._method===e.method||r&&e.method==="HEAD")&&this._varyMatches(e)}_allowsStoringAuthenticated(){return this._rescc["must-revalidate"]||this._rescc.public||this._rescc["s-maxage"]}_varyMatches(e){if(!this._resHeaders.vary)return!0;if(this._resHeaders.vary==="*")return!1;let r=this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);for(let s of r)if(e.headers[s]!==this._reqHeaders[s])return!1;return!0}_copyWithoutHopByHopHeaders(e){let r={};for(let s in e)ly[s]||(r[s]=e[s]);if(e.connection){let s=e.connection.trim().split(/\s*,\s*/);for(let i of s)delete r[i]}if(r.warning){let s=r.warning.split(/,/).filter(i=>!/^\s*1[0-9][0-9]/.test(i));s.length?r.warning=s.join(",").trim():delete r.warning}return r}responseHeaders(){let e=this._copyWithoutHopByHopHeaders(this._resHeaders),r=this.age();return r>3600*24&&!this._hasExplicitExpiration()&&this.maxAge()>3600*24&&(e.warning=(e.warning?`${e.warning}, `:"")+'113 - "rfc7234 5.5.4"'),e.age=`${Math.round(r)}`,e.date=new Date(this.now()).toUTCString(),e}date(){let e=Date.parse(this._resHeaders.date);return isFinite(e)?e:this._responseTime}age(){let e=this._ageValue(),r=(this.now()-this._responseTime)/1e3;return e+r}_ageValue(){return yt(this._resHeaders.age)}maxAge(){if(!this.storable()||this._rescc["no-cache"]||this._isShared&&this._resHeaders["set-cookie"]&&!this._rescc.public&&!this._rescc.immutable||this._resHeaders.vary==="*")return 0;if(this._isShared){if(this._rescc["proxy-revalidate"])return 0;if(this._rescc["s-maxage"])return yt(this._rescc["s-maxage"])}if(this._rescc["max-age"])return yt(this._rescc["max-age"]);let e=this._rescc.immutable?this._immutableMinTtl:0,r=this.date();if(this._resHeaders.expires){let s=Date.parse(this._resHeaders.expires);return Number.isNaN(s)||s<r?0:Math.max(e,(s-r)/1e3)}if(this._resHeaders["last-modified"]){let s=Date.parse(this._resHeaders["last-modified"]);if(isFinite(s)&&r>s)return Math.max(e,(r-s)/1e3*this._cacheHeuristic)}return e}timeToLive(){let e=this.maxAge()-this.age(),r=e+yt(this._rescc["stale-if-error"]),s=e+yt(this._rescc["stale-while-revalidate"]);return Math.max(0,e,r,s)*1e3}stale(){return this.maxAge()<=this.age()}_useStaleIfError(){return this.maxAge()+yt(this._rescc["stale-if-error"])>this.age()}useStaleWhileRevalidate(){return this.maxAge()+yt(this._rescc["stale-while-revalidate"])>this.age()}static fromObject(e){return new this(void 0,void 0,{_fromObject:e})}_fromObject(e){if(this._responseTime)throw Error("Reinitialized");if(!e||e.v!==1)throw Error("Invalid serialization");this._responseTime=e.t,this._isShared=e.sh,this._cacheHeuristic=e.ch,this._immutableMinTtl=e.imm!==void 0?e.imm:24*3600*1e3,this._status=e.st,this._resHeaders=e.resh,this._rescc=e.rescc,this._method=e.m,this._url=e.u,this._host=e.h,this._noAuthorization=e.a,this._reqHeaders=e.reqh,this._reqcc=e.reqcc}toObject(){return{v:1,t:this._responseTime,sh:this._isShared,ch:this._cacheHeuristic,imm:this._immutableMinTtl,st:this._status,resh:this._resHeaders,rescc:this._rescc,m:this._method,u:this._url,h:this._host,a:this._noAuthorization,reqh:this._reqHeaders,reqcc:this._reqcc}}revalidationHeaders(e){this._assertRequestHasHeaders(e);let r=this._copyWithoutHopByHopHeaders(e.headers);if(delete r["if-range"],!this._requestMatches(e,!0)||!this.storable())return delete r["if-none-match"],delete r["if-modified-since"],r;if(this._resHeaders.etag&&(r["if-none-match"]=r["if-none-match"]?`${r["if-none-match"]}, ${this._resHeaders.etag}`:this._resHeaders.etag),r["accept-ranges"]||r["if-match"]||r["if-unmodified-since"]||this._method&&this._method!="GET"){if(delete r["if-modified-since"],r["if-none-match"]){let i=r["if-none-match"].split(/,/).filter(n=>!/^\s*W\//.test(n));i.length?r["if-none-match"]=i.join(",").trim():delete r["if-none-match"]}}else this._resHeaders["last-modified"]&&!r["if-modified-since"]&&(r["if-modified-since"]=this._resHeaders["last-modified"]);return r}revalidatedPolicy(e,r){if(this._assertRequestHasHeaders(e),this._useStaleIfError()&&uy(r))return{modified:!1,matches:!1,policy:this};if(!r||!r.headers)throw Error("Response headers missing");let s=!1;if(r.status!==void 0&&r.status!=304?s=!1:r.headers.etag&&!/^\s*W\//.test(r.headers.etag)?s=this._resHeaders.etag&&this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag:this._resHeaders.etag&&r.headers.etag?s=this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag.replace(/^\s*W\//,""):this._resHeaders["last-modified"]?s=this._resHeaders["last-modified"]===r.headers["last-modified"]:!this._resHeaders.etag&&!this._resHeaders["last-modified"]&&!r.headers.etag&&!r.headers["last-modified"]&&(s=!0),!s)return{policy:new this.constructor(e,r),modified:r.status!=304,matches:!1};let i={};for(let o in this._resHeaders)i[o]=o in r.headers&&!dy[o]?r.headers[o]:this._resHeaders[o];let n=Object.assign({},r,{status:this._status,method:this._method,headers:i});return{policy:new this.constructor(e,n,{shared:this._isShared,cacheHeuristic:this._cacheHeuristic,immutableMinTimeToLive:this._immutableMinTtl}),modified:!1,matches:!0}}}});var af=k(Eo=>{"use strict";Eo.stringify=function t(e){if(typeof e>"u")return e;if(e&&Buffer.isBuffer(e))return JSON.stringify(":base64:"+e.toString("base64"));if(e&&e.toJSON&&(e=e.toJSON()),e&&typeof e=="object"){var r="",s=Array.isArray(e);r=s?"[":"{";var i=!0;for(var n in e){var o=typeof e[n]=="function"||!s&&typeof e[n]>"u";Object.hasOwnProperty.call(e,n)&&!o&&(i||(r+=","),i=!1,s?e[n]==null?r+="null":r+=t(e[n]):e[n]!==void 0&&(r+=t(n)+":"+t(e[n])))}return r+=s?"]":"}",r}else return typeof e=="string"?JSON.stringify(/^:/.test(e)?":"+e:e):typeof e>"u"?"null":JSON.stringify(e)};Eo.parse=function(t){return JSON.parse(t,function(e,r){return typeof r=="string"?/^:base64:/.test(r)?Buffer.from(r.substring(8),"base64"):/^:/.test(r)?r.substring(1):r:r})}});var lf=k((vE,ff)=>{"use strict";var py=require("events"),hf=af(),yy=t=>{let e={redis:"@keyv/redis",rediss:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql",etcd:"@keyv/etcd",offline:"@keyv/offline",tiered:"@keyv/tiered"};if(t.adapter||t.uri){let r=t.adapter||/^[^:+]*/.exec(t.uri)[0];return new(require(e[r]))(t)}return new Map},cf=["sqlite","postgres","mysql","mongo","redis","tiered"],So=class extends py{constructor(e,{emitErrors:r=!0,...s}={}){if(super(),this.opts={namespace:"keyv",serialize:hf.stringify,deserialize:hf.parse,...typeof e=="string"?{uri:e}:e,...s},!this.opts.store){let n={...this.opts};this.opts.store=yy(n)}if(this.opts.compression){let n=this.opts.compression;this.opts.serialize=n.serialize.bind(n),this.opts.deserialize=n.deserialize.bind(n)}typeof this.opts.store.on=="function"&&r&&this.opts.store.on("error",n=>this.emit("error",n)),this.opts.store.namespace=this.opts.namespace;let i=n=>async function*(){for await(let[o,a]of typeof n=="function"?n(this.opts.store.namespace):n){let h=await this.opts.deserialize(a);if(!(this.opts.store.namespace&&!o.includes(this.opts.store.namespace))){if(typeof h.expires=="number"&&Date.now()>h.expires){this.delete(o);continue}yield[this._getKeyUnprefix(o),h.value]}}};typeof this.opts.store[Symbol.iterator]=="function"&&this.opts.store instanceof Map?this.iterator=i(this.opts.store):typeof this.opts.store.iterator=="function"&&this.opts.store.opts&&this._checkIterableAdaptar()&&(this.iterator=i(this.opts.store.iterator.bind(this.opts.store)))}_checkIterableAdaptar(){return cf.includes(this.opts.store.opts.dialect)||cf.findIndex(e=>this.opts.store.opts.url.includes(e))>=0}_getKeyPrefix(e){return`${this.opts.namespace}:${e}`}_getKeyPrefixArray(e){return e.map(r=>`${this.opts.namespace}:${r}`)}_getKeyUnprefix(e){return e.split(":").splice(1).join(":")}get(e,r){let{store:s}=this.opts,i=Array.isArray(e),n=i?this._getKeyPrefixArray(e):this._getKeyPrefix(e);if(i&&s.getMany===void 0){let o=[];for(let a of n)o.push(Promise.resolve().then(()=>s.get(a)).then(h=>typeof h=="string"?this.opts.deserialize(h):this.opts.compression?this.opts.deserialize(h):h).then(h=>{if(h!=null)return typeof h.expires=="number"&&Date.now()>h.expires?this.delete(a).then(()=>{}):r&&r.raw?h:h.value}));return Promise.allSettled(o).then(a=>{let h=[];for(let f of a)h.push(f.value);return h})}return Promise.resolve().then(()=>i?s.getMany(n):s.get(n)).then(o=>typeof o=="string"?this.opts.deserialize(o):this.opts.compression?this.opts.deserialize(o):o).then(o=>{if(o!=null)return i?o.map((a,h)=>{if(typeof a=="string"&&(a=this.opts.deserialize(a)),a!=null){if(typeof a.expires=="number"&&Date.now()>a.expires){this.delete(e[h]).then(()=>{});return}return r&&r.raw?a:a.value}}):typeof o.expires=="number"&&Date.now()>o.expires?this.delete(e).then(()=>{}):r&&r.raw?o:o.value})}set(e,r,s){let i=this._getKeyPrefix(e);typeof s>"u"&&(s=this.opts.ttl),s===0&&(s=void 0);let{store:n}=this.opts;return Promise.resolve().then(()=>{let o=typeof s=="number"?Date.now()+s:null;return typeof r=="symbol"&&this.emit("error","symbol cannot be serialized"),r={value:r,expires:o},this.opts.serialize(r)}).then(o=>n.set(i,o,s)).then(()=>!0)}delete(e){let{store:r}=this.opts;if(Array.isArray(e)){let i=this._getKeyPrefixArray(e);if(r.deleteMany===void 0){let n=[];for(let o of i)n.push(r.delete(o));return Promise.allSettled(n).then(o=>o.every(a=>a.value===!0))}return Promise.resolve().then(()=>r.deleteMany(i))}let s=this._getKeyPrefix(e);return Promise.resolve().then(()=>r.delete(s))}clear(){let{store:e}=this.opts;return Promise.resolve().then(()=>e.clear())}has(e){let r=this._getKeyPrefix(e),{store:s}=this.opts;return Promise.resolve().then(async()=>typeof s.has=="function"?s.has(r):await s.get(r)!==void 0)}disconnect(){let{store:e}=this.opts;if(typeof e.disconnect=="function")return e.disconnect()}};ff.exports=So});var gf=k((WE,yf)=>{"use strict";var Ey=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];yf.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat(Ey)),s={};for(let i of r)i in e||(s[i]={get(){let n=t[i];return typeof n=="function"?n.bind(t):n},set(n){t[i]=n},enumerable:!0,configurable:!1});return Object.defineProperties(e,s),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var bf=k((GE,wf)=>{"use strict";var{Transform:Sy,PassThrough:xy}=require("stream"),Oo=require("zlib"),Ry=gf();wf.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof Oo.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let s=!0,i=new Sy({transform(a,h,f){s=!1,f(null,a)},flush(a){a()}}),n=new xy({autoDestroy:!1,destroy(a,h){t.destroy(),h(a)}}),o=r?Oo.createBrotliDecompress():Oo.createUnzip();return o.once("error",a=>{if(s&&!t.readable){n.end();return}n.destroy(a)}),Ry(t,n),t.pipe(i).pipe(o).pipe(n),n}});var Bo=k((cS,zf)=>{"use strict";var Mo=class{constructor(e={}){if(!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(e,r){if(this.cache.set(e,r),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction=="function")for(let[s,i]of this.oldCache.entries())this.onEviction(s,i);this.oldCache=this.cache,this.cache=new Map}}get(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e)){let r=this.oldCache.get(e);return this.oldCache.delete(e),this._set(e,r),r}}set(e,r){return this.cache.has(e)?this.cache.set(e,r):this._set(e,r),this}has(e){return this.cache.has(e)||this.oldCache.has(e)}peek(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e))return this.oldCache.get(e)}delete(e){let r=this.cache.delete(e);return r&&this._size--,this.oldCache.delete(e)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache)yield e;for(let e of this.oldCache){let[r]=e;this.cache.has(r)||(yield e)}}get size(){let e=0;for(let r of this.oldCache.keys())this.cache.has(r)||e++;return Math.min(this._size+e,this.maxSize)}};zf.exports=Mo});var Fo=k((fS,jf)=>{"use strict";jf.exports=t=>{if(t.listenerCount("error")!==0)return t;t.__destroy=t._destroy,t._destroy=(...r)=>{let s=r.pop();t.__destroy(...r,async i=>{await Promise.resolve(),s(i)})};let e=r=>{Promise.resolve().then(()=>{t.emit("error",r)})};return t.once("error",e),Promise.resolve().then(()=>{t.off("error",e)}),t}});var wt=k((lS,Kf)=>{"use strict";var{URL:qf}=require("url"),Hy=require("events"),zy=require("tls"),jy=require("http2"),qy=Bo(),$y=Fo(),W=Symbol("currentStreamCount"),$f=Symbol("request"),G=Symbol("cachedOriginSet"),Xe=Symbol("gracefullyClosing"),wi=Symbol("length"),Wf=["createConnection","maxDeflateDynamicTableSize","maxSettings","maxSessionMemory","maxHeaderListPairs","maxOutstandingPings","maxReservedRemoteStreams","maxSendHeaderBlockLength","paddingStrategy","peerMaxConcurrentStreams","settings","family","localAddress","rejectUnauthorized","pskCallback","minDHSize","path","socket","ca","cert","sigalgs","ciphers","clientCertEngine","crl","dhparam","ecdhCurve","honorCipherOrder","key","privateKeyEngine","privateKeyIdentifier","maxVersion","minVersion","pfx","secureOptions","secureProtocol","sessionIdContext","ticketKeys"],Wy=(t,e,r)=>{let s=0,i=t.length;for(;s<i;){let n=s+i>>>1;r(t[n],e)?s=n+1:i=n}return s},Gy=(t,e)=>t.remoteSettings.maxConcurrentStreams>e.remoteSettings.maxConcurrentStreams,Uo=(t,e)=>{for(let r=0;r<t.length;r++){let s=t[r];s[G].length>0&&s[G].length<e[G].length&&s[G].every(i=>e[G].includes(i))&&s[W]+e[W]<=e.remoteSettings.maxConcurrentStreams&&Vf(s)}},Gf=(t,e)=>{for(let r=0;r<t.length;r++){let s=t[r];if(e[G].length>0&&e[G].length<s[G].length&&e[G].every(i=>s[G].includes(i))&&e[W]+s[W]<=s.remoteSettings.maxConcurrentStreams)return Vf(e),!0}return!1},Vf=t=>{t[Xe]=!0,t[W]===0&&t.close()},Gt=class t extends Hy{constructor({timeout:e=0,maxSessions:r=Number.POSITIVE_INFINITY,maxEmptySessions:s=10,maxCachedTlsSessions:i=100}={}){super(),this.sessions={},this.queue={},this.timeout=e,this.maxSessions=r,this.maxEmptySessions=s,this._emptySessionCount=0,this._sessionCount=0,this.settings={enablePush:!1,initialWindowSize:1024*1024*32},this.tlsSessionCache=new qy({maxSize:i})}get protocol(){return"https:"}normalizeOptions(e){let r="";for(let s=0;s<Wf.length;s++){let i=Wf[s];r+=":",e&&e[i]!==void 0&&(r+=e[i])}return r}_processQueue(){if(this._sessionCount>=this.maxSessions){this.closeEmptySessions(this.maxSessions-this._sessionCount+1);return}for(let e in this.queue)for(let r in this.queue[e]){let s=this.queue[e][r];s.completed||(s.completed=!0,s())}}_isBetterSession(e,r){return e>r}_accept(e,r,s,i){let n=0;for(;n<r.length&&e[W]<e.remoteSettings.maxConcurrentStreams;)r[n].resolve(e),n++;r.splice(0,n),r.length>0&&(this.getSession(s,i,r),r.length=0)}getSession(e,r,s){return new Promise((i,n)=>{Array.isArray(s)&&s.length>0?(s=[...s],i()):s=[{resolve:i,reject:n}];try{if(typeof e=="string")e=new qf(e);else if(!(e instanceof qf))throw new TypeError("The `origin` argument needs to be a string or an URL object");if(r){let{servername:l}=r,{hostname:m}=e;if(l&&m!==l)throw new Error(`Origin ${m} differs from servername ${l}`)}}catch(l){for(let m=0;m<s.length;m++)s[m].reject(l);return}let o=this.normalizeOptions(r),a=e.origin;if(o in this.sessions){let l=this.sessions[o],m=-1,u=-1,g;for(let b=0;b<l.length;b++){let d=l[b],_=d.remoteSettings.maxConcurrentStreams;if(_<m)break;if(!d[G].includes(a))continue;let y=d[W];y>=_||d[Xe]||d.destroyed||(g||(m=_),this._isBetterSession(y,u)&&(g=d,u=y))}if(g){this._accept(g,s,a,r);return}}if(o in this.queue){if(a in this.queue[o]){this.queue[o][a].listeners.push(...s);return}}else this.queue[o]={[wi]:0};let h=()=>{o in this.queue&&this.queue[o][a]===f&&(delete this.queue[o][a],--this.queue[o][wi]===0&&delete this.queue[o])},f=async()=>{this._sessionCount++;let l=`${a}:${o}`,m=!1,u;try{let g={...r};g.settings===void 0&&(g.settings=this.settings),g.session===void 0&&(g.session=this.tlsSessionCache.get(l)),u=await(g.createConnection||this.createConnection).call(this,e,g),g.createConnection=()=>u;let d=jy.connect(e,g);d[W]=0,d[Xe]=!1;let _=()=>{let{socket:E}=d,R;return E.servername===!1?(E.servername=E.remoteAddress,R=d.originSet,E.servername=!1):R=d.originSet,R},y=()=>d[W]<d.remoteSettings.maxConcurrentStreams;d.socket.once("session",E=>{this.tlsSessionCache.set(l,E)}),d.once("error",E=>{for(let R=0;R<s.length;R++)s[R].reject(E);this.tlsSessionCache.delete(l)}),d.setTimeout(this.timeout,()=>{d.destroy()}),d.once("close",()=>{if(this._sessionCount--,m){this._emptySessionCount--;let E=this.sessions[o];E.length===1?delete this.sessions[o]:E.splice(E.indexOf(d),1)}else{h();let E=new Error("Session closed without receiving a SETTINGS frame");E.code="HTTP2WRAPPER_NOSETTINGS";for(let R=0;R<s.length;R++)s[R].reject(E)}this._processQueue()});let T=()=>{let E=this.queue[o];if(!E)return;let R=d[G];for(let v=0;v<R.length;v++){let V=R[v];if(V in E){let{listeners:ve,completed:hd}=E[V],es=0;for(;es<ve.length&&y();)ve[es].resolve(d),es++;if(E[V].listeners.splice(0,es),E[V].listeners.length===0&&!hd&&(delete E[V],--E[wi]===0)){delete this.queue[o];break}if(!y())break}}};d.on("origin",()=>{d[G]=_()||[],d[Xe]=!1,Gf(this.sessions[o],d),!(d[Xe]||!y())&&(T(),y()&&Uo(this.sessions[o],d))}),d.once("remoteSettings",()=>{if(f.destroyed){let E=new Error("Agent has been destroyed");for(let R=0;R<s.length;R++)s[R].reject(E);d.destroy();return}if(d.setLocalWindowSize&&d.setLocalWindowSize(1024*1024*4),d[G]=_()||[],d.socket.encrypted){let E=d[G][0];if(E!==a){let R=new Error(`Requested origin ${a} does not match server ${E}`);for(let v=0;v<s.length;v++)s[v].reject(R);d.destroy();return}}h();{let E=this.sessions;if(o in E){let R=E[o];R.splice(Wy(R,d,Gy),0,d)}else E[o]=[d]}m=!0,this._emptySessionCount++,this.emit("session",d),this._accept(d,s,a,r),d[W]===0&&this._emptySessionCount>this.maxEmptySessions&&this.closeEmptySessions(this._emptySessionCount-this.maxEmptySessions),d.on("remoteSettings",()=>{y()&&(T(),y()&&Uo(this.sessions[o],d))})}),d[$f]=d.request,d.request=(E,R)=>{if(d[Xe])throw new Error("The session is gracefully closing. No new streams are allowed.");let v=d[$f](E,R);return d.ref(),d[W]++===0&&this._emptySessionCount--,v.once("close",()=>{if(--d[W]===0&&(this._emptySessionCount++,d.unref(),this._emptySessionCount>this.maxEmptySessions||d[Xe])){d.close();return}d.destroyed||d.closed||y()&&!Gf(this.sessions[o],d)&&(Uo(this.sessions[o],d),T(),d[W]===0&&this._processQueue())}),v}}catch(g){h(),this._sessionCount--;for(let b=0;b<s.length;b++)s[b].reject(g)}};f.listeners=s,f.completed=!1,f.destroyed=!1,this.queue[o][a]=f,this.queue[o][wi]++,this._processQueue()})}request(e,r,s,i){return new Promise((n,o)=>{this.getSession(e,r,[{reject:o,resolve:a=>{try{let h=a.request(s,i);$y(h),n(h)}catch(h){o(h)}}}])})}async createConnection(e,r){return t.connect(e,r)}static connect(e,r){r.ALPNProtocols=["h2"];let s=e.port||443,i=e.hostname;typeof r.servername>"u"&&(r.servername=i);let n=zy.connect(s,i,r);return r.socket&&(n._peername={family:void 0,address:void 0,port:s}),n}closeEmptySessions(e=Number.POSITIVE_INFINITY){let r=0,{sessions:s}=this;for(let i in s){let n=s[i];for(let o=0;o<n.length;o++){let a=n[o];if(a[W]===0&&(r++,a.close(),r>=e))return r}}return r}destroy(e){let{sessions:r,queue:s}=this;for(let i in r){let n=r[i];for(let o=0;o<n.length;o++)n[o].destroy(e)}for(let i in s){let n=s[i];for(let o in n)n[o].destroyed=!0}this.queue={},this.tlsSessionCache.clear()}get emptySessionCount(){return this._emptySessionCount}get pendingSessionCount(){return this._sessionCount-this._emptySessionCount}get sessionCount(){return this._sessionCount}};Gt.kCurrentStreamCount=W;Gt.kGracefullyClosing=Xe;Kf.exports={Agent:Gt,globalAgent:new Gt}});var zo=k((dS,Yf)=>{"use strict";var{Readable:Vy}=require("stream"),Ho=class extends Vy{constructor(e,r){super({emitClose:!1,autoDestroy:!0,highWaterMark:r}),this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=e,this._dumped=!1}get connection(){return this.socket}set connection(e){this.socket=e}_destroy(e,r){this.readableEnded||(this.aborted=!0),r(),this.req._request.destroy(e)}setTimeout(e,r){return this.req.setTimeout(e,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};Yf.exports=Ho});var Jf=k((uS,Zf)=>{"use strict";Zf.exports=(t,e,r)=>{for(let s of r)t.on(s,(...i)=>e.emit(s,...i))}});var Vr=k((pS,Xf)=>{"use strict";var bt=(t,e,r)=>{Xf.exports[e]=class extends t{constructor(...i){super(typeof r=="string"?r:r(i)),this.name=`${super.name} [${e}]`,this.code=e}}};bt(TypeError,"ERR_INVALID_ARG_TYPE",t=>{let e=t[0].includes(".")?"property":"argument",r=t[1],s=Array.isArray(r);return s&&(r=`${r.slice(0,-1).join(", ")} or ${r.slice(-1)}`),`The "${t[0]}" ${e} must be ${s?"one of":"of"} type ${r}. Received ${typeof t[2]}`});bt(TypeError,"ERR_INVALID_PROTOCOL",t=>`Protocol "${t[0]}" not supported. Expected "${t[1]}"`);bt(Error,"ERR_HTTP_HEADERS_SENT",t=>`Cannot ${t[0]} headers after they are sent to the client`);bt(TypeError,"ERR_INVALID_HTTP_TOKEN",t=>`${t[0]} must be a valid HTTP token [${t[1]}]`);bt(TypeError,"ERR_HTTP_INVALID_HEADER_VALUE",t=>`Invalid value "${t[0]} for header "${t[1]}"`);bt(TypeError,"ERR_INVALID_CHAR",t=>`Invalid character in ${t[0]} [${t[1]}]`);bt(Error,"ERR_HTTP2_NO_SOCKET_MANIPULATION","HTTP/2 sockets should not be directly manipulated (e.g. read and written)")});var el=k((yS,Qf)=>{"use strict";Qf.exports=t=>{switch(t){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var jo=k((gS,tl)=>{"use strict";var{ERR_INVALID_HTTP_TOKEN:Ky}=Vr(),Yy=el(),Zy=/^[\^`\-\w!#$%&*+.|~]+$/;tl.exports=t=>{if(typeof t!="string"||!Zy.test(t)&&!Yy(t))throw new Ky("Header name",t)}});var qo=k((wS,rl)=>{"use strict";var{ERR_HTTP_INVALID_HEADER_VALUE:Jy,ERR_INVALID_CHAR:Xy}=Vr(),Qy=/[^\t\u0020-\u007E\u0080-\u00FF]/;rl.exports=(t,e)=>{if(typeof e>"u")throw new Jy(e,t);if(Qy.test(e))throw new Xy("header content",t)}});var nl=k((bS,il)=>{"use strict";var{ERR_HTTP2_NO_SOCKET_MANIPULATION:sl}=Vr(),eg={has(t,e){let r=t.session===void 0?t:t.session.socket;return e in t||e in r},get(t,e){switch(e){case"on":case"once":case"end":case"emit":case"destroy":return t[e].bind(t);case"writable":case"destroyed":return t[e];case"readable":return t.destroyed?!1:t.readable;case"setTimeout":{let{session:r}=t;return r!==void 0?r.setTimeout.bind(r):t.setTimeout.bind(t)}case"write":case"read":case"pause":case"resume":throw new sl;default:{let r=t.session===void 0?t:t.session.socket,s=r[e];return typeof s=="function"?s.bind(r):s}}},getPrototypeOf(t){return t.session!==void 0?Reflect.getPrototypeOf(t.session.socket):Reflect.getPrototypeOf(t)},set(t,e,r){switch(e){case"writable":case"readable":case"destroyed":case"on":case"once":case"end":case"emit":case"destroy":return t[e]=r,!0;case"setTimeout":{let{session:s}=t;return s===void 0?t.setTimeout=r:s.setTimeout=r,!0}case"write":case"read":case"pause":case"resume":throw new sl;default:{let s=t.session===void 0?t:t.session.socket;return s[e]=r,!0}}}};il.exports=eg});var Vo=k((_S,ll)=>{"use strict";var{URL:$o,urlToHttpOptions:ol}=require("url"),tg=require("http2"),{Writable:rg}=require("stream"),{Agent:sg,globalAgent:ig}=wt(),ng=zo(),og=Jf(),{ERR_INVALID_ARG_TYPE:bi,ERR_INVALID_PROTOCOL:ag,ERR_HTTP_HEADERS_SENT:al}=Vr(),hg=jo(),cg=qo(),fg=nl(),{HTTP2_HEADER_STATUS:hl,HTTP2_HEADER_METHOD:cl,HTTP2_HEADER_PATH:fl,HTTP2_HEADER_AUTHORITY:Kr,HTTP2_METHOD_CONNECT:lg}=tg.constants,H=Symbol("headers"),Vt=Symbol("origin"),Yr=Symbol("session"),Wo=Symbol("options"),_i=Symbol("flushedHeaders"),Kt=Symbol("jobs"),Zr=Symbol("pendingAgentPromise"),Go=class extends rg{constructor(e,r,s){if(super({autoDestroy:!1,emitClose:!1}),typeof e=="string"?e=ol(new $o(e)):e instanceof $o?e=ol(e):e={...e},typeof r=="function"||r===void 0?(s=r,r=e):r=Object.assign(e,r),r.h2session){if(this[Yr]=r.h2session,this[Yr].destroyed)throw new Error("The session has been closed already");this.protocol=this[Yr].socket.encrypted?"https:":"http:"}else if(r.agent===!1)this.agent=new sg({maxEmptySessions:0});else if(typeof r.agent>"u"||r.agent===null)this.agent=ig;else if(typeof r.agent.request=="function")this.agent=r.agent;else throw new bi("options.agent",["http2wrapper.Agent-like Object","undefined","false"],r.agent);if(this.agent&&(this.protocol=this.agent.protocol),r.protocol&&r.protocol!==this.protocol)throw new ag(r.protocol,this.protocol);r.port||(r.port=r.defaultPort||this.agent&&this.agent.defaultPort||443),r.host=r.hostname||r.host||"localhost",delete r.hostname;let{timeout:i}=r;r.timeout=void 0,this[H]=Object.create(null),this[Kt]=[],this[Zr]=void 0,this.socket=null,this.connection=null,this.method=r.method||"GET",this.method==="CONNECT"&&(r.path==="/"||r.path===void 0)||(this.path=r.path),this.res=null,this.aborted=!1,this.reusedSocket=!1;let{headers:n}=r;if(n)for(let a in n)this.setHeader(a,n[a]);r.auth&&!("authorization"in this[H])&&(this[H].authorization="Basic "+Buffer.from(r.auth).toString("base64")),r.session=r.tlsSession,r.path=r.socketPath,this[Wo]=r,this[Vt]=new $o(`${this.protocol}//${r.servername||r.host}:${r.port}`);let o=r._reuseSocket;o&&(r.createConnection=(...a)=>o.destroyed?this.agent.createConnection(...a):o,this.agent.getSession(this[Vt],this[Wo]).catch(()=>{})),i&&this.setTimeout(i),s&&this.once("response",s),this[_i]=!1}get method(){return this[H][cl]}set method(e){e&&(this[H][cl]=e.toUpperCase())}get path(){let e=this.method==="CONNECT"?Kr:fl;return this[H][e]}set path(e){if(e){let r=this.method==="CONNECT"?Kr:fl;this[H][r]=e}}get host(){return this[Vt].hostname}set host(e){}get _mustNotHaveABody(){return this.method==="GET"||this.method==="HEAD"||this.method==="DELETE"}_write(e,r,s){if(this._mustNotHaveABody){s(new Error("The GET, HEAD and DELETE methods must NOT have a body"));return}this.flushHeaders();let i=()=>this._request.write(e,r,s);this._request?i():this[Kt].push(i)}_final(e){this.flushHeaders();let r=()=>{if(this._mustNotHaveABody||this.method==="CONNECT"){e();return}this._request.end(e)};this._request?r():this[Kt].push(r)}abort(){this.res&&this.res.complete||(this.aborted||process.nextTick(()=>this.emit("abort")),this.aborted=!0,this.destroy())}async _destroy(e,r){this.res&&this.res._dump(),this._request?this._request.destroy():process.nextTick(()=>{this.emit("close")});try{await this[Zr]}catch(s){this.aborted&&(e=s)}r(e)}async flushHeaders(){if(this[_i]||this.destroyed)return;this[_i]=!0;let e=this.method===lg,r=s=>{if(this._request=s,this.destroyed){s.destroy();return}e||og(s,this,["timeout","continue"]),s.once("error",n=>{this.destroy(n)}),s.once("aborted",()=>{let{res:n}=this;n?(n.aborted=!0,n.emit("aborted"),n.destroy()):this.destroy(new Error("The server aborted the HTTP/2 stream"))});let i=(n,o,a)=>{let h=new ng(this.socket,s.readableHighWaterMark);this.res=h,h.url=`${this[Vt].origin}${this.path}`,h.req=this,h.statusCode=n[hl],h.headers=n,h.rawHeaders=a,h.once("end",()=>{h.complete=!0,h.socket=null,h.connection=null}),e?(h.upgrade=!0,this.emit("connect",h,s,Buffer.alloc(0))?this.emit("close"):s.destroy()):(s.on("data",f=>{!h._dumped&&!h.push(f)&&s.pause()}),s.once("end",()=>{this.aborted||h.push(null)}),this.emit("response",h)||h._dump())};s.once("response",i),s.once("headers",n=>this.emit("information",{statusCode:n[hl]})),s.once("trailers",(n,o,a)=>{let{res:h}=this;if(h===null){i(n,o,a);return}h.trailers=n,h.rawTrailers=a}),s.once("close",()=>{let{aborted:n,res:o}=this;if(o){n&&(o.aborted=!0,o.emit("aborted"),o.destroy());let a=()=>{o.emit("close"),this.destroy(),this.emit("close")};o.readable?o.once("end",a):a();return}if(!this.destroyed){this.destroy(new Error("The HTTP/2 stream has been early terminated")),this.emit("close");return}this.destroy(),this.emit("close")}),this.socket=new Proxy(s,fg);for(let n of this[Kt])n();this[Kt].length=0,this.emit("socket",this.socket)};if(!(Kr in this[H])&&!e&&(this[H][Kr]=this[Vt].host),this[Yr])try{r(this[Yr].request(this[H]))}catch(s){this.destroy(s)}else{this.reusedSocket=!0;try{let s=this.agent.request(this[Vt],this[Wo],this[H]);this[Zr]=s,r(await s),this[Zr]=!1}catch(s){this[Zr]=!1,this.destroy(s)}}}get connection(){return this.socket}set connection(e){this.socket=e}getHeaderNames(){return Object.keys(this[H])}hasHeader(e){if(typeof e!="string")throw new bi("name","string",e);return!!this[H][e.toLowerCase()]}getHeader(e){if(typeof e!="string")throw new bi("name","string",e);return this[H][e.toLowerCase()]}get headersSent(){return this[_i]}removeHeader(e){if(typeof e!="string")throw new bi("name","string",e);if(this.headersSent)throw new al("remove");delete this[H][e.toLowerCase()]}setHeader(e,r){if(this.headersSent)throw new al("set");hg(e),cg(e,r);let s=e.toLowerCase();if(s==="connection"){if(r.toLowerCase()==="keep-alive")return;throw new Error(`Invalid 'connection' header: ${r}`)}s==="host"&&this.method==="CONNECT"?this[H][Kr]=r:this[H][s]=r}setNoDelay(){}setSocketKeepAlive(){}setTimeout(e,r){let s=()=>this._request.setTimeout(e,r);return this._request?s():this[Kt].push(s),this}get maxHeadersCount(){if(!this.destroyed&&this._request)return this._request.session.localSettings.maxHeaderListSize}set maxHeadersCount(e){}};ll.exports=Go});var ul=k((ES,dl)=>{"use strict";var dg=require("tls");dl.exports=(t={},e=dg.connect)=>new Promise((r,s)=>{let i=!1,n,o=async()=>{await h,n.off("timeout",a),n.off("error",s),t.resolveSocket?(r({alpnProtocol:n.alpnProtocol,socket:n,timeout:i}),i&&(await Promise.resolve(),n.emit("timeout"))):(n.destroy(),r({alpnProtocol:n.alpnProtocol,timeout:i}))},a=async()=>{i=!0,o()},h=(async()=>{try{n=await e(t,o),n.on("error",s),n.once("timeout",a)}catch(f){s(f)}})()})});var pl=k((SS,ml)=>{"use strict";var{isIP:ug}=require("net"),mg=require("assert"),pg=t=>{if(t[0]==="["){let r=t.indexOf("]");return mg(r!==-1),t.slice(1,r)}let e=t.indexOf(":");return e===-1?t:t.slice(0,e)};ml.exports=t=>{let e=pg(t);return ug(e)?"":e}});var xl=k((xS,Jr)=>{"use strict";var{URL:yl,urlToHttpOptions:gl}=require("url"),wl=require("http"),Ko=require("https"),yg=ul(),gg=Bo(),{Agent:wg,globalAgent:bg}=wt(),_g=Vo(),Eg=pl(),bl=Fo(),_l=new gg({maxSize:100}),Sg=new Map,xg=(t,e,r)=>{e._httpMessage={shouldKeepAlive:!0};let s=()=>{t.emit("free",e,r)};e.on("free",s);let i=()=>{t.removeSocket(e,r)};e.on("close",i);let n=()=>{let{freeSockets:a}=t;for(let h of Object.values(a))if(h.includes(e)){e.destroy();return}};e.on("timeout",n);let o=()=>{t.removeSocket(e,r),e.off("close",i),e.off("free",s),e.off("timeout",n),e.off("agentRemove",o)};e.on("agentRemove",o),t.emit("free",e,r)},El=(t,e=new Map,r=void 0)=>async s=>{let i=`${s.host}:${s.port}:${s.ALPNProtocols.sort()}`;if(!t.has(i)){if(e.has(i))return{alpnProtocol:(await e.get(i)).alpnProtocol};let{path:n}=s;s.path=s.socketPath;let o=yg(s,r);e.set(i,o);try{let a=await o;return t.set(i,a.alpnProtocol),e.delete(i),s.path=n,a}catch(a){throw e.delete(i),s.path=n,a}}return{alpnProtocol:t.get(i)}},Sl=El(_l,Sg);Jr.exports=async(t,e,r)=>{if(typeof t=="string"?t=gl(new yl(t)):t instanceof yl?t=gl(t):t={...t},typeof e=="function"||e===void 0?(r=e,e=t):e=Object.assign(t,e),e.ALPNProtocols=e.ALPNProtocols||["h2","http/1.1"],!Array.isArray(e.ALPNProtocols)||e.ALPNProtocols.length===0)throw new Error("The `ALPNProtocols` option must be an Array with at least one entry");e.protocol=e.protocol||"https:";let s=e.protocol==="https:";e.host=e.hostname||e.host||"localhost",e.session=e.tlsSession,e.servername=e.servername||Eg(e.headers&&e.headers.host||e.host),e.port=e.port||(s?443:80),e._defaultAgent=s?Ko.globalAgent:wl.globalAgent;let i=e.resolveProtocol||Sl,{agent:n}=e;if(n!==void 0&&n!==!1&&n.constructor.name!=="Object")throw new Error("The `options.agent` can be only an object `http`, `https` or `http2` properties");if(s){e.resolveSocket=!0;let{socket:o,alpnProtocol:a,timeout:h}=await i(e);if(h){o&&o.destroy();let l=new Error(`Timed out resolving ALPN: ${e.timeout} ms`);throw l.code="ETIMEDOUT",l.ms=e.timeout,l}o&&e.createConnection&&(o.destroy(),o=void 0),delete e.resolveSocket;let f=a==="h2";if(n&&(n=f?n.http2:n.https,e.agent=n),n===void 0&&(n=f?bg:Ko.globalAgent),o)if(n===!1)o.destroy();else{let l=(f?wg:Ko.Agent).prototype.createConnection;n.createConnection===l?f?e._reuseSocket=o:xg(n,o,e):o.destroy()}if(f)return bl(new _g(e,r))}else n&&(e.agent=n.http);return e.headers&&(e.headers={...e.headers},e.headers[":authority"]&&(e.headers.host||(e.headers.host=e.headers[":authority"]),delete e.headers[":authority"]),delete e.headers[":method"],delete e.headers[":scheme"],delete e.headers[":path"]),bl(wl.request(e,r))};Jr.exports.protocolCache=_l;Jr.exports.resolveProtocol=Sl;Jr.exports.createResolveProtocol=El});var Yo=k((RS,Rl)=>{"use strict";var Rg=require("stream"),Tg=require("tls"),Og=new Tg.TLSSocket(new Rg.PassThrough)._handle._parentWrap.constructor;Rl.exports=Og});var Jo=k((TS,Tl)=>{"use strict";var Zo=class extends Error{constructor(e,r=""){super(`The proxy server rejected the request with status code ${e} (${r||"empty status message"})`),this.statusCode=e,this.statusMessage=r}};Tl.exports=Zo});var Al=k((OS,Ol)=>{"use strict";var Ag=(t,e,r)=>{if(!r.some(i=>typeof i==="string"?typeof e===i:e instanceof i)){let i=r.map(n=>typeof n=="string"?n:n.name);throw new TypeError(`Expected '${t}' to be a type of ${i.join(" or ")}, got ${typeof e}`)}};Ol.exports=Ag});var Xo=k((AS,Cl)=>{"use strict";var{URL:kl}=require("url"),Ei=Al();Cl.exports=(t,e)=>{Ei("proxyOptions",e,["object"]),Ei("proxyOptions.headers",e.headers,["object","undefined"]),Ei("proxyOptions.raw",e.raw,["boolean","undefined"]),Ei("proxyOptions.url",e.url,[kl,"string"]);let r=new kl(e.url);t.proxyOptions={raw:!0,...e,headers:{...e.headers},url:r}}});var Si=k((kS,Nl)=>{"use strict";Nl.exports=t=>{let{username:e,password:r}=t.proxyOptions.url;if(e||r){let s=`${e}:${r}`,i=`Basic ${Buffer.from(s).toString("base64")}`;return{"proxy-authorization":i,authorization:i}}return{}}});var vl=k((CS,Dl)=>{"use strict";var kg=require("tls"),Cg=require("http"),Pl=require("https"),Ng=Yo(),{globalAgent:Pg}=wt(),Ig=Jo(),Il=Xo(),Lg=Si(),Ll=(t,e,r)=>{(async()=>{try{let{proxyOptions:s}=t,{url:i,headers:n,raw:o}=s,a=await Pg.request(i,s,{...Lg(t),...n,":method":"CONNECT",":authority":`${e.host}:${e.port}`});a.once("error",r),a.once("response",h=>{let f=h[":status"];if(f!==200){r(new Ig(f,""));return}let l=t instanceof Pl.Agent;if(o&&l){e.socket=a;let u=kg.connect(e);u.once("close",()=>{a.destroy()}),r(null,u);return}let m=new Ng(a);m.encrypted=!1,m._handle.getpeername=u=>{u.family=void 0,u.address=void 0,u.port=void 0},r(null,m)})}catch(s){r(s)}})()},Qo=class extends Cg.Agent{constructor(e){super(e),Il(this,e.proxyOptions)}createConnection(e,r){Ll(this,e,r)}},ea=class extends Pl.Agent{constructor(e){super(e),Il(this,e.proxyOptions)}createConnection(e,r){Ll(this,e,r)}};Dl.exports={HttpOverHttp2:Qo,HttpsOverHttp2:ea}});var ra=k((NS,Ml)=>{"use strict";var{Agent:Dg}=wt(),vg=Yo(),Mg=Jo(),Bg=Xo(),ta=class extends Dg{constructor(e){super(e),Bg(this,e.proxyOptions)}async createConnection(e,r){let s=`${e.hostname}:${e.port||443}`,[i,n,o]=await this._getProxyStream(s);if(n!==200)throw new Mg(n,o);if(this.proxyOptions.raw)r.socket=i;else{let a=new vg(i);return a.encrypted=!1,a._handle.getpeername=h=>{h.family=void 0,h.address=void 0,h.port=void 0},a}return super.createConnection(e,r)}};Ml.exports=ta});var Fl=k((PS,Bl)=>{"use strict";var{globalAgent:Fg}=wt(),Ug=ra(),Hg=Si(),zg=t=>new Promise((e,r)=>{t.once("error",r),t.once("response",s=>{t.off("error",r),e(s[":status"])})}),sa=class extends Ug{async _getProxyStream(e){let{proxyOptions:r}=this,s={...Hg(this),...r.headers,":method":"CONNECT",":authority":e},i=await Fg.request(r.url,r,s),n=await zg(i);return[i,n,""]}};Bl.exports=sa});var Hl=k((IS,Ul)=>{"use strict";var jg=require("http"),qg=require("https"),$g=ra(),Wg=Si(),Gg=t=>new Promise((e,r)=>{let s=(i,n,o)=>{n.unshift(o),t.off("error",r),e([n,i.statusCode,i.statusMessage])};t.once("error",r),t.once("connect",s)}),xi=class extends $g{async _getProxyStream(e){let{proxyOptions:r}=this,{url:s,headers:i}=this.proxyOptions,o=(s.protocol==="https:"?qg:jg).request({...r,hostname:s.hostname,port:s.port,path:e,headers:{...Wg(this),...i,host:e},method:"CONNECT"}).end();return Gg(o)}};Ul.exports={Http2OverHttp:xi,Http2OverHttps:xi}});var jl=k((LS,zl)=>{"use strict";var Vg=require("http2"),{Agent:Kg,globalAgent:Yg}=wt(),ia=Vo(),Zg=zo(),Jg=xl(),{HttpOverHttp2:Xg,HttpsOverHttp2:Qg}=vl(),ew=Fl(),{Http2OverHttp:tw,Http2OverHttps:rw}=Hl(),sw=jo(),iw=qo(),nw=(t,e,r)=>new ia(t,e,r),ow=(t,e,r)=>{let s=new ia(t,e,r);return s.end(),s};zl.exports={...Vg,ClientRequest:ia,IncomingMessage:Zg,Agent:Kg,globalAgent:Yg,request:nw,get:ow,auto:Jg,proxies:{HttpOverHttp2:Xg,HttpsOverHttp2:Qg,Http2OverHttp2:ew,Http2OverHttp:tw,Http2OverHttps:rw},validateHeaderName:sw,validateHeaderValue:iw}});var kw={};md(kw,{downloadAndExtractRepo:()=>Aw});module.exports=pd(kw);var id=require("stream"),nd=require("util"),od=require("path"),ad=require("os"),Ci=require("fs");var pa=x(require("events"),1),$=x(require("fs"),1);var hs=require("events"),Mi=x(require("stream"),1),ma=require("string_decoder"),fa=typeof process=="object"&&process?process:{stdout:null,stderr:null},yd=t=>!!t&&typeof t=="object"&&(t instanceof K||t instanceof Mi.default||gd(t)||wd(t)),gd=t=>!!t&&typeof t=="object"&&t instanceof hs.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==Mi.default.Writable.prototype.pipe,wd=t=>!!t&&typeof t=="object"&&t instanceof hs.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Se=Symbol("EOF"),xe=Symbol("maybeEmitEnd"),Me=Symbol("emittedEnd"),rs=Symbol("emittingEnd"),Xt=Symbol("emittedError"),ss=Symbol("closed"),la=Symbol("read"),is=Symbol("flush"),da=Symbol("flushChunk"),se=Symbol("encoding"),Et=Symbol("decoder"),M=Symbol("flowing"),Qt=Symbol("paused"),St=Symbol("resume"),B=Symbol("buffer"),q=Symbol("pipes"),F=Symbol("bufferLength"),Ni=Symbol("bufferPush"),ns=Symbol("bufferShift"),z=Symbol("objectMode"),L=Symbol("destroyed"),Pi=Symbol("error"),Ii=Symbol("emitData"),ua=Symbol("emitEnd"),Li=Symbol("emitEnd2"),le=Symbol("async"),Di=Symbol("abort"),os=Symbol("aborted"),er=Symbol("signal"),Qe=Symbol("dataListeners"),Z=Symbol("discarded"),tr=t=>Promise.resolve().then(t),bd=t=>t(),_d=t=>t==="end"||t==="finish"||t==="prefinish",Ed=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Sd=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),as=class{src;dest;opts;ondrain;constructor(e,r,s){this.src=e,this.dest=r,this.opts=s,this.ondrain=()=>e[St](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},vi=class extends as{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,s){super(e,r,s),this.proxyErrors=i=>r.emit("error",i),e.on("error",this.proxyErrors)}},xd=t=>!!t.objectMode,Rd=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",K=class extends hs.EventEmitter{[M]=!1;[Qt]=!1;[q]=[];[B]=[];[z];[se];[le];[Et];[Se]=!1;[Me]=!1;[rs]=!1;[ss]=!1;[Xt]=null;[F]=0;[L]=!1;[er];[os]=!1;[Qe]=0;[Z]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");xd(r)?(this[z]=!0,this[se]=null):Rd(r)?(this[se]=r.encoding,this[z]=!1):(this[z]=!1,this[se]=null),this[le]=!!r.async,this[Et]=this[se]?new ma.StringDecoder(this[se]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[B]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[q]});let{signal:s}=r;s&&(this[er]=s,s.aborted?this[Di]():s.addEventListener("abort",()=>this[Di]()))}get bufferLength(){return this[F]}get encoding(){return this[se]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[z]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[le]}set async(e){this[le]=this[le]||!!e}[Di](){this[os]=!0,this.emit("abort",this[er]?.reason),this.destroy(this[er]?.reason)}get aborted(){return this[os]}set aborted(e){}write(e,r,s){if(this[os])return!1;if(this[Se])throw new Error("write after end");if(this[L])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(s=r,r="utf8"),r||(r="utf8");let i=this[le]?tr:bd;if(!this[z]&&!Buffer.isBuffer(e)){if(Sd(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Ed(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[z]?(this[M]&&this[F]!==0&&this[is](!0),this[M]?this.emit("data",e):this[Ni](e),this[F]!==0&&this.emit("readable"),s&&i(s),this[M]):e.length?(typeof e=="string"&&!(r===this[se]&&!this[Et]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[se]&&(e=this[Et].write(e)),this[M]&&this[F]!==0&&this[is](!0),this[M]?this.emit("data",e):this[Ni](e),this[F]!==0&&this.emit("readable"),s&&i(s),this[M]):(this[F]!==0&&this.emit("readable"),s&&i(s),this[M])}read(e){if(this[L])return null;if(this[Z]=!1,this[F]===0||e===0||e&&e>this[F])return this[xe](),null;this[z]&&(e=null),this[B].length>1&&!this[z]&&(this[B]=[this[se]?this[B].join(""):Buffer.concat(this[B],this[F])]);let r=this[la](e||null,this[B][0]);return this[xe](),r}[la](e,r){if(this[z])this[ns]();else{let s=r;e===s.length||e===null?this[ns]():typeof s=="string"?(this[B][0]=s.slice(e),r=s.slice(0,e),this[F]-=e):(this[B][0]=s.subarray(e),r=s.subarray(0,e),this[F]-=e)}return this.emit("data",r),!this[B].length&&!this[Se]&&this.emit("drain"),r}end(e,r,s){return typeof e=="function"&&(s=e,e=void 0),typeof r=="function"&&(s=r,r="utf8"),e!==void 0&&this.write(e,r),s&&this.once("end",s),this[Se]=!0,this.writable=!1,(this[M]||!this[Qt])&&this[xe](),this}[St](){this[L]||(!this[Qe]&&!this[q].length&&(this[Z]=!0),this[Qt]=!1,this[M]=!0,this.emit("resume"),this[B].length?this[is]():this[Se]?this[xe]():this.emit("drain"))}resume(){return this[St]()}pause(){this[M]=!1,this[Qt]=!0,this[Z]=!1}get destroyed(){return this[L]}get flowing(){return this[M]}get paused(){return this[Qt]}[Ni](e){this[z]?this[F]+=1:this[F]+=e.length,this[B].push(e)}[ns](){return this[z]?this[F]-=1:this[F]-=this[B][0].length,this[B].shift()}[is](e=!1){do;while(this[da](this[ns]())&&this[B].length);!e&&!this[B].length&&!this[Se]&&this.emit("drain")}[da](e){return this.emit("data",e),this[M]}pipe(e,r){if(this[L])return e;this[Z]=!1;let s=this[Me];return r=r||{},e===fa.stdout||e===fa.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,s?r.end&&e.end():(this[q].push(r.proxyErrors?new vi(this,e,r):new as(this,e,r)),this[le]?tr(()=>this[St]()):this[St]()),e}unpipe(e){let r=this[q].find(s=>s.dest===e);r&&(this[q].length===1?(this[M]&&this[Qe]===0&&(this[M]=!1),this[q]=[]):this[q].splice(this[q].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let s=super.on(e,r);if(e==="data")this[Z]=!1,this[Qe]++,!this[q].length&&!this[M]&&this[St]();else if(e==="readable"&&this[F]!==0)super.emit("readable");else if(_d(e)&&this[Me])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Xt]){let i=r;this[le]?tr(()=>i.call(this,this[Xt])):i.call(this,this[Xt])}return s}removeListener(e,r){return this.off(e,r)}off(e,r){let s=super.off(e,r);return e==="data"&&(this[Qe]=this.listeners("data").length,this[Qe]===0&&!this[Z]&&!this[q].length&&(this[M]=!1)),s}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Qe]=0,!this[Z]&&!this[q].length&&(this[M]=!1)),r}get emittedEnd(){return this[Me]}[xe](){!this[rs]&&!this[Me]&&!this[L]&&this[B].length===0&&this[Se]&&(this[rs]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ss]&&this.emit("close"),this[rs]=!1)}emit(e,...r){let s=r[0];if(e!=="error"&&e!=="close"&&e!==L&&this[L])return!1;if(e==="data")return!this[z]&&!s?!1:this[le]?(tr(()=>this[Ii](s)),!0):this[Ii](s);if(e==="end")return this[ua]();if(e==="close"){if(this[ss]=!0,!this[Me]&&!this[L])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[Xt]=s,super.emit(Pi,s);let n=!this[er]||this.listeners("error").length?super.emit("error",s):!1;return this[xe](),n}else if(e==="resume"){let n=super.emit("resume");return this[xe](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let i=super.emit(e,...r);return this[xe](),i}[Ii](e){for(let s of this[q])s.dest.write(e)===!1&&this.pause();let r=this[Z]?!1:super.emit("data",e);return this[xe](),r}[ua](){return this[Me]?!1:(this[Me]=!0,this.