#!/usr/bin/env node
"use strict";var a=Object.defineProperty;var t=(e,r)=>a(e,"name",{value:r,configurable:!0});var commands_agent=require("./agent.index.cjs"),S=require("fs");require("./index2.cjs");require("node:url");require("node:fs");require("node:fs/promises");require("node:util");require("node:path");require("path");require("os");require("node:os");require("tty");require("util");require("node:perf_hooks");require("url");require("node:readline");require("node:process");require("node:tty");require("./index3.cjs");require("crypto");require("buffer");require("./index4.cjs");require("stream");require("events");require("string_decoder");require("zlib");require("http");require("https");require("assert");require("process");require("querystring");require("net");require("tls");require("dns");require("fs/promises");require("child_process");require("punycode");require("node:events");require("node:stream");require("http2");require("node:stream/web");require("timers");require("node:crypto");require("readline");require("./index5.cjs");require("./index6.cjs");const fromWebToken=t(e=>async r=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");const{roleArn:i,roleSessionName:n,webIdentityToken:o,providerId:u,policyArns:d,policy:c,durationSeconds:l}=e;let{roleAssumerWithWebIdentity:s}=e;if(!s){const{getDefaultRoleAssumerWithWebIdentity:q}=await Promise.resolve().then(function(){return require("./index12.cjs")});s=q({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...r?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins)}return s({RoleArn:i,RoleSessionName:n??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:o,ProviderId:u,PolicyArns:d,Policy:c,DurationSeconds:l})},"fromWebToken"),ENV_TOKEN_FILE="AWS_WEB_IDENTITY_TOKEN_FILE",ENV_ROLE_ARN="AWS_ROLE_ARN",ENV_ROLE_SESSION_NAME="AWS_ROLE_SESSION_NAME",fromTokenFile=t((e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");const r=e?.webIdentityTokenFile??process.env[ENV_TOKEN_FILE],i=e?.roleArn??process.env[ENV_ROLE_ARN],n=e?.roleSessionName??process.env[ENV_ROLE_SESSION_NAME];if(!r||!i)throw new commands_agent.CredentialsProviderError("Web identity configuration not specified",{logger:e.logger});const o=await fromWebToken({...e,webIdentityToken:S.readFileSync(r,{encoding:"ascii"}),roleArn:i,roleSessionName:n})();return r===process.env[ENV_TOKEN_FILE]&&commands_agent.setCredentialFeature$1(o,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h"),o},"fromTokenFile");exports.fromTokenFile=fromTokenFile;exports.fromWebToken=fromWebToken;
