import { a as CredentialsProviderError, s as setCredentialFeature } from './role-executor-C4-3bmgC.js';
import { e as externalDataInterceptor } from './externalDataInterceptor-C3C4cObe.js';
import { readFileSync } from 'node:fs';
import './paths-2M_UxD_H.js';
import 'node:path';
import 'node:os';
import 'node:events';
import 'node:diagnostics_channel';
import 'fs';
import 'events';
import 'util';
import 'path';
import 'assert';
import 'worker_threads';
import 'module';
import 'node:url';
import 'url';
import 'buffer';
import 'node:module';
import 'node:child_process';
import 'node:crypto';
import 'node:process';
import 'node:async_hooks';
import './credential-pool-B04qO8at.js';
import './index-IVoIz4D5.js';
import 'constants';
import 'stream';
import './config-B0nEjgSh.js';
import './json-DXl7iDYg.js';
import './lock-BoHF25mx.js';
import 'node:fs/promises';
import './index-Ca4C2M45.js';
import './role-resolver-DF9BQ_U6.js';
import 'node:stream';
import 'crypto';
import 'os';
import 'node:http2';
import 'fs/promises';
import 'node:net';
import './readFile-CxwXhymG.js';
import './getSSOTokenFromFile-yZAJxDci.js';

//#region ../../node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.972.41/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromWebToken.js
var fromWebToken = (init) => async (awsIdentityProperties) => {
	init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");
	const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;
	let { roleAssumerWithWebIdentity } = init;
	if (!roleAssumerWithWebIdentity) {
		const { getDefaultRoleAssumerWithWebIdentity } = await import('./sts-B6i3EhdC.js');
		roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
			...init.clientConfig,
			credentialProviderLogger: init.logger,
			parentClientConfig: {
				...awsIdentityProperties?.callerClientConfig,
				...init.parentClientConfig
			}
		}, init.clientPlugins);
	}
	return roleAssumerWithWebIdentity({
		RoleArn: roleArn,
		RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`,
		WebIdentityToken: webIdentityToken,
		ProviderId: providerId,
		PolicyArns: policyArns,
		Policy: policy,
		DurationSeconds: durationSeconds
	});
};
//#endregion
//#region ../../node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.972.41/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
var ENV_ROLE_ARN = "AWS_ROLE_ARN";
var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
var fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
	init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
	const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
	const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
	const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
	if (!webIdentityTokenFile || !roleArn) throw new CredentialsProviderError("Web identity configuration not specified", { logger: init.logger });
	const credentials = await fromWebToken({
		...init,
		webIdentityToken: externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ?? readFileSync(webIdentityTokenFile, { encoding: "ascii" }),
		roleArn,
		roleSessionName
	})(awsIdentityProperties);
	if (webIdentityTokenFile === process.env[ENV_TOKEN_FILE]) setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN", "h");
	return credentials;
};

export { fromTokenFile };
//# sourceMappingURL=dist-es8-BSbV9TZw.js.map
