=s;if(n){--i}return i}function joseToDer(e,t){e=signatureAsBuffer(e);var r=n(t);var a=e.length;if(a!==r*2){throw new TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+a+'"')}var o=countPadding(e,0,r);var A=countPadding(e,r,e.length);var l=r-o;var p=r-A;var u=1+1+l+1+1+p;var h=u{"use strict";function getParamSize(e){var t=(e/8|0)+(e%8===0?0:1);return t}var t={ES256:getParamSize(256),ES384:getParamSize(384),ES512:getParamSize(521)};function getParamBytesForAlg(e){var r=t[e];if(r){return r}throw new Error('Unknown algorithm "'+e+'"')}e.exports=getParamBytesForAlg},8171:e=>{"use strict";var t=Object.prototype.hasOwnProperty;var r=Object.prototype.toString;var i=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var s=function isArray(e){if(typeof Array.isArray==="function"){return Array.isArray(e)}return r.call(e)==="[object Array]"};var a=function isPlainObject(e){if(!e||r.call(e)!=="[object Object]"){return false}var i=t.call(e,"constructor");var n=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!i&&!n){return false}var s;for(s in e){}return typeof s==="undefined"||t.call(e,s)};var o=function setProperty(e,t){if(i&&t.name==="__proto__"){i(e,t.name,{enumerable:true,configurable:true,value:t.newValue,writable:true})}else{e[t.name]=t.newValue}};var A=function getProperty(e,r){if(r==="__proto__"){if(!t.call(e,r)){return void 0}else if(n){return n(e,r).value}}return e[r]};e.exports=function extend(){var e,t,r,i,n,l;var c=arguments[0];var d=1;var p=arguments.length;var u=false;if(typeof c==="boolean"){u=c;c=arguments[1]||{};d=2}if(c==null||typeof c!=="object"&&typeof c!=="function"){c={}}for(;d{e.exports=class FixedFIFO{constructor(e){if(!(e>0)||(e-1&e)!==0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e);this.mask=e-1;this.top=0;this.btm=0;this.next=null}clear(){this.top=this.btm=0;this.next=null;this.buffer.fill(undefined)}push(e){if(this.buffer[this.top]!==undefined)return false;this.buffer[this.top]=e;this.top=this.top+1&this.mask;return true}shift(){const e=this.buffer[this.btm];if(e===undefined)return undefined;this.buffer[this.btm]=undefined;this.btm=this.btm+1&this.mask;return e}peek(){return this.buffer[this.btm]}isEmpty(){return this.buffer[this.btm]===undefined}}},2958:(e,t,r)=>{const i=r(7030);e.exports=class FastFIFO{constructor(e){this.hwm=e||16;this.head=new i(this.hwm);this.tail=this.head;this.length=0}clear(){this.head=this.tail;this.head.clear();this.length=0}push(e){this.length++;if(!this.head.push(e)){const t=this.head;this.head=t.next=new i(2*this.head.buffer.length);this.head.push(e)}}shift(){if(this.length!==0)this.length--;const e=this.tail.shift();if(e===undefined&&this.tail.next){const e=this.tail.next;this.tail.next=null;this.tail=e;return this.tail.shift()}return e}peek(){const e=this.tail.peek();if(e===undefined&&this.tail.next)return this.tail.next.peek();return e}isEmpty(){return this.length===0}}},6863:(e,t,r)=>{e.exports=realpath;realpath.realpath=realpath;realpath.sync=realpathSync;realpath.realpathSync=realpathSync;realpath.monkeypatch=monkeypatch;realpath.unmonkeypatch=unmonkeypatch;var i=r(7147);var n=i.realpath;var s=i.realpathSync;var a=process.version;var o=/^v[0-5]\./.test(a);var A=r(1734);function newError(e){return e&&e.syscall==="realpath"&&(e.code==="ELOOP"||e.code==="ENOMEM"||e.code==="ENAMETOOLONG")}function realpath(e,t,r){if(o){return n(e,t,r)}if(typeof t==="function"){r=t;t=null}n(e,t,(function(i,n){if(newError(i)){A.realpath(e,t,r)}else{r(i,n)}}))}function realpathSync(e,t){if(o){return s(e,t)}try{return s(e,t)}catch(r){if(newError(r)){return A.realpathSync(e,t)}else{throw r}}}function monkeypatch(){i.realpath=realpath;i.realpathSync=realpathSync}function unmonkeypatch(){i.realpath=n;i.realpathSync=s}},1734:(e,t,r)=>{var i=r(1017);var n=process.platform==="win32";var s=r(7147);var a=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function rethrow(){var e;if(a){var t=new Error;e=debugCallback}else e=missingCallback;return e;function debugCallback(e){if(e){t.message=e.message;e=t;missingCallback(e)}}function missingCallback(e){if(e){if(process.throwDeprecation)throw e;else if(!process.noDeprecation){var t="fs: missing callback "+(e.stack||e.message);if(process.traceDeprecation)console.trace(t);else console.error(t)}}}}function maybeCallback(e){return typeof e==="function"?e:rethrow()}var o=i.normalize;if(n){var A=/(.*?)(?:[\/\\]+|$)/g}else{var A=/(.*?)(?:[\/]+|$)/g}if(n){var l=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/}else{var l=/^[\/]*/}t.realpathSync=function realpathSync(e,t){e=i.resolve(e);if(t&&Object.prototype.hasOwnProperty.call(t,e)){return t[e]}var r=e,a={},o={};var c;var d;var p;var u;start();function start(){var t=l.exec(e);c=t[0].length;d=t[0];p=t[0];u="";if(n&&!o[p]){s.lstatSync(p);o[p]=true}}while(c=e.length){if(t)t[a]=e;return r(null,e)}A.lastIndex=d;var i=A.exec(e);h=p;p+=i[0];u=h+i[1];d=A.lastIndex;if(c[u]||t&&t[u]===u){return process.nextTick(LOOP)}if(t&&Object.prototype.hasOwnProperty.call(t,u)){return gotResolvedLink(t[u])}return s.lstat(u,gotStat)}function gotStat(e,i){if(e)return r(e);if(!i.isSymbolicLink()){c[u]=true;if(t)t[u]=u;return process.nextTick(LOOP)}if(!n){var a=i.dev.toString(32)+":"+i.ino.toString(32);if(o.hasOwnProperty(a)){return gotTarget(null,o[a],u)}}s.stat(u,(function(e){if(e)return r(e);s.readlink(u,(function(e,t){if(!n)o[a]=t;gotTarget(e,t)}))}))}function gotTarget(e,n,s){if(e)return r(e);var a=i.resolve(h,n);if(t)t[s]=a;gotResolvedLink(a)}function gotResolvedLink(t){e=i.resolve(t,e.slice(d));start()}}},6129:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.defaultErrorRedactor=t.GaxiosError=void 0;const i=r(7310);class GaxiosError extends Error{constructor(e,t,r,i){super(e);this.config=t;this.response=r;this.error=i;if(this.response){try{this.response.data=translateData(t.responseType,r===null||r===void 0?void 0:r.data)}catch(e){}this.status=this.response.status}if(i&&"code"in i&&i.code){this.code=i.code}if(t.errorRedactor){const e=t.errorRedactor;this.config={...t};if(this.response){this.response={...this.response,config:{...this.response.config}}}const i=e({config:t,response:r});this.config={...t,...i.config};if(this.response){this.response={...this.response,...i.response,config:t}}}}}t.GaxiosError=GaxiosError;function translateData(e,t){switch(e){case"stream":return t;case"json":return JSON.parse(JSON.stringify(t));case"arraybuffer":return JSON.parse(Buffer.from(t).toString("utf8"));case"blob":return JSON.parse(t.text());default:return t}}function defaultErrorRedactor(e){const t="< - See `errorRedactor` option in `gaxios` for configuration>.";function redactHeaders(e){if(!e)return;for(const r of Object.keys(e)){if(/^authentication$/.test(r)){e[r]=t}}}function redactString(e,r){if(typeof e==="object"&&e!==null&&typeof e[r]==="string"){const i=e[r];if(/grant_type=/.test(i)||/assertion=/.test(i)){e[r]=t}}}function redactObject(e){if(typeof e==="object"&&e!==null){if("grant_type"in e){e["grant_type"]=t}if("assertion"in e){e["assertion"]=t}}}if(e.config){redactHeaders(e.config.headers);redactString(e.config,"data");redactObject(e.config.data);redactString(e.config,"body");redactObject(e.config.body);try{const r=new i.URL(e.config.url||"");if(r.searchParams.has("token")){r.searchParams.set("token",t)}e.config.url=r.toString()}catch(e){}}if(e.response){defaultErrorRedactor({config:e.response.config});redactHeaders(e.response.headers);redactString(e.response,"data");redactObject(e.response.data)}return e}t.defaultErrorRedactor=defaultErrorRedactor},8133:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.Gaxios=void 0;const n=i(r(8171));const s=r(5687);const a=i(r(467));const o=i(r(3477));const A=i(r(1554));const l=r(7310);const c=r(6129);const d=r(1052);const p=r(7219);const u=hasFetch()?window.fetch:a.default;function hasWindow(){return typeof window!=="undefined"&&!!window}function hasFetch(){return hasWindow()&&!!window.fetch}function hasBuffer(){return typeof Buffer!=="undefined"}function hasHeader(e,t){return!!getHeader(e,t)}function getHeader(e,t){t=t.toLowerCase();for(const r of Object.keys((e===null||e===void 0?void 0:e.headers)||{})){if(t===r.toLowerCase()){return e.headers[r]}}return undefined}let h;function loadProxy(){var e,t,r,i;const n=((e=process===null||process===void 0?void 0:process.env)===null||e===void 0?void 0:e.HTTPS_PROXY)||((t=process===null||process===void 0?void 0:process.env)===null||t===void 0?void 0:t.https_proxy)||((r=process===null||process===void 0?void 0:process.env)===null||r===void 0?void 0:r.HTTP_PROXY)||((i=process===null||process===void 0?void 0:process.env)===null||i===void 0?void 0:i.http_proxy);if(n){h=p.HttpsProxyAgent}return n}loadProxy();function skipProxy(e){var t;const r=(t=process.env.NO_PROXY)!==null&&t!==void 0?t:process.env.no_proxy;if(!r){return false}const i=r.split(",");const n=new l.URL(e);return!!i.find((e=>{if(e.startsWith("*.")||e.startsWith(".")){e=e.replace(/^\*\./,".");return n.hostname.endsWith(e)}else{return e===n.origin||e===n.hostname}}))}function getProxy(e){if(skipProxy(e)){return undefined}else{return loadProxy()}}class Gaxios{constructor(e){this.agentCache=new Map;this.defaults=e||{}}async request(e={}){e=this.validateOpts(e);return this._request(e)}async _defaultAdapter(e){const t=e.fetchImplementation||u;const r=await t(e.url,e);const i=await this.getResponseData(e,r);return this.translateResponse(e,r,i)}async _request(e={}){try{let t;if(e.adapter){t=await e.adapter(e,this._defaultAdapter.bind(this))}else{t=await this._defaultAdapter(e)}if(!e.validateStatus(t.status)){if(e.responseType==="stream"){let e="";await new Promise((r=>{(t===null||t===void 0?void 0:t.data).on("data",(t=>{e+=t}));(t===null||t===void 0?void 0:t.data).on("end",r)}));t.data=e}throw new c.GaxiosError(`Request failed with status code ${t.status}`,e,t)}return t}catch(t){const r=t instanceof c.GaxiosError?t:new c.GaxiosError(t.message,e,undefined,t);const{shouldRetry:i,config:n}=await(0,d.getRetryConfig)(r);if(i&&n){r.config.retryConfig.currentRetryAttempt=n.retryConfig.currentRetryAttempt;return this._request(r.config)}throw r}}async getResponseData(e,t){switch(e.responseType){case"stream":return t.body;case"json":{let e=await t.text();try{e=JSON.parse(e)}catch(e){}return e}case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"text":return t.text();default:return this.getResponseDataFromContentType(t)}}validateOpts(e){const t=(0,n.default)(true,{},this.defaults,e);if(!t.url){throw new Error("URL is required.")}const r=t.baseUrl||t.baseURL;if(r){t.url=r+t.url}t.paramsSerializer=t.paramsSerializer||this.paramsSerializer;if(t.params&&Object.keys(t.params).length>0){let e=t.paramsSerializer(t.params);if(e.startsWith("?")){e=e.slice(1)}const r=t.url.includes("?")?"&":"?";t.url=t.url+r+e}if(typeof e.maxContentLength==="number"){t.size=e.maxContentLength}if(typeof e.maxRedirects==="number"){t.follow=e.maxRedirects}t.headers=t.headers||{};if(t.data){const e=typeof FormData==="undefined"?false:(t===null||t===void 0?void 0:t.data)instanceof FormData;if(A.default.readable(t.data)){t.body=t.data}else if(hasBuffer()&&Buffer.isBuffer(t.data)){t.body=t.data;if(!hasHeader(t,"Content-Type")){t.headers["Content-Type"]="application/json"}}else if(typeof t.data==="object"){if(!e){if(getHeader(t,"content-type")==="application/x-www-form-urlencoded"){t.body=t.paramsSerializer(t.data)}else{if(!hasHeader(t,"Content-Type")){t.headers["Content-Type"]="application/json"}t.body=JSON.stringify(t.data)}}}else{t.body=t.data}}t.validateStatus=t.validateStatus||this.validateStatus;t.responseType=t.responseType||"unknown";if(!t.headers["Accept"]&&t.responseType==="json"){t.headers["Accept"]="application/json"}t.method=t.method||"GET";const i=getProxy(t.url);if(i){if(this.agentCache.has(i)){t.agent=this.agentCache.get(i)}else{if(t.cert&&t.key){const e=new l.URL(i);t.agent=new h({port:e.port,host:e.host,protocol:e.protocol,cert:t.cert,key:t.key})}else{t.agent=new h(i)}this.agentCache.set(i,t.agent)}}else if(t.cert&&t.key){if(this.agentCache.has(t.key)){t.agent=this.agentCache.get(t.key)}else{t.agent=new s.Agent({cert:t.cert,key:t.key});this.agentCache.set(t.key,t.agent)}}if(typeof t.errorRedactor!=="function"&&t.errorRedactor!==false){t.errorRedactor=c.defaultErrorRedactor}return t}validateStatus(e){return e>=200&&e<300}paramsSerializer(e){return o.default.stringify(e)}translateResponse(e,t,r){const i={};t.headers.forEach(((e,t)=>{i[t]=e}));return{config:e,data:r,headers:i,status:t.status,statusText:t.statusText,request:{responseURL:t.url}}}async getResponseDataFromContentType(e){let t=e.headers.get("Content-Type");if(t===null){return e.text()}t=t.toLowerCase();if(t.includes("application/json")){let t=await e.text();try{t=JSON.parse(t)}catch(e){}return t}else if(t.includes("text/plain")||t.includes("text/html")){return e.text()}else{return e.blob()}}}t.Gaxios=Gaxios},9555:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.request=t.instance=t.Gaxios=t.GaxiosError=void 0;const i=r(8133);Object.defineProperty(t,"Gaxios",{enumerable:true,get:function(){return i.Gaxios}});var n=r(6129);Object.defineProperty(t,"GaxiosError",{enumerable:true,get:function(){return n.GaxiosError}});t.instance=new i.Gaxios;async function request(e){return t.instance.request(e)}t.request=request},1052:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getRetryConfig=void 0;async function getRetryConfig(e){var t;let r=getConfig(e);if(!e||!e.config||!r&&!e.config.retry){return{shouldRetry:false}}r=r||{};r.currentRetryAttempt=r.currentRetryAttempt||0;r.retry=r.retry===undefined||r.retry===null?3:r.retry;r.httpMethodsToRetry=r.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"];r.noResponseRetries=r.noResponseRetries===undefined||r.noResponseRetries===null?2:r.noResponseRetries;const i=[[100,199],[429,429],[500,599]];r.statusCodesToRetry=r.statusCodesToRetry||i;e.config.retryConfig=r;const n=r.shouldRetry||shouldRetryRequest;if(!await n(e)){return{shouldRetry:false,config:e.config}}const s=r.currentRetryAttempt?0:(t=r.retryDelay)!==null&&t!==void 0?t:100;const a=s+(Math.pow(2,r.currentRetryAttempt)-1)/2*1e3;e.config.retryConfig.currentRetryAttempt+=1;const o=r.retryBackoff?r.retryBackoff(e,a):new Promise((e=>{setTimeout(e,a)}));if(r.onRetryAttempt){r.onRetryAttempt(e)}await o;return{shouldRetry:true,config:e.config}}t.getRetryConfig=getRetryConfig;function shouldRetryRequest(e){var t;const r=getConfig(e);if(e.name==="AbortError"||((t=e.error)===null||t===void 0?void 0:t.name)==="AbortError"){return false}if(!r||r.retry===0){return false}if(!e.response&&(r.currentRetryAttempt||0)>=r.noResponseRetries){return false}if(!e.config.method||r.httpMethodsToRetry.indexOf(e.config.method.toUpperCase())<0){return false}if(e.response&&e.response.status){let t=false;for(const[i,n]of r.statusCodesToRetry){const r=e.response.status;if(r>=i&&r<=n){t=true;break}}if(!t){return false}}r.currentRetryAttempt=r.currentRetryAttempt||0;if(r.currentRetryAttempt>=r.retry){return false}return true}function getConfig(e){if(e&&e.config&&e.config.retryConfig){return e.config.retryConfig}return}},1904:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.detectGCPResidency=t.isGoogleComputeEngine=t.isGoogleComputeEngineMACAddress=t.isGoogleComputeEngineLinux=t.isGoogleCloudServerless=t.GCE_LINUX_BIOS_PATHS=void 0;const i=r(7147);const n=r(2037);t.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};const s=/^42:01/;function isGoogleCloudServerless(){const e=process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE;return!!e}t.isGoogleCloudServerless=isGoogleCloudServerless;function isGoogleComputeEngineLinux(){if((0,n.platform)()!=="linux")return false;try{(0,i.statSync)(t.GCE_LINUX_BIOS_PATHS.BIOS_DATE);const e=(0,i.readFileSync)(t.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(e)}catch(e){return false}}t.isGoogleComputeEngineLinux=isGoogleComputeEngineLinux;function isGoogleComputeEngineMACAddress(){const e=(0,n.networkInterfaces)();for(const t of Object.values(e)){if(!t)continue;for(const{mac:e}of t){if(s.test(e)){return true}}}return false}t.isGoogleComputeEngineMACAddress=isGoogleComputeEngineMACAddress;function isGoogleComputeEngine(){return isGoogleComputeEngineLinux()||isGoogleComputeEngineMACAddress()}t.isGoogleComputeEngine=isGoogleComputeEngine;function detectGCPResidency(){return isGoogleCloudServerless()||isGoogleComputeEngine()}t.detectGCPResidency=detectGCPResidency},3563:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){if(i===undefined)i=r;var n=Object.getOwnPropertyDescriptor(t,r);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,i,n)}:function(e,t,r,i){if(i===undefined)i=r;e[i]=t[r]});var n=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))i(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});t.requestTimeout=t.setGCPResidency=t.getGCPResidency=t.gcpResidencyCache=t.resetIsAvailableCache=t.isAvailable=t.bulk=t.universe=t.project=t.instance=t.METADATA_SERVER_DETECTION=t.HEADERS=t.HEADER_VALUE=t.HEADER_NAME=t.SECONDARY_HOST_ADDRESS=t.HOST_ADDRESS=t.BASE_PATH=void 0;const s=r(9555);const a=r(5031);const o=r(1904);t.BASE_PATH="/computeMetadata/v1";t.HOST_ADDRESS="http://169.254.169.254";t.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";t.HEADER_NAME="Metadata-Flavor";t.HEADER_VALUE="Google";t.HEADERS=Object.freeze({[t.HEADER_NAME]:t.HEADER_VALUE});t.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"});function getBaseUrl(e){if(!e){e=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||t.HOST_ADDRESS}if(!/^https?:\/\//.test(e)){e=`http://${e}`}return new URL(t.BASE_PATH,e).href}function validate(e){Object.keys(e).forEach((e=>{switch(e){case"params":case"property":case"headers":break;case"qs":throw new Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw new Error(`'${e}' is not a valid configuration option.`)}}))}async function metadataAccessor(e,r={},i=3,n=false){let o="";let A={};let l={};if(typeof e==="object"){const t=e;o=t.metadataKey;A=t.params||A;l=t.headers||l;i=t.noResponseRetries||i;n=t.fastFail||n}else{o=e}if(typeof r==="string"){o+=`/${r}`}else{validate(r);if(r.property){o+=`/${r.property}`}l=r.headers||l;A=r.params||A}try{const e=n?fastFailMetadataRequest:s.request;const r=await e({url:`${getBaseUrl()}/${o}`,headers:{...t.HEADERS,...l},retryConfig:{noResponseRetries:i},params:A,responseType:"text",timeout:requestTimeout()});if(r.headers[t.HEADER_NAME.toLowerCase()]!==t.HEADER_VALUE){throw new Error(`Invalid response from metadata service: incorrect ${t.HEADER_NAME} header.`)}else if(!r.data){throw new Error("Invalid response from the metadata service")}if(typeof r.data==="string"){try{return a.parse(r.data)}catch(e){}}return r.data}catch(e){const t=e;if(t.response&&t.response.status!==200){t.message=`Unsuccessful response status code. ${t.message}`}throw e}}async function fastFailMetadataRequest(e){const r={...e,url:e.url.replace(getBaseUrl(),getBaseUrl(t.SECONDARY_HOST_ADDRESS))};let i=false;const n=(0,s.request)(e).then((e=>{i=true;return e})).catch((e=>{if(i){return a}else{i=true;throw e}}));const a=(0,s.request)(r).then((e=>{i=true;return e})).catch((e=>{if(i){return n}else{i=true;throw e}}));return Promise.race([n,a])}function instance(e){return metadataAccessor("instance",e)}t.instance=instance;function project(e){return metadataAccessor("project",e)}t.project=project;function universe(e){return metadataAccessor("universe",e)}t.universe=universe;async function bulk(e){const t={};await Promise.all(e.map((e=>(async()=>{const r=await metadataAccessor(e);const i=e.metadataKey;t[i]=r})())));return t}t.bulk=bulk;function detectGCPAvailableRetries(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}let A;async function isAvailable(){if(process.env.METADATA_SERVER_DETECTION){const e=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(e in t.METADATA_SERVER_DETECTION)){throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${e}\`, but it should be \`${Object.keys(t.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`)}switch(e){case"assume-present":return true;case"none":return false;case"bios-only":return getGCPResidency();case"ping-only":}}try{if(A===undefined){A=metadataAccessor("instance",undefined,detectGCPAvailableRetries(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))}await A;return true}catch(e){const t=e;if(process.env.DEBUG_AUTH){console.info(t)}if(t.type==="request-timeout"){return false}if(t.response&&t.response.status===404){return false}else{if(!(t.response&&t.response.status===404)&&(!t.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(t.code))){let e="UNKNOWN";if(t.code)e=t.code;process.emitWarning(`received unexpected error = ${t.message} code = ${e}`,"MetadataLookupWarning")}return false}}}t.isAvailable=isAvailable;function resetIsAvailableCache(){A=undefined}t.resetIsAvailableCache=resetIsAvailableCache;t.gcpResidencyCache=null;function getGCPResidency(){if(t.gcpResidencyCache===null){setGCPResidency()}return t.gcpResidencyCache}t.getGCPResidency=getGCPResidency;function setGCPResidency(e=null){t.gcpResidencyCache=e!==null?e:(0,o.detectGCPResidency)()}t.setGCPResidency=setGCPResidency;function requestTimeout(){return getGCPResidency()?0:3e3}t.requestTimeout=requestTimeout;n(r(1904),t)},7625:(e,t,r)=>{t.setopts=setopts;t.ownProp=ownProp;t.makeAbs=makeAbs;t.finish=finish;t.mark=mark;t.isIgnored=isIgnored;t.childrenIgnored=childrenIgnored;function ownProp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var i=r(7147);var n=r(1017);var s=r(6453);var a=r(1017).isAbsolute;var o=s.Minimatch;function alphasort(e,t){return e.localeCompare(t,"en")}function setupIgnores(e,t){e.ignore=t.ignore||[];if(!Array.isArray(e.ignore))e.ignore=[e.ignore];if(e.ignore.length){e.ignore=e.ignore.map(ignoreMap)}}function ignoreMap(e){var t=null;if(e.slice(-3)==="/**"){var r=e.replace(/(\/\*\*)+$/,"");t=new o(r,{dot:true})}return{matcher:new o(e,{dot:true}),gmatcher:t}}function setopts(e,t,r){if(!r)r={};if(r.matchBase&&-1===t.indexOf("/")){if(r.noglobstar){throw new Error("base matching requires globstar")}t="**/"+t}e.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===false;if(e.windowsPathsNoEscape){t=t.replace(/\\/g,"/")}e.silent=!!r.silent;e.pattern=t;e.strict=r.strict!==false;e.realpath=!!r.realpath;e.realpathCache=r.realpathCache||Object.create(null);e.follow=!!r.follow;e.dot=!!r.dot;e.mark=!!r.mark;e.nodir=!!r.nodir;if(e.nodir)e.mark=true;e.sync=!!r.sync;e.nounique=!!r.nounique;e.nonull=!!r.nonull;e.nosort=!!r.nosort;e.nocase=!!r.nocase;e.stat=!!r.stat;e.noprocess=!!r.noprocess;e.absolute=!!r.absolute;e.fs=r.fs||i;e.maxLength=r.maxLength||Infinity;e.cache=r.cache||Object.create(null);e.statCache=r.statCache||Object.create(null);e.symlinks=r.symlinks||Object.create(null);setupIgnores(e,r);e.changedCwd=false;var s=process.cwd();if(!ownProp(r,"cwd"))e.cwd=n.resolve(s);else{e.cwd=n.resolve(r.cwd);e.changedCwd=e.cwd!==s}e.root=r.root||n.resolve(e.cwd,"/");e.root=n.resolve(e.root);e.cwdAbs=a(e.cwd)?e.cwd:makeAbs(e,e.cwd);e.nomount=!!r.nomount;if(process.platform==="win32"){e.root=e.root.replace(/\\/g,"/");e.cwd=e.cwd.replace(/\\/g,"/");e.cwdAbs=e.cwdAbs.replace(/\\/g,"/")}r.nonegate=true;r.nocomment=true;e.minimatch=new o(t,r);e.options=e.minimatch.options}function finish(e){var t=e.nounique;var r=t?[]:Object.create(null);for(var i=0,n=e.matches.length;i{e.exports=glob;var i=r(6863);var n=r(6453);var s=n.Minimatch;var a=r(4124);var o=r(2361).EventEmitter;var A=r(1017);var l=r(9491);var c=r(1017).isAbsolute;var d=r(9010);var p=r(7625);var u=p.setopts;var h=p.ownProp;var g=r(2492);var E=r(3837);var C=p.childrenIgnored;var B=p.isIgnored;var I=r(1223);function glob(e,t,r){if(typeof t==="function")r=t,t={};if(!t)t={};if(t.sync){if(r)throw new TypeError("callback provided to sync glob");return d(e,t)}return new Glob(e,t,r)}glob.sync=d;var Q=glob.GlobSync=d.GlobSync;glob.glob=glob;function extend(e,t){if(t===null||typeof t!=="object"){return e}var r=Object.keys(t);var i=r.length;while(i--){e[r[i]]=t[r[i]]}return e}glob.hasMagic=function(e,t){var r=extend({},t);r.noprocess=true;var i=new Glob(e,r);var n=i.minimatch.set;if(!e)return false;if(n.length>1)return true;for(var s=0;sthis.maxLength)return t();if(!this.stat&&h(this.cache,r)){var n=this.cache[r];if(Array.isArray(n))n="DIR";if(!i||n==="DIR")return t(null,n);if(i&&n==="FILE")return t()}var s;var a=this.statCache[r];if(a!==undefined){if(a===false)return t(null,a);else{var o=a.isDirectory()?"DIR":"FILE";if(i&&o==="FILE")return t();else return t(null,o,a)}}var A=this;var l=g("stat\0"+r,lstatcb_);if(l)A.fs.lstat(r,l);function lstatcb_(i,n){if(n&&n.isSymbolicLink()){return A.fs.stat(r,(function(i,s){if(i)A._stat2(e,r,null,n,t);else A._stat2(e,r,i,s,t)}))}else{A._stat2(e,r,i,n,t)}}};Glob.prototype._stat2=function(e,t,r,i,n){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR")){this.statCache[t]=false;return n()}var s=e.slice(-1)==="/";this.statCache[t]=i;if(t.slice(-1)==="/"&&i&&!i.isDirectory())return n(null,false,i);var a=true;if(i)a=i.isDirectory()?"DIR":"FILE";this.cache[t]=this.cache[t]||a;if(s&&a==="FILE")return n();return n(null,a,i)}},3438:e=>{const t=typeof process==="object"&&process&&process.platform==="win32";e.exports=t?{sep:"\\"}:{sep:"/"}},6453:(e,t,r)=>{const i=e.exports=(e,t,r={})=>{assertValidPattern(t);if(!r.nocomment&&t.charAt(0)==="#"){return false}return new Minimatch(t,r).match(e)};e.exports=i;const n=r(3438);i.sep=n.sep;const s=Symbol("globstar **");i.GLOBSTAR=s;const a=r(3717);const o={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};const A="[^/]";const l=A+"*?";const c="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";const d="(?:(?!(?:\\/|^)\\.).)*?";const charSet=e=>e.split("").reduce(((e,t)=>{e[t]=true;return e}),{});const p=charSet("().*{}+?[]^$\\!");const u=charSet("[.(");const h=/\/+/;i.filter=(e,t={})=>(r,n,s)=>i(r,e,t);const ext=(e,t={})=>{const r={};Object.keys(e).forEach((t=>r[t]=e[t]));Object.keys(t).forEach((e=>r[e]=t[e]));return r};i.defaults=e=>{if(!e||typeof e!=="object"||!Object.keys(e).length){return i}const t=i;const m=(r,i,n)=>t(r,i,ext(e,n));m.Minimatch=class Minimatch extends t.Minimatch{constructor(t,r){super(t,ext(e,r))}};m.Minimatch.defaults=r=>t.defaults(ext(e,r)).Minimatch;m.filter=(r,i)=>t.filter(r,ext(e,i));m.defaults=r=>t.defaults(ext(e,r));m.makeRe=(r,i)=>t.makeRe(r,ext(e,i));m.braceExpand=(r,i)=>t.braceExpand(r,ext(e,i));m.match=(r,i,n)=>t.match(r,i,ext(e,n));return m};i.braceExpand=(e,t)=>braceExpand(e,t);const braceExpand=(e,t={})=>{assertValidPattern(e);if(t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)){return[e]}return a(e)};const g=1024*64;const assertValidPattern=e=>{if(typeof e!=="string"){throw new TypeError("invalid pattern")}if(e.length>g){throw new TypeError("pattern is too long")}};const E=Symbol("subparse");i.makeRe=(e,t)=>new Minimatch(e,t||{}).makeRe();i.match=(e,t,r={})=>{const i=new Minimatch(t,r);e=e.filter((e=>i.match(e)));if(i.options.nonull&&!e.length){e.push(t)}return e};const globUnescape=e=>e.replace(/\\(.)/g,"$1");const charUnescape=e=>e.replace(/\\([^-\]])/g,"$1");const regExpEscape=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");const braExpEscape=e=>e.replace(/[[\]\\]/g,"\\$&");class Minimatch{constructor(e,t){assertValidPattern(e);if(!t)t={};this.options=t;this.set=[];this.pattern=e;this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===false;if(this.windowsPathsNoEscape){this.pattern=this.pattern.replace(/\\/g,"/")}this.regexp=null;this.negate=false;this.comment=false;this.empty=false;this.partial=!!t.partial;this.make()}debug(){}make(){const e=this.pattern;const t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=true;return}if(!e){this.empty=true;return}this.parseNegate();let r=this.globSet=this.braceExpand();if(t.debug)this.debug=(...e)=>console.error(...e);this.debug(this.pattern,r);r=this.globParts=r.map((e=>e.split(h)));this.debug(this.pattern,r);r=r.map(((e,t,r)=>e.map(this.parse,this)));this.debug(this.pattern,r);r=r.filter((e=>e.indexOf(false)===-1));this.debug(this.pattern,r);this.set=r}parseNegate(){if(this.options.nonegate)return;const e=this.pattern;let t=false;let r=0;for(let i=0;i>> no match, partial?",e,d,t,p);if(d===o)return true}return false}var h;if(typeof l==="string"){h=c===l;this.debug("string match",l,c,h)}else{h=c.match(l);this.debug("pattern match",l,c,h)}if(!h)return false}if(n===o&&a===A){return true}else if(n===o){return r}else if(a===A){return n===o-1&&e[n]===""}throw new Error("wtf?")}braceExpand(){return braceExpand(this.pattern,this.options)}parse(e,t){assertValidPattern(e);const r=this.options;if(e==="**"){if(!r.noglobstar)return s;else e="*"}if(e==="")return"";let i="";let n=false;let a=false;const c=[];const d=[];let h;let g=false;let C=-1;let B=-1;let I;let Q;let y;let w=e.charAt(0)===".";let v=r.dot||w;const patternStart=()=>w?"":v?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)";const subPatternStart=e=>e.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)";const clearStateChar=()=>{if(h){switch(h){case"*":i+=l;n=true;break;case"?":i+=A;n=true;break;default:i+="\\"+h;break}this.debug("clearStateChar %j %j",h,i);h=false}};for(let t=0,s;t{if(!r){r="\\"}return t+t+r+"|"}));this.debug("tail=%j\n %s",e,e,Q,i);const t=Q.type==="*"?l:Q.type==="?"?A:"\\"+Q.type;n=true;i=i.slice(0,Q.reStart)+t+"\\("+e}clearStateChar();if(a){i+="\\\\"}const b=u[i.charAt(0)];for(let e=d.length-1;e>-1;e--){const r=d[e];const n=i.slice(0,r.reStart);const s=i.slice(r.reStart,r.reEnd-8);let a=i.slice(r.reEnd);const o=i.slice(r.reEnd-8,r.reEnd)+a;const A=n.split(")").length;const l=n.split("(").length-A;let c=a;for(let e=0;e{e=e.map((e=>typeof e==="string"?regExpEscape(e):e===s?s:e._src)).reduce(((e,t)=>{if(!(e[e.length-1]===s&&t===s)){e.push(t)}return e}),[]);e.forEach(((t,i)=>{if(t!==s||e[i-1]===s){return}if(i===0){if(e.length>1){e[i+1]="(?:\\/|"+r+"\\/)?"+e[i+1]}else{e[i]=r}}else if(i===e.length-1){e[i-1]+="(?:\\/|"+r+")?"}else{e[i-1]+="(?:\\/|\\/"+r+"\\/)"+e[i+1];e[i+1]=s}}));return e.filter((e=>e!==s)).join("/")})).join("|");n="^(?:"+n+")$";if(this.negate)n="^(?!"+n+").*$";try{this.regexp=new RegExp(n,i)}catch(e){this.regexp=false}return this.regexp}match(e,t=this.partial){this.debug("match",e,this.pattern);if(this.comment)return false;if(this.empty)return e==="";if(e==="/"&&t)return true;const r=this.options;if(n.sep!=="/"){e=e.split(n.sep).join("/")}e=e.split(h);this.debug(this.pattern,"split",e);const i=this.set;this.debug(this.pattern,"set",i);let s;for(let t=e.length-1;t>=0;t--){s=e[t];if(s)break}for(let n=0;n{e.exports=globSync;globSync.GlobSync=GlobSync;var i=r(6863);var n=r(6453);var s=n.Minimatch;var a=r(1957).Glob;var o=r(3837);var A=r(1017);var l=r(9491);var c=r(1017).isAbsolute;var d=r(7625);var p=d.setopts;var u=d.ownProp;var h=d.childrenIgnored;var g=d.isIgnored;function globSync(e,t){if(typeof t==="function"||arguments.length===3)throw new TypeError("callback provided to sync glob\n"+"See: https://github.com/isaacs/node-glob/issues/167");return new GlobSync(e,t).found}function GlobSync(e,t){if(!e)throw new Error("must provide pattern");if(typeof t==="function"||arguments.length===3)throw new TypeError("callback provided to sync glob\n"+"See: https://github.com/isaacs/node-glob/issues/167");if(!(this instanceof GlobSync))return new GlobSync(e,t);p(this,e,t);if(this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var i=0;ithis.maxLength)return false;if(!this.stat&&u(this.cache,t)){var i=this.cache[t];if(Array.isArray(i))i="DIR";if(!r||i==="DIR")return i;if(r&&i==="FILE")return false}var n;var s=this.statCache[t];if(!s){var a;try{a=this.fs.lstatSync(t)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR")){this.statCache[t]=false;return false}}if(a&&a.isSymbolicLink()){try{s=this.fs.statSync(t)}catch(e){s=a}}else{s=a}}this.statCache[t]=s;var i=true;if(s)i=s.isDirectory()?"DIR":"FILE";this.cache[t]=this.cache[t]||i;if(r&&i==="FILE")return false;return i};GlobSync.prototype._mark=function(e){return d.mark(this,e)};GlobSync.prototype._makeAbs=function(e){return d.makeAbs(this,e)}},4627:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.AuthClient=t.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=t.DEFAULT_UNIVERSE=void 0;const i=r(2361);const n=r(2649);const s=r(8905);t.DEFAULT_UNIVERSE="googleapis.com";t.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=5*60*1e3;class AuthClient extends i.EventEmitter{constructor(e={}){var r,i,a,o,A;super();this.credentials={};this.eagerRefreshThresholdMillis=t.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;this.forceRefreshOnFailure=false;this.universeDomain=t.DEFAULT_UNIVERSE;const l=(0,s.originalOrCamelOptions)(e);this.projectId=(r=l.get("project_id"))!==null&&r!==void 0?r:null;this.quotaProjectId=l.get("quota_project_id");this.credentials=(i=l.get("credentials"))!==null&&i!==void 0?i:{};this.universeDomain=(a=l.get("universe_domain"))!==null&&a!==void 0?a:t.DEFAULT_UNIVERSE;this.transporter=(o=e.transporter)!==null&&o!==void 0?o:new n.DefaultTransporter;if(e.transporterOptions){this.transporter.defaults=e.transporterOptions}if(e.eagerRefreshThresholdMillis){this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=(A=e.forceRefreshOnFailure)!==null&&A!==void 0?A:false}setCredentials(e){this.credentials=e}addSharedMetadataHeaders(e){if(!e["x-goog-user-project"]&&this.quotaProjectId){e["x-goog-user-project"]=this.quotaProjectId}return e}}t.AuthClient=AuthClient},1569:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.AwsClient=void 0;const i=r(1754);const n=r(7391);class AwsClient extends n.BaseExternalAccountClient{constructor(e,t){super(e,t);this.environmentId=e.credential_source.environment_id;this.regionUrl=e.credential_source.region_url;this.securityCredentialsUrl=e.credential_source.url;this.regionalCredVerificationUrl=e.credential_source.regional_cred_verification_url;this.imdsV2SessionTokenUrl=e.credential_source.imdsv2_session_token_url;this.awsRequestSigner=null;this.region="";this.credentialSourceType="aws";this.validateEnvironmentId()}validateEnvironmentId(){var e;const t=(e=this.environmentId)===null||e===void 0?void 0:e.match(/^(aws)(\d+)$/);if(!t||!this.regionalCredVerificationUrl){throw new Error('No valid AWS "credential_source" provided')}else if(parseInt(t[2],10)!==1){throw new Error(`aws version "${t[2]}" is not supported in the current build.`)}}async retrieveSubjectToken(){if(!this.awsRequestSigner){const e={};if(this.shouldUseMetadataServer()&&this.imdsV2SessionTokenUrl){e["x-aws-ec2-metadata-token"]=await this.getImdsV2SessionToken()}this.region=await this.getAwsRegion(e);this.awsRequestSigner=new i.AwsRequestSigner((async()=>{if(this.securityCredentialsFromEnv){return this.securityCredentialsFromEnv}const t=await this.getAwsRoleName(e);const r=await this.getAwsSecurityCredentials(t,e);return{accessKeyId:r.AccessKeyId,secretAccessKey:r.SecretAccessKey,token:r.Token}}),this.region)}const e=await this.awsRequestSigner.getRequestOptions({url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"});const t=[];const r=Object.assign({"x-goog-cloud-target-resource":this.audience},e.headers);for(const e in r){t.push({key:e,value:r[e]})}return encodeURIComponent(JSON.stringify({url:e.url,method:e.method,headers:t}))}async getImdsV2SessionToken(){const e={url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};const t=await this.transporter.request(e);return t.data}async getAwsRegion(e){if(this.regionFromEnv){return this.regionFromEnv}if(!this.regionUrl){throw new Error("Unable to determine AWS region due to missing "+'"options.credential_source.region_url"')}const t={url:this.regionUrl,method:"GET",responseType:"text",headers:e};const r=await this.transporter.request(t);return r.data.substr(0,r.data.length-1)}async getAwsRoleName(e){if(!this.securityCredentialsUrl){throw new Error("Unable to determine AWS role name due to missing "+'"options.credential_source.url"')}const t={url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers:e};const r=await this.transporter.request(t);return r.data}async getAwsSecurityCredentials(e,t){const r=await this.transporter.request({url:`${this.securityCredentialsUrl}/${e}`,responseType:"json",headers:t});return r.data}shouldUseMetadataServer(){return!this.regionFromEnv||!this.securityCredentialsFromEnv}get regionFromEnv(){return process.env["AWS_REGION"]||process.env["AWS_DEFAULT_REGION"]||null}get securityCredentialsFromEnv(){if(process.env["AWS_ACCESS_KEY_ID"]&&process.env["AWS_SECRET_ACCESS_KEY"]){return{accessKeyId:process.env["AWS_ACCESS_KEY_ID"],secretAccessKey:process.env["AWS_SECRET_ACCESS_KEY"],token:process.env["AWS_SESSION_TOKEN"]}}return null}}t.AwsClient=AwsClient;AwsClient.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";AwsClient.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"},1754:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.AwsRequestSigner=void 0;const i=r(8043);const n="AWS4-HMAC-SHA256";const s="aws4_request";class AwsRequestSigner{constructor(e,t){this.getCredentials=e;this.region=t;this.crypto=(0,i.createCrypto)()}async getRequestOptions(e){if(!e.url){throw new Error('"url" is required in "amzOptions"')}const t=typeof e.data==="object"?JSON.stringify(e.data):e.data;const r=e.url;const i=e.method||"GET";const n=e.body||t;const s=e.headers;const a=await this.getCredentials();const o=new URL(r);const A=await generateAuthenticationHeaderMap({crypto:this.crypto,host:o.host,canonicalUri:o.pathname,canonicalQuerystring:o.search.substr(1),method:i,region:this.region,securityCredentials:a,requestPayload:n,additionalAmzHeaders:s});const l=Object.assign(A.amzDate?{"x-amz-date":A.amzDate}:{},{Authorization:A.authorizationHeader,host:o.host},s||{});if(a.token){Object.assign(l,{"x-amz-security-token":a.token})}const c={url:r,method:i,headers:l};if(typeof n!=="undefined"){c.body=n}return c}}t.AwsRequestSigner=AwsRequestSigner;async function sign(e,t,r){return await e.signWithHmacSha256(t,r)}async function getSigningKey(e,t,r,i,n){const s=await sign(e,`AWS4${t}`,r);const a=await sign(e,s,i);const o=await sign(e,a,n);const A=await sign(e,o,"aws4_request");return A}async function generateAuthenticationHeaderMap(e){const t=e.additionalAmzHeaders||{};const r=e.requestPayload||"";const a=e.host.split(".")[0];const o=new Date;const A=o.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,"");const l=o.toISOString().replace(/[-]/g,"").replace(/T.*/,"");const c={};Object.keys(t).forEach((e=>{c[e.toLowerCase()]=t[e]}));if(e.securityCredentials.token){c["x-amz-security-token"]=e.securityCredentials.token}const d=Object.assign({host:e.host},c.date?{}:{"x-amz-date":A},c);let p="";const u=Object.keys(d).sort();u.forEach((e=>{p+=`${e}:${d[e]}\n`}));const h=u.join(";");const g=await e.crypto.sha256DigestHex(r);const E=`${e.method}\n`+`${e.canonicalUri}\n`+`${e.canonicalQuerystring}\n`+`${p}\n`+`${h}\n`+`${g}`;const C=`${l}/${e.region}/${a}/${s}`;const B=`${n}\n`+`${A}\n`+`${C}\n`+await e.crypto.sha256DigestHex(E);const I=await getSigningKey(e.crypto,e.securityCredentials.secretAccessKey,l,e.region,a);const Q=await sign(e.crypto,I,B);const y=`${n} Credential=${e.securityCredentials.accessKeyId}/`+`${C}, SignedHeaders=${h}, `+`Signature=${(0,i.fromArrayBufferToHex)(Q)}`;return{amzDate:c.date?undefined:A,authorizationHeader:y,canonicalQuerystring:e.canonicalQuerystring}}},7391:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.BaseExternalAccountClient=t.DEFAULT_UNIVERSE=t.CLOUD_RESOURCE_MANAGER=t.EXTERNAL_ACCOUNT_TYPE=t.EXPIRATION_TIME_OFFSET=void 0;const i=r(2781);const n=r(4627);const s=r(6308);const a=r(8905);const o="urn:ietf:params:oauth:grant-type:token-exchange";const A="urn:ietf:params:oauth:token-type:access_token";const l="https://www.googleapis.com/auth/cloud-platform";const c=3600;t.EXPIRATION_TIME_OFFSET=5*60*1e3;t.EXTERNAL_ACCOUNT_TYPE="external_account";t.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";const d="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+";const p=r(1402);var u=r(4627);Object.defineProperty(t,"DEFAULT_UNIVERSE",{enumerable:true,get:function(){return u.DEFAULT_UNIVERSE}});class BaseExternalAccountClient extends n.AuthClient{constructor(e,r){super({...e,...r});const i=(0,a.originalOrCamelOptions)(e);if(i.get("type")!==t.EXTERNAL_ACCOUNT_TYPE){throw new Error(`Expected "${t.EXTERNAL_ACCOUNT_TYPE}" type but `+`received "${e.type}"`)}const n=i.get("client_id");const o=i.get("client_secret");const A=i.get("token_url");const p=i.get("subject_token_type");const u=i.get("workforce_pool_user_project");const h=i.get("service_account_impersonation_url");const g=i.get("service_account_impersonation");const E=(0,a.originalOrCamelOptions)(g).get("token_lifetime_seconds");if(n){this.clientAuth={confidentialClientType:"basic",clientId:n,clientSecret:o}}this.stsCredential=new s.StsCredentials(A,this.clientAuth);this.scopes=[l];this.cachedAccessToken=null;this.audience=i.get("audience");this.subjectTokenType=p;this.workforcePoolUserProject=u;const C=new RegExp(d);if(this.workforcePoolUserProject&&!this.audience.match(C)){throw new Error("workforcePoolUserProject should not be set for non-workforce pool "+"credentials.")}this.serviceAccountImpersonationUrl=h;this.serviceAccountImpersonationLifetime=E;if(this.serviceAccountImpersonationLifetime){this.configLifetimeRequested=true}else{this.configLifetimeRequested=false;this.serviceAccountImpersonationLifetime=c}this.projectNumber=this.getProjectNumber(this.audience)}getServiceAccountEmail(){var e;if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256){throw new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`)}const t=/serviceAccounts\/(?[^:]+):generateAccessToken$/;const r=t.exec(this.serviceAccountImpersonationUrl);return((e=r===null||r===void 0?void 0:r.groups)===null||e===void 0?void 0:e.email)||null}return null}setCredentials(e){super.setCredentials(e);this.cachedAccessToken=e}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const t={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(t)}request(e,t){if(t){this.requestAsync(e).then((e=>t(null,e)),(e=>t(e,e.response)))}else{return this.requestAsync(e)}}async getProjectId(){const e=this.projectNumber||this.workforcePoolUserProject;if(this.projectId){return this.projectId}else if(e){const r=await this.getRequestHeaders();const i=await this.transporter.request({headers:r,url:`${t.CLOUD_RESOURCE_MANAGER}${e}`,responseType:"json"});this.projectId=i.data.projectId;return this.projectId}return null}async requestAsync(e,t=false){let r;try{const t=await this.getRequestHeaders();e.headers=e.headers||{};if(t&&t["x-goog-user-project"]){e.headers["x-goog-user-project"]=t["x-goog-user-project"]}if(t&&t.Authorization){e.headers.Authorization=t.Authorization}r=await this.transporter.request(e)}catch(r){const n=r.response;if(n){const r=n.status;const s=n.config.data instanceof i.Readable;const a=r===401||r===403;if(!t&&a&&!s&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw r}return r}async refreshAccessTokenAsync(){const e=await this.retrieveSubjectToken();const t={grantType:o,audience:this.audience,requestedTokenType:A,subjectToken:e,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[l]:this.getScopesArray()};const r=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:undefined;const i={"x-goog-api-client":this.getMetricsHeaderValue()};const n=await this.stsCredential.exchangeToken(t,i,r);if(this.serviceAccountImpersonationUrl){this.cachedAccessToken=await this.getImpersonatedAccessToken(n.access_token)}else if(n.expires_in){this.cachedAccessToken={access_token:n.access_token,expiry_date:(new Date).getTime()+n.expires_in*1e3,res:n.res}}else{this.cachedAccessToken={access_token:n.access_token,res:n.res}}this.credentials={};Object.assign(this.credentials,this.cachedAccessToken);delete this.credentials.res;this.emit("tokens",{refresh_token:null,expiry_date:this.cachedAccessToken.expiry_date,access_token:this.cachedAccessToken.access_token,token_type:"Bearer",id_token:null});return this.cachedAccessToken}getProjectNumber(e){const t=e.match(/\/projects\/([^/]+)/);if(!t){return null}return t[1]}async getImpersonatedAccessToken(e){const t={url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"},responseType:"json"};const r=await this.transporter.request(t);const i=r.data;return{access_token:i.accessToken,expiry_date:new Date(i.expireTime).getTime(),res:r}}isExpired(e){const t=(new Date).getTime();return e.expiry_date?t>=e.expiry_date-this.eagerRefreshThresholdMillis:false}getScopesArray(){if(typeof this.scopes==="string"){return[this.scopes]}else if(typeof this.scopes==="undefined"){return[l]}else{return this.scopes}}getMetricsHeaderValue(){const e=process.version.replace(/^v/,"");const t=this.serviceAccountImpersonationUrl!==undefined;const r=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${e} auth/${p.version} google-byoid-sdk source/${r} sa-impersonation/${t} config-lifetime/${this.configLifetimeRequested}`}}t.BaseExternalAccountClient=BaseExternalAccountClient},6875:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Compute=void 0;const i=r(9555);const n=r(3563);const s=r(3936);class Compute extends s.OAuth2Client{constructor(e={}){super(e);this.credentials={expiry_date:1,refresh_token:"compute-placeholder"};this.serviceAccountEmail=e.serviceAccountEmail||"default";this.scopes=Array.isArray(e.scopes)?e.scopes:e.scopes?[e.scopes]:[]}async refreshTokenNoCache(e){const t=`service-accounts/${this.serviceAccountEmail}/token`;let r;try{const e={property:t};if(this.scopes.length>0){e.params={scopes:this.scopes.join(",")}}r=await n.instance(e)}catch(e){if(e instanceof i.GaxiosError){e.message=`Could not refresh access token: ${e.message}`;this.wrapError(e)}throw e}const s=r;if(r&&r.expires_in){s.expiry_date=(new Date).getTime()+r.expires_in*1e3;delete s.expires_in}this.emit("tokens",s);return{tokens:s,res:null}}async fetchIdToken(e){const t=`service-accounts/${this.serviceAccountEmail}/identity`+`?format=full&audience=${e}`;let r;try{const e={property:t};r=await n.instance(e)}catch(e){if(e instanceof Error){e.message=`Could not fetch ID token: ${e.message}`}throw e}return r}wrapError(e){const t=e.response;if(t&&t.status){e.status=t.status;if(t.status===403){e.message="A Forbidden error was returned while attempting to retrieve an access "+"token for the Compute Engine built-in service account. This may be because the Compute "+"Engine instance does not have the correct permission scopes specified: "+e.message}else if(t.status===404){e.message="A Not Found error was returned while attempting to retrieve an access"+"token for the Compute Engine built-in service account. This may be because the Compute "+"Engine instance does not have any permission scopes specified: "+e.message}}}}t.Compute=Compute},6270:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DownscopedClient=t.EXPIRATION_TIME_OFFSET=t.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;const i=r(2781);const n=r(4627);const s=r(6308);const a="urn:ietf:params:oauth:grant-type:token-exchange";const o="urn:ietf:params:oauth:token-type:access_token";const A="urn:ietf:params:oauth:token-type:access_token";const l="https://sts.googleapis.com/v1/token";t.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;t.EXPIRATION_TIME_OFFSET=5*60*1e3;class DownscopedClient extends n.AuthClient{constructor(e,r,i,n){super({...i,quotaProjectId:n});this.authClient=e;this.credentialAccessBoundary=r;if(r.accessBoundary.accessBoundaryRules.length===0){throw new Error("At least one access boundary rule needs to be defined.")}else if(r.accessBoundary.accessBoundaryRules.length>t.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error("The provided access boundary has more than "+`${t.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`)}for(const e of r.accessBoundary.accessBoundaryRules){if(e.availablePermissions.length===0){throw new Error("At least one permission should be defined in access boundary rules.")}}this.stsCredential=new s.StsCredentials(l);this.cachedDownscopedAccessToken=null}setCredentials(e){if(!e.expiry_date){throw new Error("The access token expiry_date field is missing in the provided "+"credentials.")}super.setCredentials(e);this.cachedDownscopedAccessToken=e}async getAccessToken(){if(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const t={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(t)}request(e,t){if(t){this.requestAsync(e).then((e=>t(null,e)),(e=>t(e,e.response)))}else{return this.requestAsync(e)}}async requestAsync(e,t=false){let r;try{const t=await this.getRequestHeaders();e.headers=e.headers||{};if(t&&t["x-goog-user-project"]){e.headers["x-goog-user-project"]=t["x-goog-user-project"]}if(t&&t.Authorization){e.headers.Authorization=t.Authorization}r=await this.transporter.request(e)}catch(r){const n=r.response;if(n){const r=n.status;const s=n.config.data instanceof i.Readable;const a=r===401||r===403;if(!t&&a&&!s&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw r}return r}async refreshAccessTokenAsync(){var e;const t=(await this.authClient.getAccessToken()).token;const r={grantType:a,requestedTokenType:o,subjectToken:t,subjectTokenType:A};const i=await this.stsCredential.exchangeToken(r,undefined,this.credentialAccessBoundary);const n=((e=this.authClient.credentials)===null||e===void 0?void 0:e.expiry_date)||null;const s=i.expires_in?(new Date).getTime()+i.expires_in*1e3:n;this.cachedDownscopedAccessToken={access_token:i.access_token,expiry_date:s,res:i.res};this.credentials={};Object.assign(this.credentials,this.cachedDownscopedAccessToken);delete this.credentials.res;this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null});return this.cachedDownscopedAccessToken}isExpired(e){const t=(new Date).getTime();return e.expiry_date?t>=e.expiry_date-this.eagerRefreshThresholdMillis:false}}t.DownscopedClient=DownscopedClient},1380:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getEnv=t.clear=t.GCPEnv=void 0;const i=r(3563);var n;(function(e){e["APP_ENGINE"]="APP_ENGINE";e["KUBERNETES_ENGINE"]="KUBERNETES_ENGINE";e["CLOUD_FUNCTIONS"]="CLOUD_FUNCTIONS";e["COMPUTE_ENGINE"]="COMPUTE_ENGINE";e["CLOUD_RUN"]="CLOUD_RUN";e["NONE"]="NONE"})(n||(t.GCPEnv=n={}));let s;function clear(){s=undefined}t.clear=clear;async function getEnv(){if(s){return s}s=getEnvMemoized();return s}t.getEnv=getEnv;async function getEnvMemoized(){let e=n.NONE;if(isAppEngine()){e=n.APP_ENGINE}else if(isCloudFunction()){e=n.CLOUD_FUNCTIONS}else if(await isComputeEngine()){if(await isKubernetesEngine()){e=n.KUBERNETES_ENGINE}else if(isCloudRun()){e=n.CLOUD_RUN}else{e=n.COMPUTE_ENGINE}}else{e=n.NONE}return e}function isAppEngine(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}function isCloudFunction(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}function isCloudRun(){return!!process.env.K_CONFIGURATION}async function isKubernetesEngine(){try{await i.instance("attributes/cluster-name");return true}catch(e){return false}}async function isComputeEngine(){return i.isAvailable()}},8749:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.InvalidSubjectTokenError=t.InvalidMessageFieldError=t.InvalidCodeFieldError=t.InvalidTokenTypeFieldError=t.InvalidExpirationTimeFieldError=t.InvalidSuccessFieldError=t.InvalidVersionFieldError=t.ExecutableResponseError=t.ExecutableResponse=void 0;const r="urn:ietf:params:oauth:token-type:saml2";const i="urn:ietf:params:oauth:token-type:id_token";const n="urn:ietf:params:oauth:token-type:jwt";class ExecutableResponse{constructor(e){if(!e.version){throw new InvalidVersionFieldError("Executable response must contain a 'version' field.")}if(e.success===undefined){throw new InvalidSuccessFieldError("Executable response must contain a 'success' field.")}this.version=e.version;this.success=e.success;if(this.success){this.expirationTime=e.expiration_time;this.tokenType=e.token_type;if(this.tokenType!==r&&this.tokenType!==i&&this.tokenType!==n){throw new InvalidTokenTypeFieldError("Executable response must contain a 'token_type' field when successful "+`and it must be one of ${i}, ${n}, or ${r}.`)}if(this.tokenType===r){if(!e.saml_response){throw new InvalidSubjectTokenError(`Executable response must contain a 'saml_response' field when token_type=${r}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new InvalidSubjectTokenError("Executable response must contain a 'id_token' field when "+`token_type=${i} or ${n}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new InvalidCodeFieldError("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new InvalidMessageFieldError("Executable response must contain a 'message' field when unsuccessful.")}this.errorCode=e.code;this.errorMessage=e.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==undefined&&this.expirationTime{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ExternalAccountAuthorizedUserClient=t.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;const i=r(4627);const n=r(9510);const s=r(9555);const a=r(2781);const o=r(7391);t.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";class ExternalAccountAuthorizedUserHandler extends n.OAuthClientAuthHandler{constructor(e,t,r){super(r);this.url=e;this.transporter=t}async refreshToken(e,t){const r=new URLSearchParams({grant_type:"refresh_token",refresh_token:e});const i={"Content-Type":"application/x-www-form-urlencoded",...t};const a={url:this.url,method:"POST",headers:i,data:r.toString(),responseType:"json"};this.applyClientAuthenticationOptions(a);try{const e=await this.transporter.request(a);const t=e.data;t.res=e;return t}catch(e){if(e instanceof s.GaxiosError&&e.response){throw(0,n.getErrorFromOAuthErrorResponse)(e.response.data,e)}throw e}}}class ExternalAccountAuthorizedUserClient extends i.AuthClient{constructor(e,t){super({...e,...t});this.refreshToken=e.refresh_token;const r={confidentialClientType:"basic",clientId:e.client_id,clientSecret:e.client_secret};this.externalAccountAuthorizedUserHandler=new ExternalAccountAuthorizedUserHandler(e.token_url,this.transporter,r);this.cachedAccessToken=null;this.quotaProjectId=e.quota_project_id;if(typeof(t===null||t===void 0?void 0:t.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=o.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=t.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(t===null||t===void 0?void 0:t.forceRefreshOnFailure);if(e.universe_domain){this.universeDomain=e.universe_domain}}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const t={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(t)}request(e,t){if(t){this.requestAsync(e).then((e=>t(null,e)),(e=>t(e,e.response)))}else{return this.requestAsync(e)}}async requestAsync(e,t=false){let r;try{const t=await this.getRequestHeaders();e.headers=e.headers||{};if(t&&t["x-goog-user-project"]){e.headers["x-goog-user-project"]=t["x-goog-user-project"]}if(t&&t.Authorization){e.headers.Authorization=t.Authorization}r=await this.transporter.request(e)}catch(r){const i=r.response;if(i){const r=i.status;const n=i.config.data instanceof a.Readable;const s=r===401||r===403;if(!t&&s&&!n&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw r}return r}async refreshAccessTokenAsync(){const e=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);this.cachedAccessToken={access_token:e.access_token,expiry_date:(new Date).getTime()+e.expires_in*1e3,res:e.res};if(e.refresh_token!==undefined){this.refreshToken=e.refresh_token}return this.cachedAccessToken}isExpired(e){const t=(new Date).getTime();return e.expiry_date?t>=e.expiry_date-this.eagerRefreshThresholdMillis:false}}t.ExternalAccountAuthorizedUserClient=ExternalAccountAuthorizedUserClient},4381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ExternalAccountClient=void 0;const i=r(7391);const n=r(117);const s=r(1569);const a=r(4782);class ExternalAccountClient{constructor(){throw new Error("ExternalAccountClients should be initialized via: "+"ExternalAccountClient.fromJSON(), "+"directly via explicit constructors, eg. "+"new AwsClient(options), new IdentityPoolClient(options), new"+"PluggableAuthClientOptions, or via "+"new GoogleAuth(options).getClient()")}static fromJSON(e,t){var r,o;if(e&&e.type===i.EXTERNAL_ACCOUNT_TYPE){if((r=e.credential_source)===null||r===void 0?void 0:r.environment_id){return new s.AwsClient(e,t)}else if((o=e.credential_source)===null||o===void 0?void 0:o.executable){return new a.PluggableAuthClient(e,t)}else{return new n.IdentityPoolClient(e,t)}}else{return null}}}t.ExternalAccountClient=ExternalAccountClient},695:function(e,t,r){"use strict";var i=this&&this.__classPrivateFieldGet||function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)};var n=this&&this.__classPrivateFieldSet||function(e,t,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r};var s,a,o;Object.defineProperty(t,"__esModule",{value:true});t.GoogleAuth=t.CLOUD_SDK_CLIENT_ID=void 0;const A=r(2081);const l=r(7147);const c=r(3563);const d=r(2037);const p=r(1017);const u=r(8043);const h=r(2649);const g=r(6875);const E=r(298);const C=r(1380);const B=r(3959);const I=r(8790);const Q=r(1103);const y=r(4381);const w=r(7391);const v=r(4627);const b=r(8765);const S=r(8905);t.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";const k={NO_PROJECT_ID_FOUND:"Unable to detect a Project Id in the current environment. \n"+"To learn more about authentication and Google APIs, visit: \n"+"https://cloud.google.com/docs/authentication/getting-started",NO_CREDENTIALS_FOUND:"Unable to find credentials in current environment. \n"+"To learn more about authentication and Google APIs, visit: \n"+"https://cloud.google.com/docs/authentication/getting-started",NO_UNIVERSE_DOMAIN_FOUND:"Unable to detect a Universe Domain in the current environment.\n"+"To learn more about Universe Domain retrieval, visit: \n"+"https://cloud.google.com/compute/docs/metadata/predefined-metadata-keys"};class GoogleAuth{get isGCE(){return this.checkIsGCE}constructor(e){s.add(this);this.checkIsGCE=undefined;this.jsonContent=null;this.cachedCredential=null;a.set(this,undefined);e=e||{};this._cachedProjectId=e.projectId||null;this.cachedCredential=e.authClient||null;this.keyFilename=e.keyFilename||e.keyFile;this.scopes=e.scopes;this.jsonContent=e.credentials||null;this.clientOptions=e.clientOptions}setGapicJWTValues(e){e.defaultServicePath=this.defaultServicePath;e.useJWTAccessWithScope=this.useJWTAccessWithScope;e.defaultScopes=this.defaultScopes}getProjectId(e){if(e){this.getProjectIdAsync().then((t=>e(null,t)),e)}else{return this.getProjectIdAsync()}}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===k.NO_PROJECT_ID_FOUND){return null}else{throw e}}}async findAndCacheProjectId(){let e=null;e||(e=await this.getProductionProjectId());e||(e=await this.getFileProjectId());e||(e=await this.getDefaultServiceProjectId());e||(e=await this.getGCEProjectId());e||(e=await this.getExternalAccountClientProjectId());if(e){this._cachedProjectId=e;return e}else{throw new Error(k.NO_PROJECT_ID_FOUND)}}async getProjectIdAsync(){if(this._cachedProjectId){return this._cachedProjectId}if(!this._findProjectIdPromise){this._findProjectIdPromise=this.findAndCacheProjectId()}return this._findProjectIdPromise}async getUniverseDomain(){var e,t;n(this,a,(e=i(this,a,"f"))!==null&&e!==void 0?e:(0,S.originalOrCamelOptions)(this.clientOptions).get("universe_domain"),"f");n(this,a,(t=i(this,a,"f"))!==null&&t!==void 0?t:await i(this,s,"m",o).call(this),"f");return i(this,a,"f")||v.DEFAULT_UNIVERSE}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(e={},t){let r;if(typeof e==="function"){t=e}else{r=e}if(t){this.getApplicationDefaultAsync(r).then((e=>t(null,e.credential,e.projectId)),t)}else{return this.getApplicationDefaultAsync(r)}}async getApplicationDefaultAsync(e={}){if(this.cachedCredential){return await this.prepareAndCacheADC(this.cachedCredential)}const t=process.env["GOOGLE_CLOUD_QUOTA_PROJECT"];let r;r=await this._tryGetApplicationCredentialsFromEnvironmentVariable(e);if(r){if(r instanceof B.JWT){r.scopes=this.scopes}else if(r instanceof w.BaseExternalAccountClient){r.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(r,t)}r=await this._tryGetApplicationCredentialsFromWellKnownFile(e);if(r){if(r instanceof B.JWT){r.scopes=this.scopes}else if(r instanceof w.BaseExternalAccountClient){r.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(r,t)}if(await this._checkIsGCE()){if(!(0,S.originalOrCamelOptions)(e).get("universe_domain")){e.universeDomain=await this.getUniverseDomain()}e.scopes=this.getAnyScopes();return await this.prepareAndCacheADC(new g.Compute(e),t)}throw new Error("Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.")}async prepareAndCacheADC(e,t){const r=await this.getProjectIdOptional();if(t){e.quotaProjectId=t}this.cachedCredential=e;return{credential:e,projectId:r}}async _checkIsGCE(){if(this.checkIsGCE===undefined){this.checkIsGCE=c.getGCPResidency()||await c.isAvailable()}return this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(e){const t=process.env["GOOGLE_APPLICATION_CREDENTIALS"]||process.env["google_application_credentials"];if(!t||t.length===0){return null}try{return this._getApplicationCredentialsFromFilePath(t,e)}catch(e){if(e instanceof Error){e.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${e.message}`}throw e}}async _tryGetApplicationCredentialsFromWellKnownFile(e){let t=null;if(this._isWindows()){t=process.env["APPDATA"]}else{const e=process.env["HOME"];if(e){t=p.join(e,".config")}}if(t){t=p.join(t,"gcloud","application_default_credentials.json");if(!l.existsSync(t)){t=null}}if(!t){return null}const r=await this._getApplicationCredentialsFromFilePath(t,e);return r}async _getApplicationCredentialsFromFilePath(e,t={}){if(!e||e.length===0){throw new Error("The file path is invalid.")}try{e=l.realpathSync(e);if(!l.lstatSync(e).isFile()){throw new Error}}catch(t){if(t instanceof Error){t.message=`The file at ${e} does not exist, or it is not a file. ${t.message}`}throw t}const r=l.createReadStream(e);return this.fromStream(r,t)}fromImpersonatedJSON(e){var t,r,i,n,s;if(!e){throw new Error("Must pass in a JSON object containing an impersonated refresh token")}if(e.type!==Q.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${Q.IMPERSONATED_ACCOUNT_TYPE}" type`)}if(!e.source_credentials){throw new Error("The incoming JSON object does not contain a source_credentials field")}if(!e.service_account_impersonation_url){throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field")}const a=new I.UserRefreshClient(e.source_credentials.client_id,e.source_credentials.client_secret,e.source_credentials.refresh_token);if(((t=e.service_account_impersonation_url)===null||t===void 0?void 0:t.length)>256){throw new RangeError(`Target principal is too long: ${e.service_account_impersonation_url}`)}const o=(i=(r=/(?[^/]+):generateAccessToken$/.exec(e.service_account_impersonation_url))===null||r===void 0?void 0:r.groups)===null||i===void 0?void 0:i.target;if(!o){throw new RangeError(`Cannot extract target principal from ${e.service_account_impersonation_url}`)}const A=(n=this.getAnyScopes())!==null&&n!==void 0?n:[];const l=new Q.Impersonated({delegates:(s=e.delegates)!==null&&s!==void 0?s:[],sourceClient:a,targetPrincipal:o,targetScopes:Array.isArray(A)?A:[A]});return l}fromJSON(e,t={}){let r;if(e.type===I.USER_REFRESH_ACCOUNT_TYPE){r=new I.UserRefreshClient(t);r.fromJSON(e)}else if(e.type===Q.IMPERSONATED_ACCOUNT_TYPE){r=this.fromImpersonatedJSON(e)}else if(e.type===w.EXTERNAL_ACCOUNT_TYPE){r=y.ExternalAccountClient.fromJSON(e,t);r.scopes=this.getAnyScopes()}else if(e.type===b.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){r=new b.ExternalAccountAuthorizedUserClient(e,t)}else{t.scopes=this.scopes;r=new B.JWT(t);this.setGapicJWTValues(r);r.fromJSON(e)}return r}_cacheClientFromJSON(e,t){const r=this.fromJSON(e,t);this.jsonContent=e;this.cachedCredential=r;return r}fromStream(e,t={},r){let i={};if(typeof t==="function"){r=t}else{i=t}if(r){this.fromStreamAsync(e,i).then((e=>r(null,e)),r)}else{return this.fromStreamAsync(e,i)}}fromStreamAsync(e,t){return new Promise(((r,i)=>{if(!e){throw new Error("Must pass in a stream containing the Google auth settings.")}let n="";e.setEncoding("utf8").on("error",i).on("data",(e=>n+=e)).on("end",(()=>{try{try{const e=JSON.parse(n);const i=this._cacheClientFromJSON(e,t);return r(i)}catch(e){if(!this.keyFilename)throw e;const t=new B.JWT({...this.clientOptions,keyFile:this.keyFilename});this.cachedCredential=t;this.setGapicJWTValues(t);return r(t)}}catch(e){return i(e)}}))}))}fromAPIKey(e,t){t=t||{};const r=new B.JWT(t);r.fromAPIKey(e);return r}_isWindows(){const e=d.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise((e=>{(0,A.exec)("gcloud config config-helper --format json",((t,r)=>{if(!t&&r){try{const t=JSON.parse(r).configuration.properties.core.project;e(t);return}catch(e){}}e(null)}))}))}getProductionProjectId(){return process.env["GCLOUD_PROJECT"]||process.env["GOOGLE_CLOUD_PROJECT"]||process.env["gcloud_project"]||process.env["google_cloud_project"]}async getFileProjectId(){if(this.cachedCredential){return this.cachedCredential.projectId}if(this.keyFilename){const e=await this.getClient();if(e&&e.projectId){return e.projectId}}const e=await this._tryGetApplicationCredentialsFromEnvironmentVariable();if(e){return e.projectId}else{return null}}async getExternalAccountClientProjectId(){if(!this.jsonContent||this.jsonContent.type!==w.EXTERNAL_ACCOUNT_TYPE){return null}const e=await this.getClient();return await e.getProjectId()}async getGCEProjectId(){try{const e=await c.project("project-id");return e}catch(e){return null}}getCredentials(e){if(e){this.getCredentialsAsync().then((t=>e(null,t)),e)}else{return this.getCredentialsAsync()}}async getCredentialsAsync(){const e=await this.getClient();if(e instanceof Q.Impersonated){return{client_email:e.getTargetPrincipal()}}if(e instanceof w.BaseExternalAccountClient){const t=e.getServiceAccountEmail();if(t){return{client_email:t,universe_domain:e.universeDomain}}}if(this.jsonContent){return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain}}if(await this._checkIsGCE()){const[e,t]=await Promise.all([c.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:e,universe_domain:t}}throw new Error(k.NO_CREDENTIALS_FOUND)}async getClient(){if(!this.cachedCredential){if(this.jsonContent){this._cacheClientFromJSON(this.jsonContent,this.clientOptions)}else if(this.keyFilename){const e=p.resolve(this.keyFilename);const t=l.createReadStream(e);await this.fromStreamAsync(t,this.clientOptions)}else{await this.getApplicationDefaultAsync(this.clientOptions)}}return this.cachedCredential}async getIdTokenClient(e){const t=await this.getClient();if(!("fetchIdToken"in t)){throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.")}return new E.IdTokenClient({targetAudience:e,idTokenProvider:t})}async getAccessToken(){const e=await this.getClient();return(await e.getAccessToken()).token}async getRequestHeaders(e){const t=await this.getClient();return t.getRequestHeaders(e)}async authorizeRequest(e){e=e||{};const t=e.url||e.uri;const r=await this.getClient();const i=await r.getRequestHeaders(t);e.headers=Object.assign(e.headers||{},i);return e}async request(e){const t=await this.getClient();return t.request(e)}getEnv(){return(0,C.getEnv)()}async sign(e){const t=await this.getClient();if(t instanceof Q.Impersonated){const r=await t.sign(e);return r.signedBlob}const r=(0,u.createCrypto)();if(t instanceof B.JWT&&t.key){const i=await r.sign(t.key,e);return i}const i=await this.getCredentials();if(!i.client_email){throw new Error("Cannot sign data without `client_email`.")}return this.signBlob(r,i.client_email,e)}async signBlob(e,t,r){const i="https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/"+`${t}:signBlob`;const n=await this.request({method:"POST",url:i,data:{payload:e.encodeBase64StringUtf8(r)}});return n.data.signedBlob}}t.GoogleAuth=GoogleAuth;a=new WeakMap,s=new WeakSet,o=async function _GoogleAuth_getUniverseFromMetadataServer(){var e;if(!await this._checkIsGCE())return;let t;try{t=await c.universe("universe_domain");t||(t=v.DEFAULT_UNIVERSE)}catch(r){if(r&&((e=r===null||r===void 0?void 0:r.response)===null||e===void 0?void 0:e.status)===404){t=v.DEFAULT_UNIVERSE}else{throw r}}return t};GoogleAuth.DefaultTransporter=h.DefaultTransporter},9735:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.IAMAuth=void 0;class IAMAuth{constructor(e,t){this.selector=e;this.token=t;this.selector=e;this.token=t}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}}t.IAMAuth=IAMAuth},117:(e,t,r)=>{"use strict";var i,n,s;Object.defineProperty(t,"__esModule",{value:true});t.IdentityPoolClient=void 0;const a=r(7147);const o=r(3837);const A=r(7391);const l=r(8905);const c=(0,o.promisify)((i=a.readFile)!==null&&i!==void 0?i:()=>{});const d=(0,o.promisify)((n=a.realpath)!==null&&n!==void 0?n:()=>{});const p=(0,o.promisify)((s=a.lstat)!==null&&s!==void 0?s:()=>{});class IdentityPoolClient extends A.BaseExternalAccountClient{constructor(e,t){super(e,t);const r=(0,l.originalOrCamelOptions)(e);const i=r.get("credential_source");const n=(0,l.originalOrCamelOptions)(i);this.file=n.get("file");this.url=n.get("url");this.headers=n.get("headers");if(this.file&&this.url){throw new Error('No valid Identity Pool "credential_source" provided, must be either file or url.')}else if(this.file&&!this.url){this.credentialSourceType="file"}else if(!this.file&&this.url){this.credentialSourceType="url"}else{throw new Error('No valid Identity Pool "credential_source" provided, must be either file or url.')}const s=(0,l.originalOrCamelOptions)(n.get("format"));this.formatType=s.get("type")||"text";this.formatSubjectTokenFieldName=s.get("subject_token_field_name");if(this.formatType!=="json"&&this.formatType!=="text"){throw new Error(`Invalid credential_source format "${this.formatType}"`)}if(this.formatType==="json"&&!this.formatSubjectTokenFieldName){throw new Error("Missing subject_token_field_name for JSON credential_source format")}}async retrieveSubjectToken(){if(this.file){return await this.getTokenFromFile(this.file,this.formatType,this.formatSubjectTokenFieldName)}return await this.getTokenFromUrl(this.url,this.formatType,this.formatSubjectTokenFieldName,this.headers)}async getTokenFromFile(e,t,r){try{e=await d(e);if(!(await p(e)).isFile()){throw new Error}}catch(t){if(t instanceof Error){t.message=`The file at ${e} does not exist, or it is not a file. ${t.message}`}throw t}let i;const n=await c(e,{encoding:"utf8"});if(t==="text"){i=n}else if(t==="json"&&r){const e=JSON.parse(n);i=e[r]}if(!i){throw new Error("Unable to parse the subject_token from the credential_source file")}return i}async getTokenFromUrl(e,t,r,i){const n={url:e,method:"GET",headers:i,responseType:t};let s;if(t==="text"){const e=await this.transporter.request(n);s=e.data}else if(t==="json"&&r){const e=await this.transporter.request(n);s=e.data[r]}if(!s){throw new Error("Unable to parse the subject_token from the credential_source URL")}return s}}t.IdentityPoolClient=IdentityPoolClient},298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.IdTokenClient=void 0;const i=r(3936);class IdTokenClient extends i.OAuth2Client{constructor(e){super(e);this.targetAudience=e.targetAudience;this.idTokenProvider=e.idTokenProvider}async getRequestMetadataAsync(e){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){const e=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:e,expiry_date:this.getIdTokenExpiryDate(e)}}const t={Authorization:"Bearer "+this.credentials.id_token};return{headers:t}}getIdTokenExpiryDate(e){const t=e.split(".")[1];if(t){const e=JSON.parse(Buffer.from(t,"base64").toString("ascii"));return e.exp*1e3}}}t.IdTokenClient=IdTokenClient},1103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Impersonated=t.IMPERSONATED_ACCOUNT_TYPE=void 0;const i=r(3936);const n=r(9555);t.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";class Impersonated extends i.OAuth2Client{constructor(e={}){var t,r,n,s,a,o;super(e);this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"};this.sourceClient=(t=e.sourceClient)!==null&&t!==void 0?t:new i.OAuth2Client;this.targetPrincipal=(r=e.targetPrincipal)!==null&&r!==void 0?r:"";this.delegates=(n=e.delegates)!==null&&n!==void 0?n:[];this.targetScopes=(s=e.targetScopes)!==null&&s!==void 0?s:[];this.lifetime=(a=e.lifetime)!==null&&a!==void 0?a:3600;this.endpoint=(o=e.endpoint)!==null&&o!==void 0?o:"https://iamcredentials.googleapis.com"}async sign(e){await this.sourceClient.getAccessToken();const t=`projects/-/serviceAccounts/${this.targetPrincipal}`;const r=`${this.endpoint}/v1/${t}:signBlob`;const i={delegates:this.delegates,payload:Buffer.from(e).toString("base64")};const n=await this.sourceClient.request({url:r,data:i,method:"POST"});return n.data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(e){var t,r,i,s,a,o;try{await this.sourceClient.getAccessToken();const e="projects/-/serviceAccounts/"+this.targetPrincipal;const t=`${this.endpoint}/v1/${e}:generateAccessToken`;const r={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"};const i=await this.sourceClient.request({url:t,data:r,method:"POST"});const n=i.data;this.credentials.access_token=n.accessToken;this.credentials.expiry_date=Date.parse(n.expireTime);return{tokens:this.credentials,res:i}}catch(e){if(!(e instanceof Error))throw e;let A=0;let l="";if(e instanceof n.GaxiosError){A=(i=(r=(t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.data)===null||r===void 0?void 0:r.error)===null||i===void 0?void 0:i.status;l=(o=(a=(s=e===null||e===void 0?void 0:e.response)===null||s===void 0?void 0:s.data)===null||a===void 0?void 0:a.error)===null||o===void 0?void 0:o.message}if(A&&l){e.message=`${A}: unable to impersonate: ${l}`;throw e}else{e.message=`unable to impersonate: ${e}`;throw e}}}async fetchIdToken(e,t){var r;await this.sourceClient.getAccessToken();const i=`projects/-/serviceAccounts/${this.targetPrincipal}`;const n=`${this.endpoint}/v1/${i}:generateIdToken`;const s={delegates:this.delegates,audience:e,includeEmail:(r=t===null||t===void 0?void 0:t.includeEmail)!==null&&r!==void 0?r:true};const a=await this.sourceClient.request({url:n,data:s,method:"POST"});return a.data.token}}t.Impersonated=Impersonated},8740:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.JWTAccess=void 0;const i=r(4636);const n=r(8905);const s={alg:"RS256",typ:"JWT"};class JWTAccess{constructor(e,t,r,i){this.cache=new n.LRUCache({capacity:500,maxAge:60*60*1e3});this.email=e;this.key=t;this.keyId=r;this.eagerRefreshThresholdMillis=i!==null&&i!==void 0?i:5*60*1e3}getCachedKey(e,t){let r=e;if(t&&Array.isArray(t)&&t.length){r=e?`${e}_${t.join("_")}`:`${t.join("_")}`}else if(typeof t==="string"){r=e?`${e}_${t}`:t}if(!r){throw Error("Scopes or url must be provided")}return r}getRequestHeaders(e,t,r){const n=this.getCachedKey(e,r);const a=this.cache.get(n);const o=Date.now();if(a&&a.expiration-o>this.eagerRefreshThresholdMillis){return a.headers}const A=Math.floor(Date.now()/1e3);const l=JWTAccess.getExpirationTime(A);let c;if(Array.isArray(r)){r=r.join(" ")}if(r){c={iss:this.email,sub:this.email,scope:r,exp:l,iat:A}}else{c={iss:this.email,sub:this.email,aud:e,exp:l,iat:A}}if(t){for(const e in c){if(t[e]){throw new Error(`The '${e}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}}}const d=this.keyId?{...s,kid:this.keyId}:s;const p=Object.assign(c,t);const u=i.sign({header:d,payload:p,secret:this.key});const h={Authorization:`Bearer ${u}`};this.cache.set(n,{expiration:l*1e3,headers:h});return h}static getExpirationTime(e){const t=e+3600;return t}fromJSON(e){if(!e){throw new Error("Must pass in a JSON object containing the service account auth settings.")}if(!e.client_email){throw new Error("The incoming JSON object does not contain a client_email field")}if(!e.private_key){throw new Error("The incoming JSON object does not contain a private_key field")}this.email=e.client_email;this.key=e.private_key;this.keyId=e.private_key_id;this.projectId=e.project_id}fromStream(e,t){if(t){this.fromStreamAsync(e).then((()=>t()),t)}else{return this.fromStreamAsync(e)}}fromStreamAsync(e){return new Promise(((t,r)=>{if(!e){r(new Error("Must pass in a stream containing the service account auth settings."))}let i="";e.setEncoding("utf8").on("data",(e=>i+=e)).on("error",r).on("end",(()=>{try{const e=JSON.parse(i);this.fromJSON(e);t()}catch(e){r(e)}}))}))}}t.JWTAccess=JWTAccess},3959:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.JWT=void 0;const i=r(6031);const n=r(8740);const s=r(3936);class JWT extends s.OAuth2Client{constructor(e,t,r,i,n,s){const a=e&&typeof e==="object"?e:{email:e,keyFile:t,key:r,keyId:s,scopes:i,subject:n};super(a);this.email=a.email;this.keyFile=a.keyFile;this.key=a.key;this.keyId=a.keyId;this.scopes=a.scopes;this.subject=a.subject;this.additionalClaims=a.additionalClaims;this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(e){const t=new JWT(this);t.scopes=e;return t}async getRequestMetadataAsync(e){e=this.defaultServicePath?`https://${this.defaultServicePath}/`:e;const t=!this.hasUserScopes()&&e||this.useJWTAccessWithScope&&this.hasAnyScopes();if(!this.apiKey&&t){if(this.additionalClaims&&this.additionalClaims.target_audience){const{tokens:e}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders({Authorization:`Bearer ${e.id_token}`})}}else{if(!this.access){this.access=new n.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis)}let t;if(this.hasUserScopes()){t=this.scopes}else if(!e){t=this.defaultScopes}const r=await this.access.getRequestHeaders(e!==null&&e!==void 0?e:undefined,this.additionalClaims,this.useJWTAccessWithScope?t:undefined);return{headers:this.addSharedMetadataHeaders(r)}}}else if(this.hasAnyScopes()||this.apiKey){return super.getRequestMetadataAsync(e)}else{return{headers:{}}}}async fetchIdToken(e){const t=new i.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:e},transporter:this.transporter});await t.getToken({forceRefresh:true});if(!t.idToken){throw new Error("Unknown error: Failed to fetch ID token")}return t.idToken}hasUserScopes(){if(!this.scopes){return false}return this.scopes.length>0}hasAnyScopes(){if(this.scopes&&this.scopes.length>0)return true;if(this.defaultScopes&&this.defaultScopes.length>0)return true;return false}authorize(e){if(e){this.authorizeAsync().then((t=>e(null,t)),e)}else{return this.authorizeAsync()}}async authorizeAsync(){const e=await this.refreshToken();if(!e){throw new Error("No result returned")}this.credentials=e.tokens;this.credentials.refresh_token="jwt-placeholder";this.key=this.gtoken.key;this.email=this.gtoken.iss;return e.tokens}async refreshTokenNoCache(e){const t=this.createGToken();const r=await t.getToken({forceRefresh:this.isTokenExpiring()});const i={access_token:r.access_token,token_type:"Bearer",expiry_date:t.expiresAt,id_token:t.idToken};this.emit("tokens",i);return{res:null,tokens:i}}createGToken(){if(!this.gtoken){this.gtoken=new i.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:this.additionalClaims,transporter:this.transporter})}return this.gtoken}fromJSON(e){if(!e){throw new Error("Must pass in a JSON object containing the service account auth settings.")}if(!e.client_email){throw new Error("The incoming JSON object does not contain a client_email field")}if(!e.private_key){throw new Error("The incoming JSON object does not contain a private_key field")}this.email=e.client_email;this.key=e.private_key;this.keyId=e.private_key_id;this.projectId=e.project_id;this.quotaProjectId=e.quota_project_id}fromStream(e,t){if(t){this.fromStreamAsync(e).then((()=>t()),t)}else{return this.fromStreamAsync(e)}}fromStreamAsync(e){return new Promise(((t,r)=>{if(!e){throw new Error("Must pass in a stream containing the service account auth settings.")}let i="";e.setEncoding("utf8").on("error",r).on("data",(e=>i+=e)).on("end",(()=>{try{const e=JSON.parse(i);this.fromJSON(e);t()}catch(e){r(e)}}))}))}fromAPIKey(e){if(typeof e!=="string"){throw new Error("Must provide an API Key string.")}this.apiKey=e}async getCredentials(){if(this.key){return{private_key:this.key,client_email:this.email}}else if(this.keyFile){const e=this.createGToken();const t=await e.getCredentials(this.keyFile);return{private_key:t.privateKey,client_email:t.clientEmail}}throw new Error("A key or a keyFile must be provided to getCredentials.")}}t.JWT=JWT},4524:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.LoginTicket=void 0;class LoginTicket{constructor(e,t){this.envelope=e;this.payload=t}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){const e=this.getPayload();if(e&&e.sub){return e.sub}return null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}}t.LoginTicket=LoginTicket},3936:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.OAuth2Client=t.CertificateFormat=t.CodeChallengeMethod=void 0;const i=r(9555);const n=r(3477);const s=r(2781);const a=r(1728);const o=r(8043);const A=r(4627);const l=r(4524);var c;(function(e){e["Plain"]="plain";e["S256"]="S256"})(c||(t.CodeChallengeMethod=c={}));var d;(function(e){e["PEM"]="PEM";e["JWK"]="JWK"})(d||(t.CertificateFormat=d={}));class OAuth2Client extends A.AuthClient{constructor(e,t,r){const i=e&&typeof e==="object"?e:{clientId:e,clientSecret:t,redirectUri:r};super(i);this.certificateCache={};this.certificateExpiry=null;this.certificateCacheFormat=d.PEM;this.refreshTokenPromises=new Map;this._clientId=i.clientId;this._clientSecret=i.clientSecret;this.redirectUri=i.redirectUri}generateAuthUrl(e={}){if(e.code_challenge_method&&!e.code_challenge){throw new Error("If a code_challenge_method is provided, code_challenge must be included.")}e.response_type=e.response_type||"code";e.client_id=e.client_id||this._clientId;e.redirect_uri=e.redirect_uri||this.redirectUri;if(Array.isArray(e.scope)){e.scope=e.scope.join(" ")}const t=OAuth2Client.GOOGLE_OAUTH2_AUTH_BASE_URL_;return t+"?"+n.stringify(e)}generateCodeVerifier(){throw new Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){const e=(0,o.createCrypto)();const t=e.randomBytesBase64(96);const r=t.replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-");const i=await e.sha256DigestBase64(r);const n=i.split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:r,codeChallenge:n}}getToken(e,t){const r=typeof e==="string"?{code:e}:e;if(t){this.getTokenAsync(r).then((e=>t(null,e.tokens,e.res)),(e=>t(e,null,e.response)))}else{return this.getTokenAsync(r)}}async getTokenAsync(e){const t=OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_;const r={code:e.code,client_id:e.client_id||this._clientId,client_secret:this._clientSecret,redirect_uri:e.redirect_uri||this.redirectUri,grant_type:"authorization_code",code_verifier:e.codeVerifier};const i=await this.transporter.request({method:"POST",url:t,data:n.stringify(r),headers:{"Content-Type":"application/x-www-form-urlencoded"}});const s=i.data;if(i.data&&i.data.expires_in){s.expiry_date=(new Date).getTime()+i.data.expires_in*1e3;delete s.expires_in}this.emit("tokens",s);return{tokens:s,res:i}}async refreshToken(e){if(!e){return this.refreshTokenNoCache(e)}if(this.refreshTokenPromises.has(e)){return this.refreshTokenPromises.get(e)}const t=this.refreshTokenNoCache(e).then((t=>{this.refreshTokenPromises.delete(e);return t}),(t=>{this.refreshTokenPromises.delete(e);throw t}));this.refreshTokenPromises.set(e,t);return t}async refreshTokenNoCache(e){var t;if(!e){throw new Error("No refresh token is set.")}const r=OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_;const s={refresh_token:e,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"};let a;try{a=await this.transporter.request({method:"POST",url:r,data:n.stringify(s),headers:{"Content-Type":"application/x-www-form-urlencoded"}})}catch(e){if(e instanceof i.GaxiosError&&e.message==="invalid_grant"&&((t=e.response)===null||t===void 0?void 0:t.data)&&/ReAuth/i.test(e.response.data.error_description)){e.message=JSON.stringify(e.response.data)}throw e}const o=a.data;if(a.data&&a.data.expires_in){o.expiry_date=(new Date).getTime()+a.data.expires_in*1e3;delete o.expires_in}this.emit("tokens",o);return{tokens:o,res:a}}refreshAccessToken(e){if(e){this.refreshAccessTokenAsync().then((t=>e(null,t.credentials,t.res)),e)}else{return this.refreshAccessTokenAsync()}}async refreshAccessTokenAsync(){const e=await this.refreshToken(this.credentials.refresh_token);const t=e.tokens;t.refresh_token=this.credentials.refresh_token;this.credentials=t;return{credentials:this.credentials,res:e.res}}getAccessToken(e){if(e){this.getAccessTokenAsync().then((t=>e(null,t.token,t.res)),e)}else{return this.getAccessTokenAsync()}}async getAccessTokenAsync(){const e=!this.credentials.access_token||this.isTokenExpiring();if(e){if(!this.credentials.refresh_token){if(this.refreshHandler){const e=await this.processAndValidateRefreshHandler();if(e===null||e===void 0?void 0:e.access_token){this.setCredentials(e);return{token:this.credentials.access_token}}}else{throw new Error("No refresh token or refresh handler callback is set.")}}const e=await this.refreshAccessTokenAsync();if(!e.credentials||e.credentials&&!e.credentials.access_token){throw new Error("Could not refresh access token.")}return{token:e.credentials.access_token,res:e.res}}else{return{token:this.credentials.access_token}}}async getRequestHeaders(e){const t=(await this.getRequestMetadataAsync(e)).headers;return t}async getRequestMetadataAsync(e){const t=this.credentials;if(!t.access_token&&!t.refresh_token&&!this.apiKey&&!this.refreshHandler){throw new Error("No access, refresh token, API key or refresh handler callback is set.")}if(t.access_token&&!this.isTokenExpiring()){t.token_type=t.token_type||"Bearer";const e={Authorization:t.token_type+" "+t.access_token};return{headers:this.addSharedMetadataHeaders(e)}}if(this.refreshHandler){const e=await this.processAndValidateRefreshHandler();if(e===null||e===void 0?void 0:e.access_token){this.setCredentials(e);const t={Authorization:"Bearer "+this.credentials.access_token};return{headers:this.addSharedMetadataHeaders(t)}}}if(this.apiKey){return{headers:{"X-Goog-Api-Key":this.apiKey}}}let r=null;let i=null;try{r=await this.refreshToken(t.refresh_token);i=r.tokens}catch(e){const t=e;if(t.response&&(t.response.status===403||t.response.status===404)){t.message=`Could not refresh access token: ${t.message}`}throw t}const n=this.credentials;n.token_type=n.token_type||"Bearer";i.refresh_token=n.refresh_token;this.credentials=i;const s={Authorization:n.token_type+" "+i.access_token};return{headers:this.addSharedMetadataHeaders(s),res:r.res}}static getRevokeTokenUrl(e){const t=n.stringify({token:e});return`${OAuth2Client.GOOGLE_OAUTH2_REVOKE_URL_}?${t}`}revokeToken(e,t){const r={url:OAuth2Client.getRevokeTokenUrl(e),method:"POST"};if(t){this.transporter.request(r).then((e=>t(null,e)),t)}else{return this.transporter.request(r)}}revokeCredentials(e){if(e){this.revokeCredentialsAsync().then((t=>e(null,t)),e)}else{return this.revokeCredentialsAsync()}}async revokeCredentialsAsync(){const e=this.credentials.access_token;this.credentials={};if(e){return this.revokeToken(e)}else{throw new Error("No access token to revoke.")}}request(e,t){if(t){this.requestAsync(e).then((e=>t(null,e)),(e=>t(e,e.response)))}else{return this.requestAsync(e)}}async requestAsync(e,t=false){let r;try{const t=await this.getRequestMetadataAsync(e.url);e.headers=e.headers||{};if(t.headers&&t.headers["x-goog-user-project"]){e.headers["x-goog-user-project"]=t.headers["x-goog-user-project"]}if(t.headers&&t.headers.Authorization){e.headers.Authorization=t.headers.Authorization}if(this.apiKey){e.headers["X-Goog-Api-Key"]=this.apiKey}r=await this.transporter.request(e)}catch(r){const i=r.response;if(i){const r=i.status;const n=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure);const a=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler;const o=i.config.data instanceof s.Readable;const A=r===401||r===403;if(!t&&A&&!o&&n){await this.refreshAccessTokenAsync();return this.requestAsync(e,true)}else if(!t&&A&&!o&&a){const t=await this.processAndValidateRefreshHandler();if(t===null||t===void 0?void 0:t.access_token){this.setCredentials(t)}return this.requestAsync(e,true)}}throw r}return r}verifyIdToken(e,t){if(t&&typeof t!=="function"){throw new Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.")}if(t){this.verifyIdTokenAsync(e).then((e=>t(null,e)),t)}else{return this.verifyIdTokenAsync(e)}}async verifyIdTokenAsync(e){if(!e.idToken){throw new Error("The verifyIdToken method requires an ID Token")}const t=await this.getFederatedSignonCertsAsync();const r=await this.verifySignedJwtWithCertsAsync(e.idToken,t.certs,e.audience,OAuth2Client.ISSUERS_,e.maxExpiry);return r}async getTokenInfo(e){const{data:t}=await this.transporter.request({method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${e}`},url:OAuth2Client.GOOGLE_TOKEN_INFO_URL});const r=Object.assign({expiry_date:(new Date).getTime()+t.expires_in*1e3,scopes:t.scope.split(" ")},t);delete r.expires_in;delete r.scope;return r}getFederatedSignonCerts(e){if(e){this.getFederatedSignonCertsAsync().then((t=>e(null,t.certs,t.res)),e)}else{return this.getFederatedSignonCertsAsync()}}async getFederatedSignonCertsAsync(){const e=(new Date).getTime();const t=(0,o.hasBrowserCrypto)()?d.JWK:d.PEM;if(this.certificateExpiry&&ee(null,t.pubkeys,t.res)),e)}else{return this.getIapPublicKeysAsync()}}async getIapPublicKeysAsync(){let e;const t=OAuth2Client.GOOGLE_OAUTH2_IAP_PUBLIC_KEY_URL_;try{e=await this.transporter.request({url:t})}catch(e){if(e instanceof Error){e.message=`Failed to retrieve verification certificates: ${e.message}`}throw e}return{pubkeys:e.data,res:e}}verifySignedJwtWithCerts(){throw new Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(e,t,r,i,n){const s=(0,o.createCrypto)();if(!n){n=OAuth2Client.MAX_TOKEN_LIFETIME_SECS_}const A=e.split(".");if(A.length!==3){throw new Error("Wrong number of segments in token: "+e)}const c=A[0]+"."+A[1];let d=A[2];let p;let u;try{p=JSON.parse(s.decodeBase64StringUtf8(A[0]))}catch(e){if(e instanceof Error){e.message=`Can't parse token envelope: ${A[0]}': ${e.message}`}throw e}if(!p){throw new Error("Can't parse token envelope: "+A[0])}try{u=JSON.parse(s.decodeBase64StringUtf8(A[1]))}catch(e){if(e instanceof Error){e.message=`Can't parse token payload '${A[0]}`}throw e}if(!u){throw new Error("Can't parse token payload: "+A[1])}if(!Object.prototype.hasOwnProperty.call(t,p.kid)){throw new Error("No pem found for envelope: "+JSON.stringify(p))}const h=t[p.kid];if(p.alg==="ES256"){d=a.joseToDer(d,"ES256").toString("base64")}const g=await s.verify(h,c,d);if(!g){throw new Error("Invalid token signature: "+e)}if(!u.iat){throw new Error("No issue time in token: "+JSON.stringify(u))}if(!u.exp){throw new Error("No expiration time in token: "+JSON.stringify(u))}const E=Number(u.iat);if(isNaN(E))throw new Error("iat field using invalid format");const C=Number(u.exp);if(isNaN(C))throw new Error("exp field using invalid format");const B=(new Date).getTime()/1e3;if(C>=B+n){throw new Error("Expiration time too far in future: "+JSON.stringify(u))}const I=E-OAuth2Client.CLOCK_SKEW_SECS_;const Q=C+OAuth2Client.CLOCK_SKEW_SECS_;if(BQ){throw new Error("Token used too late, "+B+" > "+Q+": "+JSON.stringify(u))}if(i&&i.indexOf(u.iss)<0){throw new Error("Invalid issuer, expected one of ["+i+"], but got "+u.iss)}if(typeof r!=="undefined"&&r!==null){const e=u.aud;let t=false;if(r.constructor===Array){t=r.indexOf(e)>-1}else{t=e===r}if(!t){throw new Error("Wrong recipient, payload audience != requiredAudience")}}return new l.LoginTicket(p,u)}async processAndValidateRefreshHandler(){if(this.refreshHandler){const e=await this.refreshHandler();if(!e.access_token){throw new Error("No access token is returned by the refreshHandler callback.")}return e}return}isTokenExpiring(){const e=this.credentials.expiry_date;return e?e<=(new Date).getTime()+this.eagerRefreshThresholdMillis:false}}t.OAuth2Client=OAuth2Client;OAuth2Client.GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";OAuth2Client.GOOGLE_OAUTH2_AUTH_BASE_URL_="https://accounts.google.com/o/oauth2/v2/auth";OAuth2Client.GOOGLE_OAUTH2_TOKEN_URL_="https://oauth2.googleapis.com/token";OAuth2Client.GOOGLE_OAUTH2_REVOKE_URL_="https://oauth2.googleapis.com/revoke";OAuth2Client.GOOGLE_OAUTH2_FEDERATED_SIGNON_PEM_CERTS_URL_="https://www.googleapis.com/oauth2/v1/certs";OAuth2Client.GOOGLE_OAUTH2_FEDERATED_SIGNON_JWK_CERTS_URL_="https://www.googleapis.com/oauth2/v3/certs";OAuth2Client.GOOGLE_OAUTH2_IAP_PUBLIC_KEY_URL_="https://www.gstatic.com/iap/verify/public_key";OAuth2Client.CLOCK_SKEW_SECS_=300;OAuth2Client.MAX_TOKEN_LIFETIME_SECS_=86400;OAuth2Client.ISSUERS_=["accounts.google.com","https://accounts.google.com"]},9510:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getErrorFromOAuthErrorResponse=t.OAuthClientAuthHandler=void 0;const i=r(3477);const n=r(8043);const s=["PUT","POST","PATCH"];class OAuthClientAuthHandler{constructor(e){this.clientAuthentication=e;this.crypto=(0,n.createCrypto)()}applyClientAuthenticationOptions(e,t){this.injectAuthenticatedHeaders(e,t);if(!t){this.injectAuthenticatedRequestBody(e)}}injectAuthenticatedHeaders(e,t){var r;if(t){e.headers=e.headers||{};Object.assign(e.headers,{Authorization:`Bearer ${t}}`})}else if(((r=this.clientAuthentication)===null||r===void 0?void 0:r.confidentialClientType)==="basic"){e.headers=e.headers||{};const t=this.clientAuthentication.clientId;const r=this.clientAuthentication.clientSecret||"";const i=this.crypto.encodeBase64StringUtf8(`${t}:${r}`);Object.assign(e.headers,{Authorization:`Basic ${i}`})}}injectAuthenticatedRequestBody(e){var t;if(((t=this.clientAuthentication)===null||t===void 0?void 0:t.confidentialClientType)==="request-body"){const t=(e.method||"GET").toUpperCase();if(s.indexOf(t)!==-1){let t;const r=e.headers||{};for(const e in r){if(e.toLowerCase()==="content-type"&&r[e]){t=r[e].toLowerCase();break}}if(t==="application/x-www-form-urlencoded"){e.data=e.data||"";const t=i.parse(e.data);Object.assign(t,{client_id:this.clientAuthentication.clientId,client_secret:this.clientAuthentication.clientSecret||""});e.data=i.stringify(t)}else if(t==="application/json"){e.data=e.data||{};Object.assign(e.data,{client_id:this.clientAuthentication.clientId,client_secret:this.clientAuthentication.clientSecret||""})}else{throw new Error(`${t} content-types are not supported with `+`${this.clientAuthentication.confidentialClientType} `+"client authentication")}}else{throw new Error(`${t} HTTP method does not support `+`${this.clientAuthentication.confidentialClientType} `+"client authentication")}}}}t.OAuthClientAuthHandler=OAuthClientAuthHandler;function getErrorFromOAuthErrorResponse(e,t){const r=e.error;const i=e.error_description;const n=e.error_uri;let s=`Error code ${r}`;if(typeof i!=="undefined"){s+=`: ${i}`}if(typeof n!=="undefined"){s+=` - ${n}`}const a=new Error(s);if(t){const e=Object.keys(t);if(t.stack){e.push("stack")}e.forEach((e=>{if(e!=="message"){Object.defineProperty(a,e,{value:t[e],writable:false,enumerable:true})}}))}return a}t.getErrorFromOAuthErrorResponse=getErrorFromOAuthErrorResponse},4782:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.PluggableAuthClient=t.ExecutableError=void 0;const i=r(7391);const n=r(8749);const s=r(8941);class ExecutableError extends Error{constructor(e,t){super(`The executable failed with exit code: ${t} and error message: ${e}.`);this.code=t;Object.setPrototypeOf(this,new.target.prototype)}}t.ExecutableError=ExecutableError;const a=30*1e3;const o=5*1e3;const A=120*1e3;const l="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";const c=1;class PluggableAuthClient extends i.BaseExternalAccountClient{constructor(e,t){super(e,t);if(!e.credential_source.executable){throw new Error('No valid Pluggable Auth "credential_source" provided.')}this.command=e.credential_source.executable.command;if(!this.command){throw new Error('No valid Pluggable Auth "credential_source" provided.')}if(e.credential_source.executable.timeout_millis===undefined){this.timeoutMillis=a}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillisA){throw new Error(`Timeout must be between ${o} and `+`${A} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new s.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile});this.credentialSourceType="executable"}async retrieveSubjectToken(){if(process.env[l]!=="1"){throw new Error("Pluggable Auth executables need to be explicitly allowed to run by "+"setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment "+"Variable to 1.")}let e=undefined;if(this.outputFile){e=await this.handler.retrieveCachedResponse()}if(!e){const t=new Map;t.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience);t.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType);t.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0");if(this.outputFile){t.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile)}const r=this.getServiceAccountEmail();if(r){t.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",r)}e=await this.handler.retrieveResponseFromExecutable(t)}if(e.version>c){throw new Error(`Version of executable is not currently supported, maximum supported version is ${c}.`)}if(!e.success){throw new ExecutableError(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new n.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.")}}if(e.isExpired()){throw new Error("Executable response is expired.")}return e.subjectToken}}t.PluggableAuthClient=PluggableAuthClient},8941:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.PluggableAuthHandler=void 0;const i=r(4782);const n=r(8749);const s=r(2081);const a=r(7147);class PluggableAuthHandler{constructor(e){if(!e.command){throw new Error("No command provided.")}this.commandComponents=PluggableAuthHandler.parseCommand(e.command);this.timeoutMillis=e.timeoutMillis;if(!this.timeoutMillis){throw new Error("No timeoutMillis provided.")}this.outputFile=e.outputFile}retrieveResponseFromExecutable(e){return new Promise(((t,r)=>{const a=s.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(e)}});let o="";a.stdout.on("data",(e=>{o+=e}));a.stderr.on("data",(e=>{o+=e}));const A=setTimeout((()=>{a.removeAllListeners();a.kill();return r(new Error("The executable failed to finish within the timeout specified."))}),this.timeoutMillis);a.on("close",(e=>{clearTimeout(A);if(e===0){try{const e=JSON.parse(o);const r=new n.ExecutableResponse(e);return t(r)}catch(e){if(e instanceof n.ExecutableResponseError){return r(e)}return r(new n.ExecutableResponseError(`The executable returned an invalid response: ${o}`))}}else{return r(new i.ExecutableError(o,e.toString()))}}))}))}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return undefined}let e;try{e=await a.promises.realpath(this.outputFile)}catch(e){return undefined}if(!(await a.promises.lstat(e)).isFile()){return undefined}const t=await a.promises.readFile(e,{encoding:"utf8"});if(t===""){return undefined}try{const e=JSON.parse(t);const r=new n.ExecutableResponse(e);if(r.isValid()){return new n.ExecutableResponse(e)}return undefined}catch(e){if(e instanceof n.ExecutableResponseError){throw e}throw new n.ExecutableResponseError(`The output file contained an invalid response: ${t}`)}}static parseCommand(e){const t=e.match(/(?:[^\s"]+|"[^"]*")+/g);if(!t){throw new Error(`Provided command: "${e}" could not be parsed.`)}for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.UserRefreshClient=t.USER_REFRESH_ACCOUNT_TYPE=void 0;const i=r(3936);t.USER_REFRESH_ACCOUNT_TYPE="authorized_user";class UserRefreshClient extends i.OAuth2Client{constructor(e,t,r,i,n){const s=e&&typeof e==="object"?e:{clientId:e,clientSecret:t,refreshToken:r,eagerRefreshThresholdMillis:i,forceRefreshOnFailure:n};super(s);this._refreshToken=s.refreshToken;this.credentials.refresh_token=s.refreshToken}async refreshTokenNoCache(e){return super.refreshTokenNoCache(this._refreshToken)}fromJSON(e){if(!e){throw new Error("Must pass in a JSON object containing the user refresh token")}if(e.type!=="authorized_user"){throw new Error('The incoming JSON object does not have the "authorized_user" type')}if(!e.client_id){throw new Error("The incoming JSON object does not contain a client_id field")}if(!e.client_secret){throw new Error("The incoming JSON object does not contain a client_secret field")}if(!e.refresh_token){throw new Error("The incoming JSON object does not contain a refresh_token field")}this._clientId=e.client_id;this._clientSecret=e.client_secret;this._refreshToken=e.refresh_token;this.credentials.refresh_token=e.refresh_token;this.quotaProjectId=e.quota_project_id}fromStream(e,t){if(t){this.fromStreamAsync(e).then((()=>t()),t)}else{return this.fromStreamAsync(e)}}async fromStreamAsync(e){return new Promise(((t,r)=>{if(!e){return r(new Error("Must pass in a stream containing the user refresh token."))}let i="";e.setEncoding("utf8").on("error",r).on("data",(e=>i+=e)).on("end",(()=>{try{const e=JSON.parse(i);this.fromJSON(e);return t()}catch(e){return r(e)}}))}))}}t.UserRefreshClient=UserRefreshClient},6308:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.StsCredentials=void 0;const i=r(9555);const n=r(3477);const s=r(2649);const a=r(9510);class StsCredentials extends a.OAuthClientAuthHandler{constructor(e,t){super(t);this.tokenExchangeEndpoint=e;this.transporter=new s.DefaultTransporter}async exchangeToken(e,t,r){var s,o,A;const l={grant_type:e.grantType,resource:e.resource,audience:e.audience,scope:(s=e.scope)===null||s===void 0?void 0:s.join(" "),requested_token_type:e.requestedTokenType,subject_token:e.subjectToken,subject_token_type:e.subjectTokenType,actor_token:(o=e.actingParty)===null||o===void 0?void 0:o.actorToken,actor_token_type:(A=e.actingParty)===null||A===void 0?void 0:A.actorTokenType,options:r&&JSON.stringify(r)};Object.keys(l).forEach((e=>{if(typeof l[e]==="undefined"){delete l[e]}}));const c={"Content-Type":"application/x-www-form-urlencoded"};Object.assign(c,t||{});const d={url:this.tokenExchangeEndpoint,method:"POST",headers:c,data:n.stringify(l),responseType:"json"};this.applyClientAuthenticationOptions(d);try{const e=await this.transporter.request(d);const t=e.data;t.res=e;return t}catch(e){if(e instanceof i.GaxiosError&&e.response){throw(0,a.getErrorFromOAuthErrorResponse)(e.response.data,e)}throw e}}}t.StsCredentials=StsCredentials},4693:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.BrowserCrypto=void 0;const i=r(6463);const n=r(8043);class BrowserCrypto{constructor(){if(typeof window==="undefined"||window.crypto===undefined||window.crypto.subtle===undefined){throw new Error("SubtleCrypto not found. Make sure it's an https:// website.")}}async sha256DigestBase64(e){const t=(new TextEncoder).encode(e);const r=await window.crypto.subtle.digest("SHA-256",t);return i.fromByteArray(new Uint8Array(r))}randomBytesBase64(e){const t=new Uint8Array(e);window.crypto.getRandomValues(t);return i.fromByteArray(t)}static padBase64(e){while(e.length%4!==0){e+="="}return e}async verify(e,t,r){const n={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};const s=(new TextEncoder).encode(t);const a=i.toByteArray(BrowserCrypto.padBase64(r));const o=await window.crypto.subtle.importKey("jwk",e,n,true,["verify"]);const A=await window.crypto.subtle.verify(n,o,a,s);return A}async sign(e,t){const r={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};const n=(new TextEncoder).encode(t);const s=await window.crypto.subtle.importKey("jwk",e,r,true,["sign"]);const a=await window.crypto.subtle.sign(r,s,n);return i.fromByteArray(new Uint8Array(a))}decodeBase64StringUtf8(e){const t=i.toByteArray(BrowserCrypto.padBase64(e));const r=(new TextDecoder).decode(t);return r}encodeBase64StringUtf8(e){const t=(new TextEncoder).encode(e);const r=i.fromByteArray(t);return r}async sha256DigestHex(e){const t=(new TextEncoder).encode(e);const r=await window.crypto.subtle.digest("SHA-256",t);return(0,n.fromArrayBufferToHex)(r)}async signWithHmacSha256(e,t){const r=typeof e==="string"?e:String.fromCharCode(...new Uint16Array(e));const i=new TextEncoder;const n=await window.crypto.subtle.importKey("raw",i.encode(r),{name:"HMAC",hash:{name:"SHA-256"}},false,["sign"]);return window.crypto.subtle.sign("HMAC",n,i.encode(t))}}t.BrowserCrypto=BrowserCrypto},8043:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.fromArrayBufferToHex=t.hasBrowserCrypto=t.createCrypto=void 0;const i=r(4693);const n=r(757);function createCrypto(){if(hasBrowserCrypto()){return new i.BrowserCrypto}return new n.NodeCrypto}t.createCrypto=createCrypto;function hasBrowserCrypto(){return typeof window!=="undefined"&&typeof window.crypto!=="undefined"&&typeof window.crypto.subtle!=="undefined"}t.hasBrowserCrypto=hasBrowserCrypto;function fromArrayBufferToHex(e){const t=Array.from(new Uint8Array(e));return t.map((e=>e.toString(16).padStart(2,"0"))).join("")}t.fromArrayBufferToHex=fromArrayBufferToHex},757:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.NodeCrypto=void 0;const i=r(6113);class NodeCrypto{async sha256DigestBase64(e){return i.createHash("sha256").update(e).digest("base64")}randomBytesBase64(e){return i.randomBytes(e).toString("base64")}async verify(e,t,r){const n=i.createVerify("RSA-SHA256");n.update(t);n.end();return n.verify(e,r,"base64")}async sign(e,t){const r=i.createSign("RSA-SHA256");r.update(t);r.end();return r.sign(e,"base64")}decodeBase64StringUtf8(e){return Buffer.from(e,"base64").toString("utf-8")}encodeBase64StringUtf8(e){return Buffer.from(e,"utf-8").toString("base64")}async sha256DigestHex(e){return i.createHash("sha256").update(e).digest("hex")}async signWithHmacSha256(e,t){const r=typeof e==="string"?e:toBuffer(e);return toArrayBuffer(i.createHmac("sha256",r).update(t).digest())}}t.NodeCrypto=NodeCrypto;function toArrayBuffer(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function toBuffer(e){return Buffer.from(e)}},810:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.GoogleAuth=t.auth=t.DefaultTransporter=t.PluggableAuthClient=t.DownscopedClient=t.BaseExternalAccountClient=t.ExternalAccountClient=t.IdentityPoolClient=t.AwsClient=t.UserRefreshClient=t.LoginTicket=t.OAuth2Client=t.CodeChallengeMethod=t.Impersonated=t.JWT=t.JWTAccess=t.IdTokenClient=t.IAMAuth=t.GCPEnv=t.Compute=t.AuthClient=t.gcpMetadata=void 0;const i=r(695);Object.defineProperty(t,"GoogleAuth",{enumerable:true,get:function(){return i.GoogleAuth}});t.gcpMetadata=r(3563);var n=r(4627);Object.defineProperty(t,"AuthClient",{enumerable:true,get:function(){return n.AuthClient}});var s=r(6875);Object.defineProperty(t,"Compute",{enumerable:true,get:function(){return s.Compute}});var a=r(1380);Object.defineProperty(t,"GCPEnv",{enumerable:true,get:function(){return a.GCPEnv}});var o=r(9735);Object.defineProperty(t,"IAMAuth",{enumerable:true,get:function(){return o.IAMAuth}});var A=r(298);Object.defineProperty(t,"IdTokenClient",{enumerable:true,get:function(){return A.IdTokenClient}});var l=r(8740);Object.defineProperty(t,"JWTAccess",{enumerable:true,get:function(){return l.JWTAccess}});var c=r(3959);Object.defineProperty(t,"JWT",{enumerable:true,get:function(){return c.JWT}});var d=r(1103);Object.defineProperty(t,"Impersonated",{enumerable:true,get:function(){return d.Impersonated}});var p=r(3936);Object.defineProperty(t,"CodeChallengeMethod",{enumerable:true,get:function(){return p.CodeChallengeMethod}});Object.defineProperty(t,"OAuth2Client",{enumerable:true,get:function(){return p.OAuth2Client}});var u=r(4524);Object.defineProperty(t,"LoginTicket",{enumerable:true,get:function(){return u.LoginTicket}});var h=r(8790);Object.defineProperty(t,"UserRefreshClient",{enumerable:true,get:function(){return h.UserRefreshClient}});var g=r(1569);Object.defineProperty(t,"AwsClient",{enumerable:true,get:function(){return g.AwsClient}});var E=r(117);Object.defineProperty(t,"IdentityPoolClient",{enumerable:true,get:function(){return E.IdentityPoolClient}});var C=r(4381);Object.defineProperty(t,"ExternalAccountClient",{enumerable:true,get:function(){return C.ExternalAccountClient}});var B=r(7391);Object.defineProperty(t,"BaseExternalAccountClient",{enumerable:true,get:function(){return B.BaseExternalAccountClient}});var I=r(6270);Object.defineProperty(t,"DownscopedClient",{enumerable:true,get:function(){return I.DownscopedClient}});var Q=r(4782);Object.defineProperty(t,"PluggableAuthClient",{enumerable:true,get:function(){return Q.PluggableAuthClient}});var y=r(2649);Object.defineProperty(t,"DefaultTransporter",{enumerable:true,get:function(){return y.DefaultTransporter}});const w=new i.GoogleAuth;t.auth=w},6608:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validate=void 0;function validate(e){const t=[{invalid:"uri",expected:"url"},{invalid:"json",expected:"data"},{invalid:"qs",expected:"params"}];for(const r of t){if(e[r.invalid]){const e=`'${r.invalid}' is not a valid configuration option. Please use '${r.expected}' instead. This library is using Axios for requests. Please see https://github.com/axios/axios to learn more about the valid request options.`;throw new Error(e)}}}t.validate=validate},2649:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DefaultTransporter=void 0;const i=r(9555);const n=r(6608);const s=r(1402);const a="google-api-nodejs-client";class DefaultTransporter{constructor(){this.instance=new i.Gaxios}configure(e={}){e.headers=e.headers||{};if(typeof window==="undefined"){const t=e.headers["User-Agent"];if(!t){e.headers["User-Agent"]=DefaultTransporter.USER_AGENT}else if(!t.includes(`${a}/`)){e.headers["User-Agent"]=`${t} ${DefaultTransporter.USER_AGENT}`}if(!e.headers["x-goog-api-client"]){const t=process.version.replace(/^v/,"");e.headers["x-goog-api-client"]=`gl-node/${t}`}}return e}request(e){e=this.configure(e);(0,n.validate)(e);return this.instance.request(e).catch((e=>{throw this.processError(e)}))}get defaults(){return this.instance.defaults}set defaults(e){this.instance.defaults=e}processError(e){const t=e.response;const r=e;const i=t?t.data:null;if(t&&i&&i.error&&t.status!==200){if(typeof i.error==="string"){r.message=i.error;r.status=t.status}else if(Array.isArray(i.error.errors)){r.message=i.error.errors.map((e=>e.message)).join("\n");r.code=i.error.code;r.errors=i.error.errors}else{r.message=i.error.message;r.code=i.error.code}}else if(t&&t.status>=400){r.message=i;r.status=t.status}return r}}t.DefaultTransporter=DefaultTransporter;DefaultTransporter.USER_AGENT=`${a}/${s.version}`},8905:function(e,t){"use strict";var r=this&&this.__classPrivateFieldGet||function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)};var i,n,s,a;Object.defineProperty(t,"__esModule",{value:true});t.LRUCache=t.originalOrCamelOptions=t.snakeToCamel=void 0;function snakeToCamel(e){return e.replace(/([_][^_])/g,(e=>e.slice(1).toUpperCase()))}t.snakeToCamel=snakeToCamel;function originalOrCamelOptions(e){function get(t){var r;const i=e||{};return(r=i[t])!==null&&r!==void 0?r:i[snakeToCamel(t)]}return{get:get}}t.originalOrCamelOptions=originalOrCamelOptions;class LRUCache{constructor(e){i.add(this);n.set(this,new Map);this.capacity=e.capacity;this.maxAge=e.maxAge}set(e,t){r(this,i,"m",s).call(this,e,t);r(this,i,"m",a).call(this)}get(e){const t=r(this,n,"f").get(e);if(!t)return;r(this,i,"m",s).call(this,e,t.value);r(this,i,"m",a).call(this);return t.value}}t.LRUCache=LRUCache;n=new WeakMap,i=new WeakSet,s=function _LRUCache_moveToEnd(e,t){r(this,n,"f").delete(e);r(this,n,"f").set(e,{value:t,lastAccessed:Date.now()})},a=function _LRUCache_evict(){const e=this.maxAge?Date.now()-this.maxAge:0;let t=r(this,n,"f").entries().next();while(!t.done&&(r(this,n,"f").size>this.capacity||t.value[1].lastAccessed{"use strict";e.exports=clone;var t=Object.getPrototypeOf||function(e){return e.__proto__};function clone(e){if(e===null||typeof e!=="object")return e;if(e instanceof Object)var r={__proto__:t(e)};else var r=Object.create(null);Object.getOwnPropertyNames(e).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}));return r}},7758:(e,t,r)=>{var i=r(7147);var n=r(263);var s=r(3086);var a=r(7356);var o=r(3837);var A;var l;if(typeof Symbol==="function"&&typeof Symbol.for==="function"){A=Symbol.for("graceful-fs.queue");l=Symbol.for("graceful-fs.previous")}else{A="___graceful-fs.queue";l="___graceful-fs.previous"}function noop(){}function publishQueue(e,t){Object.defineProperty(e,A,{get:function(){return t}})}var c=noop;if(o.debuglog)c=o.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))c=function(){var e=o.format.apply(o,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: ");console.error(e)};if(!i[A]){var d=global[A]||[];publishQueue(i,d);i.close=function(e){function close(t,r){return e.call(i,t,(function(e){if(!e){resetQueue()}if(typeof r==="function")r.apply(this,arguments)}))}Object.defineProperty(close,l,{value:e});return close}(i.close);i.closeSync=function(e){function closeSync(t){e.apply(i,arguments);resetQueue()}Object.defineProperty(closeSync,l,{value:e});return closeSync}(i.closeSync);if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")){process.on("exit",(function(){c(i[A]);r(9491).equal(i[A].length,0)}))}}if(!global[A]){publishQueue(global,i[A])}e.exports=patch(a(i));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!i.__patched){e.exports=patch(i);i.__patched=true}function patch(e){n(e);e.gracefulify=patch;e.createReadStream=createReadStream;e.createWriteStream=createWriteStream;var t=e.readFile;e.readFile=readFile;function readFile(e,r,i){if(typeof r==="function")i=r,r=null;return go$readFile(e,r,i);function go$readFile(e,r,i,n){return t(e,r,(function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))enqueue([go$readFile,[e,r,i],t,n||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}var r=e.writeFile;e.writeFile=writeFile;function writeFile(e,t,i,n){if(typeof i==="function")n=i,i=null;return go$writeFile(e,t,i,n);function go$writeFile(e,t,i,n,s){return r(e,t,i,(function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))enqueue([go$writeFile,[e,t,i,n],r,s||Date.now(),Date.now()]);else{if(typeof n==="function")n.apply(this,arguments)}}))}}var i=e.appendFile;if(i)e.appendFile=appendFile;function appendFile(e,t,r,n){if(typeof r==="function")n=r,r=null;return go$appendFile(e,t,r,n);function go$appendFile(e,t,r,n,s){return i(e,t,r,(function(i){if(i&&(i.code==="EMFILE"||i.code==="ENFILE"))enqueue([go$appendFile,[e,t,r,n],i,s||Date.now(),Date.now()]);else{if(typeof n==="function")n.apply(this,arguments)}}))}}var a=e.copyFile;if(a)e.copyFile=copyFile;function copyFile(e,t,r,i){if(typeof r==="function"){i=r;r=0}return go$copyFile(e,t,r,i);function go$copyFile(e,t,r,i,n){return a(e,t,r,(function(s){if(s&&(s.code==="EMFILE"||s.code==="ENFILE"))enqueue([go$copyFile,[e,t,r,i],s,n||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}var o=e.readdir;e.readdir=readdir;var A=/^v[0-5]\./;function readdir(e,t,r){if(typeof t==="function")r=t,t=null;var i=A.test(process.version)?function go$readdir(e,t,r,i){return o(e,fs$readdirCallback(e,t,r,i))}:function go$readdir(e,t,r,i){return o(e,t,fs$readdirCallback(e,t,r,i))};return i(e,t,r);function fs$readdirCallback(e,t,r,n){return function(s,a){if(s&&(s.code==="EMFILE"||s.code==="ENFILE"))enqueue([i,[e,t,r],s,n||Date.now(),Date.now()]);else{if(a&&a.sort)a.sort();if(typeof r==="function")r.call(this,s,a)}}}}if(process.version.substr(0,4)==="v0.8"){var l=s(e);ReadStream=l.ReadStream;WriteStream=l.WriteStream}var c=e.ReadStream;if(c){ReadStream.prototype=Object.create(c.prototype);ReadStream.prototype.open=ReadStream$open}var d=e.WriteStream;if(d){WriteStream.prototype=Object.create(d.prototype);WriteStream.prototype.open=WriteStream$open}Object.defineProperty(e,"ReadStream",{get:function(){return ReadStream},set:function(e){ReadStream=e},enumerable:true,configurable:true});Object.defineProperty(e,"WriteStream",{get:function(){return WriteStream},set:function(e){WriteStream=e},enumerable:true,configurable:true});var p=ReadStream;Object.defineProperty(e,"FileReadStream",{get:function(){return p},set:function(e){p=e},enumerable:true,configurable:true});var u=WriteStream;Object.defineProperty(e,"FileWriteStream",{get:function(){return u},set:function(e){u=e},enumerable:true,configurable:true});function ReadStream(e,t){if(this instanceof ReadStream)return c.apply(this,arguments),this;else return ReadStream.apply(Object.create(ReadStream.prototype),arguments)}function ReadStream$open(){var e=this;open(e.path,e.flags,e.mode,(function(t,r){if(t){if(e.autoClose)e.destroy();e.emit("error",t)}else{e.fd=r;e.emit("open",r);e.read()}}))}function WriteStream(e,t){if(this instanceof WriteStream)return d.apply(this,arguments),this;else return WriteStream.apply(Object.create(WriteStream.prototype),arguments)}function WriteStream$open(){var e=this;open(e.path,e.flags,e.mode,(function(t,r){if(t){e.destroy();e.emit("error",t)}else{e.fd=r;e.emit("open",r)}}))}function createReadStream(t,r){return new e.ReadStream(t,r)}function createWriteStream(t,r){return new e.WriteStream(t,r)}var h=e.open;e.open=open;function open(e,t,r,i){if(typeof r==="function")i=r,r=null;return go$open(e,t,r,i);function go$open(e,t,r,i,n){return h(e,t,r,(function(s,a){if(s&&(s.code==="EMFILE"||s.code==="ENFILE"))enqueue([go$open,[e,t,r,i],s,n||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}return e}function enqueue(e){c("ENQUEUE",e[0].name,e[1]);i[A].push(e);retry()}var p;function resetQueue(){var e=Date.now();for(var t=0;t2){i[A][t][3]=e;i[A][t][4]=e}}retry()}function retry(){clearTimeout(p);p=undefined;if(i[A].length===0)return;var e=i[A].shift();var t=e[0];var r=e[1];var n=e[2];var s=e[3];var a=e[4];if(s===undefined){c("RETRY",t.name,r);t.apply(null,r)}else if(Date.now()-s>=6e4){c("TIMEOUT",t.name,r);var o=r.pop();if(typeof o==="function")o.call(null,n)}else{var l=Date.now()-a;var d=Math.max(a-s,1);var u=Math.min(d*1.2,100);if(l>=u){c("RETRY",t.name,r);t.apply(null,r.concat([s]))}else{i[A].push(e)}}if(p===undefined){p=setTimeout(retry,0)}}},3086:(e,t,r)=>{var i=r(2781).Stream;e.exports=legacy;function legacy(e){return{ReadStream:ReadStream,WriteStream:WriteStream};function ReadStream(t,r){if(!(this instanceof ReadStream))return new ReadStream(t,r);i.call(this);var n=this;this.path=t;this.fd=null;this.readable=true;this.paused=false;this.flags="r";this.mode=438;this.bufferSize=64*1024;r=r||{};var s=Object.keys(r);for(var a=0,o=s.length;athis.end){throw new Error("start must be <= end")}this.pos=this.start}if(this.fd!==null){process.nextTick((function(){n._read()}));return}e.open(this.path,this.flags,this.mode,(function(e,t){if(e){n.emit("error",e);n.readable=false;return}n.fd=t;n.emit("open",t);n._read()}))}function WriteStream(t,r){if(!(this instanceof WriteStream))return new WriteStream(t,r);i.call(this);this.path=t;this.fd=null;this.writable=true;this.flags="w";this.encoding="binary";this.mode=438;this.bytesWritten=0;r=r||{};var n=Object.keys(r);for(var s=0,a=n.length;s= zero")}this.pos=this.start}this.busy=false;this._queue=[];if(this.fd===null){this._open=e.open;this._queue.push([this._open,this.path,this.flags,this.mode,undefined]);this.flush()}}}},263:(e,t,r)=>{var i=r(2057);var n=process.cwd;var s=null;var a=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!s)s=n.call(process);return s};try{process.cwd()}catch(e){}if(typeof process.chdir==="function"){var o=process.chdir;process.chdir=function(e){s=null;o.call(process,e)};if(Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,o)}e.exports=patch;function patch(e){if(i.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)){patchLchmod(e)}if(!e.lutimes){patchLutimes(e)}e.chown=chownFix(e.chown);e.fchown=chownFix(e.fchown);e.lchown=chownFix(e.lchown);e.chmod=chmodFix(e.chmod);e.fchmod=chmodFix(e.fchmod);e.lchmod=chmodFix(e.lchmod);e.chownSync=chownFixSync(e.chownSync);e.fchownSync=chownFixSync(e.fchownSync);e.lchownSync=chownFixSync(e.lchownSync);e.chmodSync=chmodFixSync(e.chmodSync);e.fchmodSync=chmodFixSync(e.fchmodSync);e.lchmodSync=chmodFixSync(e.lchmodSync);e.stat=statFix(e.stat);e.fstat=statFix(e.fstat);e.lstat=statFix(e.lstat);e.statSync=statFixSync(e.statSync);e.fstatSync=statFixSync(e.fstatSync);e.lstatSync=statFixSync(e.lstatSync);if(e.chmod&&!e.lchmod){e.lchmod=function(e,t,r){if(r)process.nextTick(r)};e.lchmodSync=function(){}}if(e.chown&&!e.lchown){e.lchown=function(e,t,r,i){if(i)process.nextTick(i)};e.lchownSync=function(){}}if(a==="win32"){e.rename=typeof e.rename!=="function"?e.rename:function(t){function rename(r,i,n){var s=Date.now();var a=0;t(r,i,(function CB(o){if(o&&(o.code==="EACCES"||o.code==="EPERM"||o.code==="EBUSY")&&Date.now()-s<6e4){setTimeout((function(){e.stat(i,(function(e,s){if(e&&e.code==="ENOENT")t(r,i,CB);else n(o)}))}),a);if(a<100)a+=10;return}if(n)n(o)}))}if(Object.setPrototypeOf)Object.setPrototypeOf(rename,t);return rename}(e.rename)}e.read=typeof e.read!=="function"?e.read:function(t){function read(r,i,n,s,a,o){var A;if(o&&typeof o==="function"){var l=0;A=function(c,d,p){if(c&&c.code==="EAGAIN"&&l<10){l++;return t.call(e,r,i,n,s,a,A)}o.apply(this,arguments)}}return t.call(e,r,i,n,s,a,A)}if(Object.setPrototypeOf)Object.setPrototypeOf(read,t);return read}(e.read);e.readSync=typeof e.readSync!=="function"?e.readSync:function(t){return function(r,i,n,s,a){var o=0;while(true){try{return t.call(e,r,i,n,s,a)}catch(e){if(e.code==="EAGAIN"&&o<10){o++;continue}throw e}}}}(e.readSync);function patchLchmod(e){e.lchmod=function(t,r,n){e.open(t,i.O_WRONLY|i.O_SYMLINK,r,(function(t,i){if(t){if(n)n(t);return}e.fchmod(i,r,(function(t){e.close(i,(function(e){if(n)n(t||e)}))}))}))};e.lchmodSync=function(t,r){var n=e.openSync(t,i.O_WRONLY|i.O_SYMLINK,r);var s=true;var a;try{a=e.fchmodSync(n,r);s=false}finally{if(s){try{e.closeSync(n)}catch(e){}}else{e.closeSync(n)}}return a}}function patchLutimes(e){if(i.hasOwnProperty("O_SYMLINK")&&e.futimes){e.lutimes=function(t,r,n,s){e.open(t,i.O_SYMLINK,(function(t,i){if(t){if(s)s(t);return}e.futimes(i,r,n,(function(t){e.close(i,(function(e){if(s)s(t||e)}))}))}))};e.lutimesSync=function(t,r,n){var s=e.openSync(t,i.O_SYMLINK);var a;var o=true;try{a=e.futimesSync(s,r,n);o=false}finally{if(o){try{e.closeSync(s)}catch(e){}}else{e.closeSync(s)}}return a}}else if(e.futimes){e.lutimes=function(e,t,r,i){if(i)process.nextTick(i)};e.lutimesSync=function(){}}}function chmodFix(t){if(!t)return t;return function(r,i,n){return t.call(e,r,i,(function(e){if(chownErOk(e))e=null;if(n)n.apply(this,arguments)}))}}function chmodFixSync(t){if(!t)return t;return function(r,i){try{return t.call(e,r,i)}catch(e){if(!chownErOk(e))throw e}}}function chownFix(t){if(!t)return t;return function(r,i,n,s){return t.call(e,r,i,n,(function(e){if(chownErOk(e))e=null;if(s)s.apply(this,arguments)}))}}function chownFixSync(t){if(!t)return t;return function(r,i,n){try{return t.call(e,r,i,n)}catch(e){if(!chownErOk(e))throw e}}}function statFix(t){if(!t)return t;return function(r,i,n){if(typeof i==="function"){n=i;i=null}function callback(e,t){if(t){if(t.uid<0)t.uid+=4294967296;if(t.gid<0)t.gid+=4294967296}if(n)n.apply(this,arguments)}return i?t.call(e,r,i,callback):t.call(e,r,callback)}}function statFixSync(t){if(!t)return t;return function(r,i){var n=i?t.call(e,r,i):t.call(e,r);if(n){if(n.uid<0)n.uid+=4294967296;if(n.gid<0)n.gid+=4294967296}return n}}function chownErOk(e){if(!e)return true;if(e.code==="ENOSYS")return true;var t=!process.getuid||process.getuid()!==0;if(t){if(e.code==="EINVAL"||e.code==="EPERM")return true}return false}}},6031:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.GoogleToken=void 0;const i=r(7147);const n=r(9555);const s=r(4636);const a=r(1017);const o=r(3837);const A=i.readFile?(0,o.promisify)(i.readFile):async()=>{throw new ErrorWithCode("use key rather than keyFile.","MISSING_CREDENTIALS")};const l="https://www.googleapis.com/oauth2/v4/token";const c="https://accounts.google.com/o/oauth2/revoke?token=";class ErrorWithCode extends Error{constructor(e,t){super(e);this.code=t}}class GoogleToken{get accessToken(){return this.rawToken?this.rawToken.access_token:undefined}get idToken(){return this.rawToken?this.rawToken.id_token:undefined}get tokenType(){return this.rawToken?this.rawToken.token_type:undefined}get refreshToken(){return this.rawToken?this.rawToken.refresh_token:undefined}constructor(e){this.transporter={request:e=>(0,n.request)(e)};this.configure(e)}hasExpired(){const e=(new Date).getTime();if(this.rawToken&&this.expiresAt){return e>=this.expiresAt}else{return true}}isTokenExpiring(){var e;const t=(new Date).getTime();const r=(e=this.eagerRefreshThresholdMillis)!==null&&e!==void 0?e:0;if(this.rawToken&&this.expiresAt){return this.expiresAt<=t+r}else{return true}}getToken(e,t={}){if(typeof e==="object"){t=e;e=undefined}t=Object.assign({forceRefresh:false},t);if(e){const r=e;this.getTokenAsync(t).then((e=>r(null,e)),e);return}return this.getTokenAsync(t)}async getCredentials(e){const t=a.extname(e);switch(t){case".json":{const t=await A(e,"utf8");const r=JSON.parse(t);const i=r.private_key;const n=r.client_email;if(!i||!n){throw new ErrorWithCode("private_key and client_email are required.","MISSING_CREDENTIALS")}return{privateKey:i,clientEmail:n}}case".der":case".crt":case".pem":{const t=await A(e,"utf8");return{privateKey:t}}case".p12":case".pfx":{throw new ErrorWithCode("*.p12 certificates are not supported after v6.1.2. "+"Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.","UNKNOWN_CERTIFICATE_TYPE")}default:throw new ErrorWithCode("Unknown certificate type. Type is determined based on file extension. "+"Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE")}}async getTokenAsync(e){if(this.inFlightRequest&&!e.forceRefresh){return this.inFlightRequest}try{return await(this.inFlightRequest=this.getTokenAsyncInner(e))}finally{this.inFlightRequest=undefined}}async getTokenAsyncInner(e){if(this.isTokenExpiring()===false&&e.forceRefresh===false){return Promise.resolve(this.rawToken)}if(!this.key&&!this.keyFile){throw new Error("No key or keyFile set.")}if(!this.key&&this.keyFile){const e=await this.getCredentials(this.keyFile);this.key=e.privateKey;this.iss=e.clientEmail||this.iss;if(!e.clientEmail){this.ensureEmail()}}return this.requestToken()}ensureEmail(){if(!this.iss){throw new ErrorWithCode("email is required.","MISSING_CREDENTIALS")}}revokeToken(e){if(e){this.revokeTokenAsync().then((()=>e()),e);return}return this.revokeTokenAsync()}async revokeTokenAsync(){if(!this.accessToken){throw new Error("No token to revoke.")}const e=c+this.accessToken;await this.transporter.request({url:e});this.configure({email:this.iss,sub:this.sub,key:this.key,keyFile:this.keyFile,scope:this.scope,additionalClaims:this.additionalClaims})}configure(e={}){this.keyFile=e.keyFile;this.key=e.key;this.rawToken=undefined;this.iss=e.email||e.iss;this.sub=e.sub;this.additionalClaims=e.additionalClaims;if(typeof e.scope==="object"){this.scope=e.scope.join(" ")}else{this.scope=e.scope}this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis;if(e.transporter){this.transporter=e.transporter}}async requestToken(){var e,t;const r=Math.floor((new Date).getTime()/1e3);const i=this.additionalClaims||{};const n=Object.assign({iss:this.iss,scope:this.scope,aud:l,exp:r+3600,iat:r,sub:this.sub},i);const a=s.sign({header:{alg:"RS256"},payload:n,secret:this.key});try{const e=await this.transporter.request({method:"POST",url:l,data:{grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:a},headers:{"Content-Type":"application/x-www-form-urlencoded"},responseType:"json"});this.rawToken=e.data;this.expiresAt=e.data.expires_in===null||e.data.expires_in===undefined?undefined:(r+e.data.expires_in)*1e3;return this.rawToken}catch(r){this.rawToken=undefined;this.tokenExpires=undefined;const i=r.response&&((e=r.response)===null||e===void 0?void 0:e.data)?(t=r.response)===null||t===void 0?void 0:t.data:{};if(i.error){const e=i.error_description?`: ${i.error_description}`:"";r.message=`${i.error}${e}`}throw r}}}t.GoogleToken=GoogleToken},1621:e=>{"use strict";e.exports=(e,t=process.argv)=>{const r=e.startsWith("-")?"":e.length===1?"-":"--";const i=t.indexOf(r+e);const n=t.indexOf("--");return i!==-1&&(n===-1||i{u("Replaying proxy buffer for failed request");(0,l.default)(e.listenerCount("data")>0);e.push(h);e.push(null)}));return g}}HttpsProxyAgent.protocols=["http","https"];t.HttpsProxyAgent=HttpsProxyAgent;function resume(e){e.resume()}function omit(e,...t){const r={};let i;for(i in e){if(!t.includes(i)){r[i]=e[i]}}return r}},595:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseProxyResponse=void 0;const n=i(r(8237));const s=(0,n.default)("https-proxy-agent:parse-proxy-response");function parseProxyResponse(e){return new Promise(((t,r)=>{let i=0;const n=[];function read(){const t=e.read();if(t)ondata(t);else e.once("readable",read)}function cleanup(){e.removeListener("end",onend);e.removeListener("error",onerror);e.removeListener("readable",read)}function onend(){cleanup();s("onend");r(new Error("Proxy connection ended before receiving CONNECT response"))}function onerror(e){cleanup();s("onerror %o",e);r(e)}function ondata(a){n.push(a);i+=a.length;const o=Buffer.concat(n,i);const A=o.indexOf("\r\n\r\n");if(A===-1){s("have not received end of HTTP headers yet...");read();return}const l=o.slice(0,A).toString("ascii").split("\r\n");const c=l.shift();if(!c){e.destroy();return r(new Error("No header received from proxy CONNECT response"))}const d=c.split(" ");const p=+d[1];const u=d.slice(2).join(" ");const h={};for(const t of l){if(!t)continue;const i=t.indexOf(":");if(i===-1){e.destroy();return r(new Error(`Invalid header from proxy CONNECT response: "${t}"`))}const n=t.slice(0,i).toLowerCase();const s=t.slice(i+1).trimStart();const a=h[n];if(typeof a==="string"){h[n]=[a,s]}else if(Array.isArray(a)){a.push(s)}else{h[n]=s}}s("got proxy server response: %o %o",c,h);cleanup();t({connect:{statusCode:p,statusText:u,headers:h},buffered:o})}e.on("error",onerror);e.on("end",onend);read()}))}t.parseProxyResponse=parseProxyResponse},1230:e=>{function makeArray(e){return Array.isArray(e)?e:[e]}const t="";const r=" ";const i="\\";const n=/^\s+$/;const s=/(?:[^\\]|^)\\$/;const a=/^\\!/;const o=/^\\#/;const A=/\r?\n/g;const l=/^\.*\/|^\.+$/;const c="/";let d="node-ignore";if(typeof Symbol!=="undefined"){d=Symbol.for("node-ignore")}const p=d;const define=(e,t,r)=>Object.defineProperty(e,t,{value:r});const u=/([0-z])-([0-z])/g;const RETURN_FALSE=()=>false;const sanitizeRange=e=>e.replace(u,((e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:t));const cleanRangeBackSlash=e=>{const{length:t}=e;return e.slice(0,t-t%2)};const h=[[/\\?\s+$/,e=>e.indexOf("\\")===0?r:t],[/\\\s/g,()=>r],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function startingReplacer(){return!/\/(?!$)/.test(this)?"(?:^|\\/)":"^"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,r)=>t+6{const i=r.replace(/\\\*/g,"[^\\/]*");return t+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>i],[/\\\\/g,()=>i],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,r,n,s)=>t===i?`\\[${r}${cleanRangeBackSlash(n)}${s}`:s==="]"?n.length%2===0?`[${sanitizeRange(r)}${n}]`:"[]":"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>{const r=t?`${t}[^/]+`:"[^/]*";return`${r}(?=$|\\/$)`}]];const g=Object.create(null);const makeRegex=(e,t)=>{let r=g[e];if(!r){r=h.reduce(((t,r)=>t.replace(r[0],r[1].bind(e))),e);g[e]=r}return t?new RegExp(r,"i"):new RegExp(r)};const isString=e=>typeof e==="string";const checkPattern=e=>e&&isString(e)&&!n.test(e)&&!s.test(e)&&e.indexOf("#")!==0;const splitPattern=e=>e.split(A);class IgnoreRule{constructor(e,t,r,i){this.origin=e;this.pattern=t;this.negative=r;this.regex=i}}const createRule=(e,t)=>{const r=e;let i=false;if(e.indexOf("!")===0){i=true;e=e.substr(1)}e=e.replace(a,"!").replace(o,"#");const n=makeRegex(e,t);return new IgnoreRule(r,e,i,n)};const throwError=(e,t)=>{throw new t(e)};const checkPath=(e,t,r)=>{if(!isString(e)){return r(`path must be a string, but got \`${t}\``,TypeError)}if(!e){return r(`path must not be empty`,TypeError)}if(checkPath.isNotRelative(e)){const e="`path.relative()`d";return r(`path should be a ${e} string, but got "${t}"`,RangeError)}return true};const isNotRelative=e=>l.test(e);checkPath.isNotRelative=isNotRelative;checkPath.convert=e=>e;class Ignore{constructor({ignorecase:e=true,ignoreCase:t=e,allowRelativePaths:r=false}={}){define(this,p,true);this._rules=[];this._ignoreCase=t;this._allowRelativePaths=r;this._initCache()}_initCache(){this._ignoreCache=Object.create(null);this._testCache=Object.create(null)}_addPattern(e){if(e&&e[p]){this._rules=this._rules.concat(e._rules);this._added=true;return}if(checkPattern(e)){const t=createRule(e,this._ignoreCase);this._added=true;this._rules.push(t)}}add(e){this._added=false;makeArray(isString(e)?splitPattern(e):e).forEach(this._addPattern,this);if(this._added){this._initCache()}return this}addPattern(e){return this.add(e)}_testOne(e,t){let r=false;let i=false;this._rules.forEach((n=>{const{negative:s}=n;if(i===s&&r!==i||s&&!r&&!i&&!t){return}const a=n.regex.test(e);if(a){r=!s;i=s}}));return{ignored:r,unignored:i}}_test(e,t,r,i){const n=e&&checkPath.convert(e);checkPath(n,e,this._allowRelativePaths?RETURN_FALSE:throwError);return this._t(n,t,r,i)}_t(e,t,r,i){if(e in t){return t[e]}if(!i){i=e.split(c)}i.pop();if(!i.length){return t[e]=this._testOne(e,r)}const n=this._t(i.join(c)+c,t,r,i);return t[e]=n.ignored?n:this._testOne(e,r)}ignores(e){return this._test(e,this._ignoreCache,false).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return makeArray(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,true)}}const factory=e=>new Ignore(e);const isPathValid=e=>checkPath(e&&checkPath.convert(e),e,RETURN_FALSE);factory.isPathValid=isPathValid;factory.default=factory;e.exports=factory;if(typeof process!=="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const makePosix=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,"/");checkPath.convert=makePosix;const e=/^[a-z]:\//i;checkPath.isNotRelative=t=>e.test(t)||isNotRelative(t)}},2492:(e,t,r)=>{var i=r(2940);var n=Object.create(null);var s=r(1223);e.exports=i(inflight);function inflight(e,t){if(n[e]){n[e].push(t);return null}else{n[e]=[t];return makeres(e)}}function makeres(e){return s((function RES(){var t=n[e];var r=t.length;var i=slice(arguments);try{for(var s=0;sr){t.splice(0,r);process.nextTick((function(){RES.apply(null,i)}))}else{delete n[e]}}}))}function slice(e){var t=e.length;var r=[];for(var i=0;i{try{var i=r(3837);if(typeof i.inherits!=="function")throw"";e.exports=i.inherits}catch(t){e.exports=r(8544)}},8544:e=>{if(typeof Object.create==="function"){e.exports=function inherits(e,t){if(t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}}else{e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype;e.prototype=new TempCtor;e.prototype.constructor=e}}}},1554:e=>{"use strict";const isStream=e=>e!==null&&typeof e==="object"&&typeof e.pipe==="function";isStream.writable=e=>isStream(e)&&e.writable!==false&&typeof e._write==="function"&&typeof e._writableState==="object";isStream.readable=e=>isStream(e)&&e.readable!==false&&typeof e._read==="function"&&typeof e._readableState==="object";isStream.duplex=e=>isStream.writable(e)&&isStream.readable(e);isStream.transform=e=>isStream.duplex(e)&&typeof e._transform==="function";e.exports=isStream},893:e=>{var t={}.toString;e.exports=Array.isArray||function(e){return t.call(e)=="[object Array]"}},5031:(e,t,r)=>{var i=r(8574).stringify;var n=r(9099);e.exports=function(e){return{parse:n(e),stringify:i}};e.exports.parse=n();e.exports.stringify=i},9099:(e,t,r)=>{var i=null;const n=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;const s=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;var json_parse=function(e){"use strict";var t={strict:false,storeAsString:false,alwaysParseAsBig:false,useNativeBigInt:false,protoAction:"error",constructorAction:"error"};if(e!==undefined&&e!==null){if(e.strict===true){t.strict=true}if(e.storeAsString===true){t.storeAsString=true}t.alwaysParseAsBig=e.alwaysParseAsBig===true?e.alwaysParseAsBig:false;t.useNativeBigInt=e.useNativeBigInt===true?e.useNativeBigInt:false;if(typeof e.constructorAction!=="undefined"){if(e.constructorAction==="error"||e.constructorAction==="ignore"||e.constructorAction==="preserve"){t.constructorAction=e.constructorAction}else{throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${e.constructorAction}`)}}if(typeof e.protoAction!=="undefined"){if(e.protoAction==="error"||e.protoAction==="ignore"||e.protoAction==="preserve"){t.protoAction=e.protoAction}else{throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${e.protoAction}`)}}}var a,o,A={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},l,error=function(e){throw{name:"SyntaxError",message:e,at:a,text:l}},next=function(e){if(e&&e!==o){error("Expected '"+e+"' instead of '"+o+"'")}o=l.charAt(a);a+=1;return o},number=function(){var e,n="";if(o==="-"){n="-";next("-")}while(o>="0"&&o<="9"){n+=o;next()}if(o==="."){n+=".";while(next()&&o>="0"&&o<="9"){n+=o}}if(o==="e"||o==="E"){n+=o;next();if(o==="-"||o==="+"){n+=o;next()}while(o>="0"&&o<="9"){n+=o;next()}}e=+n;if(!isFinite(e)){error("Bad number")}else{if(i==null)i=r(7558);if(n.length>15)return t.storeAsString?n:t.useNativeBigInt?BigInt(n):new i(n);else return!t.alwaysParseAsBig?e:t.useNativeBigInt?BigInt(e):new i(e)}},string=function(){var e,t,r="",i;if(o==='"'){var n=a;while(next()){if(o==='"'){if(a-1>n)r+=l.substring(n,a-1);next();return r}if(o==="\\"){if(a-1>n)r+=l.substring(n,a-1);next();if(o==="u"){i=0;for(t=0;t<4;t+=1){e=parseInt(next(),16);if(!isFinite(e)){break}i=i*16+e}r+=String.fromCharCode(i)}else if(typeof A[o]==="string"){r+=A[o]}else{break}n=a}}}error("Bad string")},white=function(){while(o&&o<=" "){next()}},word=function(){switch(o){case"t":next("t");next("r");next("u");next("e");return true;case"f":next("f");next("a");next("l");next("s");next("e");return false;case"n":next("n");next("u");next("l");next("l");return null}error("Unexpected '"+o+"'")},c,array=function(){var e=[];if(o==="["){next("[");white();if(o==="]"){next("]");return e}while(o){e.push(c());white();if(o==="]"){next("]");return e}next(",");white()}}error("Bad array")},object=function(){var e,r=Object.create(null);if(o==="{"){next("{");white();if(o==="}"){next("}");return r}while(o){e=string();white();next(":");if(t.strict===true&&Object.hasOwnProperty.call(r,e)){error('Duplicate key "'+e+'"')}if(n.test(e)===true){if(t.protoAction==="error"){error("Object contains forbidden prototype property")}else if(t.protoAction==="ignore"){c()}else{r[e]=c()}}else if(s.test(e)===true){if(t.constructorAction==="error"){error("Object contains forbidden constructor property")}else if(t.constructorAction==="ignore"){c()}else{r[e]=c()}}else{r[e]=c()}white();if(o==="}"){next("}");return r}next(",");white()}}error("Bad object")};c=function(){white();switch(o){case"{":return object();case"[":return array();case'"':return string();case"-":return number();default:return o>="0"&&o<="9"?number():word()}};return function(e,t){var r;l=e+"";a=0;o=" ";r=c();white();if(o){error("Syntax error")}return typeof t==="function"?function walk(e,r){var i,n,s=e[r];if(s&&typeof s==="object"){Object.keys(s).forEach((function(e){n=walk(s,e);if(n!==undefined){s[e]=n}else{delete s[e]}}))}return t.call(e,r,s)}({"":r},""):r}};e.exports=json_parse},8574:(e,t,r)=>{var i=r(7558);var n=e.exports;(function(){"use strict";function f(e){return e<10?"0"+e:e}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,t=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r,s,a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},o;function quote(e){t.lastIndex=0;return t.test(e)?'"'+e.replace(t,(function(e){var t=a[e];return typeof t==="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function str(e,t){var n,a,A,l,c=r,d,p=t[e],u=p!=null&&(p instanceof i||i.isBigNumber(p));if(p&&typeof p==="object"&&typeof p.toJSON==="function"){p=p.toJSON(e)}if(typeof o==="function"){p=o.call(t,e,p)}switch(typeof p){case"string":if(u){return p}else{return quote(p)}case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":case"bigint":return String(p);case"object":if(!p){return"null"}r+=s;d=[];if(Object.prototype.toString.apply(p)==="[object Array]"){l=p.length;for(n=0;n{var i=r(9239);var n=r(1867).Buffer;var s=r(6113);var a=r(1728);var o=r(3837);var A='"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".';var l="secret must be a string or buffer";var c="key must be a string or a buffer";var d="key must be a string, a buffer or an object";var p=typeof s.createPublicKey==="function";if(p){c+=" or a KeyObject";l+="or a KeyObject"}function checkIsPublicKey(e){if(n.isBuffer(e)){return}if(typeof e==="string"){return}if(!p){throw typeError(c)}if(typeof e!=="object"){throw typeError(c)}if(typeof e.type!=="string"){throw typeError(c)}if(typeof e.asymmetricKeyType!=="string"){throw typeError(c)}if(typeof e.export!=="function"){throw typeError(c)}}function checkIsPrivateKey(e){if(n.isBuffer(e)){return}if(typeof e==="string"){return}if(typeof e==="object"){return}throw typeError(d)}function checkIsSecretKey(e){if(n.isBuffer(e)){return}if(typeof e==="string"){return e}if(!p){throw typeError(l)}if(typeof e!=="object"){throw typeError(l)}if(e.type!=="secret"){throw typeError(l)}if(typeof e.export!=="function"){throw typeError(l)}}function fromBase64(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function toBase64(e){e=e.toString();var t=4-e.length%4;if(t!==4){for(var r=0;r