alran 0.9.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/ALRAN_TOOLS_NOTICES.md +11 -0
  2. package/README.md +11 -16
  3. package/assets/agents/alran/skills/alran-code-product/SKILL.md +3 -3
  4. package/assets/agents/alran/skills/alran-code-product/references/account-models.md +19 -16
  5. package/chunks/{account-commands-JZ6NXTTK.js → account-commands-GW7N3MYC.js} +1 -1
  6. package/chunks/{anthropic-MN33DP4E.js → anthropic-63VE6MAE.js} +1 -1
  7. package/chunks/{application-ITGAJ4HC.js → application-WPPTE6LU.js} +1 -1
  8. package/chunks/{auth-command-V3RVPLZO.js → auth-command-36RMNQZW.js} +1 -1
  9. package/chunks/azure-openai-responses-OIP3KVKJ.js +2 -0
  10. package/chunks/chunk-2K5H5GA7.js +2 -0
  11. package/chunks/chunk-3GGKARES.js +2 -0
  12. package/chunks/chunk-5RIMHTEU.js +207 -0
  13. package/chunks/{chunk-EYK25HWR.js → chunk-5Y76VFHY.js} +1 -1
  14. package/chunks/{chunk-QIN5ZBE2.js → chunk-6DOVXX7W.js} +1 -1
  15. package/chunks/{chunk-E3GLGDGC.js → chunk-6PFI65C6.js} +1 -1
  16. package/chunks/{chunk-4PDIO3M6.js → chunk-6UXSIWCB.js} +1 -1
  17. package/chunks/{chunk-OQNU3VPS.js → chunk-C6LAAFG2.js} +2 -2
  18. package/chunks/{chunk-33CNY6GP.js → chunk-CUG7F2FN.js} +1 -1
  19. package/chunks/chunk-DFMYLGVU.js +249 -0
  20. package/chunks/{chunk-IIE366LR.js → chunk-G5MOGPZ3.js} +490 -485
  21. package/chunks/{chunk-FC4M2B7E.js → chunk-IC6A323Q.js} +1 -1
  22. package/chunks/{chunk-4X22UJQH.js → chunk-IN2Z5SSJ.js} +1 -1
  23. package/chunks/chunk-JSTSFMGK.js +70 -0
  24. package/chunks/{chunk-WWNUAU4P.js → chunk-LCC45PCZ.js} +1 -1
  25. package/chunks/{chunk-7QLAXRD2.js → chunk-MPQ6G7LH.js} +254 -254
  26. package/chunks/{chunk-FUERW2DW.js → chunk-MUXNNOSQ.js} +1 -1
  27. package/chunks/{chunk-44VPC5LA.js → chunk-NBONSNQZ.js} +1 -1
  28. package/chunks/chunk-NMKRNU5O.js +2 -0
  29. package/chunks/chunk-NVPGGFT3.js +2 -0
  30. package/chunks/chunk-NZXJAHTO.js +9 -0
  31. package/chunks/{chunk-6255CZPL.js → chunk-PCL2CVVE.js} +1 -1
  32. package/chunks/chunk-PXH4SBCS.js +3 -0
  33. package/chunks/chunk-RLJVY75P.js +28 -0
  34. package/chunks/{chunk-WYANV3IX.js → chunk-RLND4AYL.js} +1 -1
  35. package/chunks/chunk-TJC4LPRQ.js +2 -0
  36. package/chunks/chunk-U4PFHJ7Z.js +27 -0
  37. package/chunks/chunk-V2SB4U4D.js +2 -0
  38. package/chunks/chunk-VGKKKM2W.js +6 -0
  39. package/chunks/{chunk-XFCC2CI2.js → chunk-VUISZDXX.js} +1 -1
  40. package/chunks/chunk-XVGPB7TW.js +21 -0
  41. package/chunks/{chunk-CJM7ZJ6W.js → chunk-ZDI22NOK.js} +1 -1
  42. package/chunks/{data-dir-LDVKDCJ2.js → data-dir-OEPRRIOO.js} +1 -1
  43. package/chunks/{dist-2BRD4JFU.js → dist-VKYZJYR6.js} +1 -1
  44. package/chunks/{dist-EXKHRFQO.js → dist-WGTMUM3E.js} +1 -1
  45. package/chunks/{ffi-OUPK6AY6.js → ffi-EFLUAAVX.js} +1 -1
  46. package/chunks/{ffi-M5UP5J6C.js → ffi-QKKA5HYI.js} +1 -1
  47. package/chunks/{google-UJAPMFAB.js → google-RCR46TTQ.js} +1 -1
  48. package/chunks/{google-vertex-VLSF55PW.js → google-vertex-Y26T7YYR.js} +1 -1
  49. package/chunks/{install-source-JTIUC4G4.js → install-source-63OVVBMK.js} +1 -1
  50. package/chunks/launcher-2UG3JPYF.js +63 -0
  51. package/chunks/lifecycle-5IPJRP2V.js +2 -0
  52. package/chunks/{main-TQGGRHTS.js → main-7SGOQBHZ.js} +2 -2
  53. package/chunks/{mistral-ZJZUEF2X.js → mistral-NEBDKUEI.js} +1 -1
  54. package/chunks/{module-6F3E5H7Y-BN7QWGYB.js → module-6F3E5H7Y-FIMLNSCK.js} +1 -1
  55. package/chunks/{module-asyncify-R6PWJ6ZV-P4FWSBAY.js → module-asyncify-R6PWJ6ZV-Q2HJ3NOC.js} +1 -1
  56. package/chunks/{multipart-parser-L6M455MS.js → multipart-parser-JVSLI2CL.js} +1 -1
  57. package/chunks/{network-proxy-U72JCK2I.js → network-proxy-AJO7ZW3O.js} +1 -1
  58. package/chunks/openai-codex-responses-L2CIGCKO.js +2 -0
  59. package/chunks/openai-completions-C4PHW6MD.js +2 -0
  60. package/chunks/openai-responses-5NVFOW4Y.js +2 -0
  61. package/chunks/{openrouter-G2EHY5BD.js → openrouter-BKUGQT7Z.js} +1 -1
  62. package/chunks/{otel-OHXIZ666.js → otel-DRJM2PIX.js} +1 -1
  63. package/chunks/plugin-command-CIDTOPNB.js +2 -0
  64. package/chunks/provider-command-UZ7KQFAC.js +2 -0
  65. package/chunks/run-acp-command-AKDLHKMR.js +59 -0
  66. package/chunks/{run-exec-command-5ADSQR2Z.js → run-exec-command-UXTPS7LC.js} +1 -1
  67. package/chunks/{skills-command-XXXEZAG6.js → skills-command-57TF53NO.js} +1 -1
  68. package/chunks/src-5PSNGHHD.js +2 -0
  69. package/chunks/{src-IBHIRTD7.js → src-YZ26EVSY.js} +1 -1
  70. package/chunks/telemetry-3NXMCOVD.js +2 -0
  71. package/chunks/{telemetry-command-COQG2AKK.js → telemetry-command-CMDERYNN.js} +1 -1
  72. package/chunks/{tools-WDBB2JKV.js → tools-CRJR35HS.js} +1 -1
  73. package/chunks/{undici-TUGHZJSA.js → undici-O4OQVZ6I.js} +1 -1
  74. package/chunks/{update-NB6OD572.js → update-ACFAGV6F.js} +1 -1
  75. package/cli.js +2 -3
  76. package/embedded/alran-tools/cli.mjs +1 -5
  77. package/embedded/alran-tools/manifest.json +1 -1
  78. package/image-preview-worker.js +1 -1
  79. package/matrix-mcp-stdio.js +1 -1
  80. package/package.json +1 -1
  81. package/quickjs-worker.js +1 -1
  82. package/chunks/azure-openai-responses-OWHMUNKC.js +0 -2
  83. package/chunks/chunk-C3CMJAAV.js +0 -3
  84. package/chunks/chunk-ENHOPPS7.js +0 -16
  85. package/chunks/chunk-FSNYOJPJ.js +0 -2
  86. package/chunks/chunk-FXOH6TEQ.js +0 -21
  87. package/chunks/chunk-GRXX6I72.js +0 -2
  88. package/chunks/chunk-GSYHBK5Q.js +0 -6
  89. package/chunks/chunk-IWK7PZP7.js +0 -207
  90. package/chunks/chunk-KCLRJQ53.js +0 -59
  91. package/chunks/chunk-M7GW4VMR.js +0 -27
  92. package/chunks/chunk-QFUV5PX6.js +0 -2
  93. package/chunks/chunk-TW23QKAD.js +0 -3
  94. package/chunks/chunk-U7U3DJHF.js +0 -2
  95. package/chunks/chunk-WTAJMYF2.js +0 -249
  96. package/chunks/chunk-YLQXZBEL.js +0 -2
  97. package/chunks/chunk-Z6BHCXKT.js +0 -25
  98. package/chunks/chunk-Z6HBNJCA.js +0 -8
  99. package/chunks/launcher-FCZ3EDBF.js +0 -61
  100. package/chunks/lifecycle-GY435YMF.js +0 -2
  101. package/chunks/openai-codex-responses-FPCDNRL5.js +0 -2
  102. package/chunks/openai-completions-D32YW6KL.js +0 -2
  103. package/chunks/openai-responses-ZCGSENM4.js +0 -2
  104. package/chunks/plugin-command-OSAFHS7C.js +0 -2
  105. package/chunks/provider-command-SKTCHD4E.js +0 -2
  106. package/chunks/run-acp-command-SG2BDMFJ.js +0 -2
  107. package/chunks/src-DNIDEMVV.js +0 -2
  108. package/chunks/telemetry-J7ZLGF5X.js +0 -2
  109. /package/chunks/{chunk-EOR6EDNR.js → chunk-2AYWJZ72.js} +0 -0
  110. /package/chunks/{chunk-YPV2X2RG.js → chunk-4XP5XUIZ.js} +0 -0
  111. /package/chunks/{chunk-NWB7LFOK.js → chunk-5DQTVSQV.js} +0 -0
  112. /package/chunks/{chunk-OIQ336YE.js → chunk-EJN3SE5B.js} +0 -0
  113. /package/chunks/{chunk-A7GMJNA2.js → chunk-K5DTFR6D.js} +0 -0
  114. /package/chunks/{chunk-ZQOALVGL.js → chunk-R44C5DM6.js} +0 -0
  115. /package/chunks/{chunk-PNXZWSWT.js → chunk-UJCAE7SG.js} +0 -0
  116. /package/chunks/{chunk-J3KCPYZT.js → chunk-W5ZOLW7T.js} +0 -0
  117. /package/chunks/{chunk-XAGZ6ZEU.js → chunk-XLVABFJC.js} +0 -0
  118. /package/chunks/{chunk-N5SVBCUB.js → chunk-XSEU4WQD.js} +0 -0
  119. /package/chunks/{chunk-CSOUJVKM.js → chunk-Z5HOCNTZ.js} +0 -0
  120. /package/chunks/{emscripten-module-ZS3PMSDF.js → emscripten-module-3WGSFZYF.js} +0 -0
  121. /package/chunks/{emscripten-module-XPTEOIWW.js → emscripten-module-74WUXTHL.js} +0 -0
  122. /package/chunks/{emscripten-module-WYNDFH3N.js → emscripten-module-MCN4Y3N4.js} +0 -0
  123. /package/chunks/{emscripten-module-RD6P2XH5.js → emscripten-module-NEAT5LGD.js} +0 -0
  124. /package/chunks/{ffi-ORLOPBB3.js → ffi-JIGPPPF7.js} +0 -0
  125. /package/chunks/{ffi-IO7WZQNG.js → ffi-RLX77WFG.js} +0 -0
  126. /package/chunks/{pdfjs-SHZAF7PF.js → pdfjs-2UOWBGC2.js} +0 -0
  127. /package/chunks/{photon_rs-C52RL4CI.js → photon_rs-MVWYTYTO.js} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __alran_cR } from "module"; import { basename as __alran_basename, dirname as __alran_dirname, join as __alran_join } from "path"; import { fileURLToPath as __alran_fileURLToPath, pathToFileURL as __alran_pathToFileURL } from "url"; const __alran_tuiCurrentModuleDir = __alran_dirname(__alran_fileURLToPath(import.meta.url)); const __alran_tuiPackageRoot = __alran_basename(__alran_tuiCurrentModuleDir) === "chunks" ? __alran_dirname(__alran_tuiCurrentModuleDir) : __alran_tuiCurrentModuleDir; const __alran_tuiPackageEntryUrl = __alran_pathToFileURL(__alran_join(__alran_tuiPackageRoot, "cli.js")).href; const require = __alran_cR(__alran_tuiPackageEntryUrl); const __dirname = __alran_tuiPackageRoot;
2
- import{a as Ka}from"./chunk-PNXZWSWT.js";import{l as Ja}from"./chunk-VLXX22YO.js";import{a as vt}from"./chunk-7XYOYZX2.js";import{a as an}from"./chunk-N5SVBCUB.js";import{a as z,c as F,e as $a}from"./chunk-XQK7JM66.js";var Ya=F((SS,Wa)=>{function xe(t,e){if(typeof e==="boolean"){e={forever:e}}this._originalTimeouts=JSON.parse(JSON.stringify(t));this._timeouts=t;this._options=e||{};this._maxRetryTime=e&&e.maxRetryTime||Infinity;this._fn=null;this._errors=[];this._attempts=1;this._operationTimeout=null;this._operationTimeoutCb=null;this._timeout=null;this._operationStart=null;this._timer=null;if(this._options.forever){this._cachedTimeouts=this._timeouts.slice(0)}}Wa.exports=xe;xe.prototype.reset=function(){this._attempts=1;this._timeouts=this._originalTimeouts.slice(0)};xe.prototype.stop=function(){if(this._timeout){clearTimeout(this._timeout)}if(this._timer){clearTimeout(this._timer)}this._timeouts=[];this._cachedTimeouts=null};xe.prototype.retry=function(t){if(this._timeout){clearTimeout(this._timeout)}if(!t){return false}var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime){this._errors.push(t);this._errors.unshift(new Error("RetryOperation timeout occurred"));return false}this._errors.push(t);var n=this._timeouts.shift();if(n===void 0){if(this._cachedTimeouts){this._errors.splice(0,this._errors.length-1);n=this._cachedTimeouts.slice(-1)}else{return false}}var i=this;this._timer=setTimeout(function(){i._attempts++;if(i._operationTimeoutCb){i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout);if(i._options.unref){i._timeout.unref()}}i._fn(i._attempts)},n);if(this._options.unref){this._timer.unref()}return true};xe.prototype.attempt=function(t,e){this._fn=t;if(e){if(e.timeout){this._operationTimeout=e.timeout}if(e.cb){this._operationTimeoutCb=e.cb}}var n=this;if(this._operationTimeoutCb){this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)}this._operationStart=new Date().getTime();this._fn(this._attempts)};xe.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated");this.attempt(t)};xe.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated");this.attempt(t)};xe.prototype.start=xe.prototype.try;xe.prototype.errors=function(){return this._errors};xe.prototype.attempts=function(){return this._attempts};xe.prototype.mainError=function(){if(this._errors.length===0){return null}var t={};var e=null;var n=0;for(var i=0;i<this._errors.length;i++){var r=this._errors[i];var o=r.message;var l=(t[o]||0)+1;t[o]=l;if(l>=n){e=r;n=l}}return e}});var za=F(St=>{var ep=Ya();St.operation=function(t){var e=St.timeouts(t);return new ep(e,{forever:t&&(t.forever||t.retries===Infinity),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};St.timeouts=function(t){if(t instanceof Array){return[].concat(t)}var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:Infinity,randomize:false};for(var n in t){e[n]=t[n]}if(e.minTimeout>e.maxTimeout){throw new Error("minTimeout is greater than maxTimeout")}var i=[];for(var r=0;r<e.retries;r++){i.push(this.createTimeout(r,e))}if(t&&t.forever&&!i.length){i.push(this.createTimeout(r,e))}i.sort(function(o,l){return o-l});return i};St.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1;var i=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));i=Math.min(i,e.maxTimeout);return i};St.wrap=function(t,e,n){if(e instanceof Array){n=e;e=null}if(!n){n=[];for(var i in t){if(typeof t[i]==="function"){n.push(i)}}}for(var r=0;r<n.length;r++){var o=n[r];var l=t[o];t[o]=function u(c){var d=St.operation(e);var f=Array.prototype.slice.call(arguments,1);var p=f.pop();f.push(function(h){if(d.retry(h)){return}if(h){arguments[0]=d.mainError()}p.apply(this,arguments)});d.attempt(function(){c.apply(t,f)})}.bind(t,l);t[o].options=e}}});var Qa=F((wS,Xa)=>{Xa.exports=za()});var ja=F((RS,xn)=>{"use strict";var tp=Qa();var np=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];var kn=class extends Error{constructor(e){super();if(e instanceof Error){this.originalError=e;({message:e}=e)}else{this.originalError=new Error(e);this.originalError.stack=this.stack}this.name="AbortError";this.message=e}};var ip=(t,e,n)=>{const i=n.retries-(e-1);t.attemptNumber=e;t.retriesLeft=i;return t};var rp=t=>np.includes(t);var Za=(t,e)=>new Promise((n,i)=>{e={onFailedAttempt:()=>{},retries:10,...e};const r=tp.operation(e);r.attempt(async o=>{try{n(await t(o))}catch(l){if(!(l instanceof Error)){i(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof kn){r.stop();i(l.originalError)}else if(l instanceof TypeError&&!rp(l.message)){r.stop();i(l)}else{ip(l,o,e);try{await e.onFailedAttempt(l)}catch(u){i(u);return}if(!r.retry(l)){i(r.mainError())}}}})});xn.exports=Za;xn.exports.default=Za;xn.exports.AbortError=kn});var vr=F((PS,al)=>{"use strict";var Dn=Object.prototype.hasOwnProperty;var sl=Object.prototype.toString;var el=Object.defineProperty;var tl=Object.getOwnPropertyDescriptor;var nl=function t(e){if(typeof Array.isArray==="function"){return Array.isArray(e)}return sl.call(e)==="[object Array]"};var il=function t(e){if(!e||sl.call(e)!=="[object Object]"){return false}var n=Dn.call(e,"constructor");var i=e.constructor&&e.constructor.prototype&&Dn.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!i){return false}var r;for(r in e){}return typeof r==="undefined"||Dn.call(e,r)};var rl=function t(e,n){if(el&&n.name==="__proto__"){el(e,n.name,{enumerable:true,configurable:true,value:n.newValue,writable:true})}else{e[n.name]=n.newValue}};var ol=function t(e,n){if(n==="__proto__"){if(!Dn.call(e,n)){return void 0}else if(tl){return tl(e,n).value}}return e[n]};al.exports=function t(){var e,n,i,r,o,l;var u=arguments[0];var c=1;var d=arguments.length;var f=false;if(typeof u==="boolean"){f=u;u=arguments[1]||{};c=2}if(u==null||typeof u!=="object"&&typeof u!=="function"){u={}}for(;c<d;++c){e=arguments[c];if(e!=null){for(n in e){i=ol(u,n);r=ol(e,n);if(u!==r){if(f&&r&&(il(r)||(o=nl(r)))){if(o){o=false;l=i&&nl(i)?i:[]}else{l=i&&il(i)?i:{}}rl(u,{name:n,newValue:t(f,l,r)})}else if(typeof r!=="undefined"){rl(u,{name:n,newValue:r})}}}}}return u}});var ll=F((NS,op)=>{op.exports={name:"gaxios",version:"7.3.1",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"core/packages/gaxios",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.0",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"21.0.3","stream-browserify":"^3.0.0",tmp:"0.2.7","ts-loader":"^9.5.2",typescript:"5.8.3","undici-types":"^7.24.1",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/gaxios"}});var cl=F((MS,ul)=>{"use strict";var sp=ll();ul.exports={pkg:sp}});var wr=F(De=>{"use strict";var fl=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(De,"__esModule",{value:true});De.GaxiosError=De.GAXIOS_ERROR_SYMBOL=void 0;De.defaultErrorRedactor=pl;var dl=fl(vr());var ap=fl(cl());var Sr=ap.default.pkg;De.GAXIOS_ERROR_SYMBOL=Symbol.for(`${Sr.name}-gaxios-error`);var Ir=class t extends Error{config;response;code;status;error;[De.GAXIOS_ERROR_SYMBOL]=Sr.version;static[Symbol.hasInstance](e){if(e&&typeof e==="object"&&De.GAXIOS_ERROR_SYMBOL in e&&e[De.GAXIOS_ERROR_SYMBOL]===Sr.version){return true}return Function.prototype[Symbol.hasInstance].call(t,e)}constructor(e,n,i,r){super(e,{cause:r});this.config=n;this.response=i;this.error=r instanceof Error?r:void 0;this.config=(0,dl.default)(true,{},n);if(this.response){this.response.config=(0,dl.default)(true,{},this.response.config)}if(this.response){try{this.response.data=lp(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(r instanceof DOMException){this.code=r.name}else if(r&&typeof r==="object"&&"code"in r&&(typeof r.code==="string"||typeof r.code==="number")){this.code=r.code}}static extractAPIErrorFromResponse(e,n="The request failed"){let i=n;if(typeof e.data==="string"){i=e.data}if(e.data&&typeof e.data==="object"&&"error"in e.data&&e.data.error&&!e.ok){if(typeof e.data.error==="string"){return{message:e.data.error,code:e.status,status:e.statusText}}if(typeof e.data.error==="object"){i="message"in e.data.error&&typeof e.data.error.message==="string"?e.data.error.message:i;const r="status"in e.data.error&&typeof e.data.error.status==="string"?e.data.error.status:e.statusText;const o="code"in e.data.error&&typeof e.data.error.code==="number"?e.data.error.code:e.status;if("errors"in e.data.error&&Array.isArray(e.data.error.errors)){const l=[];for(const u of e.data.error.errors){if(typeof u==="object"&&"message"in u&&typeof u.message==="string"){l.push(u.message)}}return Object.assign({message:l.join("\n")||i,code:o,status:r},e.data.error)}return Object.assign({message:i,code:o,status:r},e.data.error)}}return{message:i,code:e.status,status:e.statusText}}};De.GaxiosError=Ir;function lp(t,e){switch(t){case"stream":return e;case"json":return JSON.parse(JSON.stringify(e));case"arraybuffer":return JSON.parse(Buffer.from(e).toString("utf8"));case"blob":return JSON.parse(e.text());default:return e}}function pl(t){const e="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function n(o){if(!o)return;o.forEach((l,u)=>{if(/^authentication$/i.test(u)||/^authorization$/i.test(u)||/secret/i.test(u))o.set(u,e)})}function i(o,l){if(typeof o==="object"&&o!==null&&typeof o[l]==="string"){const u=o[l];if(/grant_type=/i.test(u)||/assertion=/i.test(u)||/secret/i.test(u)){o[l]=e}}}function r(o){if(!o||typeof o!=="object"){return}else if(o instanceof FormData||o instanceof URLSearchParams||"forEach"in o&&"set"in o){o.forEach((l,u)=>{if(["grant_type","assertion"].includes(u)||/secret/.test(u)){o.set(u,e)}})}else{if("grant_type"in o){o["grant_type"]=e}if("assertion"in o){o["assertion"]=e}if("client_secret"in o){o["client_secret"]=e}}}if(t.config){n(t.config.headers);i(t.config,"data");r(t.config.data);i(t.config,"body");r(t.config.body);if(t.config.url.searchParams.has("token")){t.config.url.searchParams.set("token",e)}if(t.config.url.searchParams.has("client_secret")){t.config.url.searchParams.set("client_secret",e)}}if(t.response){pl({config:t.response.config});n(t.response.headers);if(t.response.bodyUsed){i(t.response,"data");r(t.response.data)}}return t}});var gl=F(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:true});Rr.getRetryConfig=up;async function up(t){let e=hl(t);if(!t||!t.config||!e&&!t.config.retry){return{shouldRetry:false}}e=e||{};e.currentRetryAttempt=e.currentRetryAttempt||0;e.retry=e.retry===void 0||e.retry===null?3:e.retry;e.httpMethodsToRetry=e.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"];e.noResponseRetries=e.noResponseRetries===void 0||e.noResponseRetries===null?2:e.noResponseRetries;e.retryDelayMultiplier=e.retryDelayMultiplier?e.retryDelayMultiplier:2;e.timeOfFirstRequest=e.timeOfFirstRequest?e.timeOfFirstRequest:Date.now();e.totalTimeout=e.totalTimeout?e.totalTimeout:Number.MAX_SAFE_INTEGER;e.maxRetryDelay=e.maxRetryDelay?e.maxRetryDelay:Number.MAX_SAFE_INTEGER;const n=[[100,199],[408,408],[429,429],[500,599]];e.statusCodesToRetry=e.statusCodesToRetry||n;t.config.retryConfig=e;const i=e.shouldRetry||cp;if(!await i(t)){return{shouldRetry:false,config:t.config}}const r=dp(e);t.config.retryConfig.currentRetryAttempt+=1;const o=e.retryBackoff?e.retryBackoff(t,r):new Promise(l=>{setTimeout(l,r)});if(e.onRetryAttempt){await e.onRetryAttempt(t)}await o;return{shouldRetry:true,config:t.config}}function cp(t){const e=hl(t);if(t.config.signal?.aborted&&t.code!=="TimeoutError"||t.code==="AbortError"){return false}if(!e||e.retry===0){return false}if(!t.response&&(e.currentRetryAttempt||0)>=e.noResponseRetries){return false}if(!e.httpMethodsToRetry||!e.httpMethodsToRetry.includes(t.config.method?.toUpperCase()||"GET")){return false}if(t.response&&t.response.status){let n=false;for(const[i,r]of e.statusCodesToRetry){const o=t.response.status;if(o>=i&&o<=r){n=true;break}}if(!n){return false}}e.currentRetryAttempt=e.currentRetryAttempt||0;if(e.currentRetryAttempt>=e.retry){return false}return true}function hl(t){if(t&&t.config&&t.config.retryConfig){return t.config.retryConfig}return}function dp(t){const e=t.currentRetryAttempt?0:t.retryDelay??100;const n=e+(Math.pow(t.retryDelayMultiplier,t.currentRetryAttempt)-1)/2*1e3;const i=t.totalTimeout-(Date.now()-t.timeOfFirstRequest);return Math.min(n,i,t.maxRetryDelay)}});var Nr=F(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:true});Un.GaxiosInterceptorManager=void 0;var Pr=class extends Set{};Un.GaxiosInterceptorManager=Pr});var El=F(Dt=>{"use strict";var fp=Dt&&Dt.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};var xt;Object.defineProperty(Dt,"__esModule",{value:true});Dt.Gaxios=void 0;var pp=fp(vr());var hp=z("https");var It=wr();var gp=gl();var ml=z("stream");var yl=Nr();var mp=async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID();var yp=204;var Ln=class{agentCache=new Map;defaults;interceptors;constructor(e){this.defaults=e||{};this.interceptors={request:new yl.GaxiosInterceptorManager,response:new yl.GaxiosInterceptorManager}}fetch(...e){const n=e[0];const i=e[1];let r=void 0;const o=new Headers;if(typeof n==="string"){r=new URL(n)}else if(n instanceof URL){r=n}else if(n&&n.url){r=new URL(n.url)}if(n&&typeof n==="object"&&"headers"in n){xt.mergeHeaders(o,n.headers)}if(i){xt.mergeHeaders(o,new Headers(i.headers))}if(typeof n==="object"&&!(n instanceof URL)){return this.request({...i,...n,headers:o,url:r})}else{return this.request({...i,headers:o,url:r})}}async request(e={}){let n=await this.#i(e);n=await this.#t(n);return this.#n(this._request(n))}async _defaultAdapter(e){const n=e.fetchImplementation||this.defaults.fetchImplementation||await xt.#l();const i={...e};delete i.data;const r=await n(e.url,i);const o=await this.getResponseData(e,r);if(!Object.getOwnPropertyDescriptor(r,"data")?.configurable){Object.defineProperties(r,{data:{configurable:true,writable:true,enumerable:true,value:o}})}return Object.assign(r,{config:e,data:o})}async _request(e){try{let n;if(e.adapter){n=await e.adapter(e,this._defaultAdapter.bind(this))}else{n=await this._defaultAdapter(e)}if(!e.validateStatus(n.status)){if(e.responseType==="stream"){const r=[];for await(const o of n.data){r.push(o)}n.data=Buffer.concat(r.map(o=>typeof o==="string"?Buffer.from(o):o)).toString("utf8")}const i=It.GaxiosError.extractAPIErrorFromResponse(n,`Request failed with status code ${n.status}`);throw new It.GaxiosError(i?.message,e,n,i)}return n}catch(n){let i;if(n instanceof It.GaxiosError){i=n}else if(n instanceof Error){i=new It.GaxiosError(n.message,e,void 0,n)}else{i=new It.GaxiosError("Unexpected Gaxios Error",e,void 0,n)}const{shouldRetry:r,config:o}=await(0,gp.getRetryConfig)(i);if(r&&o){i.config.retryConfig.currentRetryAttempt=o.retryConfig.currentRetryAttempt;e.retryConfig=i.config?.retryConfig;this.#r(e);return this._request(e)}if(e.errorRedactor){e.errorRedactor(i)}throw i}}async getResponseData(e,n){if(n.status===yp){return""}if(e.maxContentLength&&n.headers.has("content-length")&&e.maxContentLength<Number.parseInt(n.headers?.get("content-length")||"")){throw new It.GaxiosError("Response's `Content-Length` is over the limit.",e,Object.assign(n,{config:e}))}switch(e.responseType){case"stream":return n.body;case"json":{const i=await n.text();try{return JSON.parse(i)}catch{return i}}case"arraybuffer":return n.arrayBuffer();case"blob":return n.blob();case"text":return n.text();default:return this.getResponseDataFromContentType(n)}}#e(e,n=[]){const i=new URL(e);const r=[...n];const o=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(const l of o){r.push(l.trim())}for(const l of r){if(l instanceof RegExp){if(l.test(i.toString())){return false}}else if(l instanceof URL){if(l.origin===i.origin){return false}}else if(l.startsWith("*.")||l.startsWith(".")){const u=l.replace(/^\*\./,".");if(i.hostname.endsWith(u)){return false}}else if(l===i.origin||l===i.hostname||l===i.href){return false}}return true}async#t(e){let n=Promise.resolve(e);for(const i of this.interceptors.request.values()){if(i){n=n.then(i.resolved,i.rejected)}}return n}async#n(e){let n=Promise.resolve(e);for(const i of this.interceptors.response.values()){if(i){n=n.then(i.resolved,i.rejected)}}return n}async#i(e){const n=new Headers(this.defaults.headers);xt.mergeHeaders(n,e.headers);const i=(0,pp.default)(true,{},this.defaults,e);if(!i.url){throw new Error("URL is required.")}if(i.baseURL){i.url=new URL(i.url,i.baseURL)}i.url=new URL(i.url);if(i.params){if(i.paramsSerializer){let l=i.paramsSerializer(i.params);if(l.startsWith("?")){l=l.slice(1)}const u=i.url.toString().includes("?")?"&":"?";i.url=i.url+u+l}else{const l=i.url instanceof URL?i.url:new URL(i.url);for(const[u,c]of new URLSearchParams(i.params)){l.searchParams.append(u,c)}i.url=l}}if(typeof e.maxContentLength==="number"){i.size=e.maxContentLength}if(typeof e.maxRedirects==="number"){i.follow=e.maxRedirects}const r=typeof i.data==="string"||i.data instanceof ArrayBuffer||i.data instanceof Blob||globalThis.File&&i.data instanceof File||i.data instanceof FormData||i.data instanceof ml.Readable||i.data instanceof ReadableStream||i.data instanceof String||i.data instanceof URLSearchParams||ArrayBuffer.isView(i.data)||["Blob","File","FormData"].includes(i.data?.constructor?.name||"");if(i.multipart?.length){const l=await mp();n.set("content-type",`multipart/related; boundary=${l}`);i.body=ml.Readable.from(this.getMultipartRequest(i.multipart,l))}else if(r){i.body=i.data}else if(typeof i.data==="object"){if(n.get("Content-Type")==="application/x-www-form-urlencoded"){i.body=i.paramsSerializer?i.paramsSerializer(i.data):new URLSearchParams(i.data)}else{if(!n.has("content-type")){n.set("content-type","application/json")}i.body=JSON.stringify(i.data)}}else if(i.data){i.body=i.data}i.validateStatus=i.validateStatus||this.validateStatus;i.responseType=i.responseType||"unknown";if(!n.has("accept")&&i.responseType==="json"){n.set("accept","application/json")}const o=i.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(i.agent){}else if(o&&this.#e(i.url,i.noProxy)){const l=await xt.#a();if(this.agentCache.has(o)){i.agent=this.agentCache.get(o)}else{i.agent=new l(o,{cert:i.cert,key:i.key});this.agentCache.set(o,i.agent)}}else if(i.cert&&i.key){if(this.agentCache.has(i.key)){i.agent=this.agentCache.get(i.key)}else{i.agent=new hp.Agent({cert:i.cert,key:i.key});this.agentCache.set(i.key,i.agent)}}if(typeof i.errorRedactor!=="function"&&i.errorRedactor!==false){i.errorRedactor=It.defaultErrorRedactor}if(i.body&&!("duplex"in i)){i.duplex="half"}this.#r(i);return Object.assign(i,{headers:n,url:i.url instanceof URL?i.url:new URL(i.url)})}#r(e){if(e.timeout){const n=AbortSignal.timeout(e.timeout);if(e.signal&&!e.signal.aborted){e.signal=AbortSignal.any([e.signal,n])}else{e.signal=n}}}validateStatus(e){return e>=200&&e<300}async getResponseDataFromContentType(e){let n=e.headers.get("Content-Type");if(n===null){return e.text()}n=n.toLowerCase();if(n.includes("application/json")){let i=await e.text();try{i=JSON.parse(i)}catch{}return i}else if(n.match(/^text\//)){return e.text()}else{return e.blob()}}async*getMultipartRequest(e,n){const i=`--${n}--`;for(const r of e){const o=r.headers.get("Content-Type")||"application/octet-stream";const l=`--${n}\r
2
+ import{a as Ka}from"./chunk-UJCAE7SG.js";import{l as Ja}from"./chunk-VLXX22YO.js";import{a as vt}from"./chunk-7XYOYZX2.js";import{a as an}from"./chunk-XSEU4WQD.js";import{a as z,c as F,e as $a}from"./chunk-XQK7JM66.js";var Ya=F((SS,Wa)=>{function xe(t,e){if(typeof e==="boolean"){e={forever:e}}this._originalTimeouts=JSON.parse(JSON.stringify(t));this._timeouts=t;this._options=e||{};this._maxRetryTime=e&&e.maxRetryTime||Infinity;this._fn=null;this._errors=[];this._attempts=1;this._operationTimeout=null;this._operationTimeoutCb=null;this._timeout=null;this._operationStart=null;this._timer=null;if(this._options.forever){this._cachedTimeouts=this._timeouts.slice(0)}}Wa.exports=xe;xe.prototype.reset=function(){this._attempts=1;this._timeouts=this._originalTimeouts.slice(0)};xe.prototype.stop=function(){if(this._timeout){clearTimeout(this._timeout)}if(this._timer){clearTimeout(this._timer)}this._timeouts=[];this._cachedTimeouts=null};xe.prototype.retry=function(t){if(this._timeout){clearTimeout(this._timeout)}if(!t){return false}var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime){this._errors.push(t);this._errors.unshift(new Error("RetryOperation timeout occurred"));return false}this._errors.push(t);var n=this._timeouts.shift();if(n===void 0){if(this._cachedTimeouts){this._errors.splice(0,this._errors.length-1);n=this._cachedTimeouts.slice(-1)}else{return false}}var i=this;this._timer=setTimeout(function(){i._attempts++;if(i._operationTimeoutCb){i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout);if(i._options.unref){i._timeout.unref()}}i._fn(i._attempts)},n);if(this._options.unref){this._timer.unref()}return true};xe.prototype.attempt=function(t,e){this._fn=t;if(e){if(e.timeout){this._operationTimeout=e.timeout}if(e.cb){this._operationTimeoutCb=e.cb}}var n=this;if(this._operationTimeoutCb){this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)}this._operationStart=new Date().getTime();this._fn(this._attempts)};xe.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated");this.attempt(t)};xe.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated");this.attempt(t)};xe.prototype.start=xe.prototype.try;xe.prototype.errors=function(){return this._errors};xe.prototype.attempts=function(){return this._attempts};xe.prototype.mainError=function(){if(this._errors.length===0){return null}var t={};var e=null;var n=0;for(var i=0;i<this._errors.length;i++){var r=this._errors[i];var o=r.message;var l=(t[o]||0)+1;t[o]=l;if(l>=n){e=r;n=l}}return e}});var za=F(St=>{var ep=Ya();St.operation=function(t){var e=St.timeouts(t);return new ep(e,{forever:t&&(t.forever||t.retries===Infinity),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};St.timeouts=function(t){if(t instanceof Array){return[].concat(t)}var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:Infinity,randomize:false};for(var n in t){e[n]=t[n]}if(e.minTimeout>e.maxTimeout){throw new Error("minTimeout is greater than maxTimeout")}var i=[];for(var r=0;r<e.retries;r++){i.push(this.createTimeout(r,e))}if(t&&t.forever&&!i.length){i.push(this.createTimeout(r,e))}i.sort(function(o,l){return o-l});return i};St.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1;var i=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));i=Math.min(i,e.maxTimeout);return i};St.wrap=function(t,e,n){if(e instanceof Array){n=e;e=null}if(!n){n=[];for(var i in t){if(typeof t[i]==="function"){n.push(i)}}}for(var r=0;r<n.length;r++){var o=n[r];var l=t[o];t[o]=function u(c){var d=St.operation(e);var f=Array.prototype.slice.call(arguments,1);var p=f.pop();f.push(function(h){if(d.retry(h)){return}if(h){arguments[0]=d.mainError()}p.apply(this,arguments)});d.attempt(function(){c.apply(t,f)})}.bind(t,l);t[o].options=e}}});var Qa=F((wS,Xa)=>{Xa.exports=za()});var ja=F((RS,xn)=>{"use strict";var tp=Qa();var np=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];var kn=class extends Error{constructor(e){super();if(e instanceof Error){this.originalError=e;({message:e}=e)}else{this.originalError=new Error(e);this.originalError.stack=this.stack}this.name="AbortError";this.message=e}};var ip=(t,e,n)=>{const i=n.retries-(e-1);t.attemptNumber=e;t.retriesLeft=i;return t};var rp=t=>np.includes(t);var Za=(t,e)=>new Promise((n,i)=>{e={onFailedAttempt:()=>{},retries:10,...e};const r=tp.operation(e);r.attempt(async o=>{try{n(await t(o))}catch(l){if(!(l instanceof Error)){i(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof kn){r.stop();i(l.originalError)}else if(l instanceof TypeError&&!rp(l.message)){r.stop();i(l)}else{ip(l,o,e);try{await e.onFailedAttempt(l)}catch(u){i(u);return}if(!r.retry(l)){i(r.mainError())}}}})});xn.exports=Za;xn.exports.default=Za;xn.exports.AbortError=kn});var vr=F((PS,al)=>{"use strict";var Dn=Object.prototype.hasOwnProperty;var sl=Object.prototype.toString;var el=Object.defineProperty;var tl=Object.getOwnPropertyDescriptor;var nl=function t(e){if(typeof Array.isArray==="function"){return Array.isArray(e)}return sl.call(e)==="[object Array]"};var il=function t(e){if(!e||sl.call(e)!=="[object Object]"){return false}var n=Dn.call(e,"constructor");var i=e.constructor&&e.constructor.prototype&&Dn.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!i){return false}var r;for(r in e){}return typeof r==="undefined"||Dn.call(e,r)};var rl=function t(e,n){if(el&&n.name==="__proto__"){el(e,n.name,{enumerable:true,configurable:true,value:n.newValue,writable:true})}else{e[n.name]=n.newValue}};var ol=function t(e,n){if(n==="__proto__"){if(!Dn.call(e,n)){return void 0}else if(tl){return tl(e,n).value}}return e[n]};al.exports=function t(){var e,n,i,r,o,l;var u=arguments[0];var c=1;var d=arguments.length;var f=false;if(typeof u==="boolean"){f=u;u=arguments[1]||{};c=2}if(u==null||typeof u!=="object"&&typeof u!=="function"){u={}}for(;c<d;++c){e=arguments[c];if(e!=null){for(n in e){i=ol(u,n);r=ol(e,n);if(u!==r){if(f&&r&&(il(r)||(o=nl(r)))){if(o){o=false;l=i&&nl(i)?i:[]}else{l=i&&il(i)?i:{}}rl(u,{name:n,newValue:t(f,l,r)})}else if(typeof r!=="undefined"){rl(u,{name:n,newValue:r})}}}}}return u}});var ll=F((NS,op)=>{op.exports={name:"gaxios",version:"7.3.1",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"core/packages/gaxios",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.0",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"21.0.3","stream-browserify":"^3.0.0",tmp:"0.2.7","ts-loader":"^9.5.2",typescript:"5.8.3","undici-types":"^7.24.1",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/gaxios"}});var cl=F((MS,ul)=>{"use strict";var sp=ll();ul.exports={pkg:sp}});var wr=F(De=>{"use strict";var fl=De&&De.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(De,"__esModule",{value:true});De.GaxiosError=De.GAXIOS_ERROR_SYMBOL=void 0;De.defaultErrorRedactor=pl;var dl=fl(vr());var ap=fl(cl());var Sr=ap.default.pkg;De.GAXIOS_ERROR_SYMBOL=Symbol.for(`${Sr.name}-gaxios-error`);var Ir=class t extends Error{config;response;code;status;error;[De.GAXIOS_ERROR_SYMBOL]=Sr.version;static[Symbol.hasInstance](e){if(e&&typeof e==="object"&&De.GAXIOS_ERROR_SYMBOL in e&&e[De.GAXIOS_ERROR_SYMBOL]===Sr.version){return true}return Function.prototype[Symbol.hasInstance].call(t,e)}constructor(e,n,i,r){super(e,{cause:r});this.config=n;this.response=i;this.error=r instanceof Error?r:void 0;this.config=(0,dl.default)(true,{},n);if(this.response){this.response.config=(0,dl.default)(true,{},this.response.config)}if(this.response){try{this.response.data=lp(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(r instanceof DOMException){this.code=r.name}else if(r&&typeof r==="object"&&"code"in r&&(typeof r.code==="string"||typeof r.code==="number")){this.code=r.code}}static extractAPIErrorFromResponse(e,n="The request failed"){let i=n;if(typeof e.data==="string"){i=e.data}if(e.data&&typeof e.data==="object"&&"error"in e.data&&e.data.error&&!e.ok){if(typeof e.data.error==="string"){return{message:e.data.error,code:e.status,status:e.statusText}}if(typeof e.data.error==="object"){i="message"in e.data.error&&typeof e.data.error.message==="string"?e.data.error.message:i;const r="status"in e.data.error&&typeof e.data.error.status==="string"?e.data.error.status:e.statusText;const o="code"in e.data.error&&typeof e.data.error.code==="number"?e.data.error.code:e.status;if("errors"in e.data.error&&Array.isArray(e.data.error.errors)){const l=[];for(const u of e.data.error.errors){if(typeof u==="object"&&"message"in u&&typeof u.message==="string"){l.push(u.message)}}return Object.assign({message:l.join("\n")||i,code:o,status:r},e.data.error)}return Object.assign({message:i,code:o,status:r},e.data.error)}}return{message:i,code:e.status,status:e.statusText}}};De.GaxiosError=Ir;function lp(t,e){switch(t){case"stream":return e;case"json":return JSON.parse(JSON.stringify(e));case"arraybuffer":return JSON.parse(Buffer.from(e).toString("utf8"));case"blob":return JSON.parse(e.text());default:return e}}function pl(t){const e="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function n(o){if(!o)return;o.forEach((l,u)=>{if(/^authentication$/i.test(u)||/^authorization$/i.test(u)||/secret/i.test(u))o.set(u,e)})}function i(o,l){if(typeof o==="object"&&o!==null&&typeof o[l]==="string"){const u=o[l];if(/grant_type=/i.test(u)||/assertion=/i.test(u)||/secret/i.test(u)){o[l]=e}}}function r(o){if(!o||typeof o!=="object"){return}else if(o instanceof FormData||o instanceof URLSearchParams||"forEach"in o&&"set"in o){o.forEach((l,u)=>{if(["grant_type","assertion"].includes(u)||/secret/.test(u)){o.set(u,e)}})}else{if("grant_type"in o){o["grant_type"]=e}if("assertion"in o){o["assertion"]=e}if("client_secret"in o){o["client_secret"]=e}}}if(t.config){n(t.config.headers);i(t.config,"data");r(t.config.data);i(t.config,"body");r(t.config.body);if(t.config.url.searchParams.has("token")){t.config.url.searchParams.set("token",e)}if(t.config.url.searchParams.has("client_secret")){t.config.url.searchParams.set("client_secret",e)}}if(t.response){pl({config:t.response.config});n(t.response.headers);if(t.response.bodyUsed){i(t.response,"data");r(t.response.data)}}return t}});var gl=F(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:true});Rr.getRetryConfig=up;async function up(t){let e=hl(t);if(!t||!t.config||!e&&!t.config.retry){return{shouldRetry:false}}e=e||{};e.currentRetryAttempt=e.currentRetryAttempt||0;e.retry=e.retry===void 0||e.retry===null?3:e.retry;e.httpMethodsToRetry=e.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"];e.noResponseRetries=e.noResponseRetries===void 0||e.noResponseRetries===null?2:e.noResponseRetries;e.retryDelayMultiplier=e.retryDelayMultiplier?e.retryDelayMultiplier:2;e.timeOfFirstRequest=e.timeOfFirstRequest?e.timeOfFirstRequest:Date.now();e.totalTimeout=e.totalTimeout?e.totalTimeout:Number.MAX_SAFE_INTEGER;e.maxRetryDelay=e.maxRetryDelay?e.maxRetryDelay:Number.MAX_SAFE_INTEGER;const n=[[100,199],[408,408],[429,429],[500,599]];e.statusCodesToRetry=e.statusCodesToRetry||n;t.config.retryConfig=e;const i=e.shouldRetry||cp;if(!await i(t)){return{shouldRetry:false,config:t.config}}const r=dp(e);t.config.retryConfig.currentRetryAttempt+=1;const o=e.retryBackoff?e.retryBackoff(t,r):new Promise(l=>{setTimeout(l,r)});if(e.onRetryAttempt){await e.onRetryAttempt(t)}await o;return{shouldRetry:true,config:t.config}}function cp(t){const e=hl(t);if(t.config.signal?.aborted&&t.code!=="TimeoutError"||t.code==="AbortError"){return false}if(!e||e.retry===0){return false}if(!t.response&&(e.currentRetryAttempt||0)>=e.noResponseRetries){return false}if(!e.httpMethodsToRetry||!e.httpMethodsToRetry.includes(t.config.method?.toUpperCase()||"GET")){return false}if(t.response&&t.response.status){let n=false;for(const[i,r]of e.statusCodesToRetry){const o=t.response.status;if(o>=i&&o<=r){n=true;break}}if(!n){return false}}e.currentRetryAttempt=e.currentRetryAttempt||0;if(e.currentRetryAttempt>=e.retry){return false}return true}function hl(t){if(t&&t.config&&t.config.retryConfig){return t.config.retryConfig}return}function dp(t){const e=t.currentRetryAttempt?0:t.retryDelay??100;const n=e+(Math.pow(t.retryDelayMultiplier,t.currentRetryAttempt)-1)/2*1e3;const i=t.totalTimeout-(Date.now()-t.timeOfFirstRequest);return Math.min(n,i,t.maxRetryDelay)}});var Nr=F(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:true});Un.GaxiosInterceptorManager=void 0;var Pr=class extends Set{};Un.GaxiosInterceptorManager=Pr});var El=F(Dt=>{"use strict";var fp=Dt&&Dt.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};var xt;Object.defineProperty(Dt,"__esModule",{value:true});Dt.Gaxios=void 0;var pp=fp(vr());var hp=z("https");var It=wr();var gp=gl();var ml=z("stream");var yl=Nr();var mp=async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID();var yp=204;var Ln=class{agentCache=new Map;defaults;interceptors;constructor(e){this.defaults=e||{};this.interceptors={request:new yl.GaxiosInterceptorManager,response:new yl.GaxiosInterceptorManager}}fetch(...e){const n=e[0];const i=e[1];let r=void 0;const o=new Headers;if(typeof n==="string"){r=new URL(n)}else if(n instanceof URL){r=n}else if(n&&n.url){r=new URL(n.url)}if(n&&typeof n==="object"&&"headers"in n){xt.mergeHeaders(o,n.headers)}if(i){xt.mergeHeaders(o,new Headers(i.headers))}if(typeof n==="object"&&!(n instanceof URL)){return this.request({...i,...n,headers:o,url:r})}else{return this.request({...i,headers:o,url:r})}}async request(e={}){let n=await this.#i(e);n=await this.#t(n);return this.#n(this._request(n))}async _defaultAdapter(e){const n=e.fetchImplementation||this.defaults.fetchImplementation||await xt.#l();const i={...e};delete i.data;const r=await n(e.url,i);const o=await this.getResponseData(e,r);if(!Object.getOwnPropertyDescriptor(r,"data")?.configurable){Object.defineProperties(r,{data:{configurable:true,writable:true,enumerable:true,value:o}})}return Object.assign(r,{config:e,data:o})}async _request(e){try{let n;if(e.adapter){n=await e.adapter(e,this._defaultAdapter.bind(this))}else{n=await this._defaultAdapter(e)}if(!e.validateStatus(n.status)){if(e.responseType==="stream"){const r=[];for await(const o of n.data){r.push(o)}n.data=Buffer.concat(r.map(o=>typeof o==="string"?Buffer.from(o):o)).toString("utf8")}const i=It.GaxiosError.extractAPIErrorFromResponse(n,`Request failed with status code ${n.status}`);throw new It.GaxiosError(i?.message,e,n,i)}return n}catch(n){let i;if(n instanceof It.GaxiosError){i=n}else if(n instanceof Error){i=new It.GaxiosError(n.message,e,void 0,n)}else{i=new It.GaxiosError("Unexpected Gaxios Error",e,void 0,n)}const{shouldRetry:r,config:o}=await(0,gp.getRetryConfig)(i);if(r&&o){i.config.retryConfig.currentRetryAttempt=o.retryConfig.currentRetryAttempt;e.retryConfig=i.config?.retryConfig;this.#r(e);return this._request(e)}if(e.errorRedactor){e.errorRedactor(i)}throw i}}async getResponseData(e,n){if(n.status===yp){return""}if(e.maxContentLength&&n.headers.has("content-length")&&e.maxContentLength<Number.parseInt(n.headers?.get("content-length")||"")){throw new It.GaxiosError("Response's `Content-Length` is over the limit.",e,Object.assign(n,{config:e}))}switch(e.responseType){case"stream":return n.body;case"json":{const i=await n.text();try{return JSON.parse(i)}catch{return i}}case"arraybuffer":return n.arrayBuffer();case"blob":return n.blob();case"text":return n.text();default:return this.getResponseDataFromContentType(n)}}#e(e,n=[]){const i=new URL(e);const r=[...n];const o=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(const l of o){r.push(l.trim())}for(const l of r){if(l instanceof RegExp){if(l.test(i.toString())){return false}}else if(l instanceof URL){if(l.origin===i.origin){return false}}else if(l.startsWith("*.")||l.startsWith(".")){const u=l.replace(/^\*\./,".");if(i.hostname.endsWith(u)){return false}}else if(l===i.origin||l===i.hostname||l===i.href){return false}}return true}async#t(e){let n=Promise.resolve(e);for(const i of this.interceptors.request.values()){if(i){n=n.then(i.resolved,i.rejected)}}return n}async#n(e){let n=Promise.resolve(e);for(const i of this.interceptors.response.values()){if(i){n=n.then(i.resolved,i.rejected)}}return n}async#i(e){const n=new Headers(this.defaults.headers);xt.mergeHeaders(n,e.headers);const i=(0,pp.default)(true,{},this.defaults,e);if(!i.url){throw new Error("URL is required.")}if(i.baseURL){i.url=new URL(i.url,i.baseURL)}i.url=new URL(i.url);if(i.params){if(i.paramsSerializer){let l=i.paramsSerializer(i.params);if(l.startsWith("?")){l=l.slice(1)}const u=i.url.toString().includes("?")?"&":"?";i.url=i.url+u+l}else{const l=i.url instanceof URL?i.url:new URL(i.url);for(const[u,c]of new URLSearchParams(i.params)){l.searchParams.append(u,c)}i.url=l}}if(typeof e.maxContentLength==="number"){i.size=e.maxContentLength}if(typeof e.maxRedirects==="number"){i.follow=e.maxRedirects}const r=typeof i.data==="string"||i.data instanceof ArrayBuffer||i.data instanceof Blob||globalThis.File&&i.data instanceof File||i.data instanceof FormData||i.data instanceof ml.Readable||i.data instanceof ReadableStream||i.data instanceof String||i.data instanceof URLSearchParams||ArrayBuffer.isView(i.data)||["Blob","File","FormData"].includes(i.data?.constructor?.name||"");if(i.multipart?.length){const l=await mp();n.set("content-type",`multipart/related; boundary=${l}`);i.body=ml.Readable.from(this.getMultipartRequest(i.multipart,l))}else if(r){i.body=i.data}else if(typeof i.data==="object"){if(n.get("Content-Type")==="application/x-www-form-urlencoded"){i.body=i.paramsSerializer?i.paramsSerializer(i.data):new URLSearchParams(i.data)}else{if(!n.has("content-type")){n.set("content-type","application/json")}i.body=JSON.stringify(i.data)}}else if(i.data){i.body=i.data}i.validateStatus=i.validateStatus||this.validateStatus;i.responseType=i.responseType||"unknown";if(!n.has("accept")&&i.responseType==="json"){n.set("accept","application/json")}const o=i.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(i.agent){}else if(o&&this.#e(i.url,i.noProxy)){const l=await xt.#a();if(this.agentCache.has(o)){i.agent=this.agentCache.get(o)}else{i.agent=new l(o,{cert:i.cert,key:i.key});this.agentCache.set(o,i.agent)}}else if(i.cert&&i.key){if(this.agentCache.has(i.key)){i.agent=this.agentCache.get(i.key)}else{i.agent=new hp.Agent({cert:i.cert,key:i.key});this.agentCache.set(i.key,i.agent)}}if(typeof i.errorRedactor!=="function"&&i.errorRedactor!==false){i.errorRedactor=It.defaultErrorRedactor}if(i.body&&!("duplex"in i)){i.duplex="half"}this.#r(i);return Object.assign(i,{headers:n,url:i.url instanceof URL?i.url:new URL(i.url)})}#r(e){if(e.timeout){const n=AbortSignal.timeout(e.timeout);if(e.signal&&!e.signal.aborted){e.signal=AbortSignal.any([e.signal,n])}else{e.signal=n}}}validateStatus(e){return e>=200&&e<300}async getResponseDataFromContentType(e){let n=e.headers.get("Content-Type");if(n===null){return e.text()}n=n.toLowerCase();if(n.includes("application/json")){let i=await e.text();try{i=JSON.parse(i)}catch{}return i}else if(n.match(/^text\//)){return e.text()}else{return e.blob()}}async*getMultipartRequest(e,n){const i=`--${n}--`;for(const r of e){const o=r.headers.get("Content-Type")||"application/octet-stream";const l=`--${n}\r
3
3
  Content-Type: ${o}\r
4
4
  \r
5
- `;yield l;if(typeof r.content==="string"){yield r.content}else{yield*r.content}yield"\r\n"}yield i}static#o;static#s;static async#a(){this.#o||=(await import("./dist-EXKHRFQO.js")).HttpsProxyAgent;return this.#o}static async#l(){const e=typeof window!=="undefined"&&!!window;this.#s||=e?window.fetch:(await import("./src-IBHIRTD7.js")).default;return this.#s}static mergeHeaders(e,...n){e=e instanceof Headers?e:new Headers(e);for(const i of n){const r=i instanceof Headers?i:new Headers(i);r.forEach((o,l)=>{l==="set-cookie"?e.append(l,o):e.set(l,o)})}return e}};Dt.Gaxios=Ln;xt=Ln});var ge=F(_e=>{"use strict";var Ep=_e&&_e.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var _p=_e&&_e.__exportStar||function(t,e){for(var n in t)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n))Ep(e,t,n)};Object.defineProperty(_e,"__esModule",{value:true});_e.instance=_e.Gaxios=_e.GaxiosError=void 0;_e.request=Ap;var _l=El();Object.defineProperty(_e,"Gaxios",{enumerable:true,get:function(){return _l.Gaxios}});var Tp=wr();Object.defineProperty(_e,"GaxiosError",{enumerable:true,get:function(){return Tp.GaxiosError}});_p(Nr(),_e);_e.instance=new _l.Gaxios;async function Ap(t){return _e.instance.request(t)}});var Mr=F((Tl,Gn)=>{(function(t){"use strict";var e,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,r=Math.floor,o="[BigNumber Error] ",l=o+"Number primitive has more than 15 significant digits: ",u=1e14,c=14,d=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,h=1e9;function m(L){var R,q,V,k=b.prototype={constructor:b,toString:null,valueOf:null},$=new b(1),Y=20,Q=4,oe=-7,ee=21,re=-1e7,le=1e7,Se=false,Ie=1,ce=0,At={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},Ct="0123456789abcdefghijklmnopqrstuvwxyz",Er=true;function b(g,y){var E,N,S,w,x,C,I,M,P=this;if(!(P instanceof b))return new b(g,y);if(y==null){if(g&&g._isBigNumber===true){P.s=g.s;if(!g.c||g.e>le){P.c=P.e=null}else if(g.e<re){P.c=[P.e=0]}else{P.e=g.e;P.c=g.c.slice()}return}if((C=typeof g=="number")&&g*0==0){P.s=1/g<0?(g=-g,-1):1;if(g===~~g){for(w=0,x=g;x>=10;x/=10,w++);if(w>le){P.c=P.e=null}else{P.e=w;P.c=[g]}return}M=String(g)}else{if(!n.test(M=String(g)))return V(P,M,C);P.s=M.charCodeAt(0)==45?(M=M.slice(1),-1):1}if((w=M.indexOf("."))>-1)M=M.replace(".","");if((x=M.search(/e/i))>0){if(w<0)w=x;w+=+M.slice(x+1);M=M.substring(0,x)}else if(w<0){w=M.length}}else{v(y,2,Ct.length,"Base");if(y==10&&Er){P=new b(g);return Me(P,Y+P.e+1,Q)}M=String(g);if(C=typeof g=="number"){if(g*0!=0)return V(P,M,C,y);P.s=1/g<0?(M=M.slice(1),-1):1;if(b.DEBUG&&M.replace(/^0\.0*|\./,"").length>15){throw Error(l+g)}}else{P.s=M.charCodeAt(0)===45?(M=M.slice(1),-1):1}E=Ct.slice(0,y);w=x=0;for(I=M.length;x<I;x++){if(E.indexOf(N=M.charAt(x))<0){if(N=="."){if(x>w){w=I;continue}}else if(!S){if(M==M.toUpperCase()&&(M=M.toLowerCase())||M==M.toLowerCase()&&(M=M.toUpperCase())){S=true;x=-1;w=0;continue}}return V(P,String(g),C,y)}}C=false;M=q(M,y,10,P.s);if((w=M.indexOf("."))>-1)M=M.replace(".","");else w=M.length}for(x=0;M.charCodeAt(x)===48;x++);for(I=M.length;M.charCodeAt(--I)===48;);if(M=M.slice(x,++I)){I-=x;if(C&&b.DEBUG&&I>15&&(g>d||g!==r(g))){throw Error(l+P.s*g)}if((w=w-x-1)>le){P.c=P.e=null}else if(w<re){P.c=[P.e=0]}else{P.e=w;P.c=[];x=(w+1)%c;if(w<0)x+=c;if(x<I){if(x)P.c.push(+M.slice(0,x));for(I-=c;x<I;){P.c.push(+M.slice(x,x+=c))}x=c-(M=M.slice(x)).length}else{x-=I}for(;x--;M+="0");P.c.push(+M)}}else{P.c=[P.e=0]}}b.clone=m;b.ROUND_UP=0;b.ROUND_DOWN=1;b.ROUND_CEIL=2;b.ROUND_FLOOR=3;b.ROUND_HALF_UP=4;b.ROUND_HALF_DOWN=5;b.ROUND_HALF_EVEN=6;b.ROUND_HALF_CEIL=7;b.ROUND_HALF_FLOOR=8;b.EUCLID=9;b.config=b.set=function(g){var y,E;if(g!=null){if(typeof g=="object"){if(g.hasOwnProperty(y="DECIMAL_PLACES")){E=g[y];v(E,0,h,y);Y=E}if(g.hasOwnProperty(y="ROUNDING_MODE")){E=g[y];v(E,0,8,y);Q=E}if(g.hasOwnProperty(y="EXPONENTIAL_AT")){E=g[y];if(E&&E.pop){v(E[0],-h,0,y);v(E[1],0,h,y);oe=E[0];ee=E[1]}else{v(E,-h,h,y);oe=-(ee=E<0?-E:E)}}if(g.hasOwnProperty(y="RANGE")){E=g[y];if(E&&E.pop){v(E[0],-h,-1,y);v(E[1],1,h,y);re=E[0];le=E[1]}else{v(E,-h,h,y);if(E){re=-(le=E<0?-E:E)}else{throw Error(o+y+" cannot be zero: "+E)}}}if(g.hasOwnProperty(y="CRYPTO")){E=g[y];if(E===!!E){if(E){if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes)){Se=E}else{Se=!E;throw Error(o+"crypto unavailable")}}else{Se=E}}else{throw Error(o+y+" not true or false: "+E)}}if(g.hasOwnProperty(y="MODULO_MODE")){E=g[y];v(E,0,9,y);Ie=E}if(g.hasOwnProperty(y="POW_PRECISION")){E=g[y];v(E,0,h,y);ce=E}if(g.hasOwnProperty(y="FORMAT")){E=g[y];if(typeof E=="object")At=E;else throw Error(o+y+" not an object: "+E)}if(g.hasOwnProperty(y="ALPHABET")){E=g[y];if(typeof E=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(E)){Er=E.slice(0,10)=="0123456789";Ct=E}else{throw Error(o+y+" invalid: "+E)}}}else{throw Error(o+"Object expected: "+g)}}return{DECIMAL_PLACES:Y,ROUNDING_MODE:Q,EXPONENTIAL_AT:[oe,ee],RANGE:[re,le],CRYPTO:Se,MODULO_MODE:Ie,POW_PRECISION:ce,FORMAT:At,ALPHABET:Ct}};b.isBigNumber=function(g){if(!g||g._isBigNumber!==true)return false;if(!b.DEBUG)return true;var y,E,N=g.c,S=g.e,w=g.s;e:if({}.toString.call(N)=="[object Array]"){if((w===1||w===-1)&&S>=-h&&S<=h&&S===r(S)){if(N[0]===0){if(S===0&&N.length===1)return true;break e}y=(S+1)%c;if(y<1)y+=c;if(String(N[0]).length==y){for(y=0;y<N.length;y++){E=N[y];if(E<0||E>=u||E!==r(E))break e}if(E!==0)return true}}}else if(N===null&&S===null&&(w===null||w===1||w===-1)){return true}throw Error(o+"Invalid BigNumber: "+g)};b.maximum=b.max=function(){return Ba(arguments,-1)};b.minimum=b.min=function(){return Ba(arguments,1)};b.random=(function(){var g=9007199254740992;var y=Math.random()*g&2097151?function(){return r(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(E){var N,S,w,x,C,I=0,M=[],P=new b($);if(E==null)E=Y;else v(E,0,h);x=i(E/c);if(Se){if(crypto.getRandomValues){N=crypto.getRandomValues(new Uint32Array(x*=2));for(;I<x;){C=N[I]*131072+(N[I+1]>>>11);if(C>=9e15){S=crypto.getRandomValues(new Uint32Array(2));N[I]=S[0];N[I+1]=S[1]}else{M.push(C%1e14);I+=2}}I=x/2}else if(crypto.randomBytes){N=crypto.randomBytes(x*=7);for(;I<x;){C=(N[I]&31)*281474976710656+N[I+1]*1099511627776+N[I+2]*4294967296+N[I+3]*16777216+(N[I+4]<<16)+(N[I+5]<<8)+N[I+6];if(C>=9e15){crypto.randomBytes(7).copy(N,I)}else{M.push(C%1e14);I+=7}}I=x/7}else{Se=false;throw Error(o+"crypto unavailable")}}if(!Se){for(;I<x;){C=y();if(C<9e15)M[I++]=C%1e14}}x=M[--I];E%=c;if(x&&E){C=f[c-E];M[I]=r(x/C)*C}for(;M[I]===0;M.pop(),I--);if(I<0){M=[w=0]}else{for(w=-1;M[0]===0;M.splice(0,1),w-=c);for(I=1,C=M[0];C>=10;C/=10,I++);if(I<c)w-=c-I}P.e=w;P.c=M;return P}})();b.sum=function(){var g=1,y=arguments,E=new b(y[0]);for(;g<y.length;)E=E.plus(y[g++]);return E};q=(function(){var g="0123456789";function y(E,N,S,w){var x,C=[0],I,M=0,P=E.length;for(;M<P;){for(I=C.length;I--;C[I]*=N);C[0]+=w.indexOf(E.charAt(M++));for(x=0;x<C.length;x++){if(C[x]>S-1){if(C[x+1]==null)C[x+1]=0;C[x+1]+=C[x]/S|0;C[x]%=S}}}return C.reverse()}return function(E,N,S,w,x){var C,I,M,P,U,J,K,te,se=E.indexOf("."),pe=Y,Z=Q;if(se>=0){P=ce;ce=0;E=E.replace(".","");te=new b(N);J=te.pow(E.length-se);ce=P;te.c=y(O(A(J.c),J.e,"0"),10,S,g);te.e=te.c.length}K=y(E,N,S,x?(C=Ct,g):(C=g,Ct));M=P=K.length;for(;K[--P]==0;K.pop());if(!K[0])return C.charAt(0);if(se<0){--M}else{J.c=K;J.e=M;J.s=w;J=R(J,te,pe,Z,S);K=J.c;U=J.r;M=J.e}I=M+pe+1;se=K[I];P=S/2;U=U||I<0||K[I+1]!=null;U=Z<4?(se!=null||U)&&(Z==0||Z==(J.s<0?3:2)):se>P||se==P&&(Z==4||U||Z==6&&K[I-1]&1||Z==(J.s<0?8:7));if(I<1||!K[0]){E=U?O(C.charAt(1),-pe,C.charAt(0)):C.charAt(0)}else{K.length=I;if(U){for(--S;++K[--I]>S;){K[I]=0;if(!I){++M;K=[1].concat(K)}}}for(P=K.length;!K[--P];);for(se=0,E="";se<=P;E+=C.charAt(K[se++]));E=O(E,M,C.charAt(0))}return E}})();R=(function(){function g(N,S,w){var x,C,I,M,P=0,U=N.length,J=S%p,K=S/p|0;for(N=N.slice();U--;){I=N[U]%p;M=N[U]/p|0;x=K*I+M*J;C=J*I+x%p*p+P;P=(C/w|0)+(x/p|0)+K*M;N[U]=C%w}if(P)N=[P].concat(N);return N}function y(N,S,w,x){var C,I;if(w!=x){I=w>x?1:-1}else{for(C=I=0;C<w;C++){if(N[C]!=S[C]){I=N[C]>S[C]?1:-1;break}}}return I}function E(N,S,w,x){var C=0;for(;w--;){N[w]-=C;C=N[w]<S[w]?1:0;N[w]=C*x+N[w]-S[w]}for(;!N[0]&&N.length>1;N.splice(0,1));}return function(N,S,w,x,C){var I,M,P,U,J,K,te,se,pe,Z,ne,me,Mn,Ar,Cr,ze,sn,ke=N.s==S.s?1:-1,Ee=N.c,ae=S.c;if(!Ee||!Ee[0]||!ae||!ae[0]){return new b(!N.s||!S.s||(Ee?ae&&Ee[0]==ae[0]:!ae)?NaN:Ee&&Ee[0]==0||!ae?ke*0:ke/0)}se=new b(ke);pe=se.c=[];M=N.e-S.e;ke=w+M+1;if(!C){C=u;M=_(N.e/c)-_(S.e/c);ke=ke/c|0}for(P=0;ae[P]==(Ee[P]||0);P++);if(ae[P]>(Ee[P]||0))M--;if(ke<0){pe.push(1);U=true}else{Ar=Ee.length;ze=ae.length;P=0;ke+=2;J=r(C/(ae[0]+1));if(J>1){ae=g(ae,J,C);Ee=g(Ee,J,C);ze=ae.length;Ar=Ee.length}Mn=ze;Z=Ee.slice(0,ze);ne=Z.length;for(;ne<ze;Z[ne++]=0);sn=ae.slice();sn=[0].concat(sn);Cr=ae[0];if(ae[1]>=C/2)Cr++;do{J=0;I=y(ae,Z,ze,ne);if(I<0){me=Z[0];if(ze!=ne)me=me*C+(Z[1]||0);J=r(me/Cr);if(J>1){if(J>=C)J=C-1;K=g(ae,J,C);te=K.length;ne=Z.length;while(y(K,Z,te,ne)==1){J--;E(K,ze<te?sn:ae,te,C);te=K.length;I=1}}else{if(J==0){I=J=1}K=ae.slice();te=K.length}if(te<ne)K=[0].concat(K);E(Z,K,ne,C);ne=Z.length;if(I==-1){while(y(ae,Z,ze,ne)<1){J++;E(Z,ze<ne?sn:ae,ne,C);ne=Z.length}}}else if(I===0){J++;Z=[0]}pe[P++]=J;if(Z[0]){Z[ne++]=Ee[Mn]||0}else{Z=[Ee[Mn]];ne=1}}while((Mn++<Ar||Z[0]!=null)&&ke--);U=Z[0]!=null;if(!pe[0])pe.splice(0,1)}if(C==u){for(P=1,ke=pe[0];ke>=10;ke/=10,P++);Me(se,w+(se.e=P+M*c-1)+1,x,U)}else{se.e=M;se.r=+U}return se}})();function _r(g,y,E,N){var S,w,x,C,I;if(E==null)E=Q;else v(E,0,8);if(!g.c)return g.toString();S=g.c[0];x=g.e;if(y==null){I=A(g.c);I=N==1||N==2&&(x<=oe||x>=ee)?D(I,x):O(I,x,"0")}else{g=Me(new b(g),y,E);w=g.e;I=A(g.c);C=I.length;if(N==1||N==2&&(y<=w||w<=oe)){for(;C<y;I+="0",C++);I=D(I,w)}else{y-=x+(N===2&&w>x);I=O(I,w,"0");if(w+1>C){if(--y>0)for(I+=".";y--;I+="0");}else{y+=w-C;if(y>0){if(w+1==C)I+=".";for(;y--;I+="0");}}}}return g.s<0&&S?"-"+I:I}function Ba(g,y){var E,N,S=1,w=new b(g[0]);for(;S<g.length;S++){N=new b(g[S]);if(!N.s||(E=T(w,N))===y||E===0&&w.s===y){w=N}}return w}function Tr(g,y,E){var N=1,S=y.length;for(;!y[--S];y.pop());for(S=y[0];S>=10;S/=10,N++);if((E=N+E*c-1)>le){g.c=g.e=null}else if(E<re){g.c=[g.e=0]}else{g.e=E;g.c=y}return g}V=(function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,E=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,S=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(w,x,C,I){var M,P=C?x:x.replace(S,"");if(N.test(P)){w.s=isNaN(P)?null:P<0?-1:1}else{if(!C){P=P.replace(g,function(U,J,K){M=(K=K.toLowerCase())=="x"?16:K=="b"?2:8;return!I||I==M?J:U});if(I){M=I;P=P.replace(y,"$1").replace(E,"0.$1")}if(x!=P)return new b(P,M)}if(b.DEBUG){throw Error(o+"Not a"+(I?" base "+I:"")+" number: "+x)}w.s=null}w.c=w.e=null}})();function Me(g,y,E,N){var S,w,x,C,I,M,P,U=g.c,J=f;if(U){e:{for(S=1,C=U[0];C>=10;C/=10,S++);w=y-S;if(w<0){w+=c;x=y;I=U[M=0];P=r(I/J[S-x-1]%10)}else{M=i((w+1)/c);if(M>=U.length){if(N){for(;U.length<=M;U.push(0));I=P=0;S=1;w%=c;x=w-c+1}else{break e}}else{I=C=U[M];for(S=1;C>=10;C/=10,S++);w%=c;x=w-c+S;P=x<0?0:r(I/J[S-x-1]%10)}}N=N||y<0||U[M+1]!=null||(x<0?I:I%J[S-x-1]);N=E<4?(P||N)&&(E==0||E==(g.s<0?3:2)):P>5||P==5&&(E==4||N||E==6&&(w>0?x>0?I/J[S-x]:0:U[M-1])%10&1||E==(g.s<0?8:7));if(y<1||!U[0]){U.length=0;if(N){y-=g.e+1;U[0]=J[(c-y%c)%c];g.e=-y||0}else{U[0]=g.e=0}return g}if(w==0){U.length=M;C=1;M--}else{U.length=M+1;C=J[c-w];U[M]=x>0?r(I/J[S-x]%J[x])*C:0}if(N){for(;;){if(M==0){for(w=1,x=U[0];x>=10;x/=10,w++);x=U[0]+=C;for(C=1;x>=10;x/=10,C++);if(w!=C){g.e++;if(U[0]==u)U[0]=1}break}else{U[M]+=C;if(U[M]!=u)break;U[M--]=0;C=1}}}for(w=U.length;U[--w]===0;U.pop());}if(g.e>le){g.c=g.e=null}else if(g.e<re){g.c=[g.e=0]}}return g}function nt(g){var y,E=g.e;if(E===null)return g.toString();y=A(g.c);y=E<=oe||E>=ee?D(y,E):O(y,E,"0");return g.s<0?"-"+y:y}k.absoluteValue=k.abs=function(){var g=new b(this);if(g.s<0)g.s=1;return g};k.comparedTo=function(g,y){return T(this,new b(g,y))};k.decimalPlaces=k.dp=function(g,y){var E,N,S,w=this;if(g!=null){v(g,0,h);if(y==null)y=Q;else v(y,0,8);return Me(new b(w),g+w.e+1,y)}if(!(E=w.c))return null;N=((S=E.length-1)-_(this.e/c))*c;if(S=E[S])for(;S%10==0;S/=10,N--);if(N<0)N=0;return N};k.dividedBy=k.div=function(g,y){return R(this,new b(g,y),Y,Q)};k.dividedToIntegerBy=k.idiv=function(g,y){return R(this,new b(g,y),0,1)};k.exponentiatedBy=k.pow=function(g,y){var E,N,S,w,x,C,I,M,P,U=this;g=new b(g);if(g.c&&!g.isInteger()){throw Error(o+"Exponent not an integer: "+nt(g))}if(y!=null)y=new b(y);C=g.e>14;if(!U.c||!U.c[0]||U.c[0]==1&&!U.e&&U.c.length==1||!g.c||!g.c[0]){P=new b(Math.pow(+nt(U),C?g.s*(2-G(g)):+nt(g)));return y?P.mod(y):P}I=g.s<0;if(y){if(y.c?!y.c[0]:!y.s)return new b(NaN);N=!I&&U.isInteger()&&y.isInteger();if(N)U=U.mod(y)}else if(g.e>9&&(U.e>0||U.e<-1||(U.e==0?U.c[0]>1||C&&U.c[1]>=24e7:U.c[0]<8e13||C&&U.c[0]<=9999975e7))){w=U.s<0&&G(g)?-0:0;if(U.e>-1)w=1/w;return new b(I?1/w:w)}else if(ce){w=i(ce/c+2)}if(C){E=new b(.5);if(I)g.s=1;M=G(g)}else{S=Math.abs(+nt(g));M=S%2}P=new b($);for(;;){if(M){P=P.times(U);if(!P.c)break;if(w){if(P.c.length>w)P.c.length=w}else if(N){P=P.mod(y)}}if(S){S=r(S/2);if(S===0)break;M=S%2}else{g=g.times(E);Me(g,g.e+1,1);if(g.e>14){M=G(g)}else{S=+nt(g);if(S===0)break;M=S%2}}U=U.times(U);if(w){if(U.c&&U.c.length>w)U.c.length=w}else if(N){U=U.mod(y)}}if(N)return P;if(I)P=$.div(P);return y?P.mod(y):w?Me(P,ce,Q,x):P};k.integerValue=function(g){var y=new b(this);if(g==null)g=Q;else v(g,0,8);return Me(y,y.e+1,g)};k.isEqualTo=k.eq=function(g,y){return T(this,new b(g,y))===0};k.isFinite=function(){return!!this.c};k.isGreaterThan=k.gt=function(g,y){return T(this,new b(g,y))>0};k.isGreaterThanOrEqualTo=k.gte=function(g,y){return(y=T(this,new b(g,y)))===1||y===0};k.isInteger=function(){return!!this.c&&_(this.e/c)>this.c.length-2};k.isLessThan=k.lt=function(g,y){return T(this,new b(g,y))<0};k.isLessThanOrEqualTo=k.lte=function(g,y){return(y=T(this,new b(g,y)))===-1||y===0};k.isNaN=function(){return!this.s};k.isNegative=function(){return this.s<0};k.isPositive=function(){return this.s>0};k.isZero=function(){return!!this.c&&this.c[0]==0};k.minus=function(g,y){var E,N,S,w,x=this,C=x.s;g=new b(g,y);y=g.s;if(!C||!y)return new b(NaN);if(C!=y){g.s=-y;return x.plus(g)}var I=x.e/c,M=g.e/c,P=x.c,U=g.c;if(!I||!M){if(!P||!U)return P?(g.s=-y,g):new b(U?x:NaN);if(!P[0]||!U[0]){return U[0]?(g.s=-y,g):new b(P[0]?x:Q==3?-0:0)}}I=_(I);M=_(M);P=P.slice();if(C=I-M){if(w=C<0){C=-C;S=P}else{M=I;S=U}S.reverse();for(y=C;y--;S.push(0));S.reverse()}else{N=(w=(C=P.length)<(y=U.length))?C:y;for(C=y=0;y<N;y++){if(P[y]!=U[y]){w=P[y]<U[y];break}}}if(w){S=P;P=U;U=S;g.s=-g.s}y=(N=U.length)-(E=P.length);if(y>0)for(;y--;P[E++]=0);y=u-1;for(;N>C;){if(P[--N]<U[N]){for(E=N;E&&!P[--E];P[E]=y);--P[E];P[N]+=u}P[N]-=U[N]}for(;P[0]==0;P.splice(0,1),--M);if(!P[0]){g.s=Q==3?-1:1;g.c=[g.e=0];return g}return Tr(g,P,M)};k.modulo=k.mod=function(g,y){var E,N,S=this;g=new b(g,y);if(!S.c||!g.s||g.c&&!g.c[0]){return new b(NaN)}else if(!g.c||S.c&&!S.c[0]){return new b(S)}if(Ie==9){N=g.s;g.s=1;E=R(S,g,0,3);g.s=N;E.s*=N}else{E=R(S,g,0,Ie)}g=S.minus(E.times(g));if(!g.c[0]&&Ie==1)g.s=S.s;return g};k.multipliedBy=k.times=function(g,y){var E,N,S,w,x,C,I,M,P,U,J,K,te,se,pe,Z=this,ne=Z.c,me=(g=new b(g,y)).c;if(!ne||!me||!ne[0]||!me[0]){if(!Z.s||!g.s||ne&&!ne[0]&&!me||me&&!me[0]&&!ne){g.c=g.e=g.s=null}else{g.s*=Z.s;if(!ne||!me){g.c=g.e=null}else{g.c=[0];g.e=0}}return g}N=_(Z.e/c)+_(g.e/c);g.s*=Z.s;I=ne.length;U=me.length;if(I<U){te=ne;ne=me;me=te;S=I;I=U;U=S}for(S=I+U,te=[];S--;te.push(0));se=u;pe=p;for(S=U;--S>=0;){E=0;J=me[S]%pe;K=me[S]/pe|0;for(x=I,w=S+x;w>S;){M=ne[--x]%pe;P=ne[x]/pe|0;C=K*M+P*J;M=J*M+C%pe*pe+te[w]+E;E=(M/se|0)+(C/pe|0)+K*P;te[w--]=M%se}te[w]=E}if(E){++N}else{te.splice(0,1)}return Tr(g,te,N)};k.negated=function(){var g=new b(this);g.s=-g.s||null;return g};k.plus=function(g,y){var E,N=this,S=N.s;g=new b(g,y);y=g.s;if(!S||!y)return new b(NaN);if(S!=y){g.s=-y;return N.minus(g)}var w=N.e/c,x=g.e/c,C=N.c,I=g.c;if(!w||!x){if(!C||!I)return new b(S/0);if(!C[0]||!I[0])return I[0]?g:new b(C[0]?N:S*0)}w=_(w);x=_(x);C=C.slice();if(S=w-x){if(S>0){x=w;E=I}else{S=-S;E=C}E.reverse();for(;S--;E.push(0));E.reverse()}S=C.length;y=I.length;if(S-y<0){E=I;I=C;C=E;y=S}for(S=0;y;){S=(C[--y]=C[y]+I[y]+S)/u|0;C[y]=u===C[y]?0:C[y]%u}if(S){C=[S].concat(C);++x}return Tr(g,C,x)};k.precision=k.sd=function(g,y){var E,N,S,w=this;if(g!=null&&g!==!!g){v(g,1,h);if(y==null)y=Q;else v(y,0,8);return Me(new b(w),g,y)}if(!(E=w.c))return null;S=E.length-1;N=S*c+1;if(S=E[S]){for(;S%10==0;S/=10,N--);for(S=E[0];S>=10;S/=10,N++);}if(g&&w.e+1>N)N=w.e+1;return N};k.shiftedBy=function(g){v(g,-d,d);return this.times("1e"+g)};k.squareRoot=k.sqrt=function(){var g,y,E,N,S,w=this,x=w.c,C=w.s,I=w.e,M=Y+4,P=new b("0.5");if(C!==1||!x||!x[0]){return new b(!C||C<0&&(!x||x[0])?NaN:x?w:1/0)}C=Math.sqrt(+nt(w));if(C==0||C==1/0){y=A(x);if((y.length+I)%2==0)y+="0";C=Math.sqrt(+y);I=_((I+1)/2)-(I<0||I%2);if(C==1/0){y="5e"+I}else{y=C.toExponential();y=y.slice(0,y.indexOf("e")+1)+I}E=new b(y)}else{E=new b(C+"")}if(E.c[0]){I=E.e;C=I+M;if(C<3)C=0;for(;;){S=E;E=P.times(S.plus(R(w,S,M,1)));if(A(S.c).slice(0,C)===(y=A(E.c)).slice(0,C)){if(E.e<I)--C;y=y.slice(C-3,C+1);if(y=="9999"||!N&&y=="4999"){if(!N){Me(S,S.e+Y+2,0);if(S.times(S).eq(w)){E=S;break}}M+=4;C+=4;N=1}else{if(!+y||!+y.slice(1)&&y.charAt(0)=="5"){Me(E,E.e+Y+2,1);g=!E.times(E).eq(w)}break}}}}return Me(E,E.e+Y+1,Q,g)};k.toExponential=function(g,y){if(g!=null){v(g,0,h);g++}return _r(this,g,y,1)};k.toFixed=function(g,y){if(g!=null){v(g,0,h);g=g+this.e+1}return _r(this,g,y)};k.toFormat=function(g,y,E){var N,S=this;if(E==null){if(g!=null&&y&&typeof y=="object"){E=y;y=null}else if(g&&typeof g=="object"){E=g;g=y=null}else{E=At}}else if(typeof E!="object"){throw Error(o+"Argument not an object: "+E)}N=S.toFixed(g,y);if(S.c){var w,x=N.split("."),C=+E.groupSize,I=+E.secondaryGroupSize,M=E.groupSeparator||"",P=x[0],U=x[1],J=S.s<0,K=J?P.slice(1):P,te=K.length;if(I){w=C;C=I;I=w;te-=w}if(C>0&&te>0){w=te%C||C;P=K.substr(0,w);for(;w<te;w+=C)P+=M+K.substr(w,C);if(I>0)P+=M+K.slice(w);if(J)P="-"+P}N=U?P+(E.decimalSeparator||"")+((I=+E.fractionGroupSize)?U.replace(new RegExp("\\d{"+I+"}\\B","g"),"$&"+(E.fractionGroupSeparator||"")):U):P}return(E.prefix||"")+N+(E.suffix||"")};k.toFraction=function(g){var y,E,N,S,w,x,C,I,M,P,U,J,K=this,te=K.c;if(g!=null){C=new b(g);if(!C.isInteger()&&(C.c||C.s!==1)||C.lt($)){throw Error(o+"Argument "+(C.isInteger()?"out of range: ":"not an integer: ")+nt(C))}}if(!te)return new b(K);y=new b($);M=E=new b($);N=I=new b($);J=A(te);w=y.e=J.length-K.e-1;y.c[0]=f[(x=w%c)<0?c+x:x];g=!g||C.comparedTo(y)>0?w>0?y:M:C;x=le;le=1/0;C=new b(J);I.c[0]=0;for(;;){P=R(C,y,0,1);S=E.plus(P.times(N));if(S.comparedTo(g)==1)break;E=N;N=S;M=I.plus(P.times(S=M));I=S;y=C.minus(P.times(S=y));C=S}S=R(g.minus(E),N,0,1);I=I.plus(S.times(M));E=E.plus(S.times(N));I.s=M.s=K.s;w=w*2;U=R(M,N,w,Q).minus(K).abs().comparedTo(R(I,E,w,Q).minus(K).abs())<1?[M,N]:[I,E];le=x;return U};k.toNumber=function(){return+nt(this)};k.toPrecision=function(g,y){if(g!=null)v(g,1,h);return _r(this,g,y,2)};k.toString=function(g){var y,E=this,N=E.s,S=E.e;if(S===null){if(N){y="Infinity";if(N<0)y="-"+y}else{y="NaN"}}else{if(g==null){y=S<=oe||S>=ee?D(A(E.c),S):O(A(E.c),S,"0")}else if(g===10&&Er){E=Me(new b(E),Y+S+1,Q);y=O(A(E.c),E.e,"0")}else{v(g,2,Ct.length,"Base");y=q(O(A(E.c),S,"0"),10,g,N,true)}if(N<0&&E.c[0])y="-"+y}return y};k.valueOf=k.toJSON=function(){return nt(this)};k._isBigNumber=true;if(L!=null)b.set(L);return b}function _(L){var R=L|0;return L>0||L===R?R:R-1}function A(L){var R,q,V=1,k=L.length,$=L[0]+"";for(;V<k;){R=L[V++]+"";q=c-R.length;for(;q--;R="0"+R);$+=R}for(k=$.length;$.charCodeAt(--k)===48;);return $.slice(0,k+1||1)}function T(L,R){var q,V,k=L.c,$=R.c,Y=L.s,Q=R.s,oe=L.e,ee=R.e;if(!Y||!Q)return null;q=k&&!k[0];V=$&&!$[0];if(q||V)return q?V?0:-Q:Y;if(Y!=Q)return Y;q=Y<0;V=oe==ee;if(!k||!$)return V?0:!k^q?1:-1;if(!V)return oe>ee^q?1:-1;Q=(oe=k.length)<(ee=$.length)?oe:ee;for(Y=0;Y<Q;Y++)if(k[Y]!=$[Y])return k[Y]>$[Y]^q?1:-1;return oe==ee?0:oe>ee^q?1:-1}function v(L,R,q,V){if(L<R||L>q||L!==r(L)){throw Error(o+(V||"Argument")+(typeof L=="number"?L<R||L>q?" out of range: ":" not an integer: ":" not a primitive number: ")+String(L))}}function G(L){var R=L.c.length-1;return _(L.e/c)==R&&L.c[R]%2!=0}function D(L,R){return(L.length>1?L.charAt(0)+"."+L.slice(1):L)+(R<0?"e":"e+")+R}function O(L,R,q){var V,k;if(R<0){for(k=q+".";++R;k+=q);L=k+L}else{V=L.length;if(++R>V){for(k=q,R-=V;--R;k+=q);L+=k}else if(R<V){L=L.slice(0,R)+"."+L.slice(R)}}return L}e=m();e["default"]=e.BigNumber=e;if(typeof define=="function"&&define.amd){define(function(){return e})}else if(typeof Gn!="undefined"&&Gn.exports){Gn.exports=e}else{if(!t){t=typeof self!="undefined"&&self?self:window}t.BigNumber=e}})(Tl)});var Sl=F((GS,vl)=>{var Al=Mr();var Cl=vl.exports;(function(){"use strict";function t(d){return d<10?"0"+d:d}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i,r,o={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},l;function u(d){n.lastIndex=0;return n.test(d)?'"'+d.replace(n,function(f){var p=o[f];return typeof p==="string"?p:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+d+'"'}function c(d,f){var p,h,m,_,A=i,T,v=f[d],G=v!=null&&(v instanceof Al||Al.isBigNumber(v));if(v&&typeof v==="object"&&typeof v.toJSON==="function"){v=v.toJSON(d)}if(typeof l==="function"){v=l.call(f,d,v)}switch(typeof v){case"string":if(G){return v}else{return u(v)}case"number":return isFinite(v)?String(v):"null";case"boolean":case"null":case"bigint":return String(v);case"object":if(!v){return"null"}i+=r;T=[];if(Object.prototype.toString.apply(v)==="[object Array]"){_=v.length;for(p=0;p<_;p+=1){T[p]=c(p,v)||"null"}m=T.length===0?"[]":i?"[\n"+i+T.join(",\n"+i)+"\n"+A+"]":"["+T.join(",")+"]";i=A;return m}if(l&&typeof l==="object"){_=l.length;for(p=0;p<_;p+=1){if(typeof l[p]==="string"){h=l[p];m=c(h,v);if(m){T.push(u(h)+(i?": ":":")+m)}}}}else{Object.keys(v).forEach(function(D){var O=c(D,v);if(O){T.push(u(D)+(i?": ":":")+O)}})}m=T.length===0?"{}":i?"{\n"+i+T.join(",\n"+i)+"\n"+A+"}":"{"+T.join(",")+"}";i=A;return m}}if(typeof Cl.stringify!=="function"){Cl.stringify=function(d,f,p){var h;i="";r="";if(typeof p==="number"){for(h=0;h<p;h+=1){r+=" "}}else if(typeof p==="string"){r=p}l=f;if(f&&typeof f!=="function"&&(typeof f!=="object"||typeof f.length!=="number")){throw new Error("JSON.stringify")}return c("",{"":d})}}})()});var wl=F((OS,Il)=>{var On=null;var Cp=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;var vp=/(?: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 Sp=function(t){"use strict";var e={strict:false,storeAsString:false,alwaysParseAsBig:false,useNativeBigInt:false,protoAction:"error",constructorAction:"error"};if(t!==void 0&&t!==null){if(t.strict===true){e.strict=true}if(t.storeAsString===true){e.storeAsString=true}e.alwaysParseAsBig=t.alwaysParseAsBig===true?t.alwaysParseAsBig:false;e.useNativeBigInt=t.useNativeBigInt===true?t.useNativeBigInt:false;if(typeof t.constructorAction!=="undefined"){if(t.constructorAction==="error"||t.constructorAction==="ignore"||t.constructorAction==="preserve"){e.constructorAction=t.constructorAction}else{throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${t.constructorAction}`)}}if(typeof t.protoAction!=="undefined"){if(t.protoAction==="error"||t.protoAction==="ignore"||t.protoAction==="preserve"){e.protoAction=t.protoAction}else{throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${t.protoAction}`)}}}var n,i,r={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},o,l=function(A){throw{name:"SyntaxError",message:A,at:n,text:o}},u=function(A){if(A&&A!==i){l("Expected '"+A+"' instead of '"+i+"'")}i=o.charAt(n);n+=1;return i},c=function(){var A,T="";if(i==="-"){T="-";u("-")}while(i>="0"&&i<="9"){T+=i;u()}if(i==="."){T+=".";while(u()&&i>="0"&&i<="9"){T+=i}}if(i==="e"||i==="E"){T+=i;u();if(i==="-"||i==="+"){T+=i;u()}while(i>="0"&&i<="9"){T+=i;u()}}A=+T;if(!isFinite(A)){l("Bad number")}else{if(On==null)On=Mr();if(T.length>15)return e.storeAsString?T:e.useNativeBigInt?BigInt(T):new On(T);else return!e.alwaysParseAsBig?A:e.useNativeBigInt?BigInt(A):new On(A)}},d=function(){var A,T,v="",G;if(i==='"'){var D=n;while(u()){if(i==='"'){if(n-1>D)v+=o.substring(D,n-1);u();return v}if(i==="\\"){if(n-1>D)v+=o.substring(D,n-1);u();if(i==="u"){G=0;for(T=0;T<4;T+=1){A=parseInt(u(),16);if(!isFinite(A)){break}G=G*16+A}v+=String.fromCharCode(G)}else if(typeof r[i]==="string"){v+=r[i]}else{break}D=n}}}l("Bad string")},f=function(){while(i&&i<=" "){u()}},p=function(){switch(i){case"t":u("t");u("r");u("u");u("e");return true;case"f":u("f");u("a");u("l");u("s");u("e");return false;case"n":u("n");u("u");u("l");u("l");return null}l("Unexpected '"+i+"'")},h,m=function(){var A=[];if(i==="["){u("[");f();if(i==="]"){u("]");return A}while(i){A.push(h());f();if(i==="]"){u("]");return A}u(",");f()}}l("Bad array")},_=function(){var A,T=Object.create(null);if(i==="{"){u("{");f();if(i==="}"){u("}");return T}while(i){A=d();f();u(":");if(e.strict===true&&Object.hasOwnProperty.call(T,A)){l('Duplicate key "'+A+'"')}if(Cp.test(A)===true){if(e.protoAction==="error"){l("Object contains forbidden prototype property")}else if(e.protoAction==="ignore"){h()}else{T[A]=h()}}else if(vp.test(A)===true){if(e.constructorAction==="error"){l("Object contains forbidden constructor property")}else if(e.constructorAction==="ignore"){h()}else{T[A]=h()}}else{T[A]=h()}f();if(i==="}"){u("}");return T}u(",");f()}}l("Bad object")};h=function(){f();switch(i){case"{":return _();case"[":return m();case'"':return d();case"-":return c();default:return i>="0"&&i<="9"?c():p()}};return function(A,T){var v;o=A+"";n=0;i=" ";v=h();f();if(i){l("Syntax error")}return typeof T==="function"?(function G(D,O){var L,R,q=D[O];if(q&&typeof q==="object"){Object.keys(q).forEach(function(V){R=G(q,V);if(R!==void 0){q[V]=R}else{delete q[V]}})}return T.call(D,O,q)})({"":v},""):v}};Il.exports=Sp});var Nl=F((bS,bn)=>{var Rl=Sl().stringify;var Pl=wl();bn.exports=function(t){return{parse:Pl(t),stringify:Rl}};bn.exports.parse=Pl();bn.exports.stringify=Rl});var kr=F(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:true});be.GCE_LINUX_BIOS_PATHS=void 0;be.isGoogleCloudServerless=xl;be.isGoogleComputeEngineLinux=Dl;be.isGoogleComputeEngineMACAddress=Ul;be.isGoogleComputeEngine=Ll;be.detectGCPResidency=wp;var Ml=z("fs");var kl=z("os");be.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var Ip=/^42:01/;function xl(){const t=process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE;return!!t}function Dl(){if((0,kl.platform)()!=="linux")return false;try{(0,Ml.statSync)(be.GCE_LINUX_BIOS_PATHS.BIOS_DATE);const t=(0,Ml.readFileSync)(be.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(t)}catch{return false}}function Ul(){const t=(0,kl.networkInterfaces)();for(const e of Object.values(t)){if(!e)continue;for(const{mac:n}of e){if(Ip.test(n)){return true}}}return false}function Ll(){return Dl()||Ul()}function wp(){return xl()||Ll()}});var Gl=F(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:true});Fn.Colours=void 0;var ye=class t{static isEnabled(e){return e&&e.isTTY&&(typeof e.getColorDepth==="function"?e.getColorDepth()>2:true)}static refresh(){t.enabled=t.isEnabled(process===null||process===void 0?void 0:process.stderr);if(!this.enabled){t.reset="";t.bright="";t.dim="";t.red="";t.green="";t.yellow="";t.blue="";t.magenta="";t.cyan="";t.white="";t.grey=""}else{t.reset="\x1B[0m";t.bright="\x1B[1m";t.dim="\x1B[2m";t.red="\x1B[31m";t.green="\x1B[32m";t.yellow="\x1B[33m";t.blue="\x1B[34m";t.magenta="\x1B[35m";t.cyan="\x1B[36m";t.white="\x1B[37m";t.grey="\x1B[90m"}}};Fn.Colours=ye;ye.enabled=false;ye.reset="";ye.bright="";ye.dim="";ye.red="";ye.green="";ye.yellow="";ye.blue="";ye.magenta="";ye.cyan="";ye.white="";ye.grey="";ye.refresh()});var ql=F(ie=>{"use strict";var Rp=ie&&ie.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var Pp=ie&&ie.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}):function(t,e){t["default"]=e});var Ol=ie&&ie.__importStar||(function(){var t=function(e){t=Object.getOwnPropertyNames||function(n){var i=[];for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r))i[i.length]=r;return i};return t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null){for(var i=t(e),r=0;r<i.length;r++)if(i[r]!=="default")Rp(n,e,i[r])}Pp(n,e);return n}})();Object.defineProperty(ie,"__esModule",{value:true});ie.env=ie.DebugLogBackendBase=ie.placeholder=ie.AdhocDebugLogger=ie.LogSeverity=void 0;ie.getNodeBackend=Dr;ie.getDebugBackend=Mp;ie.getStructuredBackend=kp;ie.setBackend=xp;ie.log=Fl;var Np=z("events");var ln=Ol(z("process"));var bl=Ol(z("util"));var we=Gl();var Fe;(function(t){t["DEFAULT"]="DEFAULT";t["DEBUG"]="DEBUG";t["INFO"]="INFO";t["WARNING"]="WARNING";t["ERROR"]="ERROR"})(Fe||(ie.LogSeverity=Fe={}));var un=class extends Np.EventEmitter{constructor(e,n){super();this.namespace=e;this.upstream=n;this.func=Object.assign(this.invoke.bind(this),{instance:this,on:(i,r)=>this.on(i,r)});this.func.debug=(...i)=>this.invokeSeverity(Fe.DEBUG,...i);this.func.info=(...i)=>this.invokeSeverity(Fe.INFO,...i);this.func.warn=(...i)=>this.invokeSeverity(Fe.WARNING,...i);this.func.error=(...i)=>this.invokeSeverity(Fe.ERROR,...i);this.func.sublog=i=>Fl(i,this.func)}invoke(e,...n){if(this.upstream){try{this.upstream(e,...n)}catch(i){}}try{this.emit("log",e,n)}catch(i){}}invokeSeverity(e,...n){this.invoke({severity:e},...n)}};ie.AdhocDebugLogger=un;ie.placeholder=new un("",()=>{}).func;var Ut=class{constructor(){var e;this.cached=new Map;this.filters=[];this.filtersSet=false;let n=(e=ln.env[ie.env.nodeEnables])!==null&&e!==void 0?e:"*";if(n==="all"){n="*"}this.filters=n.split(",")}log(e,n,...i){try{if(!this.filtersSet){this.setFilters();this.filtersSet=true}let r=this.cached.get(e);if(!r){r=this.makeLogger(e);this.cached.set(e,r)}r(n,...i)}catch(r){console.error(r)}}};ie.DebugLogBackendBase=Ut;var xr=class extends Ut{constructor(){super(...arguments);this.enabledRegexp=/.*/g}isEnabled(e){return this.enabledRegexp.test(e)}makeLogger(e){if(!this.enabledRegexp.test(e)){return()=>{}}return(n,...i)=>{var r;const o=`${we.Colours.green}${e}${we.Colours.reset}`;const l=`${we.Colours.yellow}${ln.pid}${we.Colours.reset}`;let u;switch(n.severity){case Fe.ERROR:u=`${we.Colours.red}${n.severity}${we.Colours.reset}`;break;case Fe.INFO:u=`${we.Colours.magenta}${n.severity}${we.Colours.reset}`;break;case Fe.WARNING:u=`${we.Colours.yellow}${n.severity}${we.Colours.reset}`;break;default:u=(r=n.severity)!==null&&r!==void 0?r:Fe.DEFAULT;break}const c=bl.formatWithOptions({colors:we.Colours.enabled},...i);const d=Object.assign({},n);delete d.severity;const f=Object.getOwnPropertyNames(d).length?JSON.stringify(d):"";const p=f?`${we.Colours.grey}${f}${we.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",l,o,u,c,f?` ${p}`:"")}}setFilters(){const e=this.filters.join(",");const n=e.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${n}$`,"i")}};function Dr(){return new xr}var Ur=class extends Ut{constructor(e){super();this.debugPkg=e}makeLogger(e){const n=this.debugPkg(e);return(i,...r)=>{n(r[0],...r.slice(1))}}setFilters(){var e;const n=(e=ln.env["NODE_DEBUG"])!==null&&e!==void 0?e:"";ln.env["NODE_DEBUG"]=`${n}${n?",":""}${this.filters.join(",")}`}};function Mp(t){return new Ur(t)}var Lr=class extends Ut{constructor(e){var n;super();this.upstream=(n=e)!==null&&n!==void 0?n:void 0}makeLogger(e){var n;const i=(n=this.upstream)===null||n===void 0?void 0:n.makeLogger(e);return(r,...o)=>{var l;const u=(l=r.severity)!==null&&l!==void 0?l:Fe.INFO;const c=Object.assign({severity:u,message:bl.format(...o)},r);const d=JSON.stringify(c);if(i){i(r,d)}else{console.log("%s",d)}}}setFilters(){var e;(e=this.upstream)===null||e===void 0?void 0:e.setFilters()}};function kp(t){return new Lr(t)}ie.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var Gr=new Map;var Re=void 0;function xp(t){Re=t;Gr.clear()}function Fl(t,e){if(!Re){const r=ln.env[ie.env.nodeEnables];if(!r){return ie.placeholder}}if(!t){return ie.placeholder}if(e){t=`${e.instance.namespace}:${t}`}const n=Gr.get(t);if(n){return n.func}if(Re===null){return ie.placeholder}else if(Re===void 0){Re=Dr()}const i=(()=>{let r=void 0;const o=new un(t,(l,...u)=>{if(r!==Re){if(Re===null){return}else if(Re===void 0){Re=Dr()}r=Re}Re===null||Re===void 0?void 0:Re.log(t,l,...u)});return o})();Gr.set(t,i);return i.func}});var Or=F(wt=>{"use strict";var Dp=wt&&wt.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var Up=wt&&wt.__exportStar||function(t,e){for(var n in t)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n))Dp(e,t,n)};Object.defineProperty(wt,"__esModule",{value:true});Up(ql(),wt)});var dn=F(W=>{"use strict";var Vl=W&&W.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var Lp=W&&W.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}):function(t,e){t["default"]=e});var Gp=W&&W.__importStar||(function(){var t=function(e){t=Object.getOwnPropertyNames||function(n){var i=[];for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r))i[i.length]=r;return i};return t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null){for(var i=t(e),r=0;r<i.length;r++)if(i[r]!=="default")Vl(n,e,i[r])}Lp(n,e);return n}})();var Op=W&&W.__exportStar||function(t,e){for(var n in t)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n))Vl(e,t,n)};Object.defineProperty(W,"__esModule",{value:true});W.gcpResidencyCache=W.METADATA_SERVER_DETECTION=W.HEADERS=W.HEADER_VALUE=W.HEADER_NAME=W.SECONDARY_HOST_ADDRESS=W.HOST_ADDRESS=W.BASE_PATH=void 0;W.instance=Bp;W.project=$p;W.universe=Jp;W.bulk=Kp;W.isAvailable=Yp;W.resetIsAvailableCache=zp;W.getGCPResidency=qr;W.setGCPResidency=Bl;W.requestTimeout=$l;var br=ge();var bp=Nl();var Fp=kr();var qp=Gp(Or());W.BASE_PATH="/computeMetadata/v1";W.HOST_ADDRESS="http://169.254.169.254";W.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";W.HEADER_NAME="Metadata-Flavor";W.HEADER_VALUE="Google";W.HEADERS=Object.freeze({[W.HEADER_NAME]:W.HEADER_VALUE});var Hl=qp.log("gcp-metadata");W.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 Fr(t){if(!t){t=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||W.HOST_ADDRESS}if(!/^https?:\/\//.test(t)){t=`http://${t}`}return new URL(W.BASE_PATH,t).href}function Hp(t){Object.keys(t).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 cn(t,e={},n=3,i=false){const r=new Headers(W.HEADERS);let o="";let l={};if(typeof t==="object"){const p=t;new Headers(p.headers).forEach((h,m)=>r.set(m,h));o=p.metadataKey;l=p.params||l;n=p.noResponseRetries||n;i=p.fastFail||i}else{o=t}if(typeof e==="string"){o+=`/${e}`}else{Hp(e);if(e.property){o+=`/${e.property}`}new Headers(e.headers).forEach((p,h)=>r.set(h,p));l=e.params||l}const u=i?Vp:br.request;const c={url:`${Fr()}/${o}`,headers:r,retryConfig:{noResponseRetries:n},params:l,responseType:"text",timeout:$l()};Hl.info("instance request %j",c);const d=await u(c);Hl.info("instance metadata is %s",d.data);const f=d.headers.get(W.HEADER_NAME);if(f!==W.HEADER_VALUE){throw new RangeError(`Invalid response from metadata service: incorrect ${W.HEADER_NAME} header. Expected '${W.HEADER_VALUE}', got ${f?`'${f}'`:"no header"}`)}if(typeof d.data==="string"){try{return bp.parse(d.data)}catch{}}return d.data}async function Vp(t){const e={...t,url:t.url?.toString().replace(Fr(),Fr(W.SECONDARY_HOST_ADDRESS))};const n=(0,br.request)(t);const i=(0,br.request)(e);return Promise.any([n,i])}function Bp(t){return cn("instance",t)}function $p(t){return cn("project",t)}function Jp(t){return cn("universe",t)}async function Kp(t){const e={};await Promise.all(t.map(n=>{return(async()=>{const i=await cn(n);const r=n.metadataKey;e[r]=i})()}));return e}function Wp(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}var qn;async function Yp(){if(process.env.METADATA_SERVER_DETECTION){const t=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(t in W.METADATA_SERVER_DETECTION)){throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${t}\`, but it should be \`${Object.keys(W.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`)}switch(t){case"assume-present":return true;case"none":return false;case"bios-only":return qr();case"ping-only":}}try{if(qn===void 0){qn=cn("instance",void 0,Wp(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))}await qn;return true}catch(t){const e=t;if(process.env.DEBUG_AUTH){console.info(e)}if(e.type==="request-timeout"){return false}if(e.response&&e.response.status===404){return false}else{if(!(e.response&&e.response.status===404)&&(!e.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(e.code.toString()))){let n="UNKNOWN";if(e.code)n=e.code.toString();process.emitWarning(`received unexpected error = ${e.message} code = ${n}`,"MetadataLookupWarning")}return false}}}function zp(){qn=void 0}W.gcpResidencyCache=null;function qr(){if(W.gcpResidencyCache===null){Bl()}return W.gcpResidencyCache}function Bl(t=null){W.gcpResidencyCache=t!==null?t:(0,Fp.detectGCPResidency)()}function $l(){return qr()?0:3e3}Op(kr(),W)});var Wl=F(Hn=>{"use strict";Hn.byteLength=Qp;Hn.toByteArray=jp;Hn.fromByteArray=nh;var Xe=[];var Ue=[];var Xp=typeof Uint8Array!=="undefined"?Uint8Array:Array;var Hr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Rt=0,Jl=Hr.length;Rt<Jl;++Rt){Xe[Rt]=Hr[Rt];Ue[Hr.charCodeAt(Rt)]=Rt}var Rt;var Jl;Ue["-".charCodeAt(0)]=62;Ue["_".charCodeAt(0)]=63;function Kl(t){var e=t.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=t.indexOf("=");if(n===-1)n=e;var i=n===e?0:4-n%4;return[n,i]}function Qp(t){var e=Kl(t);var n=e[0];var i=e[1];return(n+i)*3/4-i}function Zp(t,e,n){return(e+n)*3/4-n}function jp(t){var e;var n=Kl(t);var i=n[0];var r=n[1];var o=new Xp(Zp(t,i,r));var l=0;var u=r>0?i-4:i;var c;for(c=0;c<u;c+=4){e=Ue[t.charCodeAt(c)]<<18|Ue[t.charCodeAt(c+1)]<<12|Ue[t.charCodeAt(c+2)]<<6|Ue[t.charCodeAt(c+3)];o[l++]=e>>16&255;o[l++]=e>>8&255;o[l++]=e&255}if(r===2){e=Ue[t.charCodeAt(c)]<<2|Ue[t.charCodeAt(c+1)]>>4;o[l++]=e&255}if(r===1){e=Ue[t.charCodeAt(c)]<<10|Ue[t.charCodeAt(c+1)]<<4|Ue[t.charCodeAt(c+2)]>>2;o[l++]=e>>8&255;o[l++]=e&255}return o}function eh(t){return Xe[t>>18&63]+Xe[t>>12&63]+Xe[t>>6&63]+Xe[t&63]}function th(t,e,n){var i;var r=[];for(var o=e;o<n;o+=3){i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255);r.push(eh(i))}return r.join("")}function nh(t){var e;var n=t.length;var i=n%3;var r=[];var o=16383;for(var l=0,u=n-i;l<u;l+=o){r.push(th(t,l,l+o>u?u:l+o))}if(i===1){e=t[n-1];r.push(Xe[e>>2]+Xe[e<<4&63]+"==")}else if(i===2){e=(t[n-2]<<8)+t[n-1];r.push(Xe[e>>10]+Xe[e>>4&63]+Xe[e<<2&63]+"=")}return r.join("")}});var Br=F(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:true});Vr.fromArrayBufferToHex=ih;function ih(t){const e=Array.from(new Uint8Array(t));return e.map(n=>{return n.toString(16).padStart(2,"0")}).join("")}});var Yl=F(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:true});Vn.BrowserCrypto=void 0;var Lt=Wl();var rh=Br();var $r=class t{constructor(){if(typeof window==="undefined"||window.crypto===void 0||window.crypto.subtle===void 0){throw new Error("SubtleCrypto not found. Make sure it's an https:// website.")}}async sha256DigestBase64(e){const n=new TextEncoder().encode(e);const i=await window.crypto.subtle.digest("SHA-256",n);return Lt.fromByteArray(new Uint8Array(i))}randomBytesBase64(e){const n=new Uint8Array(e);window.crypto.getRandomValues(n);return Lt.fromByteArray(n)}static padBase64(e){while(e.length%4!==0){e+="="}return e}async verify(e,n,i){const r={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};const o=new TextEncoder().encode(n);const l=Lt.toByteArray(t.padBase64(i));const u=await window.crypto.subtle.importKey("jwk",e,r,true,["verify"]);const c=await window.crypto.subtle.verify(r,u,Buffer.from(l),o);return c}async sign(e,n){const i={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};const r=new TextEncoder().encode(n);const o=await window.crypto.subtle.importKey("jwk",e,i,true,["sign"]);const l=await window.crypto.subtle.sign(i,o,r);return Lt.fromByteArray(new Uint8Array(l))}decodeBase64StringUtf8(e){const n=Lt.toByteArray(t.padBase64(e));const i=new TextDecoder().decode(n);return i}encodeBase64StringUtf8(e){const n=new TextEncoder().encode(e);const i=Lt.fromByteArray(n);return i}async sha256DigestHex(e){const n=new TextEncoder().encode(e);const i=await window.crypto.subtle.digest("SHA-256",n);return(0,rh.fromArrayBufferToHex)(i)}async signWithHmacSha256(e,n){const i=typeof e==="string"?e:String.fromCharCode(...new Uint16Array(e));const r=new TextEncoder;const o=await window.crypto.subtle.importKey("raw",r.encode(i),{name:"HMAC",hash:{name:"SHA-256"}},false,["sign"]);return window.crypto.subtle.sign("HMAC",o,r.encode(n))}};Vn.BrowserCrypto=$r});var zl=F(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:true});Bn.NodeCrypto=void 0;var Gt=z("crypto");var Jr=class{async sha256DigestBase64(e){return Gt.createHash("sha256").update(e).digest("base64")}randomBytesBase64(e){return Gt.randomBytes(e).toString("base64")}async verify(e,n,i){const r=Gt.createVerify("RSA-SHA256");r.update(n);r.end();return r.verify(e,i,"base64")}async sign(e,n){const i=Gt.createSign("RSA-SHA256");i.update(n);i.end();return i.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 Gt.createHash("sha256").update(e).digest("hex")}async signWithHmacSha256(e,n){const i=typeof e==="string"?e:sh(e);return oh(Gt.createHmac("sha256",i).update(n).digest())}};Bn.NodeCrypto=Jr;function oh(t){const e=new ArrayBuffer(t.length);const n=new Uint8Array(e);for(let i=0;i<t.length;++i){n[i]=t[i]}return e}function sh(t){return Buffer.from(t)}});var fn=F(it=>{"use strict";var ah=it&&it.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var lh=it&&it.__exportStar||function(t,e){for(var n in t)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n))ah(e,t,n)};Object.defineProperty(it,"__esModule",{value:true});it.createCrypto=dh;it.hasBrowserCrypto=Xl;var uh=Yl();var ch=zl();lh(Br(),it);function dh(){if(Xl()){return new uh.BrowserCrypto}return new ch.NodeCrypto}function Xl(){return typeof window!=="undefined"&&typeof window.crypto!=="undefined"&&typeof window.crypto.subtle!=="undefined"}});var Zl=F((zS,Ql)=>{"use strict";function Kr(t){var e=(t/8|0)+(t%8===0?0:1);return e}var fh={ES256:Kr(256),ES384:Kr(384),ES512:Kr(521)};function ph(t){var e=fh[t];if(e){return e}throw new Error('Unknown algorithm "'+t+'"')}Ql.exports=ph});var Wr=F((XS,ru)=>{"use strict";var $n=an().Buffer;var eu=Zl();var Jn=128;var tu=0;var hh=32;var gh=16;var mh=2;var nu=gh|hh|tu<<6;var Kn=mh|tu<<6;function yh(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function iu(t){if($n.isBuffer(t)){return t}else if("string"===typeof t){return $n.from(t,"base64")}throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function Eh(t,e){t=iu(t);var n=eu(e);var i=n+1;var r=t.length;var o=0;if(t[o++]!==nu){throw new Error('Could not find expected "seq"')}var l=t[o++];if(l===(Jn|1)){l=t[o++]}if(r-o<l){throw new Error('"seq" specified length of "'+l+'", only "'+(r-o)+'" remaining')}if(t[o++]!==Kn){throw new Error('Could not find expected "int" for "r"')}var u=t[o++];if(r-o-2<u){throw new Error('"r" specified length of "'+u+'", only "'+(r-o-2)+'" available')}if(i<u){throw new Error('"r" specified length of "'+u+'", max of "'+i+'" is acceptable')}var c=o;o+=u;if(t[o++]!==Kn){throw new Error('Could not find expected "int" for "s"')}var d=t[o++];if(r-o!==d){throw new Error('"s" specified length of "'+d+'", expected "'+(r-o)+'"')}if(i<d){throw new Error('"s" specified length of "'+d+'", max of "'+i+'" is acceptable')}var f=o;o+=d;if(o!==r){throw new Error('Expected to consume entire buffer, but "'+(r-o)+'" bytes remain')}var p=n-u,h=n-d;var m=$n.allocUnsafe(p+u+h+d);for(o=0;o<p;++o){m[o]=0}t.copy(m,o,c+Math.max(-p,0),c+u);o=n;for(var _=o;o<_+h;++o){m[o]=0}t.copy(m,o,f+Math.max(-h,0),f+d);m=m.toString("base64");m=yh(m);return m}function jl(t,e,n){var i=0;while(e+i<n&&t[e+i]===0){++i}var r=t[e+i]>=Jn;if(r){--i}return i}function _h(t,e){t=iu(t);var n=eu(e);var i=t.length;if(i!==n*2){throw new TypeError('"'+e+'" signatures must be "'+n*2+'" bytes, saw "'+i+'"')}var r=jl(t,0,n);var o=jl(t,n,t.length);var l=n-r;var u=n-o;var c=1+1+l+1+1+u;var d=c<Jn;var f=$n.allocUnsafe((d?2:3)+c);var p=0;f[p++]=nu;if(d){f[p++]=c}else{f[p++]=Jn|1;f[p++]=c&255}f[p++]=Kn;f[p++]=l;if(r<0){f[p++]=0;p+=t.copy(f,p,0,n)}else{p+=t.copy(f,p,r,n)}f[p++]=Kn;f[p++]=u;if(o<0){f[p++]=0;t.copy(f,p,n)}else{t.copy(f,p,n+o)}return f}ru.exports={derToJose:Eh,joseToDer:_h}});var qe=F(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:true});rt.LRUCache=void 0;rt.snakeToCamel=su;rt.originalOrCamelOptions=vh;rt.removeUndefinedValuesInObject=Sh;rt.isValidFile=Ih;rt.getWellKnownCertificateConfigFileLocation=wh;var Th=z("fs");var Ah=z("os");var Yr=z("path");var Ch="certificate_config.json";var ou="gcloud";function su(t){return t.replace(/([_][^_])/g,e=>e.slice(1).toUpperCase())}function vh(t){function e(n){const i=t||{};return i[n]??i[su(n)]}return{get:e}}var zr=class{capacity;#e=new Map;maxAge;constructor(e){this.capacity=e.capacity;this.maxAge=e.maxAge}#t(e,n){this.#e.delete(e);this.#e.set(e,{value:n,lastAccessed:Date.now()})}set(e,n){this.#t(e,n);this.#n()}get(e){const n=this.#e.get(e);if(!n)return;this.#t(e,n.value);this.#n();return n.value}#n(){const e=this.maxAge?Date.now()-this.maxAge:0;let n=this.#e.entries().next();while(!n.done&&(this.#e.size>this.capacity||n.value[1].lastAccessed<e)){this.#e.delete(n.value[0]);n=this.#e.entries().next()}}};rt.LRUCache=zr;function Sh(t){Object.entries(t).forEach(([e,n])=>{if(n===void 0||n==="undefined"){delete t[e]}});return t}async function Ih(t){try{const e=await Th.promises.lstat(t);return e.isFile()}catch(e){return false}}function wh(){const t=process.env.CLOUDSDK_CONFIG||(Rh()?Yr.join(process.env.APPDATA||"",ou):Yr.join(process.env.HOME||"",".config",ou));return Yr.join(t,Ch)}function Rh(){return Ah.platform().startsWith("win")}});var au=F((ZS,Ph)=>{Ph.exports={name:"google-auth-library",version:"10.9.1",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:{type:"git",directory:"core/packages/google-auth-library-nodejs",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.1.4","gcp-metadata":"8.1.2","google-logging-utils":"1.1.3",jws:"^4.0.0"},devDependencies:{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","assert-rejects":"^1.0.0",c8:"^10.1.3",codecov:"^3.8.3",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",keypair:"^1.0.4",mocha:"^11.1.0",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1",puppeteer:"^24.0.0",sinon:"21.0.3","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",clean:"gts clean",prepare:"npm run compile",lint:"gts check --no-inline-config",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0",homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/google-auth-library-nodejs"}});var Xr=F(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.USER_AGENT=ut.PRODUCT_NAME=ut.pkg=void 0;var lu=au();ut.pkg=lu;var uu="google-api-nodejs-client";ut.PRODUCT_NAME=uu;var Nh=`${uu}/${lu.version}`;ut.USER_AGENT=Nh});var Pe=F(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:true});He.AuthClient=He.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=He.DEFAULT_UNIVERSE=void 0;var Mh=z("events");var Qr=ge();var kh=qe();var xh=Or();var Zr=Xr();He.DEFAULT_UNIVERSE="googleapis.com";He.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=5*60*1e3;var jr=class t extends Mh.EventEmitter{apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=He.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=false;universeDomain=He.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(e={}){super();const n=(0,kh.originalOrCamelOptions)(e);this.apiKey=e.apiKey;this.projectId=n.get("project_id")??null;this.quotaProjectId=n.get("quota_project_id");this.credentials=n.get("credentials")??{};this.universeDomain=n.get("universe_domain")??He.DEFAULT_UNIVERSE;this.transporter=e.transporter??new Qr.Gaxios(e.transporterOptions);if(n.get("useAuthRequestParameters")!==false){this.transporter.interceptors.request.add(t.DEFAULT_REQUEST_INTERCEPTOR);this.transporter.interceptors.response.add(t.DEFAULT_RESPONSE_INTERCEPTOR)}if(e.eagerRefreshThresholdMillis){this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=e.forceRefreshOnFailure??false}fetch(...e){const n=e[0];const i=e[1];let r=void 0;const o=new Headers;if(typeof n==="string"){r=new URL(n)}else if(n instanceof URL){r=n}else if(n&&n.url){r=new URL(n.url)}if(n&&typeof n==="object"&&"headers"in n){Qr.Gaxios.mergeHeaders(o,n.headers)}if(i){Qr.Gaxios.mergeHeaders(o,new Headers(i.headers))}if(typeof n==="object"&&!(n instanceof URL)){return this.request({...i,...n,headers:o,url:r})}else{return this.request({...i,headers:o,url:r})}}setCredentials(e){this.credentials=e}addSharedMetadataHeaders(e){if(!e.has("x-goog-user-project")&&this.quotaProjectId){e.set("x-goog-user-project",this.quotaProjectId)}return e}addUserProjectAndAuthHeaders(e,n){const i=n.get("x-goog-user-project");const r=n.get("authorization");if(i){e.set("x-goog-user-project",i)}if(r){e.set("authorization",r)}return e}static log=(0,xh.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:async e=>{if(!e.headers.has("x-goog-api-client")){const i=process.version.replace(/^v/,"");e.headers.set("x-goog-api-client",`gl-node/${i}`)}const n=e.headers.get("User-Agent");if(!n){e.headers.set("User-Agent",Zr.USER_AGENT)}else if(!n.includes(`${Zr.PRODUCT_NAME}/`)){e.headers.set("User-Agent",`${n} ${Zr.USER_AGENT}`)}try{const i=e;const r=i[t.RequestMethodNameSymbol];const o=`${Math.floor(Math.random()*1e3)}`;i[t.RequestLogIdSymbol]=o;const l={url:e.url,headers:e.headers};if(r){t.log.info("%s [%s] request %j",r,o,l)}else{t.log.info("[%s] request %j",o,l)}}catch(i){}return e}};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:async e=>{try{const n=e.config;const i=n[t.RequestMethodNameSymbol];const r=n[t.RequestLogIdSymbol];if(i){t.log.info("%s [%s] response %j",i,r,e.data)}else{t.log.info("[%s] response %j",r,e.data)}}catch(n){}return e},rejected:async e=>{try{const n=e.config;const i=n[t.RequestMethodNameSymbol];const r=n[t.RequestLogIdSymbol];if(i){t.log.info("%s [%s] error %j",i,r,e.response?.data)}else{t.log.error("[%s] error %j",r,e.response?.data)}}catch(n){}throw e}};static setMethodName(e,n){try{const i=e;i[t.RequestMethodNameSymbol]=n}catch(i){}}static get RETRY_CONFIG(){return{retry:true,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};He.AuthClient=jr});var to=F(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:true});Wn.LoginTicket=void 0;var eo=class{envelope;payload;constructor(e,n){this.envelope=e;this.payload=n}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()}}};Wn.LoginTicket=eo});var ct=F(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:true});Qe.OAuth2Client=Qe.ClientAuthentication=Qe.CertificateFormat=Qe.CodeChallengeMethod=void 0;var cu=ge();var Dh=z("querystring");var Uh=z("stream");var Lh=Wr();var du=qe();var no=fn();var Ot=Pe();var Gh=to();var fu;(function(t){t["Plain"]="plain";t["S256"]="S256"})(fu||(Qe.CodeChallengeMethod=fu={}));var ot;(function(t){t["PEM"]="PEM";t["JWK"]="JWK"})(ot||(Qe.CertificateFormat=ot={}));var pn;(function(t){t["ClientSecretPost"]="ClientSecretPost";t["ClientSecretBasic"]="ClientSecretBasic";t["None"]="None"})(pn||(Qe.ClientAuthentication=pn={}));var io=class t extends Ot.AuthClient{redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=ot.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(e={},n,i){super(typeof e==="object"?e:{});if(typeof e!=="object"){e={clientId:e,clientSecret:n,redirectUri:i}}this._clientId=e.clientId||e.client_id;this._clientSecret=e.clientSecret||e.client_secret;this.redirectUri=e.redirectUri||e.redirect_uris?.[0];this.endpoints={tokenInfoUrl:"https://oauth2.googleapis.com/tokeninfo",oauth2AuthBaseUrl:"https://accounts.google.com/o/oauth2/v2/auth",oauth2TokenUrl:"https://oauth2.googleapis.com/token",oauth2RevokeUrl:"https://oauth2.googleapis.com/revoke",oauth2FederatedSignonPemCertsUrl:"https://www.googleapis.com/oauth2/v1/certs",oauth2FederatedSignonJwkCertsUrl:"https://www.googleapis.com/oauth2/v3/certs",oauth2IapPublicKeyUrl:"https://www.gstatic.com/iap/verify/public_key",...e.endpoints};this.clientAuthentication=e.clientAuthentication||pn.ClientSecretPost;this.issuers=e.issuers||["accounts.google.com","https://accounts.google.com",this.universeDomain]}static GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";static CLOCK_SKEW_SECS_=300;static DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400;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 n=this.endpoints.oauth2AuthBaseUrl.toString();return n+"?"+Dh.stringify(e)}generateCodeVerifier(){throw new Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){const e=(0,no.createCrypto)();const n=e.randomBytesBase64(96);const i=n.replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-");const r=await e.sha256DigestBase64(i);const o=r.split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:i,codeChallenge:o}}getToken(e,n){const i=typeof e==="string"?{code:e}:e;if(n){this.getTokenAsync(i).then(r=>n(null,r.tokens,r.res),r=>n(r,null,r.response))}else{return this.getTokenAsync(i)}}async getTokenAsync(e){const n=this.endpoints.oauth2TokenUrl.toString();const i=new Headers;const r={client_id:e.client_id||this._clientId,code_verifier:e.codeVerifier,code:e.code,grant_type:"authorization_code",redirect_uri:e.redirect_uri||this.redirectUri};if(this.clientAuthentication===pn.ClientSecretBasic){const c=Buffer.from(`${this._clientId}:${this._clientSecret}`);i.set("authorization",`Basic ${c.toString("base64")}`)}if(this.clientAuthentication===pn.ClientSecretPost){r.client_secret=this._clientSecret}const o={...t.RETRY_CONFIG,method:"POST",url:n,data:new URLSearchParams((0,du.removeUndefinedValuesInObject)(r)),headers:i};Ot.AuthClient.setMethodName(o,"getTokenAsync");const l=await this.transporter.request(o);const u=l.data;if(l.data&&l.data.expires_in){u.expiry_date=new Date().getTime()+l.data.expires_in*1e3;delete u.expires_in}this.emit("tokens",u);return{tokens:u,res:l}}async refreshToken(e){if(!e){return this.refreshTokenNoCache(e)}if(this.refreshTokenPromises.has(e)){return this.refreshTokenPromises.get(e)}const n=this.refreshTokenNoCache(e).then(i=>{this.refreshTokenPromises.delete(e);return i},i=>{this.refreshTokenPromises.delete(e);throw i});this.refreshTokenPromises.set(e,n);return n}async refreshTokenNoCache(e){if(!e){throw new Error("No refresh token is set.")}const n=this.endpoints.oauth2TokenUrl.toString();const i={refresh_token:e,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"};let r;try{const l={...t.RETRY_CONFIG,method:"POST",url:n,data:new URLSearchParams((0,du.removeUndefinedValuesInObject)(i))};Ot.AuthClient.setMethodName(l,"refreshTokenNoCache");r=await this.transporter.request(l)}catch(l){if(l instanceof cu.GaxiosError&&l.message==="invalid_grant"&&l.response?.data&&/ReAuth/i.test(l.response.data.error_description)){l.message=JSON.stringify(l.response.data)}throw l}const o=r.data;if(r.data&&r.data.expires_in){o.expiry_date=new Date().getTime()+r.data.expires_in*1e3;delete o.expires_in}this.emit("tokens",o);return{tokens:o,res:r}}refreshAccessToken(e){if(e){this.refreshAccessTokenAsync().then(n=>e(null,n.credentials,n.res),e)}else{return this.refreshAccessTokenAsync()}}async refreshAccessTokenAsync(){const e=await this.refreshToken(this.credentials.refresh_token);const n=e.tokens;n.refresh_token=this.credentials.refresh_token;this.credentials=n;return{credentials:this.credentials,res:e.res}}getAccessToken(e){if(e){this.getAccessTokenAsync().then(n=>e(null,n.token,n.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 i=await this.processAndValidateRefreshHandler();if(i?.access_token){this.setCredentials(i);return{token:this.credentials.access_token}}}else{throw new Error("No refresh token or refresh handler callback is set.")}}const n=await this.refreshAccessTokenAsync();if(!n.credentials||n.credentials&&!n.credentials.access_token){throw new Error("Could not refresh access token.")}return{token:n.credentials.access_token,res:n.res}}else{return{token:this.credentials.access_token}}}async getRequestHeaders(e){const n=(await this.getRequestMetadataAsync(e)).headers;return n}async getRequestMetadataAsync(e){e;const n=this.credentials;if(!n.access_token&&!n.refresh_token&&!this.apiKey&&!this.refreshHandler){throw new Error("No access, refresh token, API key or refresh handler callback is set.")}if(n.access_token&&!this.isTokenExpiring()){n.token_type=n.token_type||"Bearer";const u=new Headers({authorization:n.token_type+" "+n.access_token});return{headers:this.addSharedMetadataHeaders(u)}}if(this.refreshHandler){const u=await this.processAndValidateRefreshHandler();if(u?.access_token){this.setCredentials(u);const c=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(c)}}}if(this.apiKey){return{headers:new Headers({"X-Goog-Api-Key":this.apiKey})}}let i=null;let r=null;try{i=await this.refreshToken(n.refresh_token);r=i.tokens}catch(u){const c=u;if(c.response&&(c.response.status===403||c.response.status===404)){c.message=`Could not refresh access token: ${c.message}`}throw c}const o=this.credentials;o.token_type=o.token_type||"Bearer";r.refresh_token=o.refresh_token;this.credentials=r;const l=new Headers({authorization:o.token_type+" "+r.access_token});return{headers:this.addSharedMetadataHeaders(l),res:i.res}}static getRevokeTokenUrl(e){return new t().getRevokeTokenURL(e).toString()}getRevokeTokenURL(e){const n=new URL(this.endpoints.oauth2RevokeUrl);n.searchParams.append("token",e);return n}revokeToken(e,n){const i={...t.RETRY_CONFIG,url:this.getRevokeTokenURL(e).toString(),method:"POST"};Ot.AuthClient.setMethodName(i,"revokeToken");if(n){this.transporter.request(i).then(r=>n(null,r),n)}else{return this.transporter.request(i)}}revokeCredentials(e){if(e){this.revokeCredentialsAsync().then(n=>e(null,n),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,n){if(n){this.requestAsync(e).then(i=>n(null,i),i=>{return n(i,i.response)})}else{return this.requestAsync(e)}}async requestAsync(e,n=false){try{const i=await this.getRequestMetadataAsync();e.headers=cu.Gaxios.mergeHeaders(e.headers);this.addUserProjectAndAuthHeaders(e.headers,i.headers);if(this.apiKey){e.headers.set("X-Goog-Api-Key",this.apiKey)}return await this.transporter.request(e)}catch(i){const r=i.response;if(r){const o=r.status;const l=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure);const u=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler;const c=r.config.data instanceof Uh.Readable;const d=o===401||o===403;if(!n&&d&&!c&&l){await this.refreshAccessTokenAsync();return this.requestAsync(e,true)}else if(!n&&d&&!c&&u){const f=await this.processAndValidateRefreshHandler();if(f?.access_token){this.setCredentials(f)}return this.requestAsync(e,true)}}throw i}}verifyIdToken(e,n){if(n&&typeof n!=="function"){throw new Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.")}if(n){this.verifyIdTokenAsync(e).then(i=>n(null,i),n)}else{return this.verifyIdTokenAsync(e)}}async verifyIdTokenAsync(e){if(!e.idToken){throw new Error("The verifyIdToken method requires an ID Token")}const n=await this.getFederatedSignonCertsAsync();const i=await this.verifySignedJwtWithCertsAsync(e.idToken,n.certs,e.audience,this.issuers,e.maxExpiry);return i}async getTokenInfo(e){const{data:n}=await this.transporter.request({...t.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${e}`},url:this.endpoints.tokenInfoUrl.toString()});const i=Object.assign({expiry_date:new Date().getTime()+n.expires_in*1e3,scopes:n.scope.split(" ")},n);delete i.expires_in;delete i.scope;return i}getFederatedSignonCerts(e){if(e){this.getFederatedSignonCertsAsync().then(n=>e(null,n.certs,n.res),e)}else{return this.getFederatedSignonCertsAsync()}}async getFederatedSignonCertsAsync(){const e=new Date().getTime();const n=(0,no.hasBrowserCrypto)()?ot.JWK:ot.PEM;if(this.certificateExpiry&&e<this.certificateExpiry.getTime()&&this.certificateCacheFormat===n){return{certs:this.certificateCache,format:n}}let i;let r;switch(n){case ot.PEM:r=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case ot.JWK:r=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw new Error(`Unsupported certificate format ${n}`)}try{const d={...t.RETRY_CONFIG,url:r};Ot.AuthClient.setMethodName(d,"getFederatedSignonCertsAsync");i=await this.transporter.request(d)}catch(d){if(d instanceof Error){d.message=`Failed to retrieve verification certificates: ${d.message}`}throw d}const o=i?.headers.get("cache-control");let l=-1;if(o){const d=/max-age=(?<maxAge>[0-9]+)/.exec(o)?.groups?.maxAge;if(d){l=Number(d)*1e3}}let u={};switch(n){case ot.PEM:u=i.data;break;case ot.JWK:for(const d of i.data.keys){u[d.kid]=d}break;default:throw new Error(`Unsupported certificate format ${n}`)}const c=new Date;this.certificateExpiry=l===-1?null:new Date(c.getTime()+l);this.certificateCache=u;this.certificateCacheFormat=n;return{certs:u,format:n,res:i}}getIapPublicKeys(e){if(e){this.getIapPublicKeysAsync().then(n=>e(null,n.pubkeys,n.res),e)}else{return this.getIapPublicKeysAsync()}}async getIapPublicKeysAsync(){let e;const n=this.endpoints.oauth2IapPublicKeyUrl.toString();try{const i={...t.RETRY_CONFIG,url:n};Ot.AuthClient.setMethodName(i,"getIapPublicKeysAsync");e=await this.transporter.request(i)}catch(i){if(i instanceof Error){i.message=`Failed to retrieve verification certificates: ${i.message}`}throw i}return{pubkeys:e.data,res:e}}verifySignedJwtWithCerts(){throw new Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(e,n,i,r,o){const l=(0,no.createCrypto)();if(!o){o=t.DEFAULT_MAX_TOKEN_LIFETIME_SECS_}const u=e.split(".");if(u.length!==3){throw new Error("Wrong number of segments in token: "+e)}const c=u[0]+"."+u[1];let d=u[2];let f;let p;try{f=JSON.parse(l.decodeBase64StringUtf8(u[0]))}catch(D){if(D instanceof Error){D.message=`Can't parse token envelope: ${u[0]}': ${D.message}`}throw D}if(!f){throw new Error("Can't parse token envelope: "+u[0])}try{p=JSON.parse(l.decodeBase64StringUtf8(u[1]))}catch(D){if(D instanceof Error){D.message=`Can't parse token payload '${u[0]}`}throw D}if(!p){throw new Error("Can't parse token payload: "+u[1])}if(!Object.prototype.hasOwnProperty.call(n,f.kid)){throw new Error("No pem found for envelope: "+JSON.stringify(f))}const h=n[f.kid];if(f.alg==="ES256"){d=Lh.joseToDer(d,"ES256").toString("base64")}const m=await l.verify(h,c,d);if(!m){throw new Error("Invalid token signature: "+e)}if(!p.iat){throw new Error("No issue time in token: "+JSON.stringify(p))}if(!p.exp){throw new Error("No expiration time in token: "+JSON.stringify(p))}const _=Number(p.iat);if(isNaN(_))throw new Error("iat field using invalid format");const A=Number(p.exp);if(isNaN(A))throw new Error("exp field using invalid format");const T=new Date().getTime()/1e3;if(A>=T+o){throw new Error("Expiration time too far in future: "+JSON.stringify(p))}const v=_-t.CLOCK_SKEW_SECS_;const G=A+t.CLOCK_SKEW_SECS_;if(T<v){throw new Error("Token used too early, "+T+" < "+v+": "+JSON.stringify(p))}if(T>G){throw new Error("Token used too late, "+T+" > "+G+": "+JSON.stringify(p))}if(r&&r.indexOf(p.iss)<0){throw new Error("Invalid issuer, expected one of ["+r+"], but got "+p.iss)}if(typeof i!=="undefined"&&i!==null){const D=p.aud;let O=false;if(i.constructor===Array){O=i.indexOf(D)>-1}else{O=D===i}if(!O){throw new Error("Wrong recipient, payload audience != requiredAudience")}}return new Gh.LoginTicket(f,p)}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}};Qe.OAuth2Client=io});var oo=F(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:true});Yn.Compute=void 0;var Oh=ge();var pu=dn();var bh=ct();var ro=class extends bh.OAuth2Client{serviceAccountEmail;scopes;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(){const e=`service-accounts/${this.serviceAccountEmail}/token`;let n;try{const r={property:e};if(this.scopes.length>0){r.params={scopes:this.scopes.join(",")}}n=await pu.instance(r)}catch(r){if(r instanceof Oh.GaxiosError){r.message=`Could not refresh access token: ${r.message}`;this.wrapError(r)}throw r}const i=n;if(n&&n.expires_in){i.expiry_date=new Date().getTime()+n.expires_in*1e3;delete i.expires_in}this.emit("tokens",i);return{tokens:i,res:null}}async fetchIdToken(e){const n=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${e}`;let i;try{const r={property:n};i=await pu.instance(r)}catch(r){if(r instanceof Error){r.message=`Could not fetch ID token: ${r.message}`}throw r}return i}wrapError(e){const n=e.response;if(n&&n.status){e.status=n.status;if(n.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(n.status===404){e.message="A Not Found error was returned while attempting to retrieve an accesstoken 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}}}};Yn.Compute=ro});var ao=F(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:true});zn.IdTokenClient=void 0;var Fh=ct();var so=class extends Fh.OAuth2Client{targetAudience;idTokenProvider;constructor(e){super(e);this.targetAudience=e.targetAudience;this.idTokenProvider=e.idTokenProvider}async getRequestMetadataAsync(){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){const n=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:n,expiry_date:this.getIdTokenExpiryDate(n)}}const e=new Headers({authorization:"Bearer "+this.credentials.id_token});return{headers:e}}getIdTokenExpiryDate(e){const n=e.split(".")[1];if(n){const i=JSON.parse(Buffer.from(n,"base64").toString("ascii"));return i.exp*1e3}}};zn.IdTokenClient=so});var lo=F(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:true});bt.GCPEnv=void 0;bt.clear=qh;bt.getEnv=Hh;var hu=dn();var Ze;(function(t){t["APP_ENGINE"]="APP_ENGINE";t["KUBERNETES_ENGINE"]="KUBERNETES_ENGINE";t["CLOUD_FUNCTIONS"]="CLOUD_FUNCTIONS";t["COMPUTE_ENGINE"]="COMPUTE_ENGINE";t["CLOUD_RUN"]="CLOUD_RUN";t["CLOUD_RUN_JOBS"]="CLOUD_RUN_JOBS";t["NONE"]="NONE"})(Ze||(bt.GCPEnv=Ze={}));var hn;function qh(){hn=void 0}async function Hh(){if(hn){return hn}hn=Vh();return hn}async function Vh(){let t=Ze.NONE;if(Bh()){t=Ze.APP_ENGINE}else if($h()){t=Ze.CLOUD_FUNCTIONS}else if(await Yh()){if(await Wh()){t=Ze.KUBERNETES_ENGINE}else if(Jh()){t=Ze.CLOUD_RUN}else if(Kh()){t=Ze.CLOUD_RUN_JOBS}else{t=Ze.COMPUTE_ENGINE}}else{t=Ze.NONE}return t}function Bh(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}function $h(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}function Jh(){return!!process.env.K_CONFIGURATION}function Kh(){return!!process.env.CLOUD_RUN_JOB}async function Wh(){try{await hu.instance("attributes/cluster-name");return true}catch(t){return false}}async function Yh(){return hu.isAvailable()}});var uo=F((sI,gu)=>{var Xn=an().Buffer;var zh=z("stream");var Xh=z("util");function Qn(t){this.buffer=null;this.writable=true;this.readable=true;if(!t){this.buffer=Xn.alloc(0);return this}if(typeof t.pipe==="function"){this.buffer=Xn.alloc(0);t.pipe(this);return this}if(t.length||typeof t==="object"){this.buffer=t;this.writable=false;process.nextTick(function(){this.emit("end",t);this.readable=false;this.emit("close")}.bind(this));return this}throw new TypeError("Unexpected data type ("+typeof t+")")}Xh.inherits(Qn,zh);Qn.prototype.write=function t(e){this.buffer=Xn.concat([this.buffer,Xn.from(e)]);this.emit("data",e)};Qn.prototype.end=function t(e){if(e)this.write(e);this.emit("end",e);this.emit("close");this.writable=false;this.readable=false};gu.exports=Qn});var yu=F((aI,mu)=>{"use strict";var gn=z("buffer").Buffer;var co=z("buffer").SlowBuffer;mu.exports=Zn;function Zn(t,e){if(!gn.isBuffer(t)||!gn.isBuffer(e)){return false}if(t.length!==e.length){return false}var n=0;for(var i=0;i<t.length;i++){n|=t[i]^e[i]}return n===0}Zn.install=function(){gn.prototype.equal=co.prototype.equal=function t(e){return Zn(this,e)}};var Qh=gn.prototype.equal;var Zh=co.prototype.equal;Zn.restore=function(){gn.prototype.equal=Qh;co.prototype.equal=Zh}});var go=F((lI,wu)=>{var qt=an().Buffer;var Le=z("crypto");var _u=Wr();var Eu=z("util");var jh='"%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 mn="secret must be a string or buffer";var Ft="key must be a string or a buffer";var eg="key must be a string, a buffer or an object";var po=typeof Le.createPublicKey==="function";if(po){Ft+=" or a KeyObject";mn+="or a KeyObject"}function Tu(t){if(qt.isBuffer(t)){return}if(typeof t==="string"){return}if(!po){throw Ve(Ft)}if(typeof t!=="object"){throw Ve(Ft)}if(typeof t.type!=="string"){throw Ve(Ft)}if(typeof t.asymmetricKeyType!=="string"){throw Ve(Ft)}if(typeof t.export!=="function"){throw Ve(Ft)}}function Au(t){if(qt.isBuffer(t)){return}if(typeof t==="string"){return}if(typeof t==="object"){return}throw Ve(eg)}function tg(t){if(qt.isBuffer(t)){return}if(typeof t==="string"){return t}if(!po){throw Ve(mn)}if(typeof t!=="object"){throw Ve(mn)}if(t.type!=="secret"){throw Ve(mn)}if(typeof t.export!=="function"){throw Ve(mn)}}function ho(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Cu(t){t=t.toString();var e=4-t.length%4;if(e!==4){for(var n=0;n<e;++n){t+="="}}return t.replace(/\-/g,"+").replace(/_/g,"/")}function Ve(t){var e=[].slice.call(arguments,1);var n=Eu.format.bind(Eu,t).apply(null,e);return new TypeError(n)}function ng(t){return qt.isBuffer(t)||typeof t==="string"}function yn(t){if(!ng(t))t=JSON.stringify(t);return t}function vu(t){return function e(n,i){tg(i);n=yn(n);var r=Le.createHmac("sha"+t,i);var o=(r.update(n),r.digest("base64"));return ho(o)}}var fo;var ig="timingSafeEqual"in Le?function t(e,n){if(e.byteLength!==n.byteLength){return false}return Le.timingSafeEqual(e,n)}:function t(e,n){if(!fo){fo=yu()}return fo(e,n)};function rg(t){return function e(n,i,r){var o=vu(t)(n,r);return ig(qt.from(i),qt.from(o))}}function Su(t){return function e(n,i){Au(i);n=yn(n);var r=Le.createSign("RSA-SHA"+t);var o=(r.update(n),r.sign(i,"base64"));return ho(o)}}function Iu(t){return function e(n,i,r){Tu(r);n=yn(n);i=Cu(i);var o=Le.createVerify("RSA-SHA"+t);o.update(n);return o.verify(r,i,"base64")}}function og(t){return function e(n,i){Au(i);n=yn(n);var r=Le.createSign("RSA-SHA"+t);var o=(r.update(n),r.sign({key:i,padding:Le.constants.RSA_PKCS1_PSS_PADDING,saltLength:Le.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return ho(o)}}function sg(t){return function e(n,i,r){Tu(r);n=yn(n);i=Cu(i);var o=Le.createVerify("RSA-SHA"+t);o.update(n);return o.verify({key:r,padding:Le.constants.RSA_PKCS1_PSS_PADDING,saltLength:Le.constants.RSA_PSS_SALTLEN_DIGEST},i,"base64")}}function ag(t){var e=Su(t);return function n(){var i=e.apply(null,arguments);i=_u.derToJose(i,"ES"+t);return i}}function lg(t){var e=Iu(t);return function n(i,r,o){r=_u.joseToDer(r,"ES"+t).toString("base64");var l=e(i,r,o);return l}}function ug(){return function t(){return""}}function cg(){return function t(e,n){return n===""}}wu.exports=function t(e){var n={hs:vu,rs:Su,ps:og,es:ag,none:ug};var i={hs:rg,rs:Iu,ps:sg,es:lg,none:cg};var r=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!r)throw Ve(jh,e);var o=(r[1]||r[3]).toLowerCase();var l=r[2];return{sign:n[o](l),verify:i[o](l)}}});var mo=F((uI,Ru)=>{var dg=z("buffer").Buffer;Ru.exports=function t(e){if(typeof e==="string")return e;if(typeof e==="number"||dg.isBuffer(e))return e.toString();return JSON.stringify(e)}});var Du=F((cI,xu)=>{var fg=an().Buffer;var Pu=uo();var pg=go();var hg=z("stream");var Nu=mo();var yo=z("util");function Mu(t,e){return fg.from(t,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function gg(t,e,n){n=n||"utf8";var i=Mu(Nu(t),"binary");var r=Mu(Nu(e),n);return yo.format("%s.%s",i,r)}function ku(t){var e=t.header;var n=t.payload;var i=t.secret||t.privateKey;var r=t.encoding;var o=pg(e.alg);var l=gg(e,n,r);var u=o.sign(l,i);return yo.format("%s.%s",l,u)}function jn(t){var e=t.secret;e=e==null?t.privateKey:e;e=e==null?t.key:e;if(/^hs/i.test(t.header.alg)===true&&e==null){throw new TypeError("secret must be a string or buffer or a KeyObject")}var n=new Pu(e);this.readable=true;this.header=t.header;this.encoding=t.encoding;this.secret=this.privateKey=this.key=n;this.payload=new Pu(t.payload);this.secret.once("close",function(){if(!this.payload.writable&&this.readable)this.sign()}.bind(this));this.payload.once("close",function(){if(!this.secret.writable&&this.readable)this.sign()}.bind(this))}yo.inherits(jn,hg);jn.prototype.sign=function t(){try{var e=ku({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});this.emit("done",e);this.emit("data",e);this.emit("end");this.readable=false;return e}catch(n){this.readable=false;this.emit("error",n);this.emit("close")}};jn.sign=ku;xu.exports=jn});var Bu=F((dI,Vu)=>{var Lu=an().Buffer;var Uu=uo();var mg=go();var yg=z("stream");var Gu=mo();var Eg=z("util");var _g=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function Tg(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ag(t){if(Tg(t))return t;try{return JSON.parse(t)}catch(e){return void 0}}function Ou(t){var e=t.split(".",1)[0];return Ag(Lu.from(e,"base64").toString("binary"))}function Cg(t){return t.split(".",2).join(".")}function bu(t){return t.split(".")[2]}function vg(t,e){e=e||"utf8";var n=t.split(".")[1];return Lu.from(n,"base64").toString(e)}function Fu(t){return _g.test(t)&&!!Ou(t)}function qu(t,e,n){if(!e){var i=new Error("Missing algorithm parameter for jws.verify");i.code="MISSING_ALGORITHM";throw i}t=Gu(t);var r=bu(t);var o=Cg(t);var l=mg(e);return l.verify(o,r,n)}function Hu(t,e){e=e||{};t=Gu(t);if(!Fu(t))return null;var n=Ou(t);if(!n)return null;var i=vg(t);if(n.typ==="JWT"||e.json)i=JSON.parse(i,e.encoding);return{header:n,payload:i,signature:bu(t)}}function Ht(t){t=t||{};var e=t.secret;e=e==null?t.publicKey:e;e=e==null?t.key:e;if(/^hs/i.test(t.algorithm)===true&&e==null){throw new TypeError("secret must be a string or buffer or a KeyObject")}var n=new Uu(e);this.readable=true;this.algorithm=t.algorithm;this.encoding=t.encoding;this.secret=this.publicKey=this.key=n;this.signature=new Uu(t.signature);this.secret.once("close",function(){if(!this.signature.writable&&this.readable)this.verify()}.bind(this));this.signature.once("close",function(){if(!this.secret.writable&&this.readable)this.verify()}.bind(this))}Eg.inherits(Ht,yg);Ht.prototype.verify=function t(){try{var e=qu(this.signature.buffer,this.algorithm,this.key.buffer);var n=Hu(this.signature.buffer,this.encoding);this.emit("done",e,n);this.emit("data",e);this.emit("end");this.readable=false;return e}catch(i){this.readable=false;this.emit("error",i);this.emit("close")}};Ht.decode=Hu;Ht.isValid=Fu;Ht.verify=qu;Vu.exports=Ht});var Eo=F(dt=>{var $u=Du();var ei=Bu();var Sg=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];dt.ALGORITHMS=Sg;dt.sign=$u.sign;dt.verify=ei.verify;dt.decode=ei.decode;dt.isValid=ei.isValid;dt.createSign=function t(e){return new $u(e)};dt.createVerify=function t(e){return new ei(e)}});var Ku=F(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:true});ti.buildPayloadForJwsSign=Ju;ti.getJwsSign=Pg;var Ig=Eo();var wg="RS256";var Rg="https://oauth2.googleapis.com/token";function Ju(t){const e=Math.floor(new Date().getTime()/1e3);const n={iss:t.iss,scope:t.scope,aud:Rg,exp:e+3600,iat:e,sub:t.sub,...t.additionalClaims};return n}function Pg(t){const e=Ju(t);return(0,Ig.sign)({header:{alg:wg},payload:e,secret:t.key})}});var Wu=F(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:true});_o.getToken=Dg;var Ng=Ku();var Mg="https://oauth2.googleapis.com/token";var kg="urn:ietf:params:oauth:grant-type:jwt-bearer";var xg=t=>{return{method:"POST",url:Mg,data:new URLSearchParams({grant_type:kg,assertion:(0,Ng.getJwsSign)(t)}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}}};async function Dg(t){if(!t.transporter){throw new Error("No transporter set.")}try{const e=xg(t);const n=await t.transporter.request(e);return n.data}catch(e){const n=e;const i=n.response?.data;if(i?.error){n.message=`${i.error}: ${i.error_description}`}throw n}}});var Yu=F(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:true});ni.ErrorWithCode=void 0;var To=class extends Error{code;constructor(e,n){super(e);this.code=n}};ni.ErrorWithCode=To});var wo=F(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:true});Io.getCredentials=Gg;var Ug=z("path");var zu=z("fs");var Lg=z("util");var ii=Yu();var Xu=zu.readFile?(0,Lg.promisify)(zu.readFile):async()=>{throw new ii.ErrorWithCode("use key rather than keyFile.","MISSING_CREDENTIALS")};var ft;(function(t){t["JSON"]=".json";t["DER"]=".der";t["CRT"]=".crt";t["PEM"]=".pem";t["P12"]=".p12";t["PFX"]=".pfx"})(ft||(ft={}));var Ao=class{keyFilePath;constructor(e){this.keyFilePath=e}async getCredentials(){const e=await Xu(this.keyFilePath,"utf8");let n;try{n=JSON.parse(e)}catch(o){const l=o;throw new Error(`Invalid JSON key file: ${l.message}`)}const i=n.private_key;const r=n.client_email;if(!i||!r){throw new ii.ErrorWithCode("private_key and client_email are required.","MISSING_CREDENTIALS")}return{privateKey:i,clientEmail:r}}};var Co=class{keyFilePath;constructor(e){this.keyFilePath=e}async getCredentials(){const e=await Xu(this.keyFilePath,"utf8");return{privateKey:e}}};var vo=class{async getCredentials(){throw new ii.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")}};var So=class{static create(e){const n=Ug.extname(e);switch(n){case ft.JSON:return new Ao(e);case ft.DER:case ft.CRT:case ft.PEM:return new Co(e);case ft.P12:case ft.PFX:return new vo;default:throw new ii.ErrorWithCode("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE")}}};async function Gg(t){const e=So.create(t);return e.getCredentials()}});var Qu=F(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:true});ri.TokenHandler=void 0;var Og=Wu();var bg=wo();var Ro=class{token;tokenExpiresAt;inFlightRequest;tokenOptions;constructor(e){this.tokenOptions=e}async processCredentials(){if(!this.tokenOptions.key&&!this.tokenOptions.keyFile){throw new Error("No key or keyFile set.")}if(!this.tokenOptions.key&&this.tokenOptions.keyFile){const e=await(0,bg.getCredentials)(this.tokenOptions.keyFile);this.tokenOptions.key=e.privateKey;this.tokenOptions.email=e.clientEmail}}isTokenExpiring(){if(!this.token||!this.tokenExpiresAt){return true}const e=new Date().getTime();const n=this.tokenOptions.eagerRefreshThresholdMillis??0;return this.tokenExpiresAt<=e+n}hasExpired(){const e=new Date().getTime();if(this.token&&this.tokenExpiresAt){const n=new Date().getTime();return n>=this.tokenExpiresAt}return true}async getToken(e){await this.processCredentials();if(this.inFlightRequest&&!e){return this.inFlightRequest}if(this.token&&!this.isTokenExpiring()&&!e){return this.token}try{this.inFlightRequest=(0,Og.getToken)(this.tokenOptions);const n=await this.inFlightRequest;this.token=n;this.tokenExpiresAt=new Date().getTime()+(n.expires_in??0)*1e3;return n}finally{this.inFlightRequest=void 0}}};ri.TokenHandler=Ro});var Zu=F(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:true});Po.revokeToken=Hg;var Fg="https://oauth2.googleapis.com/revoke?token=";var qg=true;async function Hg(t,e){const n=Fg+t;return await e.request({url:n,retry:qg})}});var Mo=F(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:true});oi.GoogleToken=void 0;var Vg=ge();var ju=Qu();var Bg=Zu();var No=class{tokenOptions;tokenHandler;constructor(e){this.tokenOptions=e||{};this.tokenOptions.transporter=this.tokenOptions.transporter||{request:n=>(0,Vg.request)(n)};if(!this.tokenOptions.iss){this.tokenOptions.iss=this.tokenOptions.email}if(typeof this.tokenOptions.scope==="object"){this.tokenOptions.scope=this.tokenOptions.scope.join(" ")}this.tokenHandler=new ju.TokenHandler(this.tokenOptions)}get expiresAt(){return this.tokenHandler.tokenExpiresAt}get accessToken(){return this.tokenHandler.token?.access_token}get idToken(){return this.tokenHandler.token?.id_token}get tokenType(){return this.tokenHandler.token?.token_type}get refreshToken(){return this.tokenHandler.token?.refresh_token}hasExpired(){return this.tokenHandler.hasExpired()}isTokenExpiring(){return this.tokenHandler.isTokenExpiring()}getToken(e,n={forceRefresh:false}){let i;if(typeof e==="function"){i=e}else if(typeof e==="object"){n=e}const r=this.tokenHandler.getToken(n.forceRefresh??false);if(i){r.then(o=>i(null,o),i)}return r}revokeToken(e){if(!this.accessToken){return Promise.reject(new Error("No token to revoke."))}const n=(0,Bg.revokeToken)(this.accessToken,this.tokenOptions.transporter);if(e){n.then(()=>e(),e)}this.tokenHandler=new ju.TokenHandler(this.tokenOptions)}get googleTokenOptions(){return this.tokenOptions}};oi.GoogleToken=No});var xo=F(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:true});si.JWTAccess=void 0;var $g=Eo();var Jg=qe();var ec={alg:"RS256",typ:"JWT"};var ko=class t{email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new Jg.LRUCache({capacity:500,maxAge:60*60*1e3});constructor(e,n,i,r){this.email=e;this.key=n;this.keyId=i;this.eagerRefreshThresholdMillis=r??5*60*1e3}getCachedKey(e,n){let i=e;if(n&&Array.isArray(n)&&n.length){i=e?`${e}_${n.join("_")}`:`${n.join("_")}`}else if(typeof n==="string"){i=e?`${e}_${n}`:n}if(!i){throw Error("Scopes or url must be provided")}return i}getRequestHeaders(e,n,i){const r=this.getCachedKey(e,i);const o=this.cache.get(r);const l=Date.now();if(o&&o.expiration-l>this.eagerRefreshThresholdMillis){return new Headers(o.headers)}const u=Math.floor(Date.now()/1e3);const c=t.getExpirationTime(u);let d;if(Array.isArray(i)){i=i.join(" ")}if(i){d={iss:this.email,sub:this.email,scope:i,exp:c,iat:u}}else{d={iss:this.email,sub:this.email,aud:e,exp:c,iat:u}}if(n){for(const _ in d){if(n[_]){throw new Error(`The '${_}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}}}const f=this.keyId?{...ec,kid:this.keyId}:ec;const p=Object.assign(d,n);const h=$g.sign({header:f,payload:p,secret:this.key});const m=new Headers({authorization:`Bearer ${h}`});this.cache.set(r,{expiration:c*1e3,headers:m});return m}static getExpirationTime(e){const n=e+3600;return n}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,n){if(n){this.fromStreamAsync(e).then(()=>n(),n)}else{return this.fromStreamAsync(e)}}fromStreamAsync(e){return new Promise((n,i)=>{if(!e){i(new Error("Must pass in a stream containing the service account auth settings."))}let r="";e.setEncoding("utf8").on("data",o=>r+=o).on("error",i).on("end",()=>{try{const o=JSON.parse(r);this.fromJSON(o);n()}catch(o){i(o)}})})}};si.JWTAccess=ko});var Uo=F(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:true});li.JWT=void 0;var tc=Mo();var Kg=wo();var Wg=xo();var Yg=ct();var ai=Pe();var Do=class t extends Yg.OAuth2Client{email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(e={}){super(e);this.email=e.email;this.keyFile=e.keyFile;this.key=e.key;this.keyId=e.keyId;this.scopes=e.scopes;this.subject=e.subject;this.additionalClaims=e.additionalClaims;this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(e){const n=new t(this);n.scopes=e;return n}async getRequestMetadataAsync(e){e=this.defaultServicePath?`https://${this.defaultServicePath}/`:e;const n=!this.hasUserScopes()&&e||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==ai.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==ai.DEFAULT_UNIVERSE){throw new RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${ai.DEFAULT_UNIVERSE}`)}if(!this.apiKey&&n){if(this.additionalClaims&&this.additionalClaims.target_audience){const{tokens:i}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${i.id_token}`}))}}else{if(!this.access){this.access=new Wg.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis)}let i;if(this.hasUserScopes()){i=this.scopes}else if(!e){i=this.defaultScopes}const r=this.useJWTAccessWithScope||this.universeDomain!==ai.DEFAULT_UNIVERSE;const o=await this.access.getRequestHeaders(e??void 0,this.additionalClaims,r?i:void 0);return{headers:this.addSharedMetadataHeaders(o)}}}else if(this.hasAnyScopes()||this.apiKey){return super.getRequestMetadataAsync(e)}else{return{headers:new Headers}}}async fetchIdToken(e){const n=new tc.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 n.getToken({forceRefresh:true});if(!n.idToken){throw new Error("Unknown error: Failed to fetch ID token")}return n.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(n=>e(null,n),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.googleTokenOptions?.key;this.email=this.gtoken.googleTokenOptions?.iss;return e.tokens}async refreshTokenNoCache(){const e=this.createGToken();const n=await e.getToken({forceRefresh:this.isTokenExpiring()});const i={access_token:n.access_token,token_type:"Bearer",expiry_date:e.expiresAt,id_token:e.idToken};this.emit("tokens",i);return{res:null,tokens:i}}createGToken(){if(!this.gtoken){this.gtoken=new tc.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;this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,n){if(n){this.fromStreamAsync(e).then(()=>n(),n)}else{return this.fromStreamAsync(e)}}fromStreamAsync(e){return new Promise((n,i)=>{if(!e){throw new Error("Must pass in a stream containing the service account auth settings.")}let r="";e.setEncoding("utf8").on("error",i).on("data",o=>r+=o).on("end",()=>{try{const o=JSON.parse(r);this.fromJSON(o);n()}catch(o){i(o)}})})}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 n=await(0,Kg.getCredentials)(this.keyFile);return{private_key:n.privateKey,client_email:n.clientEmail}}throw new Error("A key or a keyFile must be provided to getCredentials.")}};li.JWT=Do});var Go=F(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:true});Vt.UserRefreshClient=Vt.USER_REFRESH_ACCOUNT_TYPE=void 0;var zg=ct();var Xg=Pe();Vt.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var Lo=class t extends zg.OAuth2Client{_refreshToken;constructor(e,n,i,r,o){const l=e&&typeof e==="object"?e:{clientId:e,clientSecret:n,refreshToken:i,eagerRefreshThresholdMillis:r,forceRefreshOnFailure:o};super(l);this._refreshToken=l.refreshToken;this.credentials.refresh_token=l.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(e){const n={...t.RETRY_CONFIG,url:this.endpoints.oauth2TokenUrl,method:"POST",data:new URLSearchParams({client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:this._refreshToken,target_audience:e}),responseType:"json"};Xg.AuthClient.setMethodName(n,"fetchIdToken");const i=await this.transporter.request(n);return i.data.id_token}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;this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,n){if(n){this.fromStreamAsync(e).then(()=>n(),n)}else{return this.fromStreamAsync(e)}}async fromStreamAsync(e){return new Promise((n,i)=>{if(!e){return i(new Error("Must pass in a stream containing the user refresh token."))}let r="";e.setEncoding("utf8").on("error",i).on("data",o=>r+=o).on("end",()=>{try{const o=JSON.parse(r);this.fromJSON(o);return n()}catch(o){return i(o)}})})}static fromJSON(e){const n=new t;n.fromJSON(e);return n}};Vt.UserRefreshClient=Lo});var bo=F(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:true});Bt.Impersonated=Bt.IMPERSONATED_ACCOUNT_TYPE=void 0;var nc=ct();var Qg=ge();var Zg=qe();Bt.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var Oo=class t extends nc.OAuth2Client{sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(e={}){super(e);this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"};this.sourceClient=e.sourceClient??new nc.OAuth2Client;this.targetPrincipal=e.targetPrincipal??"";this.delegates=e.delegates??[];this.targetScopes=e.targetScopes??[];this.lifetime=e.lifetime??3600;const n=!!(0,Zg.originalOrCamelOptions)(e).get("universe_domain");if(!n){this.universeDomain=this.sourceClient.universeDomain}else if(this.sourceClient.universeDomain!==this.universeDomain){throw new RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`)}this.endpoint=e.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(e){await this.sourceClient.getAccessToken();const n=`projects/-/serviceAccounts/${this.targetPrincipal}`;const i=`${this.endpoint}/v1/${n}:signBlob`;const r={delegates:this.delegates,payload:Buffer.from(e).toString("base64")};const o=await this.sourceClient.request({...t.RETRY_CONFIG,url:i,data:r,method:"POST"});return o.data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();const e="projects/-/serviceAccounts/"+this.targetPrincipal;const n=`${this.endpoint}/v1/${e}:generateAccessToken`;const i={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"};const r=await this.sourceClient.request({...t.RETRY_CONFIG,url:n,data:i,method:"POST"});const o=r.data;this.credentials.access_token=o.accessToken;this.credentials.expiry_date=Date.parse(o.expireTime);return{tokens:this.credentials,res:r}}catch(e){if(!(e instanceof Error))throw e;let n=0;let i="";if(e instanceof Qg.GaxiosError){n=e?.response?.data?.error?.status;i=e?.response?.data?.error?.message}if(n&&i){e.message=`${n}: unable to impersonate: ${i}`;throw e}else{e.message=`unable to impersonate: ${e}`;throw e}}}async fetchIdToken(e,n){await this.sourceClient.getAccessToken();const i=`projects/-/serviceAccounts/${this.targetPrincipal}`;const r=`${this.endpoint}/v1/${i}:generateIdToken`;const o={delegates:this.delegates,audience:e,includeEmail:n?.includeEmail??true,useEmailAzp:n?.includeEmail??true};const l=await this.sourceClient.request({...t.RETRY_CONFIG,url:r,data:o,method:"POST"});return l.data.token}};Bt.Impersonated=Oo});var qo=F(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:true});En.OAuthClientAuthHandler=void 0;En.getErrorFromOAuthErrorResponse=tm;var $t=ge();var jg=fn();var em=["PUT","POST","PATCH"];var Fo=class{#e=(0,jg.createCrypto)();#t;transporter;constructor(e){if(e&&"clientId"in e){this.#t=e;this.transporter=new $t.Gaxios}else{this.#t=e?.clientAuthentication;this.transporter=e?.transporter||new $t.Gaxios}}applyClientAuthenticationOptions(e,n){e.headers=$t.Gaxios.mergeHeaders(e.headers);this.injectAuthenticatedHeaders(e,n);if(!n){this.injectAuthenticatedRequestBody(e)}}injectAuthenticatedHeaders(e,n){if(n){e.headers=$t.Gaxios.mergeHeaders(e.headers,{authorization:`Bearer ${n}`})}else if(this.#t?.confidentialClientType==="basic"){e.headers=$t.Gaxios.mergeHeaders(e.headers);const i=this.#t.clientId;const r=this.#t.clientSecret||"";const o=this.#e.encodeBase64StringUtf8(`${i}:${r}`);$t.Gaxios.mergeHeaders(e.headers,{authorization:`Basic ${o}`})}}injectAuthenticatedRequestBody(e){if(this.#t?.confidentialClientType==="request-body"){const n=(e.method||"GET").toUpperCase();if(!em.includes(n)){throw new Error(`${n} HTTP method does not support ${this.#t.confidentialClientType} client authentication`)}const i=new Headers(e.headers);const r=i.get("content-type");if(r?.startsWith("application/x-www-form-urlencoded")||e.data instanceof URLSearchParams){const o=new URLSearchParams(e.data??"");o.append("client_id",this.#t.clientId);o.append("client_secret",this.#t.clientSecret||"");e.data=o}else if(r?.startsWith("application/json")){e.data=e.data||{};Object.assign(e.data,{client_id:this.#t.clientId,client_secret:this.#t.clientSecret||""})}else{throw new Error(`${r} content-types are not supported with ${this.#t.confidentialClientType} client authentication`)}}}static get RETRY_CONFIG(){return{retry:true,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};En.OAuthClientAuthHandler=Fo;function tm(t,e){const n=t.error;const i=t.error_description;const r=t.error_uri;let o=`Error code ${n}`;if(typeof i!=="undefined"){o+=`: ${i}`}if(typeof r!=="undefined"){o+=` - ${r}`}const l=new Error(o);if(e){const u=Object.keys(e);if(e.stack){u.push("stack")}u.forEach(c=>{if(c!=="message"){Object.defineProperty(l,c,{value:e[c],writable:false,enumerable:true})}})}return l}});var ci=F(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:true});ui.StsCredentials=void 0;var nm=ge();var im=Pe();var ic=qo();var rm=qe();var Ho=class t extends ic.OAuthClientAuthHandler{#e;constructor(e={tokenExchangeEndpoint:""},n){if(typeof e!=="object"||e instanceof URL){e={tokenExchangeEndpoint:e,clientAuthentication:n}}super(e);this.#e=e.tokenExchangeEndpoint}async exchangeToken(e,n,i){const r={grant_type:e.grantType,resource:e.resource,audience:e.audience,scope:e.scope?.join(" "),requested_token_type:e.requestedTokenType,subject_token:e.subjectToken,subject_token_type:e.subjectTokenType,actor_token:e.actingParty?.actorToken,actor_token_type:e.actingParty?.actorTokenType,options:i&&JSON.stringify(i)};const o={...t.RETRY_CONFIG,url:this.#e.toString(),method:"POST",headers:n,data:new URLSearchParams((0,rm.removeUndefinedValuesInObject)(r)),responseType:"json"};im.AuthClient.setMethodName(o,"exchangeToken");this.applyClientAuthenticationOptions(o);try{const l=await this.transporter.request(o);const u=l.data;u.res=l;return u}catch(l){if(l instanceof nm.GaxiosError&&l.response){throw(0,ic.getErrorFromOAuthErrorResponse)(l.response.data,l)}throw l}}};ui.StsCredentials=Ho});var pt=F(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:true});Ge.BaseExternalAccountClient=Ge.CLOUD_RESOURCE_MANAGER=Ge.EXTERNAL_ACCOUNT_TYPE=Ge.EXPIRATION_TIME_OFFSET=void 0;var om=ge();var sm=z("stream");var Vo=Pe();var am=ci();var rc=qe();var lm=Xr();var um="urn:ietf:params:oauth:grant-type:token-exchange";var cm="urn:ietf:params:oauth:token-type:access_token";var Bo="https://www.googleapis.com/auth/cloud-platform";var dm=3600;Ge.EXPIRATION_TIME_OFFSET=5*60*1e3;Ge.EXTERNAL_ACCOUNT_TYPE="external_account";Ge.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var fm="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+";var pm="https://sts.{universeDomain}/v1/token";var $o=class t extends Vo.AuthClient{scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#e=null;constructor(e){super(e);const n=(0,rc.originalOrCamelOptions)(e);const i=n.get("type");if(i&&i!==Ge.EXTERNAL_ACCOUNT_TYPE){throw new Error(`Expected "${Ge.EXTERNAL_ACCOUNT_TYPE}" type but received "${e.type}"`)}const r=n.get("client_id");const o=n.get("client_secret");this.tokenUrl=n.get("token_url")??pm.replace("{universeDomain}",this.universeDomain);const l=n.get("subject_token_type");const u=n.get("workforce_pool_user_project");const c=n.get("service_account_impersonation_url");const d=n.get("service_account_impersonation");const f=(0,rc.originalOrCamelOptions)(d).get("token_lifetime_seconds");this.cloudResourceManagerURL=new URL(n.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`);if(r){this.clientAuth={confidentialClientType:"basic",clientId:r,clientSecret:o}}this.stsCredential=new am.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth});this.scopes=n.get("scopes")||[Bo];this.cachedAccessToken=null;this.audience=n.get("audience");this.subjectTokenType=l;this.workforcePoolUserProject=u;const p=new RegExp(fm);if(this.workforcePoolUserProject&&!this.audience.match(p)){throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.")}this.serviceAccountImpersonationUrl=c;this.serviceAccountImpersonationLifetime=f;if(this.serviceAccountImpersonationLifetime){this.configLifetimeRequested=true}else{this.configLifetimeRequested=false;this.serviceAccountImpersonationLifetime=dm}this.projectNumber=this.getProjectNumber(this.audience);this.supplierContext={audience:this.audience,subjectTokenType:this.subjectTokenType,transporter:this.transporter}}getServiceAccountEmail(){if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256){throw new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`)}const e=/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/;const n=e.exec(this.serviceAccountImpersonationUrl);return n?.groups?.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 n=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(n)}request(e,n){if(n){this.requestAsync(e).then(i=>n(null,i),i=>{return n(i,i.response)})}else{return this.requestAsync(e)}}async getProjectId(){const e=this.projectNumber||this.workforcePoolUserProject;if(this.projectId){return this.projectId}else if(e){const n=await this.getRequestHeaders();const i={...t.RETRY_CONFIG,headers:n,url:`${this.cloudResourceManagerURL.toString()}${e}`,responseType:"json"};Vo.AuthClient.setMethodName(i,"getProjectId");const r=await this.transporter.request(i);this.projectId=r.data.projectId;return this.projectId}return null}async requestAsync(e,n=false){let i;try{const r=await this.getRequestHeaders();e.headers=om.Gaxios.mergeHeaders(e.headers);this.addUserProjectAndAuthHeaders(e.headers,r);i=await this.transporter.request(e)}catch(r){const o=r.response;if(o){const l=o.status;const u=o.config.data instanceof sm.Readable;const c=l===401||l===403;if(!n&&c&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw r}return i}async refreshAccessTokenAsync(){this.#e=this.#e||this.#t();try{return await this.#e}finally{this.#e=null}}async#t(){const e=await this.retrieveSubjectToken();const n={grantType:um,audience:this.audience,requestedTokenType:cm,subjectToken:e,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[Bo]:this.getScopesArray()};const i=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0;const r=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()});const o=await this.stsCredential.exchangeToken(n,r,i);if(this.serviceAccountImpersonationUrl){this.cachedAccessToken=await this.getImpersonatedAccessToken(o.access_token)}else if(o.expires_in){this.cachedAccessToken={access_token:o.access_token,expiry_date:new Date().getTime()+o.expires_in*1e3,res:o.res}}else{this.cachedAccessToken={access_token:o.access_token,res:o.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 n=e.match(/\/projects\/([^/]+)/);if(!n){return null}return n[1]}async getImpersonatedAccessToken(e){const n={...t.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"},responseType:"json"};Vo.AuthClient.setMethodName(n,"getImpersonatedAccessToken");const i=await this.transporter.request(n);const r=i.data;return{access_token:r.accessToken,expiry_date:new Date(r.expireTime).getTime(),res:i}}isExpired(e){const n=new Date().getTime();return e.expiry_date?n>=e.expiry_date-this.eagerRefreshThresholdMillis:false}getScopesArray(){if(typeof this.scopes==="string"){return[this.scopes]}return this.scopes||[Bo]}getMetricsHeaderValue(){const e=process.version.replace(/^v/,"");const n=this.serviceAccountImpersonationUrl!==void 0;const i=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${e} auth/${lm.pkg.version} google-byoid-sdk source/${i} sa-impersonation/${n} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}};Ge.BaseExternalAccountClient=$o});var oc=F(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:true});di.FileSubjectTokenSupplier=void 0;var Ko=z("util");var Wo=z("fs");var hm=(0,Ko.promisify)(Wo.readFile??(()=>{}));var gm=(0,Ko.promisify)(Wo.realpath??(()=>{}));var mm=(0,Ko.promisify)(Wo.lstat??(()=>{}));var Jo=class{filePath;formatType;subjectTokenFieldName;constructor(e){this.filePath=e.filePath;this.formatType=e.formatType;this.subjectTokenFieldName=e.subjectTokenFieldName}async getSubjectToken(){let e=this.filePath;try{e=await gm(e);if(!(await mm(e)).isFile()){throw new Error}}catch(r){if(r instanceof Error){r.message=`The file at ${e} does not exist, or it is not a file. ${r.message}`}throw r}let n;const i=await hm(e,{encoding:"utf8"});if(this.formatType==="text"){n=i}else if(this.formatType==="json"&&this.subjectTokenFieldName){const r=JSON.parse(i);n=r[this.subjectTokenFieldName]}if(!n){throw new Error("Unable to parse the subject_token from the credential_source file")}return n}};di.FileSubjectTokenSupplier=Jo});var sc=F(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:true});fi.UrlSubjectTokenSupplier=void 0;var ym=Pe();var Yo=class{url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(e){this.url=e.url;this.formatType=e.formatType;this.subjectTokenFieldName=e.subjectTokenFieldName;this.headers=e.headers;this.additionalGaxiosOptions=e.additionalGaxiosOptions}async getSubjectToken(e){const n={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers,responseType:this.formatType};ym.AuthClient.setMethodName(n,"getSubjectToken");let i;if(this.formatType==="text"){const r=await e.transporter.request(n);i=r.data}else if(this.formatType==="json"&&this.subjectTokenFieldName){const r=await e.transporter.request(n);i=r.data[this.subjectTokenFieldName]}if(!i){throw new Error("Unable to parse the subject_token from the credential_source URL")}return i}};fi.UrlSubjectTokenSupplier=Yo});var ac=F(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:true});Ne.CertificateSubjectTokenSupplier=Ne.InvalidConfigurationError=Ne.CertificateSourceUnavailableError=Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var pi=qe();var hi=z("fs");var gi=z("crypto");var Em=z("https");Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";var je=class extends Error{constructor(e){super(e);this.name="CertificateSourceUnavailableError"}};Ne.CertificateSourceUnavailableError=je;var Oe=class extends Error{constructor(e){super(e);this.name="InvalidConfigurationError"}};Ne.InvalidConfigurationError=Oe;var zo=class{certificateConfigPath;trustChainPath;cert;key;constructor(e){if(!e.useDefaultCertificateConfig&&!e.certificateConfigLocation){throw new Oe("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.")}if(e.useDefaultCertificateConfig&&e.certificateConfigLocation){throw new Oe("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.")}this.trustChainPath=e.trustChainPath;this.certificateConfigPath=e.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert){throw new Oe("Cannot create mTLS Agent with missing certificate or key")}return new Em.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#e();const{certPath:e,keyPath:n}=await this.#t();({cert:this.cert,key:this.key}=await this.#n(e,n));return await this.#i(this.cert)}async#e(){const e=this.certificateConfigPath;if(e){if(await(0,pi.isValidFile)(e)){return e}throw new je(`Provided certificate config path is invalid: ${e}`)}const n=process.env[Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(n){if(await(0,pi.isValidFile)(n)){return n}throw new je(`Path from environment variable "${Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${n}`)}const i=(0,pi.getWellKnownCertificateConfigFileLocation)();if(await(0,pi.isValidFile)(i)){return i}throw new je(`Could not find certificate configuration file. Searched override path, the "${Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${i}).`)}async#t(){const e=this.certificateConfigPath;let n;try{n=await hi.promises.readFile(e,"utf8")}catch(i){throw new je(`Failed to read certificate config file at: ${e}`)}try{const i=JSON.parse(n);const r=i?.cert_configs?.workload?.cert_path;const o=i?.cert_configs?.workload?.key_path;if(!r||!o){throw new Oe(`Certificate config file (${e}) is missing required "cert_path" or "key_path" in the workload config.`)}return{certPath:r,keyPath:o}}catch(i){if(i instanceof Oe)throw i;throw new Oe(`Failed to parse certificate config from ${e}: ${i.message}`)}}async#n(e,n){let i,r;try{i=await hi.promises.readFile(e);new gi.X509Certificate(i)}catch(o){const l=o instanceof Error?o.message:String(o);throw new je(`Failed to read certificate file at ${e}: ${l}`)}try{r=await hi.promises.readFile(n);(0,gi.createPrivateKey)(r)}catch(o){const l=o instanceof Error?o.message:String(o);throw new je(`Failed to read private key file at ${n}: ${l}`)}return{cert:i,key:r}}async#i(e){const n=new gi.X509Certificate(e);if(!this.trustChainPath){return JSON.stringify([n.raw.toString("base64")])}try{const i=await hi.promises.readFile(this.trustChainPath,"utf8");const r=i.match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[];const o=r.map((c,d)=>{try{return new gi.X509Certificate(c)}catch(f){const p=f instanceof Error?f.message:String(f);throw new Oe(`Failed to parse certificate at index ${d} in trust chain file ${this.trustChainPath}: ${p}`)}});const l=o.findIndex(c=>n.raw.equals(c.raw));let u;if(l===-1){u=[n,...o]}else if(l===0){u=o}else{throw new Oe(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${l}).`)}return JSON.stringify(u.map(c=>c.raw.toString("base64")))}catch(i){if(i instanceof Oe)throw i;const r=i instanceof Error?i.message:String(i);throw new je(`Failed to process certificate chain from ${this.trustChainPath}: ${r}`)}}};Ne.CertificateSubjectTokenSupplier=zo});var Zo=F(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:true});mi.IdentityPoolClient=void 0;var _m=pt();var Xo=qe();var Tm=oc();var Am=sc();var lc=ac();var Cm=ci();var uc=ge();var Qo=class t extends _m.BaseExternalAccountClient{subjectTokenSupplier;constructor(e){super(e);const n=(0,Xo.originalOrCamelOptions)(e);const i=n.get("credential_source");const r=n.get("subject_token_supplier");if(!i&&!r){throw new Error("A credential source or subject token supplier must be specified.")}if(i&&r){throw new Error("Only one of credential source or subject token supplier can be specified.")}if(r){this.subjectTokenSupplier=r;this.credentialSourceType="programmatic"}else{const o=(0,Xo.originalOrCamelOptions)(i);const l=(0,Xo.originalOrCamelOptions)(o.get("format"));const u=l.get("type")||"text";const c=l.get("subject_token_field_name");if(u!=="json"&&u!=="text"){throw new Error(`Invalid credential_source format "${u}"`)}if(u==="json"&&!c){throw new Error("Missing subject_token_field_name for JSON credential_source format")}const d=o.get("file");const f=o.get("url");const p=o.get("certificate");const h=o.get("headers");if(d&&f||f&&p||d&&p){throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}else if(d){this.credentialSourceType="file";this.subjectTokenSupplier=new Tm.FileSubjectTokenSupplier({filePath:d,formatType:u,subjectTokenFieldName:c})}else if(f){this.credentialSourceType="url";this.subjectTokenSupplier=new Am.UrlSubjectTokenSupplier({url:f,formatType:u,subjectTokenFieldName:c,headers:h,additionalGaxiosOptions:t.RETRY_CONFIG})}else if(p){this.credentialSourceType="certificate";const m=new lc.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:p.use_default_certificate_config,certificateConfigLocation:p.certificate_config_location,trustChainPath:p.trust_chain_path});this.subjectTokenSupplier=m}else{throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}}async retrieveSubjectToken(){const e=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof lc.CertificateSubjectTokenSupplier){const n=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new Cm.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new uc.Gaxios({agent:n})});this.transporter=new uc.Gaxios({...this.transporter.defaults||{},agent:n})}return e}};mi.IdentityPoolClient=Qo});var es=F(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:true});Ei.AwsRequestSigner=void 0;var yi=ge();var dc=fn();var cc="AWS4-HMAC-SHA256";var vm="aws4_request";var jo=class{getCredentials;region;crypto;constructor(e,n){this.getCredentials=e;this.region=n;this.crypto=(0,dc.createCrypto)()}async getRequestOptions(e){if(!e.url){throw new RangeError('"url" is required in "amzOptions"')}const n=typeof e.data==="object"?JSON.stringify(e.data):e.data;const i=e.url;const r=e.method||"GET";const o=e.body||n;const l=e.headers;const u=await this.getCredentials();const c=new URL(i);if(typeof o!=="string"&&o!==void 0){throw new TypeError(`'requestPayload' is expected to be a string if provided. Got: ${o}`)}const d=await Im({crypto:this.crypto,host:c.host,canonicalUri:c.pathname,canonicalQuerystring:c.search.slice(1),method:r,region:this.region,securityCredentials:u,requestPayload:o,additionalAmzHeaders:l});const f=yi.Gaxios.mergeHeaders(d.amzDate?{"x-amz-date":d.amzDate}:{},{authorization:d.authorizationHeader,host:c.host},l||{});if(u.token){yi.Gaxios.mergeHeaders(f,{"x-amz-security-token":u.token})}const p={url:i,method:r,headers:f};if(o!==void 0){p.body=o}return p}};Ei.AwsRequestSigner=jo;async function _n(t,e,n){return await t.signWithHmacSha256(e,n)}async function Sm(t,e,n,i,r){const o=await _n(t,`AWS4${e}`,n);const l=await _n(t,o,i);const u=await _n(t,l,r);const c=await _n(t,u,"aws4_request");return c}async function Im(t){const e=yi.Gaxios.mergeHeaders(t.additionalAmzHeaders);const n=t.requestPayload||"";const i=t.host.split(".")[0];const r=new Date;const o=r.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,"");const l=r.toISOString().replace(/[-]/g,"").replace(/T.*/,"");if(t.securityCredentials.token){e.set("x-amz-security-token",t.securityCredentials.token)}const u=yi.Gaxios.mergeHeaders({host:t.host},e.has("date")?{}:{"x-amz-date":o},e);let c="";const d=[...u.keys()].sort();d.forEach(G=>{c+=`${G}:${u.get(G)}
5
+ `;yield l;if(typeof r.content==="string"){yield r.content}else{yield*r.content}yield"\r\n"}yield i}static#o;static#s;static async#a(){this.#o||=(await import("./dist-WGTMUM3E.js")).HttpsProxyAgent;return this.#o}static async#l(){const e=typeof window!=="undefined"&&!!window;this.#s||=e?window.fetch:(await import("./src-YZ26EVSY.js")).default;return this.#s}static mergeHeaders(e,...n){e=e instanceof Headers?e:new Headers(e);for(const i of n){const r=i instanceof Headers?i:new Headers(i);r.forEach((o,l)=>{l==="set-cookie"?e.append(l,o):e.set(l,o)})}return e}};Dt.Gaxios=Ln;xt=Ln});var ge=F(_e=>{"use strict";var Ep=_e&&_e.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var _p=_e&&_e.__exportStar||function(t,e){for(var n in t)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n))Ep(e,t,n)};Object.defineProperty(_e,"__esModule",{value:true});_e.instance=_e.Gaxios=_e.GaxiosError=void 0;_e.request=Ap;var _l=El();Object.defineProperty(_e,"Gaxios",{enumerable:true,get:function(){return _l.Gaxios}});var Tp=wr();Object.defineProperty(_e,"GaxiosError",{enumerable:true,get:function(){return Tp.GaxiosError}});_p(Nr(),_e);_e.instance=new _l.Gaxios;async function Ap(t){return _e.instance.request(t)}});var Mr=F((Tl,Gn)=>{(function(t){"use strict";var e,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,r=Math.floor,o="[BigNumber Error] ",l=o+"Number primitive has more than 15 significant digits: ",u=1e14,c=14,d=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,h=1e9;function m(L){var R,q,V,k=b.prototype={constructor:b,toString:null,valueOf:null},$=new b(1),Y=20,Q=4,oe=-7,ee=21,re=-1e7,le=1e7,Se=false,Ie=1,ce=0,At={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},Ct="0123456789abcdefghijklmnopqrstuvwxyz",Er=true;function b(g,y){var E,N,S,w,x,C,I,M,P=this;if(!(P instanceof b))return new b(g,y);if(y==null){if(g&&g._isBigNumber===true){P.s=g.s;if(!g.c||g.e>le){P.c=P.e=null}else if(g.e<re){P.c=[P.e=0]}else{P.e=g.e;P.c=g.c.slice()}return}if((C=typeof g=="number")&&g*0==0){P.s=1/g<0?(g=-g,-1):1;if(g===~~g){for(w=0,x=g;x>=10;x/=10,w++);if(w>le){P.c=P.e=null}else{P.e=w;P.c=[g]}return}M=String(g)}else{if(!n.test(M=String(g)))return V(P,M,C);P.s=M.charCodeAt(0)==45?(M=M.slice(1),-1):1}if((w=M.indexOf("."))>-1)M=M.replace(".","");if((x=M.search(/e/i))>0){if(w<0)w=x;w+=+M.slice(x+1);M=M.substring(0,x)}else if(w<0){w=M.length}}else{v(y,2,Ct.length,"Base");if(y==10&&Er){P=new b(g);return Me(P,Y+P.e+1,Q)}M=String(g);if(C=typeof g=="number"){if(g*0!=0)return V(P,M,C,y);P.s=1/g<0?(M=M.slice(1),-1):1;if(b.DEBUG&&M.replace(/^0\.0*|\./,"").length>15){throw Error(l+g)}}else{P.s=M.charCodeAt(0)===45?(M=M.slice(1),-1):1}E=Ct.slice(0,y);w=x=0;for(I=M.length;x<I;x++){if(E.indexOf(N=M.charAt(x))<0){if(N=="."){if(x>w){w=I;continue}}else if(!S){if(M==M.toUpperCase()&&(M=M.toLowerCase())||M==M.toLowerCase()&&(M=M.toUpperCase())){S=true;x=-1;w=0;continue}}return V(P,String(g),C,y)}}C=false;M=q(M,y,10,P.s);if((w=M.indexOf("."))>-1)M=M.replace(".","");else w=M.length}for(x=0;M.charCodeAt(x)===48;x++);for(I=M.length;M.charCodeAt(--I)===48;);if(M=M.slice(x,++I)){I-=x;if(C&&b.DEBUG&&I>15&&(g>d||g!==r(g))){throw Error(l+P.s*g)}if((w=w-x-1)>le){P.c=P.e=null}else if(w<re){P.c=[P.e=0]}else{P.e=w;P.c=[];x=(w+1)%c;if(w<0)x+=c;if(x<I){if(x)P.c.push(+M.slice(0,x));for(I-=c;x<I;){P.c.push(+M.slice(x,x+=c))}x=c-(M=M.slice(x)).length}else{x-=I}for(;x--;M+="0");P.c.push(+M)}}else{P.c=[P.e=0]}}b.clone=m;b.ROUND_UP=0;b.ROUND_DOWN=1;b.ROUND_CEIL=2;b.ROUND_FLOOR=3;b.ROUND_HALF_UP=4;b.ROUND_HALF_DOWN=5;b.ROUND_HALF_EVEN=6;b.ROUND_HALF_CEIL=7;b.ROUND_HALF_FLOOR=8;b.EUCLID=9;b.config=b.set=function(g){var y,E;if(g!=null){if(typeof g=="object"){if(g.hasOwnProperty(y="DECIMAL_PLACES")){E=g[y];v(E,0,h,y);Y=E}if(g.hasOwnProperty(y="ROUNDING_MODE")){E=g[y];v(E,0,8,y);Q=E}if(g.hasOwnProperty(y="EXPONENTIAL_AT")){E=g[y];if(E&&E.pop){v(E[0],-h,0,y);v(E[1],0,h,y);oe=E[0];ee=E[1]}else{v(E,-h,h,y);oe=-(ee=E<0?-E:E)}}if(g.hasOwnProperty(y="RANGE")){E=g[y];if(E&&E.pop){v(E[0],-h,-1,y);v(E[1],1,h,y);re=E[0];le=E[1]}else{v(E,-h,h,y);if(E){re=-(le=E<0?-E:E)}else{throw Error(o+y+" cannot be zero: "+E)}}}if(g.hasOwnProperty(y="CRYPTO")){E=g[y];if(E===!!E){if(E){if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes)){Se=E}else{Se=!E;throw Error(o+"crypto unavailable")}}else{Se=E}}else{throw Error(o+y+" not true or false: "+E)}}if(g.hasOwnProperty(y="MODULO_MODE")){E=g[y];v(E,0,9,y);Ie=E}if(g.hasOwnProperty(y="POW_PRECISION")){E=g[y];v(E,0,h,y);ce=E}if(g.hasOwnProperty(y="FORMAT")){E=g[y];if(typeof E=="object")At=E;else throw Error(o+y+" not an object: "+E)}if(g.hasOwnProperty(y="ALPHABET")){E=g[y];if(typeof E=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(E)){Er=E.slice(0,10)=="0123456789";Ct=E}else{throw Error(o+y+" invalid: "+E)}}}else{throw Error(o+"Object expected: "+g)}}return{DECIMAL_PLACES:Y,ROUNDING_MODE:Q,EXPONENTIAL_AT:[oe,ee],RANGE:[re,le],CRYPTO:Se,MODULO_MODE:Ie,POW_PRECISION:ce,FORMAT:At,ALPHABET:Ct}};b.isBigNumber=function(g){if(!g||g._isBigNumber!==true)return false;if(!b.DEBUG)return true;var y,E,N=g.c,S=g.e,w=g.s;e:if({}.toString.call(N)=="[object Array]"){if((w===1||w===-1)&&S>=-h&&S<=h&&S===r(S)){if(N[0]===0){if(S===0&&N.length===1)return true;break e}y=(S+1)%c;if(y<1)y+=c;if(String(N[0]).length==y){for(y=0;y<N.length;y++){E=N[y];if(E<0||E>=u||E!==r(E))break e}if(E!==0)return true}}}else if(N===null&&S===null&&(w===null||w===1||w===-1)){return true}throw Error(o+"Invalid BigNumber: "+g)};b.maximum=b.max=function(){return Ba(arguments,-1)};b.minimum=b.min=function(){return Ba(arguments,1)};b.random=(function(){var g=9007199254740992;var y=Math.random()*g&2097151?function(){return r(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(E){var N,S,w,x,C,I=0,M=[],P=new b($);if(E==null)E=Y;else v(E,0,h);x=i(E/c);if(Se){if(crypto.getRandomValues){N=crypto.getRandomValues(new Uint32Array(x*=2));for(;I<x;){C=N[I]*131072+(N[I+1]>>>11);if(C>=9e15){S=crypto.getRandomValues(new Uint32Array(2));N[I]=S[0];N[I+1]=S[1]}else{M.push(C%1e14);I+=2}}I=x/2}else if(crypto.randomBytes){N=crypto.randomBytes(x*=7);for(;I<x;){C=(N[I]&31)*281474976710656+N[I+1]*1099511627776+N[I+2]*4294967296+N[I+3]*16777216+(N[I+4]<<16)+(N[I+5]<<8)+N[I+6];if(C>=9e15){crypto.randomBytes(7).copy(N,I)}else{M.push(C%1e14);I+=7}}I=x/7}else{Se=false;throw Error(o+"crypto unavailable")}}if(!Se){for(;I<x;){C=y();if(C<9e15)M[I++]=C%1e14}}x=M[--I];E%=c;if(x&&E){C=f[c-E];M[I]=r(x/C)*C}for(;M[I]===0;M.pop(),I--);if(I<0){M=[w=0]}else{for(w=-1;M[0]===0;M.splice(0,1),w-=c);for(I=1,C=M[0];C>=10;C/=10,I++);if(I<c)w-=c-I}P.e=w;P.c=M;return P}})();b.sum=function(){var g=1,y=arguments,E=new b(y[0]);for(;g<y.length;)E=E.plus(y[g++]);return E};q=(function(){var g="0123456789";function y(E,N,S,w){var x,C=[0],I,M=0,P=E.length;for(;M<P;){for(I=C.length;I--;C[I]*=N);C[0]+=w.indexOf(E.charAt(M++));for(x=0;x<C.length;x++){if(C[x]>S-1){if(C[x+1]==null)C[x+1]=0;C[x+1]+=C[x]/S|0;C[x]%=S}}}return C.reverse()}return function(E,N,S,w,x){var C,I,M,P,U,J,K,te,se=E.indexOf("."),pe=Y,Z=Q;if(se>=0){P=ce;ce=0;E=E.replace(".","");te=new b(N);J=te.pow(E.length-se);ce=P;te.c=y(O(A(J.c),J.e,"0"),10,S,g);te.e=te.c.length}K=y(E,N,S,x?(C=Ct,g):(C=g,Ct));M=P=K.length;for(;K[--P]==0;K.pop());if(!K[0])return C.charAt(0);if(se<0){--M}else{J.c=K;J.e=M;J.s=w;J=R(J,te,pe,Z,S);K=J.c;U=J.r;M=J.e}I=M+pe+1;se=K[I];P=S/2;U=U||I<0||K[I+1]!=null;U=Z<4?(se!=null||U)&&(Z==0||Z==(J.s<0?3:2)):se>P||se==P&&(Z==4||U||Z==6&&K[I-1]&1||Z==(J.s<0?8:7));if(I<1||!K[0]){E=U?O(C.charAt(1),-pe,C.charAt(0)):C.charAt(0)}else{K.length=I;if(U){for(--S;++K[--I]>S;){K[I]=0;if(!I){++M;K=[1].concat(K)}}}for(P=K.length;!K[--P];);for(se=0,E="";se<=P;E+=C.charAt(K[se++]));E=O(E,M,C.charAt(0))}return E}})();R=(function(){function g(N,S,w){var x,C,I,M,P=0,U=N.length,J=S%p,K=S/p|0;for(N=N.slice();U--;){I=N[U]%p;M=N[U]/p|0;x=K*I+M*J;C=J*I+x%p*p+P;P=(C/w|0)+(x/p|0)+K*M;N[U]=C%w}if(P)N=[P].concat(N);return N}function y(N,S,w,x){var C,I;if(w!=x){I=w>x?1:-1}else{for(C=I=0;C<w;C++){if(N[C]!=S[C]){I=N[C]>S[C]?1:-1;break}}}return I}function E(N,S,w,x){var C=0;for(;w--;){N[w]-=C;C=N[w]<S[w]?1:0;N[w]=C*x+N[w]-S[w]}for(;!N[0]&&N.length>1;N.splice(0,1));}return function(N,S,w,x,C){var I,M,P,U,J,K,te,se,pe,Z,ne,me,Mn,Ar,Cr,ze,sn,ke=N.s==S.s?1:-1,Ee=N.c,ae=S.c;if(!Ee||!Ee[0]||!ae||!ae[0]){return new b(!N.s||!S.s||(Ee?ae&&Ee[0]==ae[0]:!ae)?NaN:Ee&&Ee[0]==0||!ae?ke*0:ke/0)}se=new b(ke);pe=se.c=[];M=N.e-S.e;ke=w+M+1;if(!C){C=u;M=_(N.e/c)-_(S.e/c);ke=ke/c|0}for(P=0;ae[P]==(Ee[P]||0);P++);if(ae[P]>(Ee[P]||0))M--;if(ke<0){pe.push(1);U=true}else{Ar=Ee.length;ze=ae.length;P=0;ke+=2;J=r(C/(ae[0]+1));if(J>1){ae=g(ae,J,C);Ee=g(Ee,J,C);ze=ae.length;Ar=Ee.length}Mn=ze;Z=Ee.slice(0,ze);ne=Z.length;for(;ne<ze;Z[ne++]=0);sn=ae.slice();sn=[0].concat(sn);Cr=ae[0];if(ae[1]>=C/2)Cr++;do{J=0;I=y(ae,Z,ze,ne);if(I<0){me=Z[0];if(ze!=ne)me=me*C+(Z[1]||0);J=r(me/Cr);if(J>1){if(J>=C)J=C-1;K=g(ae,J,C);te=K.length;ne=Z.length;while(y(K,Z,te,ne)==1){J--;E(K,ze<te?sn:ae,te,C);te=K.length;I=1}}else{if(J==0){I=J=1}K=ae.slice();te=K.length}if(te<ne)K=[0].concat(K);E(Z,K,ne,C);ne=Z.length;if(I==-1){while(y(ae,Z,ze,ne)<1){J++;E(Z,ze<ne?sn:ae,ne,C);ne=Z.length}}}else if(I===0){J++;Z=[0]}pe[P++]=J;if(Z[0]){Z[ne++]=Ee[Mn]||0}else{Z=[Ee[Mn]];ne=1}}while((Mn++<Ar||Z[0]!=null)&&ke--);U=Z[0]!=null;if(!pe[0])pe.splice(0,1)}if(C==u){for(P=1,ke=pe[0];ke>=10;ke/=10,P++);Me(se,w+(se.e=P+M*c-1)+1,x,U)}else{se.e=M;se.r=+U}return se}})();function _r(g,y,E,N){var S,w,x,C,I;if(E==null)E=Q;else v(E,0,8);if(!g.c)return g.toString();S=g.c[0];x=g.e;if(y==null){I=A(g.c);I=N==1||N==2&&(x<=oe||x>=ee)?D(I,x):O(I,x,"0")}else{g=Me(new b(g),y,E);w=g.e;I=A(g.c);C=I.length;if(N==1||N==2&&(y<=w||w<=oe)){for(;C<y;I+="0",C++);I=D(I,w)}else{y-=x+(N===2&&w>x);I=O(I,w,"0");if(w+1>C){if(--y>0)for(I+=".";y--;I+="0");}else{y+=w-C;if(y>0){if(w+1==C)I+=".";for(;y--;I+="0");}}}}return g.s<0&&S?"-"+I:I}function Ba(g,y){var E,N,S=1,w=new b(g[0]);for(;S<g.length;S++){N=new b(g[S]);if(!N.s||(E=T(w,N))===y||E===0&&w.s===y){w=N}}return w}function Tr(g,y,E){var N=1,S=y.length;for(;!y[--S];y.pop());for(S=y[0];S>=10;S/=10,N++);if((E=N+E*c-1)>le){g.c=g.e=null}else if(E<re){g.c=[g.e=0]}else{g.e=E;g.c=y}return g}V=(function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,E=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,S=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(w,x,C,I){var M,P=C?x:x.replace(S,"");if(N.test(P)){w.s=isNaN(P)?null:P<0?-1:1}else{if(!C){P=P.replace(g,function(U,J,K){M=(K=K.toLowerCase())=="x"?16:K=="b"?2:8;return!I||I==M?J:U});if(I){M=I;P=P.replace(y,"$1").replace(E,"0.$1")}if(x!=P)return new b(P,M)}if(b.DEBUG){throw Error(o+"Not a"+(I?" base "+I:"")+" number: "+x)}w.s=null}w.c=w.e=null}})();function Me(g,y,E,N){var S,w,x,C,I,M,P,U=g.c,J=f;if(U){e:{for(S=1,C=U[0];C>=10;C/=10,S++);w=y-S;if(w<0){w+=c;x=y;I=U[M=0];P=r(I/J[S-x-1]%10)}else{M=i((w+1)/c);if(M>=U.length){if(N){for(;U.length<=M;U.push(0));I=P=0;S=1;w%=c;x=w-c+1}else{break e}}else{I=C=U[M];for(S=1;C>=10;C/=10,S++);w%=c;x=w-c+S;P=x<0?0:r(I/J[S-x-1]%10)}}N=N||y<0||U[M+1]!=null||(x<0?I:I%J[S-x-1]);N=E<4?(P||N)&&(E==0||E==(g.s<0?3:2)):P>5||P==5&&(E==4||N||E==6&&(w>0?x>0?I/J[S-x]:0:U[M-1])%10&1||E==(g.s<0?8:7));if(y<1||!U[0]){U.length=0;if(N){y-=g.e+1;U[0]=J[(c-y%c)%c];g.e=-y||0}else{U[0]=g.e=0}return g}if(w==0){U.length=M;C=1;M--}else{U.length=M+1;C=J[c-w];U[M]=x>0?r(I/J[S-x]%J[x])*C:0}if(N){for(;;){if(M==0){for(w=1,x=U[0];x>=10;x/=10,w++);x=U[0]+=C;for(C=1;x>=10;x/=10,C++);if(w!=C){g.e++;if(U[0]==u)U[0]=1}break}else{U[M]+=C;if(U[M]!=u)break;U[M--]=0;C=1}}}for(w=U.length;U[--w]===0;U.pop());}if(g.e>le){g.c=g.e=null}else if(g.e<re){g.c=[g.e=0]}}return g}function nt(g){var y,E=g.e;if(E===null)return g.toString();y=A(g.c);y=E<=oe||E>=ee?D(y,E):O(y,E,"0");return g.s<0?"-"+y:y}k.absoluteValue=k.abs=function(){var g=new b(this);if(g.s<0)g.s=1;return g};k.comparedTo=function(g,y){return T(this,new b(g,y))};k.decimalPlaces=k.dp=function(g,y){var E,N,S,w=this;if(g!=null){v(g,0,h);if(y==null)y=Q;else v(y,0,8);return Me(new b(w),g+w.e+1,y)}if(!(E=w.c))return null;N=((S=E.length-1)-_(this.e/c))*c;if(S=E[S])for(;S%10==0;S/=10,N--);if(N<0)N=0;return N};k.dividedBy=k.div=function(g,y){return R(this,new b(g,y),Y,Q)};k.dividedToIntegerBy=k.idiv=function(g,y){return R(this,new b(g,y),0,1)};k.exponentiatedBy=k.pow=function(g,y){var E,N,S,w,x,C,I,M,P,U=this;g=new b(g);if(g.c&&!g.isInteger()){throw Error(o+"Exponent not an integer: "+nt(g))}if(y!=null)y=new b(y);C=g.e>14;if(!U.c||!U.c[0]||U.c[0]==1&&!U.e&&U.c.length==1||!g.c||!g.c[0]){P=new b(Math.pow(+nt(U),C?g.s*(2-G(g)):+nt(g)));return y?P.mod(y):P}I=g.s<0;if(y){if(y.c?!y.c[0]:!y.s)return new b(NaN);N=!I&&U.isInteger()&&y.isInteger();if(N)U=U.mod(y)}else if(g.e>9&&(U.e>0||U.e<-1||(U.e==0?U.c[0]>1||C&&U.c[1]>=24e7:U.c[0]<8e13||C&&U.c[0]<=9999975e7))){w=U.s<0&&G(g)?-0:0;if(U.e>-1)w=1/w;return new b(I?1/w:w)}else if(ce){w=i(ce/c+2)}if(C){E=new b(.5);if(I)g.s=1;M=G(g)}else{S=Math.abs(+nt(g));M=S%2}P=new b($);for(;;){if(M){P=P.times(U);if(!P.c)break;if(w){if(P.c.length>w)P.c.length=w}else if(N){P=P.mod(y)}}if(S){S=r(S/2);if(S===0)break;M=S%2}else{g=g.times(E);Me(g,g.e+1,1);if(g.e>14){M=G(g)}else{S=+nt(g);if(S===0)break;M=S%2}}U=U.times(U);if(w){if(U.c&&U.c.length>w)U.c.length=w}else if(N){U=U.mod(y)}}if(N)return P;if(I)P=$.div(P);return y?P.mod(y):w?Me(P,ce,Q,x):P};k.integerValue=function(g){var y=new b(this);if(g==null)g=Q;else v(g,0,8);return Me(y,y.e+1,g)};k.isEqualTo=k.eq=function(g,y){return T(this,new b(g,y))===0};k.isFinite=function(){return!!this.c};k.isGreaterThan=k.gt=function(g,y){return T(this,new b(g,y))>0};k.isGreaterThanOrEqualTo=k.gte=function(g,y){return(y=T(this,new b(g,y)))===1||y===0};k.isInteger=function(){return!!this.c&&_(this.e/c)>this.c.length-2};k.isLessThan=k.lt=function(g,y){return T(this,new b(g,y))<0};k.isLessThanOrEqualTo=k.lte=function(g,y){return(y=T(this,new b(g,y)))===-1||y===0};k.isNaN=function(){return!this.s};k.isNegative=function(){return this.s<0};k.isPositive=function(){return this.s>0};k.isZero=function(){return!!this.c&&this.c[0]==0};k.minus=function(g,y){var E,N,S,w,x=this,C=x.s;g=new b(g,y);y=g.s;if(!C||!y)return new b(NaN);if(C!=y){g.s=-y;return x.plus(g)}var I=x.e/c,M=g.e/c,P=x.c,U=g.c;if(!I||!M){if(!P||!U)return P?(g.s=-y,g):new b(U?x:NaN);if(!P[0]||!U[0]){return U[0]?(g.s=-y,g):new b(P[0]?x:Q==3?-0:0)}}I=_(I);M=_(M);P=P.slice();if(C=I-M){if(w=C<0){C=-C;S=P}else{M=I;S=U}S.reverse();for(y=C;y--;S.push(0));S.reverse()}else{N=(w=(C=P.length)<(y=U.length))?C:y;for(C=y=0;y<N;y++){if(P[y]!=U[y]){w=P[y]<U[y];break}}}if(w){S=P;P=U;U=S;g.s=-g.s}y=(N=U.length)-(E=P.length);if(y>0)for(;y--;P[E++]=0);y=u-1;for(;N>C;){if(P[--N]<U[N]){for(E=N;E&&!P[--E];P[E]=y);--P[E];P[N]+=u}P[N]-=U[N]}for(;P[0]==0;P.splice(0,1),--M);if(!P[0]){g.s=Q==3?-1:1;g.c=[g.e=0];return g}return Tr(g,P,M)};k.modulo=k.mod=function(g,y){var E,N,S=this;g=new b(g,y);if(!S.c||!g.s||g.c&&!g.c[0]){return new b(NaN)}else if(!g.c||S.c&&!S.c[0]){return new b(S)}if(Ie==9){N=g.s;g.s=1;E=R(S,g,0,3);g.s=N;E.s*=N}else{E=R(S,g,0,Ie)}g=S.minus(E.times(g));if(!g.c[0]&&Ie==1)g.s=S.s;return g};k.multipliedBy=k.times=function(g,y){var E,N,S,w,x,C,I,M,P,U,J,K,te,se,pe,Z=this,ne=Z.c,me=(g=new b(g,y)).c;if(!ne||!me||!ne[0]||!me[0]){if(!Z.s||!g.s||ne&&!ne[0]&&!me||me&&!me[0]&&!ne){g.c=g.e=g.s=null}else{g.s*=Z.s;if(!ne||!me){g.c=g.e=null}else{g.c=[0];g.e=0}}return g}N=_(Z.e/c)+_(g.e/c);g.s*=Z.s;I=ne.length;U=me.length;if(I<U){te=ne;ne=me;me=te;S=I;I=U;U=S}for(S=I+U,te=[];S--;te.push(0));se=u;pe=p;for(S=U;--S>=0;){E=0;J=me[S]%pe;K=me[S]/pe|0;for(x=I,w=S+x;w>S;){M=ne[--x]%pe;P=ne[x]/pe|0;C=K*M+P*J;M=J*M+C%pe*pe+te[w]+E;E=(M/se|0)+(C/pe|0)+K*P;te[w--]=M%se}te[w]=E}if(E){++N}else{te.splice(0,1)}return Tr(g,te,N)};k.negated=function(){var g=new b(this);g.s=-g.s||null;return g};k.plus=function(g,y){var E,N=this,S=N.s;g=new b(g,y);y=g.s;if(!S||!y)return new b(NaN);if(S!=y){g.s=-y;return N.minus(g)}var w=N.e/c,x=g.e/c,C=N.c,I=g.c;if(!w||!x){if(!C||!I)return new b(S/0);if(!C[0]||!I[0])return I[0]?g:new b(C[0]?N:S*0)}w=_(w);x=_(x);C=C.slice();if(S=w-x){if(S>0){x=w;E=I}else{S=-S;E=C}E.reverse();for(;S--;E.push(0));E.reverse()}S=C.length;y=I.length;if(S-y<0){E=I;I=C;C=E;y=S}for(S=0;y;){S=(C[--y]=C[y]+I[y]+S)/u|0;C[y]=u===C[y]?0:C[y]%u}if(S){C=[S].concat(C);++x}return Tr(g,C,x)};k.precision=k.sd=function(g,y){var E,N,S,w=this;if(g!=null&&g!==!!g){v(g,1,h);if(y==null)y=Q;else v(y,0,8);return Me(new b(w),g,y)}if(!(E=w.c))return null;S=E.length-1;N=S*c+1;if(S=E[S]){for(;S%10==0;S/=10,N--);for(S=E[0];S>=10;S/=10,N++);}if(g&&w.e+1>N)N=w.e+1;return N};k.shiftedBy=function(g){v(g,-d,d);return this.times("1e"+g)};k.squareRoot=k.sqrt=function(){var g,y,E,N,S,w=this,x=w.c,C=w.s,I=w.e,M=Y+4,P=new b("0.5");if(C!==1||!x||!x[0]){return new b(!C||C<0&&(!x||x[0])?NaN:x?w:1/0)}C=Math.sqrt(+nt(w));if(C==0||C==1/0){y=A(x);if((y.length+I)%2==0)y+="0";C=Math.sqrt(+y);I=_((I+1)/2)-(I<0||I%2);if(C==1/0){y="5e"+I}else{y=C.toExponential();y=y.slice(0,y.indexOf("e")+1)+I}E=new b(y)}else{E=new b(C+"")}if(E.c[0]){I=E.e;C=I+M;if(C<3)C=0;for(;;){S=E;E=P.times(S.plus(R(w,S,M,1)));if(A(S.c).slice(0,C)===(y=A(E.c)).slice(0,C)){if(E.e<I)--C;y=y.slice(C-3,C+1);if(y=="9999"||!N&&y=="4999"){if(!N){Me(S,S.e+Y+2,0);if(S.times(S).eq(w)){E=S;break}}M+=4;C+=4;N=1}else{if(!+y||!+y.slice(1)&&y.charAt(0)=="5"){Me(E,E.e+Y+2,1);g=!E.times(E).eq(w)}break}}}}return Me(E,E.e+Y+1,Q,g)};k.toExponential=function(g,y){if(g!=null){v(g,0,h);g++}return _r(this,g,y,1)};k.toFixed=function(g,y){if(g!=null){v(g,0,h);g=g+this.e+1}return _r(this,g,y)};k.toFormat=function(g,y,E){var N,S=this;if(E==null){if(g!=null&&y&&typeof y=="object"){E=y;y=null}else if(g&&typeof g=="object"){E=g;g=y=null}else{E=At}}else if(typeof E!="object"){throw Error(o+"Argument not an object: "+E)}N=S.toFixed(g,y);if(S.c){var w,x=N.split("."),C=+E.groupSize,I=+E.secondaryGroupSize,M=E.groupSeparator||"",P=x[0],U=x[1],J=S.s<0,K=J?P.slice(1):P,te=K.length;if(I){w=C;C=I;I=w;te-=w}if(C>0&&te>0){w=te%C||C;P=K.substr(0,w);for(;w<te;w+=C)P+=M+K.substr(w,C);if(I>0)P+=M+K.slice(w);if(J)P="-"+P}N=U?P+(E.decimalSeparator||"")+((I=+E.fractionGroupSize)?U.replace(new RegExp("\\d{"+I+"}\\B","g"),"$&"+(E.fractionGroupSeparator||"")):U):P}return(E.prefix||"")+N+(E.suffix||"")};k.toFraction=function(g){var y,E,N,S,w,x,C,I,M,P,U,J,K=this,te=K.c;if(g!=null){C=new b(g);if(!C.isInteger()&&(C.c||C.s!==1)||C.lt($)){throw Error(o+"Argument "+(C.isInteger()?"out of range: ":"not an integer: ")+nt(C))}}if(!te)return new b(K);y=new b($);M=E=new b($);N=I=new b($);J=A(te);w=y.e=J.length-K.e-1;y.c[0]=f[(x=w%c)<0?c+x:x];g=!g||C.comparedTo(y)>0?w>0?y:M:C;x=le;le=1/0;C=new b(J);I.c[0]=0;for(;;){P=R(C,y,0,1);S=E.plus(P.times(N));if(S.comparedTo(g)==1)break;E=N;N=S;M=I.plus(P.times(S=M));I=S;y=C.minus(P.times(S=y));C=S}S=R(g.minus(E),N,0,1);I=I.plus(S.times(M));E=E.plus(S.times(N));I.s=M.s=K.s;w=w*2;U=R(M,N,w,Q).minus(K).abs().comparedTo(R(I,E,w,Q).minus(K).abs())<1?[M,N]:[I,E];le=x;return U};k.toNumber=function(){return+nt(this)};k.toPrecision=function(g,y){if(g!=null)v(g,1,h);return _r(this,g,y,2)};k.toString=function(g){var y,E=this,N=E.s,S=E.e;if(S===null){if(N){y="Infinity";if(N<0)y="-"+y}else{y="NaN"}}else{if(g==null){y=S<=oe||S>=ee?D(A(E.c),S):O(A(E.c),S,"0")}else if(g===10&&Er){E=Me(new b(E),Y+S+1,Q);y=O(A(E.c),E.e,"0")}else{v(g,2,Ct.length,"Base");y=q(O(A(E.c),S,"0"),10,g,N,true)}if(N<0&&E.c[0])y="-"+y}return y};k.valueOf=k.toJSON=function(){return nt(this)};k._isBigNumber=true;if(L!=null)b.set(L);return b}function _(L){var R=L|0;return L>0||L===R?R:R-1}function A(L){var R,q,V=1,k=L.length,$=L[0]+"";for(;V<k;){R=L[V++]+"";q=c-R.length;for(;q--;R="0"+R);$+=R}for(k=$.length;$.charCodeAt(--k)===48;);return $.slice(0,k+1||1)}function T(L,R){var q,V,k=L.c,$=R.c,Y=L.s,Q=R.s,oe=L.e,ee=R.e;if(!Y||!Q)return null;q=k&&!k[0];V=$&&!$[0];if(q||V)return q?V?0:-Q:Y;if(Y!=Q)return Y;q=Y<0;V=oe==ee;if(!k||!$)return V?0:!k^q?1:-1;if(!V)return oe>ee^q?1:-1;Q=(oe=k.length)<(ee=$.length)?oe:ee;for(Y=0;Y<Q;Y++)if(k[Y]!=$[Y])return k[Y]>$[Y]^q?1:-1;return oe==ee?0:oe>ee^q?1:-1}function v(L,R,q,V){if(L<R||L>q||L!==r(L)){throw Error(o+(V||"Argument")+(typeof L=="number"?L<R||L>q?" out of range: ":" not an integer: ":" not a primitive number: ")+String(L))}}function G(L){var R=L.c.length-1;return _(L.e/c)==R&&L.c[R]%2!=0}function D(L,R){return(L.length>1?L.charAt(0)+"."+L.slice(1):L)+(R<0?"e":"e+")+R}function O(L,R,q){var V,k;if(R<0){for(k=q+".";++R;k+=q);L=k+L}else{V=L.length;if(++R>V){for(k=q,R-=V;--R;k+=q);L+=k}else if(R<V){L=L.slice(0,R)+"."+L.slice(R)}}return L}e=m();e["default"]=e.BigNumber=e;if(typeof define=="function"&&define.amd){define(function(){return e})}else if(typeof Gn!="undefined"&&Gn.exports){Gn.exports=e}else{if(!t){t=typeof self!="undefined"&&self?self:window}t.BigNumber=e}})(Tl)});var Sl=F((GS,vl)=>{var Al=Mr();var Cl=vl.exports;(function(){"use strict";function t(d){return d<10?"0"+d:d}var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i,r,o={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},l;function u(d){n.lastIndex=0;return n.test(d)?'"'+d.replace(n,function(f){var p=o[f];return typeof p==="string"?p:"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+d+'"'}function c(d,f){var p,h,m,_,A=i,T,v=f[d],G=v!=null&&(v instanceof Al||Al.isBigNumber(v));if(v&&typeof v==="object"&&typeof v.toJSON==="function"){v=v.toJSON(d)}if(typeof l==="function"){v=l.call(f,d,v)}switch(typeof v){case"string":if(G){return v}else{return u(v)}case"number":return isFinite(v)?String(v):"null";case"boolean":case"null":case"bigint":return String(v);case"object":if(!v){return"null"}i+=r;T=[];if(Object.prototype.toString.apply(v)==="[object Array]"){_=v.length;for(p=0;p<_;p+=1){T[p]=c(p,v)||"null"}m=T.length===0?"[]":i?"[\n"+i+T.join(",\n"+i)+"\n"+A+"]":"["+T.join(",")+"]";i=A;return m}if(l&&typeof l==="object"){_=l.length;for(p=0;p<_;p+=1){if(typeof l[p]==="string"){h=l[p];m=c(h,v);if(m){T.push(u(h)+(i?": ":":")+m)}}}}else{Object.keys(v).forEach(function(D){var O=c(D,v);if(O){T.push(u(D)+(i?": ":":")+O)}})}m=T.length===0?"{}":i?"{\n"+i+T.join(",\n"+i)+"\n"+A+"}":"{"+T.join(",")+"}";i=A;return m}}if(typeof Cl.stringify!=="function"){Cl.stringify=function(d,f,p){var h;i="";r="";if(typeof p==="number"){for(h=0;h<p;h+=1){r+=" "}}else if(typeof p==="string"){r=p}l=f;if(f&&typeof f!=="function"&&(typeof f!=="object"||typeof f.length!=="number")){throw new Error("JSON.stringify")}return c("",{"":d})}}})()});var wl=F((OS,Il)=>{var On=null;var Cp=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;var vp=/(?: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 Sp=function(t){"use strict";var e={strict:false,storeAsString:false,alwaysParseAsBig:false,useNativeBigInt:false,protoAction:"error",constructorAction:"error"};if(t!==void 0&&t!==null){if(t.strict===true){e.strict=true}if(t.storeAsString===true){e.storeAsString=true}e.alwaysParseAsBig=t.alwaysParseAsBig===true?t.alwaysParseAsBig:false;e.useNativeBigInt=t.useNativeBigInt===true?t.useNativeBigInt:false;if(typeof t.constructorAction!=="undefined"){if(t.constructorAction==="error"||t.constructorAction==="ignore"||t.constructorAction==="preserve"){e.constructorAction=t.constructorAction}else{throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${t.constructorAction}`)}}if(typeof t.protoAction!=="undefined"){if(t.protoAction==="error"||t.protoAction==="ignore"||t.protoAction==="preserve"){e.protoAction=t.protoAction}else{throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${t.protoAction}`)}}}var n,i,r={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},o,l=function(A){throw{name:"SyntaxError",message:A,at:n,text:o}},u=function(A){if(A&&A!==i){l("Expected '"+A+"' instead of '"+i+"'")}i=o.charAt(n);n+=1;return i},c=function(){var A,T="";if(i==="-"){T="-";u("-")}while(i>="0"&&i<="9"){T+=i;u()}if(i==="."){T+=".";while(u()&&i>="0"&&i<="9"){T+=i}}if(i==="e"||i==="E"){T+=i;u();if(i==="-"||i==="+"){T+=i;u()}while(i>="0"&&i<="9"){T+=i;u()}}A=+T;if(!isFinite(A)){l("Bad number")}else{if(On==null)On=Mr();if(T.length>15)return e.storeAsString?T:e.useNativeBigInt?BigInt(T):new On(T);else return!e.alwaysParseAsBig?A:e.useNativeBigInt?BigInt(A):new On(A)}},d=function(){var A,T,v="",G;if(i==='"'){var D=n;while(u()){if(i==='"'){if(n-1>D)v+=o.substring(D,n-1);u();return v}if(i==="\\"){if(n-1>D)v+=o.substring(D,n-1);u();if(i==="u"){G=0;for(T=0;T<4;T+=1){A=parseInt(u(),16);if(!isFinite(A)){break}G=G*16+A}v+=String.fromCharCode(G)}else if(typeof r[i]==="string"){v+=r[i]}else{break}D=n}}}l("Bad string")},f=function(){while(i&&i<=" "){u()}},p=function(){switch(i){case"t":u("t");u("r");u("u");u("e");return true;case"f":u("f");u("a");u("l");u("s");u("e");return false;case"n":u("n");u("u");u("l");u("l");return null}l("Unexpected '"+i+"'")},h,m=function(){var A=[];if(i==="["){u("[");f();if(i==="]"){u("]");return A}while(i){A.push(h());f();if(i==="]"){u("]");return A}u(",");f()}}l("Bad array")},_=function(){var A,T=Object.create(null);if(i==="{"){u("{");f();if(i==="}"){u("}");return T}while(i){A=d();f();u(":");if(e.strict===true&&Object.hasOwnProperty.call(T,A)){l('Duplicate key "'+A+'"')}if(Cp.test(A)===true){if(e.protoAction==="error"){l("Object contains forbidden prototype property")}else if(e.protoAction==="ignore"){h()}else{T[A]=h()}}else if(vp.test(A)===true){if(e.constructorAction==="error"){l("Object contains forbidden constructor property")}else if(e.constructorAction==="ignore"){h()}else{T[A]=h()}}else{T[A]=h()}f();if(i==="}"){u("}");return T}u(",");f()}}l("Bad object")};h=function(){f();switch(i){case"{":return _();case"[":return m();case'"':return d();case"-":return c();default:return i>="0"&&i<="9"?c():p()}};return function(A,T){var v;o=A+"";n=0;i=" ";v=h();f();if(i){l("Syntax error")}return typeof T==="function"?(function G(D,O){var L,R,q=D[O];if(q&&typeof q==="object"){Object.keys(q).forEach(function(V){R=G(q,V);if(R!==void 0){q[V]=R}else{delete q[V]}})}return T.call(D,O,q)})({"":v},""):v}};Il.exports=Sp});var Nl=F((bS,bn)=>{var Rl=Sl().stringify;var Pl=wl();bn.exports=function(t){return{parse:Pl(t),stringify:Rl}};bn.exports.parse=Pl();bn.exports.stringify=Rl});var kr=F(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:true});be.GCE_LINUX_BIOS_PATHS=void 0;be.isGoogleCloudServerless=xl;be.isGoogleComputeEngineLinux=Dl;be.isGoogleComputeEngineMACAddress=Ul;be.isGoogleComputeEngine=Ll;be.detectGCPResidency=wp;var Ml=z("fs");var kl=z("os");be.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var Ip=/^42:01/;function xl(){const t=process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE;return!!t}function Dl(){if((0,kl.platform)()!=="linux")return false;try{(0,Ml.statSync)(be.GCE_LINUX_BIOS_PATHS.BIOS_DATE);const t=(0,Ml.readFileSync)(be.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(t)}catch{return false}}function Ul(){const t=(0,kl.networkInterfaces)();for(const e of Object.values(t)){if(!e)continue;for(const{mac:n}of e){if(Ip.test(n)){return true}}}return false}function Ll(){return Dl()||Ul()}function wp(){return xl()||Ll()}});var Gl=F(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:true});Fn.Colours=void 0;var ye=class t{static isEnabled(e){return e&&e.isTTY&&(typeof e.getColorDepth==="function"?e.getColorDepth()>2:true)}static refresh(){t.enabled=t.isEnabled(process===null||process===void 0?void 0:process.stderr);if(!this.enabled){t.reset="";t.bright="";t.dim="";t.red="";t.green="";t.yellow="";t.blue="";t.magenta="";t.cyan="";t.white="";t.grey=""}else{t.reset="\x1B[0m";t.bright="\x1B[1m";t.dim="\x1B[2m";t.red="\x1B[31m";t.green="\x1B[32m";t.yellow="\x1B[33m";t.blue="\x1B[34m";t.magenta="\x1B[35m";t.cyan="\x1B[36m";t.white="\x1B[37m";t.grey="\x1B[90m"}}};Fn.Colours=ye;ye.enabled=false;ye.reset="";ye.bright="";ye.dim="";ye.red="";ye.green="";ye.yellow="";ye.blue="";ye.magenta="";ye.cyan="";ye.white="";ye.grey="";ye.refresh()});var ql=F(ie=>{"use strict";var Rp=ie&&ie.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var Pp=ie&&ie.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}):function(t,e){t["default"]=e});var Ol=ie&&ie.__importStar||(function(){var t=function(e){t=Object.getOwnPropertyNames||function(n){var i=[];for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r))i[i.length]=r;return i};return t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null){for(var i=t(e),r=0;r<i.length;r++)if(i[r]!=="default")Rp(n,e,i[r])}Pp(n,e);return n}})();Object.defineProperty(ie,"__esModule",{value:true});ie.env=ie.DebugLogBackendBase=ie.placeholder=ie.AdhocDebugLogger=ie.LogSeverity=void 0;ie.getNodeBackend=Dr;ie.getDebugBackend=Mp;ie.getStructuredBackend=kp;ie.setBackend=xp;ie.log=Fl;var Np=z("events");var ln=Ol(z("process"));var bl=Ol(z("util"));var we=Gl();var Fe;(function(t){t["DEFAULT"]="DEFAULT";t["DEBUG"]="DEBUG";t["INFO"]="INFO";t["WARNING"]="WARNING";t["ERROR"]="ERROR"})(Fe||(ie.LogSeverity=Fe={}));var un=class extends Np.EventEmitter{constructor(e,n){super();this.namespace=e;this.upstream=n;this.func=Object.assign(this.invoke.bind(this),{instance:this,on:(i,r)=>this.on(i,r)});this.func.debug=(...i)=>this.invokeSeverity(Fe.DEBUG,...i);this.func.info=(...i)=>this.invokeSeverity(Fe.INFO,...i);this.func.warn=(...i)=>this.invokeSeverity(Fe.WARNING,...i);this.func.error=(...i)=>this.invokeSeverity(Fe.ERROR,...i);this.func.sublog=i=>Fl(i,this.func)}invoke(e,...n){if(this.upstream){try{this.upstream(e,...n)}catch(i){}}try{this.emit("log",e,n)}catch(i){}}invokeSeverity(e,...n){this.invoke({severity:e},...n)}};ie.AdhocDebugLogger=un;ie.placeholder=new un("",()=>{}).func;var Ut=class{constructor(){var e;this.cached=new Map;this.filters=[];this.filtersSet=false;let n=(e=ln.env[ie.env.nodeEnables])!==null&&e!==void 0?e:"*";if(n==="all"){n="*"}this.filters=n.split(",")}log(e,n,...i){try{if(!this.filtersSet){this.setFilters();this.filtersSet=true}let r=this.cached.get(e);if(!r){r=this.makeLogger(e);this.cached.set(e,r)}r(n,...i)}catch(r){console.error(r)}}};ie.DebugLogBackendBase=Ut;var xr=class extends Ut{constructor(){super(...arguments);this.enabledRegexp=/.*/g}isEnabled(e){return this.enabledRegexp.test(e)}makeLogger(e){if(!this.enabledRegexp.test(e)){return()=>{}}return(n,...i)=>{var r;const o=`${we.Colours.green}${e}${we.Colours.reset}`;const l=`${we.Colours.yellow}${ln.pid}${we.Colours.reset}`;let u;switch(n.severity){case Fe.ERROR:u=`${we.Colours.red}${n.severity}${we.Colours.reset}`;break;case Fe.INFO:u=`${we.Colours.magenta}${n.severity}${we.Colours.reset}`;break;case Fe.WARNING:u=`${we.Colours.yellow}${n.severity}${we.Colours.reset}`;break;default:u=(r=n.severity)!==null&&r!==void 0?r:Fe.DEFAULT;break}const c=bl.formatWithOptions({colors:we.Colours.enabled},...i);const d=Object.assign({},n);delete d.severity;const f=Object.getOwnPropertyNames(d).length?JSON.stringify(d):"";const p=f?`${we.Colours.grey}${f}${we.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",l,o,u,c,f?` ${p}`:"")}}setFilters(){const e=this.filters.join(",");const n=e.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${n}$`,"i")}};function Dr(){return new xr}var Ur=class extends Ut{constructor(e){super();this.debugPkg=e}makeLogger(e){const n=this.debugPkg(e);return(i,...r)=>{n(r[0],...r.slice(1))}}setFilters(){var e;const n=(e=ln.env["NODE_DEBUG"])!==null&&e!==void 0?e:"";ln.env["NODE_DEBUG"]=`${n}${n?",":""}${this.filters.join(",")}`}};function Mp(t){return new Ur(t)}var Lr=class extends Ut{constructor(e){var n;super();this.upstream=(n=e)!==null&&n!==void 0?n:void 0}makeLogger(e){var n;const i=(n=this.upstream)===null||n===void 0?void 0:n.makeLogger(e);return(r,...o)=>{var l;const u=(l=r.severity)!==null&&l!==void 0?l:Fe.INFO;const c=Object.assign({severity:u,message:bl.format(...o)},r);const d=JSON.stringify(c);if(i){i(r,d)}else{console.log("%s",d)}}}setFilters(){var e;(e=this.upstream)===null||e===void 0?void 0:e.setFilters()}};function kp(t){return new Lr(t)}ie.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var Gr=new Map;var Re=void 0;function xp(t){Re=t;Gr.clear()}function Fl(t,e){if(!Re){const r=ln.env[ie.env.nodeEnables];if(!r){return ie.placeholder}}if(!t){return ie.placeholder}if(e){t=`${e.instance.namespace}:${t}`}const n=Gr.get(t);if(n){return n.func}if(Re===null){return ie.placeholder}else if(Re===void 0){Re=Dr()}const i=(()=>{let r=void 0;const o=new un(t,(l,...u)=>{if(r!==Re){if(Re===null){return}else if(Re===void 0){Re=Dr()}r=Re}Re===null||Re===void 0?void 0:Re.log(t,l,...u)});return o})();Gr.set(t,i);return i.func}});var Or=F(wt=>{"use strict";var Dp=wt&&wt.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var Up=wt&&wt.__exportStar||function(t,e){for(var n in t)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n))Dp(e,t,n)};Object.defineProperty(wt,"__esModule",{value:true});Up(ql(),wt)});var dn=F(W=>{"use strict";var Vl=W&&W.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var Lp=W&&W.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}):function(t,e){t["default"]=e});var Gp=W&&W.__importStar||(function(){var t=function(e){t=Object.getOwnPropertyNames||function(n){var i=[];for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r))i[i.length]=r;return i};return t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null){for(var i=t(e),r=0;r<i.length;r++)if(i[r]!=="default")Vl(n,e,i[r])}Lp(n,e);return n}})();var Op=W&&W.__exportStar||function(t,e){for(var n in t)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n))Vl(e,t,n)};Object.defineProperty(W,"__esModule",{value:true});W.gcpResidencyCache=W.METADATA_SERVER_DETECTION=W.HEADERS=W.HEADER_VALUE=W.HEADER_NAME=W.SECONDARY_HOST_ADDRESS=W.HOST_ADDRESS=W.BASE_PATH=void 0;W.instance=Bp;W.project=$p;W.universe=Jp;W.bulk=Kp;W.isAvailable=Yp;W.resetIsAvailableCache=zp;W.getGCPResidency=qr;W.setGCPResidency=Bl;W.requestTimeout=$l;var br=ge();var bp=Nl();var Fp=kr();var qp=Gp(Or());W.BASE_PATH="/computeMetadata/v1";W.HOST_ADDRESS="http://169.254.169.254";W.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";W.HEADER_NAME="Metadata-Flavor";W.HEADER_VALUE="Google";W.HEADERS=Object.freeze({[W.HEADER_NAME]:W.HEADER_VALUE});var Hl=qp.log("gcp-metadata");W.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 Fr(t){if(!t){t=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||W.HOST_ADDRESS}if(!/^https?:\/\//.test(t)){t=`http://${t}`}return new URL(W.BASE_PATH,t).href}function Hp(t){Object.keys(t).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 cn(t,e={},n=3,i=false){const r=new Headers(W.HEADERS);let o="";let l={};if(typeof t==="object"){const p=t;new Headers(p.headers).forEach((h,m)=>r.set(m,h));o=p.metadataKey;l=p.params||l;n=p.noResponseRetries||n;i=p.fastFail||i}else{o=t}if(typeof e==="string"){o+=`/${e}`}else{Hp(e);if(e.property){o+=`/${e.property}`}new Headers(e.headers).forEach((p,h)=>r.set(h,p));l=e.params||l}const u=i?Vp:br.request;const c={url:`${Fr()}/${o}`,headers:r,retryConfig:{noResponseRetries:n},params:l,responseType:"text",timeout:$l()};Hl.info("instance request %j",c);const d=await u(c);Hl.info("instance metadata is %s",d.data);const f=d.headers.get(W.HEADER_NAME);if(f!==W.HEADER_VALUE){throw new RangeError(`Invalid response from metadata service: incorrect ${W.HEADER_NAME} header. Expected '${W.HEADER_VALUE}', got ${f?`'${f}'`:"no header"}`)}if(typeof d.data==="string"){try{return bp.parse(d.data)}catch{}}return d.data}async function Vp(t){const e={...t,url:t.url?.toString().replace(Fr(),Fr(W.SECONDARY_HOST_ADDRESS))};const n=(0,br.request)(t);const i=(0,br.request)(e);return Promise.any([n,i])}function Bp(t){return cn("instance",t)}function $p(t){return cn("project",t)}function Jp(t){return cn("universe",t)}async function Kp(t){const e={};await Promise.all(t.map(n=>{return(async()=>{const i=await cn(n);const r=n.metadataKey;e[r]=i})()}));return e}function Wp(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}var qn;async function Yp(){if(process.env.METADATA_SERVER_DETECTION){const t=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(t in W.METADATA_SERVER_DETECTION)){throw new RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${t}\`, but it should be \`${Object.keys(W.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`)}switch(t){case"assume-present":return true;case"none":return false;case"bios-only":return qr();case"ping-only":}}try{if(qn===void 0){qn=cn("instance",void 0,Wp(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))}await qn;return true}catch(t){const e=t;if(process.env.DEBUG_AUTH){console.info(e)}if(e.type==="request-timeout"){return false}if(e.response&&e.response.status===404){return false}else{if(!(e.response&&e.response.status===404)&&(!e.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(e.code.toString()))){let n="UNKNOWN";if(e.code)n=e.code.toString();process.emitWarning(`received unexpected error = ${e.message} code = ${n}`,"MetadataLookupWarning")}return false}}}function zp(){qn=void 0}W.gcpResidencyCache=null;function qr(){if(W.gcpResidencyCache===null){Bl()}return W.gcpResidencyCache}function Bl(t=null){W.gcpResidencyCache=t!==null?t:(0,Fp.detectGCPResidency)()}function $l(){return qr()?0:3e3}Op(kr(),W)});var Wl=F(Hn=>{"use strict";Hn.byteLength=Qp;Hn.toByteArray=jp;Hn.fromByteArray=nh;var Xe=[];var Ue=[];var Xp=typeof Uint8Array!=="undefined"?Uint8Array:Array;var Hr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Rt=0,Jl=Hr.length;Rt<Jl;++Rt){Xe[Rt]=Hr[Rt];Ue[Hr.charCodeAt(Rt)]=Rt}var Rt;var Jl;Ue["-".charCodeAt(0)]=62;Ue["_".charCodeAt(0)]=63;function Kl(t){var e=t.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=t.indexOf("=");if(n===-1)n=e;var i=n===e?0:4-n%4;return[n,i]}function Qp(t){var e=Kl(t);var n=e[0];var i=e[1];return(n+i)*3/4-i}function Zp(t,e,n){return(e+n)*3/4-n}function jp(t){var e;var n=Kl(t);var i=n[0];var r=n[1];var o=new Xp(Zp(t,i,r));var l=0;var u=r>0?i-4:i;var c;for(c=0;c<u;c+=4){e=Ue[t.charCodeAt(c)]<<18|Ue[t.charCodeAt(c+1)]<<12|Ue[t.charCodeAt(c+2)]<<6|Ue[t.charCodeAt(c+3)];o[l++]=e>>16&255;o[l++]=e>>8&255;o[l++]=e&255}if(r===2){e=Ue[t.charCodeAt(c)]<<2|Ue[t.charCodeAt(c+1)]>>4;o[l++]=e&255}if(r===1){e=Ue[t.charCodeAt(c)]<<10|Ue[t.charCodeAt(c+1)]<<4|Ue[t.charCodeAt(c+2)]>>2;o[l++]=e>>8&255;o[l++]=e&255}return o}function eh(t){return Xe[t>>18&63]+Xe[t>>12&63]+Xe[t>>6&63]+Xe[t&63]}function th(t,e,n){var i;var r=[];for(var o=e;o<n;o+=3){i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255);r.push(eh(i))}return r.join("")}function nh(t){var e;var n=t.length;var i=n%3;var r=[];var o=16383;for(var l=0,u=n-i;l<u;l+=o){r.push(th(t,l,l+o>u?u:l+o))}if(i===1){e=t[n-1];r.push(Xe[e>>2]+Xe[e<<4&63]+"==")}else if(i===2){e=(t[n-2]<<8)+t[n-1];r.push(Xe[e>>10]+Xe[e>>4&63]+Xe[e<<2&63]+"=")}return r.join("")}});var Br=F(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:true});Vr.fromArrayBufferToHex=ih;function ih(t){const e=Array.from(new Uint8Array(t));return e.map(n=>{return n.toString(16).padStart(2,"0")}).join("")}});var Yl=F(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:true});Vn.BrowserCrypto=void 0;var Lt=Wl();var rh=Br();var $r=class t{constructor(){if(typeof window==="undefined"||window.crypto===void 0||window.crypto.subtle===void 0){throw new Error("SubtleCrypto not found. Make sure it's an https:// website.")}}async sha256DigestBase64(e){const n=new TextEncoder().encode(e);const i=await window.crypto.subtle.digest("SHA-256",n);return Lt.fromByteArray(new Uint8Array(i))}randomBytesBase64(e){const n=new Uint8Array(e);window.crypto.getRandomValues(n);return Lt.fromByteArray(n)}static padBase64(e){while(e.length%4!==0){e+="="}return e}async verify(e,n,i){const r={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};const o=new TextEncoder().encode(n);const l=Lt.toByteArray(t.padBase64(i));const u=await window.crypto.subtle.importKey("jwk",e,r,true,["verify"]);const c=await window.crypto.subtle.verify(r,u,Buffer.from(l),o);return c}async sign(e,n){const i={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};const r=new TextEncoder().encode(n);const o=await window.crypto.subtle.importKey("jwk",e,i,true,["sign"]);const l=await window.crypto.subtle.sign(i,o,r);return Lt.fromByteArray(new Uint8Array(l))}decodeBase64StringUtf8(e){const n=Lt.toByteArray(t.padBase64(e));const i=new TextDecoder().decode(n);return i}encodeBase64StringUtf8(e){const n=new TextEncoder().encode(e);const i=Lt.fromByteArray(n);return i}async sha256DigestHex(e){const n=new TextEncoder().encode(e);const i=await window.crypto.subtle.digest("SHA-256",n);return(0,rh.fromArrayBufferToHex)(i)}async signWithHmacSha256(e,n){const i=typeof e==="string"?e:String.fromCharCode(...new Uint16Array(e));const r=new TextEncoder;const o=await window.crypto.subtle.importKey("raw",r.encode(i),{name:"HMAC",hash:{name:"SHA-256"}},false,["sign"]);return window.crypto.subtle.sign("HMAC",o,r.encode(n))}};Vn.BrowserCrypto=$r});var zl=F(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:true});Bn.NodeCrypto=void 0;var Gt=z("crypto");var Jr=class{async sha256DigestBase64(e){return Gt.createHash("sha256").update(e).digest("base64")}randomBytesBase64(e){return Gt.randomBytes(e).toString("base64")}async verify(e,n,i){const r=Gt.createVerify("RSA-SHA256");r.update(n);r.end();return r.verify(e,i,"base64")}async sign(e,n){const i=Gt.createSign("RSA-SHA256");i.update(n);i.end();return i.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 Gt.createHash("sha256").update(e).digest("hex")}async signWithHmacSha256(e,n){const i=typeof e==="string"?e:sh(e);return oh(Gt.createHmac("sha256",i).update(n).digest())}};Bn.NodeCrypto=Jr;function oh(t){const e=new ArrayBuffer(t.length);const n=new Uint8Array(e);for(let i=0;i<t.length;++i){n[i]=t[i]}return e}function sh(t){return Buffer.from(t)}});var fn=F(it=>{"use strict";var ah=it&&it.__createBinding||(Object.create?(function(t,e,n,i){if(i===void 0)i=n;var r=Object.getOwnPropertyDescriptor(e,n);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[n]}}}Object.defineProperty(t,i,r)}):(function(t,e,n,i){if(i===void 0)i=n;t[i]=e[n]}));var lh=it&&it.__exportStar||function(t,e){for(var n in t)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n))ah(e,t,n)};Object.defineProperty(it,"__esModule",{value:true});it.createCrypto=dh;it.hasBrowserCrypto=Xl;var uh=Yl();var ch=zl();lh(Br(),it);function dh(){if(Xl()){return new uh.BrowserCrypto}return new ch.NodeCrypto}function Xl(){return typeof window!=="undefined"&&typeof window.crypto!=="undefined"&&typeof window.crypto.subtle!=="undefined"}});var Zl=F((zS,Ql)=>{"use strict";function Kr(t){var e=(t/8|0)+(t%8===0?0:1);return e}var fh={ES256:Kr(256),ES384:Kr(384),ES512:Kr(521)};function ph(t){var e=fh[t];if(e){return e}throw new Error('Unknown algorithm "'+t+'"')}Ql.exports=ph});var Wr=F((XS,ru)=>{"use strict";var $n=an().Buffer;var eu=Zl();var Jn=128;var tu=0;var hh=32;var gh=16;var mh=2;var nu=gh|hh|tu<<6;var Kn=mh|tu<<6;function yh(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function iu(t){if($n.isBuffer(t)){return t}else if("string"===typeof t){return $n.from(t,"base64")}throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function Eh(t,e){t=iu(t);var n=eu(e);var i=n+1;var r=t.length;var o=0;if(t[o++]!==nu){throw new Error('Could not find expected "seq"')}var l=t[o++];if(l===(Jn|1)){l=t[o++]}if(r-o<l){throw new Error('"seq" specified length of "'+l+'", only "'+(r-o)+'" remaining')}if(t[o++]!==Kn){throw new Error('Could not find expected "int" for "r"')}var u=t[o++];if(r-o-2<u){throw new Error('"r" specified length of "'+u+'", only "'+(r-o-2)+'" available')}if(i<u){throw new Error('"r" specified length of "'+u+'", max of "'+i+'" is acceptable')}var c=o;o+=u;if(t[o++]!==Kn){throw new Error('Could not find expected "int" for "s"')}var d=t[o++];if(r-o!==d){throw new Error('"s" specified length of "'+d+'", expected "'+(r-o)+'"')}if(i<d){throw new Error('"s" specified length of "'+d+'", max of "'+i+'" is acceptable')}var f=o;o+=d;if(o!==r){throw new Error('Expected to consume entire buffer, but "'+(r-o)+'" bytes remain')}var p=n-u,h=n-d;var m=$n.allocUnsafe(p+u+h+d);for(o=0;o<p;++o){m[o]=0}t.copy(m,o,c+Math.max(-p,0),c+u);o=n;for(var _=o;o<_+h;++o){m[o]=0}t.copy(m,o,f+Math.max(-h,0),f+d);m=m.toString("base64");m=yh(m);return m}function jl(t,e,n){var i=0;while(e+i<n&&t[e+i]===0){++i}var r=t[e+i]>=Jn;if(r){--i}return i}function _h(t,e){t=iu(t);var n=eu(e);var i=t.length;if(i!==n*2){throw new TypeError('"'+e+'" signatures must be "'+n*2+'" bytes, saw "'+i+'"')}var r=jl(t,0,n);var o=jl(t,n,t.length);var l=n-r;var u=n-o;var c=1+1+l+1+1+u;var d=c<Jn;var f=$n.allocUnsafe((d?2:3)+c);var p=0;f[p++]=nu;if(d){f[p++]=c}else{f[p++]=Jn|1;f[p++]=c&255}f[p++]=Kn;f[p++]=l;if(r<0){f[p++]=0;p+=t.copy(f,p,0,n)}else{p+=t.copy(f,p,r,n)}f[p++]=Kn;f[p++]=u;if(o<0){f[p++]=0;t.copy(f,p,n)}else{t.copy(f,p,n+o)}return f}ru.exports={derToJose:Eh,joseToDer:_h}});var qe=F(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:true});rt.LRUCache=void 0;rt.snakeToCamel=su;rt.originalOrCamelOptions=vh;rt.removeUndefinedValuesInObject=Sh;rt.isValidFile=Ih;rt.getWellKnownCertificateConfigFileLocation=wh;var Th=z("fs");var Ah=z("os");var Yr=z("path");var Ch="certificate_config.json";var ou="gcloud";function su(t){return t.replace(/([_][^_])/g,e=>e.slice(1).toUpperCase())}function vh(t){function e(n){const i=t||{};return i[n]??i[su(n)]}return{get:e}}var zr=class{capacity;#e=new Map;maxAge;constructor(e){this.capacity=e.capacity;this.maxAge=e.maxAge}#t(e,n){this.#e.delete(e);this.#e.set(e,{value:n,lastAccessed:Date.now()})}set(e,n){this.#t(e,n);this.#n()}get(e){const n=this.#e.get(e);if(!n)return;this.#t(e,n.value);this.#n();return n.value}#n(){const e=this.maxAge?Date.now()-this.maxAge:0;let n=this.#e.entries().next();while(!n.done&&(this.#e.size>this.capacity||n.value[1].lastAccessed<e)){this.#e.delete(n.value[0]);n=this.#e.entries().next()}}};rt.LRUCache=zr;function Sh(t){Object.entries(t).forEach(([e,n])=>{if(n===void 0||n==="undefined"){delete t[e]}});return t}async function Ih(t){try{const e=await Th.promises.lstat(t);return e.isFile()}catch(e){return false}}function wh(){const t=process.env.CLOUDSDK_CONFIG||(Rh()?Yr.join(process.env.APPDATA||"",ou):Yr.join(process.env.HOME||"",".config",ou));return Yr.join(t,Ch)}function Rh(){return Ah.platform().startsWith("win")}});var au=F((ZS,Ph)=>{Ph.exports={name:"google-auth-library",version:"10.9.1",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:{type:"git",directory:"core/packages/google-auth-library-nodejs",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.1.4","gcp-metadata":"8.1.2","google-logging-utils":"1.1.3",jws:"^4.0.0"},devDependencies:{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","assert-rejects":"^1.0.0",c8:"^10.1.3",codecov:"^3.8.3",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",keypair:"^1.0.4",mocha:"^11.1.0",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1",puppeteer:"^24.0.0",sinon:"21.0.3","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",clean:"gts clean",prepare:"npm run compile",lint:"gts check --no-inline-config",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0",homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/google-auth-library-nodejs"}});var Xr=F(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:true});ut.USER_AGENT=ut.PRODUCT_NAME=ut.pkg=void 0;var lu=au();ut.pkg=lu;var uu="google-api-nodejs-client";ut.PRODUCT_NAME=uu;var Nh=`${uu}/${lu.version}`;ut.USER_AGENT=Nh});var Pe=F(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:true});He.AuthClient=He.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=He.DEFAULT_UNIVERSE=void 0;var Mh=z("events");var Qr=ge();var kh=qe();var xh=Or();var Zr=Xr();He.DEFAULT_UNIVERSE="googleapis.com";He.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=5*60*1e3;var jr=class t extends Mh.EventEmitter{apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=He.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=false;universeDomain=He.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(e={}){super();const n=(0,kh.originalOrCamelOptions)(e);this.apiKey=e.apiKey;this.projectId=n.get("project_id")??null;this.quotaProjectId=n.get("quota_project_id");this.credentials=n.get("credentials")??{};this.universeDomain=n.get("universe_domain")??He.DEFAULT_UNIVERSE;this.transporter=e.transporter??new Qr.Gaxios(e.transporterOptions);if(n.get("useAuthRequestParameters")!==false){this.transporter.interceptors.request.add(t.DEFAULT_REQUEST_INTERCEPTOR);this.transporter.interceptors.response.add(t.DEFAULT_RESPONSE_INTERCEPTOR)}if(e.eagerRefreshThresholdMillis){this.eagerRefreshThresholdMillis=e.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=e.forceRefreshOnFailure??false}fetch(...e){const n=e[0];const i=e[1];let r=void 0;const o=new Headers;if(typeof n==="string"){r=new URL(n)}else if(n instanceof URL){r=n}else if(n&&n.url){r=new URL(n.url)}if(n&&typeof n==="object"&&"headers"in n){Qr.Gaxios.mergeHeaders(o,n.headers)}if(i){Qr.Gaxios.mergeHeaders(o,new Headers(i.headers))}if(typeof n==="object"&&!(n instanceof URL)){return this.request({...i,...n,headers:o,url:r})}else{return this.request({...i,headers:o,url:r})}}setCredentials(e){this.credentials=e}addSharedMetadataHeaders(e){if(!e.has("x-goog-user-project")&&this.quotaProjectId){e.set("x-goog-user-project",this.quotaProjectId)}return e}addUserProjectAndAuthHeaders(e,n){const i=n.get("x-goog-user-project");const r=n.get("authorization");if(i){e.set("x-goog-user-project",i)}if(r){e.set("authorization",r)}return e}static log=(0,xh.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:async e=>{if(!e.headers.has("x-goog-api-client")){const i=process.version.replace(/^v/,"");e.headers.set("x-goog-api-client",`gl-node/${i}`)}const n=e.headers.get("User-Agent");if(!n){e.headers.set("User-Agent",Zr.USER_AGENT)}else if(!n.includes(`${Zr.PRODUCT_NAME}/`)){e.headers.set("User-Agent",`${n} ${Zr.USER_AGENT}`)}try{const i=e;const r=i[t.RequestMethodNameSymbol];const o=`${Math.floor(Math.random()*1e3)}`;i[t.RequestLogIdSymbol]=o;const l={url:e.url,headers:e.headers};if(r){t.log.info("%s [%s] request %j",r,o,l)}else{t.log.info("[%s] request %j",o,l)}}catch(i){}return e}};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:async e=>{try{const n=e.config;const i=n[t.RequestMethodNameSymbol];const r=n[t.RequestLogIdSymbol];if(i){t.log.info("%s [%s] response %j",i,r,e.data)}else{t.log.info("[%s] response %j",r,e.data)}}catch(n){}return e},rejected:async e=>{try{const n=e.config;const i=n[t.RequestMethodNameSymbol];const r=n[t.RequestLogIdSymbol];if(i){t.log.info("%s [%s] error %j",i,r,e.response?.data)}else{t.log.error("[%s] error %j",r,e.response?.data)}}catch(n){}throw e}};static setMethodName(e,n){try{const i=e;i[t.RequestMethodNameSymbol]=n}catch(i){}}static get RETRY_CONFIG(){return{retry:true,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};He.AuthClient=jr});var to=F(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:true});Wn.LoginTicket=void 0;var eo=class{envelope;payload;constructor(e,n){this.envelope=e;this.payload=n}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()}}};Wn.LoginTicket=eo});var ct=F(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:true});Qe.OAuth2Client=Qe.ClientAuthentication=Qe.CertificateFormat=Qe.CodeChallengeMethod=void 0;var cu=ge();var Dh=z("querystring");var Uh=z("stream");var Lh=Wr();var du=qe();var no=fn();var Ot=Pe();var Gh=to();var fu;(function(t){t["Plain"]="plain";t["S256"]="S256"})(fu||(Qe.CodeChallengeMethod=fu={}));var ot;(function(t){t["PEM"]="PEM";t["JWK"]="JWK"})(ot||(Qe.CertificateFormat=ot={}));var pn;(function(t){t["ClientSecretPost"]="ClientSecretPost";t["ClientSecretBasic"]="ClientSecretBasic";t["None"]="None"})(pn||(Qe.ClientAuthentication=pn={}));var io=class t extends Ot.AuthClient{redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=ot.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(e={},n,i){super(typeof e==="object"?e:{});if(typeof e!=="object"){e={clientId:e,clientSecret:n,redirectUri:i}}this._clientId=e.clientId||e.client_id;this._clientSecret=e.clientSecret||e.client_secret;this.redirectUri=e.redirectUri||e.redirect_uris?.[0];this.endpoints={tokenInfoUrl:"https://oauth2.googleapis.com/tokeninfo",oauth2AuthBaseUrl:"https://accounts.google.com/o/oauth2/v2/auth",oauth2TokenUrl:"https://oauth2.googleapis.com/token",oauth2RevokeUrl:"https://oauth2.googleapis.com/revoke",oauth2FederatedSignonPemCertsUrl:"https://www.googleapis.com/oauth2/v1/certs",oauth2FederatedSignonJwkCertsUrl:"https://www.googleapis.com/oauth2/v3/certs",oauth2IapPublicKeyUrl:"https://www.gstatic.com/iap/verify/public_key",...e.endpoints};this.clientAuthentication=e.clientAuthentication||pn.ClientSecretPost;this.issuers=e.issuers||["accounts.google.com","https://accounts.google.com",this.universeDomain]}static GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";static CLOCK_SKEW_SECS_=300;static DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400;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 n=this.endpoints.oauth2AuthBaseUrl.toString();return n+"?"+Dh.stringify(e)}generateCodeVerifier(){throw new Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){const e=(0,no.createCrypto)();const n=e.randomBytesBase64(96);const i=n.replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-");const r=await e.sha256DigestBase64(i);const o=r.split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:i,codeChallenge:o}}getToken(e,n){const i=typeof e==="string"?{code:e}:e;if(n){this.getTokenAsync(i).then(r=>n(null,r.tokens,r.res),r=>n(r,null,r.response))}else{return this.getTokenAsync(i)}}async getTokenAsync(e){const n=this.endpoints.oauth2TokenUrl.toString();const i=new Headers;const r={client_id:e.client_id||this._clientId,code_verifier:e.codeVerifier,code:e.code,grant_type:"authorization_code",redirect_uri:e.redirect_uri||this.redirectUri};if(this.clientAuthentication===pn.ClientSecretBasic){const c=Buffer.from(`${this._clientId}:${this._clientSecret}`);i.set("authorization",`Basic ${c.toString("base64")}`)}if(this.clientAuthentication===pn.ClientSecretPost){r.client_secret=this._clientSecret}const o={...t.RETRY_CONFIG,method:"POST",url:n,data:new URLSearchParams((0,du.removeUndefinedValuesInObject)(r)),headers:i};Ot.AuthClient.setMethodName(o,"getTokenAsync");const l=await this.transporter.request(o);const u=l.data;if(l.data&&l.data.expires_in){u.expiry_date=new Date().getTime()+l.data.expires_in*1e3;delete u.expires_in}this.emit("tokens",u);return{tokens:u,res:l}}async refreshToken(e){if(!e){return this.refreshTokenNoCache(e)}if(this.refreshTokenPromises.has(e)){return this.refreshTokenPromises.get(e)}const n=this.refreshTokenNoCache(e).then(i=>{this.refreshTokenPromises.delete(e);return i},i=>{this.refreshTokenPromises.delete(e);throw i});this.refreshTokenPromises.set(e,n);return n}async refreshTokenNoCache(e){if(!e){throw new Error("No refresh token is set.")}const n=this.endpoints.oauth2TokenUrl.toString();const i={refresh_token:e,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"};let r;try{const l={...t.RETRY_CONFIG,method:"POST",url:n,data:new URLSearchParams((0,du.removeUndefinedValuesInObject)(i))};Ot.AuthClient.setMethodName(l,"refreshTokenNoCache");r=await this.transporter.request(l)}catch(l){if(l instanceof cu.GaxiosError&&l.message==="invalid_grant"&&l.response?.data&&/ReAuth/i.test(l.response.data.error_description)){l.message=JSON.stringify(l.response.data)}throw l}const o=r.data;if(r.data&&r.data.expires_in){o.expiry_date=new Date().getTime()+r.data.expires_in*1e3;delete o.expires_in}this.emit("tokens",o);return{tokens:o,res:r}}refreshAccessToken(e){if(e){this.refreshAccessTokenAsync().then(n=>e(null,n.credentials,n.res),e)}else{return this.refreshAccessTokenAsync()}}async refreshAccessTokenAsync(){const e=await this.refreshToken(this.credentials.refresh_token);const n=e.tokens;n.refresh_token=this.credentials.refresh_token;this.credentials=n;return{credentials:this.credentials,res:e.res}}getAccessToken(e){if(e){this.getAccessTokenAsync().then(n=>e(null,n.token,n.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 i=await this.processAndValidateRefreshHandler();if(i?.access_token){this.setCredentials(i);return{token:this.credentials.access_token}}}else{throw new Error("No refresh token or refresh handler callback is set.")}}const n=await this.refreshAccessTokenAsync();if(!n.credentials||n.credentials&&!n.credentials.access_token){throw new Error("Could not refresh access token.")}return{token:n.credentials.access_token,res:n.res}}else{return{token:this.credentials.access_token}}}async getRequestHeaders(e){const n=(await this.getRequestMetadataAsync(e)).headers;return n}async getRequestMetadataAsync(e){e;const n=this.credentials;if(!n.access_token&&!n.refresh_token&&!this.apiKey&&!this.refreshHandler){throw new Error("No access, refresh token, API key or refresh handler callback is set.")}if(n.access_token&&!this.isTokenExpiring()){n.token_type=n.token_type||"Bearer";const u=new Headers({authorization:n.token_type+" "+n.access_token});return{headers:this.addSharedMetadataHeaders(u)}}if(this.refreshHandler){const u=await this.processAndValidateRefreshHandler();if(u?.access_token){this.setCredentials(u);const c=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(c)}}}if(this.apiKey){return{headers:new Headers({"X-Goog-Api-Key":this.apiKey})}}let i=null;let r=null;try{i=await this.refreshToken(n.refresh_token);r=i.tokens}catch(u){const c=u;if(c.response&&(c.response.status===403||c.response.status===404)){c.message=`Could not refresh access token: ${c.message}`}throw c}const o=this.credentials;o.token_type=o.token_type||"Bearer";r.refresh_token=o.refresh_token;this.credentials=r;const l=new Headers({authorization:o.token_type+" "+r.access_token});return{headers:this.addSharedMetadataHeaders(l),res:i.res}}static getRevokeTokenUrl(e){return new t().getRevokeTokenURL(e).toString()}getRevokeTokenURL(e){const n=new URL(this.endpoints.oauth2RevokeUrl);n.searchParams.append("token",e);return n}revokeToken(e,n){const i={...t.RETRY_CONFIG,url:this.getRevokeTokenURL(e).toString(),method:"POST"};Ot.AuthClient.setMethodName(i,"revokeToken");if(n){this.transporter.request(i).then(r=>n(null,r),n)}else{return this.transporter.request(i)}}revokeCredentials(e){if(e){this.revokeCredentialsAsync().then(n=>e(null,n),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,n){if(n){this.requestAsync(e).then(i=>n(null,i),i=>{return n(i,i.response)})}else{return this.requestAsync(e)}}async requestAsync(e,n=false){try{const i=await this.getRequestMetadataAsync();e.headers=cu.Gaxios.mergeHeaders(e.headers);this.addUserProjectAndAuthHeaders(e.headers,i.headers);if(this.apiKey){e.headers.set("X-Goog-Api-Key",this.apiKey)}return await this.transporter.request(e)}catch(i){const r=i.response;if(r){const o=r.status;const l=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure);const u=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler;const c=r.config.data instanceof Uh.Readable;const d=o===401||o===403;if(!n&&d&&!c&&l){await this.refreshAccessTokenAsync();return this.requestAsync(e,true)}else if(!n&&d&&!c&&u){const f=await this.processAndValidateRefreshHandler();if(f?.access_token){this.setCredentials(f)}return this.requestAsync(e,true)}}throw i}}verifyIdToken(e,n){if(n&&typeof n!=="function"){throw new Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.")}if(n){this.verifyIdTokenAsync(e).then(i=>n(null,i),n)}else{return this.verifyIdTokenAsync(e)}}async verifyIdTokenAsync(e){if(!e.idToken){throw new Error("The verifyIdToken method requires an ID Token")}const n=await this.getFederatedSignonCertsAsync();const i=await this.verifySignedJwtWithCertsAsync(e.idToken,n.certs,e.audience,this.issuers,e.maxExpiry);return i}async getTokenInfo(e){const{data:n}=await this.transporter.request({...t.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${e}`},url:this.endpoints.tokenInfoUrl.toString()});const i=Object.assign({expiry_date:new Date().getTime()+n.expires_in*1e3,scopes:n.scope.split(" ")},n);delete i.expires_in;delete i.scope;return i}getFederatedSignonCerts(e){if(e){this.getFederatedSignonCertsAsync().then(n=>e(null,n.certs,n.res),e)}else{return this.getFederatedSignonCertsAsync()}}async getFederatedSignonCertsAsync(){const e=new Date().getTime();const n=(0,no.hasBrowserCrypto)()?ot.JWK:ot.PEM;if(this.certificateExpiry&&e<this.certificateExpiry.getTime()&&this.certificateCacheFormat===n){return{certs:this.certificateCache,format:n}}let i;let r;switch(n){case ot.PEM:r=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case ot.JWK:r=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw new Error(`Unsupported certificate format ${n}`)}try{const d={...t.RETRY_CONFIG,url:r};Ot.AuthClient.setMethodName(d,"getFederatedSignonCertsAsync");i=await this.transporter.request(d)}catch(d){if(d instanceof Error){d.message=`Failed to retrieve verification certificates: ${d.message}`}throw d}const o=i?.headers.get("cache-control");let l=-1;if(o){const d=/max-age=(?<maxAge>[0-9]+)/.exec(o)?.groups?.maxAge;if(d){l=Number(d)*1e3}}let u={};switch(n){case ot.PEM:u=i.data;break;case ot.JWK:for(const d of i.data.keys){u[d.kid]=d}break;default:throw new Error(`Unsupported certificate format ${n}`)}const c=new Date;this.certificateExpiry=l===-1?null:new Date(c.getTime()+l);this.certificateCache=u;this.certificateCacheFormat=n;return{certs:u,format:n,res:i}}getIapPublicKeys(e){if(e){this.getIapPublicKeysAsync().then(n=>e(null,n.pubkeys,n.res),e)}else{return this.getIapPublicKeysAsync()}}async getIapPublicKeysAsync(){let e;const n=this.endpoints.oauth2IapPublicKeyUrl.toString();try{const i={...t.RETRY_CONFIG,url:n};Ot.AuthClient.setMethodName(i,"getIapPublicKeysAsync");e=await this.transporter.request(i)}catch(i){if(i instanceof Error){i.message=`Failed to retrieve verification certificates: ${i.message}`}throw i}return{pubkeys:e.data,res:e}}verifySignedJwtWithCerts(){throw new Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(e,n,i,r,o){const l=(0,no.createCrypto)();if(!o){o=t.DEFAULT_MAX_TOKEN_LIFETIME_SECS_}const u=e.split(".");if(u.length!==3){throw new Error("Wrong number of segments in token: "+e)}const c=u[0]+"."+u[1];let d=u[2];let f;let p;try{f=JSON.parse(l.decodeBase64StringUtf8(u[0]))}catch(D){if(D instanceof Error){D.message=`Can't parse token envelope: ${u[0]}': ${D.message}`}throw D}if(!f){throw new Error("Can't parse token envelope: "+u[0])}try{p=JSON.parse(l.decodeBase64StringUtf8(u[1]))}catch(D){if(D instanceof Error){D.message=`Can't parse token payload '${u[0]}`}throw D}if(!p){throw new Error("Can't parse token payload: "+u[1])}if(!Object.prototype.hasOwnProperty.call(n,f.kid)){throw new Error("No pem found for envelope: "+JSON.stringify(f))}const h=n[f.kid];if(f.alg==="ES256"){d=Lh.joseToDer(d,"ES256").toString("base64")}const m=await l.verify(h,c,d);if(!m){throw new Error("Invalid token signature: "+e)}if(!p.iat){throw new Error("No issue time in token: "+JSON.stringify(p))}if(!p.exp){throw new Error("No expiration time in token: "+JSON.stringify(p))}const _=Number(p.iat);if(isNaN(_))throw new Error("iat field using invalid format");const A=Number(p.exp);if(isNaN(A))throw new Error("exp field using invalid format");const T=new Date().getTime()/1e3;if(A>=T+o){throw new Error("Expiration time too far in future: "+JSON.stringify(p))}const v=_-t.CLOCK_SKEW_SECS_;const G=A+t.CLOCK_SKEW_SECS_;if(T<v){throw new Error("Token used too early, "+T+" < "+v+": "+JSON.stringify(p))}if(T>G){throw new Error("Token used too late, "+T+" > "+G+": "+JSON.stringify(p))}if(r&&r.indexOf(p.iss)<0){throw new Error("Invalid issuer, expected one of ["+r+"], but got "+p.iss)}if(typeof i!=="undefined"&&i!==null){const D=p.aud;let O=false;if(i.constructor===Array){O=i.indexOf(D)>-1}else{O=D===i}if(!O){throw new Error("Wrong recipient, payload audience != requiredAudience")}}return new Gh.LoginTicket(f,p)}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}};Qe.OAuth2Client=io});var oo=F(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:true});Yn.Compute=void 0;var Oh=ge();var pu=dn();var bh=ct();var ro=class extends bh.OAuth2Client{serviceAccountEmail;scopes;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(){const e=`service-accounts/${this.serviceAccountEmail}/token`;let n;try{const r={property:e};if(this.scopes.length>0){r.params={scopes:this.scopes.join(",")}}n=await pu.instance(r)}catch(r){if(r instanceof Oh.GaxiosError){r.message=`Could not refresh access token: ${r.message}`;this.wrapError(r)}throw r}const i=n;if(n&&n.expires_in){i.expiry_date=new Date().getTime()+n.expires_in*1e3;delete i.expires_in}this.emit("tokens",i);return{tokens:i,res:null}}async fetchIdToken(e){const n=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${e}`;let i;try{const r={property:n};i=await pu.instance(r)}catch(r){if(r instanceof Error){r.message=`Could not fetch ID token: ${r.message}`}throw r}return i}wrapError(e){const n=e.response;if(n&&n.status){e.status=n.status;if(n.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(n.status===404){e.message="A Not Found error was returned while attempting to retrieve an accesstoken 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}}}};Yn.Compute=ro});var ao=F(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:true});zn.IdTokenClient=void 0;var Fh=ct();var so=class extends Fh.OAuth2Client{targetAudience;idTokenProvider;constructor(e){super(e);this.targetAudience=e.targetAudience;this.idTokenProvider=e.idTokenProvider}async getRequestMetadataAsync(){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){const n=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:n,expiry_date:this.getIdTokenExpiryDate(n)}}const e=new Headers({authorization:"Bearer "+this.credentials.id_token});return{headers:e}}getIdTokenExpiryDate(e){const n=e.split(".")[1];if(n){const i=JSON.parse(Buffer.from(n,"base64").toString("ascii"));return i.exp*1e3}}};zn.IdTokenClient=so});var lo=F(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:true});bt.GCPEnv=void 0;bt.clear=qh;bt.getEnv=Hh;var hu=dn();var Ze;(function(t){t["APP_ENGINE"]="APP_ENGINE";t["KUBERNETES_ENGINE"]="KUBERNETES_ENGINE";t["CLOUD_FUNCTIONS"]="CLOUD_FUNCTIONS";t["COMPUTE_ENGINE"]="COMPUTE_ENGINE";t["CLOUD_RUN"]="CLOUD_RUN";t["CLOUD_RUN_JOBS"]="CLOUD_RUN_JOBS";t["NONE"]="NONE"})(Ze||(bt.GCPEnv=Ze={}));var hn;function qh(){hn=void 0}async function Hh(){if(hn){return hn}hn=Vh();return hn}async function Vh(){let t=Ze.NONE;if(Bh()){t=Ze.APP_ENGINE}else if($h()){t=Ze.CLOUD_FUNCTIONS}else if(await Yh()){if(await Wh()){t=Ze.KUBERNETES_ENGINE}else if(Jh()){t=Ze.CLOUD_RUN}else if(Kh()){t=Ze.CLOUD_RUN_JOBS}else{t=Ze.COMPUTE_ENGINE}}else{t=Ze.NONE}return t}function Bh(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}function $h(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}function Jh(){return!!process.env.K_CONFIGURATION}function Kh(){return!!process.env.CLOUD_RUN_JOB}async function Wh(){try{await hu.instance("attributes/cluster-name");return true}catch(t){return false}}async function Yh(){return hu.isAvailable()}});var uo=F((sI,gu)=>{var Xn=an().Buffer;var zh=z("stream");var Xh=z("util");function Qn(t){this.buffer=null;this.writable=true;this.readable=true;if(!t){this.buffer=Xn.alloc(0);return this}if(typeof t.pipe==="function"){this.buffer=Xn.alloc(0);t.pipe(this);return this}if(t.length||typeof t==="object"){this.buffer=t;this.writable=false;process.nextTick(function(){this.emit("end",t);this.readable=false;this.emit("close")}.bind(this));return this}throw new TypeError("Unexpected data type ("+typeof t+")")}Xh.inherits(Qn,zh);Qn.prototype.write=function t(e){this.buffer=Xn.concat([this.buffer,Xn.from(e)]);this.emit("data",e)};Qn.prototype.end=function t(e){if(e)this.write(e);this.emit("end",e);this.emit("close");this.writable=false;this.readable=false};gu.exports=Qn});var yu=F((aI,mu)=>{"use strict";var gn=z("buffer").Buffer;var co=z("buffer").SlowBuffer;mu.exports=Zn;function Zn(t,e){if(!gn.isBuffer(t)||!gn.isBuffer(e)){return false}if(t.length!==e.length){return false}var n=0;for(var i=0;i<t.length;i++){n|=t[i]^e[i]}return n===0}Zn.install=function(){gn.prototype.equal=co.prototype.equal=function t(e){return Zn(this,e)}};var Qh=gn.prototype.equal;var Zh=co.prototype.equal;Zn.restore=function(){gn.prototype.equal=Qh;co.prototype.equal=Zh}});var go=F((lI,wu)=>{var qt=an().Buffer;var Le=z("crypto");var _u=Wr();var Eu=z("util");var jh='"%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 mn="secret must be a string or buffer";var Ft="key must be a string or a buffer";var eg="key must be a string, a buffer or an object";var po=typeof Le.createPublicKey==="function";if(po){Ft+=" or a KeyObject";mn+="or a KeyObject"}function Tu(t){if(qt.isBuffer(t)){return}if(typeof t==="string"){return}if(!po){throw Ve(Ft)}if(typeof t!=="object"){throw Ve(Ft)}if(typeof t.type!=="string"){throw Ve(Ft)}if(typeof t.asymmetricKeyType!=="string"){throw Ve(Ft)}if(typeof t.export!=="function"){throw Ve(Ft)}}function Au(t){if(qt.isBuffer(t)){return}if(typeof t==="string"){return}if(typeof t==="object"){return}throw Ve(eg)}function tg(t){if(qt.isBuffer(t)){return}if(typeof t==="string"){return t}if(!po){throw Ve(mn)}if(typeof t!=="object"){throw Ve(mn)}if(t.type!=="secret"){throw Ve(mn)}if(typeof t.export!=="function"){throw Ve(mn)}}function ho(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Cu(t){t=t.toString();var e=4-t.length%4;if(e!==4){for(var n=0;n<e;++n){t+="="}}return t.replace(/\-/g,"+").replace(/_/g,"/")}function Ve(t){var e=[].slice.call(arguments,1);var n=Eu.format.bind(Eu,t).apply(null,e);return new TypeError(n)}function ng(t){return qt.isBuffer(t)||typeof t==="string"}function yn(t){if(!ng(t))t=JSON.stringify(t);return t}function vu(t){return function e(n,i){tg(i);n=yn(n);var r=Le.createHmac("sha"+t,i);var o=(r.update(n),r.digest("base64"));return ho(o)}}var fo;var ig="timingSafeEqual"in Le?function t(e,n){if(e.byteLength!==n.byteLength){return false}return Le.timingSafeEqual(e,n)}:function t(e,n){if(!fo){fo=yu()}return fo(e,n)};function rg(t){return function e(n,i,r){var o=vu(t)(n,r);return ig(qt.from(i),qt.from(o))}}function Su(t){return function e(n,i){Au(i);n=yn(n);var r=Le.createSign("RSA-SHA"+t);var o=(r.update(n),r.sign(i,"base64"));return ho(o)}}function Iu(t){return function e(n,i,r){Tu(r);n=yn(n);i=Cu(i);var o=Le.createVerify("RSA-SHA"+t);o.update(n);return o.verify(r,i,"base64")}}function og(t){return function e(n,i){Au(i);n=yn(n);var r=Le.createSign("RSA-SHA"+t);var o=(r.update(n),r.sign({key:i,padding:Le.constants.RSA_PKCS1_PSS_PADDING,saltLength:Le.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return ho(o)}}function sg(t){return function e(n,i,r){Tu(r);n=yn(n);i=Cu(i);var o=Le.createVerify("RSA-SHA"+t);o.update(n);return o.verify({key:r,padding:Le.constants.RSA_PKCS1_PSS_PADDING,saltLength:Le.constants.RSA_PSS_SALTLEN_DIGEST},i,"base64")}}function ag(t){var e=Su(t);return function n(){var i=e.apply(null,arguments);i=_u.derToJose(i,"ES"+t);return i}}function lg(t){var e=Iu(t);return function n(i,r,o){r=_u.joseToDer(r,"ES"+t).toString("base64");var l=e(i,r,o);return l}}function ug(){return function t(){return""}}function cg(){return function t(e,n){return n===""}}wu.exports=function t(e){var n={hs:vu,rs:Su,ps:og,es:ag,none:ug};var i={hs:rg,rs:Iu,ps:sg,es:lg,none:cg};var r=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!r)throw Ve(jh,e);var o=(r[1]||r[3]).toLowerCase();var l=r[2];return{sign:n[o](l),verify:i[o](l)}}});var mo=F((uI,Ru)=>{var dg=z("buffer").Buffer;Ru.exports=function t(e){if(typeof e==="string")return e;if(typeof e==="number"||dg.isBuffer(e))return e.toString();return JSON.stringify(e)}});var Du=F((cI,xu)=>{var fg=an().Buffer;var Pu=uo();var pg=go();var hg=z("stream");var Nu=mo();var yo=z("util");function Mu(t,e){return fg.from(t,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function gg(t,e,n){n=n||"utf8";var i=Mu(Nu(t),"binary");var r=Mu(Nu(e),n);return yo.format("%s.%s",i,r)}function ku(t){var e=t.header;var n=t.payload;var i=t.secret||t.privateKey;var r=t.encoding;var o=pg(e.alg);var l=gg(e,n,r);var u=o.sign(l,i);return yo.format("%s.%s",l,u)}function jn(t){var e=t.secret;e=e==null?t.privateKey:e;e=e==null?t.key:e;if(/^hs/i.test(t.header.alg)===true&&e==null){throw new TypeError("secret must be a string or buffer or a KeyObject")}var n=new Pu(e);this.readable=true;this.header=t.header;this.encoding=t.encoding;this.secret=this.privateKey=this.key=n;this.payload=new Pu(t.payload);this.secret.once("close",function(){if(!this.payload.writable&&this.readable)this.sign()}.bind(this));this.payload.once("close",function(){if(!this.secret.writable&&this.readable)this.sign()}.bind(this))}yo.inherits(jn,hg);jn.prototype.sign=function t(){try{var e=ku({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});this.emit("done",e);this.emit("data",e);this.emit("end");this.readable=false;return e}catch(n){this.readable=false;this.emit("error",n);this.emit("close")}};jn.sign=ku;xu.exports=jn});var Bu=F((dI,Vu)=>{var Lu=an().Buffer;var Uu=uo();var mg=go();var yg=z("stream");var Gu=mo();var Eg=z("util");var _g=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function Tg(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ag(t){if(Tg(t))return t;try{return JSON.parse(t)}catch(e){return void 0}}function Ou(t){var e=t.split(".",1)[0];return Ag(Lu.from(e,"base64").toString("binary"))}function Cg(t){return t.split(".",2).join(".")}function bu(t){return t.split(".")[2]}function vg(t,e){e=e||"utf8";var n=t.split(".")[1];return Lu.from(n,"base64").toString(e)}function Fu(t){return _g.test(t)&&!!Ou(t)}function qu(t,e,n){if(!e){var i=new Error("Missing algorithm parameter for jws.verify");i.code="MISSING_ALGORITHM";throw i}t=Gu(t);var r=bu(t);var o=Cg(t);var l=mg(e);return l.verify(o,r,n)}function Hu(t,e){e=e||{};t=Gu(t);if(!Fu(t))return null;var n=Ou(t);if(!n)return null;var i=vg(t);if(n.typ==="JWT"||e.json)i=JSON.parse(i,e.encoding);return{header:n,payload:i,signature:bu(t)}}function Ht(t){t=t||{};var e=t.secret;e=e==null?t.publicKey:e;e=e==null?t.key:e;if(/^hs/i.test(t.algorithm)===true&&e==null){throw new TypeError("secret must be a string or buffer or a KeyObject")}var n=new Uu(e);this.readable=true;this.algorithm=t.algorithm;this.encoding=t.encoding;this.secret=this.publicKey=this.key=n;this.signature=new Uu(t.signature);this.secret.once("close",function(){if(!this.signature.writable&&this.readable)this.verify()}.bind(this));this.signature.once("close",function(){if(!this.secret.writable&&this.readable)this.verify()}.bind(this))}Eg.inherits(Ht,yg);Ht.prototype.verify=function t(){try{var e=qu(this.signature.buffer,this.algorithm,this.key.buffer);var n=Hu(this.signature.buffer,this.encoding);this.emit("done",e,n);this.emit("data",e);this.emit("end");this.readable=false;return e}catch(i){this.readable=false;this.emit("error",i);this.emit("close")}};Ht.decode=Hu;Ht.isValid=Fu;Ht.verify=qu;Vu.exports=Ht});var Eo=F(dt=>{var $u=Du();var ei=Bu();var Sg=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];dt.ALGORITHMS=Sg;dt.sign=$u.sign;dt.verify=ei.verify;dt.decode=ei.decode;dt.isValid=ei.isValid;dt.createSign=function t(e){return new $u(e)};dt.createVerify=function t(e){return new ei(e)}});var Ku=F(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:true});ti.buildPayloadForJwsSign=Ju;ti.getJwsSign=Pg;var Ig=Eo();var wg="RS256";var Rg="https://oauth2.googleapis.com/token";function Ju(t){const e=Math.floor(new Date().getTime()/1e3);const n={iss:t.iss,scope:t.scope,aud:Rg,exp:e+3600,iat:e,sub:t.sub,...t.additionalClaims};return n}function Pg(t){const e=Ju(t);return(0,Ig.sign)({header:{alg:wg},payload:e,secret:t.key})}});var Wu=F(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:true});_o.getToken=Dg;var Ng=Ku();var Mg="https://oauth2.googleapis.com/token";var kg="urn:ietf:params:oauth:grant-type:jwt-bearer";var xg=t=>{return{method:"POST",url:Mg,data:new URLSearchParams({grant_type:kg,assertion:(0,Ng.getJwsSign)(t)}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}}};async function Dg(t){if(!t.transporter){throw new Error("No transporter set.")}try{const e=xg(t);const n=await t.transporter.request(e);return n.data}catch(e){const n=e;const i=n.response?.data;if(i?.error){n.message=`${i.error}: ${i.error_description}`}throw n}}});var Yu=F(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:true});ni.ErrorWithCode=void 0;var To=class extends Error{code;constructor(e,n){super(e);this.code=n}};ni.ErrorWithCode=To});var wo=F(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:true});Io.getCredentials=Gg;var Ug=z("path");var zu=z("fs");var Lg=z("util");var ii=Yu();var Xu=zu.readFile?(0,Lg.promisify)(zu.readFile):async()=>{throw new ii.ErrorWithCode("use key rather than keyFile.","MISSING_CREDENTIALS")};var ft;(function(t){t["JSON"]=".json";t["DER"]=".der";t["CRT"]=".crt";t["PEM"]=".pem";t["P12"]=".p12";t["PFX"]=".pfx"})(ft||(ft={}));var Ao=class{keyFilePath;constructor(e){this.keyFilePath=e}async getCredentials(){const e=await Xu(this.keyFilePath,"utf8");let n;try{n=JSON.parse(e)}catch(o){const l=o;throw new Error(`Invalid JSON key file: ${l.message}`)}const i=n.private_key;const r=n.client_email;if(!i||!r){throw new ii.ErrorWithCode("private_key and client_email are required.","MISSING_CREDENTIALS")}return{privateKey:i,clientEmail:r}}};var Co=class{keyFilePath;constructor(e){this.keyFilePath=e}async getCredentials(){const e=await Xu(this.keyFilePath,"utf8");return{privateKey:e}}};var vo=class{async getCredentials(){throw new ii.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")}};var So=class{static create(e){const n=Ug.extname(e);switch(n){case ft.JSON:return new Ao(e);case ft.DER:case ft.CRT:case ft.PEM:return new Co(e);case ft.P12:case ft.PFX:return new vo;default:throw new ii.ErrorWithCode("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE")}}};async function Gg(t){const e=So.create(t);return e.getCredentials()}});var Qu=F(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:true});ri.TokenHandler=void 0;var Og=Wu();var bg=wo();var Ro=class{token;tokenExpiresAt;inFlightRequest;tokenOptions;constructor(e){this.tokenOptions=e}async processCredentials(){if(!this.tokenOptions.key&&!this.tokenOptions.keyFile){throw new Error("No key or keyFile set.")}if(!this.tokenOptions.key&&this.tokenOptions.keyFile){const e=await(0,bg.getCredentials)(this.tokenOptions.keyFile);this.tokenOptions.key=e.privateKey;this.tokenOptions.email=e.clientEmail}}isTokenExpiring(){if(!this.token||!this.tokenExpiresAt){return true}const e=new Date().getTime();const n=this.tokenOptions.eagerRefreshThresholdMillis??0;return this.tokenExpiresAt<=e+n}hasExpired(){const e=new Date().getTime();if(this.token&&this.tokenExpiresAt){const n=new Date().getTime();return n>=this.tokenExpiresAt}return true}async getToken(e){await this.processCredentials();if(this.inFlightRequest&&!e){return this.inFlightRequest}if(this.token&&!this.isTokenExpiring()&&!e){return this.token}try{this.inFlightRequest=(0,Og.getToken)(this.tokenOptions);const n=await this.inFlightRequest;this.token=n;this.tokenExpiresAt=new Date().getTime()+(n.expires_in??0)*1e3;return n}finally{this.inFlightRequest=void 0}}};ri.TokenHandler=Ro});var Zu=F(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:true});Po.revokeToken=Hg;var Fg="https://oauth2.googleapis.com/revoke?token=";var qg=true;async function Hg(t,e){const n=Fg+t;return await e.request({url:n,retry:qg})}});var Mo=F(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:true});oi.GoogleToken=void 0;var Vg=ge();var ju=Qu();var Bg=Zu();var No=class{tokenOptions;tokenHandler;constructor(e){this.tokenOptions=e||{};this.tokenOptions.transporter=this.tokenOptions.transporter||{request:n=>(0,Vg.request)(n)};if(!this.tokenOptions.iss){this.tokenOptions.iss=this.tokenOptions.email}if(typeof this.tokenOptions.scope==="object"){this.tokenOptions.scope=this.tokenOptions.scope.join(" ")}this.tokenHandler=new ju.TokenHandler(this.tokenOptions)}get expiresAt(){return this.tokenHandler.tokenExpiresAt}get accessToken(){return this.tokenHandler.token?.access_token}get idToken(){return this.tokenHandler.token?.id_token}get tokenType(){return this.tokenHandler.token?.token_type}get refreshToken(){return this.tokenHandler.token?.refresh_token}hasExpired(){return this.tokenHandler.hasExpired()}isTokenExpiring(){return this.tokenHandler.isTokenExpiring()}getToken(e,n={forceRefresh:false}){let i;if(typeof e==="function"){i=e}else if(typeof e==="object"){n=e}const r=this.tokenHandler.getToken(n.forceRefresh??false);if(i){r.then(o=>i(null,o),i)}return r}revokeToken(e){if(!this.accessToken){return Promise.reject(new Error("No token to revoke."))}const n=(0,Bg.revokeToken)(this.accessToken,this.tokenOptions.transporter);if(e){n.then(()=>e(),e)}this.tokenHandler=new ju.TokenHandler(this.tokenOptions)}get googleTokenOptions(){return this.tokenOptions}};oi.GoogleToken=No});var xo=F(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:true});si.JWTAccess=void 0;var $g=Eo();var Jg=qe();var ec={alg:"RS256",typ:"JWT"};var ko=class t{email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new Jg.LRUCache({capacity:500,maxAge:60*60*1e3});constructor(e,n,i,r){this.email=e;this.key=n;this.keyId=i;this.eagerRefreshThresholdMillis=r??5*60*1e3}getCachedKey(e,n){let i=e;if(n&&Array.isArray(n)&&n.length){i=e?`${e}_${n.join("_")}`:`${n.join("_")}`}else if(typeof n==="string"){i=e?`${e}_${n}`:n}if(!i){throw Error("Scopes or url must be provided")}return i}getRequestHeaders(e,n,i){const r=this.getCachedKey(e,i);const o=this.cache.get(r);const l=Date.now();if(o&&o.expiration-l>this.eagerRefreshThresholdMillis){return new Headers(o.headers)}const u=Math.floor(Date.now()/1e3);const c=t.getExpirationTime(u);let d;if(Array.isArray(i)){i=i.join(" ")}if(i){d={iss:this.email,sub:this.email,scope:i,exp:c,iat:u}}else{d={iss:this.email,sub:this.email,aud:e,exp:c,iat:u}}if(n){for(const _ in d){if(n[_]){throw new Error(`The '${_}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}}}const f=this.keyId?{...ec,kid:this.keyId}:ec;const p=Object.assign(d,n);const h=$g.sign({header:f,payload:p,secret:this.key});const m=new Headers({authorization:`Bearer ${h}`});this.cache.set(r,{expiration:c*1e3,headers:m});return m}static getExpirationTime(e){const n=e+3600;return n}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,n){if(n){this.fromStreamAsync(e).then(()=>n(),n)}else{return this.fromStreamAsync(e)}}fromStreamAsync(e){return new Promise((n,i)=>{if(!e){i(new Error("Must pass in a stream containing the service account auth settings."))}let r="";e.setEncoding("utf8").on("data",o=>r+=o).on("error",i).on("end",()=>{try{const o=JSON.parse(r);this.fromJSON(o);n()}catch(o){i(o)}})})}};si.JWTAccess=ko});var Uo=F(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:true});li.JWT=void 0;var tc=Mo();var Kg=wo();var Wg=xo();var Yg=ct();var ai=Pe();var Do=class t extends Yg.OAuth2Client{email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(e={}){super(e);this.email=e.email;this.keyFile=e.keyFile;this.key=e.key;this.keyId=e.keyId;this.scopes=e.scopes;this.subject=e.subject;this.additionalClaims=e.additionalClaims;this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(e){const n=new t(this);n.scopes=e;return n}async getRequestMetadataAsync(e){e=this.defaultServicePath?`https://${this.defaultServicePath}/`:e;const n=!this.hasUserScopes()&&e||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==ai.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==ai.DEFAULT_UNIVERSE){throw new RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${ai.DEFAULT_UNIVERSE}`)}if(!this.apiKey&&n){if(this.additionalClaims&&this.additionalClaims.target_audience){const{tokens:i}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${i.id_token}`}))}}else{if(!this.access){this.access=new Wg.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis)}let i;if(this.hasUserScopes()){i=this.scopes}else if(!e){i=this.defaultScopes}const r=this.useJWTAccessWithScope||this.universeDomain!==ai.DEFAULT_UNIVERSE;const o=await this.access.getRequestHeaders(e??void 0,this.additionalClaims,r?i:void 0);return{headers:this.addSharedMetadataHeaders(o)}}}else if(this.hasAnyScopes()||this.apiKey){return super.getRequestMetadataAsync(e)}else{return{headers:new Headers}}}async fetchIdToken(e){const n=new tc.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 n.getToken({forceRefresh:true});if(!n.idToken){throw new Error("Unknown error: Failed to fetch ID token")}return n.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(n=>e(null,n),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.googleTokenOptions?.key;this.email=this.gtoken.googleTokenOptions?.iss;return e.tokens}async refreshTokenNoCache(){const e=this.createGToken();const n=await e.getToken({forceRefresh:this.isTokenExpiring()});const i={access_token:n.access_token,token_type:"Bearer",expiry_date:e.expiresAt,id_token:e.idToken};this.emit("tokens",i);return{res:null,tokens:i}}createGToken(){if(!this.gtoken){this.gtoken=new tc.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;this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,n){if(n){this.fromStreamAsync(e).then(()=>n(),n)}else{return this.fromStreamAsync(e)}}fromStreamAsync(e){return new Promise((n,i)=>{if(!e){throw new Error("Must pass in a stream containing the service account auth settings.")}let r="";e.setEncoding("utf8").on("error",i).on("data",o=>r+=o).on("end",()=>{try{const o=JSON.parse(r);this.fromJSON(o);n()}catch(o){i(o)}})})}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 n=await(0,Kg.getCredentials)(this.keyFile);return{private_key:n.privateKey,client_email:n.clientEmail}}throw new Error("A key or a keyFile must be provided to getCredentials.")}};li.JWT=Do});var Go=F(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:true});Vt.UserRefreshClient=Vt.USER_REFRESH_ACCOUNT_TYPE=void 0;var zg=ct();var Xg=Pe();Vt.USER_REFRESH_ACCOUNT_TYPE="authorized_user";var Lo=class t extends zg.OAuth2Client{_refreshToken;constructor(e,n,i,r,o){const l=e&&typeof e==="object"?e:{clientId:e,clientSecret:n,refreshToken:i,eagerRefreshThresholdMillis:r,forceRefreshOnFailure:o};super(l);this._refreshToken=l.refreshToken;this.credentials.refresh_token=l.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(e){const n={...t.RETRY_CONFIG,url:this.endpoints.oauth2TokenUrl,method:"POST",data:new URLSearchParams({client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:this._refreshToken,target_audience:e}),responseType:"json"};Xg.AuthClient.setMethodName(n,"fetchIdToken");const i=await this.transporter.request(n);return i.data.id_token}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;this.universeDomain=e.universe_domain||this.universeDomain}fromStream(e,n){if(n){this.fromStreamAsync(e).then(()=>n(),n)}else{return this.fromStreamAsync(e)}}async fromStreamAsync(e){return new Promise((n,i)=>{if(!e){return i(new Error("Must pass in a stream containing the user refresh token."))}let r="";e.setEncoding("utf8").on("error",i).on("data",o=>r+=o).on("end",()=>{try{const o=JSON.parse(r);this.fromJSON(o);return n()}catch(o){return i(o)}})})}static fromJSON(e){const n=new t;n.fromJSON(e);return n}};Vt.UserRefreshClient=Lo});var bo=F(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:true});Bt.Impersonated=Bt.IMPERSONATED_ACCOUNT_TYPE=void 0;var nc=ct();var Qg=ge();var Zg=qe();Bt.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";var Oo=class t extends nc.OAuth2Client{sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(e={}){super(e);this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"};this.sourceClient=e.sourceClient??new nc.OAuth2Client;this.targetPrincipal=e.targetPrincipal??"";this.delegates=e.delegates??[];this.targetScopes=e.targetScopes??[];this.lifetime=e.lifetime??3600;const n=!!(0,Zg.originalOrCamelOptions)(e).get("universe_domain");if(!n){this.universeDomain=this.sourceClient.universeDomain}else if(this.sourceClient.universeDomain!==this.universeDomain){throw new RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`)}this.endpoint=e.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(e){await this.sourceClient.getAccessToken();const n=`projects/-/serviceAccounts/${this.targetPrincipal}`;const i=`${this.endpoint}/v1/${n}:signBlob`;const r={delegates:this.delegates,payload:Buffer.from(e).toString("base64")};const o=await this.sourceClient.request({...t.RETRY_CONFIG,url:i,data:r,method:"POST"});return o.data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();const e="projects/-/serviceAccounts/"+this.targetPrincipal;const n=`${this.endpoint}/v1/${e}:generateAccessToken`;const i={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"};const r=await this.sourceClient.request({...t.RETRY_CONFIG,url:n,data:i,method:"POST"});const o=r.data;this.credentials.access_token=o.accessToken;this.credentials.expiry_date=Date.parse(o.expireTime);return{tokens:this.credentials,res:r}}catch(e){if(!(e instanceof Error))throw e;let n=0;let i="";if(e instanceof Qg.GaxiosError){n=e?.response?.data?.error?.status;i=e?.response?.data?.error?.message}if(n&&i){e.message=`${n}: unable to impersonate: ${i}`;throw e}else{e.message=`unable to impersonate: ${e}`;throw e}}}async fetchIdToken(e,n){await this.sourceClient.getAccessToken();const i=`projects/-/serviceAccounts/${this.targetPrincipal}`;const r=`${this.endpoint}/v1/${i}:generateIdToken`;const o={delegates:this.delegates,audience:e,includeEmail:n?.includeEmail??true,useEmailAzp:n?.includeEmail??true};const l=await this.sourceClient.request({...t.RETRY_CONFIG,url:r,data:o,method:"POST"});return l.data.token}};Bt.Impersonated=Oo});var qo=F(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:true});En.OAuthClientAuthHandler=void 0;En.getErrorFromOAuthErrorResponse=tm;var $t=ge();var jg=fn();var em=["PUT","POST","PATCH"];var Fo=class{#e=(0,jg.createCrypto)();#t;transporter;constructor(e){if(e&&"clientId"in e){this.#t=e;this.transporter=new $t.Gaxios}else{this.#t=e?.clientAuthentication;this.transporter=e?.transporter||new $t.Gaxios}}applyClientAuthenticationOptions(e,n){e.headers=$t.Gaxios.mergeHeaders(e.headers);this.injectAuthenticatedHeaders(e,n);if(!n){this.injectAuthenticatedRequestBody(e)}}injectAuthenticatedHeaders(e,n){if(n){e.headers=$t.Gaxios.mergeHeaders(e.headers,{authorization:`Bearer ${n}`})}else if(this.#t?.confidentialClientType==="basic"){e.headers=$t.Gaxios.mergeHeaders(e.headers);const i=this.#t.clientId;const r=this.#t.clientSecret||"";const o=this.#e.encodeBase64StringUtf8(`${i}:${r}`);$t.Gaxios.mergeHeaders(e.headers,{authorization:`Basic ${o}`})}}injectAuthenticatedRequestBody(e){if(this.#t?.confidentialClientType==="request-body"){const n=(e.method||"GET").toUpperCase();if(!em.includes(n)){throw new Error(`${n} HTTP method does not support ${this.#t.confidentialClientType} client authentication`)}const i=new Headers(e.headers);const r=i.get("content-type");if(r?.startsWith("application/x-www-form-urlencoded")||e.data instanceof URLSearchParams){const o=new URLSearchParams(e.data??"");o.append("client_id",this.#t.clientId);o.append("client_secret",this.#t.clientSecret||"");e.data=o}else if(r?.startsWith("application/json")){e.data=e.data||{};Object.assign(e.data,{client_id:this.#t.clientId,client_secret:this.#t.clientSecret||""})}else{throw new Error(`${r} content-types are not supported with ${this.#t.confidentialClientType} client authentication`)}}}static get RETRY_CONFIG(){return{retry:true,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}};En.OAuthClientAuthHandler=Fo;function tm(t,e){const n=t.error;const i=t.error_description;const r=t.error_uri;let o=`Error code ${n}`;if(typeof i!=="undefined"){o+=`: ${i}`}if(typeof r!=="undefined"){o+=` - ${r}`}const l=new Error(o);if(e){const u=Object.keys(e);if(e.stack){u.push("stack")}u.forEach(c=>{if(c!=="message"){Object.defineProperty(l,c,{value:e[c],writable:false,enumerable:true})}})}return l}});var ci=F(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:true});ui.StsCredentials=void 0;var nm=ge();var im=Pe();var ic=qo();var rm=qe();var Ho=class t extends ic.OAuthClientAuthHandler{#e;constructor(e={tokenExchangeEndpoint:""},n){if(typeof e!=="object"||e instanceof URL){e={tokenExchangeEndpoint:e,clientAuthentication:n}}super(e);this.#e=e.tokenExchangeEndpoint}async exchangeToken(e,n,i){const r={grant_type:e.grantType,resource:e.resource,audience:e.audience,scope:e.scope?.join(" "),requested_token_type:e.requestedTokenType,subject_token:e.subjectToken,subject_token_type:e.subjectTokenType,actor_token:e.actingParty?.actorToken,actor_token_type:e.actingParty?.actorTokenType,options:i&&JSON.stringify(i)};const o={...t.RETRY_CONFIG,url:this.#e.toString(),method:"POST",headers:n,data:new URLSearchParams((0,rm.removeUndefinedValuesInObject)(r)),responseType:"json"};im.AuthClient.setMethodName(o,"exchangeToken");this.applyClientAuthenticationOptions(o);try{const l=await this.transporter.request(o);const u=l.data;u.res=l;return u}catch(l){if(l instanceof nm.GaxiosError&&l.response){throw(0,ic.getErrorFromOAuthErrorResponse)(l.response.data,l)}throw l}}};ui.StsCredentials=Ho});var pt=F(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:true});Ge.BaseExternalAccountClient=Ge.CLOUD_RESOURCE_MANAGER=Ge.EXTERNAL_ACCOUNT_TYPE=Ge.EXPIRATION_TIME_OFFSET=void 0;var om=ge();var sm=z("stream");var Vo=Pe();var am=ci();var rc=qe();var lm=Xr();var um="urn:ietf:params:oauth:grant-type:token-exchange";var cm="urn:ietf:params:oauth:token-type:access_token";var Bo="https://www.googleapis.com/auth/cloud-platform";var dm=3600;Ge.EXPIRATION_TIME_OFFSET=5*60*1e3;Ge.EXTERNAL_ACCOUNT_TYPE="external_account";Ge.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var fm="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+";var pm="https://sts.{universeDomain}/v1/token";var $o=class t extends Vo.AuthClient{scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#e=null;constructor(e){super(e);const n=(0,rc.originalOrCamelOptions)(e);const i=n.get("type");if(i&&i!==Ge.EXTERNAL_ACCOUNT_TYPE){throw new Error(`Expected "${Ge.EXTERNAL_ACCOUNT_TYPE}" type but received "${e.type}"`)}const r=n.get("client_id");const o=n.get("client_secret");this.tokenUrl=n.get("token_url")??pm.replace("{universeDomain}",this.universeDomain);const l=n.get("subject_token_type");const u=n.get("workforce_pool_user_project");const c=n.get("service_account_impersonation_url");const d=n.get("service_account_impersonation");const f=(0,rc.originalOrCamelOptions)(d).get("token_lifetime_seconds");this.cloudResourceManagerURL=new URL(n.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`);if(r){this.clientAuth={confidentialClientType:"basic",clientId:r,clientSecret:o}}this.stsCredential=new am.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth});this.scopes=n.get("scopes")||[Bo];this.cachedAccessToken=null;this.audience=n.get("audience");this.subjectTokenType=l;this.workforcePoolUserProject=u;const p=new RegExp(fm);if(this.workforcePoolUserProject&&!this.audience.match(p)){throw new Error("workforcePoolUserProject should not be set for non-workforce pool credentials.")}this.serviceAccountImpersonationUrl=c;this.serviceAccountImpersonationLifetime=f;if(this.serviceAccountImpersonationLifetime){this.configLifetimeRequested=true}else{this.configLifetimeRequested=false;this.serviceAccountImpersonationLifetime=dm}this.projectNumber=this.getProjectNumber(this.audience);this.supplierContext={audience:this.audience,subjectTokenType:this.subjectTokenType,transporter:this.transporter}}getServiceAccountEmail(){if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256){throw new RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`)}const e=/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/;const n=e.exec(this.serviceAccountImpersonationUrl);return n?.groups?.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 n=new Headers({authorization:`Bearer ${e.token}`});return this.addSharedMetadataHeaders(n)}request(e,n){if(n){this.requestAsync(e).then(i=>n(null,i),i=>{return n(i,i.response)})}else{return this.requestAsync(e)}}async getProjectId(){const e=this.projectNumber||this.workforcePoolUserProject;if(this.projectId){return this.projectId}else if(e){const n=await this.getRequestHeaders();const i={...t.RETRY_CONFIG,headers:n,url:`${this.cloudResourceManagerURL.toString()}${e}`,responseType:"json"};Vo.AuthClient.setMethodName(i,"getProjectId");const r=await this.transporter.request(i);this.projectId=r.data.projectId;return this.projectId}return null}async requestAsync(e,n=false){let i;try{const r=await this.getRequestHeaders();e.headers=om.Gaxios.mergeHeaders(e.headers);this.addUserProjectAndAuthHeaders(e.headers,r);i=await this.transporter.request(e)}catch(r){const o=r.response;if(o){const l=o.status;const u=o.config.data instanceof sm.Readable;const c=l===401||l===403;if(!n&&c&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw r}return i}async refreshAccessTokenAsync(){this.#e=this.#e||this.#t();try{return await this.#e}finally{this.#e=null}}async#t(){const e=await this.retrieveSubjectToken();const n={grantType:um,audience:this.audience,requestedTokenType:cm,subjectToken:e,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[Bo]:this.getScopesArray()};const i=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0;const r=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()});const o=await this.stsCredential.exchangeToken(n,r,i);if(this.serviceAccountImpersonationUrl){this.cachedAccessToken=await this.getImpersonatedAccessToken(o.access_token)}else if(o.expires_in){this.cachedAccessToken={access_token:o.access_token,expiry_date:new Date().getTime()+o.expires_in*1e3,res:o.res}}else{this.cachedAccessToken={access_token:o.access_token,res:o.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 n=e.match(/\/projects\/([^/]+)/);if(!n){return null}return n[1]}async getImpersonatedAccessToken(e){const n={...t.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"},responseType:"json"};Vo.AuthClient.setMethodName(n,"getImpersonatedAccessToken");const i=await this.transporter.request(n);const r=i.data;return{access_token:r.accessToken,expiry_date:new Date(r.expireTime).getTime(),res:i}}isExpired(e){const n=new Date().getTime();return e.expiry_date?n>=e.expiry_date-this.eagerRefreshThresholdMillis:false}getScopesArray(){if(typeof this.scopes==="string"){return[this.scopes]}return this.scopes||[Bo]}getMetricsHeaderValue(){const e=process.version.replace(/^v/,"");const n=this.serviceAccountImpersonationUrl!==void 0;const i=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${e} auth/${lm.pkg.version} google-byoid-sdk source/${i} sa-impersonation/${n} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}};Ge.BaseExternalAccountClient=$o});var oc=F(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:true});di.FileSubjectTokenSupplier=void 0;var Ko=z("util");var Wo=z("fs");var hm=(0,Ko.promisify)(Wo.readFile??(()=>{}));var gm=(0,Ko.promisify)(Wo.realpath??(()=>{}));var mm=(0,Ko.promisify)(Wo.lstat??(()=>{}));var Jo=class{filePath;formatType;subjectTokenFieldName;constructor(e){this.filePath=e.filePath;this.formatType=e.formatType;this.subjectTokenFieldName=e.subjectTokenFieldName}async getSubjectToken(){let e=this.filePath;try{e=await gm(e);if(!(await mm(e)).isFile()){throw new Error}}catch(r){if(r instanceof Error){r.message=`The file at ${e} does not exist, or it is not a file. ${r.message}`}throw r}let n;const i=await hm(e,{encoding:"utf8"});if(this.formatType==="text"){n=i}else if(this.formatType==="json"&&this.subjectTokenFieldName){const r=JSON.parse(i);n=r[this.subjectTokenFieldName]}if(!n){throw new Error("Unable to parse the subject_token from the credential_source file")}return n}};di.FileSubjectTokenSupplier=Jo});var sc=F(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:true});fi.UrlSubjectTokenSupplier=void 0;var ym=Pe();var Yo=class{url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(e){this.url=e.url;this.formatType=e.formatType;this.subjectTokenFieldName=e.subjectTokenFieldName;this.headers=e.headers;this.additionalGaxiosOptions=e.additionalGaxiosOptions}async getSubjectToken(e){const n={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers,responseType:this.formatType};ym.AuthClient.setMethodName(n,"getSubjectToken");let i;if(this.formatType==="text"){const r=await e.transporter.request(n);i=r.data}else if(this.formatType==="json"&&this.subjectTokenFieldName){const r=await e.transporter.request(n);i=r.data[this.subjectTokenFieldName]}if(!i){throw new Error("Unable to parse the subject_token from the credential_source URL")}return i}};fi.UrlSubjectTokenSupplier=Yo});var ac=F(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:true});Ne.CertificateSubjectTokenSupplier=Ne.InvalidConfigurationError=Ne.CertificateSourceUnavailableError=Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var pi=qe();var hi=z("fs");var gi=z("crypto");var Em=z("https");Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";var je=class extends Error{constructor(e){super(e);this.name="CertificateSourceUnavailableError"}};Ne.CertificateSourceUnavailableError=je;var Oe=class extends Error{constructor(e){super(e);this.name="InvalidConfigurationError"}};Ne.InvalidConfigurationError=Oe;var zo=class{certificateConfigPath;trustChainPath;cert;key;constructor(e){if(!e.useDefaultCertificateConfig&&!e.certificateConfigLocation){throw new Oe("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.")}if(e.useDefaultCertificateConfig&&e.certificateConfigLocation){throw new Oe("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.")}this.trustChainPath=e.trustChainPath;this.certificateConfigPath=e.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert){throw new Oe("Cannot create mTLS Agent with missing certificate or key")}return new Em.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#e();const{certPath:e,keyPath:n}=await this.#t();({cert:this.cert,key:this.key}=await this.#n(e,n));return await this.#i(this.cert)}async#e(){const e=this.certificateConfigPath;if(e){if(await(0,pi.isValidFile)(e)){return e}throw new je(`Provided certificate config path is invalid: ${e}`)}const n=process.env[Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(n){if(await(0,pi.isValidFile)(n)){return n}throw new je(`Path from environment variable "${Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${n}`)}const i=(0,pi.getWellKnownCertificateConfigFileLocation)();if(await(0,pi.isValidFile)(i)){return i}throw new je(`Could not find certificate configuration file. Searched override path, the "${Ne.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${i}).`)}async#t(){const e=this.certificateConfigPath;let n;try{n=await hi.promises.readFile(e,"utf8")}catch(i){throw new je(`Failed to read certificate config file at: ${e}`)}try{const i=JSON.parse(n);const r=i?.cert_configs?.workload?.cert_path;const o=i?.cert_configs?.workload?.key_path;if(!r||!o){throw new Oe(`Certificate config file (${e}) is missing required "cert_path" or "key_path" in the workload config.`)}return{certPath:r,keyPath:o}}catch(i){if(i instanceof Oe)throw i;throw new Oe(`Failed to parse certificate config from ${e}: ${i.message}`)}}async#n(e,n){let i,r;try{i=await hi.promises.readFile(e);new gi.X509Certificate(i)}catch(o){const l=o instanceof Error?o.message:String(o);throw new je(`Failed to read certificate file at ${e}: ${l}`)}try{r=await hi.promises.readFile(n);(0,gi.createPrivateKey)(r)}catch(o){const l=o instanceof Error?o.message:String(o);throw new je(`Failed to read private key file at ${n}: ${l}`)}return{cert:i,key:r}}async#i(e){const n=new gi.X509Certificate(e);if(!this.trustChainPath){return JSON.stringify([n.raw.toString("base64")])}try{const i=await hi.promises.readFile(this.trustChainPath,"utf8");const r=i.match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[];const o=r.map((c,d)=>{try{return new gi.X509Certificate(c)}catch(f){const p=f instanceof Error?f.message:String(f);throw new Oe(`Failed to parse certificate at index ${d} in trust chain file ${this.trustChainPath}: ${p}`)}});const l=o.findIndex(c=>n.raw.equals(c.raw));let u;if(l===-1){u=[n,...o]}else if(l===0){u=o}else{throw new Oe(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${l}).`)}return JSON.stringify(u.map(c=>c.raw.toString("base64")))}catch(i){if(i instanceof Oe)throw i;const r=i instanceof Error?i.message:String(i);throw new je(`Failed to process certificate chain from ${this.trustChainPath}: ${r}`)}}};Ne.CertificateSubjectTokenSupplier=zo});var Zo=F(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:true});mi.IdentityPoolClient=void 0;var _m=pt();var Xo=qe();var Tm=oc();var Am=sc();var lc=ac();var Cm=ci();var uc=ge();var Qo=class t extends _m.BaseExternalAccountClient{subjectTokenSupplier;constructor(e){super(e);const n=(0,Xo.originalOrCamelOptions)(e);const i=n.get("credential_source");const r=n.get("subject_token_supplier");if(!i&&!r){throw new Error("A credential source or subject token supplier must be specified.")}if(i&&r){throw new Error("Only one of credential source or subject token supplier can be specified.")}if(r){this.subjectTokenSupplier=r;this.credentialSourceType="programmatic"}else{const o=(0,Xo.originalOrCamelOptions)(i);const l=(0,Xo.originalOrCamelOptions)(o.get("format"));const u=l.get("type")||"text";const c=l.get("subject_token_field_name");if(u!=="json"&&u!=="text"){throw new Error(`Invalid credential_source format "${u}"`)}if(u==="json"&&!c){throw new Error("Missing subject_token_field_name for JSON credential_source format")}const d=o.get("file");const f=o.get("url");const p=o.get("certificate");const h=o.get("headers");if(d&&f||f&&p||d&&p){throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}else if(d){this.credentialSourceType="file";this.subjectTokenSupplier=new Tm.FileSubjectTokenSupplier({filePath:d,formatType:u,subjectTokenFieldName:c})}else if(f){this.credentialSourceType="url";this.subjectTokenSupplier=new Am.UrlSubjectTokenSupplier({url:f,formatType:u,subjectTokenFieldName:c,headers:h,additionalGaxiosOptions:t.RETRY_CONFIG})}else if(p){this.credentialSourceType="certificate";const m=new lc.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:p.use_default_certificate_config,certificateConfigLocation:p.certificate_config_location,trustChainPath:p.trust_chain_path});this.subjectTokenSupplier=m}else{throw new Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}}async retrieveSubjectToken(){const e=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof lc.CertificateSubjectTokenSupplier){const n=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new Cm.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new uc.Gaxios({agent:n})});this.transporter=new uc.Gaxios({...this.transporter.defaults||{},agent:n})}return e}};mi.IdentityPoolClient=Qo});var es=F(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:true});Ei.AwsRequestSigner=void 0;var yi=ge();var dc=fn();var cc="AWS4-HMAC-SHA256";var vm="aws4_request";var jo=class{getCredentials;region;crypto;constructor(e,n){this.getCredentials=e;this.region=n;this.crypto=(0,dc.createCrypto)()}async getRequestOptions(e){if(!e.url){throw new RangeError('"url" is required in "amzOptions"')}const n=typeof e.data==="object"?JSON.stringify(e.data):e.data;const i=e.url;const r=e.method||"GET";const o=e.body||n;const l=e.headers;const u=await this.getCredentials();const c=new URL(i);if(typeof o!=="string"&&o!==void 0){throw new TypeError(`'requestPayload' is expected to be a string if provided. Got: ${o}`)}const d=await Im({crypto:this.crypto,host:c.host,canonicalUri:c.pathname,canonicalQuerystring:c.search.slice(1),method:r,region:this.region,securityCredentials:u,requestPayload:o,additionalAmzHeaders:l});const f=yi.Gaxios.mergeHeaders(d.amzDate?{"x-amz-date":d.amzDate}:{},{authorization:d.authorizationHeader,host:c.host},l||{});if(u.token){yi.Gaxios.mergeHeaders(f,{"x-amz-security-token":u.token})}const p={url:i,method:r,headers:f};if(o!==void 0){p.body=o}return p}};Ei.AwsRequestSigner=jo;async function _n(t,e,n){return await t.signWithHmacSha256(e,n)}async function Sm(t,e,n,i,r){const o=await _n(t,`AWS4${e}`,n);const l=await _n(t,o,i);const u=await _n(t,l,r);const c=await _n(t,u,"aws4_request");return c}async function Im(t){const e=yi.Gaxios.mergeHeaders(t.additionalAmzHeaders);const n=t.requestPayload||"";const i=t.host.split(".")[0];const r=new Date;const o=r.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,"");const l=r.toISOString().replace(/[-]/g,"").replace(/T.*/,"");if(t.securityCredentials.token){e.set("x-amz-security-token",t.securityCredentials.token)}const u=yi.Gaxios.mergeHeaders({host:t.host},e.has("date")?{}:{"x-amz-date":o},e);let c="";const d=[...u.keys()].sort();d.forEach(G=>{c+=`${G}:${u.get(G)}
6
6
  `});const f=d.join(";");const p=await t.crypto.sha256DigestHex(n);const h=`${t.method.toUpperCase()}
7
7
  ${t.canonicalUri}
8
8
  ${t.canonicalQuerystring}