import{c as S,A,s as l,S as I}from"./loadSts-CsI2lH7u.js";import{b as re,E as se,e as ae,I as ce,d as le,M as me,P as de,R as pe,a as ue}from"./loadSts-CsI2lH7u.js";import{C as y,g as E}from"./index-fkBiak1w.js";import{a as ge}from"./index-fkBiak1w.js";import"./normalizeProvider-BrOPyH3l.js";import"./preload-helper-BlTxHScW.js";import"./index-Doo87e5X.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./_commonjsHelpers-38a7CZ6X-W3E8ocG7.js";import"./index-VamKv2HZ--hbiLl7B.js";import"./index-ChvoNxcO.js";import"./__vite-browser-external-DJy8wZt7.js";import"./index-xuotMAFm-B-PTrwYx.js";import"./_commonjsHelpers-B4e78b8K-W3E8ocG7.js";import"./index-6mKfgpcs-DsgiI2lM.js";import"./inherits_browser-BPb0V7-q-C7Z2MfVc.js";import"./index-DsIu-45t-Bejjlpz4.js";import"./index-DSosZ5sh-Ceejs_jv.js";import"./index-69shuAsh-DF18H7zf.js";import"./index-BJBOx-Z---hbiLl7B.js";import"./index-D5v913EJ-CsbEilVn.js";import"./_commonjs-dynamic-modules-BpilXLfW-DfYEAvWy.js";import"./_commonjsHelpers-38a7CZ6X-BfEUBFWa-BEFu9Otg.js";import"./index-VamKv2HZ-CaraMydH-D75zmpPt.js";import"./index-D1jV2j2Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./index-DIt05veo.js";import"./inherits_browser-5Fj3Mjxs.js";function R(){return async()=>"us-east-1"}class x extends y.classBuilder().ep(S).m(function(t,n,i,o){return[E(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(A).build(){}const W=e=>{if(typeof e?.Arn=="string"){const t=e.Arn.split(":");if(t.length>4&&t[4]!=="")return t[4]}},T=async(e,t,n,i={})=>{const o=typeof e=="function"?await e():e,s=typeof t=="function"?await t():t,r=await R()();return n?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${o} (credential provider clientConfig)`,`${s} (contextual client)`,`${r} (STS default: AWS_REGION, profile region, or us-east-1)`),o??s??r},b=(e,t)=>{let n;return async i=>{if(!n){const{logger:m=e?.parentClientConfig?.logger,profile:d=e?.parentClientConfig?.profile,region:p,requestHandler:c=e?.parentClientConfig?.requestHandler,credentialProviderLogger:u,userAgentAppId:f=e?.parentClientConfig?.userAgentAppId}=e,g=await T(p,e?.parentClientConfig?.region,u,{}),C=!h(c);n=new t({...e,userAgentAppId:f,profile:d,region:g,requestHandler:C?c:void 0,logger:m})}const{Credentials:o,AssumedRoleUser:s}=await n.send(new x(i));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${i.RoleArn}`);const r=W(s),a={accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...r&&{accountId:r}};return r&&l(a,"RESOLVED_ACCOUNT_ID","T"),l(a,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),a}},h=e=>e?.metadata?.handlerProtocol==="h2",w=(e,t)=>t?class extends e{constructor(i){super(i);for(const o of t)this.middlewareStack.use(o)}}:e,oe=(e={},t)=>b(e,w(I,t));export{y as $Command,re as AssumeRoleCommand,x as AssumeRoleWithWebIdentityCommand,se as ExpiredTokenException,ae as IDPCommunicationErrorException,ce as IDPRejectedClaimException,le as InvalidIdentityTokenException,me as MalformedPolicyDocumentException,de as PackedPolicyTooLargeException,pe as RegionDisabledException,I as STSClient,ue as STSServiceException,ge as __Client,oe as getDefaultRoleAssumerWithWebIdentity};
