@muxcodecli/cli 1.15.17 → 1.15.18
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.
- package/dist/bip-bop-01-ga21wr3r.mp3 +0 -0
- package/dist/bip-bop-03-kgfd4rq4.mp3 +0 -0
- package/dist/chunk-0hqmdrjr.js +3 -0
- package/dist/chunk-0npjzye0.js +2 -0
- package/dist/chunk-0pe6y883.js +2 -0
- package/dist/chunk-0qqpjj2h.js +3 -0
- package/dist/chunk-0r3h8jgj.js +2 -0
- package/dist/chunk-11285jfy.js +3 -0
- package/dist/chunk-11ant2kk.js +3 -0
- package/dist/chunk-124qmktt.js +18 -0
- package/dist/chunk-138ntz3h.js +2 -0
- package/dist/chunk-1e73ypg5.js +3 -0
- package/dist/chunk-1evcc54z.js +3 -0
- package/dist/chunk-1mqsg5s7.js +75 -0
- package/dist/chunk-1pv2317e.js +7 -0
- package/dist/chunk-1y3ssxx6.js +2 -0
- package/dist/chunk-20x8vsdn.js +7 -0
- package/dist/chunk-21x3anp4.js +9 -0
- package/dist/chunk-22qpzg37.js +212 -0
- package/dist/chunk-2bt5mtgm.js +3 -0
- package/dist/chunk-2d95ene8.js +2 -0
- package/dist/chunk-2h2zq5cp.js +2 -0
- package/dist/chunk-2pc63est.js +2 -0
- package/dist/chunk-33gs9z8d.js +2 -0
- package/dist/chunk-33vwwxjk.js +2 -0
- package/dist/chunk-3dq7hfxc.js +9 -0
- package/dist/chunk-3jvft1k1.js +2 -0
- package/dist/chunk-4jqh4mpm.js +2 -0
- package/dist/chunk-4mgyaytc.js +672 -0
- package/dist/chunk-4va8fzq1.js +2 -0
- package/dist/chunk-4wkq9y2z.js +7 -0
- package/dist/chunk-526nbm9e.js +2 -0
- package/dist/chunk-5a6895cv.js +37 -0
- package/dist/chunk-5e9dq2av.js +2 -0
- package/dist/chunk-5jn2z3nf.js +3 -0
- package/dist/chunk-5npr1qyq.js +574 -0
- package/dist/chunk-5sfky0gz.js +8 -0
- package/dist/chunk-5t7xqdvk.js +3 -0
- package/dist/chunk-5tpqj6ag.js +10 -0
- package/dist/chunk-5v5015am.js +12 -0
- package/dist/chunk-5wawdxv2.js +7 -0
- package/dist/chunk-6btrg3ff.js +2 -0
- package/dist/chunk-6skbzman.js +6 -0
- package/dist/chunk-6sz698ew.js +11 -0
- package/dist/chunk-6xzrzmsr.js +2 -0
- package/dist/chunk-7848rf5q.js +63 -0
- package/dist/chunk-7ep2edcv.js +12 -0
- package/dist/chunk-7svw66kw.js +13 -0
- package/dist/chunk-7xgr8vx6.js +2 -0
- package/dist/chunk-7zjn6m1m.js +2 -0
- package/dist/chunk-8atqb297.js +12 -0
- package/dist/chunk-8ebkxjar.js +7 -0
- package/dist/chunk-8j3aw4qg.js +3 -0
- package/dist/chunk-8jy0dvcn.js +3 -0
- package/dist/chunk-8refh038.js +2 -0
- package/dist/chunk-93cszp8k.js +3 -0
- package/dist/chunk-93ze3gcb.js +2 -0
- package/dist/chunk-98yxzxtd.js +2 -0
- package/dist/chunk-9g64kggy.js +3 -0
- package/dist/chunk-9h1pwxb2.js +8 -0
- package/dist/chunk-9j4j9nrm.js +2 -0
- package/dist/chunk-9kzczwh0.js +3 -0
- package/dist/chunk-9n629gtn.js +3 -0
- package/dist/chunk-9y59sxde.js +2 -0
- package/dist/chunk-a2m5jyd8.js +2 -0
- package/dist/chunk-a595cp8s.js +2 -0
- package/dist/chunk-ak0k3m4q.js +3 -0
- package/dist/chunk-apksmrz9.js +3 -0
- package/dist/chunk-b05r09sj.js +10 -0
- package/dist/chunk-b47e563q.js +2 -0
- package/dist/chunk-b57avnse.js +2 -0
- package/dist/chunk-bfjq7w7k.js +2 -0
- package/dist/chunk-bhc70qet.js +3 -0
- package/dist/chunk-bvtscj68.js +2 -0
- package/dist/chunk-bw2cy5v0.js +8 -0
- package/dist/chunk-c7dvyh2x.js +2 -0
- package/dist/chunk-cbz8b7g5.js +3 -0
- package/dist/chunk-cw4vbnet.js +3 -0
- package/dist/chunk-czcj3j9y.js +2 -0
- package/dist/chunk-dg466kdp.js +2 -0
- package/dist/chunk-dmscgnhq.js +2 -0
- package/dist/chunk-dtk4m8rm.js +3 -0
- package/dist/chunk-dy7akyj3.js +2 -0
- package/dist/chunk-e2wv2sp4.js +2 -0
- package/dist/chunk-e8j03wnd.js +3 -0
- package/dist/chunk-egkp6tct.js +2 -0
- package/dist/chunk-emfc800a.js +2 -0
- package/dist/chunk-envnht72.js +4 -0
- package/dist/chunk-eskw1cj2.js +3 -0
- package/dist/chunk-ezz15tyg.js +2 -0
- package/dist/chunk-fkmzj0qt.js +16 -0
- package/dist/chunk-fqt3c3g5.js +4 -0
- package/dist/chunk-frbht418.js +19 -0
- package/dist/chunk-ftz8cqfq.js +2 -0
- package/dist/chunk-g4jxdrr6.js +2 -0
- package/dist/chunk-g52xzmrr.js +2 -0
- package/dist/chunk-gbtvkje9.js +4 -0
- package/dist/chunk-gm9msqq5.js +8 -0
- package/dist/chunk-gxat3dpd.js +3 -0
- package/dist/chunk-hfppq1w5.js +4 -0
- package/dist/chunk-jdg870gy.js +1683 -0
- package/dist/chunk-jfz77m78.js +3 -0
- package/dist/chunk-jg9r58pf.js +16 -0
- package/dist/chunk-jgzt4945.js +2 -0
- package/dist/chunk-jh2epywq.js +2 -0
- package/dist/chunk-jpj6a56k.js +2 -0
- package/dist/chunk-jw4sgq23.js +2 -0
- package/dist/chunk-jws11ngd.js +2 -0
- package/dist/chunk-jxhz82qt.js +2 -0
- package/dist/chunk-k19y2psf.js +4 -0
- package/dist/chunk-k6cj14zk.js +2 -0
- package/dist/chunk-kktm0pdc.js +3 -0
- package/dist/chunk-kmr27ake.js +160 -0
- package/dist/chunk-kyhwvbvq.js +2 -0
- package/dist/chunk-mgn5pejx.js +2 -0
- package/dist/chunk-mskyzxb3.js +3 -0
- package/dist/chunk-my9cfmvt.js +5 -0
- package/dist/chunk-n4vx7kvs.js +389 -0
- package/dist/chunk-nc44rvs7.js +23 -0
- package/dist/chunk-ng3vbpmy.js +3 -0
- package/dist/chunk-nmnp5g5p.js +228 -0
- package/dist/chunk-nn0t3xmn.js +2 -0
- package/dist/chunk-npr41z9a.js +19 -0
- package/dist/chunk-ntvr3177.js +25 -0
- package/dist/chunk-pkc5hkha.js +2 -0
- package/dist/chunk-ppg6zhae.js +3 -0
- package/dist/chunk-pqwm9zk1.js +6 -0
- package/dist/chunk-ptvjmfqx.js +2 -0
- package/dist/chunk-q1r48y0y.js +34 -0
- package/dist/chunk-q9yddd1r.js +3 -0
- package/dist/chunk-qavtgsrh.js +2 -0
- package/dist/chunk-qvh8ghjw.js +7 -0
- package/dist/chunk-qx6r187q.js +2 -0
- package/dist/chunk-r093mfa8.js +32 -0
- package/dist/chunk-rbaj9ktq.js +2 -0
- package/dist/chunk-rkf9ynkx.js +3 -0
- package/dist/chunk-rpp44jtx.js +3 -0
- package/dist/chunk-rrvwp351.js +2 -0
- package/dist/chunk-rs8fsgqt.js +81 -0
- package/dist/chunk-s4gy87ft.js +8 -0
- package/dist/chunk-s5qq2ch2.js +12 -0
- package/dist/chunk-s92578qx.js +71 -0
- package/dist/chunk-snsb760m.js +2 -0
- package/dist/chunk-sp1cvejp.js +2 -0
- package/dist/chunk-spb3tm25.js +4 -0
- package/dist/chunk-srnmswkj.js +2 -0
- package/dist/chunk-sxgbzwrs.js +2 -0
- package/dist/chunk-t2s6m9t2.js +35 -0
- package/dist/chunk-t98sdxty.js +2 -0
- package/dist/chunk-tbnxx5na.js +2 -0
- package/dist/chunk-tfxm3qz4.js +2 -0
- package/dist/chunk-treb38pz.js +3 -0
- package/dist/chunk-tvw8tfpr.js +6 -0
- package/dist/chunk-v107htgw.js +101 -0
- package/dist/chunk-v8at4gnt.js +2 -0
- package/dist/chunk-vmr3get8.js +2 -0
- package/dist/chunk-vqrnejgj.js +71 -0
- package/dist/chunk-vvwy955j.js +3 -0
- package/dist/chunk-w5jxffnq.js +2 -0
- package/dist/chunk-wcbh5jqy.js +3 -0
- package/dist/chunk-wfmrnep1.js +2 -0
- package/dist/chunk-wk11yy8h.js +3 -0
- package/dist/chunk-wn5f1tfj.js +2 -0
- package/dist/chunk-wpm2p1gq.js +3 -0
- package/dist/chunk-wxkyv5gj.js +2 -0
- package/dist/chunk-wyed730e.js +2 -0
- package/dist/chunk-x65zs89t.js +3 -0
- package/dist/chunk-x6zjq78z.js +2 -0
- package/dist/chunk-xedav0qx.js +3 -0
- package/dist/chunk-xmftb9ad.js +38 -0
- package/dist/chunk-xvtkw7hj.js +3 -0
- package/dist/chunk-xy0txg0n.js +2 -0
- package/dist/chunk-y7s5cpwr.js +34 -0
- package/dist/chunk-yg48tfvv.js +16 -0
- package/dist/chunk-ygpen625.js +3 -0
- package/dist/chunk-ymb45bt6.js +2 -0
- package/dist/chunk-yp2zfcvh.js +8 -0
- package/dist/chunk-z3mx7n44.js +3 -0
- package/dist/chunk-zaj612bw.js +3 -0
- package/dist/chunk-zb3179f9.js +3 -0
- package/dist/chunk-zhd8f4pc.js +759 -0
- package/dist/chunk-zjpnyah2.js +3 -0
- package/dist/cli/cmd/tui/worker.js +2 -0
- package/dist/highlights-eq9cgrbb.scm +604 -0
- package/dist/highlights-ghv9g403.scm +205 -0
- package/dist/highlights-hk7bwhj4.scm +284 -0
- package/dist/highlights-r812a2qc.scm +150 -0
- package/dist/highlights-x6tmsnaa.scm +115 -0
- package/dist/index.js +146 -5742
- package/dist/injections-73j83es3.scm +27 -0
- package/dist/muxcode-linux-x64 +0 -0
- package/dist/nope-03-2z8weyjw.mp3 +0 -0
- package/dist/photon_rs_bg-bq08arze.wasm +0 -0
- package/dist/staplebops-06-rz29m246.mp3 +0 -0
- package/dist/tree-sitter-3jzf13jk.wasm +0 -0
- package/dist/tree-sitter-bash-hq5s6fxb.wasm +0 -0
- package/dist/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
- package/dist/tree-sitter-markdown-411r6y9b.wasm +0 -0
- package/dist/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
- package/dist/tree-sitter-powershell-ryb2ffqs.wasm +0 -0
- package/dist/tree-sitter-typescript-zxjzwt75.wasm +0 -0
- package/dist/tree-sitter-zig-e78zbjpm.wasm +0 -0
- package/dist/yup-01-30ecpeh9.mp3 +0 -0
- package/package.json +2 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{QF as vQ,RF as A,UF as _}from"./chunk-8j3aw4qg.js";var U1=A((_5,e6)=>{var E8=Object.prototype.hasOwnProperty,t6=Object.prototype.toString,i6=Object.defineProperty,a6=Object.getOwnPropertyDescriptor,n6=function($){if(typeof Array.isArray==="function")return Array.isArray($);return t6.call($)==="[object Array]"},r6=function($){if(!$||t6.call($)!=="[object Object]")return!1;var Q=E8.call($,"constructor"),Y=$.constructor&&$.constructor.prototype&&E8.call($.constructor.prototype,"isPrototypeOf");if($.constructor&&!Q&&!Y)return!1;var V;for(V in $);return typeof V>"u"||E8.call($,V)},s6=function($,Q){if(i6&&Q.name==="__proto__")i6($,Q.name,{enumerable:!0,configurable:!0,value:Q.newValue,writable:!0});else $[Q.name]=Q.newValue},o6=function($,Q){if(Q==="__proto__"){if(!E8.call($,Q))return;else if(a6)return a6($,Q).value}return $[Q]};e6.exports=function Z(){var $,Q,Y,V,W,z,K=arguments[0],F=1,L=arguments.length,N=!1;if(typeof K==="boolean")N=K,K=arguments[1]||{},F=2;if(K==null||typeof K!=="object"&&typeof K!=="function")K={};for(;F<L;++F)if($=arguments[F],$!=null){for(Q in $)if(Y=o6(K,Q),V=o6($,Q),K!==V){if(N&&V&&(r6(V)||(W=n6(V)))){if(W)W=!1,z=Y&&n6(Y)?Y:[];else z=Y&&r6(Y)?Y:{};s6(K,{name:Q,newValue:Z(N,z,V)})}else if(typeof V<"u")s6(K,{name:Q,newValue:V})}}return K}});var ZZ=A((x5,LQ)=>{LQ.exports={name:"gaxios",version:"7.1.4",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","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.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":"^22.13.1","@types/sinon":"^17.0.3","@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.1",linkinator:"^6.1.2",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.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",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-core/tree/main/packages/gaxios"}});var QZ=A((b5,$Z)=>{var SQ=ZZ();$Z.exports={pkg:SQ}});var G1=A((T0)=>{var VZ=T0&&T0.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(T0,"__esModule",{value:!0});T0.GaxiosError=T0.GAXIOS_ERROR_SYMBOL=void 0;T0.defaultErrorRedactor=WZ;var YZ=VZ(U1()),BQ=VZ(QZ()),D1=BQ.default.pkg;T0.GAXIOS_ERROR_SYMBOL=Symbol.for(`${D1.name}-gaxios-error`);class M1 extends Error{config;response;code;status;error;[T0.GAXIOS_ERROR_SYMBOL]=D1.version;static[Symbol.hasInstance](Z){if(Z&&typeof Z==="object"&&T0.GAXIOS_ERROR_SYMBOL in Z&&Z[T0.GAXIOS_ERROR_SYMBOL]===D1.version)return!0;return Function.prototype[Symbol.hasInstance].call(M1,Z)}constructor(Z,$,Q,Y){super(Z,{cause:Y});if(this.config=$,this.response=Q,this.error=Y instanceof Error?Y:void 0,this.config=(0,YZ.default)(!0,{},$),this.response)this.response.config=(0,YZ.default)(!0,{},this.response.config);if(this.response){try{this.response.data=OQ(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(Y instanceof DOMException)this.code=Y.name;else if(Y&&typeof Y==="object"&&"code"in Y&&(typeof Y.code==="string"||typeof Y.code==="number"))this.code=Y.code}static extractAPIErrorFromResponse(Z,$="The request failed"){let Q=$;if(typeof Z.data==="string")Q=Z.data;if(Z.data&&typeof Z.data==="object"&&"error"in Z.data&&Z.data.error&&!Z.ok){if(typeof Z.data.error==="string")return{message:Z.data.error,code:Z.status,status:Z.statusText};if(typeof Z.data.error==="object"){Q="message"in Z.data.error&&typeof Z.data.error.message==="string"?Z.data.error.message:Q;let Y="status"in Z.data.error&&typeof Z.data.error.status==="string"?Z.data.error.status:Z.statusText,V="code"in Z.data.error&&typeof Z.data.error.code==="number"?Z.data.error.code:Z.status;if("errors"in Z.data.error&&Array.isArray(Z.data.error.errors)){let W=[];for(let z of Z.data.error.errors)if(typeof z==="object"&&"message"in z&&typeof z.message==="string")W.push(z.message);return Object.assign({message:W.join(`
|
|
3
|
+
`)||Q,code:V,status:Y},Z.data.error)}return Object.assign({message:Q,code:V,status:Y},Z.data.error)}}return{message:Q,code:Z.status,status:Z.statusText}}}T0.GaxiosError=M1;function OQ(Z,$){switch(Z){case"stream":return $;case"json":return JSON.parse(JSON.stringify($));case"arraybuffer":return JSON.parse(Buffer.from($).toString("utf8"));case"blob":return JSON.parse($.text());default:return $}}function WZ(Z){function Q(W){if(!W)return;W.forEach((z,K)=>{if(/^authentication$/i.test(K)||/^authorization$/i.test(K)||/secret/i.test(K))W.set(K,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")})}function Y(W,z){if(typeof W==="object"&&W!==null&&typeof W[z]==="string"){let K=W[z];if(/grant_type=/i.test(K)||/assertion=/i.test(K)||/secret/i.test(K))W[z]="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}function V(W){if(!W||typeof W!=="object")return;else if(W instanceof FormData||W instanceof URLSearchParams||"forEach"in W&&"set"in W)W.forEach((z,K)=>{if(["grant_type","assertion"].includes(K)||/secret/.test(K))W.set(K,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")});else{if("grant_type"in W)W.grant_type="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("assertion"in W)W.assertion="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("client_secret"in W)W.client_secret="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}if(Z.config){if(Q(Z.config.headers),Y(Z.config,"data"),V(Z.config.data),Y(Z.config,"body"),V(Z.config.body),Z.config.url.searchParams.has("token"))Z.config.url.searchParams.set("token","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.");if(Z.config.url.searchParams.has("client_secret"))Z.config.url.searchParams.set("client_secret","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")}if(Z.response){if(WZ({config:Z.response.config}),Q(Z.response.headers),Z.response.bodyUsed)Y(Z.response,"data"),V(Z.response.data)}return Z}});var HZ=A((XZ)=>{Object.defineProperty(XZ,"__esModule",{value:!0});XZ.getRetryConfig=PQ;async function PQ(Z){let $=JZ(Z);if(!Z||!Z.config||!$&&!Z.config.retry)return{shouldRetry:!1};$=$||{},$.currentRetryAttempt=$.currentRetryAttempt||0,$.retry=$.retry===void 0||$.retry===null?3:$.retry,$.httpMethodsToRetry=$.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],$.noResponseRetries=$.noResponseRetries===void 0||$.noResponseRetries===null?2:$.noResponseRetries,$.retryDelayMultiplier=$.retryDelayMultiplier?$.retryDelayMultiplier:2,$.timeOfFirstRequest=$.timeOfFirstRequest?$.timeOfFirstRequest:Date.now(),$.totalTimeout=$.totalTimeout?$.totalTimeout:Number.MAX_SAFE_INTEGER,$.maxRetryDelay=$.maxRetryDelay?$.maxRetryDelay:Number.MAX_SAFE_INTEGER;let Q=[[100,199],[408,408],[429,429],[500,599]];if($.statusCodesToRetry=$.statusCodesToRetry||Q,Z.config.retryConfig=$,!await($.shouldRetry||AQ)(Z))return{shouldRetry:!1,config:Z.config};let V=jQ($);Z.config.retryConfig.currentRetryAttempt+=1;let W=$.retryBackoff?$.retryBackoff(Z,V):new Promise((z)=>{setTimeout(z,V)});if($.onRetryAttempt)await $.onRetryAttempt(Z);return await W,{shouldRetry:!0,config:Z.config}}function AQ(Z){let $=JZ(Z);if(Z.config.signal?.aborted&&Z.code!=="TimeoutError"||Z.code==="AbortError")return!1;if(!$||$.retry===0)return!1;if(!Z.response&&($.currentRetryAttempt||0)>=$.noResponseRetries)return!1;if(!$.httpMethodsToRetry||!$.httpMethodsToRetry.includes(Z.config.method?.toUpperCase()||"GET"))return!1;if(Z.response&&Z.response.status){let Q=!1;for(let[Y,V]of $.statusCodesToRetry){let W=Z.response.status;if(W>=Y&&W<=V){Q=!0;break}}if(!Q)return!1}if($.currentRetryAttempt=$.currentRetryAttempt||0,$.currentRetryAttempt>=$.retry)return!1;return!0}function JZ(Z){if(Z&&Z.config&&Z.config.retryConfig)return Z.config.retryConfig;return}function jQ(Z){let Q=(Z.currentRetryAttempt?0:Z.retryDelay??100)+(Math.pow(Z.retryDelayMultiplier,Z.currentRetryAttempt)-1)/2*1000,Y=Z.totalTimeout-(Date.now()-Z.timeOfFirstRequest);return Math.min(Q,Y,Z.maxRetryDelay)}});var I1=A((KZ)=>{Object.defineProperty(KZ,"__esModule",{value:!0});KZ.GaxiosInterceptorManager=void 0;class zZ extends Set{}KZ.GaxiosInterceptorManager=zZ});var UZ=A((o0)=>{var EQ=o0&&o0.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}},s0;Object.defineProperty(o0,"__esModule",{value:!0});o0.Gaxios=void 0;var hQ=EQ(U1()),fQ=_("https"),p0=G1(),kQ=HZ(),wZ=_("stream"),FZ=I1(),yQ=async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),_Q=204;class R1{agentCache=new Map;defaults;interceptors;constructor(Z){this.defaults=Z||{},this.interceptors={request:new FZ.GaxiosInterceptorManager,response:new FZ.GaxiosInterceptorManager}}fetch(...Z){let $=Z[0],Q=Z[1],Y=void 0,V=new Headers;if(typeof $==="string")Y=new URL($);else if($ instanceof URL)Y=$;else if($&&$.url)Y=new URL($.url);if($&&typeof $==="object"&&"headers"in $)s0.mergeHeaders(V,$.headers);if(Q)s0.mergeHeaders(V,new Headers(Q.headers));if(typeof $==="object"&&!($ instanceof URL))return this.request({...Q,...$,headers:V,url:Y});else return this.request({...Q,headers:V,url:Y})}async request(Z={}){let $=await this.#Y(Z);return $=await this.#$($),this.#Q(this._request($))}async _defaultAdapter(Z){let $=Z.fetchImplementation||this.defaults.fetchImplementation||await s0.#H(),Q={...Z};delete Q.data;let Y=await $(Z.url,Q),V=await this.getResponseData(Z,Y);if(!Object.getOwnPropertyDescriptor(Y,"data")?.configurable)Object.defineProperties(Y,{data:{configurable:!0,writable:!0,enumerable:!0,value:V}});return Object.assign(Y,{config:Z,data:V})}async _request(Z){try{let $;if(Z.adapter)$=await Z.adapter(Z,this._defaultAdapter.bind(this));else $=await this._defaultAdapter(Z);if(!Z.validateStatus($.status)){if(Z.responseType==="stream"){let Y=[];for await(let V of $.data)Y.push(V);$.data=Y.toString()}let Q=p0.GaxiosError.extractAPIErrorFromResponse($,`Request failed with status code ${$.status}`);throw new p0.GaxiosError(Q?.message,Z,$,Q)}return $}catch($){let Q;if($ instanceof p0.GaxiosError)Q=$;else if($ instanceof Error)Q=new p0.GaxiosError($.message,Z,void 0,$);else Q=new p0.GaxiosError("Unexpected Gaxios Error",Z,void 0,$);let{shouldRetry:Y,config:V}=await(0,kQ.getRetryConfig)(Q);if(Y&&V)return Q.config.retryConfig.currentRetryAttempt=V.retryConfig.currentRetryAttempt,Z.retryConfig=Q.config?.retryConfig,this.#V(Z),this._request(Z);if(Z.errorRedactor)Z.errorRedactor(Q);throw Q}}async getResponseData(Z,$){if($.status===_Q)return"";if(Z.maxContentLength&&$.headers.has("content-length")&&Z.maxContentLength<Number.parseInt($.headers?.get("content-length")||""))throw new p0.GaxiosError("Response's `Content-Length` is over the limit.",Z,Object.assign($,{config:Z}));switch(Z.responseType){case"stream":return $.body;case"json":{let Q=await $.text();try{return JSON.parse(Q)}catch{return Q}}case"arraybuffer":return $.arrayBuffer();case"blob":return $.blob();case"text":return $.text();default:return this.getResponseDataFromContentType($)}}#Z(Z,$=[]){let Q=new URL(Z),Y=[...$],V=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let W of V)Y.push(W.trim());for(let W of Y)if(W instanceof RegExp){if(W.test(Q.toString()))return!1}else if(W instanceof URL){if(W.origin===Q.origin)return!1}else if(W.startsWith("*.")||W.startsWith(".")){let z=W.replace(/^\*\./,".");if(Q.hostname.endsWith(z))return!1}else if(W===Q.origin||W===Q.hostname||W===Q.href)return!1;return!0}async#$(Z){let $=Promise.resolve(Z);for(let Q of this.interceptors.request.values())if(Q)$=$.then(Q.resolved,Q.rejected);return $}async#Q(Z){let $=Promise.resolve(Z);for(let Q of this.interceptors.response.values())if(Q)$=$.then(Q.resolved,Q.rejected);return $}async#Y(Z){let $=new Headers(this.defaults.headers);s0.mergeHeaders($,Z.headers);let Q=(0,hQ.default)(!0,{},this.defaults,Z);if(!Q.url)throw Error("URL is required.");if(Q.baseURL)Q.url=new URL(Q.url,Q.baseURL);if(Q.url=new URL(Q.url),Q.params)if(Q.paramsSerializer){let W=Q.paramsSerializer(Q.params);if(W.startsWith("?"))W=W.slice(1);let z=Q.url.toString().includes("?")?"&":"?";Q.url=Q.url+z+W}else{let W=Q.url instanceof URL?Q.url:new URL(Q.url);for(let[z,K]of new URLSearchParams(Q.params))W.searchParams.append(z,K);Q.url=W}if(typeof Z.maxContentLength==="number")Q.size=Z.maxContentLength;if(typeof Z.maxRedirects==="number")Q.follow=Z.maxRedirects;let Y=typeof Q.data==="string"||Q.data instanceof ArrayBuffer||Q.data instanceof Blob||globalThis.File&&Q.data instanceof File||Q.data instanceof FormData||Q.data instanceof wZ.Readable||Q.data instanceof ReadableStream||Q.data instanceof String||Q.data instanceof URLSearchParams||ArrayBuffer.isView(Q.data)||["Blob","File","FormData"].includes(Q.data?.constructor?.name||"");if(Q.multipart?.length){let W=await yQ();$.set("content-type",`multipart/related; boundary=${W}`),Q.body=wZ.Readable.from(this.getMultipartRequest(Q.multipart,W))}else if(Y)Q.body=Q.data;else if(typeof Q.data==="object")if($.get("Content-Type")==="application/x-www-form-urlencoded")Q.body=Q.paramsSerializer?Q.paramsSerializer(Q.data):new URLSearchParams(Q.data);else{if(!$.has("content-type"))$.set("content-type","application/json");Q.body=JSON.stringify(Q.data)}else if(Q.data)Q.body=Q.data;if(Q.validateStatus=Q.validateStatus||this.validateStatus,Q.responseType=Q.responseType||"unknown",!$.has("accept")&&Q.responseType==="json")$.set("accept","application/json");let V=Q.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(Q.agent);else if(V&&this.#Z(Q.url,Q.noProxy)){let W=await s0.#X();if(this.agentCache.has(V))Q.agent=this.agentCache.get(V);else Q.agent=new W(V,{cert:Q.cert,key:Q.key}),this.agentCache.set(V,Q.agent)}else if(Q.cert&&Q.key)if(this.agentCache.has(Q.key))Q.agent=this.agentCache.get(Q.key);else Q.agent=new fQ.Agent({cert:Q.cert,key:Q.key}),this.agentCache.set(Q.key,Q.agent);if(typeof Q.errorRedactor!=="function"&&Q.errorRedactor!==!1)Q.errorRedactor=p0.defaultErrorRedactor;if(Q.body&&!("duplex"in Q))Q.duplex="half";return this.#V(Q),Object.assign(Q,{headers:$,url:Q.url instanceof URL?Q.url:new URL(Q.url)})}#V(Z){if(Z.timeout){let $=AbortSignal.timeout(Z.timeout);if(Z.signal&&!Z.signal.aborted)Z.signal=AbortSignal.any([Z.signal,$]);else Z.signal=$}}validateStatus(Z){return Z>=200&&Z<300}async getResponseDataFromContentType(Z){let $=Z.headers.get("Content-Type");if($===null)return Z.text();if($=$.toLowerCase(),$.includes("application/json")){let Q=await Z.text();try{Q=JSON.parse(Q)}catch{}return Q}else if($.match(/^text\//))return Z.text();else return Z.blob()}async*getMultipartRequest(Z,$){let Q=`--${$}--`;for(let Y of Z){let V=Y.headers.get("Content-Type")||"application/octet-stream";if(yield`--${$}\r
|
|
4
|
+
Content-Type: ${V}\r
|
|
5
|
+
\r
|
|
6
|
+
`,typeof Y.content==="string")yield Y.content;else yield*Y.content;yield`\r
|
|
7
|
+
`}yield Q}static#W;static#J;static async#X(){return this.#W||=(await import("./chunk-1y3ssxx6.js").then((m)=>vQ(m.default))).HttpsProxyAgent,this.#W}static async#H(){let Z=typeof window<"u"&&!!window;return this.#J||=Z?window.fetch:(await import("node-fetch")).default,this.#J}static mergeHeaders(Z,...$){Z=Z instanceof Headers?Z:new Headers(Z);for(let Q of $)(Q instanceof Headers?Q:new Headers(Q)).forEach((V,W)=>{W==="set-cookie"?Z.append(W,V):Z.set(W,V)});return Z}}o0.Gaxios=R1;s0=R1});var X0=A((q0)=>{var xQ=q0&&q0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var V=Object.getOwnPropertyDescriptor($,Q);if(!V||("get"in V?!$.__esModule:V.writable||V.configurable))V={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,V)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),bQ=q0&&q0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))xQ($,Z,Q)};Object.defineProperty(q0,"__esModule",{value:!0});q0.instance=q0.Gaxios=q0.GaxiosError=void 0;q0.request=gQ;var DZ=UZ();Object.defineProperty(q0,"Gaxios",{enumerable:!0,get:function(){return DZ.Gaxios}});var mQ=G1();Object.defineProperty(q0,"GaxiosError",{enumerable:!0,get:function(){return mQ.GaxiosError}});bQ(I1(),q0);q0.instance=new DZ.Gaxios;async function gQ(Z){return q0.instance.request(Z)}});var N1=A((MZ,h8)=>{(function(Z){var $,Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Y=Math.ceil,V=Math.floor,W="[BigNumber Error] ",z=W+"Number primitive has more than 15 significant digits: ",K=100000000000000,F=14,L=9007199254740991,N=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],S=1e7,P=1e9;function x(b){var v,k,m,O=B.prototype={constructor:B,toString:null,valueOf:null},t=new B(1),i=20,d=4,V0=-7,s=21,Q0=-1e7,e=1e7,Y0=!1,y0=1,w0=0,H1={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},c0="0123456789abcdefghijklmnopqrstuvwxyz",z1=!0;function B(J,X){var H,G,w,D,R,q,U,I,M=this;if(!(M instanceof B))return new B(J,X);if(X==null){if(J&&J._isBigNumber===!0){if(M.s=J.s,!J.c||J.e>e)M.c=M.e=null;else if(J.e<Q0)M.c=[M.e=0];else M.e=J.e,M.c=J.c.slice();return}if((q=typeof J=="number")&&J*0==0){if(M.s=1/J<0?(J=-J,-1):1,J===~~J){for(D=0,R=J;R>=10;R/=10,D++);if(D>e)M.c=M.e=null;else M.e=D,M.c=[J];return}I=String(J)}else{if(!Q.test(I=String(J)))return m(M,I,q);M.s=I.charCodeAt(0)==45?(I=I.slice(1),-1):1}if((D=I.indexOf("."))>-1)I=I.replace(".","");if((R=I.search(/e/i))>0){if(D<0)D=R;D+=+I.slice(R+1),I=I.substring(0,R)}else if(D<0)D=I.length}else{if(j(X,2,c0.length,"Base"),X==10&&z1)return M=new B(J),R0(M,i+M.e+1,d);if(I=String(J),q=typeof J=="number"){if(J*0!=0)return m(M,I,q,X);if(M.s=1/J<0?(I=I.slice(1),-1):1,B.DEBUG&&I.replace(/^0\.0*|\./,"").length>15)throw Error(z+J)}else M.s=I.charCodeAt(0)===45?(I=I.slice(1),-1):1;H=c0.slice(0,X),D=R=0;for(U=I.length;R<U;R++)if(H.indexOf(G=I.charAt(R))<0){if(G=="."){if(R>D){D=U;continue}}else if(!w){if(I==I.toUpperCase()&&(I=I.toLowerCase())||I==I.toLowerCase()&&(I=I.toUpperCase())){w=!0,R=-1,D=0;continue}}return m(M,String(J),q,X)}if(q=!1,I=k(I,X,10,M.s),(D=I.indexOf("."))>-1)I=I.replace(".","");else D=I.length}for(R=0;I.charCodeAt(R)===48;R++);for(U=I.length;I.charCodeAt(--U)===48;);if(I=I.slice(R,++U)){if(U-=R,q&&B.DEBUG&&U>15&&(J>L||J!==V(J)))throw Error(z+M.s*J);if((D=D-R-1)>e)M.c=M.e=null;else if(D<Q0)M.c=[M.e=0];else{if(M.e=D,M.c=[],R=(D+1)%F,D<0)R+=F;if(R<U){if(R)M.c.push(+I.slice(0,R));for(U-=F;R<U;)M.c.push(+I.slice(R,R+=F));R=F-(I=I.slice(R)).length}else R-=U;for(;R--;I+="0");M.c.push(+I)}}else M.c=[M.e=0]}B.clone=x,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(J){var X,H;if(J!=null)if(typeof J=="object"){if(J.hasOwnProperty(X="DECIMAL_PLACES"))H=J[X],j(H,0,P,X),i=H;if(J.hasOwnProperty(X="ROUNDING_MODE"))H=J[X],j(H,0,8,X),d=H;if(J.hasOwnProperty(X="EXPONENTIAL_AT"))if(H=J[X],H&&H.pop)j(H[0],-P,0,X),j(H[1],0,P,X),V0=H[0],s=H[1];else j(H,-P,P,X),V0=-(s=H<0?-H:H);if(J.hasOwnProperty(X="RANGE"))if(H=J[X],H&&H.pop)j(H[0],-P,-1,X),j(H[1],1,P,X),Q0=H[0],e=H[1];else if(j(H,-P,P,X),H)Q0=-(e=H<0?-H:H);else throw Error(W+X+" cannot be zero: "+H);if(J.hasOwnProperty(X="CRYPTO"))if(H=J[X],H===!!H)if(H)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))Y0=H;else throw Y0=!H,Error(W+"crypto unavailable");else Y0=H;else throw Error(W+X+" not true or false: "+H);if(J.hasOwnProperty(X="MODULO_MODE"))H=J[X],j(H,0,9,X),y0=H;if(J.hasOwnProperty(X="POW_PRECISION"))H=J[X],j(H,0,P,X),w0=H;if(J.hasOwnProperty(X="FORMAT"))if(H=J[X],typeof H=="object")H1=H;else throw Error(W+X+" not an object: "+H);if(J.hasOwnProperty(X="ALPHABET"))if(H=J[X],typeof H=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(H))z1=H.slice(0,10)=="0123456789",c0=H;else throw Error(W+X+" invalid: "+H)}else throw Error(W+"Object expected: "+J);return{DECIMAL_PLACES:i,ROUNDING_MODE:d,EXPONENTIAL_AT:[V0,s],RANGE:[Q0,e],CRYPTO:Y0,MODULO_MODE:y0,POW_PRECISION:w0,FORMAT:H1,ALPHABET:c0}},B.isBigNumber=function(J){if(!J||J._isBigNumber!==!0)return!1;if(!B.DEBUG)return!0;var X,H,G=J.c,w=J.e,D=J.s;Z:if({}.toString.call(G)=="[object Array]"){if((D===1||D===-1)&&w>=-P&&w<=P&&w===V(w)){if(G[0]===0){if(w===0&&G.length===1)return!0;break Z}if(X=(w+1)%F,X<1)X+=F;if(String(G[0]).length==X){for(X=0;X<G.length;X++)if(H=G[X],H<0||H>=K||H!==V(H))break Z;if(H!==0)return!0}}}else if(G===null&&w===null&&(D===null||D===1||D===-1))return!0;throw Error(W+"Invalid BigNumber: "+J)},B.maximum=B.max=function(){return p6(arguments,-1)},B.minimum=B.min=function(){return p6(arguments,1)},B.random=function(){var J=9007199254740992,X=Math.random()*J&2097151?function(){return V(Math.random()*J)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(H){var G,w,D,R,q,U=0,I=[],M=new B(t);if(H==null)H=i;else j(H,0,P);if(R=Y(H/F),Y0)if(crypto.getRandomValues){G=crypto.getRandomValues(new Uint32Array(R*=2));for(;U<R;)if(q=G[U]*131072+(G[U+1]>>>11),q>=9000000000000000)w=crypto.getRandomValues(new Uint32Array(2)),G[U]=w[0],G[U+1]=w[1];else I.push(q%100000000000000),U+=2;U=R/2}else if(crypto.randomBytes){G=crypto.randomBytes(R*=7);for(;U<R;)if(q=(G[U]&31)*281474976710656+G[U+1]*1099511627776+G[U+2]*4294967296+G[U+3]*16777216+(G[U+4]<<16)+(G[U+5]<<8)+G[U+6],q>=9000000000000000)crypto.randomBytes(7).copy(G,U);else I.push(q%100000000000000),U+=7;U=R/7}else throw Y0=!1,Error(W+"crypto unavailable");if(!Y0){for(;U<R;)if(q=X(),q<9000000000000000)I[U++]=q%100000000000000}if(R=I[--U],H%=F,R&&H)q=N[F-H],I[U]=V(R/q)*q;for(;I[U]===0;I.pop(),U--);if(U<0)I=[D=0];else{for(D=-1;I[0]===0;I.splice(0,1),D-=F);for(U=1,q=I[0];q>=10;q/=10,U++);if(U<F)D-=F-U}return M.e=D,M.c=I,M}}(),B.sum=function(){var J=1,X=arguments,H=new B(X[0]);for(;J<X.length;)H=H.plus(X[J++]);return H},k=function(){var J="0123456789";function X(H,G,w,D){var R,q=[0],U,I=0,M=H.length;for(;I<M;){for(U=q.length;U--;q[U]*=G);q[0]+=D.indexOf(H.charAt(I++));for(R=0;R<q.length;R++)if(q[R]>w-1){if(q[R+1]==null)q[R+1]=0;q[R+1]+=q[R]/w|0,q[R]%=w}}return q.reverse()}return function(H,G,w,D,R){var q,U,I,M,T,E,h,c,Z0=H.indexOf("."),W0=i,l=d;if(Z0>=0)M=w0,w0=0,H=H.replace(".",""),c=new B(G),E=c.pow(H.length-Z0),w0=M,c.c=X(J0(C(E.c),E.e,"0"),10,w,J),c.e=c.c.length;h=X(H,G,w,R?(q=c0,J):(q=J,c0)),I=M=h.length;for(;h[--M]==0;h.pop());if(!h[0])return q.charAt(0);if(Z0<0)--I;else E.c=h,E.e=I,E.s=D,E=v(E,c,W0,l,w),h=E.c,T=E.r,I=E.e;if(U=I+W0+1,Z0=h[U],M=w/2,T=T||U<0||h[U+1]!=null,T=l<4?(Z0!=null||T)&&(l==0||l==(E.s<0?3:2)):Z0>M||Z0==M&&(l==4||T||l==6&&h[U-1]&1||l==(E.s<0?8:7)),U<1||!h[0])H=T?J0(q.charAt(1),-W0,q.charAt(0)):q.charAt(0);else{if(h.length=U,T){for(--w;++h[--U]>w;)if(h[U]=0,!U)++I,h=[1].concat(h)}for(M=h.length;!h[--M];);for(Z0=0,H="";Z0<=M;H+=q.charAt(h[Z0++]));H=J0(H,I,q.charAt(0))}return H}}(),v=function(){function J(G,w,D){var R,q,U,I,M=0,T=G.length,E=w%S,h=w/S|0;for(G=G.slice();T--;)U=G[T]%S,I=G[T]/S|0,R=h*U+I*E,q=E*U+R%S*S+M,M=(q/D|0)+(R/S|0)+h*I,G[T]=q%D;if(M)G=[M].concat(G);return G}function X(G,w,D,R){var q,U;if(D!=R)U=D>R?1:-1;else for(q=U=0;q<D;q++)if(G[q]!=w[q]){U=G[q]>w[q]?1:-1;break}return U}function H(G,w,D,R){var q=0;for(;D--;)G[D]-=q,q=G[D]<w[D]?1:0,G[D]=q*R+G[D]-w[D];for(;!G[0]&&G.length>1;G.splice(0,1));}return function(G,w,D,R,q){var U,I,M,T,E,h,c,Z0,W0,l,a,z0,v8,w1,F1,v0,K8,N0=G.s==w.s?1:-1,K0=G.c,$0=w.c;if(!K0||!K0[0]||!$0||!$0[0])return new B(!G.s||!w.s||(K0?$0&&K0[0]==$0[0]:!$0)?NaN:K0&&K0[0]==0||!$0?N0*0:N0/0);if(Z0=new B(N0),W0=Z0.c=[],I=G.e-w.e,N0=D+I+1,!q)q=K,I=u(G.e/F)-u(w.e/F),N0=N0/F|0;for(M=0;$0[M]==(K0[M]||0);M++);if($0[M]>(K0[M]||0))I--;if(N0<0)W0.push(1),T=!0;else{if(w1=K0.length,v0=$0.length,M=0,N0+=2,E=V(q/($0[0]+1)),E>1)$0=J($0,E,q),K0=J(K0,E,q),v0=$0.length,w1=K0.length;v8=v0,l=K0.slice(0,v0),a=l.length;for(;a<v0;l[a++]=0);if(K8=$0.slice(),K8=[0].concat(K8),F1=$0[0],$0[1]>=q/2)F1++;do{if(E=0,U=X($0,l,v0,a),U<0){if(z0=l[0],v0!=a)z0=z0*q+(l[1]||0);if(E=V(z0/F1),E>1){if(E>=q)E=q-1;h=J($0,E,q),c=h.length,a=l.length;while(X(h,l,c,a)==1)E--,H(h,v0<c?K8:$0,c,q),c=h.length,U=1}else{if(E==0)U=E=1;h=$0.slice(),c=h.length}if(c<a)h=[0].concat(h);if(H(l,h,a,q),a=l.length,U==-1)while(X($0,l,v0,a)<1)E++,H(l,v0<a?K8:$0,a,q),a=l.length}else if(U===0)E++,l=[0];if(W0[M++]=E,l[0])l[a++]=K0[v8]||0;else l=[K0[v8]],a=1}while((v8++<w1||l[0]!=null)&&N0--);if(T=l[0]!=null,!W0[0])W0.splice(0,1)}if(q==K){for(M=1,N0=W0[0];N0>=10;N0/=10,M++);R0(Z0,D+(Z0.e=M+I*F-1)+1,R,T)}else Z0.e=I,Z0.r=+T;return Z0}}();function K1(J,X,H,G){var w,D,R,q,U;if(H==null)H=d;else j(H,0,8);if(!J.c)return J.toString();if(w=J.c[0],R=J.e,X==null)U=C(J.c),U=G==1||G==2&&(R<=V0||R>=s)?o(U,R):J0(U,R,"0");else if(J=R0(new B(J),X,H),D=J.e,U=C(J.c),q=U.length,G==1||G==2&&(X<=D||D<=V0)){for(;q<X;U+="0",q++);U=o(U,D)}else if(X-=R+(G===2&&D>R),U=J0(U,D,"0"),D+1>q){if(--X>0)for(U+=".";X--;U+="0");}else if(X+=D-q,X>0){if(D+1==q)U+=".";for(;X--;U+="0");}return J.s<0&&w?"-"+U:U}function p6(J,X){var H,G,w=1,D=new B(J[0]);for(;w<J.length;w++)if(G=new B(J[w]),!G.s||(H=f(D,G))===X||H===0&&D.s===X)D=G;return D}function q1(J,X,H){var G=1,w=X.length;for(;!X[--w];X.pop());for(w=X[0];w>=10;w/=10,G++);if((H=G+H*F-1)>e)J.c=J.e=null;else if(H<Q0)J.c=[J.e=0];else J.e=H,J.c=X;return J}m=function(){var J=/^(-?)0([xbo])(?=\w[\w.]*$)/i,X=/^([^.]+)\.$/,H=/^\.([^.]+)$/,G=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(D,R,q,U){var I,M=q?R:R.replace(w,"");if(G.test(M))D.s=isNaN(M)?null:M<0?-1:1;else{if(!q){if(M=M.replace(J,function(T,E,h){return I=(h=h.toLowerCase())=="x"?16:h=="b"?2:8,!U||U==I?E:T}),U)I=U,M=M.replace(X,"$1").replace(H,"0.$1");if(R!=M)return new B(M,I)}if(B.DEBUG)throw Error(W+"Not a"+(U?" base "+U:"")+" number: "+R);D.s=null}D.c=D.e=null}}();function R0(J,X,H,G){var w,D,R,q,U,I,M,T=J.c,E=N;if(T){Z:{for(w=1,q=T[0];q>=10;q/=10,w++);if(D=X-w,D<0)D+=F,R=X,U=T[I=0],M=V(U/E[w-R-1]%10);else if(I=Y((D+1)/F),I>=T.length)if(G){for(;T.length<=I;T.push(0));U=M=0,w=1,D%=F,R=D-F+1}else break Z;else{U=q=T[I];for(w=1;q>=10;q/=10,w++);D%=F,R=D-F+w,M=R<0?0:V(U/E[w-R-1]%10)}if(G=G||X<0||T[I+1]!=null||(R<0?U:U%E[w-R-1]),G=H<4?(M||G)&&(H==0||H==(J.s<0?3:2)):M>5||M==5&&(H==4||G||H==6&&(D>0?R>0?U/E[w-R]:0:T[I-1])%10&1||H==(J.s<0?8:7)),X<1||!T[0]){if(T.length=0,G)X-=J.e+1,T[0]=E[(F-X%F)%F],J.e=-X||0;else T[0]=J.e=0;return J}if(D==0)T.length=I,q=1,I--;else T.length=I+1,q=E[F-D],T[I]=R>0?V(U/E[w-R]%E[R])*q:0;if(G)for(;;)if(I==0){for(D=1,R=T[0];R>=10;R/=10,D++);R=T[0]+=q;for(q=1;R>=10;R/=10,q++);if(D!=q){if(J.e++,T[0]==K)T[0]=1}break}else{if(T[I]+=q,T[I]!=K)break;T[I--]=0,q=1}for(D=T.length;T[--D]===0;T.pop());}if(J.e>e)J.c=J.e=null;else if(J.e<Q0)J.c=[J.e=0]}return J}function _0(J){var X,H=J.e;if(H===null)return J.toString();return X=C(J.c),X=H<=V0||H>=s?o(X,H):J0(X,H,"0"),J.s<0?"-"+X:X}if(O.absoluteValue=O.abs=function(){var J=new B(this);if(J.s<0)J.s=1;return J},O.comparedTo=function(J,X){return f(this,new B(J,X))},O.decimalPlaces=O.dp=function(J,X){var H,G,w,D=this;if(J!=null){if(j(J,0,P),X==null)X=d;else j(X,0,8);return R0(new B(D),J+D.e+1,X)}if(!(H=D.c))return null;if(G=((w=H.length-1)-u(this.e/F))*F,w=H[w])for(;w%10==0;w/=10,G--);if(G<0)G=0;return G},O.dividedBy=O.div=function(J,X){return v(this,new B(J,X),i,d)},O.dividedToIntegerBy=O.idiv=function(J,X){return v(this,new B(J,X),0,1)},O.exponentiatedBy=O.pow=function(J,X){var H,G,w,D,R,q,U,I,M,T=this;if(J=new B(J),J.c&&!J.isInteger())throw Error(W+"Exponent not an integer: "+_0(J));if(X!=null)X=new B(X);if(q=J.e>14,!T.c||!T.c[0]||T.c[0]==1&&!T.e&&T.c.length==1||!J.c||!J.c[0])return M=new B(Math.pow(+_0(T),q?J.s*(2-p(J)):+_0(J))),X?M.mod(X):M;if(U=J.s<0,X){if(X.c?!X.c[0]:!X.s)return new B(NaN);if(G=!U&&T.isInteger()&&X.isInteger(),G)T=T.mod(X)}else if(J.e>9&&(T.e>0||T.e<-1||(T.e==0?T.c[0]>1||q&&T.c[1]>=240000000:T.c[0]<80000000000000||q&&T.c[0]<=99999750000000))){if(D=T.s<0&&p(J)?-0:0,T.e>-1)D=1/D;return new B(U?1/D:D)}else if(w0)D=Y(w0/F+2);if(q){if(H=new B(0.5),U)J.s=1;I=p(J)}else w=Math.abs(+_0(J)),I=w%2;M=new B(t);for(;;){if(I){if(M=M.times(T),!M.c)break;if(D){if(M.c.length>D)M.c.length=D}else if(G)M=M.mod(X)}if(w){if(w=V(w/2),w===0)break;I=w%2}else if(J=J.times(H),R0(J,J.e+1,1),J.e>14)I=p(J);else{if(w=+_0(J),w===0)break;I=w%2}if(T=T.times(T),D){if(T.c&&T.c.length>D)T.c.length=D}else if(G)T=T.mod(X)}if(G)return M;if(U)M=t.div(M);return X?M.mod(X):D?R0(M,w0,d,R):M},O.integerValue=function(J){var X=new B(this);if(J==null)J=d;else j(J,0,8);return R0(X,X.e+1,J)},O.isEqualTo=O.eq=function(J,X){return f(this,new B(J,X))===0},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(J,X){return f(this,new B(J,X))>0},O.isGreaterThanOrEqualTo=O.gte=function(J,X){return(X=f(this,new B(J,X)))===1||X===0},O.isInteger=function(){return!!this.c&&u(this.e/F)>this.c.length-2},O.isLessThan=O.lt=function(J,X){return f(this,new B(J,X))<0},O.isLessThanOrEqualTo=O.lte=function(J,X){return(X=f(this,new B(J,X)))===-1||X===0},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&this.c[0]==0},O.minus=function(J,X){var H,G,w,D,R=this,q=R.s;if(J=new B(J,X),X=J.s,!q||!X)return new B(NaN);if(q!=X)return J.s=-X,R.plus(J);var U=R.e/F,I=J.e/F,M=R.c,T=J.c;if(!U||!I){if(!M||!T)return M?(J.s=-X,J):new B(T?R:NaN);if(!M[0]||!T[0])return T[0]?(J.s=-X,J):new B(M[0]?R:d==3?-0:0)}if(U=u(U),I=u(I),M=M.slice(),q=U-I){if(D=q<0)q=-q,w=M;else I=U,w=T;w.reverse();for(X=q;X--;w.push(0));w.reverse()}else{G=(D=(q=M.length)<(X=T.length))?q:X;for(q=X=0;X<G;X++)if(M[X]!=T[X]){D=M[X]<T[X];break}}if(D)w=M,M=T,T=w,J.s=-J.s;if(X=(G=T.length)-(H=M.length),X>0)for(;X--;M[H++]=0);X=K-1;for(;G>q;){if(M[--G]<T[G]){for(H=G;H&&!M[--H];M[H]=X);--M[H],M[G]+=K}M[G]-=T[G]}for(;M[0]==0;M.splice(0,1),--I);if(!M[0])return J.s=d==3?-1:1,J.c=[J.e=0],J;return q1(J,M,I)},O.modulo=O.mod=function(J,X){var H,G,w=this;if(J=new B(J,X),!w.c||!J.s||J.c&&!J.c[0])return new B(NaN);else if(!J.c||w.c&&!w.c[0])return new B(w);if(y0==9)G=J.s,J.s=1,H=v(w,J,0,3),J.s=G,H.s*=G;else H=v(w,J,0,y0);if(J=w.minus(H.times(J)),!J.c[0]&&y0==1)J.s=w.s;return J},O.multipliedBy=O.times=function(J,X){var H,G,w,D,R,q,U,I,M,T,E,h,c,Z0,W0,l=this,a=l.c,z0=(J=new B(J,X)).c;if(!a||!z0||!a[0]||!z0[0]){if(!l.s||!J.s||a&&!a[0]&&!z0||z0&&!z0[0]&&!a)J.c=J.e=J.s=null;else if(J.s*=l.s,!a||!z0)J.c=J.e=null;else J.c=[0],J.e=0;return J}if(G=u(l.e/F)+u(J.e/F),J.s*=l.s,U=a.length,T=z0.length,U<T)c=a,a=z0,z0=c,w=U,U=T,T=w;for(w=U+T,c=[];w--;c.push(0));Z0=K,W0=S;for(w=T;--w>=0;){H=0,E=z0[w]%W0,h=z0[w]/W0|0;for(R=U,D=w+R;D>w;)I=a[--R]%W0,M=a[R]/W0|0,q=h*I+M*E,I=E*I+q%W0*W0+c[D]+H,H=(I/Z0|0)+(q/W0|0)+h*M,c[D--]=I%Z0;c[D]=H}if(H)++G;else c.splice(0,1);return q1(J,c,G)},O.negated=function(){var J=new B(this);return J.s=-J.s||null,J},O.plus=function(J,X){var H,G=this,w=G.s;if(J=new B(J,X),X=J.s,!w||!X)return new B(NaN);if(w!=X)return J.s=-X,G.minus(J);var D=G.e/F,R=J.e/F,q=G.c,U=J.c;if(!D||!R){if(!q||!U)return new B(w/0);if(!q[0]||!U[0])return U[0]?J:new B(q[0]?G:w*0)}if(D=u(D),R=u(R),q=q.slice(),w=D-R){if(w>0)R=D,H=U;else w=-w,H=q;H.reverse();for(;w--;H.push(0));H.reverse()}if(w=q.length,X=U.length,w-X<0)H=U,U=q,q=H,X=w;for(w=0;X;)w=(q[--X]=q[X]+U[X]+w)/K|0,q[X]=K===q[X]?0:q[X]%K;if(w)q=[w].concat(q),++R;return q1(J,q,R)},O.precision=O.sd=function(J,X){var H,G,w,D=this;if(J!=null&&J!==!!J){if(j(J,1,P),X==null)X=d;else j(X,0,8);return R0(new B(D),J,X)}if(!(H=D.c))return null;if(w=H.length-1,G=w*F+1,w=H[w]){for(;w%10==0;w/=10,G--);for(w=H[0];w>=10;w/=10,G++);}if(J&&D.e+1>G)G=D.e+1;return G},O.shiftedBy=function(J){return j(J,-L,L),this.times("1e"+J)},O.squareRoot=O.sqrt=function(){var J,X,H,G,w,D=this,R=D.c,q=D.s,U=D.e,I=i+4,M=new B("0.5");if(q!==1||!R||!R[0])return new B(!q||q<0&&(!R||R[0])?NaN:R?D:1/0);if(q=Math.sqrt(+_0(D)),q==0||q==1/0){if(X=C(R),(X.length+U)%2==0)X+="0";if(q=Math.sqrt(+X),U=u((U+1)/2)-(U<0||U%2),q==1/0)X="5e"+U;else X=q.toExponential(),X=X.slice(0,X.indexOf("e")+1)+U;H=new B(X)}else H=new B(q+"");if(H.c[0]){if(U=H.e,q=U+I,q<3)q=0;for(;;)if(w=H,H=M.times(w.plus(v(D,w,I,1))),C(w.c).slice(0,q)===(X=C(H.c)).slice(0,q)){if(H.e<U)--q;if(X=X.slice(q-3,q+1),X=="9999"||!G&&X=="4999"){if(!G){if(R0(w,w.e+i+2,0),w.times(w).eq(D)){H=w;break}}I+=4,q+=4,G=1}else{if(!+X||!+X.slice(1)&&X.charAt(0)=="5")R0(H,H.e+i+2,1),J=!H.times(H).eq(D);break}}}return R0(H,H.e+i+1,d,J)},O.toExponential=function(J,X){if(J!=null)j(J,0,P),J++;return K1(this,J,X,1)},O.toFixed=function(J,X){if(J!=null)j(J,0,P),J=J+this.e+1;return K1(this,J,X)},O.toFormat=function(J,X,H){var G,w=this;if(H==null)if(J!=null&&X&&typeof X=="object")H=X,X=null;else if(J&&typeof J=="object")H=J,J=X=null;else H=H1;else if(typeof H!="object")throw Error(W+"Argument not an object: "+H);if(G=w.toFixed(J,X),w.c){var D,R=G.split("."),q=+H.groupSize,U=+H.secondaryGroupSize,I=H.groupSeparator||"",M=R[0],T=R[1],E=w.s<0,h=E?M.slice(1):M,c=h.length;if(U)D=q,q=U,U=D,c-=D;if(q>0&&c>0){D=c%q||q,M=h.substr(0,D);for(;D<c;D+=q)M+=I+h.substr(D,q);if(U>0)M+=I+h.slice(D);if(E)M="-"+M}G=T?M+(H.decimalSeparator||"")+((U=+H.fractionGroupSize)?T.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(H.fractionGroupSeparator||"")):T):M}return(H.prefix||"")+G+(H.suffix||"")},O.toFraction=function(J){var X,H,G,w,D,R,q,U,I,M,T,E,h=this,c=h.c;if(J!=null){if(q=new B(J),!q.isInteger()&&(q.c||q.s!==1)||q.lt(t))throw Error(W+"Argument "+(q.isInteger()?"out of range: ":"not an integer: ")+_0(q))}if(!c)return new B(h);X=new B(t),I=H=new B(t),G=U=new B(t),E=C(c),D=X.e=E.length-h.e-1,X.c[0]=N[(R=D%F)<0?F+R:R],J=!J||q.comparedTo(X)>0?D>0?X:I:q,R=e,e=1/0,q=new B(E),U.c[0]=0;for(;;){if(M=v(q,X,0,1),w=H.plus(M.times(G)),w.comparedTo(J)==1)break;H=G,G=w,I=U.plus(M.times(w=I)),U=w,X=q.minus(M.times(w=X)),q=w}return w=v(J.minus(H),G,0,1),U=U.plus(w.times(I)),H=H.plus(w.times(G)),U.s=I.s=h.s,D=D*2,T=v(I,G,D,d).minus(h).abs().comparedTo(v(U,H,D,d).minus(h).abs())<1?[I,G]:[U,H],e=R,T},O.toNumber=function(){return+_0(this)},O.toPrecision=function(J,X){if(J!=null)j(J,1,P);return K1(this,J,X,2)},O.toString=function(J){var X,H=this,G=H.s,w=H.e;if(w===null)if(G){if(X="Infinity",G<0)X="-"+X}else X="NaN";else{if(J==null)X=w<=V0||w>=s?o(C(H.c),w):J0(C(H.c),w,"0");else if(J===10&&z1)H=R0(new B(H),i+w+1,d),X=J0(C(H.c),H.e,"0");else j(J,2,c0.length,"Base"),X=k(J0(C(H.c),w,"0"),10,J,G,!0);if(G<0&&H.c[0])X="-"+X}return X},O.valueOf=O.toJSON=function(){return _0(this)},O._isBigNumber=!0,b!=null)B.set(b);return B}function u(b){var v=b|0;return b>0||b===v?v:v-1}function C(b){var v,k,m=1,O=b.length,t=b[0]+"";for(;m<O;){v=b[m++]+"",k=F-v.length;for(;k--;v="0"+v);t+=v}for(O=t.length;t.charCodeAt(--O)===48;);return t.slice(0,O+1||1)}function f(b,v){var k,m,O=b.c,t=v.c,i=b.s,d=v.s,V0=b.e,s=v.e;if(!i||!d)return null;if(k=O&&!O[0],m=t&&!t[0],k||m)return k?m?0:-d:i;if(i!=d)return i;if(k=i<0,m=V0==s,!O||!t)return m?0:!O^k?1:-1;if(!m)return V0>s^k?1:-1;d=(V0=O.length)<(s=t.length)?V0:s;for(i=0;i<d;i++)if(O[i]!=t[i])return O[i]>t[i]^k?1:-1;return V0==s?0:V0>s^k?1:-1}function j(b,v,k,m){if(b<v||b>k||b!==V(b))throw Error(W+(m||"Argument")+(typeof b=="number"?b<v||b>k?" out of range: ":" not an integer: ":" not a primitive number: ")+String(b))}function p(b){var v=b.c.length-1;return u(b.e/F)==v&&b.c[v]%2!=0}function o(b,v){return(b.length>1?b.charAt(0)+"."+b.slice(1):b)+(v<0?"e":"e+")+v}function J0(b,v,k){var m,O;if(v<0){for(O=k+".";++v;O+=k);b=O+b}else if(m=b.length,++v>m){for(O=k,v-=m;--v;O+=k);b+=O}else if(v<m)b=b.slice(0,v)+"."+b.slice(v);return b}if($=x(),$.default=$.BigNumber=$,typeof define=="function"&&define.amd)define(function(){return $});else if(typeof h8<"u"&&h8.exports)h8.exports=$;else{if(!Z)Z=typeof self<"u"&&self?self:window;Z.BigNumber=$}})(MZ)});var NZ=A((c5,RZ)=>{var GZ=N1(),IZ=c5;(function(){function Z(L){return L<10?"0"+L:L}var $=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Q=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Y,V,W={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"},z;function K(L){return Q.lastIndex=0,Q.test(L)?'"'+L.replace(Q,function(N){var S=W[N];return typeof S==="string"?S:"\\u"+("0000"+N.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+L+'"'}function F(L,N){var S,P,x,u,C=Y,f,j=N[L],p=j!=null&&(j instanceof GZ||GZ.isBigNumber(j));if(j&&typeof j==="object"&&typeof j.toJSON==="function")j=j.toJSON(L);if(typeof z==="function")j=z.call(N,L,j);switch(typeof j){case"string":if(p)return j;else return K(j);case"number":return isFinite(j)?String(j):"null";case"boolean":case"null":case"bigint":return String(j);case"object":if(!j)return"null";if(Y+=V,f=[],Object.prototype.toString.apply(j)==="[object Array]"){u=j.length;for(S=0;S<u;S+=1)f[S]=F(S,j)||"null";return x=f.length===0?"[]":Y?`[
|
|
8
|
+
`+Y+f.join(`,
|
|
9
|
+
`+Y)+`
|
|
10
|
+
`+C+"]":"["+f.join(",")+"]",Y=C,x}if(z&&typeof z==="object"){u=z.length;for(S=0;S<u;S+=1)if(typeof z[S]==="string"){if(P=z[S],x=F(P,j),x)f.push(K(P)+(Y?": ":":")+x)}}else Object.keys(j).forEach(function(o){var J0=F(o,j);if(J0)f.push(K(o)+(Y?": ":":")+J0)});return x=f.length===0?"{}":Y?`{
|
|
11
|
+
`+Y+f.join(`,
|
|
12
|
+
`+Y)+`
|
|
13
|
+
`+C+"}":"{"+f.join(",")+"}",Y=C,x}}if(typeof IZ.stringify!=="function")IZ.stringify=function(L,N,S){var P;if(Y="",V="",typeof S==="number")for(P=0;P<S;P+=1)V+=" ";else if(typeof S==="string")V=S;if(z=N,N&&typeof N!=="function"&&(typeof N!=="object"||typeof N.length!=="number"))throw Error("JSON.stringify");return F("",{"":L})}})()});var LZ=A((p5,TZ)=>{var f8=null,uQ=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,dQ=/(?: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)/,lQ=function(Z){var $={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(Z!==void 0&&Z!==null){if(Z.strict===!0)$.strict=!0;if(Z.storeAsString===!0)$.storeAsString=!0;if($.alwaysParseAsBig=Z.alwaysParseAsBig===!0?Z.alwaysParseAsBig:!1,$.useNativeBigInt=Z.useNativeBigInt===!0?Z.useNativeBigInt:!1,typeof Z.constructorAction<"u")if(Z.constructorAction==="error"||Z.constructorAction==="ignore"||Z.constructorAction==="preserve")$.constructorAction=Z.constructorAction;else throw Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${Z.constructorAction}`);if(typeof Z.protoAction<"u")if(Z.protoAction==="error"||Z.protoAction==="ignore"||Z.protoAction==="preserve")$.protoAction=Z.protoAction;else throw Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${Z.protoAction}`)}var Q,Y,V={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
14
|
+
`,r:"\r",t:"\t"},W,z=function(C){throw{name:"SyntaxError",message:C,at:Q,text:W}},K=function(C){if(C&&C!==Y)z("Expected '"+C+"' instead of '"+Y+"'");return Y=W.charAt(Q),Q+=1,Y},F=function(){var C,f="";if(Y==="-")f="-",K("-");while(Y>="0"&&Y<="9")f+=Y,K();if(Y==="."){f+=".";while(K()&&Y>="0"&&Y<="9")f+=Y}if(Y==="e"||Y==="E"){if(f+=Y,K(),Y==="-"||Y==="+")f+=Y,K();while(Y>="0"&&Y<="9")f+=Y,K()}if(C=+f,!isFinite(C))z("Bad number");else{if(f8==null)f8=N1();if(f.length>15)return $.storeAsString?f:$.useNativeBigInt?BigInt(f):new f8(f);else return!$.alwaysParseAsBig?C:$.useNativeBigInt?BigInt(C):new f8(C)}},L=function(){var C,f,j="",p;if(Y==='"'){var o=Q;while(K()){if(Y==='"'){if(Q-1>o)j+=W.substring(o,Q-1);return K(),j}if(Y==="\\"){if(Q-1>o)j+=W.substring(o,Q-1);if(K(),Y==="u"){p=0;for(f=0;f<4;f+=1){if(C=parseInt(K(),16),!isFinite(C))break;p=p*16+C}j+=String.fromCharCode(p)}else if(typeof V[Y]==="string")j+=V[Y];else break;o=Q}}}z("Bad string")},N=function(){while(Y&&Y<=" ")K()},S=function(){switch(Y){case"t":return K("t"),K("r"),K("u"),K("e"),!0;case"f":return K("f"),K("a"),K("l"),K("s"),K("e"),!1;case"n":return K("n"),K("u"),K("l"),K("l"),null}z("Unexpected '"+Y+"'")},P,x=function(){var C=[];if(Y==="["){if(K("["),N(),Y==="]")return K("]"),C;while(Y){if(C.push(P()),N(),Y==="]")return K("]"),C;K(","),N()}}z("Bad array")},u=function(){var C,f=Object.create(null);if(Y==="{"){if(K("{"),N(),Y==="}")return K("}"),f;while(Y){if(C=L(),N(),K(":"),$.strict===!0&&Object.hasOwnProperty.call(f,C))z('Duplicate key "'+C+'"');if(uQ.test(C)===!0)if($.protoAction==="error")z("Object contains forbidden prototype property");else if($.protoAction==="ignore")P();else f[C]=P();else if(dQ.test(C)===!0)if($.constructorAction==="error")z("Object contains forbidden constructor property");else if($.constructorAction==="ignore")P();else f[C]=P();else f[C]=P();if(N(),Y==="}")return K("}"),f;K(","),N()}}z("Bad object")};return P=function(){switch(N(),Y){case"{":return u();case"[":return x();case'"':return L();case"-":return F();default:return Y>="0"&&Y<="9"?F():S()}},function(C,f){var j;if(W=C+"",Q=0,Y=" ",j=P(),N(),Y)z("Syntax error");return typeof f==="function"?function p(o,J0){var b,v,k=o[J0];if(k&&typeof k==="object")Object.keys(k).forEach(function(m){if(v=p(k,m),v!==void 0)k[m]=v;else delete k[m]});return f.call(o,J0,k)}({"":j},""):j}};TZ.exports=lQ});var OZ=A((i5,k8)=>{var SZ=NZ().stringify,BZ=LZ();k8.exports=function(Z){return{parse:BZ(Z),stringify:SZ}};k8.exports.parse=BZ();k8.exports.stringify=SZ});var T1=A((hZ)=>{Object.defineProperty(hZ,"__esModule",{value:!0});hZ.GCE_LINUX_BIOS_PATHS=void 0;hZ.isGoogleCloudServerless=jZ;hZ.isGoogleComputeEngineLinux=CZ;hZ.isGoogleComputeEngineMACAddress=vZ;hZ.isGoogleComputeEngine=EZ;hZ.detectGCPResidency=pQ;var PZ=_("fs"),AZ=_("os");hZ.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var cQ=/^42:01/;function jZ(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}function CZ(){if((0,AZ.platform)()!=="linux")return!1;try{(0,PZ.statSync)(hZ.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let Z=(0,PZ.readFileSync)(hZ.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(Z)}catch{return!1}}function vZ(){let Z=(0,AZ.networkInterfaces)();for(let $ of Object.values(Z)){if(!$)continue;for(let{mac:Q}of $)if(cQ.test(Q))return!0}return!1}function EZ(){return CZ()||vZ()}function pQ(){return jZ()||EZ()}});var yZ=A((fZ)=>{Object.defineProperty(fZ,"__esModule",{value:!0});fZ.Colours=void 0;class g{static isEnabled(Z){return Z&&Z.isTTY&&(typeof Z.getColorDepth==="function"?Z.getColorDepth()>2:!0)}static refresh(){if(g.enabled=g.isEnabled(process===null||process===void 0?void 0:process.stderr),!this.enabled)g.reset="",g.bright="",g.dim="",g.red="",g.green="",g.yellow="",g.blue="",g.magenta="",g.cyan="",g.white="",g.grey="";else g.reset="\x1B[0m",g.bright="\x1B[1m",g.dim="\x1B[2m",g.red="\x1B[31m",g.green="\x1B[32m",g.yellow="\x1B[33m",g.blue="\x1B[34m",g.magenta="\x1B[35m",g.cyan="\x1B[36m",g.white="\x1B[37m",g.grey="\x1B[90m"}}fZ.Colours=g;g.enabled=!1;g.reset="";g.bright="";g.dim="";g.red="";g.green="";g.yellow="";g.blue="";g.magenta="";g.cyan="";g.white="";g.grey="";g.refresh()});var dZ=A((n)=>{var oQ=n&&n.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var V=Object.getOwnPropertyDescriptor($,Q);if(!V||("get"in V?!$.__esModule:V.writable||V.configurable))V={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,V)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),tQ=n&&n.__setModuleDefault||(Object.create?function(Z,$){Object.defineProperty(Z,"default",{enumerable:!0,value:$})}:function(Z,$){Z.default=$}),_Z=n&&n.__importStar||function(){var Z=function($){return Z=Object.getOwnPropertyNames||function(Q){var Y=[];for(var V in Q)if(Object.prototype.hasOwnProperty.call(Q,V))Y[Y.length]=V;return Y},Z($)};return function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var Y=Z($),V=0;V<Y.length;V++)if(Y[V]!=="default")oQ(Q,$,Y[V])}return tQ(Q,$),Q}}();Object.defineProperty(n,"__esModule",{value:!0});n.env=n.DebugLogBackendBase=n.placeholder=n.AdhocDebugLogger=n.LogSeverity=void 0;n.getNodeBackend=L1;n.getDebugBackend=ZY;n.getStructuredBackend=$Y;n.setBackend=QY;n.log=uZ;var eQ=_("events"),q8=_Z(_("process")),xZ=_Z(_("util")),F0=yZ(),O0;(function(Z){Z.DEFAULT="DEFAULT",Z.DEBUG="DEBUG",Z.INFO="INFO",Z.WARNING="WARNING",Z.ERROR="ERROR"})(O0||(n.LogSeverity=O0={}));class _8 extends eQ.EventEmitter{constructor(Z,$){super();this.namespace=Z,this.upstream=$,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:(Q,Y)=>this.on(Q,Y)}),this.func.debug=(...Q)=>this.invokeSeverity(O0.DEBUG,...Q),this.func.info=(...Q)=>this.invokeSeverity(O0.INFO,...Q),this.func.warn=(...Q)=>this.invokeSeverity(O0.WARNING,...Q),this.func.error=(...Q)=>this.invokeSeverity(O0.ERROR,...Q),this.func.sublog=(Q)=>uZ(Q,this.func)}invoke(Z,...$){if(this.upstream)try{this.upstream(Z,...$)}catch(Q){}try{this.emit("log",Z,$)}catch(Q){}}invokeSeverity(Z,...$){this.invoke({severity:Z},...$)}}n.AdhocDebugLogger=_8;n.placeholder=new _8("",()=>{}).func;class w8{constructor(){var Z;this.cached=new Map,this.filters=[],this.filtersSet=!1;let $=(Z=q8.env[n.env.nodeEnables])!==null&&Z!==void 0?Z:"*";if($==="all")$="*";this.filters=$.split(",")}log(Z,$,...Q){try{if(!this.filtersSet)this.setFilters(),this.filtersSet=!0;let Y=this.cached.get(Z);if(!Y)Y=this.makeLogger(Z),this.cached.set(Z,Y);Y($,...Q)}catch(Y){console.error(Y)}}}n.DebugLogBackendBase=w8;class bZ extends w8{constructor(){super(...arguments);this.enabledRegexp=/.*/g}isEnabled(Z){return this.enabledRegexp.test(Z)}makeLogger(Z){if(!this.enabledRegexp.test(Z))return()=>{};return($,...Q)=>{var Y;let V=`${F0.Colours.green}${Z}${F0.Colours.reset}`,W=`${F0.Colours.yellow}${q8.pid}${F0.Colours.reset}`,z;switch($.severity){case O0.ERROR:z=`${F0.Colours.red}${$.severity}${F0.Colours.reset}`;break;case O0.INFO:z=`${F0.Colours.magenta}${$.severity}${F0.Colours.reset}`;break;case O0.WARNING:z=`${F0.Colours.yellow}${$.severity}${F0.Colours.reset}`;break;default:z=(Y=$.severity)!==null&&Y!==void 0?Y:O0.DEFAULT;break}let K=xZ.formatWithOptions({colors:F0.Colours.enabled},...Q),F=Object.assign({},$);delete F.severity;let L=Object.getOwnPropertyNames(F).length?JSON.stringify(F):"",N=L?`${F0.Colours.grey}${L}${F0.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",W,V,z,K,L?` ${N}`:"")}}setFilters(){let $=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${$}$`,"i")}}function L1(){return new bZ}class mZ extends w8{constructor(Z){super();this.debugPkg=Z}makeLogger(Z){let $=this.debugPkg(Z);return(Q,...Y)=>{$(Y[0],...Y.slice(1))}}setFilters(){var Z;let $=(Z=q8.env.NODE_DEBUG)!==null&&Z!==void 0?Z:"";q8.env.NODE_DEBUG=`${$}${$?",":""}${this.filters.join(",")}`}}function ZY(Z){return new mZ(Z)}class gZ extends w8{constructor(Z){var $;super();this.upstream=($=Z)!==null&&$!==void 0?$:void 0}makeLogger(Z){var $;let Q=($=this.upstream)===null||$===void 0?void 0:$.makeLogger(Z);return(Y,...V)=>{var W;let z=(W=Y.severity)!==null&&W!==void 0?W:O0.INFO,K=Object.assign({severity:z,message:xZ.format(...V)},Y),F=JSON.stringify(K);if(Q)Q(Y,F);else console.log("%s",F)}}setFilters(){var Z;(Z=this.upstream)===null||Z===void 0||Z.setFilters()}}function $Y(Z){return new gZ(Z)}n.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var S1=new Map,U0=void 0;function QY(Z){U0=Z,S1.clear()}function uZ(Z,$){if(!U0){if(!q8.env[n.env.nodeEnables])return n.placeholder}if(!Z)return n.placeholder;if($)Z=`${$.instance.namespace}:${Z}`;let Q=S1.get(Z);if(Q)return Q.func;if(U0===null)return n.placeholder;else if(U0===void 0)U0=L1();let Y=(()=>{let V=void 0;return new _8(Z,(z,...K)=>{if(V!==U0){if(U0===null)return;else if(U0===void 0)U0=L1();V=U0}U0===null||U0===void 0||U0.log(Z,z,...K)})})();return S1.set(Z,Y),Y.func}});var B1=A((i0)=>{var YY=i0&&i0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var V=Object.getOwnPropertyDescriptor($,Q);if(!V||("get"in V?!$.__esModule:V.writable||V.configurable))V={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,V)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),VY=i0&&i0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))YY($,Z,Q)};Object.defineProperty(i0,"__esModule",{value:!0});VY(dZ(),i0)});var U8=A((y)=>{var cZ=y&&y.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var V=Object.getOwnPropertyDescriptor($,Q);if(!V||("get"in V?!$.__esModule:V.writable||V.configurable))V={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,V)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),WY=y&&y.__setModuleDefault||(Object.create?function(Z,$){Object.defineProperty(Z,"default",{enumerable:!0,value:$})}:function(Z,$){Z.default=$}),JY=y&&y.__importStar||function(){var Z=function($){return Z=Object.getOwnPropertyNames||function(Q){var Y=[];for(var V in Q)if(Object.prototype.hasOwnProperty.call(Q,V))Y[Y.length]=V;return Y},Z($)};return function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var Y=Z($),V=0;V<Y.length;V++)if(Y[V]!=="default")cZ(Q,$,Y[V])}return WY(Q,$),Q}}(),XY=y&&y.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))cZ($,Z,Q)};Object.defineProperty(y,"__esModule",{value:!0});y.gcpResidencyCache=y.METADATA_SERVER_DETECTION=y.HEADERS=y.HEADER_VALUE=y.HEADER_NAME=y.SECONDARY_HOST_ADDRESS=y.HOST_ADDRESS=y.BASE_PATH=void 0;y.instance=FY;y.project=UY;y.universe=DY;y.bulk=MY;y.isAvailable=IY;y.resetIsAvailableCache=RY;y.getGCPResidency=A1;y.setGCPResidency=pZ;y.requestTimeout=iZ;var O1=X0(),HY=OZ(),zY=T1(),KY=JY(B1());y.BASE_PATH="/computeMetadata/v1";y.HOST_ADDRESS="http://169.254.169.254";y.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.";y.HEADER_NAME="Metadata-Flavor";y.HEADER_VALUE="Google";y.HEADERS=Object.freeze({[y.HEADER_NAME]:y.HEADER_VALUE});var lZ=KY.log("gcp-metadata");y.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 P1(Z){if(!Z)Z=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||y.HOST_ADDRESS;if(!/^https?:\/\//.test(Z))Z=`http://${Z}`;return new URL(y.BASE_PATH,Z).href}function qY(Z){Object.keys(Z).forEach(($)=>{switch($){case"params":case"property":case"headers":break;case"qs":throw Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw Error(`'${$}' is not a valid configuration option.`)}})}async function F8(Z,$={},Q=3,Y=!1){let V=new Headers(y.HEADERS),W="",z={};if(typeof Z==="object"){let S=Z;new Headers(S.headers).forEach((P,x)=>V.set(x,P)),W=S.metadataKey,z=S.params||z,Q=S.noResponseRetries||Q,Y=S.fastFail||Y}else W=Z;if(typeof $==="string")W+=`/${$}`;else{if(qY($),$.property)W+=`/${$.property}`;new Headers($.headers).forEach((S,P)=>V.set(P,S)),z=$.params||z}let K=Y?wY:O1.request,F={url:`${P1()}/${W}`,headers:V,retryConfig:{noResponseRetries:Q},params:z,responseType:"text",timeout:iZ()};lZ.info("instance request %j",F);let L=await K(F);lZ.info("instance metadata is %s",L.data);let N=L.headers.get(y.HEADER_NAME);if(N!==y.HEADER_VALUE)throw RangeError(`Invalid response from metadata service: incorrect ${y.HEADER_NAME} header. Expected '${y.HEADER_VALUE}', got ${N?`'${N}'`:"no header"}`);if(typeof L.data==="string")try{return HY.parse(L.data)}catch{}return L.data}async function wY(Z){let $={...Z,url:Z.url?.toString().replace(P1(),P1(y.SECONDARY_HOST_ADDRESS))},Q=(0,O1.request)(Z),Y=(0,O1.request)($);return Promise.any([Q,Y])}function FY(Z){return F8("instance",Z)}function UY(Z){return F8("project",Z)}function DY(Z){return F8("universe",Z)}async function MY(Z){let $={};return await Promise.all(Z.map((Q)=>{return(async()=>{let Y=await F8(Q),V=Q.metadataKey;$[V]=Y})()})),$}function GY(){return process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0}var x8;async function IY(){if(process.env.METADATA_SERVER_DETECTION){let Z=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(Z in y.METADATA_SERVER_DETECTION))throw RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${Z}\`, but it should be \`${Object.keys(y.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(Z){case"assume-present":return!0;case"none":return!1;case"bios-only":return A1();case"ping-only":}}try{if(x8===void 0)x8=F8("instance",void 0,GY(),!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST));return await x8,!0}catch(Z){let $=Z;if(process.env.DEBUG_AUTH)console.info($);if($ instanceof AggregateError)return!1;if($.type==="request-timeout")return!1;if($.response&&$.response.status===404)return!1;else{if(!($.response&&$.response.status===404)&&(!$.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes($.code.toString()))){let Q="UNKNOWN";if($.code)Q=$.code.toString();process.emitWarning(`received unexpected error = ${$.message} code = ${Q}`,"MetadataLookupWarning")}return!1}}}function RY(){x8=void 0}y.gcpResidencyCache=null;function A1(){if(y.gcpResidencyCache===null)pZ();return y.gcpResidencyCache}function pZ(Z=null){y.gcpResidencyCache=Z!==null?Z:(0,zY.detectGCPResidency)()}function iZ(){return A1()?0:3000}XY(T1(),y)});var nZ=A((AY)=>{AY.byteLength=TY;AY.toByteArray=SY;AY.fromByteArray=PY;var E0=[],L0=[],NY=typeof Uint8Array<"u"?Uint8Array:Array,j1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(d0=0,C1=j1.length;d0<C1;++d0)E0[d0]=j1[d0],L0[j1.charCodeAt(d0)]=d0;var d0,C1;L0[45]=62;L0[95]=63;function aZ(Z){var $=Z.length;if($%4>0)throw Error("Invalid string. Length must be a multiple of 4");var Q=Z.indexOf("=");if(Q===-1)Q=$;var Y=Q===$?0:4-Q%4;return[Q,Y]}function TY(Z){var $=aZ(Z),Q=$[0],Y=$[1];return(Q+Y)*3/4-Y}function LY(Z,$,Q){return($+Q)*3/4-Q}function SY(Z){var $,Q=aZ(Z),Y=Q[0],V=Q[1],W=new NY(LY(Z,Y,V)),z=0,K=V>0?Y-4:Y,F;for(F=0;F<K;F+=4)$=L0[Z.charCodeAt(F)]<<18|L0[Z.charCodeAt(F+1)]<<12|L0[Z.charCodeAt(F+2)]<<6|L0[Z.charCodeAt(F+3)],W[z++]=$>>16&255,W[z++]=$>>8&255,W[z++]=$&255;if(V===2)$=L0[Z.charCodeAt(F)]<<2|L0[Z.charCodeAt(F+1)]>>4,W[z++]=$&255;if(V===1)$=L0[Z.charCodeAt(F)]<<10|L0[Z.charCodeAt(F+1)]<<4|L0[Z.charCodeAt(F+2)]>>2,W[z++]=$>>8&255,W[z++]=$&255;return W}function BY(Z){return E0[Z>>18&63]+E0[Z>>12&63]+E0[Z>>6&63]+E0[Z&63]}function OY(Z,$,Q){var Y,V=[];for(var W=$;W<Q;W+=3)Y=(Z[W]<<16&16711680)+(Z[W+1]<<8&65280)+(Z[W+2]&255),V.push(BY(Y));return V.join("")}function PY(Z){var $,Q=Z.length,Y=Q%3,V=[],W=16383;for(var z=0,K=Q-Y;z<K;z+=W)V.push(OY(Z,z,z+W>K?K:z+W));if(Y===1)$=Z[Q-1],V.push(E0[$>>2]+E0[$<<4&63]+"==");else if(Y===2)$=(Z[Q-2]<<8)+Z[Q-1],V.push(E0[$>>10]+E0[$>>4&63]+E0[$<<2&63]+"=");return V.join("")}});var v1=A((rZ)=>{Object.defineProperty(rZ,"__esModule",{value:!0});rZ.fromArrayBufferToHex=EY;function EY(Z){return Array.from(new Uint8Array(Z)).map((Q)=>{return Q.toString(16).padStart(2,"0")}).join("")}});var tZ=A((sZ)=>{Object.defineProperty(sZ,"__esModule",{value:!0});sZ.BrowserCrypto=void 0;var t0=nZ(),fY=v1();class b8{constructor(){if(typeof window>"u"||window.crypto===void 0||window.crypto.subtle===void 0)throw Error("SubtleCrypto not found. Make sure it's an https:// website.")}async sha256DigestBase64(Z){let $=new TextEncoder().encode(Z),Q=await window.crypto.subtle.digest("SHA-256",$);return t0.fromByteArray(new Uint8Array(Q))}randomBytesBase64(Z){let $=new Uint8Array(Z);return window.crypto.getRandomValues($),t0.fromByteArray($)}static padBase64(Z){while(Z.length%4!==0)Z+="=";return Z}async verify(Z,$,Q){let Y={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},V=new TextEncoder().encode($),W=t0.toByteArray(b8.padBase64(Q)),z=await window.crypto.subtle.importKey("jwk",Z,Y,!0,["verify"]);return await window.crypto.subtle.verify(Y,z,W,V)}async sign(Z,$){let Q={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},Y=new TextEncoder().encode($),V=await window.crypto.subtle.importKey("jwk",Z,Q,!0,["sign"]),W=await window.crypto.subtle.sign(Q,V,Y);return t0.fromByteArray(new Uint8Array(W))}decodeBase64StringUtf8(Z){let $=t0.toByteArray(b8.padBase64(Z));return new TextDecoder().decode($)}encodeBase64StringUtf8(Z){let $=new TextEncoder().encode(Z);return t0.fromByteArray($)}async sha256DigestHex(Z){let $=new TextEncoder().encode(Z),Q=await window.crypto.subtle.digest("SHA-256",$);return(0,fY.fromArrayBufferToHex)(Q)}async signWithHmacSha256(Z,$){let Q=typeof Z==="string"?Z:String.fromCharCode(...new Uint16Array(Z)),Y=new TextEncoder,V=await window.crypto.subtle.importKey("raw",Y.encode(Q),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return window.crypto.subtle.sign("HMAC",V,Y.encode($))}}sZ.BrowserCrypto=b8});var Q4=A((Z4)=>{Object.defineProperty(Z4,"__esModule",{value:!0});Z4.NodeCrypto=void 0;var e0=_("crypto");class eZ{async sha256DigestBase64(Z){return e0.createHash("sha256").update(Z).digest("base64")}randomBytesBase64(Z){return e0.randomBytes(Z).toString("base64")}async verify(Z,$,Q){let Y=e0.createVerify("RSA-SHA256");return Y.update($),Y.end(),Y.verify(Z,Q,"base64")}async sign(Z,$){let Q=e0.createSign("RSA-SHA256");return Q.update($),Q.end(),Q.sign(Z,"base64")}decodeBase64StringUtf8(Z){return Buffer.from(Z,"base64").toString("utf-8")}encodeBase64StringUtf8(Z){return Buffer.from(Z,"utf-8").toString("base64")}async sha256DigestHex(Z){return e0.createHash("sha256").update(Z).digest("hex")}async signWithHmacSha256(Z,$){let Q=typeof Z==="string"?Z:yY(Z);return kY(e0.createHmac("sha256",Q).update($).digest())}}Z4.NodeCrypto=eZ;function kY(Z){return Z.buffer.slice(Z.byteOffset,Z.byteOffset+Z.byteLength)}function yY(Z){return Buffer.from(Z)}});var D8=A((x0)=>{var _Y=x0&&x0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var V=Object.getOwnPropertyDescriptor($,Q);if(!V||("get"in V?!$.__esModule:V.writable||V.configurable))V={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,V)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),xY=x0&&x0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))_Y($,Z,Q)};Object.defineProperty(x0,"__esModule",{value:!0});x0.createCrypto=gY;x0.hasBrowserCrypto=Y4;var bY=tZ(),mY=Q4();xY(v1(),x0);function gY(){if(Y4())return new bY.BrowserCrypto;return new mY.NodeCrypto}function Y4(){return typeof window<"u"&&typeof window.crypto<"u"&&typeof window.crypto.subtle<"u"}});var Z8=A((E1,W4)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var m8=_("buffer"),h0=m8.Buffer;function V4(Z,$){for(var Q in Z)$[Q]=Z[Q]}if(h0.from&&h0.alloc&&h0.allocUnsafe&&h0.allocUnsafeSlow)W4.exports=m8;else V4(m8,E1),E1.Buffer=a0;function a0(Z,$,Q){return h0(Z,$,Q)}a0.prototype=Object.create(h0.prototype);V4(h0,a0);a0.from=function(Z,$,Q){if(typeof Z==="number")throw TypeError("Argument must not be a number");return h0(Z,$,Q)};a0.alloc=function(Z,$,Q){if(typeof Z!=="number")throw TypeError("Argument must be a number");var Y=h0(Z);if($!==void 0)if(typeof Q==="string")Y.fill($,Q);else Y.fill($);else Y.fill(0);return Y};a0.allocUnsafe=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return h0(Z)};a0.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw TypeError("Argument must be a number");return m8.SlowBuffer(Z)}});var X4=A((YX,J4)=>{function h1(Z){var $=(Z/8|0)+(Z%8===0?0:1);return $}var uY={ES256:h1(256),ES384:h1(384),ES512:h1(521)};function dY(Z){var $=uY[Z];if($)return $;throw Error('Unknown algorithm "'+Z+'"')}J4.exports=dY});var f1=A((VX,F4)=>{var g8=Z8().Buffer,z4=X4(),u8=128,K4=0,lY=32,cY=16,pY=2,q4=cY|lY|K4<<6,d8=pY|K4<<6;function iY(Z){return Z.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function w4(Z){if(g8.isBuffer(Z))return Z;else if(typeof Z==="string")return g8.from(Z,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function aY(Z,$){Z=w4(Z);var Q=z4($),Y=Q+1,V=Z.length,W=0;if(Z[W++]!==q4)throw Error('Could not find expected "seq"');var z=Z[W++];if(z===(u8|1))z=Z[W++];if(V-W<z)throw Error('"seq" specified length of "'+z+'", only "'+(V-W)+'" remaining');if(Z[W++]!==d8)throw Error('Could not find expected "int" for "r"');var K=Z[W++];if(V-W-2<K)throw Error('"r" specified length of "'+K+'", only "'+(V-W-2)+'" available');if(Y<K)throw Error('"r" specified length of "'+K+'", max of "'+Y+'" is acceptable');var F=W;if(W+=K,Z[W++]!==d8)throw Error('Could not find expected "int" for "s"');var L=Z[W++];if(V-W!==L)throw Error('"s" specified length of "'+L+'", expected "'+(V-W)+'"');if(Y<L)throw Error('"s" specified length of "'+L+'", max of "'+Y+'" is acceptable');var N=W;if(W+=L,W!==V)throw Error('Expected to consume entire buffer, but "'+(V-W)+'" bytes remain');var S=Q-K,P=Q-L,x=g8.allocUnsafe(S+K+P+L);for(W=0;W<S;++W)x[W]=0;Z.copy(x,W,F+Math.max(-S,0),F+K),W=Q;for(var u=W;W<u+P;++W)x[W]=0;return Z.copy(x,W,N+Math.max(-P,0),N+L),x=x.toString("base64"),x=iY(x),x}function H4(Z,$,Q){var Y=0;while($+Y<Q&&Z[$+Y]===0)++Y;var V=Z[$+Y]>=u8;if(V)--Y;return Y}function nY(Z,$){Z=w4(Z);var Q=z4($),Y=Z.length;if(Y!==Q*2)throw TypeError('"'+$+'" signatures must be "'+Q*2+'" bytes, saw "'+Y+'"');var V=H4(Z,0,Q),W=H4(Z,Q,Z.length),z=Q-V,K=Q-W,F=2+z+1+1+K,L=F<u8,N=g8.allocUnsafe((L?2:3)+F),S=0;if(N[S++]=q4,L)N[S++]=F;else N[S++]=u8|1,N[S++]=F&255;if(N[S++]=d8,N[S++]=z,V<0)N[S++]=0,S+=Z.copy(N,S,0,Q);else S+=Z.copy(N,S,V,Q);if(N[S++]=d8,N[S++]=K,W<0)N[S++]=0,Z.copy(N,S,Q);else Z.copy(N,S,Q+W);return N}F4.exports={derToJose:aY,joseToDer:nY}});var P0=A((G4)=>{Object.defineProperty(G4,"__esModule",{value:!0});G4.LRUCache=void 0;G4.snakeToCamel=D4;G4.originalOrCamelOptions=tY;G4.removeUndefinedValuesInObject=eY;G4.isValidFile=ZV;G4.getWellKnownCertificateConfigFileLocation=$V;var rY=_("fs"),sY=_("os"),k1=_("path"),oY="certificate_config.json",U4="gcloud";function D4(Z){return Z.replace(/([_][^_])/g,($)=>$.slice(1).toUpperCase())}function tY(Z){function $(Q){let Y=Z||{};return Y[Q]??Y[D4(Q)]}return{get:$}}class M4{capacity;#Z=new Map;maxAge;constructor(Z){this.capacity=Z.capacity,this.maxAge=Z.maxAge}#$(Z,$){this.#Z.delete(Z),this.#Z.set(Z,{value:$,lastAccessed:Date.now()})}set(Z,$){this.#$(Z,$),this.#Q()}get(Z){let $=this.#Z.get(Z);if(!$)return;return this.#$(Z,$.value),this.#Q(),$.value}#Q(){let Z=this.maxAge?Date.now()-this.maxAge:0,$=this.#Z.entries().next();while(!$.done&&(this.#Z.size>this.capacity||$.value[1].lastAccessed<Z))this.#Z.delete($.value[0]),$=this.#Z.entries().next()}}G4.LRUCache=M4;function eY(Z){return Object.entries(Z).forEach(([$,Q])=>{if(Q===void 0||Q==="undefined")delete Z[$]}),Z}async function ZV(Z){try{return(await rY.promises.lstat(Z)).isFile()}catch($){return!1}}function $V(){let Z=process.env.CLOUDSDK_CONFIG||(QV()?k1.join(process.env.APPDATA||"",U4):k1.join(process.env.HOME||"",".config",U4));return k1.join(Z,oY)}function QV(){return sY.platform().startsWith("win")}});var R4=A((JX,HV)=>{HV.exports={name:"google-auth-library",version:"10.5.0",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:"googleapis/google-auth-library-nodejs.git",keywords:["google","api","google apis","client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.0.0","gcp-metadata":"^8.0.0","google-logging-utils":"^1.0.0",gtoken:"^8.0.0",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.1","@types/node":"^22.0.0","@types/sinon":"^17.0.0","assert-rejects":"^1.0.0",c8:"^10.0.0",codecov:"^3.0.2",gts:"^6.0.0","is-docker":"^3.0.0",jsdoc:"^4.0.0","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.0",puppeteer:"^24.0.0",sinon:"^21.0.0","ts-loader":"^8.0.0",typescript:"5.8.2",webpack:"^5.21.2","webpack-cli":"^4.0.0"},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","docs-test":"echo 'disabled until linkinator is fixed'","predocs-test":"npm run docs",prelint:"cd samples; npm link ../; npm install"},license:"Apache-2.0"}});var y1=A((L4)=>{Object.defineProperty(L4,"__esModule",{value:!0});L4.USER_AGENT=L4.PRODUCT_NAME=L4.pkg=void 0;var N4=R4();L4.pkg=N4;var T4="google-api-nodejs-client";L4.PRODUCT_NAME=T4;var zV=`${T4}/${N4.version}`;L4.USER_AGENT=zV});var D0=A((B4)=>{Object.defineProperty(B4,"__esModule",{value:!0});B4.AuthClient=B4.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=B4.DEFAULT_UNIVERSE=void 0;var wV=_("events"),_1=X0(),FV=P0(),UV=B1(),x1=y1();B4.DEFAULT_UNIVERSE="googleapis.com";B4.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=300000;class H0 extends wV.EventEmitter{apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=B4.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=!1;universeDomain=B4.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(Z={}){super();let $=(0,FV.originalOrCamelOptions)(Z);if(this.apiKey=Z.apiKey,this.projectId=$.get("project_id")??null,this.quotaProjectId=$.get("quota_project_id"),this.credentials=$.get("credentials")??{},this.universeDomain=$.get("universe_domain")??B4.DEFAULT_UNIVERSE,this.transporter=Z.transporter??new _1.Gaxios(Z.transporterOptions),$.get("useAuthRequestParameters")!==!1)this.transporter.interceptors.request.add(H0.DEFAULT_REQUEST_INTERCEPTOR),this.transporter.interceptors.response.add(H0.DEFAULT_RESPONSE_INTERCEPTOR);if(Z.eagerRefreshThresholdMillis)this.eagerRefreshThresholdMillis=Z.eagerRefreshThresholdMillis;this.forceRefreshOnFailure=Z.forceRefreshOnFailure??!1}fetch(...Z){let $=Z[0],Q=Z[1],Y=void 0,V=new Headers;if(typeof $==="string")Y=new URL($);else if($ instanceof URL)Y=$;else if($&&$.url)Y=new URL($.url);if($&&typeof $==="object"&&"headers"in $)_1.Gaxios.mergeHeaders(V,$.headers);if(Q)_1.Gaxios.mergeHeaders(V,new Headers(Q.headers));if(typeof $==="object"&&!($ instanceof URL))return this.request({...Q,...$,headers:V,url:Y});else return this.request({...Q,headers:V,url:Y})}setCredentials(Z){this.credentials=Z}addSharedMetadataHeaders(Z){if(!Z.has("x-goog-user-project")&&this.quotaProjectId)Z.set("x-goog-user-project",this.quotaProjectId);return Z}addUserProjectAndAuthHeaders(Z,$){let Q=$.get("x-goog-user-project"),Y=$.get("authorization");if(Q)Z.set("x-goog-user-project",Q);if(Y)Z.set("authorization",Y);return Z}static log=(0,UV.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:async(Z)=>{if(!Z.headers.has("x-goog-api-client")){let Q=process.version.replace(/^v/,"");Z.headers.set("x-goog-api-client",`gl-node/${Q}`)}let $=Z.headers.get("User-Agent");if(!$)Z.headers.set("User-Agent",x1.USER_AGENT);else if(!$.includes(`${x1.PRODUCT_NAME}/`))Z.headers.set("User-Agent",`${$} ${x1.USER_AGENT}`);try{let Q=Z,Y=Q[H0.RequestMethodNameSymbol],V=`${Math.floor(Math.random()*1000)}`;Q[H0.RequestLogIdSymbol]=V;let W={url:Z.url,headers:Z.headers};if(Y)H0.log.info("%s [%s] request %j",Y,V,W);else H0.log.info("[%s] request %j",V,W)}catch(Q){}return Z}};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:async(Z)=>{try{let $=Z.config,Q=$[H0.RequestMethodNameSymbol],Y=$[H0.RequestLogIdSymbol];if(Q)H0.log.info("%s [%s] response %j",Q,Y,Z.data);else H0.log.info("[%s] response %j",Y,Z.data)}catch($){}return Z},rejected:async(Z)=>{try{let $=Z.config,Q=$[H0.RequestMethodNameSymbol],Y=$[H0.RequestLogIdSymbol];if(Q)H0.log.info("%s [%s] error %j",Q,Y,Z.response?.data);else H0.log.error("[%s] error %j",Y,Z.response?.data)}catch($){}throw Z}};static setMethodName(Z,$){try{let Q=Z;Q[H0.RequestMethodNameSymbol]=$}catch(Q){}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}}B4.AuthClient=H0});var m1=A((j4)=>{Object.defineProperty(j4,"__esModule",{value:!0});j4.LoginTicket=void 0;class A4{envelope;payload;constructor(Z,$){this.envelope=Z,this.payload=$}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let Z=this.getPayload();if(Z&&Z.sub)return Z.sub;return null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}}j4.LoginTicket=A4});var n0=A((f4)=>{Object.defineProperty(f4,"__esModule",{value:!0});f4.OAuth2Client=f4.ClientAuthentication=f4.CertificateFormat=f4.CodeChallengeMethod=void 0;var v4=X0(),DV=_("querystring"),MV=_("stream"),GV=f1(),E4=P0(),g1=D8(),$8=D0(),IV=m1(),h4;(function(Z){Z.Plain="plain",Z.S256="S256"})(h4||(f4.CodeChallengeMethod=h4={}));var b0;(function(Z){Z.PEM="PEM",Z.JWK="JWK"})(b0||(f4.CertificateFormat=b0={}));var M8;(function(Z){Z.ClientSecretPost="ClientSecretPost",Z.ClientSecretBasic="ClientSecretBasic",Z.None="None"})(M8||(f4.ClientAuthentication=M8={}));class S0 extends $8.AuthClient{redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=b0.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(Z={},$,Q){super(typeof Z==="object"?Z:{});if(typeof Z!=="object")Z={clientId:Z,clientSecret:$,redirectUri:Q};this._clientId=Z.clientId||Z.client_id,this._clientSecret=Z.clientSecret||Z.client_secret,this.redirectUri=Z.redirectUri||Z.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",...Z.endpoints},this.clientAuthentication=Z.clientAuthentication||M8.ClientSecretPost,this.issuers=Z.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(Z={}){if(Z.code_challenge_method&&!Z.code_challenge)throw Error("If a code_challenge_method is provided, code_challenge must be included.");if(Z.response_type=Z.response_type||"code",Z.client_id=Z.client_id||this._clientId,Z.redirect_uri=Z.redirect_uri||this.redirectUri,Array.isArray(Z.scope))Z.scope=Z.scope.join(" ");return this.endpoints.oauth2AuthBaseUrl.toString()+"?"+DV.stringify(Z)}generateCodeVerifier(){throw Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let Z=(0,g1.createCrypto)(),Q=Z.randomBytesBase64(96).replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-"),V=(await Z.sha256DigestBase64(Q)).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:Q,codeChallenge:V}}getToken(Z,$){let Q=typeof Z==="string"?{code:Z}:Z;if($)this.getTokenAsync(Q).then((Y)=>$(null,Y.tokens,Y.res),(Y)=>$(Y,null,Y.response));else return this.getTokenAsync(Q)}async getTokenAsync(Z){let $=this.endpoints.oauth2TokenUrl.toString(),Q=new Headers,Y={client_id:Z.client_id||this._clientId,code_verifier:Z.codeVerifier,code:Z.code,grant_type:"authorization_code",redirect_uri:Z.redirect_uri||this.redirectUri};if(this.clientAuthentication===M8.ClientSecretBasic){let K=Buffer.from(`${this._clientId}:${this._clientSecret}`);Q.set("authorization",`Basic ${K.toString("base64")}`)}if(this.clientAuthentication===M8.ClientSecretPost)Y.client_secret=this._clientSecret;let V={...S0.RETRY_CONFIG,method:"POST",url:$,data:new URLSearchParams((0,E4.removeUndefinedValuesInObject)(Y)),headers:Q};$8.AuthClient.setMethodName(V,"getTokenAsync");let W=await this.transporter.request(V),z=W.data;if(W.data&&W.data.expires_in)z.expiry_date=new Date().getTime()+W.data.expires_in*1000,delete z.expires_in;return this.emit("tokens",z),{tokens:z,res:W}}async refreshToken(Z){if(!Z)return this.refreshTokenNoCache(Z);if(this.refreshTokenPromises.has(Z))return this.refreshTokenPromises.get(Z);let $=this.refreshTokenNoCache(Z).then((Q)=>{return this.refreshTokenPromises.delete(Z),Q},(Q)=>{throw this.refreshTokenPromises.delete(Z),Q});return this.refreshTokenPromises.set(Z,$),$}async refreshTokenNoCache(Z){if(!Z)throw Error("No refresh token is set.");let $=this.endpoints.oauth2TokenUrl.toString(),Q={refresh_token:Z,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"},Y;try{let W={...S0.RETRY_CONFIG,method:"POST",url:$,data:new URLSearchParams((0,E4.removeUndefinedValuesInObject)(Q))};$8.AuthClient.setMethodName(W,"refreshTokenNoCache"),Y=await this.transporter.request(W)}catch(W){if(W instanceof v4.GaxiosError&&W.message==="invalid_grant"&&W.response?.data&&/ReAuth/i.test(W.response.data.error_description))W.message=JSON.stringify(W.response.data);throw W}let V=Y.data;if(Y.data&&Y.data.expires_in)V.expiry_date=new Date().getTime()+Y.data.expires_in*1000,delete V.expires_in;return this.emit("tokens",V),{tokens:V,res:Y}}refreshAccessToken(Z){if(Z)this.refreshAccessTokenAsync().then(($)=>Z(null,$.credentials,$.res),Z);else return this.refreshAccessTokenAsync()}async refreshAccessTokenAsync(){let Z=await this.refreshToken(this.credentials.refresh_token),$=Z.tokens;return $.refresh_token=this.credentials.refresh_token,this.credentials=$,{credentials:this.credentials,res:Z.res}}getAccessToken(Z){if(Z)this.getAccessTokenAsync().then(($)=>Z(null,$.token,$.res),Z);else return this.getAccessTokenAsync()}async getAccessTokenAsync(){if(!this.credentials.access_token||this.isTokenExpiring()){if(!this.credentials.refresh_token)if(this.refreshHandler){let Q=await this.processAndValidateRefreshHandler();if(Q?.access_token)return this.setCredentials(Q),{token:this.credentials.access_token}}else throw Error("No refresh token or refresh handler callback is set.");let $=await this.refreshAccessTokenAsync();if(!$.credentials||$.credentials&&!$.credentials.access_token)throw Error("Could not refresh access token.");return{token:$.credentials.access_token,res:$.res}}else return{token:this.credentials.access_token}}async getRequestHeaders(Z){return(await this.getRequestMetadataAsync(Z)).headers}async getRequestMetadataAsync(Z){let $=this.credentials;if(!$.access_token&&!$.refresh_token&&!this.apiKey&&!this.refreshHandler)throw Error("No access, refresh token, API key or refresh handler callback is set.");if($.access_token&&!this.isTokenExpiring()){$.token_type=$.token_type||"Bearer";let z=new Headers({authorization:$.token_type+" "+$.access_token});return{headers:this.addSharedMetadataHeaders(z)}}if(this.refreshHandler){let z=await this.processAndValidateRefreshHandler();if(z?.access_token){this.setCredentials(z);let K=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(K)}}}if(this.apiKey)return{headers:new Headers({"X-Goog-Api-Key":this.apiKey})};let Q=null,Y=null;try{Q=await this.refreshToken($.refresh_token),Y=Q.tokens}catch(z){let K=z;if(K.response&&(K.response.status===403||K.response.status===404))K.message=`Could not refresh access token: ${K.message}`;throw K}let V=this.credentials;V.token_type=V.token_type||"Bearer",Y.refresh_token=V.refresh_token,this.credentials=Y;let W=new Headers({authorization:V.token_type+" "+Y.access_token});return{headers:this.addSharedMetadataHeaders(W),res:Q.res}}static getRevokeTokenUrl(Z){return new S0().getRevokeTokenURL(Z).toString()}getRevokeTokenURL(Z){let $=new URL(this.endpoints.oauth2RevokeUrl);return $.searchParams.append("token",Z),$}revokeToken(Z,$){let Q={...S0.RETRY_CONFIG,url:this.getRevokeTokenURL(Z).toString(),method:"POST"};if($8.AuthClient.setMethodName(Q,"revokeToken"),$)this.transporter.request(Q).then((Y)=>$(null,Y),$);else return this.transporter.request(Q)}revokeCredentials(Z){if(Z)this.revokeCredentialsAsync().then(($)=>Z(null,$),Z);else return this.revokeCredentialsAsync()}async revokeCredentialsAsync(){let Z=this.credentials.access_token;if(this.credentials={},Z)return this.revokeToken(Z);else throw Error("No access token to revoke.")}request(Z,$){if($)this.requestAsync(Z).then((Q)=>$(null,Q),(Q)=>{return $(Q,Q.response)});else return this.requestAsync(Z)}async requestAsync(Z,$=!1){try{let Q=await this.getRequestMetadataAsync();if(Z.headers=v4.Gaxios.mergeHeaders(Z.headers),this.addUserProjectAndAuthHeaders(Z.headers,Q.headers),this.apiKey)Z.headers.set("X-Goog-Api-Key",this.apiKey);return await this.transporter.request(Z)}catch(Q){let Y=Q.response;if(Y){let V=Y.status,W=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),z=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,K=Y.config.data instanceof MV.Readable,F=V===401||V===403;if(!$&&F&&!K&&W)return await this.refreshAccessTokenAsync(),this.requestAsync(Z,!0);else if(!$&&F&&!K&&z){let L=await this.processAndValidateRefreshHandler();if(L?.access_token)this.setCredentials(L);return this.requestAsync(Z,!0)}}throw Q}}verifyIdToken(Z,$){if($&&typeof $!=="function")throw Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if($)this.verifyIdTokenAsync(Z).then((Q)=>$(null,Q),$);else return this.verifyIdTokenAsync(Z)}async verifyIdTokenAsync(Z){if(!Z.idToken)throw Error("The verifyIdToken method requires an ID Token");let $=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(Z.idToken,$.certs,Z.audience,this.issuers,Z.maxExpiry)}async getTokenInfo(Z){let{data:$}=await this.transporter.request({...S0.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${Z}`},url:this.endpoints.tokenInfoUrl.toString()}),Q=Object.assign({expiry_date:new Date().getTime()+$.expires_in*1000,scopes:$.scope.split(" ")},$);return delete Q.expires_in,delete Q.scope,Q}getFederatedSignonCerts(Z){if(Z)this.getFederatedSignonCertsAsync().then(($)=>Z(null,$.certs,$.res),Z);else return this.getFederatedSignonCertsAsync()}async getFederatedSignonCertsAsync(){let Z=new Date().getTime(),$=(0,g1.hasBrowserCrypto)()?b0.JWK:b0.PEM;if(this.certificateExpiry&&Z<this.certificateExpiry.getTime()&&this.certificateCacheFormat===$)return{certs:this.certificateCache,format:$};let Q,Y;switch($){case b0.PEM:Y=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case b0.JWK:Y=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw Error(`Unsupported certificate format ${$}`)}try{let F={...S0.RETRY_CONFIG,url:Y};$8.AuthClient.setMethodName(F,"getFederatedSignonCertsAsync"),Q=await this.transporter.request(F)}catch(F){if(F instanceof Error)F.message=`Failed to retrieve verification certificates: ${F.message}`;throw F}let V=Q?.headers.get("cache-control"),W=-1;if(V){let F=/max-age=(?<maxAge>[0-9]+)/.exec(V)?.groups?.maxAge;if(F)W=Number(F)*1000}let z={};switch($){case b0.PEM:z=Q.data;break;case b0.JWK:for(let F of Q.data.keys)z[F.kid]=F;break;default:throw Error(`Unsupported certificate format ${$}`)}let K=new Date;return this.certificateExpiry=W===-1?null:new Date(K.getTime()+W),this.certificateCache=z,this.certificateCacheFormat=$,{certs:z,format:$,res:Q}}getIapPublicKeys(Z){if(Z)this.getIapPublicKeysAsync().then(($)=>Z(null,$.pubkeys,$.res),Z);else return this.getIapPublicKeysAsync()}async getIapPublicKeysAsync(){let Z,$=this.endpoints.oauth2IapPublicKeyUrl.toString();try{let Q={...S0.RETRY_CONFIG,url:$};$8.AuthClient.setMethodName(Q,"getIapPublicKeysAsync"),Z=await this.transporter.request(Q)}catch(Q){if(Q instanceof Error)Q.message=`Failed to retrieve verification certificates: ${Q.message}`;throw Q}return{pubkeys:Z.data,res:Z}}verifySignedJwtWithCerts(){throw Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(Z,$,Q,Y,V){let W=(0,g1.createCrypto)();if(!V)V=S0.DEFAULT_MAX_TOKEN_LIFETIME_SECS_;let z=Z.split(".");if(z.length!==3)throw Error("Wrong number of segments in token: "+Z);let K=z[0]+"."+z[1],F=z[2],L,N;try{L=JSON.parse(W.decodeBase64StringUtf8(z[0]))}catch(p){if(p instanceof Error)p.message=`Can't parse token envelope: ${z[0]}': ${p.message}`;throw p}if(!L)throw Error("Can't parse token envelope: "+z[0]);try{N=JSON.parse(W.decodeBase64StringUtf8(z[1]))}catch(p){if(p instanceof Error)p.message=`Can't parse token payload '${z[0]}`;throw p}if(!N)throw Error("Can't parse token payload: "+z[1]);if(!Object.prototype.hasOwnProperty.call($,L.kid))throw Error("No pem found for envelope: "+JSON.stringify(L));let S=$[L.kid];if(L.alg==="ES256")F=GV.joseToDer(F,"ES256").toString("base64");if(!await W.verify(S,K,F))throw Error("Invalid token signature: "+Z);if(!N.iat)throw Error("No issue time in token: "+JSON.stringify(N));if(!N.exp)throw Error("No expiration time in token: "+JSON.stringify(N));let x=Number(N.iat);if(isNaN(x))throw Error("iat field using invalid format");let u=Number(N.exp);if(isNaN(u))throw Error("exp field using invalid format");let C=new Date().getTime()/1000;if(u>=C+V)throw Error("Expiration time too far in future: "+JSON.stringify(N));let f=x-S0.CLOCK_SKEW_SECS_,j=u+S0.CLOCK_SKEW_SECS_;if(C<f)throw Error("Token used too early, "+C+" < "+f+": "+JSON.stringify(N));if(C>j)throw Error("Token used too late, "+C+" > "+j+": "+JSON.stringify(N));if(Y&&Y.indexOf(N.iss)<0)throw Error("Invalid issuer, expected one of ["+Y+"], but got "+N.iss);if(typeof Q<"u"&&Q!==null){let p=N.aud,o=!1;if(Q.constructor===Array)o=Q.indexOf(p)>-1;else o=p===Q;if(!o)throw Error("Wrong recipient, payload audience != requiredAudience")}return new IV.LoginTicket(L,N)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let Z=await this.refreshHandler();if(!Z.access_token)throw Error("No access token is returned by the refreshHandler callback.");return Z}return}isTokenExpiring(){let Z=this.credentials.expiry_date;return Z?Z<=new Date().getTime()+this.eagerRefreshThresholdMillis:!1}}f4.OAuth2Client=S0});var u1=A((x4)=>{Object.defineProperty(x4,"__esModule",{value:!0});x4.Compute=void 0;var LV=X0(),y4=U8(),SV=n0();class _4 extends SV.OAuth2Client{serviceAccountEmail;scopes;constructor(Z={}){super(Z);this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=Z.serviceAccountEmail||"default",this.scopes=Array.isArray(Z.scopes)?Z.scopes:Z.scopes?[Z.scopes]:[]}async refreshTokenNoCache(){let Z=`service-accounts/${this.serviceAccountEmail}/token`,$;try{let Y={property:Z};if(this.scopes.length>0)Y.params={scopes:this.scopes.join(",")};$=await y4.instance(Y)}catch(Y){if(Y instanceof LV.GaxiosError)Y.message=`Could not refresh access token: ${Y.message}`,this.wrapError(Y);throw Y}let Q=$;if($&&$.expires_in)Q.expiry_date=new Date().getTime()+$.expires_in*1000,delete Q.expires_in;return this.emit("tokens",Q),{tokens:Q,res:null}}async fetchIdToken(Z){let $=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${Z}`,Q;try{let Y={property:$};Q=await y4.instance(Y)}catch(Y){if(Y instanceof Error)Y.message=`Could not fetch ID token: ${Y.message}`;throw Y}return Q}wrapError(Z){let $=Z.response;if($&&$.status){if(Z.status=$.status,$.status===403)Z.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: "+Z.message;else if($.status===404)Z.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: "+Z.message}}}x4.Compute=_4});var d1=A((g4)=>{Object.defineProperty(g4,"__esModule",{value:!0});g4.IdTokenClient=void 0;var BV=n0();class m4 extends BV.OAuth2Client{targetAudience;idTokenProvider;constructor(Z){super(Z);this.targetAudience=Z.targetAudience,this.idTokenProvider=Z.idTokenProvider}async getRequestMetadataAsync(){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){let $=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:$,expiry_date:this.getIdTokenExpiryDate($)}}return{headers:new Headers({authorization:"Bearer "+this.credentials.id_token})}}getIdTokenExpiryDate(Z){let $=Z.split(".")[1];if($)return JSON.parse(Buffer.from($,"base64").toString("ascii")).exp*1000}}g4.IdTokenClient=m4});var l1=A((l4)=>{Object.defineProperty(l4,"__esModule",{value:!0});l4.GCPEnv=void 0;l4.clear=OV;l4.getEnv=PV;var d4=U8(),f0;(function(Z){Z.APP_ENGINE="APP_ENGINE",Z.KUBERNETES_ENGINE="KUBERNETES_ENGINE",Z.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",Z.COMPUTE_ENGINE="COMPUTE_ENGINE",Z.CLOUD_RUN="CLOUD_RUN",Z.CLOUD_RUN_JOBS="CLOUD_RUN_JOBS",Z.NONE="NONE"})(f0||(l4.GCPEnv=f0={}));var G8;function OV(){G8=void 0}async function PV(){if(G8)return G8;return G8=AV(),G8}async function AV(){let Z=f0.NONE;if(jV())Z=f0.APP_ENGINE;else if(CV())Z=f0.CLOUD_FUNCTIONS;else if(await fV())if(await hV())Z=f0.KUBERNETES_ENGINE;else if(vV())Z=f0.CLOUD_RUN;else if(EV())Z=f0.CLOUD_RUN_JOBS;else Z=f0.COMPUTE_ENGINE;else Z=f0.NONE;return Z}function jV(){return!!(process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME)}function CV(){return!!(process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET)}function vV(){return!!process.env.K_CONFIGURATION}function EV(){return!!process.env.CLOUD_RUN_JOB}async function hV(){try{return await d4.instance("attributes/cluster-name"),!0}catch(Z){return!1}}async function fV(){return d4.isAvailable()}});var c1=A((UX,p4)=>{var l8=Z8().Buffer,_V=_("stream"),xV=_("util");function c8(Z){if(this.buffer=null,this.writable=!0,this.readable=!0,!Z)return this.buffer=l8.alloc(0),this;if(typeof Z.pipe==="function")return this.buffer=l8.alloc(0),Z.pipe(this),this;if(Z.length||typeof Z==="object")return this.buffer=Z,this.writable=!1,process.nextTick(function(){this.emit("end",Z),this.readable=!1,this.emit("close")}.bind(this)),this;throw TypeError("Unexpected data type ("+typeof Z+")")}xV.inherits(c8,_V);c8.prototype.write=function($){this.buffer=l8.concat([this.buffer,l8.from($)]),this.emit("data",$)};c8.prototype.end=function($){if($)this.write($);this.emit("end",$),this.emit("close"),this.writable=!1,this.readable=!1};p4.exports=c8});var a4=A((DX,i4)=>{var I8=_("buffer").Buffer,p1=_("buffer").SlowBuffer;i4.exports=p8;function p8(Z,$){if(!I8.isBuffer(Z)||!I8.isBuffer($))return!1;if(Z.length!==$.length)return!1;var Q=0;for(var Y=0;Y<Z.length;Y++)Q|=Z[Y]^$[Y];return Q===0}p8.install=function(){I8.prototype.equal=p1.prototype.equal=function($){return p8(this,$)}};var bV=I8.prototype.equal,mV=p1.prototype.equal;p8.restore=function(){I8.prototype.equal=bV,p1.prototype.equal=mV}});var r1=A((MX,Q$)=>{var Y8=Z8().Buffer,B0=_("crypto"),r4=f1(),n4=_("util"),gV=`"%s" is not a valid algorithm.
|
|
15
|
+
Supported algorithms are:
|
|
16
|
+
"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,R8="secret must be a string or buffer",Q8="key must be a string or a buffer",uV="key must be a string, a buffer or an object",a1=typeof B0.createPublicKey==="function";if(a1)Q8+=" or a KeyObject",R8+="or a KeyObject";function s4(Z){if(Y8.isBuffer(Z))return;if(typeof Z==="string")return;if(!a1)throw A0(Q8);if(typeof Z!=="object")throw A0(Q8);if(typeof Z.type!=="string")throw A0(Q8);if(typeof Z.asymmetricKeyType!=="string")throw A0(Q8);if(typeof Z.export!=="function")throw A0(Q8)}function o4(Z){if(Y8.isBuffer(Z))return;if(typeof Z==="string")return;if(typeof Z==="object")return;throw A0(uV)}function dV(Z){if(Y8.isBuffer(Z))return;if(typeof Z==="string")return Z;if(!a1)throw A0(R8);if(typeof Z!=="object")throw A0(R8);if(Z.type!=="secret")throw A0(R8);if(typeof Z.export!=="function")throw A0(R8)}function n1(Z){return Z.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function t4(Z){Z=Z.toString();var $=4-Z.length%4;if($!==4)for(var Q=0;Q<$;++Q)Z+="=";return Z.replace(/\-/g,"+").replace(/_/g,"/")}function A0(Z){var $=[].slice.call(arguments,1),Q=n4.format.bind(n4,Z).apply(null,$);return TypeError(Q)}function lV(Z){return Y8.isBuffer(Z)||typeof Z==="string"}function N8(Z){if(!lV(Z))Z=JSON.stringify(Z);return Z}function e4(Z){return function(Q,Y){dV(Y),Q=N8(Q);var V=B0.createHmac("sha"+Z,Y),W=(V.update(Q),V.digest("base64"));return n1(W)}}var i1,cV="timingSafeEqual"in B0?function($,Q){if($.byteLength!==Q.byteLength)return!1;return B0.timingSafeEqual($,Q)}:function($,Q){if(!i1)i1=a4();return i1($,Q)};function pV(Z){return function(Q,Y,V){var W=e4(Z)(Q,V);return cV(Y8.from(Y),Y8.from(W))}}function Z$(Z){return function(Q,Y){o4(Y),Q=N8(Q);var V=B0.createSign("RSA-SHA"+Z),W=(V.update(Q),V.sign(Y,"base64"));return n1(W)}}function $$(Z){return function(Q,Y,V){s4(V),Q=N8(Q),Y=t4(Y);var W=B0.createVerify("RSA-SHA"+Z);return W.update(Q),W.verify(V,Y,"base64")}}function iV(Z){return function(Q,Y){o4(Y),Q=N8(Q);var V=B0.createSign("RSA-SHA"+Z),W=(V.update(Q),V.sign({key:Y,padding:B0.constants.RSA_PKCS1_PSS_PADDING,saltLength:B0.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return n1(W)}}function aV(Z){return function(Q,Y,V){s4(V),Q=N8(Q),Y=t4(Y);var W=B0.createVerify("RSA-SHA"+Z);return W.update(Q),W.verify({key:V,padding:B0.constants.RSA_PKCS1_PSS_PADDING,saltLength:B0.constants.RSA_PSS_SALTLEN_DIGEST},Y,"base64")}}function nV(Z){var $=Z$(Z);return function(){var Y=$.apply(null,arguments);return Y=r4.derToJose(Y,"ES"+Z),Y}}function rV(Z){var $=$$(Z);return function(Y,V,W){V=r4.joseToDer(V,"ES"+Z).toString("base64");var z=$(Y,V,W);return z}}function sV(){return function(){return""}}function oV(){return function($,Q){return Q===""}}Q$.exports=function($){var Q={hs:e4,rs:Z$,ps:iV,es:nV,none:sV},Y={hs:pV,rs:$$,ps:aV,es:rV,none:oV},V=$.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!V)throw A0(gV,$);var W=(V[1]||V[3]).toLowerCase(),z=V[2];return{sign:Q[W](z),verify:Y[W](z)}}});var s1=A((GX,Y$)=>{var tV=_("buffer").Buffer;Y$.exports=function($){if(typeof $==="string")return $;if(typeof $==="number"||tV.isBuffer($))return $.toString();return JSON.stringify($)}});var z$=A((IX,H$)=>{var eV=Z8().Buffer,V$=c1(),ZW=r1(),$W=_("stream"),W$=s1(),o1=_("util");function J$(Z,$){return eV.from(Z,$).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function QW(Z,$,Q){Q=Q||"utf8";var Y=J$(W$(Z),"binary"),V=J$(W$($),Q);return o1.format("%s.%s",Y,V)}function X$(Z){var{header:$,payload:Q}=Z,Y=Z.secret||Z.privateKey,V=Z.encoding,W=ZW($.alg),z=QW($,Q,V),K=W.sign(z,Y);return o1.format("%s.%s",z,K)}function i8(Z){var $=Z.secret;if($=$==null?Z.privateKey:$,$=$==null?Z.key:$,/^hs/i.test(Z.header.alg)===!0&&$==null)throw TypeError("secret must be a string or buffer or a KeyObject");var Q=new V$($);this.readable=!0,this.header=Z.header,this.encoding=Z.encoding,this.secret=this.privateKey=this.key=Q,this.payload=new V$(Z.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))}o1.inherits(i8,$W);i8.prototype.sign=function(){try{var $=X$({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",$),this.emit("data",$),this.emit("end"),this.readable=!1,$}catch(Q){this.readable=!1,this.emit("error",Q),this.emit("close")}};i8.sign=X$;H$.exports=i8});var R$=A((RX,I$)=>{var q$=Z8().Buffer,K$=c1(),YW=r1(),VW=_("stream"),w$=s1(),WW=_("util"),JW=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function XW(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function HW(Z){if(XW(Z))return Z;try{return JSON.parse(Z)}catch($){return}}function F$(Z){var $=Z.split(".",1)[0];return HW(q$.from($,"base64").toString("binary"))}function zW(Z){return Z.split(".",2).join(".")}function U$(Z){return Z.split(".")[2]}function KW(Z,$){$=$||"utf8";var Q=Z.split(".")[1];return q$.from(Q,"base64").toString($)}function D$(Z){return JW.test(Z)&&!!F$(Z)}function M$(Z,$,Q){if(!$){var Y=Error("Missing algorithm parameter for jws.verify");throw Y.code="MISSING_ALGORITHM",Y}Z=w$(Z);var V=U$(Z),W=zW(Z),z=YW($);return z.verify(W,V,Q)}function G$(Z,$){if($=$||{},Z=w$(Z),!D$(Z))return null;var Q=F$(Z);if(!Q)return null;var Y=KW(Z);if(Q.typ==="JWT"||$.json)Y=JSON.parse(Y,$.encoding);return{header:Q,payload:Y,signature:U$(Z)}}function V8(Z){Z=Z||{};var $=Z.secret;if($=$==null?Z.publicKey:$,$=$==null?Z.key:$,/^hs/i.test(Z.algorithm)===!0&&$==null)throw TypeError("secret must be a string or buffer or a KeyObject");var Q=new K$($);this.readable=!0,this.algorithm=Z.algorithm,this.encoding=Z.encoding,this.secret=this.publicKey=this.key=Q,this.signature=new K$(Z.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))}WW.inherits(V8,VW);V8.prototype.verify=function(){try{var $=M$(this.signature.buffer,this.algorithm,this.key.buffer),Q=G$(this.signature.buffer,this.encoding);return this.emit("done",$,Q),this.emit("data",$),this.emit("end"),this.readable=!1,$}catch(Y){this.readable=!1,this.emit("error",Y),this.emit("close")}};V8.decode=G$;V8.isValid=D$;V8.verify=M$;I$.exports=V8});var t1=A((wW)=>{var N$=z$(),a8=R$(),qW=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];wW.ALGORITHMS=qW;wW.sign=N$.sign;wW.verify=a8.verify;wW.decode=a8.decode;wW.isValid=a8.isValid;wW.createSign=function($){return new N$($)};wW.createVerify=function($){return new a8($)}});var x$=A((y$)=>{Object.defineProperty(y$,"__esModule",{value:!0});y$.GoogleToken=void 0;var T$=n8(_("fs")),NW=X0(),TW=n8(t1()),LW=n8(_("path")),SW=_("util");function n8(Z,$){if(typeof WeakMap=="function")var Q=new WeakMap,Y=new WeakMap;return(n8=function(W,z){if(!z&&W&&W.__esModule)return W;var K,F,L={__proto__:null,default:W};if(W===null||m0(W)!="object"&&typeof W!="function")return L;if(K=z?Y:Q){if(K.has(W))return K.get(W);K.set(W,L)}for(var N in W)N!=="default"&&{}.hasOwnProperty.call(W,N)&&((F=(K=Object.defineProperty)&&Object.getOwnPropertyDescriptor(W,N))&&(F.get||F.set)?K(L,N,F):L[N]=W[N]);return L})(Z,$)}function m0(Z){return m0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},m0(Z)}function BW(Z,$){v$(Z,$),$.add(Z)}function OW(Z,$,Q){v$(Z,$),$.set(Z,Q)}function v$(Z,$){if($.has(Z))throw TypeError("Cannot initialize the same private elements twice on an object")}function L$(Z,$,Q){return Z.set(j0(Z,$),Q),Q}function S$(Z,$){return Z.get(j0(Z,$))}function j0(Z,$,Q){if(typeof Z=="function"?Z===$:Z.has($))return arguments.length<3?$:Q;throw TypeError("Private element is not present on this object")}function B$(Z,$){for(var Q=0;Q<$.length;Q++){var Y=$[Q];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(Z,f$(Y.key),Y)}}function E$(Z,$,Q){return $&&B$(Z.prototype,$),Q&&B$(Z,Q),Object.defineProperty(Z,"prototype",{writable:!1}),Z}function h$(Z,$){if(!(Z instanceof $))throw TypeError("Cannot call a class as a function")}function PW(Z,$,Q){return $=B8($),AW(Z,V6()?Reflect.construct($,Q||[],B8(Z).constructor):$.apply(Z,Q))}function AW(Z,$){if($&&(m0($)=="object"||typeof $=="function"))return $;if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return jW(Z)}function jW(Z){if(Z===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return Z}function CW(Z,$){if(typeof $!="function"&&$!==null)throw TypeError("Super expression must either be null or a function");Z.prototype=Object.create($&&$.prototype,{constructor:{value:Z,writable:!0,configurable:!0}}),Object.defineProperty(Z,"prototype",{writable:!1}),$&&S8(Z,$)}function e1(Z){var $=typeof Map=="function"?new Map:void 0;return e1=function(Y){if(Y===null||!EW(Y))return Y;if(typeof Y!="function")throw TypeError("Super expression must either be null or a function");if($!==void 0){if($.has(Y))return $.get(Y);$.set(Y,V)}function V(){return vW(Y,arguments,B8(this).constructor)}return V.prototype=Object.create(Y.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),S8(V,Y)},e1(Z)}function vW(Z,$,Q){if(V6())return Reflect.construct.apply(null,arguments);var Y=[null];Y.push.apply(Y,$);var V=new(Z.bind.apply(Z,Y));return Q&&S8(V,Q.prototype),V}function V6(){try{var Z=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(V6=function(){return!!Z})()}function EW(Z){try{return Function.toString.call(Z).indexOf("[native code]")!==-1}catch($){return typeof Z=="function"}}function S8(Z,$){return S8=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Q,Y){return Q.__proto__=Y,Q},S8(Z,$)}function B8(Z){return B8=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($){return $.__proto__||Object.getPrototypeOf($)},B8(Z)}function M0(Z,$,Q){return($=f$($))in Z?Object.defineProperty(Z,$,{value:Q,enumerable:!0,configurable:!0,writable:!0}):Z[$]=Q,Z}function f$(Z){var $=hW(Z,"string");return m0($)=="symbol"?$:$+""}function hW(Z,$){if(m0(Z)!="object"||!Z)return Z;var Q=Z[Symbol.toPrimitive];if(Q!==void 0){var Y=Q.call(Z,$||"default");if(m0(Y)!="object")return Y;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(Z)}function I0(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var Z,$,Q=typeof Symbol=="function"?Symbol:{},Y=Q.iterator||"@@iterator",V=Q.toStringTag||"@@toStringTag";function W(x,u,C,f){var j=u&&u.prototype instanceof K?u:K,p=Object.create(j.prototype);return G0(p,"_invoke",function(o,J0,b){var v,k,m,O=0,t=b||[],i=!1,d={p:0,n:0,v:Z,a:V0,f:V0.bind(Z,4),d:function(Q0,e){return v=Q0,k=0,m=Z,d.n=e,z}};function V0(s,Q0){for(k=s,m=Q0,$=0;!i&&O&&!e&&$<t.length;$++){var e,Y0=t[$],y0=d.p,w0=Y0[2];s>3?(e=w0===Q0)&&(m=Y0[(k=Y0[4])?5:(k=3,3)],Y0[4]=Y0[5]=Z):Y0[0]<=y0&&((e=s<2&&y0<Y0[1])?(k=0,d.v=Q0,d.n=Y0[1]):y0<w0&&(e=s<3||Y0[0]>Q0||Q0>w0)&&(Y0[4]=s,Y0[5]=Q0,d.n=w0,k=0))}if(e||s>1)return z;throw i=!0,Q0}return function(s,Q0,e){if(O>1)throw TypeError("Generator is already running");for(i&&Q0===1&&V0(Q0,e),k=Q0,m=e;($=k<2?Z:m)||!i;){v||(k?k<3?(k>1&&(d.n=-1),V0(k,m)):d.n=m:d.v=m);try{if(O=2,v){if(k||(s="next"),$=v[s]){if(!($=$.call(v,m)))throw TypeError("iterator result is not an object");if(!$.done)return $;m=$.value,k<2&&(k=0)}else k===1&&($=v.return)&&$.call(v),k<2&&(m=TypeError("The iterator does not provide a '"+s+"' method"),k=1);v=Z}else if(($=(i=d.n<0)?m:o.call(J0,d))!==z)break}catch(Y0){v=Z,k=1,m=Y0}finally{O=1}}return{value:$,done:i}}}(x,C,f),!0),p}var z={};function K(){}function F(){}function L(){}$=Object.getPrototypeOf;var N=[][Y]?$($([][Y]())):(G0($={},Y,function(){return this}),$),S=L.prototype=K.prototype=Object.create(N);function P(x){return Object.setPrototypeOf?Object.setPrototypeOf(x,L):(x.__proto__=L,G0(x,V,"GeneratorFunction")),x.prototype=Object.create(S),x}return F.prototype=L,G0(S,"constructor",L),G0(L,"constructor",F),F.displayName="GeneratorFunction",G0(L,V,"GeneratorFunction"),G0(S),G0(S,V,"Generator"),G0(S,Y,function(){return this}),G0(S,"toString",function(){return"[object Generator]"}),(I0=function(){return{w:W,m:P}})()}function G0(Z,$,Q,Y){var V=Object.defineProperty;try{V({},"",{})}catch(W){V=0}G0=function(z,K,F,L){if(K)V?V(z,K,{value:F,enumerable:!L,configurable:!L,writable:!L}):z[K]=F;else{var N=function(P,x){G0(z,P,function(u){return this._invoke(P,x,u)})};N("next",0),N("throw",1),N("return",2)}},G0(Z,$,Q,Y)}function O$(Z,$,Q,Y,V,W,z){try{var K=Z[W](z),F=K.value}catch(L){return void Q(L)}K.done?$(F):Promise.resolve(F).then(Y,V)}function W8(Z){return function(){var $=this,Q=arguments;return new Promise(function(Y,V){var W=Z.apply($,Q);function z(F){O$(W,Y,V,z,K,"next",F)}function K(F){O$(W,Y,V,z,K,"throw",F)}z(void 0)})}}var P$=T$.readFile?(0,SW.promisify)(T$.readFile):W8(I0().m(function Z(){return I0().w(function($){while(!0)switch($.n){case 0:throw new L8("use key rather than keyFile.","MISSING_CREDENTIALS");case 1:return $.a(2)}},Z)})),A$="https://oauth2.googleapis.com/token",fW="https://oauth2.googleapis.com/revoke?token=",L8=function(Z){function $(Q,Y){var V;return h$(this,$),V=PW(this,$,[Q]),M0(V,"code",void 0),V.code=Y,V}return CW($,Z),E$($)}(e1(Error)),T8=new WeakMap,k0=new WeakSet,TX=y$.GoogleToken=function(){function Z($){h$(this,Z),BW(this,k0),M0(this,"expiresAt",void 0),M0(this,"key",void 0),M0(this,"keyFile",void 0),M0(this,"iss",void 0),M0(this,"sub",void 0),M0(this,"scope",void 0),M0(this,"rawToken",void 0),M0(this,"tokenExpires",void 0),M0(this,"email",void 0),M0(this,"additionalClaims",void 0),M0(this,"eagerRefreshThresholdMillis",void 0),M0(this,"transporter",{request:function(Y){return(0,NW.request)(Y)}}),OW(this,T8,void 0),j0(k0,this,k$).call(this,$)}return E$(Z,[{key:"accessToken",get:function(){return this.rawToken?this.rawToken.access_token:void 0}},{key:"idToken",get:function(){return this.rawToken?this.rawToken.id_token:void 0}},{key:"tokenType",get:function(){return this.rawToken?this.rawToken.token_type:void 0}},{key:"refreshToken",get:function(){return this.rawToken?this.rawToken.refresh_token:void 0}},{key:"hasExpired",value:function(){var Q=new Date().getTime();if(this.rawToken&&this.expiresAt)return Q>=this.expiresAt;else return!0}},{key:"isTokenExpiring",value:function(){var Q,Y=new Date().getTime(),V=(Q=this.eagerRefreshThresholdMillis)!==null&&Q!==void 0?Q:0;if(this.rawToken&&this.expiresAt)return this.expiresAt<=Y+V;else return!0}},{key:"getToken",value:function(Q){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(m0(Q)==="object")Y=Q,Q=void 0;if(Y=Object.assign({forceRefresh:!1},Y),Q){var V=Q;j0(k0,this,j$).call(this,Y).then(function(W){return V(null,W)},Q);return}return j0(k0,this,j$).call(this,Y)}},{key:"getCredentials",value:function(){var $=W8(I0().m(function Y(V){var W,z,K,F,L,N,S;return I0().w(function(P){while(!0)switch(P.n){case 0:W=LW.extname(V),S=W,P.n=S===".json"?1:S===".der"?4:S===".crt"?4:S===".pem"?4:S===".p12"?6:S===".pfx"?6:7;break;case 1:return P.n=2,P$(V,"utf8");case 2:if(z=P.v,K=JSON.parse(z),F=K.private_key,L=K.client_email,!(!F||!L)){P.n=3;break}throw new L8("private_key and client_email are required.","MISSING_CREDENTIALS");case 3:return P.a(2,{privateKey:F,clientEmail:L});case 4:return P.n=5,P$(V,"utf8");case 5:return N=P.v,P.a(2,{privateKey:N});case 6:throw new L8("*.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");case 7:throw new L8("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE");case 8:return P.a(2)}},Y)}));function Q(Y){return $.apply(this,arguments)}return Q}()},{key:"revokeToken",value:function(Q){if(Q){j0(k0,this,C$).call(this).then(function(){return Q()},Q);return}return j0(k0,this,C$).call(this)}}])}();function j$(Z){return Z6.apply(this,arguments)}function Z6(){return Z6=W8(I0().m(function Z($){return I0().w(function(Q){while(!0)switch(Q.n){case 0:if(!(S$(T8,this)&&!$.forceRefresh)){Q.n=1;break}return Q.a(2,S$(T8,this));case 1:return Q.p=1,Q.n=2,L$(T8,this,j0(k0,this,kW).call(this,$));case 2:return Q.a(2,Q.v);case 3:return Q.p=3,L$(T8,this,void 0),Q.f(3);case 4:return Q.a(2)}},Z,this,[[1,,3,4]])})),Z6.apply(this,arguments)}function kW(Z){return $6.apply(this,arguments)}function $6(){return $6=W8(I0().m(function Z($){var Q;return I0().w(function(Y){while(!0)switch(Y.n){case 0:if(!(this.isTokenExpiring()===!1&&$.forceRefresh===!1)){Y.n=1;break}return Y.a(2,Promise.resolve(this.rawToken));case 1:if(!(!this.key&&!this.keyFile)){Y.n=2;break}throw Error("No key or keyFile set.");case 2:if(!(!this.key&&this.keyFile)){Y.n=4;break}return Y.n=3,this.getCredentials(this.keyFile);case 3:if(Q=Y.v,this.key=Q.privateKey,this.iss=Q.clientEmail||this.iss,!Q.clientEmail)j0(k0,this,yW).call(this);case 4:return Y.a(2,j0(k0,this,_W).call(this))}},Z,this)})),$6.apply(this,arguments)}function yW(){if(!this.iss)throw new L8("email is required.","MISSING_CREDENTIALS")}function C$(){return Q6.apply(this,arguments)}function Q6(){return Q6=W8(I0().m(function Z(){var $;return I0().w(function(Q){while(!0)switch(Q.n){case 0:if(this.accessToken){Q.n=1;break}throw Error("No token to revoke.");case 1:return $=fW+this.accessToken,Q.n=2,this.transporter.request({url:$,retry:!0});case 2:j0(k0,this,k$).call(this,{email:this.iss,sub:this.sub,key:this.key,keyFile:this.keyFile,scope:this.scope,additionalClaims:this.additionalClaims});case 3:return Q.a(2)}},Z,this)})),Q6.apply(this,arguments)}function k$(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.keyFile=Z.keyFile,this.key=Z.key,this.rawToken=void 0,this.iss=Z.email||Z.iss,this.sub=Z.sub,this.additionalClaims=Z.additionalClaims,m0(Z.scope)==="object")this.scope=Z.scope.join(" ");else this.scope=Z.scope;if(this.eagerRefreshThresholdMillis=Z.eagerRefreshThresholdMillis,Z.transporter)this.transporter=Z.transporter}function _W(){return Y6.apply(this,arguments)}function Y6(){return Y6=W8(I0().m(function Z(){var $,Q,Y,V,W,z,K,F,L,N;return I0().w(function(S){while(!0)switch(S.n){case 0:return $=Math.floor(new Date().getTime()/1000),Q=this.additionalClaims||{},Y=Object.assign({iss:this.iss,scope:this.scope,aud:A$,exp:$+3600,iat:$,sub:this.sub},Q),V=TW.sign({header:{alg:"RS256"},payload:Y,secret:this.key}),S.p=1,S.n=2,this.transporter.request({method:"POST",url:A$,data:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:V}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}});case 2:return W=S.v,this.rawToken=W.data,this.expiresAt=W.data.expires_in===null||W.data.expires_in===void 0?void 0:($+W.data.expires_in)*1000,S.a(2,this.rawToken);case 3:if(S.p=3,N=S.v,this.rawToken=void 0,this.tokenExpires=void 0,F=N.response&&(z=N.response)!==null&&z!==void 0&&z.data?(K=N.response)===null||K===void 0?void 0:K.data:{},F.error)L=F.error_description?": ".concat(F.error_description):"",N.message="".concat(F.error).concat(L);throw N;case 4:return S.a(2)}},Z,this,[[1,3]])})),Y6.apply(this,arguments)}});var J6=A((m$)=>{Object.defineProperty(m$,"__esModule",{value:!0});m$.JWTAccess=void 0;var xW=t1(),bW=P0(),b$={alg:"RS256",typ:"JWT"};class W6{email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new bW.LRUCache({capacity:500,maxAge:3600000});constructor(Z,$,Q,Y){this.email=Z,this.key=$,this.keyId=Q,this.eagerRefreshThresholdMillis=Y??300000}getCachedKey(Z,$){let Q=Z;if($&&Array.isArray($)&&$.length)Q=Z?`${Z}_${$.join("_")}`:`${$.join("_")}`;else if(typeof $==="string")Q=Z?`${Z}_${$}`:$;if(!Q)throw Error("Scopes or url must be provided");return Q}getRequestHeaders(Z,$,Q){let Y=this.getCachedKey(Z,Q),V=this.cache.get(Y),W=Date.now();if(V&&V.expiration-W>this.eagerRefreshThresholdMillis)return new Headers(V.headers);let z=Math.floor(Date.now()/1000),K=W6.getExpirationTime(z),F;if(Array.isArray(Q))Q=Q.join(" ");if(Q)F={iss:this.email,sub:this.email,scope:Q,exp:K,iat:z};else F={iss:this.email,sub:this.email,aud:Z,exp:K,iat:z};if($){for(let x in F)if($[x])throw Error(`The '${x}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}let L=this.keyId?{...b$,kid:this.keyId}:b$,N=Object.assign(F,$),S=xW.sign({header:L,payload:N,secret:this.key}),P=new Headers({authorization:`Bearer ${S}`});return this.cache.set(Y,{expiration:K*1000,headers:P}),P}static getExpirationTime(Z){return Z+3600}fromJSON(Z){if(!Z)throw Error("Must pass in a JSON object containing the service account auth settings.");if(!Z.client_email)throw Error("The incoming JSON object does not contain a client_email field");if(!Z.private_key)throw Error("The incoming JSON object does not contain a private_key field");this.email=Z.client_email,this.key=Z.private_key,this.keyId=Z.private_key_id,this.projectId=Z.project_id}fromStream(Z,$){if($)this.fromStreamAsync(Z).then(()=>$(),$);else return this.fromStreamAsync(Z)}fromStreamAsync(Z){return new Promise(($,Q)=>{if(!Z)Q(Error("Must pass in a stream containing the service account auth settings."));let Y="";Z.setEncoding("utf8").on("data",(V)=>Y+=V).on("error",Q).on("end",()=>{try{let V=JSON.parse(Y);this.fromJSON(V),$()}catch(V){Q(V)}})})}}m$.JWTAccess=W6});var H6=A((d$)=>{Object.defineProperty(d$,"__esModule",{value:!0});d$.JWT=void 0;var u$=x$(),mW=J6(),gW=n0(),r8=D0();class X6 extends gW.OAuth2Client{email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(Z={}){super(Z);this.email=Z.email,this.keyFile=Z.keyFile,this.key=Z.key,this.keyId=Z.keyId,this.scopes=Z.scopes,this.subject=Z.subject,this.additionalClaims=Z.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(Z){let $=new X6(this);return $.scopes=Z,$}async getRequestMetadataAsync(Z){Z=this.defaultServicePath?`https://${this.defaultServicePath}/`:Z;let $=!this.hasUserScopes()&&Z||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==r8.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==r8.DEFAULT_UNIVERSE)throw RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${r8.DEFAULT_UNIVERSE}`);if(!this.apiKey&&$)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens:Q}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${Q.id_token}`}))}}else{if(!this.access)this.access=new mW.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis);let Q;if(this.hasUserScopes())Q=this.scopes;else if(!Z)Q=this.defaultScopes;let Y=this.useJWTAccessWithScope||this.universeDomain!==r8.DEFAULT_UNIVERSE,V=await this.access.getRequestHeaders(Z??void 0,this.additionalClaims,Y?Q:void 0);return{headers:this.addSharedMetadataHeaders(V)}}else if(this.hasAnyScopes()||this.apiKey)return super.getRequestMetadataAsync(Z);else return{headers:new Headers}}async fetchIdToken(Z){let $=new u$.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:Z},transporter:this.transporter});if(await $.getToken({forceRefresh:!0}),!$.idToken)throw Error("Unknown error: Failed to fetch ID token");return $.idToken}hasUserScopes(){if(!this.scopes)return!1;return this.scopes.length>0}hasAnyScopes(){if(this.scopes&&this.scopes.length>0)return!0;if(this.defaultScopes&&this.defaultScopes.length>0)return!0;return!1}authorize(Z){if(Z)this.authorizeAsync().then(($)=>Z(null,$),Z);else return this.authorizeAsync()}async authorizeAsync(){let Z=await this.refreshToken();if(!Z)throw Error("No result returned");return this.credentials=Z.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.key,this.email=this.gtoken.iss,Z.tokens}async refreshTokenNoCache(){let Z=this.createGToken(),Q={access_token:(await Z.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:Z.expiresAt,id_token:Z.idToken};return this.emit("tokens",Q),{res:null,tokens:Q}}createGToken(){if(!this.gtoken)this.gtoken=new u$.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(Z){if(!Z)throw Error("Must pass in a JSON object containing the service account auth settings.");if(!Z.client_email)throw Error("The incoming JSON object does not contain a client_email field");if(!Z.private_key)throw Error("The incoming JSON object does not contain a private_key field");this.email=Z.client_email,this.key=Z.private_key,this.keyId=Z.private_key_id,this.projectId=Z.project_id,this.quotaProjectId=Z.quota_project_id,this.universeDomain=Z.universe_domain||this.universeDomain}fromStream(Z,$){if($)this.fromStreamAsync(Z).then(()=>$(),$);else return this.fromStreamAsync(Z)}fromStreamAsync(Z){return new Promise(($,Q)=>{if(!Z)throw Error("Must pass in a stream containing the service account auth settings.");let Y="";Z.setEncoding("utf8").on("error",Q).on("data",(V)=>Y+=V).on("end",()=>{try{let V=JSON.parse(Y);this.fromJSON(V),$()}catch(V){Q(V)}})})}fromAPIKey(Z){if(typeof Z!=="string")throw Error("Must provide an API Key string.");this.apiKey=Z}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};else if(this.keyFile){let $=await this.createGToken().getCredentials(this.keyFile);return{private_key:$.privateKey,client_email:$.clientEmail}}throw Error("A key or a keyFile must be provided to getCredentials.")}}d$.JWT=X6});var z6=A((c$)=>{Object.defineProperty(c$,"__esModule",{value:!0});c$.UserRefreshClient=c$.USER_REFRESH_ACCOUNT_TYPE=void 0;var uW=n0(),dW=D0();c$.USER_REFRESH_ACCOUNT_TYPE="authorized_user";class s8 extends uW.OAuth2Client{_refreshToken;constructor(Z,$,Q,Y,V){let W=Z&&typeof Z==="object"?Z:{clientId:Z,clientSecret:$,refreshToken:Q,eagerRefreshThresholdMillis:Y,forceRefreshOnFailure:V};super(W);this._refreshToken=W.refreshToken,this.credentials.refresh_token=W.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(Z){let $={...s8.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:Z})};return dW.AuthClient.setMethodName($,"fetchIdToken"),(await this.transporter.request($)).data.id_token}fromJSON(Z){if(!Z)throw Error("Must pass in a JSON object containing the user refresh token");if(Z.type!=="authorized_user")throw Error('The incoming JSON object does not have the "authorized_user" type');if(!Z.client_id)throw Error("The incoming JSON object does not contain a client_id field");if(!Z.client_secret)throw Error("The incoming JSON object does not contain a client_secret field");if(!Z.refresh_token)throw Error("The incoming JSON object does not contain a refresh_token field");this._clientId=Z.client_id,this._clientSecret=Z.client_secret,this._refreshToken=Z.refresh_token,this.credentials.refresh_token=Z.refresh_token,this.quotaProjectId=Z.quota_project_id,this.universeDomain=Z.universe_domain||this.universeDomain}fromStream(Z,$){if($)this.fromStreamAsync(Z).then(()=>$(),$);else return this.fromStreamAsync(Z)}async fromStreamAsync(Z){return new Promise(($,Q)=>{if(!Z)return Q(Error("Must pass in a stream containing the user refresh token."));let Y="";Z.setEncoding("utf8").on("error",Q).on("data",(V)=>Y+=V).on("end",()=>{try{let V=JSON.parse(Y);return this.fromJSON(V),$()}catch(V){return Q(V)}})})}static fromJSON(Z){let $=new s8;return $.fromJSON(Z),$}}c$.UserRefreshClient=s8});var K6=A((a$)=>{Object.defineProperty(a$,"__esModule",{value:!0});a$.Impersonated=a$.IMPERSONATED_ACCOUNT_TYPE=void 0;var i$=n0(),cW=X0(),pW=P0();a$.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";class O8 extends i$.OAuth2Client{sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(Z={}){super(Z);if(this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"},this.sourceClient=Z.sourceClient??new i$.OAuth2Client,this.targetPrincipal=Z.targetPrincipal??"",this.delegates=Z.delegates??[],this.targetScopes=Z.targetScopes??[],this.lifetime=Z.lifetime??3600,!(0,pW.originalOrCamelOptions)(Z).get("universe_domain"))this.universeDomain=this.sourceClient.universeDomain;else if(this.sourceClient.universeDomain!==this.universeDomain)throw RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`);this.endpoint=Z.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(Z){await this.sourceClient.getAccessToken();let $=`projects/-/serviceAccounts/${this.targetPrincipal}`,Q=`${this.endpoint}/v1/${$}:signBlob`,Y={delegates:this.delegates,payload:Buffer.from(Z).toString("base64")};return(await this.sourceClient.request({...O8.RETRY_CONFIG,url:Q,data:Y,method:"POST"})).data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();let Z="projects/-/serviceAccounts/"+this.targetPrincipal,$=`${this.endpoint}/v1/${Z}:generateAccessToken`,Q={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"},Y=await this.sourceClient.request({...O8.RETRY_CONFIG,url:$,data:Q,method:"POST"}),V=Y.data;return this.credentials.access_token=V.accessToken,this.credentials.expiry_date=Date.parse(V.expireTime),{tokens:this.credentials,res:Y}}catch(Z){if(!(Z instanceof Error))throw Z;let $=0,Q="";if(Z instanceof cW.GaxiosError)$=Z?.response?.data?.error?.status,Q=Z?.response?.data?.error?.message;if($&&Q)throw Z.message=`${$}: unable to impersonate: ${Q}`,Z;else throw Z.message=`unable to impersonate: ${Z}`,Z}}async fetchIdToken(Z,$){await this.sourceClient.getAccessToken();let Q=`projects/-/serviceAccounts/${this.targetPrincipal}`,Y=`${this.endpoint}/v1/${Q}:generateIdToken`,V={delegates:this.delegates,audience:Z,includeEmail:$?.includeEmail??!0,useEmailAzp:$?.includeEmail??!0};return(await this.sourceClient.request({...O8.RETRY_CONFIG,url:Y,data:V,method:"POST"})).data.token}}a$.Impersonated=O8});var q6=A((s$)=>{Object.defineProperty(s$,"__esModule",{value:!0});s$.OAuthClientAuthHandler=void 0;s$.getErrorFromOAuthErrorResponse=rW;var J8=X0(),aW=D8(),nW=["PUT","POST","PATCH"];class r${#Z=(0,aW.createCrypto)();#$;transporter;constructor(Z){if(Z&&"clientId"in Z)this.#$=Z,this.transporter=new J8.Gaxios;else this.#$=Z?.clientAuthentication,this.transporter=Z?.transporter||new J8.Gaxios}applyClientAuthenticationOptions(Z,$){if(Z.headers=J8.Gaxios.mergeHeaders(Z.headers),this.injectAuthenticatedHeaders(Z,$),!$)this.injectAuthenticatedRequestBody(Z)}injectAuthenticatedHeaders(Z,$){if($)Z.headers=J8.Gaxios.mergeHeaders(Z.headers,{authorization:`Bearer ${$}`});else if(this.#$?.confidentialClientType==="basic"){Z.headers=J8.Gaxios.mergeHeaders(Z.headers);let Q=this.#$.clientId,Y=this.#$.clientSecret||"",V=this.#Z.encodeBase64StringUtf8(`${Q}:${Y}`);J8.Gaxios.mergeHeaders(Z.headers,{authorization:`Basic ${V}`})}}injectAuthenticatedRequestBody(Z){if(this.#$?.confidentialClientType==="request-body"){let $=(Z.method||"GET").toUpperCase();if(!nW.includes($))throw Error(`${$} HTTP method does not support ${this.#$.confidentialClientType} client authentication`);let Y=new Headers(Z.headers).get("content-type");if(Y?.startsWith("application/x-www-form-urlencoded")||Z.data instanceof URLSearchParams){let V=new URLSearchParams(Z.data??"");V.append("client_id",this.#$.clientId),V.append("client_secret",this.#$.clientSecret||""),Z.data=V}else if(Y?.startsWith("application/json"))Z.data=Z.data||{},Object.assign(Z.data,{client_id:this.#$.clientId,client_secret:this.#$.clientSecret||""});else throw Error(`${Y} content-types are not supported with ${this.#$.confidentialClientType} client authentication`)}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}}s$.OAuthClientAuthHandler=r$;function rW(Z,$){let{error:Q,error_description:Y,error_uri:V}=Z,W=`Error code ${Q}`;if(typeof Y<"u")W+=`: ${Y}`;if(typeof V<"u")W+=` - ${V}`;let z=Error(W);if($){let K=Object.keys($);if($.stack)K.push("stack");K.forEach((F)=>{if(F!=="message")Object.defineProperty(z,F,{value:$[F],writable:!1,enumerable:!0})})}return z}});var o8=A((e$)=>{Object.defineProperty(e$,"__esModule",{value:!0});e$.StsCredentials=void 0;var oW=X0(),tW=D0(),t$=q6(),eW=P0();class w6 extends t$.OAuthClientAuthHandler{#Z;constructor(Z={tokenExchangeEndpoint:""},$){if(typeof Z!=="object"||Z instanceof URL)Z={tokenExchangeEndpoint:Z,clientAuthentication:$};super(Z);this.#Z=Z.tokenExchangeEndpoint}async exchangeToken(Z,$,Q){let Y={grant_type:Z.grantType,resource:Z.resource,audience:Z.audience,scope:Z.scope?.join(" "),requested_token_type:Z.requestedTokenType,subject_token:Z.subjectToken,subject_token_type:Z.subjectTokenType,actor_token:Z.actingParty?.actorToken,actor_token_type:Z.actingParty?.actorTokenType,options:Q&&JSON.stringify(Q)},V={...w6.RETRY_CONFIG,url:this.#Z.toString(),method:"POST",headers:$,data:new URLSearchParams((0,eW.removeUndefinedValuesInObject)(Y))};tW.AuthClient.setMethodName(V,"exchangeToken"),this.applyClientAuthenticationOptions(V);try{let W=await this.transporter.request(V),z=W.data;return z.res=W,z}catch(W){if(W instanceof oW.GaxiosError&&W.response)throw(0,t$.getErrorFromOAuthErrorResponse)(W.response.data,W);throw W}}}e$.StsCredentials=w6});var l0=A((Q9)=>{Object.defineProperty(Q9,"__esModule",{value:!0});Q9.BaseExternalAccountClient=Q9.CLOUD_RESOURCE_MANAGER=Q9.EXTERNAL_ACCOUNT_TYPE=Q9.EXPIRATION_TIME_OFFSET=void 0;var ZJ=X0(),$J=_("stream"),F6=D0(),QJ=o8(),$9=P0(),YJ=y1(),VJ="urn:ietf:params:oauth:grant-type:token-exchange",WJ="urn:ietf:params:oauth:token-type:access_token",U6="https://www.googleapis.com/auth/cloud-platform",JJ=3600;Q9.EXPIRATION_TIME_OFFSET=300000;Q9.EXTERNAL_ACCOUNT_TYPE="external_account";Q9.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";var XJ="//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+",HJ="https://sts.{universeDomain}/v1/token";class t8 extends F6.AuthClient{scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#Z=null;constructor(Z){super(Z);let $=(0,$9.originalOrCamelOptions)(Z),Q=$.get("type");if(Q&&Q!==Q9.EXTERNAL_ACCOUNT_TYPE)throw Error(`Expected "${Q9.EXTERNAL_ACCOUNT_TYPE}" type but received "${Z.type}"`);let Y=$.get("client_id"),V=$.get("client_secret");this.tokenUrl=$.get("token_url")??HJ.replace("{universeDomain}",this.universeDomain);let W=$.get("subject_token_type"),z=$.get("workforce_pool_user_project"),K=$.get("service_account_impersonation_url"),F=$.get("service_account_impersonation"),L=(0,$9.originalOrCamelOptions)(F).get("token_lifetime_seconds");if(this.cloudResourceManagerURL=new URL($.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`),Y)this.clientAuth={confidentialClientType:"basic",clientId:Y,clientSecret:V};this.stsCredential=new QJ.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth}),this.scopes=$.get("scopes")||[U6],this.cachedAccessToken=null,this.audience=$.get("audience"),this.subjectTokenType=W,this.workforcePoolUserProject=z;let N=new RegExp(XJ);if(this.workforcePoolUserProject&&!this.audience.match(N))throw Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");if(this.serviceAccountImpersonationUrl=K,this.serviceAccountImpersonationLifetime=L,this.serviceAccountImpersonationLifetime)this.configLifetimeRequested=!0;else this.configLifetimeRequested=!1,this.serviceAccountImpersonationLifetime=JJ;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 RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);return/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/.exec(this.serviceAccountImpersonationUrl)?.groups?.email||null}return null}setCredentials(Z){super.setCredentials(Z),this.cachedAccessToken=Z}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))await this.refreshAccessTokenAsync();return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let Z=await this.getAccessToken(),$=new Headers({authorization:`Bearer ${Z.token}`});return this.addSharedMetadataHeaders($)}request(Z,$){if($)this.requestAsync(Z).then((Q)=>$(null,Q),(Q)=>{return $(Q,Q.response)});else return this.requestAsync(Z)}async getProjectId(){let Z=this.projectNumber||this.workforcePoolUserProject;if(this.projectId)return this.projectId;else if(Z){let $=await this.getRequestHeaders(),Q={...t8.RETRY_CONFIG,headers:$,url:`${this.cloudResourceManagerURL.toString()}${Z}`};F6.AuthClient.setMethodName(Q,"getProjectId");let Y=await this.transporter.request(Q);return this.projectId=Y.data.projectId,this.projectId}return null}async requestAsync(Z,$=!1){let Q;try{let Y=await this.getRequestHeaders();Z.headers=ZJ.Gaxios.mergeHeaders(Z.headers),this.addUserProjectAndAuthHeaders(Z.headers,Y),Q=await this.transporter.request(Z)}catch(Y){let V=Y.response;if(V){let W=V.status,z=V.config.data instanceof $J.Readable;if(!$&&(W===401||W===403)&&!z&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(Z,!0)}throw Y}return Q}async refreshAccessTokenAsync(){this.#Z=this.#Z||this.#$();try{return await this.#Z}finally{this.#Z=null}}async#$(){let Z=await this.retrieveSubjectToken(),$={grantType:VJ,audience:this.audience,requestedTokenType:WJ,subjectToken:Z,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[U6]:this.getScopesArray()},Q=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0,Y=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()}),V=await this.stsCredential.exchangeToken($,Y,Q);if(this.serviceAccountImpersonationUrl)this.cachedAccessToken=await this.getImpersonatedAccessToken(V.access_token);else if(V.expires_in)this.cachedAccessToken={access_token:V.access_token,expiry_date:new Date().getTime()+V.expires_in*1000,res:V.res};else this.cachedAccessToken={access_token:V.access_token,res:V.res};return 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}),this.cachedAccessToken}getProjectNumber(Z){let $=Z.match(/\/projects\/([^/]+)/);if(!$)return null;return $[1]}async getImpersonatedAccessToken(Z){let $={...t8.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${Z}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"}};F6.AuthClient.setMethodName($,"getImpersonatedAccessToken");let Q=await this.transporter.request($),Y=Q.data;return{access_token:Y.accessToken,expiry_date:new Date(Y.expireTime).getTime(),res:Q}}isExpired(Z){let $=new Date().getTime();return Z.expiry_date?$>=Z.expiry_date-this.eagerRefreshThresholdMillis:!1}getScopesArray(){if(typeof this.scopes==="string")return[this.scopes];return this.scopes||[U6]}getMetricsHeaderValue(){let Z=process.version.replace(/^v/,""),$=this.serviceAccountImpersonationUrl!==void 0,Q=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${Z} auth/${YJ.pkg.version} google-byoid-sdk source/${Q} sa-impersonation/${$} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}}Q9.BaseExternalAccountClient=t8});var X9=A((W9)=>{Object.defineProperty(W9,"__esModule",{value:!0});W9.FileSubjectTokenSupplier=void 0;var M6=_("util"),G6=_("fs"),qJ=(0,M6.promisify)(G6.readFile??(()=>{})),wJ=(0,M6.promisify)(G6.realpath??(()=>{})),FJ=(0,M6.promisify)(G6.lstat??(()=>{}));class V9{filePath;formatType;subjectTokenFieldName;constructor(Z){this.filePath=Z.filePath,this.formatType=Z.formatType,this.subjectTokenFieldName=Z.subjectTokenFieldName}async getSubjectToken(){let Z=this.filePath;try{if(Z=await wJ(Z),!(await FJ(Z)).isFile())throw Error()}catch(Y){if(Y instanceof Error)Y.message=`The file at ${Z} does not exist, or it is not a file. ${Y.message}`;throw Y}let $,Q=await qJ(Z,{encoding:"utf8"});if(this.formatType==="text")$=Q;else if(this.formatType==="json"&&this.subjectTokenFieldName)$=JSON.parse(Q)[this.subjectTokenFieldName];if(!$)throw Error("Unable to parse the subject_token from the credential_source file");return $}}W9.FileSubjectTokenSupplier=V9});var q9=A((z9)=>{Object.defineProperty(z9,"__esModule",{value:!0});z9.UrlSubjectTokenSupplier=void 0;var UJ=D0();class H9{url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(Z){this.url=Z.url,this.formatType=Z.formatType,this.subjectTokenFieldName=Z.subjectTokenFieldName,this.headers=Z.headers,this.additionalGaxiosOptions=Z.additionalGaxiosOptions}async getSubjectToken(Z){let $={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers};UJ.AuthClient.setMethodName($,"getSubjectToken");let Q;if(this.formatType==="text")Q=(await Z.transporter.request($)).data;else if(this.formatType==="json"&&this.subjectTokenFieldName)Q=(await Z.transporter.request($)).data[this.subjectTokenFieldName];if(!Q)throw Error("Unable to parse the subject_token from the credential_source URL");return Q}}z9.UrlSubjectTokenSupplier=H9});var D9=A((F9)=>{Object.defineProperty(F9,"__esModule",{value:!0});F9.CertificateSubjectTokenSupplier=F9.InvalidConfigurationError=F9.CertificateSourceUnavailableError=F9.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;var e8=P0(),Z1=_("fs"),$1=_("crypto"),DJ=_("https");F9.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";class g0 extends Error{constructor(Z){super(Z);this.name="CertificateSourceUnavailableError"}}F9.CertificateSourceUnavailableError=g0;class C0 extends Error{constructor(Z){super(Z);this.name="InvalidConfigurationError"}}F9.InvalidConfigurationError=C0;class w9{certificateConfigPath;trustChainPath;cert;key;constructor(Z){if(!Z.useDefaultCertificateConfig&&!Z.certificateConfigLocation)throw new C0("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(Z.useDefaultCertificateConfig&&Z.certificateConfigLocation)throw new C0("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=Z.trustChainPath,this.certificateConfigPath=Z.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new C0("Cannot create mTLS Agent with missing certificate or key");return new DJ.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#Z();let{certPath:Z,keyPath:$}=await this.#$();return{cert:this.cert,key:this.key}=await this.#Q(Z,$),await this.#Y(this.cert)}async#Z(){let Z=this.certificateConfigPath;if(Z){if(await(0,e8.isValidFile)(Z))return Z;throw new g0(`Provided certificate config path is invalid: ${Z}`)}let $=process.env[F9.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if($){if(await(0,e8.isValidFile)($))return $;throw new g0(`Path from environment variable "${F9.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${$}`)}let Q=(0,e8.getWellKnownCertificateConfigFileLocation)();if(await(0,e8.isValidFile)(Q))return Q;throw new g0(`Could not find certificate configuration file. Searched override path, the "${F9.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${Q}).`)}async#$(){let Z=this.certificateConfigPath,$;try{$=await Z1.promises.readFile(Z,"utf8")}catch(Q){throw new g0(`Failed to read certificate config file at: ${Z}`)}try{let Q=JSON.parse($),Y=Q?.cert_configs?.workload?.cert_path,V=Q?.cert_configs?.workload?.key_path;if(!Y||!V)throw new C0(`Certificate config file (${Z}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:Y,keyPath:V}}catch(Q){if(Q instanceof C0)throw Q;throw new C0(`Failed to parse certificate config from ${Z}: ${Q.message}`)}}async#Q(Z,$){let Q,Y;try{Q=await Z1.promises.readFile(Z),new $1.X509Certificate(Q)}catch(V){let W=V instanceof Error?V.message:String(V);throw new g0(`Failed to read certificate file at ${Z}: ${W}`)}try{Y=await Z1.promises.readFile($),(0,$1.createPrivateKey)(Y)}catch(V){let W=V instanceof Error?V.message:String(V);throw new g0(`Failed to read private key file at ${$}: ${W}`)}return{cert:Q,key:Y}}async#Y(Z){let $=new $1.X509Certificate(Z);if(!this.trustChainPath)return JSON.stringify([$.raw.toString("base64")]);try{let V=((await Z1.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((K,F)=>{try{return new $1.X509Certificate(K)}catch(L){let N=L instanceof Error?L.message:String(L);throw new C0(`Failed to parse certificate at index ${F} in trust chain file ${this.trustChainPath}: ${N}`)}}),W=V.findIndex((K)=>$.raw.equals(K.raw)),z;if(W===-1)z=[$,...V];else if(W===0)z=V;else throw new C0(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${W}).`);return JSON.stringify(z.map((K)=>K.raw.toString("base64")))}catch(Q){if(Q instanceof C0)throw Q;let Y=Q instanceof Error?Q.message:String(Q);throw new g0(`Failed to process certificate chain from ${this.trustChainPath}: ${Y}`)}}}F9.CertificateSubjectTokenSupplier=w9});var N6=A((I9)=>{Object.defineProperty(I9,"__esModule",{value:!0});I9.IdentityPoolClient=void 0;var IJ=l0(),I6=P0(),RJ=X9(),NJ=q9(),M9=D9(),TJ=o8(),G9=X0();class R6 extends IJ.BaseExternalAccountClient{subjectTokenSupplier;constructor(Z){super(Z);let $=(0,I6.originalOrCamelOptions)(Z),Q=$.get("credential_source"),Y=$.get("subject_token_supplier");if(!Q&&!Y)throw Error("A credential source or subject token supplier must be specified.");if(Q&&Y)throw Error("Only one of credential source or subject token supplier can be specified.");if(Y)this.subjectTokenSupplier=Y,this.credentialSourceType="programmatic";else{let V=(0,I6.originalOrCamelOptions)(Q),W=(0,I6.originalOrCamelOptions)(V.get("format")),z=W.get("type")||"text",K=W.get("subject_token_field_name");if(z!=="json"&&z!=="text")throw Error(`Invalid credential_source format "${z}"`);if(z==="json"&&!K)throw Error("Missing subject_token_field_name for JSON credential_source format");let F=V.get("file"),L=V.get("url"),N=V.get("certificate"),S=V.get("headers");if(F&&L||L&&N||F&&N)throw Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');else if(F)this.credentialSourceType="file",this.subjectTokenSupplier=new RJ.FileSubjectTokenSupplier({filePath:F,formatType:z,subjectTokenFieldName:K});else if(L)this.credentialSourceType="url",this.subjectTokenSupplier=new NJ.UrlSubjectTokenSupplier({url:L,formatType:z,subjectTokenFieldName:K,headers:S,additionalGaxiosOptions:R6.RETRY_CONFIG});else if(N){this.credentialSourceType="certificate";let P=new M9.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:N.use_default_certificate_config,certificateConfigLocation:N.certificate_config_location,trustChainPath:N.trust_chain_path});this.subjectTokenSupplier=P}else throw Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}async retrieveSubjectToken(){let Z=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof M9.CertificateSubjectTokenSupplier){let $=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new TJ.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new G9.Gaxios({agent:$})}),this.transporter=new G9.Gaxios({...this.transporter.defaults||{},agent:$})}return Z}}I9.IdentityPoolClient=R6});var T6=A((S9)=>{Object.defineProperty(S9,"__esModule",{value:!0});S9.AwsRequestSigner=void 0;var Y1=X0(),T9=D8(),N9="AWS4-HMAC-SHA256",LJ="aws4_request";class L9{getCredentials;region;crypto;constructor(Z,$){this.getCredentials=Z,this.region=$,this.crypto=(0,T9.createCrypto)()}async getRequestOptions(Z){if(!Z.url)throw RangeError('"url" is required in "amzOptions"');let $=typeof Z.data==="object"?JSON.stringify(Z.data):Z.data,Q=Z.url,Y=Z.method||"GET",V=Z.body||$,W=Z.headers,z=await this.getCredentials(),K=new URL(Q);if(typeof V!=="string"&&V!==void 0)throw TypeError(`'requestPayload' is expected to be a string if provided. Got: ${V}`);let F=await BJ({crypto:this.crypto,host:K.host,canonicalUri:K.pathname,canonicalQuerystring:K.search.slice(1),method:Y,region:this.region,securityCredentials:z,requestPayload:V,additionalAmzHeaders:W}),L=Y1.Gaxios.mergeHeaders(F.amzDate?{"x-amz-date":F.amzDate}:{},{authorization:F.authorizationHeader,host:K.host},W||{});if(z.token)Y1.Gaxios.mergeHeaders(L,{"x-amz-security-token":z.token});let N={url:Q,method:Y,headers:L};if(V!==void 0)N.body=V;return N}}S9.AwsRequestSigner=L9;async function P8(Z,$,Q){return await Z.signWithHmacSha256($,Q)}async function SJ(Z,$,Q,Y,V){let W=await P8(Z,`AWS4${$}`,Q),z=await P8(Z,W,Y),K=await P8(Z,z,V);return await P8(Z,K,"aws4_request")}async function BJ(Z){let $=Y1.Gaxios.mergeHeaders(Z.additionalAmzHeaders),Q=Z.requestPayload||"",Y=Z.host.split(".")[0],V=new Date,W=V.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,""),z=V.toISOString().replace(/[-]/g,"").replace(/T.*/,"");if(Z.securityCredentials.token)$.set("x-amz-security-token",Z.securityCredentials.token);let K=Y1.Gaxios.mergeHeaders({host:Z.host},$.has("date")?{}:{"x-amz-date":W},$),F="",L=[...K.keys()].sort();L.forEach((p)=>{F+=`${p}:${K.get(p)}
|
|
17
|
+
`});let N=L.join(";"),S=await Z.crypto.sha256DigestHex(Q),P=`${Z.method.toUpperCase()}
|
|
18
|
+
${Z.canonicalUri}
|
|
19
|
+
${Z.canonicalQuerystring}
|
|
20
|
+
${F}
|
|
21
|
+
${N}
|
|
22
|
+
${S}`,x=`${z}/${Z.region}/${Y}/${LJ}`,u=`${N9}
|
|
23
|
+
${W}
|
|
24
|
+
${x}
|
|
25
|
+
`+await Z.crypto.sha256DigestHex(P),C=await SJ(Z.crypto,Z.securityCredentials.secretAccessKey,z,Z.region,Y),f=await P8(Z.crypto,C,u),j=`${N9} Credential=${Z.securityCredentials.accessKeyId}/${x}, SignedHeaders=${N}, Signature=${(0,T9.fromArrayBufferToHex)(f)}`;return{amzDate:$.has("date")?void 0:W,authorizationHeader:j,canonicalQuerystring:Z.canonicalQuerystring}}});var j9=A((P9)=>{Object.defineProperty(P9,"__esModule",{value:!0});P9.DefaultAwsSecurityCredentialsSupplier=void 0;var V1=D0();class O9{regionUrl;securityCredentialsUrl;imdsV2SessionTokenUrl;additionalGaxiosOptions;constructor(Z){this.regionUrl=Z.regionUrl,this.securityCredentialsUrl=Z.securityCredentialsUrl,this.imdsV2SessionTokenUrl=Z.imdsV2SessionTokenUrl,this.additionalGaxiosOptions=Z.additionalGaxiosOptions}async getAwsRegion(Z){if(this.#Y)return this.#Y;let $=new Headers;if(!this.#Y&&this.imdsV2SessionTokenUrl)$.set("x-aws-ec2-metadata-token",await this.#Z(Z.transporter));if(!this.regionUrl)throw RangeError('Unable to determine AWS region due to missing "options.credential_source.region_url"');let Q={...this.additionalGaxiosOptions,url:this.regionUrl,method:"GET",headers:$};V1.AuthClient.setMethodName(Q,"getAwsRegion");let Y=await Z.transporter.request(Q);return Y.data.substr(0,Y.data.length-1)}async getAwsSecurityCredentials(Z){if(this.#V)return this.#V;let $=new Headers;if(this.imdsV2SessionTokenUrl)$.set("x-aws-ec2-metadata-token",await this.#Z(Z.transporter));let Q=await this.#$($,Z.transporter),Y=await this.#Q(Q,$,Z.transporter);return{accessKeyId:Y.AccessKeyId,secretAccessKey:Y.SecretAccessKey,token:Y.Token}}async#Z(Z){let $={...this.additionalGaxiosOptions,url:this.imdsV2SessionTokenUrl,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};return V1.AuthClient.setMethodName($,"#getImdsV2SessionToken"),(await Z.request($)).data}async#$(Z,$){if(!this.securityCredentialsUrl)throw Error('Unable to determine AWS role name due to missing "options.credential_source.url"');let Q={...this.additionalGaxiosOptions,url:this.securityCredentialsUrl,method:"GET",headers:Z};return V1.AuthClient.setMethodName(Q,"#getAwsRoleName"),(await $.request(Q)).data}async#Q(Z,$,Q){let Y={...this.additionalGaxiosOptions,url:`${this.securityCredentialsUrl}/${Z}`,headers:$};return V1.AuthClient.setMethodName(Y,"#retrieveAwsSecurityCredentials"),(await Q.request(Y)).data}get#Y(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||null}get#V(){if(process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY)return{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,token:process.env.AWS_SESSION_TOKEN};return null}}P9.DefaultAwsSecurityCredentialsSupplier=O9});var L6=A((v9)=>{Object.defineProperty(v9,"__esModule",{value:!0});v9.AwsClient=void 0;var OJ=T6(),PJ=l0(),AJ=j9(),C9=P0(),jJ=X0();class W1 extends PJ.BaseExternalAccountClient{environmentId;awsSecurityCredentialsSupplier;regionalCredVerificationUrl;awsRequestSigner;region;static#Z="https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15";static AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";static AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254";constructor(Z){super(Z);let $=(0,C9.originalOrCamelOptions)(Z),Q=$.get("credential_source"),Y=$.get("aws_security_credentials_supplier");if(!Q&&!Y)throw Error("A credential source or AWS security credentials supplier must be specified.");if(Q&&Y)throw Error("Only one of credential source or AWS security credentials supplier can be specified.");if(Y)this.awsSecurityCredentialsSupplier=Y,this.regionalCredVerificationUrl=W1.#Z,this.credentialSourceType="programmatic";else{let V=(0,C9.originalOrCamelOptions)(Q);this.environmentId=V.get("environment_id");let W=V.get("region_url"),z=V.get("url"),K=V.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new AJ.DefaultAwsSecurityCredentialsSupplier({regionUrl:W,securityCredentialsUrl:z,imdsV2SessionTokenUrl:K}),this.regionalCredVerificationUrl=V.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){let Z=this.environmentId?.match(/^(aws)(\d+)$/);if(!Z||!this.regionalCredVerificationUrl)throw Error('No valid AWS "credential_source" provided');else if(parseInt(Z[2],10)!==1)throw Error(`aws version "${Z[2]}" is not supported in the current build.`)}async retrieveSubjectToken(){if(!this.awsRequestSigner)this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new OJ.AwsRequestSigner(async()=>{return this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext)},this.region);let Z=await this.awsRequestSigner.getRequestOptions({...W1.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),$=[];return jJ.Gaxios.mergeHeaders({"x-goog-cloud-target-resource":this.audience},Z.headers).forEach((Y,V)=>$.push({key:V,value:Y})),encodeURIComponent(JSON.stringify({url:Z.url,method:Z.method,headers:$}))}}v9.AwsClient=W1});var v6=A((k9)=>{Object.defineProperty(k9,"__esModule",{value:!0});k9.InvalidSubjectTokenError=k9.InvalidMessageFieldError=k9.InvalidCodeFieldError=k9.InvalidTokenTypeFieldError=k9.InvalidExpirationTimeFieldError=k9.InvalidSuccessFieldError=k9.InvalidVersionFieldError=k9.ExecutableResponseError=k9.ExecutableResponse=void 0;var J1="urn:ietf:params:oauth:token-type:saml2",S6="urn:ietf:params:oauth:token-type:id_token",B6="urn:ietf:params:oauth:token-type:jwt";class h9{version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(Z){if(!Z.version)throw new O6("Executable response must contain a 'version' field.");if(Z.success===void 0)throw new P6("Executable response must contain a 'success' field.");if(this.version=Z.version,this.success=Z.success,this.success){if(this.expirationTime=Z.expiration_time,this.tokenType=Z.token_type,this.tokenType!==J1&&this.tokenType!==S6&&this.tokenType!==B6)throw new A6(`Executable response must contain a 'token_type' field when successful and it must be one of ${S6}, ${B6}, or ${J1}.`);if(this.tokenType===J1){if(!Z.saml_response)throw new X1(`Executable response must contain a 'saml_response' field when token_type=${J1}.`);this.subjectToken=Z.saml_response}else{if(!Z.id_token)throw new X1(`Executable response must contain a 'id_token' field when token_type=${S6} or ${B6}.`);this.subjectToken=Z.id_token}}else{if(!Z.code)throw new j6("Executable response must contain a 'code' field when unsuccessful.");if(!Z.message)throw new C6("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=Z.code,this.errorMessage=Z.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1000)}}k9.ExecutableResponse=h9;class u0 extends Error{constructor(Z){super(Z);Object.setPrototypeOf(this,new.target.prototype)}}k9.ExecutableResponseError=u0;class O6 extends u0{}k9.InvalidVersionFieldError=O6;class P6 extends u0{}k9.InvalidSuccessFieldError=P6;class f9 extends u0{}k9.InvalidExpirationTimeFieldError=f9;class A6 extends u0{}k9.InvalidTokenTypeFieldError=A6;class j6 extends u0{}k9.InvalidCodeFieldError=j6;class C6 extends u0{}k9.InvalidMessageFieldError=C6;class X1 extends u0{}k9.InvalidSubjectTokenError=X1});var k6=A((_9)=>{Object.defineProperty(_9,"__esModule",{value:!0});_9.PluggableAuthHandler=_9.ExecutableError=void 0;var r0=v6(),xJ=_("child_process"),E6=_("fs");class h6 extends Error{code;constructor(Z,$){super(`The executable failed with exit code: ${$} and error message: ${Z}.`);this.code=$,Object.setPrototypeOf(this,new.target.prototype)}}_9.ExecutableError=h6;class f6{commandComponents;timeoutMillis;outputFile;constructor(Z){if(!Z.command)throw Error("No command provided.");if(this.commandComponents=f6.parseCommand(Z.command),this.timeoutMillis=Z.timeoutMillis,!this.timeoutMillis)throw Error("No timeoutMillis provided.");this.outputFile=Z.outputFile}retrieveResponseFromExecutable(Z){return new Promise(($,Q)=>{let Y=xJ.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(Z)}}),V="";Y.stdout.on("data",(z)=>{V+=z}),Y.stderr.on("data",(z)=>{V+=z});let W=setTimeout(()=>{return Y.removeAllListeners(),Y.kill(),Q(Error("The executable failed to finish within the timeout specified."))},this.timeoutMillis);Y.on("close",(z)=>{if(clearTimeout(W),z===0)try{let K=JSON.parse(V),F=new r0.ExecutableResponse(K);return $(F)}catch(K){if(K instanceof r0.ExecutableResponseError)return Q(K);return Q(new r0.ExecutableResponseError(`The executable returned an invalid response: ${V}`))}else return Q(new h6(V,z.toString()))})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0)return;let Z;try{Z=await E6.promises.realpath(this.outputFile)}catch{return}if(!(await E6.promises.lstat(Z)).isFile())return;let $=await E6.promises.readFile(Z,{encoding:"utf8"});if($==="")return;try{let Q=JSON.parse($);if(new r0.ExecutableResponse(Q).isValid())return new r0.ExecutableResponse(Q);return}catch(Q){if(Q instanceof r0.ExecutableResponseError)throw Q;throw new r0.ExecutableResponseError(`The output file contained an invalid response: ${$}`)}}static parseCommand(Z){let $=Z.match(/(?:[^\s"]+|"[^"]*")+/g);if(!$)throw Error(`Provided command: "${Z}" could not be parsed.`);for(let Q=0;Q<$.length;Q++)if($[Q][0]==='"'&&$[Q].slice(-1)==='"')$[Q]=$[Q].slice(1,-1);return $}}_9.PluggableAuthHandler=f6});var _6=A((y6)=>{Object.defineProperty(y6,"__esModule",{value:!0});y6.PluggableAuthClient=y6.ExecutableError=void 0;var mJ=l0(),gJ=v6(),b9=k6(),uJ=k6();Object.defineProperty(y6,"ExecutableError",{enumerable:!0,get:function(){return uJ.ExecutableError}});var dJ=30000,m9=5000,g9=120000,lJ="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES",u9=1;class d9 extends mJ.BaseExternalAccountClient{command;timeoutMillis;outputFile;handler;constructor(Z){super(Z);if(!Z.credential_source.executable)throw Error('No valid Pluggable Auth "credential_source" provided.');if(this.command=Z.credential_source.executable.command,!this.command)throw Error('No valid Pluggable Auth "credential_source" provided.');if(Z.credential_source.executable.timeout_millis===void 0)this.timeoutMillis=dJ;else if(this.timeoutMillis=Z.credential_source.executable.timeout_millis,this.timeoutMillis<m9||this.timeoutMillis>g9)throw Error(`Timeout must be between ${m9} and ${g9} milliseconds.`);this.outputFile=Z.credential_source.executable.output_file,this.handler=new b9.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile}),this.credentialSourceType="executable"}async retrieveSubjectToken(){if(process.env[lJ]!=="1")throw Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.");let Z=void 0;if(this.outputFile)Z=await this.handler.retrieveCachedResponse();if(!Z){let $=new Map;if($.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience),$.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType),$.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0"),this.outputFile)$.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile);let Q=this.getServiceAccountEmail();if(Q)$.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",Q);Z=await this.handler.retrieveResponseFromExecutable($)}if(Z.version>u9)throw Error(`Version of executable is not currently supported, maximum supported version is ${u9}.`);if(!Z.success)throw new b9.ExecutableError(Z.errorMessage,Z.errorCode);if(this.outputFile){if(!Z.expirationTime)throw new gJ.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.")}if(Z.isExpired())throw Error("Executable response is expired.");return Z.subjectToken}}y6.PluggableAuthClient=d9});var x6=A((p9)=>{Object.defineProperty(p9,"__esModule",{value:!0});p9.ExternalAccountClient=void 0;var cJ=l0(),pJ=N6(),iJ=L6(),aJ=_6();class c9{constructor(){throw Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(Z){if(Z&&Z.type===cJ.EXTERNAL_ACCOUNT_TYPE)if(Z.credential_source?.environment_id)return new iJ.AwsClient(Z);else if(Z.credential_source?.executable)return new aJ.PluggableAuthClient(Z);else return new pJ.IdentityPoolClient(Z);else return null}}p9.ExternalAccountClient=c9});var m6=A((o9)=>{Object.defineProperty(o9,"__esModule",{value:!0});o9.ExternalAccountAuthorizedUserClient=o9.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var n9=D0(),a9=q6(),r9=X0(),nJ=_("stream"),rJ=l0();o9.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var sJ="https://sts.{universeDomain}/v1/oauthtoken";class b6 extends a9.OAuthClientAuthHandler{#Z;constructor(Z){super(Z);this.#Z=Z.tokenRefreshEndpoint}async refreshToken(Z,$){let Q={...b6.RETRY_CONFIG,url:this.#Z,method:"POST",headers:$,data:new URLSearchParams({grant_type:"refresh_token",refresh_token:Z})};n9.AuthClient.setMethodName(Q,"refreshToken"),this.applyClientAuthenticationOptions(Q);try{let Y=await this.transporter.request(Q),V=Y.data;return V.res=Y,V}catch(Y){if(Y instanceof r9.GaxiosError&&Y.response)throw(0,a9.getErrorFromOAuthErrorResponse)(Y.response.data,Y);throw Y}}}class s9 extends n9.AuthClient{cachedAccessToken;externalAccountAuthorizedUserHandler;refreshToken;constructor(Z){super(Z);if(Z.universe_domain)this.universeDomain=Z.universe_domain;this.refreshToken=Z.refresh_token;let $={confidentialClientType:"basic",clientId:Z.client_id,clientSecret:Z.client_secret};if(this.externalAccountAuthorizedUserHandler=new b6({tokenRefreshEndpoint:Z.token_url??sJ.replace("{universeDomain}",this.universeDomain),transporter:this.transporter,clientAuthentication:$}),this.cachedAccessToken=null,this.quotaProjectId=Z.quota_project_id,typeof Z?.eagerRefreshThresholdMillis!=="number")this.eagerRefreshThresholdMillis=rJ.EXPIRATION_TIME_OFFSET;else this.eagerRefreshThresholdMillis=Z.eagerRefreshThresholdMillis;this.forceRefreshOnFailure=!!Z?.forceRefreshOnFailure}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))await this.refreshAccessTokenAsync();return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let Z=await this.getAccessToken(),$=new Headers({authorization:`Bearer ${Z.token}`});return this.addSharedMetadataHeaders($)}request(Z,$){if($)this.requestAsync(Z).then((Q)=>$(null,Q),(Q)=>{return $(Q,Q.response)});else return this.requestAsync(Z)}async requestAsync(Z,$=!1){let Q;try{let Y=await this.getRequestHeaders();Z.headers=r9.Gaxios.mergeHeaders(Z.headers),this.addUserProjectAndAuthHeaders(Z.headers,Y),Q=await this.transporter.request(Z)}catch(Y){let V=Y.response;if(V){let W=V.status,z=V.config.data instanceof nJ.Readable;if(!$&&(W===401||W===403)&&!z&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(Z,!0)}throw Y}return Q}async refreshAccessTokenAsync(){let Z=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);if(this.cachedAccessToken={access_token:Z.access_token,expiry_date:new Date().getTime()+Z.expires_in*1000,res:Z.res},Z.refresh_token!==void 0)this.refreshToken=Z.refresh_token;return this.cachedAccessToken}isExpired(Z){let $=new Date().getTime();return Z.expiry_date?$>=Z.expiry_date-this.eagerRefreshThresholdMillis:!1}}o9.ExternalAccountAuthorizedUserClient=s9});var WQ=A((YQ)=>{Object.defineProperty(YQ,"__esModule",{value:!0});YQ.GoogleAuth=YQ.GoogleAuthExceptionMessages=void 0;var tJ=_("child_process"),A8=_("fs"),eJ=X0(),j8=U8(),Z5=_("os"),g6=_("path"),$5=D8(),Q5=u1(),Y5=d1(),V5=l1(),X8=H6(),e9=z6(),H8=K6(),W5=x6(),C8=l0(),u6=D0(),ZQ=m6(),$Q=P0();YQ.GoogleAuthExceptionMessages={API_KEY_WITH_CREDENTIALS:"API Keys and Credentials are mutually exclusive authentication methods and cannot be used together.",NO_PROJECT_ID_FOUND:`Unable to detect a Project Id in the current environment.
|
|
26
|
+
To learn more about authentication and Google APIs, visit:
|
|
27
|
+
https://cloud.google.com/docs/authentication/getting-started`,NO_CREDENTIALS_FOUND:`Unable to find credentials in current environment.
|
|
28
|
+
To learn more about authentication and Google APIs, visit:
|
|
29
|
+
https://cloud.google.com/docs/authentication/getting-started`,NO_ADC_FOUND:"Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.",NO_UNIVERSE_DOMAIN_FOUND:`Unable to detect a Universe Domain in the current environment.
|
|
30
|
+
To learn more about Universe Domain retrieval, visit:
|
|
31
|
+
https://cloud.google.com/compute/docs/metadata/predefined-metadata-keys`};class QQ{checkIsGCE=void 0;useJWTAccessWithScope;defaultServicePath;get isGCE(){return this.checkIsGCE}_findProjectIdPromise;_cachedProjectId;jsonContent=null;apiKey;cachedCredential=null;#Z=null;defaultScopes;keyFilename;scopes;clientOptions={};constructor(Z={}){if(this._cachedProjectId=Z.projectId||null,this.cachedCredential=Z.authClient||null,this.keyFilename=Z.keyFilename||Z.keyFile,this.scopes=Z.scopes,this.clientOptions=Z.clientOptions||{},this.jsonContent=Z.credentials||null,this.apiKey=Z.apiKey||this.clientOptions.apiKey||null,this.apiKey&&(this.jsonContent||this.clientOptions.credentials))throw RangeError(YQ.GoogleAuthExceptionMessages.API_KEY_WITH_CREDENTIALS);if(Z.universeDomain)this.clientOptions.universeDomain=Z.universeDomain}setGapicJWTValues(Z){Z.defaultServicePath=this.defaultServicePath,Z.useJWTAccessWithScope=this.useJWTAccessWithScope,Z.defaultScopes=this.defaultScopes}getProjectId(Z){if(Z)this.getProjectIdAsync().then(($)=>Z(null,$),Z);else return this.getProjectIdAsync()}async getProjectIdOptional(){try{return await this.getProjectId()}catch(Z){if(Z instanceof Error&&Z.message===YQ.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;else throw Z}}async findAndCacheProjectId(){let Z=null;if(Z||=await this.getProductionProjectId(),Z||=await this.getFileProjectId(),Z||=await this.getDefaultServiceProjectId(),Z||=await this.getGCEProjectId(),Z||=await this.getExternalAccountClientProjectId(),Z)return this._cachedProjectId=Z,Z;else throw Error(YQ.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)}async getProjectIdAsync(){if(this._cachedProjectId)return this._cachedProjectId;if(!this._findProjectIdPromise)this._findProjectIdPromise=this.findAndCacheProjectId();return this._findProjectIdPromise}async getUniverseDomainFromMetadataServer(){let Z;try{Z=await j8.universe("universe-domain"),Z||=u6.DEFAULT_UNIVERSE}catch($){if($&&$?.response?.status===404)Z=u6.DEFAULT_UNIVERSE;else throw $}return Z}async getUniverseDomain(){let Z=(0,$Q.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{Z??=(await this.getClient()).universeDomain}catch{Z??=u6.DEFAULT_UNIVERSE}return Z}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(Z={},$){let Q;if(typeof Z==="function")$=Z;else Q=Z;if($)this.getApplicationDefaultAsync(Q).then((Y)=>$(null,Y.credential,Y.projectId),$);else return this.getApplicationDefaultAsync(Q)}async getApplicationDefaultAsync(Z={}){if(this.cachedCredential)return await this.#$(this.cachedCredential,null);let $;if($=await this._tryGetApplicationCredentialsFromEnvironmentVariable(Z),$){if($ instanceof X8.JWT)$.scopes=this.scopes;else if($ instanceof C8.BaseExternalAccountClient)$.scopes=this.getAnyScopes();return await this.#$($)}if($=await this._tryGetApplicationCredentialsFromWellKnownFile(Z),$){if($ instanceof X8.JWT)$.scopes=this.scopes;else if($ instanceof C8.BaseExternalAccountClient)$.scopes=this.getAnyScopes();return await this.#$($)}if(await this._checkIsGCE())return Z.scopes=this.getAnyScopes(),await this.#$(new Q5.Compute(Z));throw Error(YQ.GoogleAuthExceptionMessages.NO_ADC_FOUND)}async#$(Z,$=process.env.GOOGLE_CLOUD_QUOTA_PROJECT||null){let Q=await this.getProjectIdOptional();if($)Z.quotaProjectId=$;return this.cachedCredential=Z,{credential:Z,projectId:Q}}async _checkIsGCE(){if(this.checkIsGCE===void 0)this.checkIsGCE=j8.getGCPResidency()||await j8.isAvailable();return this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(Z){let $=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!$||$.length===0)return null;try{return this._getApplicationCredentialsFromFilePath($,Z)}catch(Q){if(Q instanceof Error)Q.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${Q.message}`;throw Q}}async _tryGetApplicationCredentialsFromWellKnownFile(Z){let $=null;if(this._isWindows())$=process.env.APPDATA;else{let Y=process.env.HOME;if(Y)$=g6.join(Y,".config")}if($){if($=g6.join($,"gcloud","application_default_credentials.json"),!A8.existsSync($))$=null}if(!$)return null;return await this._getApplicationCredentialsFromFilePath($,Z)}async _getApplicationCredentialsFromFilePath(Z,$={}){if(!Z||Z.length===0)throw Error("The file path is invalid.");try{if(Z=A8.realpathSync(Z),!A8.lstatSync(Z).isFile())throw Error()}catch(Y){if(Y instanceof Error)Y.message=`The file at ${Z} does not exist, or it is not a file. ${Y.message}`;throw Y}let Q=A8.createReadStream(Z);return this.fromStream(Q,$)}fromImpersonatedJSON(Z){if(!Z)throw Error("Must pass in a JSON object containing an impersonated refresh token");if(Z.type!==H8.IMPERSONATED_ACCOUNT_TYPE)throw Error(`The incoming JSON object does not have the "${H8.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!Z.source_credentials)throw Error("The incoming JSON object does not contain a source_credentials field");if(!Z.service_account_impersonation_url)throw Error("The incoming JSON object does not contain a service_account_impersonation_url field");let $=this.fromJSON(Z.source_credentials);if(Z.service_account_impersonation_url?.length>256)throw RangeError(`Target principal is too long: ${Z.service_account_impersonation_url}`);let Q=/(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(Z.service_account_impersonation_url)?.groups?.target;if(!Q)throw RangeError(`Cannot extract target principal from ${Z.service_account_impersonation_url}`);let Y=(this.scopes||Z.scopes||this.defaultScopes)??[];return new H8.Impersonated({...Z,sourceClient:$,targetPrincipal:Q,targetScopes:Array.isArray(Y)?Y:[Y]})}fromJSON(Z,$={}){let Q,Y=(0,$Q.originalOrCamelOptions)($).get("universe_domain");if(Z.type===e9.USER_REFRESH_ACCOUNT_TYPE)Q=new e9.UserRefreshClient($),Q.fromJSON(Z);else if(Z.type===H8.IMPERSONATED_ACCOUNT_TYPE)Q=this.fromImpersonatedJSON(Z);else if(Z.type===C8.EXTERNAL_ACCOUNT_TYPE)Q=W5.ExternalAccountClient.fromJSON({...Z,...$}),Q.scopes=this.getAnyScopes();else if(Z.type===ZQ.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE)Q=new ZQ.ExternalAccountAuthorizedUserClient({...Z,...$});else $.scopes=this.scopes,Q=new X8.JWT($),this.setGapicJWTValues(Q),Q.fromJSON(Z);if(Y)Q.universeDomain=Y;return Q}_cacheClientFromJSON(Z,$){let Q=this.fromJSON(Z,$);return this.jsonContent=Z,this.cachedCredential=Q,Q}fromStream(Z,$={},Q){let Y={};if(typeof $==="function")Q=$;else Y=$;if(Q)this.fromStreamAsync(Z,Y).then((V)=>Q(null,V),Q);else return this.fromStreamAsync(Z,Y)}fromStreamAsync(Z,$){return new Promise((Q,Y)=>{if(!Z)throw Error("Must pass in a stream containing the Google auth settings.");let V=[];Z.setEncoding("utf8").on("error",Y).on("data",(W)=>V.push(W)).on("end",()=>{try{try{let W=JSON.parse(V.join("")),z=this._cacheClientFromJSON(W,$);return Q(z)}catch(W){if(!this.keyFilename)throw W;let z=new X8.JWT({...this.clientOptions,keyFile:this.keyFilename});return this.cachedCredential=z,this.setGapicJWTValues(z),Q(z)}}catch(W){return Y(W)}})})}fromAPIKey(Z,$={}){return new X8.JWT({...$,apiKey:Z})}_isWindows(){let Z=Z5.platform();if(Z&&Z.length>=3){if(Z.substring(0,3).toLowerCase()==="win")return!0}return!1}async getDefaultServiceProjectId(){return new Promise((Z)=>{(0,tJ.exec)("gcloud config config-helper --format json",($,Q)=>{if(!$&&Q)try{let Y=JSON.parse(Q).configuration.properties.core.project;Z(Y);return}catch(Y){}Z(null)})})}getProductionProjectId(){return process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project}async getFileProjectId(){if(this.cachedCredential)return this.cachedCredential.projectId;if(this.keyFilename){let $=await this.getClient();if($&&$.projectId)return $.projectId}let Z=await this._tryGetApplicationCredentialsFromEnvironmentVariable();if(Z)return Z.projectId;else return null}async getExternalAccountClientProjectId(){if(!this.jsonContent||this.jsonContent.type!==C8.EXTERNAL_ACCOUNT_TYPE)return null;return await(await this.getClient()).getProjectId()}async getGCEProjectId(){try{return await j8.project("project-id")}catch(Z){return null}}getCredentials(Z){if(Z)this.getCredentialsAsync().then(($)=>Z(null,$),Z);else return this.getCredentialsAsync()}async getCredentialsAsync(){let Z=await this.getClient();if(Z instanceof H8.Impersonated)return{client_email:Z.getTargetPrincipal()};if(Z instanceof C8.BaseExternalAccountClient){let $=Z.getServiceAccountEmail();if($)return{client_email:$,universe_domain:Z.universeDomain}}if(this.jsonContent)return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain};if(await this._checkIsGCE()){let[$,Q]=await Promise.all([j8.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:$,universe_domain:Q}}throw Error(YQ.GoogleAuthExceptionMessages.NO_CREDENTIALS_FOUND)}async getClient(){if(this.cachedCredential)return this.cachedCredential;this.#Z=this.#Z||this.#Q();try{return await this.#Z}finally{this.#Z=null}}async#Q(){if(this.jsonContent)return this._cacheClientFromJSON(this.jsonContent,this.clientOptions);else if(this.keyFilename){let Z=g6.resolve(this.keyFilename),$=A8.createReadStream(Z);return await this.fromStreamAsync($,this.clientOptions)}else if(this.apiKey){let Z=await this.fromAPIKey(this.apiKey,this.clientOptions);Z.scopes=this.scopes;let{credential:$}=await this.#$(Z);return $}else{let{credential:Z}=await this.getApplicationDefaultAsync(this.clientOptions);return Z}}async getIdTokenClient(Z){let $=await this.getClient();if(!("fetchIdToken"in $))throw Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.");return new Y5.IdTokenClient({targetAudience:Z,idTokenProvider:$})}async getAccessToken(){return(await(await this.getClient()).getAccessToken()).token}async getRequestHeaders(Z){return(await this.getClient()).getRequestHeaders(Z)}async authorizeRequest(Z={}){let $=Z.url,Y=await(await this.getClient()).getRequestHeaders($);return Z.headers=eJ.Gaxios.mergeHeaders(Z.headers,Y),Z}async fetch(...Z){return(await this.getClient()).fetch(...Z)}async request(Z){return(await this.getClient()).request(Z)}getEnv(){return(0,V5.getEnv)()}async sign(Z,$){let Q=await this.getClient(),Y=await this.getUniverseDomain();if($=$||`https://iamcredentials.${Y}/v1/projects/-/serviceAccounts/`,Q instanceof H8.Impersonated)return(await Q.sign(Z)).signedBlob;let V=(0,$5.createCrypto)();if(Q instanceof X8.JWT&&Q.key)return await V.sign(Q.key,Z);let W=await this.getCredentials();if(!W.client_email)throw Error("Cannot sign data without `client_email`.");return this.signBlob(V,W.client_email,Z,$)}async signBlob(Z,$,Q,Y){let V=new URL(Y+`${$}:signBlob`);return(await this.request({method:"POST",url:V.href,data:{payload:Z.encodeBase64StringUtf8(Q)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}}YQ.GoogleAuth=QQ});var zQ=A((XQ)=>{Object.defineProperty(XQ,"__esModule",{value:!0});XQ.IAMAuth=void 0;class JQ{selector;token;constructor(Z,$){this.selector=Z,this.token=$,this.selector=Z,this.token=$}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}}XQ.IAMAuth=JQ});var FQ=A((qQ)=>{Object.defineProperty(qQ,"__esModule",{value:!0});qQ.DownscopedClient=qQ.EXPIRATION_TIME_OFFSET=qQ.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var J5=X0(),X5=_("stream"),d6=D0(),H5=o8(),z5="urn:ietf:params:oauth:grant-type:token-exchange",K5="urn:ietf:params:oauth:token-type:access_token",q5="urn:ietf:params:oauth:token-type:access_token";qQ.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;qQ.EXPIRATION_TIME_OFFSET=300000;class KQ extends d6.AuthClient{authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(Z,$={accessBoundary:{accessBoundaryRules:[]}}){super(Z instanceof d6.AuthClient?{}:Z);if(Z instanceof d6.AuthClient)this.authClient=Z,this.credentialAccessBoundary=$;else this.authClient=Z.authClient,this.credentialAccessBoundary=Z.credentialAccessBoundary;if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length===0)throw Error("At least one access boundary rule needs to be defined.");else if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>qQ.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw Error(`The provided access boundary has more than ${qQ.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(let Q of this.credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(Q.availablePermissions.length===0)throw Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new H5.StsCredentials({tokenExchangeEndpoint:`https://sts.${this.universeDomain}/v1/token`}),this.cachedDownscopedAccessToken=null}setCredentials(Z){if(!Z.expiry_date)throw Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(Z),this.cachedDownscopedAccessToken=Z}async getAccessToken(){if(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))await this.refreshAccessTokenAsync();return{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let Z=await this.getAccessToken(),$=new Headers({authorization:`Bearer ${Z.token}`});return this.addSharedMetadataHeaders($)}request(Z,$){if($)this.requestAsync(Z).then((Q)=>$(null,Q),(Q)=>{return $(Q,Q.response)});else return this.requestAsync(Z)}async requestAsync(Z,$=!1){let Q;try{let Y=await this.getRequestHeaders();Z.headers=J5.Gaxios.mergeHeaders(Z.headers),this.addUserProjectAndAuthHeaders(Z.headers,Y),Q=await this.transporter.request(Z)}catch(Y){let V=Y.response;if(V){let W=V.status,z=V.config.data instanceof X5.Readable;if(!$&&(W===401||W===403)&&!z&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(Z,!0)}throw Y}return Q}async refreshAccessTokenAsync(){let Z=(await this.authClient.getAccessToken()).token,$={grantType:z5,requestedTokenType:K5,subjectToken:Z,subjectTokenType:q5},Q=await this.stsCredential.exchangeToken($,void 0,this.credentialAccessBoundary),Y=this.authClient.credentials?.expiry_date||null,V=Q.expires_in?new Date().getTime()+Q.expires_in*1000:Y;return this.cachedDownscopedAccessToken={access_token:Q.access_token,expiry_date:V,res:Q.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(Z){let $=new Date().getTime();return Z.expiry_date?$>=Z.expiry_date-this.eagerRefreshThresholdMillis:!1}}qQ.DownscopedClient=KQ});var GQ=A((DQ)=>{Object.defineProperty(DQ,"__esModule",{value:!0});DQ.PassThroughClient=void 0;var F5=D0();class UQ extends F5.AuthClient{async request(Z){return this.transporter.request(Z)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}}DQ.PassThroughClient=UQ});var y5=A((r)=>{Object.defineProperty(r,"__esModule",{value:!0});r.GoogleAuth=r.auth=r.PassThroughClient=r.ExternalAccountAuthorizedUserClient=r.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=r.ExecutableError=r.PluggableAuthClient=r.DownscopedClient=r.BaseExternalAccountClient=r.ExternalAccountClient=r.IdentityPoolClient=r.AwsRequestSigner=r.AwsClient=r.UserRefreshClient=r.LoginTicket=r.ClientAuthentication=r.OAuth2Client=r.CodeChallengeMethod=r.Impersonated=r.JWT=r.JWTAccess=r.IdTokenClient=r.IAMAuth=r.GCPEnv=r.Compute=r.DEFAULT_UNIVERSE=r.AuthClient=r.gaxios=r.gcpMetadata=void 0;var IQ=WQ();Object.defineProperty(r,"GoogleAuth",{enumerable:!0,get:function(){return IQ.GoogleAuth}});r.gcpMetadata=U8();r.gaxios=X0();var RQ=D0();Object.defineProperty(r,"AuthClient",{enumerable:!0,get:function(){return RQ.AuthClient}});Object.defineProperty(r,"DEFAULT_UNIVERSE",{enumerable:!0,get:function(){return RQ.DEFAULT_UNIVERSE}});var U5=u1();Object.defineProperty(r,"Compute",{enumerable:!0,get:function(){return U5.Compute}});var D5=l1();Object.defineProperty(r,"GCPEnv",{enumerable:!0,get:function(){return D5.GCPEnv}});var M5=zQ();Object.defineProperty(r,"IAMAuth",{enumerable:!0,get:function(){return M5.IAMAuth}});var G5=d1();Object.defineProperty(r,"IdTokenClient",{enumerable:!0,get:function(){return G5.IdTokenClient}});var I5=J6();Object.defineProperty(r,"JWTAccess",{enumerable:!0,get:function(){return I5.JWTAccess}});var R5=H6();Object.defineProperty(r,"JWT",{enumerable:!0,get:function(){return R5.JWT}});var N5=K6();Object.defineProperty(r,"Impersonated",{enumerable:!0,get:function(){return N5.Impersonated}});var c6=n0();Object.defineProperty(r,"CodeChallengeMethod",{enumerable:!0,get:function(){return c6.CodeChallengeMethod}});Object.defineProperty(r,"OAuth2Client",{enumerable:!0,get:function(){return c6.OAuth2Client}});Object.defineProperty(r,"ClientAuthentication",{enumerable:!0,get:function(){return c6.ClientAuthentication}});var T5=m1();Object.defineProperty(r,"LoginTicket",{enumerable:!0,get:function(){return T5.LoginTicket}});var L5=z6();Object.defineProperty(r,"UserRefreshClient",{enumerable:!0,get:function(){return L5.UserRefreshClient}});var S5=L6();Object.defineProperty(r,"AwsClient",{enumerable:!0,get:function(){return S5.AwsClient}});var B5=T6();Object.defineProperty(r,"AwsRequestSigner",{enumerable:!0,get:function(){return B5.AwsRequestSigner}});var O5=N6();Object.defineProperty(r,"IdentityPoolClient",{enumerable:!0,get:function(){return O5.IdentityPoolClient}});var P5=x6();Object.defineProperty(r,"ExternalAccountClient",{enumerable:!0,get:function(){return P5.ExternalAccountClient}});var A5=l0();Object.defineProperty(r,"BaseExternalAccountClient",{enumerable:!0,get:function(){return A5.BaseExternalAccountClient}});var j5=FQ();Object.defineProperty(r,"DownscopedClient",{enumerable:!0,get:function(){return j5.DownscopedClient}});var NQ=_6();Object.defineProperty(r,"PluggableAuthClient",{enumerable:!0,get:function(){return NQ.PluggableAuthClient}});Object.defineProperty(r,"ExecutableError",{enumerable:!0,get:function(){return NQ.ExecutableError}});var TQ=m6();Object.defineProperty(r,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:function(){return TQ.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE}});Object.defineProperty(r,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:function(){return TQ.ExternalAccountAuthorizedUserClient}});var C5=GQ();Object.defineProperty(r,"PassThroughClient",{enumerable:!0,get:function(){return C5.PassThroughClient}});var v5=new IQ.GoogleAuth;r.auth=v5});
|
|
32
|
+
export{y5 as eh};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Eg as A}from"./chunk-apksmrz9.js";import{$g as T}from"./chunk-3dq7hfxc.js";import{ah as y}from"./chunk-zaj612bw.js";import{QF as r}from"./chunk-8j3aw4qg.js";var u=r(A(),1);var i=r(y(),1),E=r(A(),1);import{exec as d}from"child_process";import{promisify as I}from"util";var x=r(T(),1),_=(c,n,e)=>{if(n.Version!==1)throw Error(`Profile ${c} credential_process did not return Version 1.`);if(n.AccessKeyId===void 0||n.SecretAccessKey===void 0)throw Error(`Profile ${c} credential_process returned invalid credentials.`);if(n.Expiration){let w=new Date;if(new Date(n.Expiration)<w)throw Error(`Profile ${c} credential_process returned expired credentials.`)}let s=n.AccountId;if(!s&&e?.[c]?.aws_account_id)s=e[c].aws_account_id;let t={accessKeyId:n.AccessKeyId,secretAccessKey:n.SecretAccessKey,...n.SessionToken&&{sessionToken:n.SessionToken},...n.Expiration&&{expiration:new Date(n.Expiration)},...n.CredentialScope&&{credentialScope:n.CredentialScope},...s&&{accountId:s}};return x.setCredentialFeature(t,"CREDENTIALS_PROCESS","w"),t};var K=async(c,n,e)=>{let s=n[c];if(n[c]){let t=s.credential_process;if(t!==void 0){let w=I(E.externalDataInterceptor?.getTokenRecord?.().exec??d);try{let{stdout:o}=await w(t),S;try{S=JSON.parse(o.trim())}catch{throw Error(`Profile ${c} credential_process returned invalid JSON.`)}return _(c,S,n)}catch(o){throw new i.CredentialsProviderError(o.message,{logger:e})}}else throw new i.CredentialsProviderError(`Profile ${c} did not contain credential_process.`,{logger:e})}else throw new i.CredentialsProviderError(`Profile ${c} could not be found in shared credentials file.`,{logger:e})};var R=(c={})=>async({callerClientConfig:n}={})=>{c.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");let e=await u.parseKnownFiles(c);return K(u.getProfileName({profile:c.profile??n?.profile}),e,c.logger)};export{R as Nf};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{RF as h}from"./chunk-8j3aw4qg.js";var A=h((f)=>{f.HttpAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(f.HttpAuthLocation||(f.HttpAuthLocation={}));f.HttpApiKeyAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(f.HttpApiKeyAuthLocation||(f.HttpApiKeyAuthLocation={}));f.EndpointURLScheme=void 0;(function(t){t.HTTP="http",t.HTTPS="https"})(f.EndpointURLScheme||(f.EndpointURLScheme={}));f.AlgorithmId=void 0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(f.AlgorithmId||(f.AlgorithmId={}));var x=(t)=>{let o=[];if(t.sha256!==void 0)o.push({algorithmId:()=>f.AlgorithmId.SHA256,checksumConstructor:()=>t.sha256});if(t.md5!=null)o.push({algorithmId:()=>f.AlgorithmId.MD5,checksumConstructor:()=>t.md5});return{addChecksumAlgorithm(s){o.push(s)},checksumAlgorithms(){return o}}},d=(t)=>{let o={};return t.checksumAlgorithms().forEach((s)=>{o[s.algorithmId()]=s.checksumConstructor()}),o},a=(t)=>{return x(t)},E=(t)=>{return d(t)};f.FieldPosition=void 0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(f.FieldPosition||(f.FieldPosition={}));var m="__smithy_context";f.IniSectionType=void 0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(f.IniSectionType||(f.IniSectionType={}));f.RequestHandlerProtocol=void 0;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(f.RequestHandlerProtocol||(f.RequestHandlerProtocol={}));f.SMITHY_CONTEXT_KEY=m;f.getDefaultClientConfiguration=a;f.resolveDefaultRuntimeConfig=E});
|
|
3
|
+
export{A as Tg};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ar as N,Dr as W,Op as g,gq as O,xp as h,yr as de}from"./chunk-zhd8f4pc.js";import{us as ie,xs as v}from"./chunk-8jy0dvcn.js";import{AF as s,Fx as $,Hz as le,Yz as d,eC as o}from"./chunk-1mqsg5s7.js";import{SF as se}from"./chunk-8j3aw4qg.js";function _e(e){let r,t=!1,i=()=>{if(t)return r;return r=e(),t=!0,r};return i.reset=()=>{t=!1,r=void 0},i.loaded=()=>t,i}var V={};se(V,{resolveAll:()=>me,resolve:()=>he,referencePath:()=>ge,layer:()=>pe,defaultLayer:()=>We,Service:()=>A,Reference:()=>V});import _ from"path";import Y from"path";import{fileURLToPath as Ee}from"url";class w extends s.TaggedErrorClass()("RepositoryInvalidReferenceError",{repository:s.String,message:s.String}){}class C extends s.TaggedErrorClass()("RepositoryUnsupportedLocalRepositoryError",{repository:s.String,message:s.String}){}class k extends s.TaggedErrorClass()("RepositoryInvalidBranchError",{branch:s.String,message:s.String}){}function ee(e){return e.trim().replace(/^git\+/,"").replace(/#.*$/,"").replace(/\/+$/,"")}function M(e){return e.replace(/\.git$/,"")}function q(e){return e.split("/").map((r)=>M(r.trim())).filter(Boolean)}function Se(e){return Boolean(e)&&!e.startsWith("-")&&!/[\s/\\]/.test(e)}function ve(e){return e!=="."&&e!==".."&&!e.includes(":")&&!/[\s/\\]/.test(e)}function we(e){return e.includes(".")||e.includes(":")||e==="localhost"}function Ce(e){return e.endsWith("/")?e:`${e}/`}function re(e){let r=process.env.MUXCODE_REPO_CLONE_GITHUB_BASE_URL;if(!r)return`https://github.com/${e}.git`;return new URL(`${e}.git`,Ce(r)).href}function y(e){let r=e.segments.map(M).filter(Boolean);if(!Se(e.host)||!r.length||r.some((a)=>!ve(a)))return null;let t=r.join("/"),i=r[r.length-1],n=e.host.toLowerCase();return{host:n,path:t,segments:r,owner:r.length===2?r[0]:void 0,repo:i,remote:e.remote??(n==="github.com"?re(t):`https://${n}/${t}.git`),label:n==="github.com"&&r.length===2?t:`${n}/${t}`,protocol:e.protocol}}function ke(e){let r=Y.normalize(Ee(e.url)),t=r.split(/[\\/]+/).filter(Boolean);if(!t.length)return null;return{host:"file",path:r,segments:t.map((i)=>i.replace(/:$/,"")),owner:void 0,repo:M(t[t.length-1]),remote:e.remote,label:r,protocol:"file:"}}function u(e){let r=ee(e);if(!r)return null;let t=r.match(/^github:([^/\s]+)\/([^/\s]+)$/);if(t)return y({host:"github.com",segments:[t[1],t[2]]});if(!r.includes("://")){let i=r.match(/^(?:[^@/\s]+@)?([^:/\s]+):(.+)$/);if(i)return y({host:i[1],segments:q(i[2]),remote:r});let n=q(r);if(n.length>=2&&we(n[0]))return y({host:n[0],segments:n.slice(1)});if(n.length===2)return y({host:"github.com",segments:n})}try{let i=new URL(r);if(i.protocol==="file:")return ke({url:i,remote:r});let n=q(i.pathname),a=i.host;return y({host:a,segments:n,remote:a==="github.com"?re(n.join("/")):r,protocol:i.protocol})}catch{return null}}function Fe(e){return e.protocol==="file:"}function Le(e){return!Fe(e)}function te(e){let r=u(e);if(!r)throw new w({repository:e,message:"Repository must be a git URL, host/path reference, or GitHub owner/repo shorthand"});if(!Le(r))throw new C({repository:e,message:"Local file repositories are not supported"});return r}function ne(e){if(!/^[A-Za-z0-9/_.-]+$/.test(e)||e.startsWith("-")||e.includes(".."))throw new k({branch:e,message:"Branch must contain only alphanumeric characters, /, _, ., and -, and cannot start with - or contain .."})}function Ze(e){let r=ee(e);if(!r.includes("://")&&!r.match(/^(?:[^@/\s]+@)?github\.com:/))return null;let t=u(r);if(!t||t.host!=="github.com"||!t.owner||t.segments.length!==2)return null;return{owner:t.owner,repo:t.repo}}function F(e){return Y.join(v.Path.repos,...e.host.split(":"),...e.segments)}function Q(e){return`${e.host}/${e.path}`}function oe(e,r){return Q(e)===Q(r)}var m={};se(m,{validateBranch:()=>ae,parseRemoteReference:()=>Ie,layer:()=>ce,isError:()=>Be,defaultLayer:()=>Pe,Service:()=>L,ResetFailedError:()=>T,RepositoryCache:()=>m,LockFailedError:()=>P,InvalidRepositoryError:()=>x,InvalidBranchError:()=>b,FetchFailedError:()=>B,CloneFailedError:()=>z,CheckoutFailedError:()=>I,CacheOperationError:()=>E});import D from"path";class x extends s.TaggedErrorClass()("RepositoryCacheInvalidRepositoryError",{repository:s.String,message:s.String}){}class b extends s.TaggedErrorClass()("RepositoryCacheInvalidBranchError",{branch:s.String,message:s.String}){}class z extends s.TaggedErrorClass()("RepositoryCacheCloneFailedError",{repository:s.String,message:s.String}){}class B extends s.TaggedErrorClass()("RepositoryCacheFetchFailedError",{repository:s.String,message:s.String}){}class I extends s.TaggedErrorClass()("RepositoryCacheCheckoutFailedError",{repository:s.String,branch:s.String,message:s.String}){}class T extends s.TaggedErrorClass()("RepositoryCacheResetFailedError",{repository:s.String,message:s.String}){}class P extends s.TaggedErrorClass()("RepositoryCacheLockFailedError",{localPath:s.String,message:s.String}){}class E extends s.TaggedErrorClass()("RepositoryCacheOperationError",{operation:s.String,path:s.String,message:s.String}){}class L extends $.Service()("@muxcode/RepositoryCache"){}function $e(e){if(!e.reuse)return"cloned";if(e.branchMatches===!1)return"refreshed";if(e.refresh)return"refreshed";return"cached"}function ze(e){if(e.requestedBranch)return`origin/${e.requestedBranch}`;if(e.remoteHead.code===0&&e.remoteHead.stdout)return e.remoteHead.stdout.replace(/^refs\/remotes\//,"");if(e.branch.code===0&&e.branch.stdout)return`origin/${e.branch.stdout}`;return"HEAD"}function R(e){return e instanceof globalThis.Error?e.message:String(e)}function Be(e){return e instanceof x||e instanceof b||e instanceof z||e instanceof B||e instanceof I||e instanceof T||e instanceof P||e instanceof E}var Ie=o.fn("RepositoryCache.parseRemoteReference")(function*(e){try{return te(e)}catch(r){if(r instanceof w||r instanceof C)return yield*new x({repository:r.repository,message:r.message});return yield*new x({repository:e,message:R(r)})}}),ae=o.fn("RepositoryCache.validateBranch")(function*(e){try{ne(e)}catch(r){if(r instanceof k)return yield*new b({branch:r.branch,message:r.message});return yield*new b({branch:e,message:R(r)})}}),Te=o.fn("RepositoryCache.ensureWithServices")(function*(e,r){if(e.branch)yield*ae(e.branch);let t=e.reference.label,i=e.reference.remote,n=F(e.reference),a=u(i)??e.reference;return yield*o.acquireUseRelease(o.promise((c)=>ie.acquire(`repo-clone:${n}`,{signal:c})).pipe(o.catch((c)=>o.fail(new P({localPath:n,message:R(c)||`Failed to lock ${n}`})))),()=>o.gen(function*(){yield*r.fs.ensureDir(D.dirname(n)).pipe(o.catch((l)=>o.fail(new E({operation:"ensure cache directory",path:n,message:R(l)}))));let c=yield*r.fs.existsSafe(n),f=yield*r.fs.existsSafe(D.join(n,".git")),p=f?yield*r.git.run(["config","--get","remote.origin.url"],{cwd:n}):void 0,S=p?.exitCode===0?u(p.text().trim()):void 0,X=f&&Boolean(S&&oe(S,a));if(c&&!X)yield*r.fs.remove(n,{recursive:!0}).pipe(o.catch((l)=>o.fail(new E({operation:"remove stale cache",path:n,message:R(l)}))));let ye=f?yield*r.git.branch(n):void 0,H=$e({reuse:X,refresh:e.refresh,branchMatches:e.branch?ye===e.branch:void 0});if(H==="cloned"){let l=yield*r.git.run(["clone","--depth","100",...e.branch?["--branch",e.branch]:[],"--",i,n],{cwd:D.dirname(n)});if(l.exitCode!==0)return yield*new z({repository:t,message:l.stderr.toString().trim()||l.text().trim()||`Failed to clone ${t}`})}if(H==="refreshed"){let l=yield*r.git.run(["fetch","--all","--prune"],{cwd:n});if(l.exitCode!==0)return yield*new B({repository:t,message:l.stderr.toString().trim()||l.text().trim()||`Failed to refresh ${t}`});if(e.branch){let G=yield*r.git.run(["checkout","-B",e.branch,`origin/${e.branch}`],{cwd:n});if(G.exitCode!==0)return yield*new I({repository:t,branch:e.branch,message:G.stderr.toString().trim()||G.text().trim()||`Failed to checkout ${e.branch}`})}let J=yield*r.git.run(["symbolic-ref","refs/remotes/origin/HEAD"],{cwd:n}),K=yield*r.git.run(["symbolic-ref","--quiet","--short","HEAD"],{cwd:n}),be=ze({requestedBranch:e.branch,remoteHead:{code:J.exitCode,stdout:J.text().trim()},branch:{code:K.exitCode,stdout:K.text().trim()}}),U=yield*r.git.run(["reset","--hard",be],{cwd:n});if(U.exitCode!==0)return yield*new T({repository:t,message:U.stderr.toString().trim()||U.text().trim()||`Failed to reset ${t}`})}let Z=yield*r.git.run(["rev-parse","HEAD"],{cwd:n}),Re=yield*r.git.branch(n),xe=Z.exitCode===0?Z.text().trim():void 0;return{repository:t,host:e.reference.host,remote:i,localPath:n,status:H,head:xe,branch:Re}}),(c)=>o.promise(()=>c.release()).pipe(o.ignore))}),ce=d.effect(L,o.gen(function*(){let e=yield*h.Service,r=yield*W.Service;return L.of({ensure:o.fn("RepositoryCache.ensure")(function*(t){return yield*Te(t,{fs:e,git:r})})})})),Pe=ce.pipe(d.provide(h.defaultLayer),d.provide(W.defaultLayer));class A extends $.Service()("@muxcode/Reference"){}function ge(e){if(e.value.startsWith("~/"))return _.join(v.Path.home,e.value.slice(2));return _.isAbsolute(e.value)?e.value:_.resolve(e.worktree==="/"?e.directory:e.worktree,e.value)}function Ae(e){let r=u(e.repository);if(!r||r.protocol==="file:")return{name:e.name,kind:"invalid",repository:e.repository,message:"Repository must be a git URL, host/path reference, or GitHub owner/repo shorthand"};return{name:e.name,kind:"git",repository:e.repository,reference:r,path:F(r),..."branch"in e?{branch:e.branch}:{}}}function fe(e){return e??"default branch"}function j(e){if(!e)return;return process.platform==="win32"?h.normalizePath(e):e}function ue(e,r){return h.contains(j(e)??e,r)}function He(e){let r=new Set;return e.filter((t)=>{if(t.kind!=="git")return!1;if(r.has(t.path))return!1;return r.add(t.path),!0})}function Ue(e,r){return e.ensure({reference:r.reference,branch:r.branch,refresh:!0}).pipe(o.asVoid,o.catchCause((t)=>o.logWarning("failed to materialize reference repository").pipe(o.annotateLogs({name:r.name,cause:t}))))}var Ge=o.fn("Reference.materializers")(function*(e,r){return yield*o.forEach(He(r),o.fnUntraced(function*(t){return{path:t.path,run:yield*o.cached(Ue(e,t))}}),{concurrency:"unbounded"})});function qe(e){if(!e.flags.experimentalScout)return o.void;return o.forEach(e.materializers,o.fnUntraced(function*(r){yield*r.run}),{concurrency:4,discard:!0})}function Me(e,r){return e.find((t)=>ue(t.path,r))?.run??o.void}function De(e,r){return e.some((t)=>t.kind==="git"&&ue(t.path,r))}function he(e){if(e.reference.kind==="invalid")return{name:e.name,kind:"invalid",message:e.reference.message};if(e.reference.kind==="local")return{name:e.name,kind:"local",path:ge({...e,value:e.reference.path})};return Ae({name:e.name,repository:e.reference.repository,branch:e.reference.branch})}function me(e){let r=new Map;return Object.entries(e.references).map(([t,i])=>{let n=he({name:t,reference:i,directory:e.directory,worktree:e.worktree});if(n.kind!=="git")return n;let a=r.get(n.path);if(!a)return r.set(n.path,{name:t,branch:n.branch}),n;if(a.branch===n.branch)return n;return{name:t,kind:"invalid",repository:n.repository,message:`Reference conflicts with @${a.name}: both use ${n.path}, but @${a.name} requests ${fe(a.branch)} and @${t} requests ${fe(n.branch)}`}})}var pe=d.effect(A,o.gen(function*(){let e=yield*N.Service,r=yield*m.Service,t=yield*le.Scope,i=yield*O.Service,n=yield*g.make(o.fn("Reference.state")(function*(a){let c=yield*e.get(),f=me({references:de.normalize(c.reference??{}),directory:a.directory,worktree:a.worktree}),p=yield*Ge(r,f),S=yield*o.cached(qe({flags:i,materializers:p}));return{references:f,materializeAll:S,materializeByPath:p}}));return A.of({init:o.fn("Reference.init")(function*(){if(!i.experimentalScout)return;yield*g.useEffect(n,(a)=>a.materializeAll).pipe(o.forkIn(t),o.asVoid)}),list:o.fn("Reference.list")(function*(){return yield*g.use(n,(a)=>a.references)}),get:o.fn("Reference.get")(function*(a){return yield*g.use(n,(c)=>c.references.find((f)=>f.name===a))}),ensure:o.fn("Reference.ensure")(function*(a){if(!i.experimentalScout)return;let c=j(a);if(!c)return yield*g.useEffect(n,(f)=>f.materializeAll);return yield*g.useEffect(n,(f)=>Me(f.materializeByPath,c))}),contains:o.fn("Reference.contains")(function*(a){if(!i.experimentalScout)return!1;let c=j(a);if(!c)return!1;return yield*g.use(n,(f)=>De(f.references,c))})})})),We=pe.pipe(d.provide(N.defaultLayer),d.provide(m.defaultLayer),d.provide(O.defaultLayer));
|
|
3
|
+
export{_e as Yk,u as Zk,Ze as _k,F as $k,m as al,V as bl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Df as a,Ef as b,Ff as c,Gf as d,Hf as e,If as f,Jf as g,Kf as h,Lf as i,Mf as j}from"./chunk-yg48tfvv.js";import"./chunk-xedav0qx.js";import"./chunk-9n629gtn.js";import"./chunk-nmnp5g5p.js";import"./chunk-4mgyaytc.js";import"./chunk-n4vx7kvs.js";import"./chunk-cbz8b7g5.js";import"./chunk-5jn2z3nf.js";import"./chunk-vqrnejgj.js";import"./chunk-zhd8f4pc.js";import"./chunk-ygpen625.js";import"./chunk-jfz77m78.js";import"./chunk-my9cfmvt.js";import"./chunk-8jy0dvcn.js";import"./chunk-frbht418.js";import"./chunk-1pv2317e.js";import"./chunk-21x3anp4.js";import"./chunk-ntvr3177.js";import"./chunk-9h1pwxb2.js";import"./chunk-fkmzj0qt.js";import"./chunk-q9yddd1r.js";import"./chunk-eskw1cj2.js";import"./chunk-k19y2psf.js";import"./chunk-ppg6zhae.js";import"./chunk-ng3vbpmy.js";import"./chunk-1mqsg5s7.js";import"./chunk-z3mx7n44.js";import"./chunk-0qqpjj2h.js";import"./chunk-9g64kggy.js";import"./chunk-8j3aw4qg.js";export{c as toolView,d as toolStructuredFinal,h as toolSnapshot,f as toolScroll,g as toolPermissionInfo,a as toolPath,e as toolInlineInfo,b as toolFrame,j as toolFiletype,i as toolEntryBody};
|